RFR: 8306729: Add nominal descriptors of modules and packages to Constants API [v3]

Adam Sotona asotona at openjdk.org
Tue Apr 25 07:55:09 UTC 2023


On Tue, 25 Apr 2023 07:38:41 GMT, Adam Sotona <asotona at openjdk.org> wrote:

> Note that other `*Impl` classes in `java.lang.constant` perform validation in their constructors and provide custom `toString()` formatting and they also don’t use records.

BTW: for example `ClassDesc:of(String name)` performs repeated validations and I see it as a performance bug.
`ClassDesc::of` calls `ConstantUtils::validateBinaryClassName`, then it performs conversion `binaryToInternal` and calls `ClassDesc::ofDescriptor`, which checks for `ConstantUtils::arrayDepth` and calls `ReferenceClassDescImpl::new`, which again performns validation by calling `ConstantUtils::skipOverFieldSignature` and checking the result. There is plenty of space for performance improvements here, as all the validation and conversion can be done in one pass only.

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

PR Comment: https://git.openjdk.org/jdk/pull/13615#issuecomment-1521326927


More information about the core-libs-dev mailing list