@Test @JavaVersionRule.Enforce(8) public void testUnambiguousDefaultMethod() throws Exception { DynamicType.Loaded<?> loaded = new ByteBuddy() .subclass(Object.class) .implement(Class.forName(SINGLE_DEFAULT_METHOD)) .intercept(DefaultMethodCall.unambiguousOnly()) .make() .load(Class.forName(SINGLE_DEFAULT_METHOD).getClassLoader(), ClassLoadingStrategy.Default.WRAPPER); assertThat(loaded.getLoaded().getDeclaredMethods().length, is(1)); Method method = loaded.getLoaded().getDeclaredMethod(FOO); Object instance = loaded.getLoaded().getDeclaredConstructor().newInstance(); assertThat(method.invoke(instance), is((Object) FOO)); }
public static Implementation unambiguousOnly() { return new DefaultMethodCall(Collections.<TypeDescription>emptyList()); }
DefaultMethodCall implements Implementation { public static Implementation unambiguousOnly() { return new DefaultMethodCall(Collections.<TypeDescription>emptyList()); } }
DefaultMethodCall implements Implementation { public static Implementation unambiguousOnly() { return new DefaultMethodCall(Collections.<TypeDescription>emptyList()); } protected  DefaultMethodCall(List<TypeDescription> prioritizedInterfaces); }
DefaultMethodCall implements Implementation { public static Implementation unambiguousOnly() { return new DefaultMethodCall(Collections.<TypeDescription>emptyList()); } protected  DefaultMethodCall(List<TypeDescription> prioritizedInterfaces); static Implementation prioritize(Class<?>... prioritizedInterface); static Implementation prioritize(Iterable<? extends Class<?>> prioritizedInterfaces); static Implementation prioritize(TypeDescription... prioritizedInterface); static Implementation prioritize(Collection<? extends TypeDescription> prioritizedInterfaces); static Implementation unambiguousOnly(); InstrumentedType prepare(InstrumentedType instrumentedType); ByteCodeAppender appender(Target implementationTarget); }
DefaultMethodCall implements Implementation { public static Implementation unambiguousOnly() { return new DefaultMethodCall(Collections.<TypeDescription>emptyList()); } protected  DefaultMethodCall(List<TypeDescription> prioritizedInterfaces); static Implementation prioritize(Class<?>... prioritizedInterface); static Implementation prioritize(Iterable<? extends Class<?>> prioritizedInterfaces); static Implementation prioritize(TypeDescription... prioritizedInterface); static Implementation prioritize(Collection<? extends TypeDescription> prioritizedInterfaces); static Implementation unambiguousOnly(); InstrumentedType prepare(InstrumentedType instrumentedType); ByteCodeAppender appender(Target implementationTarget);  }