-
-
Notifications
You must be signed in to change notification settings - Fork 812
New issue
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
[Question] Inner static class loading / method intercept possible? #199
Comments
I assume that A package at runtime needs to be defined by the same class loader in order to be equal at runtime. This is a limitation enforced by the JVM. (This should also not work with cglib, so to speak.) |
Thank you for the fast reply I will look into it. You can reproduce the issue if you run ./gradlew :jgiven-core:test Although I am unsure it is run in a different class loader I have to check it. |
I see now what is going on. Byte Buddy mimics the constructors of its super class but it does not change their visibility. Therefore, you would need to set the constructor to be accessible before creating an instance. You can change that by using PS: I changed this to be the default starting from the next version. |
Really nice, never saw a library dev so responsive. Kudos and thank you for quick assistance, works fine now. |
…y can access super constructors and set their visibility for reflection "raphw/byte-buddy#199 (comment)"
Hello, I am trying to adapt a library (port it) from cglib to ByteBuddy so I can run it on Android Dalvik/dex, and I am having issues with method delegation and IllegalAccessException.
ByteBuddy seems to fail with IllegalStateException in case of a inner static class declaration with following error:
Note if I change the class modifier to public it works fine:
This is a snippet of interception setup:
Then a snippet from the MethodInterceptor.class
Am I doing something wrong here, code works fine with cglib so I presume I misconfigured the interceptor?
The text was updated successfully, but these errors were encountered: