Skip to content

Conversation

@katzyn
Copy link
Contributor

@katzyn katzyn commented Aug 2, 2023

  1. 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, and icu4j libraries 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 unusual Packages.path syntax to Java.type("path") in documentation and test case, because Packages.path doesn'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.

  2. 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 only Thread.sleep(long).

There are two unrelated minor changes.

  1. Signature of Database.getMap() is changed to reflect the actual type of its result in modern versions of H2, with ConcurrentHashMap it 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.
  2. 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.

@katzyn katzyn merged commit 0bd2800 into h2database:master Aug 3, 2023
@katzyn katzyn deleted the new-java-fixes branch August 3, 2023 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant