Skip to content

Commit 0403d12

Browse files
yrodierebeikov
authored andcommitted
Move setting of net.bytebuddy.experimental to the Jenkinsfile
The hope is that whenever we add a new JDK version to test, we'll notice this setting, will try to remove it and upgrade bytebuddy if necessary. This would avoid mess-ups like the one that caused #7790
1 parent 9f3676d commit 0403d12

File tree

4 files changed

+5
-28
lines changed

4 files changed

+5
-28
lines changed

Jenkinsfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ stage('Configure') {
4949
new BuildEnvironment( testJdkVersion: '20', testJdkLauncherArgs: '--enable-preview' ),
5050
new BuildEnvironment( testJdkVersion: '21', testJdkLauncherArgs: '--enable-preview' ),
5151
new BuildEnvironment( testJdkVersion: '22', testJdkLauncherArgs: '--enable-preview' ),
52-
new BuildEnvironment( testJdkVersion: '23', testJdkLauncherArgs: '--enable-preview' )
52+
// The following JDKs aren't supported by Hibernate ORM out-of-the box yet:
53+
// they require the use of -Dnet.bytebuddy.experimental=true.
54+
// Make sure to remove that argument as soon as possible
55+
// -- generally that requires upgrading bytebuddy after the JDK goes GA.
56+
new BuildEnvironment( testJdkVersion: '23', testJdkLauncherArgs: '--enable-preview -Dnet.bytebuddy.experimental=true' )
5357
];
5458

5559
if ( env.CHANGE_ID ) {

gradle/java-module.gradle

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -294,21 +294,6 @@ test {
294294
jvmArgs '-XX:+StartAttachListener'
295295
}
296296

297-
// Enable the experimental features of ByteBuddy with JDK 22+
298-
test {
299-
// We need to test the *launcher* version,
300-
// because some tests will use Mockito (and thus Bytebuddy) to mock/spy
301-
// classes that are part of the JDK,
302-
// and those classes always have bytecode matching the version of the launcher.
303-
// So for example, when using a JDK22 launcher and compiling tests with --release 21,
304-
// Bytebuddy will still encounter classes with Java 22 bytecode.
305-
if ( jdkVersions.test.launcher.asInt() >= 22 ) {
306-
logger.warn( "The version of Java bytecode that will be tested is not supported by Bytebuddy by default. " +
307-
" Setting 'net.bytebuddy.experimental=true'." )
308-
systemProperty 'net.bytebuddy.experimental', true
309-
}
310-
}
311-
312297
test {
313298
if ( project.findProperty( 'log-test-progress' )?.toString()?.toBoolean() ) {
314299
// Log a statement for each test.

hibernate-core/hibernate-core.gradle

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,12 +298,6 @@ if ( jdkVersions.test.release.asInt() >= 17 && jdkVersions.explicit ) {
298298
useJUnitPlatform()
299299
testClassesDirs = sourceSets.testJava17.output.classesDirs
300300
classpath = sourceSets.testJava17.runtimeClasspath
301-
302-
if ( jdkVersions.test.launcher.asInt() >= 19 ) {
303-
logger.warn( "The version of Java bytecode that will be tested is not supported by Byte Buddy by default. " +
304-
" Setting 'net.bytebuddy.experimental=true'." )
305-
systemProperty 'net.bytebuddy.experimental', true
306-
}
307301
}
308302

309303
testClasses.dependsOn compileTestJava17Java

tooling/metamodel-generator/hibernate-jpamodelgen.gradle

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,6 @@ if ( jdkVersions.test.release.asInt() >= 17 && jdkVersions.explicit ) {
6161
javaLauncher = javaToolchains.launcherFor {
6262
languageVersion = jdkVersions.test.launcher
6363
}
64-
65-
if ( jdkVersions.test.launcher.asInt() >= 19 ) {
66-
logger.warn( "The version of Java bytecode that will be tested is not supported by Bytebuddy by default. " +
67-
" Setting 'net.bytebuddy.experimental=true'." )
68-
systemProperty 'net.bytebuddy.experimental', true
69-
}
7064
}
7165
} else {
7266
sourceSets {

0 commit comments

Comments
 (0)