On Wed, 19 Feb 2025 16:19:22 GMT, Chen Liang <li...@openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/Class.java line 1287: >> >>> 1285: */ >>> 1286: public Class<?> getComponentType() { >>> 1287: // Only return for array types. Storage may be reused for >>> Class for instance types. >> >> I don't see any changes to componentType related to reuse. So was this >> comment and the code below already obsolete? > > It was. Before the componentType field was reused for the class > initialization monitor int array, and it caused problems with core reflection > if a program reflectively accesses this field after a few hundred times. See > [JDK-8337622](https://bugs.openjdk.org/browse/JDK-8337622). Yes, this comment is obsolete. We used to share the componentType mirror with an internal 'init-lock' but it caused a bug that was fixed. If it's not an array the componentType is now always null. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23572#discussion_r1962069719