@ Override public void sawOpcode ( int seen ) { boolean allConstantStrings = false ; boolean sawConstant = false ; try { stack . precomputation ( this ) ; if ( seen == Const . ATHROW ) { checkForWEM ( ) ; } else if ( ( seen == Const . LDC ) || ( seen == Const . LDC_W ) ) { if ( getConstantRefOperand ( ) instanceof ConstantString ) { sawConstant = true ; } } else if ( ( seen == Const . INVOKESPECIAL ) && Values . CONSTRUCTOR . equals ( getNameConstantOperand ( ) ) ) { String clsName = getClassConstantOperand ( ) ; if ( clsName . indexOf ( "Exception" ) < 0 ) { return ; } JavaClass exCls = Repository . lookupClass ( clsName ) ; if ( ! exCls . instanceOf ( exceptionClass ) ) { return ; } String sig = getSigConstantOperand ( ) ; List < String > argTypes = SignatureUtils . getParameterSignatures ( sig ) ; int stringParms = 0 ; for ( int t = 0 ; t < argTypes . size ( ) ; t ++ ) { if ( ! Values . SIG_JAVA_LANG_STRING . equals ( argTypes . get ( t ) ) ) { continue ; } stringParms ++ ; int stackOffset = argTypes . size ( ) - t - 1 ; if ( ( stack . getStackDepth ( ) > stackOffset ) && ( stack . getStackItem ( stackOffset ) . getUserValue ( ) == null ) ) { return ; } } if ( Values . SLASHED_JAVA_LANG_EXCEPTION . equals ( clsName ) && SignatureBuilder . SIG_THROWABLE_TO_VOID . equals ( getSigConstantOperand ( ) ) ) { bugReporter . reportBug ( new BugInstance ( this , BugType . WEM_OBSCURING_EXCEPTION . name ( ) , LOW_PRIORITY ) . addClass ( this ) . addMethod ( this ) . addSourceLine ( this ) ) ; } allConstantStrings = stringParms > 0 ; } } catch ( ClassNotFoundException cnfe ) { bugReporter . reportMissingClass ( cnfe ) ; } finally { TernaryPatcher . pre ( stack , seen ) ; stack . sawOpcode ( this , seen ) ; TernaryPatcher . post ( stack , seen ) ; if ( ( sawConstant || allConstantStrings ) && ( stack . getStackDepth ( ) > 0 ) ) { OpcodeStack . Item item = stack . getStackItem ( 0 ) ; item . setUserValue ( Boolean . TRUE ) ; } } }
overrides the visitor to look for throws instructions using exceptions with static messages