Skip to content

Commit 099a635

Browse files
committed
HHH-18906 Allow unsupported enhancement strategy in hibernate testing
1 parent bbd878e commit 099a635

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
@@ -24,6 +24,7 @@
2424
import org.hibernate.bytecode.enhance.spi.UnloadedField;
2525
import org.hibernate.cfg.Environment;
2626

27+
import org.hibernate.bytecode.enhance.spi.UnsupportedEnhancementStrategy;
2728
import org.hibernate.testing.junit4.CustomRunner;
2829
import org.junit.runner.Runner;
2930
import org.junit.runner.notification.RunNotifier;
@@ -32,6 +33,7 @@
3233
import org.junit.runners.model.InitializationError;
3334
import org.junit.runners.model.RunnerBuilder;
3435

36+
import static org.hibernate.bytecode.enhance.spi.UnsupportedEnhancementStrategy.SKIP;
3537
import static org.hibernate.bytecode.internal.BytecodeProviderInitiator.buildDefaultBytecodeProvider;
3638

3739
/**
@@ -116,6 +118,12 @@ public boolean hasLazyLoadableAttributes(UnloadedClass classDescriptor) {
116118
public boolean isLazyLoadable(UnloadedField field) {
117119
return options.lazyLoading() && super.isLazyLoadable( field );
118120
}
121+
122+
@Override
123+
public UnsupportedEnhancementStrategy getUnsupportedEnhancementStrategy() {
124+
final UnsupportedEnhancementStrategy strategy = options.unsupportedEnhancementStrategy();
125+
return strategy != SKIP ? strategy : super.getUnsupportedEnhancementStrategy();
126+
}
119127
};
120128
}
121129

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
@@ -6,6 +6,8 @@
66
*/
77
package org.hibernate.testing.bytecode.enhancement;
88

9+
import org.hibernate.bytecode.enhance.spi.UnsupportedEnhancementStrategy;
10+
911
import java.lang.annotation.ElementType;
1012
import java.lang.annotation.Inherited;
1113
import java.lang.annotation.Retention;
@@ -23,4 +25,5 @@
2325
boolean inlineDirtyChecking() default false;
2426
boolean lazyLoading() default false;
2527
boolean extendedEnhancement() default false;
28+
UnsupportedEnhancementStrategy unsupportedEnhancementStrategy() default UnsupportedEnhancementStrategy.SKIP;
2629
}

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
@@ -6,6 +6,7 @@
66
*/
77
package org.hibernate.testing.bytecode.enhancement.extension.engine;
88

9+
import static org.hibernate.bytecode.enhance.spi.UnsupportedEnhancementStrategy.SKIP;
910
import static org.hibernate.bytecode.internal.BytecodeProviderInitiator.buildDefaultBytecodeProvider;
1011

1112
import java.io.BufferedInputStream;
@@ -29,6 +30,7 @@
2930
import org.hibernate.bytecode.enhance.spi.UnloadedClass;
3031
import org.hibernate.bytecode.enhance.spi.UnloadedField;
3132

33+
import org.hibernate.bytecode.enhance.spi.UnsupportedEnhancementStrategy;
3234
import org.hibernate.testing.bytecode.enhancement.ClassEnhancementSelector;
3335
import org.hibernate.testing.bytecode.enhancement.ClassEnhancementSelectors;
3436
import org.hibernate.testing.bytecode.enhancement.ClassSelector;
@@ -114,6 +116,12 @@ public boolean hasLazyLoadableAttributes(UnloadedClass classDescriptor) {
114116
public boolean isLazyLoadable(UnloadedField field) {
115117
return options.lazyLoading() && super.isLazyLoadable( field );
116118
}
119+
120+
@Override
121+
public UnsupportedEnhancementStrategy getUnsupportedEnhancementStrategy() {
122+
final UnsupportedEnhancementStrategy strategy = options.unsupportedEnhancementStrategy();
123+
return strategy != SKIP ? strategy : super.getUnsupportedEnhancementStrategy();
124+
}
117125
};
118126
}
119127

0 commit comments

Comments
 (0)