You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Erick Erickson <er...@gmail.com> on 2018/08/14 18:55:38 UTC

precommit failure

OK, so I'm trying to get modern and used the following construct to
initialize a map:

static final Map<TEST_TYPE, String> solrClassMap =
Collections.unmodifiableMap(Stream.of(
    new SimpleEntry<>(TEST_TYPE.TINT, "solr.TrieIntField"),
    new SimpleEntry<>(TEST_TYPE.BOOL, "solr.BoolField"))
    .collect(Collectors.toMap((e) -> e.getKey(), (e) -> e.getValue())));

This compiles and runs just fine, but fails the precommit step
with:"Type mismatch: cannot convert from Map<Object,Object> to
Map<TestFieldType.TEST_TYPE,String>" (See below).

Seems like a bogus failure on ejc-lint? Any workarounds you can recommend?


 [ecj-lint] static final Map<TEST_TYPE, String> solrClassMap =
Collections.unmodifiableMap(Stream.of(
 [ecj-lint]       new SimpleEntry<>(TEST_TYPE.TINT, "solr.TrieIntField"),
 [ecj-lint]       new SimpleEntry<>(TEST_TYPE.BOOL, "solr.BoolField"))
 [ecj-lint]       .collect(Collectors.toMap((e) -> e.getKey(), (e) ->
e.getValue())));
 [ecj-lint]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 [ecj-lint] Type mismatch: cannot convert from Map<Object,Object> to
Map<TestFieldType.TEST_TYPE,String>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


RE: precommit failure

Posted by Uwe Schindler <uw...@thetaphi.de>.
Hi,

> To be sure we're talking about the same thing, your preferred
> initialization looks like this?
> 
> static final Map<TEST_TYPE, String> solrClassMap =
> Collections.unmodifiableMap(Stream.of(
>     new SimpleEntry<>(TEST_TYPE.TINT, "solr.TrieIntField"),
> 
>     new SimpleEntry<>(TEST_TYPE.BOOL, "solr.BoolField"))
>     .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)));
> 
> BTW, why do you consider inline lambdas horrible? Not disagreeing,
> just wondering whether it's a functional problem or what to add to my
> knowledge store.

Yes, that looks better...

> And I assumed that this _was_ unmodifiable given it starts with
> "Collections.unmodifiableMap".

Sorry was on mobile phone and did not see the unmodifiableMap.

We should maybe add a "TODO" at those constructs to upgrade them to the much better and elegant Map.of() once we switch master to Java 9/10/11.

Uwe



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: precommit failure

Posted by Erick Erickson <er...@gmail.com>.
Robert:

Thanks, upgrading the ecj compiler to 4.6.1 did the trick. I'll open a
separate Lucene JIRA for upgrading. FWIW both my original construct
and the one below failed precommit under 4.4.1. Didn't test the older
way I was initializing under 4.6.1, but the one below works both
code-wise and precommit so it looks like upgrading is in order.


Uwe:

To be sure we're talking about the same thing, your preferred
initialization looks like this?

static final Map<TEST_TYPE, String> solrClassMap =
Collections.unmodifiableMap(Stream.of(
    new SimpleEntry<>(TEST_TYPE.TINT, "solr.TrieIntField"),

    new SimpleEntry<>(TEST_TYPE.BOOL, "solr.BoolField"))
    .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)));

BTW, why do you consider inline lambdas horrible? Not disagreeing,
just wondering whether it's a functional problem or what to add to my
knowledge store.

And I assumed that this _was_ unmodifiable given it starts with
"Collections.unmodifiableMap".

Thanks,
Erick

On Tue, Aug 14, 2018 at 1:24 PM, Uwe Schindler <uw...@thetaphi.de> wrote:
> ...and the inline lambdas are horrible. You'd should use a method reference,
> because that's how those key and value mappers should be used.
>
>
> Am August 14, 2018 8:19:21 PM UTC schrieb Uwe Schindler <uw...@thetaphi.de>:
>>
>> You have to be careful with this construct anyways, as the resulting map
>> is modifiable. You'd need to make it unmodifiable afterwards.
>>
>> Uwe
>>
>> Am August 14, 2018 8:00:24 PM UTC schrieb Erick Erickson
>> <er...@gmail.com>:
>>>
>>> Robert:
>>>
>>> I'll give it a shot, thanks! It'll be this evening before I can report
>>> back though.
>>>
>>> Erick
>>>
>>> On Tue, Aug 14, 2018 at 12:03 PM, Robert Muir <rc...@gmail.com> wrote:
>>>>
>>>>  ecj compiler is loaded from the common-build here:
>>>>
>>>> https://github.com/apache/lucene-solr/blob/master/lucene/common-build.xml#L2099
>>>>
>>>>  Looks like the compiler is a little out of date: it uses 4.4.1 but
>>>>  looking at maven it seems 4.6.1 is the latest one. Maybe try bumping
>>>>  it to see if it addresses your issue?
>>>>
>>>>  On Tue, Aug 14, 2018 at 2:55 PM, Erick Erickson
>>>> <er...@gmail.com> wrote:
>>>>>
>>>>>  OK, so I'm trying to get modern and used the following construct to
>>>>>  initialize a map:
>>>>>
>>>>>  static final Map<TEST_TYPE, String> solrClassMap =
>>>>>  Collections.unmodifiableMap(Stream.of(
>>>>>      new SimpleEntry<>(TEST_TYPE.TINT, "solr.TrieIntField"),
>>>>>      new SimpleEntry<>(TEST_TYPE.BOOL, "solr.BoolField"))
>>>>>      .collect(Collectors.toMap((e) -> e.getKey(), (e) ->
>>>>> e.getValue())));
>>>>>
>>>>>  This compiles and runs just fine, but fails the precommit step
>>>>>  with:"Type mismatch: cannot convert from Map<Object,Object> to
>>>>>  Map<TestFieldType.TEST_TYPE,String>" (See below).
>>>>>
>>>>>  Seems like a bogus failure on ejc-lint? Any workarounds you can
>>>>> recommend?
>>>>>
>>>>>
>>>>>   [ecj-lint] static final Map<TEST_TYPE, String> solrClassMap =
>>>>>  Collections.unmodifiableMap(Stream.of(
>>>>>   [ecj-lint]       new SimpleEntry<>(TEST_TYPE.TINT,
>>>>> "solr.TrieIntField"),
>>>>>   [ecj-lint]       new SimpleEntry<>(TEST_TYPE.BOOL, "solr.BoolField"))
>>>>>   [ecj-lint]       .collect(Collectors.toMap((e) -> e.getKey(), (e) ->
>>>>>  e.getValue())));
>>>>>   [ecj-lint]
>>>>>
>>>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>>>   [ecj-lint] Type mismatch: cannot convert from Map<Object,Object> to
>>>>>  Map<TestFieldType.TEST_TYPE,String>
>>>>>
>>>>> ________________________________
>>>>>
>>>>>  To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>>>>>  For additional commands, e-mail: dev-help@lucene.apache.org
>>>>
>>>>
>>>>
>>>> ________________________________
>>>>
>>>>  To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>>>>  For additional commands, e-mail: dev-help@lucene.apache.org
>>>
>>>
>>>
>>> ________________________________
>>>
>>> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>>> For additional commands, e-mail: dev-help@lucene.apache.org
>>>
>>
>> --
>> Uwe Schindler
>> Achterdiek 19, 28357 Bremen
>> https://www.thetaphi.de
>
>
> --
> Uwe Schindler
> Achterdiek 19, 28357 Bremen
> https://www.thetaphi.de

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: precommit failure

Posted by Uwe Schindler <uw...@thetaphi.de>.
...and the inline lambdas are horrible. You'd should use a method reference, because that's how those key and value mappers should be used.

Am August 14, 2018 8:19:21 PM UTC schrieb Uwe Schindler <uw...@thetaphi.de>:
>You have to be careful with this construct anyways, as the resulting
>map is modifiable. You'd need to make it unmodifiable afterwards.
>
>Uwe
>
>Am August 14, 2018 8:00:24 PM UTC schrieb Erick Erickson
><er...@gmail.com>:
>>Robert:
>>
>>I'll give it a shot, thanks! It'll be this evening before I can report
>>back though.
>>
>>Erick
>>
>>On Tue, Aug 14, 2018 at 12:03 PM, Robert Muir <rc...@gmail.com>
>wrote:
>>> ecj compiler is loaded from the common-build here:
>>>
>>https://github.com/apache/lucene-solr/blob/master/lucene/common-build.xml#L2099
>>>
>>> Looks like the compiler is a little out of date: it uses 4.4.1 but
>>> looking at maven it seems 4.6.1 is the latest one. Maybe try bumping
>>> it to see if it addresses your issue?
>>>
>>> On Tue, Aug 14, 2018 at 2:55 PM, Erick Erickson
>><er...@gmail.com> wrote:
>>>> OK, so I'm trying to get modern and used the following construct to
>>>> initialize a map:
>>>>
>>>> static final Map<TEST_TYPE, String> solrClassMap =
>>>> Collections.unmodifiableMap(Stream.of(
>>>>     new SimpleEntry<>(TEST_TYPE.TINT, "solr.TrieIntField"),
>>>>     new SimpleEntry<>(TEST_TYPE.BOOL, "solr.BoolField"))
>>>>     .collect(Collectors.toMap((e) -> e.getKey(), (e) ->
>>e.getValue())));
>>>>
>>>> This compiles and runs just fine, but fails the precommit step
>>>> with:"Type mismatch: cannot convert from Map<Object,Object> to
>>>> Map<TestFieldType.TEST_TYPE,String>" (See below).
>>>>
>>>> Seems like a bogus failure on ejc-lint? Any workarounds you can
>>recommend?
>>>>
>>>>
>>>>  [ecj-lint] static final Map<TEST_TYPE, String> solrClassMap =
>>>> Collections.unmodifiableMap(Stream.of(
>>>>  [ecj-lint]       new SimpleEntry<>(TEST_TYPE.TINT,
>>"solr.TrieIntField"),
>>>>  [ecj-lint]       new SimpleEntry<>(TEST_TYPE.BOOL,
>>"solr.BoolField"))
>>>>  [ecj-lint]       .collect(Collectors.toMap((e) -> e.getKey(), (e)
>>->
>>>> e.getValue())));
>>>>  [ecj-lint]
>>>>
>>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>>  [ecj-lint] Type mismatch: cannot convert from Map<Object,Object>
>to
>>>> Map<TestFieldType.TEST_TYPE,String>
>>>>
>>>>
>>---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>>>> For additional commands, e-mail: dev-help@lucene.apache.org
>>>>
>>>
>>>
>---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>>> For additional commands, e-mail: dev-help@lucene.apache.org
>>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>>For additional commands, e-mail: dev-help@lucene.apache.org
>
>--
>Uwe Schindler
>Achterdiek 19, 28357 Bremen
>https://www.thetaphi.de

--
Uwe Schindler
Achterdiek 19, 28357 Bremen
https://www.thetaphi.de

Re: precommit failure

Posted by Uwe Schindler <uw...@thetaphi.de>.
You have to be careful with this construct anyways, as the resulting map is modifiable. You'd need to make it unmodifiable afterwards.

Uwe

Am August 14, 2018 8:00:24 PM UTC schrieb Erick Erickson <er...@gmail.com>:
>Robert:
>
>I'll give it a shot, thanks! It'll be this evening before I can report
>back though.
>
>Erick
>
>On Tue, Aug 14, 2018 at 12:03 PM, Robert Muir <rc...@gmail.com> wrote:
>> ecj compiler is loaded from the common-build here:
>>
>https://github.com/apache/lucene-solr/blob/master/lucene/common-build.xml#L2099
>>
>> Looks like the compiler is a little out of date: it uses 4.4.1 but
>> looking at maven it seems 4.6.1 is the latest one. Maybe try bumping
>> it to see if it addresses your issue?
>>
>> On Tue, Aug 14, 2018 at 2:55 PM, Erick Erickson
><er...@gmail.com> wrote:
>>> OK, so I'm trying to get modern and used the following construct to
>>> initialize a map:
>>>
>>> static final Map<TEST_TYPE, String> solrClassMap =
>>> Collections.unmodifiableMap(Stream.of(
>>>     new SimpleEntry<>(TEST_TYPE.TINT, "solr.TrieIntField"),
>>>     new SimpleEntry<>(TEST_TYPE.BOOL, "solr.BoolField"))
>>>     .collect(Collectors.toMap((e) -> e.getKey(), (e) ->
>e.getValue())));
>>>
>>> This compiles and runs just fine, but fails the precommit step
>>> with:"Type mismatch: cannot convert from Map<Object,Object> to
>>> Map<TestFieldType.TEST_TYPE,String>" (See below).
>>>
>>> Seems like a bogus failure on ejc-lint? Any workarounds you can
>recommend?
>>>
>>>
>>>  [ecj-lint] static final Map<TEST_TYPE, String> solrClassMap =
>>> Collections.unmodifiableMap(Stream.of(
>>>  [ecj-lint]       new SimpleEntry<>(TEST_TYPE.TINT,
>"solr.TrieIntField"),
>>>  [ecj-lint]       new SimpleEntry<>(TEST_TYPE.BOOL,
>"solr.BoolField"))
>>>  [ecj-lint]       .collect(Collectors.toMap((e) -> e.getKey(), (e)
>->
>>> e.getValue())));
>>>  [ecj-lint]
>>>
>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>  [ecj-lint] Type mismatch: cannot convert from Map<Object,Object> to
>>> Map<TestFieldType.TEST_TYPE,String>
>>>
>>>
>---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>>> For additional commands, e-mail: dev-help@lucene.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: dev-help@lucene.apache.org
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>For additional commands, e-mail: dev-help@lucene.apache.org

--
Uwe Schindler
Achterdiek 19, 28357 Bremen
https://www.thetaphi.de

Re: precommit failure

Posted by Erick Erickson <er...@gmail.com>.
Robert:

I'll give it a shot, thanks! It'll be this evening before I can report
back though.

Erick

On Tue, Aug 14, 2018 at 12:03 PM, Robert Muir <rc...@gmail.com> wrote:
> ecj compiler is loaded from the common-build here:
> https://github.com/apache/lucene-solr/blob/master/lucene/common-build.xml#L2099
>
> Looks like the compiler is a little out of date: it uses 4.4.1 but
> looking at maven it seems 4.6.1 is the latest one. Maybe try bumping
> it to see if it addresses your issue?
>
> On Tue, Aug 14, 2018 at 2:55 PM, Erick Erickson <er...@gmail.com> wrote:
>> OK, so I'm trying to get modern and used the following construct to
>> initialize a map:
>>
>> static final Map<TEST_TYPE, String> solrClassMap =
>> Collections.unmodifiableMap(Stream.of(
>>     new SimpleEntry<>(TEST_TYPE.TINT, "solr.TrieIntField"),
>>     new SimpleEntry<>(TEST_TYPE.BOOL, "solr.BoolField"))
>>     .collect(Collectors.toMap((e) -> e.getKey(), (e) -> e.getValue())));
>>
>> This compiles and runs just fine, but fails the precommit step
>> with:"Type mismatch: cannot convert from Map<Object,Object> to
>> Map<TestFieldType.TEST_TYPE,String>" (See below).
>>
>> Seems like a bogus failure on ejc-lint? Any workarounds you can recommend?
>>
>>
>>  [ecj-lint] static final Map<TEST_TYPE, String> solrClassMap =
>> Collections.unmodifiableMap(Stream.of(
>>  [ecj-lint]       new SimpleEntry<>(TEST_TYPE.TINT, "solr.TrieIntField"),
>>  [ecj-lint]       new SimpleEntry<>(TEST_TYPE.BOOL, "solr.BoolField"))
>>  [ecj-lint]       .collect(Collectors.toMap((e) -> e.getKey(), (e) ->
>> e.getValue())));
>>  [ecj-lint]
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>  [ecj-lint] Type mismatch: cannot convert from Map<Object,Object> to
>> Map<TestFieldType.TEST_TYPE,String>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: dev-help@lucene.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: precommit failure

Posted by Robert Muir <rc...@gmail.com>.
ecj compiler is loaded from the common-build here:
https://github.com/apache/lucene-solr/blob/master/lucene/common-build.xml#L2099

Looks like the compiler is a little out of date: it uses 4.4.1 but
looking at maven it seems 4.6.1 is the latest one. Maybe try bumping
it to see if it addresses your issue?

On Tue, Aug 14, 2018 at 2:55 PM, Erick Erickson <er...@gmail.com> wrote:
> OK, so I'm trying to get modern and used the following construct to
> initialize a map:
>
> static final Map<TEST_TYPE, String> solrClassMap =
> Collections.unmodifiableMap(Stream.of(
>     new SimpleEntry<>(TEST_TYPE.TINT, "solr.TrieIntField"),
>     new SimpleEntry<>(TEST_TYPE.BOOL, "solr.BoolField"))
>     .collect(Collectors.toMap((e) -> e.getKey(), (e) -> e.getValue())));
>
> This compiles and runs just fine, but fails the precommit step
> with:"Type mismatch: cannot convert from Map<Object,Object> to
> Map<TestFieldType.TEST_TYPE,String>" (See below).
>
> Seems like a bogus failure on ejc-lint? Any workarounds you can recommend?
>
>
>  [ecj-lint] static final Map<TEST_TYPE, String> solrClassMap =
> Collections.unmodifiableMap(Stream.of(
>  [ecj-lint]       new SimpleEntry<>(TEST_TYPE.TINT, "solr.TrieIntField"),
>  [ecj-lint]       new SimpleEntry<>(TEST_TYPE.BOOL, "solr.BoolField"))
>  [ecj-lint]       .collect(Collectors.toMap((e) -> e.getKey(), (e) ->
> e.getValue())));
>  [ecj-lint]
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>  [ecj-lint] Type mismatch: cannot convert from Map<Object,Object> to
> Map<TestFieldType.TEST_TYPE,String>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org