Class CopyConstructorEnhancer

java.lang.Object
io.github.sugarcubes.cloner.enhancement.CopyConstructorEnhancer

public final class CopyConstructorEnhancer extends Object
Adds a copy constructor to a class file, see io.github.sugarcubes.cloner.generation.CopyConstructors for its contract.

The constructor is synthetic, private in final classes and protected in the others: constructors of subclasses call it. A protected constructor would change the serial version computed for a serializable class without serialVersionUID, so such a class gets serialVersionUID with the value computed for the original class.

  • Method Details

    • enhance

      public static CopyConstructorEnhancer.Result enhance(byte[] bytes, ClassHierarchy hierarchy, BytecodeBackend backend)
      Adds the copy constructor to the class file if the class matches the masks and can get it.
      Parameters:
      bytes - class file
      hierarchy - classes which are enhanced and their superclasses
      backend - bytecode engine
      Returns:
      result