Comments (10)
Thanks for reporting this. You are right, this is required by an ASM adapter I am using which has this requirement without documenting it. I am not yet sure when I have time to look at it. The easiest is to redefine the class itself instead of renaming it:
Foo foo = new Foo();
new ByteBuddy()
.redefine(Bar.class)
.method(named("m")).intercept(FixedValue.value("bar"))
.make()
.load(Foo.class.getClassLoader(), classLoadingStrategy);
System.out.println(foo.m());
I will however fix this on the long run once I have taken care of more pressing problems with 0.7.
from byte-buddy.
On a side note, is there any way to modify the class that an existing class extends from?
from byte-buddy.
No there is not and this is by design. Byte Buddy is designed with binary compatible instrumentation in mind. You would rather create a new class that subclasses the desired subclass for implementing the desired class.
from byte-buddy.
Alright, thank you for your help. I definitely love this library regardless!
from byte-buddy.
Thank you. All the class swapping functionality is not used by too many people but I hope that these features become more useful with the evolution of the JVM.
For the reported error: The ASM library could actually work with the non-expanded frames. The remapper that I use is rather generic in its functionality which is why they require it. The easiest would however be to not require the expansion for simple use cases. I filed a bug with ASM and I hope that they will take it. Otherwise, I need to craft some sort of work-around in the future.
from byte-buddy.
I leave the issue open until it no longer fails.
from byte-buddy.
Oh right, my bad sorry.
from byte-buddy.
No problem. Again, thanks for reporting.
from byte-buddy.
I resolved this issue on master with a workarround that works for Byte Buddy's use case. At best, ASM will offer support for this out-of-the-box at some point. Since the 0.7 release has gone wrong, I reverted master to a stable non-generic version for now and will release a version 0.6.13 some time soon.
from byte-buddy.
0.6.13 is released where this should be fixed.
from byte-buddy.
Related Issues (20)
- Not able to intercept methods of java.net.HttpURLConnection class in Java 17 HOT 1
- Strange interaction with method implementations for methods from composite interfaces HOT 1
- Replace Method Code HOT 3
- Can I replace the new byte[] in the onTransformation method? HOT 1
- I want to use bytebuddy to advice java.time.LocalDateTime HOT 3
- BUG: instrumentation error HOT 3
- No classes have been predefined during the image build to load from bytecodes at runtime HOT 8
- Verify Error on Byte Buddy generated class HOT 1
- Question: copy class hierarchy in an environment without Java Agent HOT 1
- Can 'private final method' in 'public final class' be redefined? HOT 4
- Method matchers works by chance HOT 2
- Why does ClassNotFoundException appear in Interceptor when running in SpringBoot? HOT 1
- Compilation error after adding lombok to classpath HOT 1
- why is the byte-buudy AgentBuilder source code so long ? HOT 2
- Invalid module descriptor of byte-buddy `jar` when `JAVA_HOME` is set to version 21 HOT 16
- matched class wasn't transformered and the issue appears just twice, and i didn't reproducing the issue HOT 10
- Fail to read property due to `IllegalArgumentException` when using it on withX methods HOT 4
- Improve diagnostics/troubleshooting features for agent installation HOT 1
- ByteBudy agent required by Mockito fails to install on GraalVM HOT 1
- Error when trying to modify the response of a method assigned to a public static final config variable HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from byte-buddy.