On Tue, 17 Jan 2023 12:23:25 GMT, Alan Bateman <al...@openjdk.org> wrote:
>> The choice of a `<p>` paragraph rather than `@apiNote` is for consistency >> with similar commentary paragraphs in the specs of `CASE_INSENSITIVE`, >> `UNICODE_CASE`, and `UNICODE_CHARACTER_CLASS`. >> >> I have no problems in using `@apiNote` instead, but then it would be better >> to apply the same for the other mentioned flags as well. > > 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. ------------- PR: https://git.openjdk.org/jdk/pull/12027