RFR: 8337302: Undefined type variable results in null [v2]

Rafael Winterhalter winterhalter at openjdk.org
Mon Aug 12 23:10:48 UTC 2024


On Mon, 12 Aug 2024 13:51:25 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Rafael Winterhalter has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
>> 
>>   8337302: Undefined type variable results in null
>
> test/jdk/java/lang/reflect/Generics/TestMissingTypeVariable.java line 54:
> 
>> 52:         Class<?> missing = ByteCodeLoader.load("sample.MissingVariable", bytes);
>> 53:         try {
>> 54:             Type type = missing.getField("f").getGenericType();
> 
> Suggestion:
> 
>             Type type = missing.getDeclaredField("f").getGenericType();
> 
> This field is package-private, causing this test's failure.

I made the type and field public instead. I struggle a bit with OpenJDK and IntelliJ, so I modified my local test setup slightly. Should work now!

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20535#discussion_r1714459533


More information about the core-libs-dev mailing list