On Fri, 20 Jan 2023 01:56:16 GMT, Stuart Marks <sma...@openjdk.org> wrote:
>> Okay, I see your point and to use apiNote consistently would require >> "converting" some of the existing text to apiNote too. >> >> I'm still mulling over Pattern.compile throwing OOME. An implNote is >> probably the right category for this, in which case it can start with "In >> the the JDK Reference Implementation ...". I assume the static >> Pattern.matches needs same, and also Pattern.matcher for the lazy >> compilation case. > > @AlanBateman > > I had previously discussed with @rgiulietti whether OOME or > PatternSyntaxException was more appropriate. The issue is that you might try > to compile a pattern that contains a character with N combining diacritics, > and it might work fine. But if you change that character to have N+1 > combining diacritics, it might throw OOME. There's no syntax difference, but > rather the issue is hitting an internal implementation limit. > > There's a bit of a precedent for throwing OOME in such cases. Various places > in the library try to grow arrays. If the required array size is greater than > MAX_VALUE, the library pre-emptively throws OOME without even trying to > allocate the array. > "In the the JDK Reference Implementation ..." I'm still not sure of the right style for the JDK to refer to itself. This is really the "Java SE Reference Implementation". Or perhaps it should just be "OpenJDK". Regardless, this kind of wording would stick out in a funny way, as it's not used very frequently. I'm content not having such a preamble. Having the text within `@implNote` is probably sufficient. ------------- PR: https://git.openjdk.org/jdk/pull/12027