RFR: 8333749: Consolidate ConstantDesc conversion in java.base [v2]
Chen Liang
liach at openjdk.org
Thu Jun 6 19:46:47 UTC 2024
On Thu, 6 Jun 2024 19:09:36 GMT, Claes Redestad <redestad at openjdk.org> wrote:
> There are some pre-existing places where we call `ReferenceClassDescImpl.ofValidated` directly that could probably be switched over to `ConstantUtils.classDesc` for slightly nicer code. Or - if it matters - add a `referenceClassDesc` which avoids the `type.isPrimitive` test.
I think the main advantage of `ofValidated` is that it avoids descriptor string computation from class objects and should be kept in performance-sensitive code.
`referenceClassDesc` would be feasible for less performance-demanding code's initialization and known safe conversions (a few APIs in CF API expects non-primitive CDs already). But should its implementation be `ofValidated` or `ofValidatedBinaryName` (same question for ClassDesc)? We used `ofValidatedBinaryName` here instead of a `toClassDesc` (which calls `ofValidated` via `descriptorString`)
-------------
PR Comment: https://git.openjdk.org/jdk/pull/19585#issuecomment-2153281690
More information about the core-libs-dev
mailing list