Created
June 8, 2022 19:57
-
-
Save dweiss/d77452c52daa178e041adce145c2e86a to your computer and use it in GitHub Desktop.
javac and generic type information lost on jdk11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Map; | |
import java.util.concurrent.Callable; | |
public class Oddball { | |
public static void main(String[] args) throws Exception { | |
Callable<Void> r = | |
() -> { | |
class Foo1 { | |
public Map<String, Integer> field; | |
} | |
System.out.println("Foo1.field type: " + Foo1.class.getField("field").getGenericType()); | |
return null; | |
}; | |
r.call(); | |
r = | |
new Callable<Void>() { | |
@Override | |
public Void call() throws Exception { | |
class Foo2 { | |
public Map<String, Integer> field; | |
} | |
System.out.println("Foo2.field type: " + Foo2.class.getField("field").getGenericType()); | |
return null; | |
} | |
}; | |
r.call(); | |
class Foo3 { | |
public Map<String, Integer> field; | |
} | |
System.out.println("Foo3.field type: " + Foo3.class.getField("field").getGenericType()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment