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

Chen Liang liach at openjdk.org
Mon Aug 12 13:54:39 UTC 2024


On Mon, 12 Aug 2024 07:31:09 GMT, Rafael Winterhalter <winterhalter at openjdk.org> wrote:

>> When a type uses a type variable without a declaration, no exception is thrown. This change triggers a `TypeNotFoundException` to be thrown.
>
> 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.

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

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


More information about the core-libs-dev mailing list