RFR: 8343437: ClassDesc.of incorrectly permitting empty names

Mandy Chung mchung at openjdk.org
Fri Nov 1 16:55:27 UTC 2024


On Fri, 1 Nov 2024 13:58:01 GMT, Chen Liang <liach at openjdk.org> wrote:

> An oversight in the patch for [JDK-8338544](https://bugs.openjdk.org/browse/JDK-8338544) #20665 caused `ClassDesc` to incorrectly accept empty strings as binary names.  This patch fixes that problem, and unifies the checks for package and class nominal descriptors.

Please describe where the bug was caused and also record the evaluation explaining the cause in the issue.    Here is one part I understand for your reference.

One of the causes is that the refactoring done by JDK-8338544 converts the explicit check of the return value from `ConstantUtils::skipOverFieldSignature` called by `ClassOrInterfaceDescImpl::ofValidated` to `assert`.    The refactoring was hard to review.   So `validateBinaryClassName` only validates the binary name.  Prior to JDK-8338544, the implementation expects more validations performed from `ClassDesc::ofDescriptor`.

I think it requires a thorough understanding of what being validated before JDK-8338544 to see if anything else is missing.

I am not sure what validation of package name is regressed.  Please also explain.

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

PR Comment: https://git.openjdk.org/jdk/pull/21830#issuecomment-2452218010


More information about the core-libs-dev mailing list