RFR: 8337302: Undefined type variable results in null

Chen Liang liach at openjdk.org
Mon Aug 12 00:54:40 UTC 2024


On Sun, 11 Aug 2024 22:25:40 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.

src/java.base/share/classes/java/lang/TypeNotPresentException.java line 37:

> 35:  * this exception is unchecked.
> 36:  *
> 37:  * <p>Note that this exception may be used when undefined type variables

Seems we can remove this note, now that we moved it to the last paragraph :)

test/jdk/java/lang/reflect/Generics/TestMissingTypeVariable.java line 40:

> 38: 
> 39:     public static void main(String[] args) throws Exception {
> 40:         ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_MAXS);

We currently use ClassFile API to quickly dump classes and there's a test infrastructure class `ByteCodeLoader` once you declare `@library /test/lib` jtreg directive. See example here: https://github.com/openjdk/jdk/pull/19281/files#diff-6407a097383e3239602ee0621dcf17e8a90ba2d990a4546e4ea4ff89ad9b89d5 Updated `TestBadSignatures.java`

P.S. accidentally commented on your commit instead of here as a review comment.

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

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


More information about the core-libs-dev mailing list