Skip to content

Commit

Permalink
HHH-15107 Use net.bytebuddy.experimental=true when running tests agai…
Browse files Browse the repository at this point in the history
…nst JDK19
  • Loading branch information
yrodiere committed Mar 9, 2022
1 parent a88170d commit 5eb8a6f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gradle/java-module.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,13 @@ test {

// Enable the experimental features of ByteBuddy with JDK 19+
test {
if ( gradle.ext.javaVersions.test.release.asInt() >= 19 ) {
// We need to test the *launcher* version,
// because some tests will use Mockito (and thus Bytebuddy) to mock/spy
// classes that are part of the JDK,
// and those classes always have bytecode matching the version of the launcher.
// So for example, when using a JDK19 launcher and compiling tests with --release 17,
// Bytebuddy will still encounter classes with Java 19 bytecode.
if ( gradle.ext.javaVersions.test.launcher.asInt() >= 19 ) {
logger.warn( "The version of Java bytecode that will be tested is not supported by Bytebuddy by default. " +
" Setting 'net.bytebuddy.experimental=true'." )
systemProperty 'net.bytebuddy.experimental', true
Expand Down

0 comments on commit 5eb8a6f

Please sign in to comment.