Fix issues with newer JVMs #3854
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Modern versions of JRE and JDK don't have a JavaScript engine, but Graal.JS can be installed.
js-scriptengine,js,graal-sdk,truffle-api, andicu4jlibraries are required. H2 allows JavaScript triggers for a some reason. Graal.JS is more restrictive than Nashorn and it needs an additional configuration, with these changes H2 adds this configuration if Graal.JS is detected. I also changed unusualPackages.pathsyntax toJava.type("path")in documentation and test case, becausePackages.pathdoesn't work in Graal.JS (at least without additional compatibility modules), unlike more popular syntax. Test case is now disabled automatically if JVM doesn't have any implementation of JavaScript.There are two single-argument overloads of
Thread.sleep()since Java 19, so it isn't possible to create a generic alias for all its overloads, two tests are fixed to load onlyThread.sleep(long).There are two unrelated minor changes.
Database.getMap()is changed to reflect the actual type of its result in modern versions of H2, withConcurrentHashMapit is more clear that users of this method can use only locks on metadata in the future, a lock on the whole database isn't strictly required.Database.getTempTableName()is not synchronized on the whole database any more, it only needs an atomic counter to avoid generation of the same name for two concurrent sessions.