[ https://issues.apache.org/jira/browse/SOLR-14579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17189086#comment-17189086 ]
Uwe Schindler commented on SOLR-14579: -------------------------------------- If you are interested, here is the implementation of a Bootstrap for lambdas in Elasticsearch's Painless (written by me), especially see the comment: [LambdaBootstrap lines 126-133|https://github.com/elastic/elasticsearch/blob/0a135a358e4736ee54d76bad0932cab1b5cc1a74/modules/lang-painless/src/main/java/org/elasticsearch/painless/LambdaBootstrap.java#L126-L133] If no captures are there: it's a singleton and the bootstrap code returns a method handle that: [LambdaBootstrap lines 481-491|https://github.com/elastic/elasticsearch/blob/0a135a358e4736ee54d76bad0932cab1b5cc1a74/modules/lang-painless/src/main/java/org/elasticsearch/painless/LambdaBootstrap.java#L481-L491]; you see it returns a {{ConstantCallSite}} always returning the same singleton created there with {{newInstance}}. You can check similar code in LambdaBootstraps code in the JDK, but those are doing a bit more magic, as Java is type-safe, while Elasticsearch Painless has more freedom of types (e.g. def type), so this is easier to read. > Comment SolrJ 'Utils' generic map functions > ------------------------------------------- > > Key: SOLR-14579 > URL: https://issues.apache.org/jira/browse/SOLR-14579 > Project: Solr > Issue Type: Improvement > Affects Versions: master (9.0) > Reporter: Megan Carey > Assignee: Erick Erickson > Priority: Minor > Fix For: 8.7 > > Attachments: SOLR-14579.patch > > Time Spent: 2h 50m > Remaining Estimate: 0h > > Remove the map functions like `NEW_HASHMAP_FUN` from the Utils class in solrj > module to reduce warnings and improve code quality. > [https://github.com/apache/lucene-solr/blob/master/solr/solrj/src/java/org/apache/solr/common/util/Utils.java#L92] -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org