Class StringSwitchJavacFilter

  • All Implemented Interfaces:
    IFilter

    public final class StringSwitchJavacFilter
    extends java.lang.Object
    implements IFilter
    Filters code that is generated by javac for a switch statement with a String.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void filter​(org.objectweb.asm.tree.AbstractInsnNode start, IFilterOutput output)
      javac generates two switches.
      void filter​(org.objectweb.asm.tree.MethodNode methodNode, IFilterContext context, IFilterOutput output)
      This method is called for every method.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StringSwitchJavacFilter

        public StringSwitchJavacFilter()
    • 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
      • filter

        private void filter​(org.objectweb.asm.tree.AbstractInsnNode start,
                            IFilterOutput output)
        javac generates two switches. First one by String.hashCode(). Number of handlers in the second switch is equal to number of handlers in source code, so it is enough to completely filter-out first switch. Handler for default case of the first switch - is the second switch.