Class DuplicateCatchAllTrapRemover


  • public class DuplicateCatchAllTrapRemover
    extends BodyTransformer
    Some compilers generate duplicate traps: Exception table: from to target type 9 30 37 Class java/lang/Throwable 9 30 44 any 37 46 44 any The semantics is as follows: try { // block } catch { // handler 1 } finally { // handler 2 } In this case, the first trap covers the block and jumps to handler 1. The second trap also covers the block and jumps to handler 2. The third trap covers handler 1 and jumps to handler 2. If we treat "any" as java.lang. Throwable, the second handler is clearly unnecessary. Worse, it violates Soot's invariant that there may only be one handler per combination of covered code region and jump target. This transformer detects and removes such unnecessary traps.
    Author:
    Steven Arzt
    • Constructor Detail

      • DuplicateCatchAllTrapRemover

        public DuplicateCatchAllTrapRemover​(Singletons.Global g)
    • Method Detail

      • internalTransform

        protected void internalTransform​(Body b,
                                         String phaseName,
                                         Map<String,​String> options)
        Description copied from class: BodyTransformer
        This method is called to perform the transformation itself. It is declared abstract; subclasses must implement this method by making it the entry point to their actual Body transformation.
        Specified by:
        internalTransform in class BodyTransformer
        Parameters:
        b - the body on which to apply the transformation
        phaseName - the phasename for this transform; not typically used by implementations.
        options - the actual computed options; a combination of default options and Scene specified options.