We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The first sample works well with version 0.5.6 but the second sample throws exception for the version 0.6.5
package com.ui4j.test; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.concurrent.Callable; import net.bytebuddy.ByteBuddy; import net.bytebuddy.dynamic.ClassLoadingStrategy; import net.bytebuddy.instrumentation.MethodDelegation; import net.bytebuddy.instrumentation.method.bytecode.bind.annotation.AllArguments; import net.bytebuddy.instrumentation.method.bytecode.bind.annotation.Origin; import net.bytebuddy.instrumentation.method.bytecode.bind.annotation.RuntimeType; import net.bytebuddy.instrumentation.method.bytecode.bind.annotation.SuperCall; import net.bytebuddy.instrumentation.method.bytecode.bind.annotation.This; import net.bytebuddy.matcher.ElementMatchers; import com.ui4j.webkit.proxy.WebKitProxy; public class Main { public static interface Element { Element addClass(String... names); Element removeClass(String... name); } public static class WebKitElement implements Element { public WebKitElement() { } @Override public Element addClass(String... names) { return this; } @Override public Element removeClass(String... name) { return this; } } public static class WebKitInterceptor { @RuntimeType public static Object execute(@SuperCall Callable<Object> callable, @This Object that, @Origin Method method, @AllArguments Object[] arguments) { try { return callable.call(); } catch (Exception e) { throw new RuntimeException(e); } } } public static void main(String[] args) throws Exception { Class<? extends WebKitElement> loaded = new ByteBuddy() .subclass(WebKitElement.class) .method(ElementMatchers.any() .and(ElementMatchers.not(ElementMatchers.isDeclaredBy(Object.class)) .and(ElementMatchers.not(ElementMatchers.nameStartsWith("getEngine"))))) .intercept(MethodDelegation.to(WebKitInterceptor.class)) .make() .load(WebKitProxy.class.getClassLoader(), ClassLoadingStrategy.Default.WRAPPER) .getLoaded(); Constructor<? extends WebKitElement> constructor = loaded.getConstructor(); WebKitElement instance = constructor.newInstance(); instance.addClass("foo", "bar"); } }
package com.ui4j.test; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.concurrent.Callable; import net.bytebuddy.ByteBuddy; import net.bytebuddy.dynamic.loading.ClassLoadingStrategy; import net.bytebuddy.implementation.MethodDelegation; import net.bytebuddy.implementation.bind.annotation.AllArguments; import net.bytebuddy.implementation.bind.annotation.Origin; import net.bytebuddy.implementation.bind.annotation.RuntimeType; import net.bytebuddy.implementation.bind.annotation.SuperCall; import net.bytebuddy.implementation.bind.annotation.This; import net.bytebuddy.matcher.ElementMatchers; import com.ui4j.webkit.proxy.WebKitProxy; public class Main { public static interface Element { Element addClass(String... names); Element removeClass(String... name); } public static class WebKitElement implements Element { public WebKitElement() { } @Override public Element addClass(String... names) { return this; } @Override public Element removeClass(String... name) { return this; } } public static class WebKitInterceptor { @RuntimeType public static Object execute(@SuperCall Callable<Object> callable, @This Object that, @Origin Method method, @AllArguments Object[] arguments) { try { return callable.call(); } catch (Exception e) { throw new RuntimeException(e); } } } public static void main(String[] args) throws Exception { Class<? extends WebKitElement> loaded = new ByteBuddy() .subclass(WebKitElement.class) .method(ElementMatchers.any() .and(ElementMatchers.not(ElementMatchers.isDeclaredBy(Object.class)) .and(ElementMatchers.not(ElementMatchers.nameStartsWith("getEngine"))))) .intercept(MethodDelegation.to(WebKitInterceptor.class)) .make() .load(WebKitProxy.class.getClassLoader(), ClassLoadingStrategy.Default.WRAPPER) .getLoaded(); Constructor<? extends WebKitElement> constructor = loaded.getConstructor(); WebKitElement instance = constructor.newInstance(); instance.addClass("foo", "bar"); } }
Exception in thread "main" java.lang.VerifyError: Bad type on operand stack Exception Details: Location: com/ui4j/test/Main$WebKitElement$ByteBuddy$x3pjoCmV.addClass([Ljava/lang/String;)Lcom/ui4j/test/Main$Element; @6: invokespecial Reason: Type '[Ljava/lang/String;' (current frame, stack[3]) is not assignable to 'java/lang/String' Current Frame: bci: @6 flags: { } locals: { 'com/ui4j/test/Main$WebKitElement$ByteBuddy$x3pjoCmV', '[Ljava/lang/String;' } stack: { uninitialized 0, uninitialized 0, 'com/ui4j/test/Main$WebKitElement$ByteBuddy$x3pjoCmV', '[Ljava/lang/String;' } Bytecode: 0x0000000: bb00 2059 2a2b b700 212a b200 2404 bd00 0x0000010: 1559 032b 53b8 001b c000 1db0 at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) at java.lang.Class.getConstructor0(Unknown Source) at java.lang.Class.getConstructor(Unknown Source) at com.ui4j.test.Main.main(Main.java:69)
The text was updated successfully, but these errors were encountered:
I found the bug. Currently, I am releasing a new bug-fix version. It should be synchronized to Maven Central in a couple of hours.
Sorry, something went wrong.
raphw
No branches or pull requests
The first sample works well with version 0.5.6 but the second sample throws exception for the version 0.6.5
The text was updated successfully, but these errors were encountered: