Coder Social home page Coder Social logo

Comments (2)

cpw avatar cpw commented on July 27, 2024

I don't understand your ask here.

from modlauncher.

Mumfrey avatar Mumfrey commented on July 27, 2024

Looking through the other issues here, this is basically a corollary (or possibly duplicate) of #4, though with a slightly narrower scope.

It actually boils down to two actualy where Mixin needs to obtain bytecode for a class without actually classloading it, but does need that bytecode to be transformed "normally" by everything except itself. (Using bytecode/classnode interchangably here since the format doesn't matter to me). The two cases are:

  1. Obtaining classnode for a "template" class. This is a class which shouldn't be classloaded, it is used as a template for other things. This includes actual mixin bytecode to be loaded, parsed, and applied to targets as well as inner classes of those mixins which need to be synthesized into new versions for the target classes to use. For example if a mixin has an inner class MyMixin$MyInnerClass that "class" must not be loaded, it will be loaded as MixinTarget$RepatriatedInnerClass or OtherMixinTarget$RepatriatedInnerClass and never as its original self. This means the original code passes through the transformer chain once, like it would under a normal class load operation but it never makes it as far as the ClassLoader.

  2. Obtaining classnode for an arbitrary class to generate metadata for it. This is because the pipeline is such that a bunch of things in the class hierarchy need to be known before a mixin is applied, but if we wait until class load to obtain those data then it's too late to do anything with them. This includes enumerating fields, methods and interfaces on target classes. Since additional fields, methods and interfaces might be added by transformers - or of course removed - this bytecode needs to travel through the transformer chain as well. This doesn't happen for every class, only classes referenced by mixins.

The ask here is that there isn't an elegant way to obtain the bytecode and run the transformer chain on it without the kind of ugly hacks that I've wrapped in Internals which

  • Obtain the original bytecode in a mundane way
  • Pass it through the transformer chain with simple reflection
  • Short-circuit the transformer chain by throwing an exception

Which works but is somewhat inelegant.

The duties in question are handled by IClassBytecodeProvider so you can see the duties required here.

Hopefully that makes more sense? I'll be around this evening anyway if you want to discuss it some more.

from modlauncher.

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.