Disable bytecode enhancement for documentation module as well as the test that makes use of this feature if the JDK version is 1.9

This commit is contained in:
Vlad Mihalcea 2016-09-20 18:23:45 +03:00
parent 2b30cabf2f
commit bd8c3c226d
3 changed files with 16 additions and 3 deletions

View File

@ -32,9 +32,12 @@ apply from: "${rootProject.projectDir}/utilities.gradle"
apply plugin: 'org.hibernate.orm'
hibernate {
enhance {
enableLazyInitialization = true
// Java 9 ftw!
if ( !JavaVersion.current().isJava9Compatible() ) {
hibernate {
enhance {
enableLazyInitialization = true
}
}
}

View File

@ -16,6 +16,7 @@
import org.hibernate.userguide.model.Image;
import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.Skip;
import org.hibernate.test.util.jdbc.PreparedStatementSpyConnectionProvider;
import org.junit.Test;
@ -60,6 +61,7 @@ public void releaseResources() {
}
@Test
@Skip(condition = Skip.JdkVersion._1_9.class, message = "On Java 1.9, bytecode enhancement does not work on pre-release!")
public void test() {
doInJPA( this::entityManagerFactory, entityManager -> {
Image image = new Image();

View File

@ -60,4 +60,12 @@ public boolean isMatch() {
}
}
}
interface JdkVersion {
class _1_9 implements Matcher {
@Override
public boolean isMatch() {
return System.getProperty("java.version").toLowerCase().startsWith( "1.9" );
}
}
}
}