Class SwitchFallthrough

    • Field Detail

      • DEBUG

        private static final boolean DEBUG
      • LOOK_IN_SOURCE_FOR_FALLTHRU_COMMENT

        private static final boolean LOOK_IN_SOURCE_FOR_FALLTHRU_COMMENT
      • reachable

        private boolean reachable
      • lastPC

        private int lastPC
      • biggestJumpTarget

        private int biggestJumpTarget
      • potentiallyDeadStores

        private final java.util.BitSet potentiallyDeadStores
      • potentiallyDeadFields

        private final java.util.Set<XField> potentiallyDeadFields
      • potentiallyDeadStoresFromBeforeFallthrough

        private java.util.BitSet potentiallyDeadStoresFromBeforeFallthrough
      • potentiallyDeadFieldsFromBeforeFallthrough

        private java.util.Set<XField> potentiallyDeadFieldsFromBeforeFallthrough
      • priority

        private int priority
      • justSawHashcode

        boolean justSawHashcode
    • Constructor Detail

      • SwitchFallthrough

        public SwitchFallthrough​(BugReporter bugReporter)
    • Method Detail

      • visit

        public void visit​(org.apache.bcel.classfile.Code obj)
        Overrides:
        visit in class DismantleBytecode
      • isBranchTargetOutsideOfNextCase

        public boolean isBranchTargetOutsideOfNextCase()
        A GOTO might correspond to a break or to a do/while/for loop. For loops the branch target will be before the offset of the next case, for breaks we're exiting the switch so the target is actually even after the end of the last case. The branch target might be before the switch when we're inside another structure such as a loop.
        Returns:
        true if:
        • the branch target is a GOTO instruction as it is the case for a no-op (empty block) in an arrow-syntax switch
        • the branch target is after the next switch offset as it is the case for a switch break
        • or the branch target is before the PC corresponding to the switch instruction
        • or there's no next switch case (as it is the case for the default case)
      • clearAllDeadStores

        private void clearAllDeadStores()
      • hasFallThruComment

        private boolean hasFallThruComment​(int startPC,
                                           int endPC)