Skip to content

Commit fde91d2

Browse files
committed
HHH-18906 Allow unsupported enhancement strategy in hibernate testing
1 parent aef0fdb commit fde91d2

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

hibernate-testing/src/main/java/org/hibernate/testing/bytecode/enhancement/BytecodeEnhancerRunner.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.hibernate.bytecode.enhance.spi.UnloadedClass;
2222
import org.hibernate.bytecode.enhance.spi.UnloadedField;
2323

24+
import org.hibernate.bytecode.enhance.spi.UnsupportedEnhancementStrategy;
2425
import org.hibernate.testing.junit4.CustomRunner;
2526
import org.junit.runner.Runner;
2627
import org.junit.runner.notification.RunNotifier;
@@ -29,6 +30,7 @@
2930
import org.junit.runners.model.InitializationError;
3031
import org.junit.runners.model.RunnerBuilder;
3132

33+
import static org.hibernate.bytecode.enhance.spi.UnsupportedEnhancementStrategy.SKIP;
3234
import static org.hibernate.bytecode.internal.BytecodeProviderInitiator.buildDefaultBytecodeProvider;
3335

3436
/**
@@ -113,6 +115,12 @@ public boolean hasLazyLoadableAttributes(UnloadedClass classDescriptor) {
113115
public boolean isLazyLoadable(UnloadedField field) {
114116
return options.lazyLoading() && super.isLazyLoadable( field );
115117
}
118+
119+
@Override
120+
public UnsupportedEnhancementStrategy getUnsupportedEnhancementStrategy() {
121+
final UnsupportedEnhancementStrategy strategy = options.unsupportedEnhancementStrategy();
122+
return strategy != SKIP ? strategy : super.getUnsupportedEnhancementStrategy();
123+
}
116124
};
117125
}
118126

hibernate-testing/src/main/java/org/hibernate/testing/bytecode/enhancement/EnhancementOptions.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*/
55
package org.hibernate.testing.bytecode.enhancement;
66

7+
import org.hibernate.bytecode.enhance.spi.UnsupportedEnhancementStrategy;
8+
79
import java.lang.annotation.ElementType;
810
import java.lang.annotation.Inherited;
911
import java.lang.annotation.Retention;
@@ -21,4 +23,5 @@
2123
boolean inlineDirtyChecking() default false;
2224
boolean lazyLoading() default false;
2325
boolean extendedEnhancement() default false;
26+
UnsupportedEnhancementStrategy unsupportedEnhancementStrategy() default UnsupportedEnhancementStrategy.SKIP;
2427
}

hibernate-testing/src/main/java/org/hibernate/testing/bytecode/enhancement/extension/engine/BytecodeEnhancedClassUtils.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55
package org.hibernate.testing.bytecode.enhancement.extension.engine;
66

7+
import static org.hibernate.bytecode.enhance.spi.UnsupportedEnhancementStrategy.SKIP;
78
import static org.hibernate.bytecode.internal.BytecodeProviderInitiator.buildDefaultBytecodeProvider;
89

910
import java.io.BufferedInputStream;
@@ -27,6 +28,7 @@
2728
import org.hibernate.bytecode.enhance.spi.UnloadedClass;
2829
import org.hibernate.bytecode.enhance.spi.UnloadedField;
2930

31+
import org.hibernate.bytecode.enhance.spi.UnsupportedEnhancementStrategy;
3032
import org.hibernate.testing.bytecode.enhancement.ClassEnhancementSelector;
3133
import org.hibernate.testing.bytecode.enhancement.ClassEnhancementSelectors;
3234
import org.hibernate.testing.bytecode.enhancement.ClassSelector;
@@ -112,6 +114,12 @@ public boolean hasLazyLoadableAttributes(UnloadedClass classDescriptor) {
112114
public boolean isLazyLoadable(UnloadedField field) {
113115
return options.lazyLoading() && super.isLazyLoadable( field );
114116
}
117+
118+
@Override
119+
public UnsupportedEnhancementStrategy getUnsupportedEnhancementStrategy() {
120+
final UnsupportedEnhancementStrategy strategy = options.unsupportedEnhancementStrategy();
121+
return strategy != SKIP ? strategy : super.getUnsupportedEnhancementStrategy();
122+
}
115123
};
116124
}
117125

0 commit comments

Comments
 (0)