Class EnumEmptyConstructorFilter

  • All Implemented Interfaces:
    IFilter

    public final class EnumEmptyConstructorFilter
    extends java.lang.Object
    implements IFilter
    Filters empty enum constructors. Constructor of enum is invoked from static initialization block to create instance of each enum constant. So it won't be executed if number of enum constants is zero. Such enums are sometimes used as alternative to classes with static utilities and private empty constructor. Implicit constructor of enum created by compiler doesn't have a synthetic flag and refers to a line of enum definition. Therefore in order to not have partial coverage of enum definition line in enums without enum constants and similarly to filter of private empty constructors - empty constructor in enums without additional parameters should be filtered out even if it is not implicit.
    • Constructor Detail

      • EnumEmptyConstructorFilter

        public EnumEmptyConstructorFilter()
    • Method Detail

      • filter

        public void filter​(org.objectweb.asm.tree.MethodNode methodNode,
                           IFilterContext context,
                           IFilterOutput output)
        Description copied from interface: IFilter
        This method is called for every method. The filter implementation is expected to inspect the provided method and report its result to the given IFilterOutput instance.
        Specified by:
        filter in interface IFilter
        Parameters:
        methodNode - method to inspect
        context - context information for the method
        output - callback to report filtering results to