RFR: 8368050: Validation missing in ClassFile signature factories [v3]
Chen Liang
liach at openjdk.org
Fri Sep 19 23:07:20 UTC 2025
On Fri, 19 Sep 2025 07:03:56 GMT, Adam Sotona <asotona at openjdk.org> wrote:
>> Chen Liang has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Fix links
>
> src/java.base/share/classes/java/lang/classfile/Signature.java line 246:
>
>> 244: *
>> 245: * @param outerType signature of the outer type, may be {@code null}
>> 246: * to indicate this is a top-level class or interface
>
> Actually here is the ambiguity. Null outer type is more than frequently used also for inner classes.
> Signatures of inner classes are mainly encoded without the outer type and with the $-notation of the outer$inner as the class name.
Clarified by introducing examples of signature strings and on the className/outerType.
> src/java.base/share/classes/jdk/internal/classfile/impl/ClassRemapperImpl.java line 312:
>
>> 310: Signature.ClassTypeSig.of(
>> 311: cts.outerType().map(this::mapSignature).orElse(null),
>> 312: Util.toInternalName(map(cts.classDesc())), // wrong, needs fix with InnerClasses
>
> Signatures of inner classes should be disambiguated to avoid this kind of confusions.
I aim to preserve the existing behavior for now. We can create a dedicated RFE to disambiguate for both here and InnerClasses later.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27380#discussion_r2364767064
PR Review Comment: https://git.openjdk.org/jdk/pull/27380#discussion_r2364765011
More information about the core-libs-dev
mailing list