On Tue, 11 Feb 2025 16:36:24 GMT, Chen Liang <li...@openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/classfile/constantpool/Utf8Entry.java 
>> line 95:
>> 
>>> 93:      * @since 25
>>> 94:      */
>>> 95:     boolean equalsSymbol(ClassDesc desc);
>> 
>> Ambiguity of class internal name vs. descriptor serialization might be 
>> confusing:
>> 
>> classEntry.equalsSymbol(classDesc) != 
>> classEntry.name().equalsSymbol(classDesc)
>> 
>> I think it should be more highlighted to avoid mistakes.
>
> I think the best way to avoid these confusions is, in addition to specifying 
> in the docs, renaming the methods on `Utf8Entry` to include the word 
> "descriptor", like `equalsDescriptorString`, but I fear this method name 
> might be too long.
> 
> If the `equalsDescriptorString` on `Utf8Entry` is too inconvenient, a remedy 
> may be to add `matches(String, ClassDesc)` or `matches(String, 
> MethodTypeDesc)` to NameAndTypeEntry and/or MemberRefEntry.

I think it is clearly OK to add the non-ambiguous methods, however this one 
probably should be brought to the mailing list for discussion. We already did 
some spins related to the ClassDesc serialization ambiguity in the API and 
there was never clear output. One of the option might be to exclude the 
ambiguous methods from this PR.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23548#discussion_r1951261649

Reply via email to