Interface MixinCompiler

All Known Implementing Classes:
MixinCompilerImpl

public interface MixinCompiler
Defines a compiler capable of generating a composite Class, comprised of a Set of Scala-like Trait classes on top of a base Class implementation.

Created by covers1624 on 2/17/20.

  • Method Details

    • create

      static MixinCompiler create()
      Create a MixinCompiler instance.
      Returns:
      The instance.
    • create

      static MixinCompiler create(MixinBackend backend)
      Create a MixinCompiler instance, with the given MixinBackend.
      Parameters:
      backend - The MixinBackend.
      Returns:
      The instance.
    • create

      static MixinCompiler create(MixinBackend backend, MixinDebugger debugger)
      Create a MixinCompiler instance, with the given MixinBackend and MixinDebugger.
      Parameters:
      backend - The MixinBackend.
      debugger - The MixinDebugger.
      Returns:
      The instance.
    • create

      static MixinCompiler create(MixinBackend backend, MixinDebugger debugger, Collection<Class<? extends MixinLanguageSupport>> supports)
      Create a MixinCompiler instance, with the given MixinBackend, MixinDebugger and the specified Collection of MixinLanguageSupports.
      Parameters:
      backend - The MixinBackend.
      debugger - The MixinDebugger.
      supports - The MixinLanguageSupport classes to load.
      Returns:
      The instance.
    • getMixinBackend

      MixinBackend getMixinBackend()
      Gets the MixinBackend for this MixinCompiler
      Returns:
      The MixinBackend instance.
    • getLanguageSupport

      @Nullable <T extends MixinLanguageSupport> T getLanguageSupport(String name)
      Get a MixinLanguageSupport instance with the given name.
      Parameters:
      name - The name.
      Returns:
      The MixinLanguageSupport instance or null
    • getClassInfo

      @Nullable @Nullable ClassInfo getClassInfo(String name)
      Gets a ClassInfo instance for the given class name.
      Parameters:
      name - The class name.
      Returns:
      The ClassInfo
    • getClassInfo

      @Nullable @Nullable ClassInfo getClassInfo(org.objectweb.asm.tree.ClassNode node)
      Overload for getClassInfo(String), taking a ClassNode instead.
      Parameters:
      node - The ClassNode.
      Returns:
      The ClassInfo.
    • getClassInfo

      @Nullable default @Nullable ClassInfo getClassInfo(@Nullable @Nullable Class<?> clazz)
      Overload for getClassInfo(String), taking a Class instead.
      Parameters:
      clazz - The Class.
      Returns:
      The ClassInfo.
    • getClassNode

      @Nullable @Nullable org.objectweb.asm.tree.ClassNode getClassNode(String name)
      Loads a ClassNode for the given class name.
      Parameters:
      name - The Class name.
      Returns:
      The ClassNode.
    • registerTrait

      MixinInfo registerTrait(org.objectweb.asm.tree.ClassNode cNode)
      Registers a Trait to the MixinCompiler.
      Parameters:
      cNode - The ClassNode for the trait.
      Returns:
      The MixinInfo for the trait.
    • getMixinInfo

      @Nullable @Nullable MixinInfo getMixinInfo(String name)
      Gets a MixinInfo for the given Class name.
      Parameters:
      name - The Class name
      Returns:
      The MixinInfo, Null if it does not exist.
    • defineClass

      <T> Class<T> defineClass(String name, byte[] bytes)
      Defines a class.
      Parameters:
      name - The name for the class.
      bytes - The bytes for the class.
      Returns:
      The defined class.
    • getDefinedClass

      <T> Class<T> getDefinedClass(String name)
      Get a previously defined class.
      Parameters:
      name - The name of the previously defined class.
      Returns:
      The defined class.
      Throws:
      NullPointerException - If the class was not found.
    • compileMixinClass

      <T> Class<T> compileMixinClass(String name, String superClass, Set<String> traits)
      Compiles a new class with the given name, super Class, and traits.
      Parameters:
      name - The name for the class.
      superClass - The name for the super class.s
      traits - The Traits to mixin.
      Returns:
      The compiled class.