lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erick Erickson <erickerick...@gmail.com>
Subject Re: precommit failure
Date Tue, 14 Aug 2018 22:05:16 GMT
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 <uwe@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 <uwe@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
>> <erickerickson@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 <rcmuir@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
>>>> <erickerickson@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


Mime
View raw message