diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/bytecode/enhancement/BytecodeEnhancerRunner.java b/hibernate-testing/src/main/java/org/hibernate/testing/bytecode/enhancement/BytecodeEnhancerRunner.java index a8128f6c52..5b83e6b189 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/bytecode/enhancement/BytecodeEnhancerRunner.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/bytecode/enhancement/BytecodeEnhancerRunner.java @@ -21,6 +21,7 @@ import org.hibernate.bytecode.enhance.spi.Enhancer; import org.hibernate.bytecode.enhance.spi.UnloadedClass; import org.hibernate.bytecode.enhance.spi.UnloadedField; +import org.hibernate.bytecode.enhance.spi.UnsupportedEnhancementStrategy; import org.hibernate.testing.junit4.CustomRunner; import org.junit.runner.Runner; import org.junit.runner.notification.RunNotifier; @@ -29,6 +30,7 @@ import org.junit.runners.Suite; import org.junit.runners.model.InitializationError; import org.junit.runners.model.RunnerBuilder; +import static org.hibernate.bytecode.enhance.spi.UnsupportedEnhancementStrategy.SKIP; import static org.hibernate.bytecode.internal.BytecodeProviderInitiator.buildDefaultBytecodeProvider; /** @@ -113,6 +115,12 @@ public class BytecodeEnhancerRunner extends Suite { public boolean isLazyLoadable(UnloadedField field) { return options.lazyLoading() && super.isLazyLoadable( field ); } + + @Override + public UnsupportedEnhancementStrategy getUnsupportedEnhancementStrategy() { + final UnsupportedEnhancementStrategy strategy = options.unsupportedEnhancementStrategy(); + return strategy != SKIP ? strategy : super.getUnsupportedEnhancementStrategy(); + } }; } diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/bytecode/enhancement/EnhancementOptions.java b/hibernate-testing/src/main/java/org/hibernate/testing/bytecode/enhancement/EnhancementOptions.java index 401bf139ec..920b70674c 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/bytecode/enhancement/EnhancementOptions.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/bytecode/enhancement/EnhancementOptions.java @@ -4,6 +4,8 @@ */ package org.hibernate.testing.bytecode.enhancement; +import org.hibernate.bytecode.enhance.spi.UnsupportedEnhancementStrategy; + import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; @@ -21,4 +23,5 @@ public @interface EnhancementOptions { boolean inlineDirtyChecking() default false; boolean lazyLoading() default false; boolean extendedEnhancement() default false; + UnsupportedEnhancementStrategy unsupportedEnhancementStrategy() default UnsupportedEnhancementStrategy.SKIP; } diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/bytecode/enhancement/extension/engine/BytecodeEnhancedClassUtils.java b/hibernate-testing/src/main/java/org/hibernate/testing/bytecode/enhancement/extension/engine/BytecodeEnhancedClassUtils.java index 8a7c046d61..8d4e638f9b 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/bytecode/enhancement/extension/engine/BytecodeEnhancedClassUtils.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/bytecode/enhancement/extension/engine/BytecodeEnhancedClassUtils.java @@ -4,6 +4,7 @@ */ package org.hibernate.testing.bytecode.enhancement.extension.engine; +import static org.hibernate.bytecode.enhance.spi.UnsupportedEnhancementStrategy.SKIP; import static org.hibernate.bytecode.internal.BytecodeProviderInitiator.buildDefaultBytecodeProvider; import java.io.BufferedInputStream; @@ -27,6 +28,7 @@ import org.hibernate.bytecode.enhance.spi.Enhancer; import org.hibernate.bytecode.enhance.spi.UnloadedClass; import org.hibernate.bytecode.enhance.spi.UnloadedField; +import org.hibernate.bytecode.enhance.spi.UnsupportedEnhancementStrategy; import org.hibernate.testing.bytecode.enhancement.ClassEnhancementSelector; import org.hibernate.testing.bytecode.enhancement.ClassEnhancementSelectors; import org.hibernate.testing.bytecode.enhancement.ClassSelector; @@ -112,6 +114,12 @@ final class BytecodeEnhancedClassUtils { public boolean isLazyLoadable(UnloadedField field) { return options.lazyLoading() && super.isLazyLoadable( field ); } + + @Override + public UnsupportedEnhancementStrategy getUnsupportedEnhancementStrategy() { + final UnsupportedEnhancementStrategy strategy = options.unsupportedEnhancementStrategy(); + return strategy != SKIP ? strategy : super.getUnsupportedEnhancementStrategy(); + } }; }