RFR: JDK-8281671: Class.getCanonicalName spec should explicitly cover array classes

Mandy Chung mchung at openjdk.java.net
Wed Feb 16 20:25:12 UTC 2022


On Tue, 15 Feb 2022 22:23:36 GMT, Joe Darcy <darcy at openjdk.org> wrote:

> Add explicit discussion of array types to Class.getCanonicalName, no change in behavior.
> 
> I didn't see any existing regression tests for the various "getFooName" methods of Class so I created a new test file for a handful of test cases.
> 
> Please also review the corresponding CSR: https://bugs.openjdk.java.net/browse/JDK-8281922

Marked as reviewed by mchung (Reviewer).

test/jdk/java/lang/Class/NameTest.java line 27:

> 25:  * @test
> 26:  * @bug 8281671
> 27:  * @summary Checks on various "getFooName" methods of java.lang.Class

This tests only `getCanonicalName` method.

test/jdk/java/lang/Class/NameTest.java line 56:

> 54:         expectedCanonicalName.put(int.class,              "int");
> 55:         expectedCanonicalName.put(Object.class,           "java.lang.Object");
> 56:         expectedCanonicalName.put(objectArray.getClass(), "java.lang.Object[]");

Just an observation: TestNG is a good option to clearly show the data provider and the test body.  Up to you.

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

PR: https://git.openjdk.java.net/jdk/pull/7483


More information about the core-libs-dev mailing list