Class ImplicitConstructorCleanup

java.lang.Object
net.covers1624.coffeegrinder.bytecode.transform.transformers.ImplicitConstructorCleanup
All Implemented Interfaces:
TopLevelClassTransformer, Transformer

public class ImplicitConstructorCleanup extends Object implements TopLevelClassTransformer
We have the following cases to deal with:
 - Remove calls to super with no arguments.
 - Nuke anon class passthrough constructors.
 - Remove constructors which only have a single super call
   - If there are no other constructors and
   - If the method is declared as public or the class is an enum
 - Remove empty static initializers
 
Created by covers1624 on 26/11/21.
  • Constructor Details

    • ImplicitConstructorCleanup

      public ImplicitConstructorCleanup()
  • Method Details

    • transform

      public void transform(ClassDecl cInsn, ClassTransformContext ctx)
      Description copied from interface: TopLevelClassTransformer
      Transform a top-level class.

      All methods have already been fully processed.

      All nested/inner/local/anon classes are present and already fully processed.

      Specified by:
      transform in interface TopLevelClassTransformer
      Parameters:
      cInsn - The class.
      ctx - The context.
    • removeRedundantSuperCall

      public static void removeRedundantSuperCall(MethodDecl ctor)