RFR: 8294982: Implementation of Classfile API [v15]
Adam Sotona
asotona at openjdk.org
Thu Feb 16 09:42:43 UTC 2023
On Fri, 10 Feb 2023 11:16:22 GMT, Adam Sotona <asotona at openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/classfile/constantpool/Utf8Entry.java line 47:
>>
>>> 45: * @param s the string to compare to
>>> 46: */
>>> 47: boolean equalsString(String s);
>>
>> Whatif the provided string contains character that are not representable in Utf8? Should we throw (e.g. `IllegalArgumentException`) ?
>
> I would rather expect `false` value returned, however this case is probably not covered by tests.
You almost got me, I had to think about it for a while :)
Any String is always representable in Utf8 (or modified Utf8 used in classfile).
It is completely valid to store even 4-byte Unicode characters in Utf8Entry and match them with (Utf16 encoded) String. I'll add such String to the existing test.
-------------
PR: https://git.openjdk.org/jdk/pull/10982
More information about the build-dev
mailing list