GithubHelp home page GithubHelp logo

Comments (10)

raphw avatar raphw commented on July 19, 2024

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.

Anon10W1z avatar Anon10W1z commented on July 19, 2024

On a side note, is there any way to modify the class that an existing class extends from?

from byte-buddy.

raphw avatar raphw commented on July 19, 2024

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.

Anon10W1z avatar Anon10W1z commented on July 19, 2024

Alright, thank you for your help. I definitely love this library regardless!

from byte-buddy.

raphw avatar raphw commented on July 19, 2024

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.

raphw avatar raphw commented on July 19, 2024

I leave the issue open until it no longer fails.

from byte-buddy.

Anon10W1z avatar Anon10W1z commented on July 19, 2024

Oh right, my bad sorry.

from byte-buddy.

raphw avatar raphw commented on July 19, 2024

No problem. Again, thanks for reporting.

from byte-buddy.

raphw avatar raphw commented on July 19, 2024

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.

raphw avatar raphw commented on July 19, 2024

0.6.13 is released where this should be fixed.

from byte-buddy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.