Skip to content

Commit

Permalink
HHH-18906 Allow unsupported enhancement strategy in hibernate testing
Browse files Browse the repository at this point in the history
  • Loading branch information
mbladel committed Dec 3, 2024
1 parent aef0fdb commit fde91d2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
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;
Expand All @@ -29,6 +30,7 @@
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;

/**
Expand Down Expand Up @@ -113,6 +115,12 @@ public boolean hasLazyLoadableAttributes(UnloadedClass classDescriptor) {
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();
}
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -21,4 +23,5 @@
boolean inlineDirtyChecking() default false;
boolean lazyLoading() default false;
boolean extendedEnhancement() default false;
UnsupportedEnhancementStrategy unsupportedEnhancementStrategy() default UnsupportedEnhancementStrategy.SKIP;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -27,6 +28,7 @@
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;
Expand Down Expand Up @@ -112,6 +114,12 @@ public boolean hasLazyLoadableAttributes(UnloadedClass classDescriptor) {
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();
}
};
}

Expand Down

0 comments on commit fde91d2

Please sign in to comment.