tada / pljava

PL/Java is a free add-on module that brings Java™ Stored Procedures, Triggers, Functions, Aggregates, Operators, Types, etc., to the PostgreSQL™ backend.
http://tada.github.io/pljava/
Other
242 stars 77 forks source link

Java 20 breaks `LexicalsTest.testSeparator` #435

Closed jcflack closed 1 year ago

jcflack commented 1 year ago

Until a solution for that, well, use Java 19 or earlier.

jcflack commented 1 year ago

Also breaks the DDRProcessor. Looks like they've changed what regular expressions mean.

jcflack commented 1 year ago

Submitted at bugreport.java.com as JI-9075361 published as JDK-8309515:

In addressing issue 8065554 (MatchResult should provide values of named-capturing groups), commit openjdk/jdk@ce85cac added a namedGroups field in Matcher to cache the map from parentPattern.namedGroups().

The map is lazily cached, only when the field is null and namedGroups() is called (which may be indirectly through a call of start(String), end(String), or group(String). The same cached value will then continue to be returned even if Matcher.usePattern is later called and the new Pattern has different named groups, or no named groups, or the same named groups mapped to different integers. Therefore, symptoms can include seeing the wrong results when retrieving by named groups, or spurious IllegalArgumentExceptions for groups that the new pattern provides, or exceptions not thrown for groups that the new pattern doesn't provide, or exceptions for an invalid group index when calling a method that takes a group name.

Could be fixed by eliminating the local copy and simply having Matcher.namedGroups() call parentPattern.namedGroups() unconditionally, or by having Matcher.usePattern simply null the field, so the correct map will be lazily cached when next needed.

jcflack commented 1 year ago

Resolved in 1.6.5 by detecting when affected by this bug and throwing an exception. The message advises to use either a version of Java earlier than 20, or a version recent enough to have JDK-8309515 fixed.