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
which creates an anonymous class C of a generic class ...
which captures a type variable from M
In that case reflection erroneously returns null as type argument for C.
If any of the above is changed, e.g. not using a lambda, or not using a local class, then it looks like this cannot be reproduced.
Have reported this for the Eclipse compiler because the same code seems to work as expected when compiling and running using JDK 17 (though same error occurs with JDK 11, see JDK-8306438). But maybe this is actually a bug in the Java reflection library.
Reproduction steps
Create a file called Test.java with the following content
srikanth-sankaran
changed the title
[Compiler] Reflection returns null for lambda capturing local method type variable
[Compiler] Reflection fails due to class file's EnclosingMethod attribute incorrectly pointing to lambda implementation
May 18, 2023
Version
Eclipse Compiler 3.33.0
(Maven:
org.eclipse.jdt:ecj:3.33.0
)Description
Preconditions:
In that case reflection erroneously returns
null
as type argument for C.If any of the above is changed, e.g. not using a lambda, or not using a local class, then it looks like this cannot be reproduced.
Have reported this for the Eclipse compiler because the same code seems to work as expected when compiling and running using JDK 17 (though same error occurs with JDK 11, see JDK-8306438). But maybe this is actually a bug in the Java reflection library.
Reproduction steps
Test.java
with the following contentAssertionError: Unexpected type: null
The text was updated successfully, but these errors were encountered: