diff --git a/atom-basis/src/main/java/com/pragmaticobjects/oo/atom/codegen/bytebuddy/bt/AssertBuilderTransitionIsNotCorruptingClass.java b/atom-basis/src/main/java/com/pragmaticobjects/oo/atom/codegen/bytebuddy/bt/AssertBuilderTransitionIsNotCorruptingClass.java index f6247cc..429c2c8 100644 --- a/atom-basis/src/main/java/com/pragmaticobjects/oo/atom/codegen/bytebuddy/bt/AssertBuilderTransitionIsNotCorruptingClass.java +++ b/atom-basis/src/main/java/com/pragmaticobjects/oo/atom/codegen/bytebuddy/bt/AssertBuilderTransitionIsNotCorruptingClass.java @@ -27,6 +27,7 @@ import net.bytebuddy.ByteBuddy; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.dynamic.DynamicType; +import net.bytebuddy.dynamic.loading.ClassLoadingStrategy; import static org.assertj.core.api.Assertions.assertThatCode; @@ -60,7 +61,7 @@ public final void check() throws Exception { final DynamicType.Unloaded make = bt .transitionResult(subclass, typeDescription) .make(); - final Class clazz = make.load(new AnonymousClassLoader()).getLoaded(); + final Class clazz = make.load(new AnonymousClassLoader(), ClassLoadingStrategy.Default.CHILD_FIRST).getLoaded(); clazz.getMethods(); // Initiate validation. }).doesNotThrowAnyException(); } diff --git a/atom-basis/src/main/java/com/pragmaticobjects/oo/atom/codegen/bytebuddy/bt/AssertBuilderTransitionToAnnotateAClass.java b/atom-basis/src/main/java/com/pragmaticobjects/oo/atom/codegen/bytebuddy/bt/AssertBuilderTransitionToAnnotateAClass.java index e16e2d8..2202b1b 100644 --- a/atom-basis/src/main/java/com/pragmaticobjects/oo/atom/codegen/bytebuddy/bt/AssertBuilderTransitionToAnnotateAClass.java +++ b/atom-basis/src/main/java/com/pragmaticobjects/oo/atom/codegen/bytebuddy/bt/AssertBuilderTransitionToAnnotateAClass.java @@ -29,6 +29,7 @@ import net.bytebuddy.dynamic.DynamicType; import java.lang.annotation.Annotation; +import net.bytebuddy.dynamic.loading.ClassLoadingStrategy; import static org.assertj.core.api.Assertions.assertThat; @@ -63,7 +64,7 @@ public final void check() throws Exception { final DynamicType.Unloaded make = builderTransition .transitionResult(subclass, typeDescription) .make(); - final Class clazz = make.load(new AnonymousClassLoader()).getLoaded(); + final Class clazz = make.load(new AnonymousClassLoader(), ClassLoadingStrategy.Default.CHILD_FIRST).getLoaded(); assertThat(clazz.getAnnotation(annotation)) .withFailMessage("Expected annotation %s is missing on class %s", annotation.getName(), clazz.getName()) .isNotNull(); diff --git a/atom-basis/src/main/java/com/pragmaticobjects/oo/atom/codegen/bytebuddy/bt/AssertClassToHaveCertainMethodsAfterBuilderTransition.java b/atom-basis/src/main/java/com/pragmaticobjects/oo/atom/codegen/bytebuddy/bt/AssertClassToHaveCertainMethodsAfterBuilderTransition.java index 19c16f4..23b3dfc 100644 --- a/atom-basis/src/main/java/com/pragmaticobjects/oo/atom/codegen/bytebuddy/bt/AssertClassToHaveCertainMethodsAfterBuilderTransition.java +++ b/atom-basis/src/main/java/com/pragmaticobjects/oo/atom/codegen/bytebuddy/bt/AssertClassToHaveCertainMethodsAfterBuilderTransition.java @@ -30,6 +30,7 @@ import net.bytebuddy.dynamic.DynamicType; import java.lang.reflect.Method; +import net.bytebuddy.dynamic.loading.ClassLoadingStrategy; import static org.assertj.core.api.Assertions.assertThat; @@ -79,7 +80,7 @@ public final void check() throws Exception { final DynamicType.Unloaded make = bt .transitionResult(subclass, typeDescription) .make(); - final Class newClazz = make.load(new AnonymousClassLoader()).getLoaded(); + final Class newClazz = make.load(new AnonymousClassLoader(), ClassLoadingStrategy.Default.CHILD_FIRST).getLoaded(); assertThat( List.of(newClazz.getDeclaredMethods()).map(Method::getName) ).containsOnlyElementsOf( @@ -92,5 +93,6 @@ public final void check() throws Exception { * * @author Kapralov Sergey */ - private static final class AnonymousClassLoader extends ClassLoader {} + private static final class AnonymousClassLoader extends ClassLoader { + } }