...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 <[email protected]>: >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 ><[email protected]>: >>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 <[email protected]> >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 >><[email protected]> 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: [email protected] >>>> For additional commands, e-mail: [email protected] >>>> >>> >>> >--------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >>> >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: [email protected] >>For additional commands, e-mail: [email protected] > >-- >Uwe Schindler >Achterdiek 19, 28357 Bremen >https://www.thetaphi.de -- Uwe Schindler Achterdiek 19, 28357 Bremen https://www.thetaphi.de
