You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ResolvableType should support resolving lambda types [SPR-13698] #18273
in: coreIssues in core modules (aop, beans, core, context, expression)status: bulk-closedAn outdated, unresolved issue that's closed in bulk as part of a cleaning process
This helper library (itself inspired by Spring's GenericTypeResolver) seems to use an additional code path to use API introduced in Java 8 to resolve lambdas in a special way.
Indeed, we rejected in back then since the "API introduced in Java 8" is actually internal (sun.reflect.ConstantPool), and the entire approach is rather hacky, even relying on the index of entries in the constant pool... This is very likely to break on JDK 9 eventually, so I'm reluctant to add support for it at this point.
Maybe we should bring this up with the JDK team then, they might be able to fix this? I haven't looked deeply into the code but is there a particular reason the standard lookup algorithm doesn't work here? I just think it's kind of weird to see a lambda failing while the very same declaration works if you create the anonymous class. It basically subverts our "use Java 8 and everything will be better" message to some degree.
I just ran into this again with code that was expecting a Converter and I thought I could just hand in a lambda, which I couldn't as the called code was inspecting the given instance for generic types. I think that's the main issue with this one: for a user it's not at all obvious whether you can use a lambda with a SAM type or not.
in: coreIssues in core modules (aop, beans, core, context, expression)status: bulk-closedAn outdated, unresolved issue that's closed in bulk as part of a cleaning process
Activity
spring-projects-issues commentedon Nov 18, 2015
Stéphane Nicoll commented
I thought we had already such report (with a lengthy discussion with thomas.darimont) but I can't find it anymore
spring-projects-issues commentedon Nov 23, 2015
Juergen Hoeller commented
Indeed, we rejected in back then since the "API introduced in Java 8" is actually internal (
sun.reflect.ConstantPool), and the entire approach is rather hacky, even relying on the index of entries in the constant pool... This is very likely to break on JDK 9 eventually, so I'm reluctant to add support for it at this point.Juergen
spring-projects-issues commentedon Nov 23, 2015
Oliver Drotbohm commented
Maybe we should bring this up with the JDK team then, they might be able to fix this? I haven't looked deeply into the code but is there a particular reason the standard lookup algorithm doesn't work here? I just think it's kind of weird to see a lambda failing while the very same declaration works if you create the anonymous class. It basically subverts our "use Java 8 and everything will be better" message to some degree.
spring-projects-issues commentedon Dec 18, 2015
Oliver Drotbohm commented
I just ran into this again with code that was expecting a
Converterand I thought I could just hand in a lambda, which I couldn't as the called code was inspecting the given instance for generic types. I think that's the main issue with this one: for a user it's not at all obvious whether you can use a lambda with a SAM type or not.spring-projects-issues commentedon Jul 11, 2018
Oliver Drotbohm commented
For reference, here's the discussion I had with the JDK team: http://mail.openjdk.java.net/pipermail/compiler-dev/2016-December/010623.html
spring-projects-issues commentedon Jan 12, 2019
Bulk closing outdated, unresolved issues. Please, reopen if still relevant.