From bd8c3c226db45fdb12a3952bd6988fc6123a09b3 Mon Sep 17 00:00:00 2001 From: Vlad Mihalcea Date: Tue, 20 Sep 2016 18:23:45 +0300 Subject: [PATCH] Disable bytecode enhancement for documentation module as well as the test that makes use of this feature if the JDK version is 1.9 --- documentation/documentation.gradle | 9 ++++++--- .../userguide/fetching/LazyBasicAttributeTest.java | 2 ++ .../src/main/java/org/hibernate/testing/Skip.java | 8 ++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/documentation/documentation.gradle b/documentation/documentation.gradle index 4ce4f0b911..38bd11fe9b 100644 --- a/documentation/documentation.gradle +++ b/documentation/documentation.gradle @@ -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 + } } } diff --git a/documentation/src/test/java/org/hibernate/userguide/fetching/LazyBasicAttributeTest.java b/documentation/src/test/java/org/hibernate/userguide/fetching/LazyBasicAttributeTest.java index f8a4d023e7..1136ad8292 100644 --- a/documentation/src/test/java/org/hibernate/userguide/fetching/LazyBasicAttributeTest.java +++ b/documentation/src/test/java/org/hibernate/userguide/fetching/LazyBasicAttributeTest.java @@ -16,6 +16,7 @@ import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; 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 class LazyBasicAttributeTest extends BaseEntityManagerFunctionalTestCase } @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(); diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/Skip.java b/hibernate-testing/src/main/java/org/hibernate/testing/Skip.java index 417e0dc591..da345a79a1 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/Skip.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/Skip.java @@ -60,4 +60,12 @@ public @interface Skip { } } } + interface JdkVersion { + class _1_9 implements Matcher { + @Override + public boolean isMatch() { + return System.getProperty("java.version").toLowerCase().startsWith( "1.9" ); + } + } + } }