@Override public String toString() { if (isTop()) { return "TOP"; } return stack.toString() + "::" + lvValues.toString(); }
@Override @OverridingMethodsMustInvokeSuper public boolean beforeOpcode(int seen) { stack.precomputation(this); return !stack.isTop(); }
public static @CheckForNull BugAnnotation getSomeSource(ClassContext classContext, Method method, Location location, OpcodeStack stack, int stackPos) { if (stack.isTop()) { return null; } int pc = location.getHandle().getPosition(); try { BugAnnotation result = ValueNumberSourceInfo.getFromValueNumber(classContext, method, location, stackPos); if (result != null) { return result; } } catch (DataflowAnalysisException e) { AnalysisContext.logError("Couldn't find value source", e); } catch (CFGBuilderException e) { AnalysisContext.logError("Couldn't find value source", e); } return getValueSource(stack.getStackItem(stackPos), method, pc); }
/** * Factory method to create a MethodAnnotation from a method called by the * instruction the given visitor is currently visiting. * * @param visitor * the visitor * @return the MethodAnnotation representing the called method */ public static MethodAnnotation fromCalledMethod(DismantleBytecode visitor) { String className = visitor.getDottedClassConstantOperand(); String methodName = visitor.getNameConstantOperand(); String methodSig = visitor.getSigConstantOperand(); if (visitor instanceof OpcodeStackDetector && visitor.getOpcode() != Const.INVOKESTATIC) { int params = PreorderVisitor.getNumberArguments(methodSig); OpcodeStackDetector oVisitor = (OpcodeStackDetector) visitor; if (!oVisitor.getStack().isTop() && oVisitor.getStack().getStackDepth() > params) { OpcodeStack.Item item = oVisitor.getStack().getStackItem(params); String cName = ClassName.fromFieldSignature(item.getSignature()); if (cName != null) { className = cName; } } } return fromCalledMethod(className, methodName, methodSig, visitor.getOpcode() == Const.INVOKESTATIC); }
@Override public void sawOpcode(int seen) { if (stack.isTop()) { pendingUnreachableBranch = null; if (becameTop == -1) {
needToMerge = true; try { if (isTop()) { encountedTop = true; return;
@Override public String toString() { if (isTop()) { return "TOP"; } return stack.toString() + "::" + lvValues.toString(); }
@Override public boolean beforeOpcode(int seen) { stack.precomputation(this); return !stack.isTop(); }
/** * Call this method before #afterOpcode of detector. If this method returns new userValue, attach * it to the head value of stack after #afterOpcode of detector is called. * * @return non-null if seen == ANEWARRAY */ ArrayData afterOpcode(OpcodeStack stack, int seen, String className, int pc) { if (seen != Const.ANEWARRAY) { return null; } else if (stack.isTop()) { // see https://github.com/KengoTODA/findbugs-slf4j/issues/29 System.err.printf( "ArrayDataHandler: stack is TOP, cannot be analyzed. %s:%d%n", className, pc); return null; } return tryToDetectArraySize(stack); }
private boolean isInvokingGetMessage(int seen) { return seen == INVOKEVIRTUAL && !stack.isTop() && getThrowableHandler().checkThrowable(getStack().getStackItem(0)) && (Objects.equal("getMessage", getNameConstantOperand()) || Objects.equal("getLocalizedMessage", getNameConstantOperand())); }
@Override public void afterOpcode(int seen) { boolean isInvokingGetMessage = isInvokingGetMessage(seen); super.afterOpcode(seen); if (isInvokingGetMessage && !stack.isTop()) { stack.getStackItem(0).setSpecialKind(isMessage); } }
public static @CheckForNull BugAnnotation getSomeSource(ClassContext classContext, Method method, Location location, OpcodeStack stack, int stackPos) { if (stack.isTop()) { return null; } int pc = location.getHandle().getPosition(); try { BugAnnotation result = ValueNumberSourceInfo.getFromValueNumber(classContext, method, location, stackPos); if (result != null) { return result; } } catch (DataflowAnalysisException e) { AnalysisContext.logError("Couldn't find value source", e); } catch (CFGBuilderException e) { AnalysisContext.logError("Couldn't find value source", e); } return getValueSource(stack.getStackItem(stackPos), method, pc); }
/** * Factory method to create a MethodAnnotation from a method called by the * instruction the given visitor is currently visiting. * * @param visitor * the visitor * @return the MethodAnnotation representing the called method */ public static MethodAnnotation fromCalledMethod(DismantleBytecode visitor) { String className = visitor.getDottedClassConstantOperand(); String methodName = visitor.getNameConstantOperand(); String methodSig = visitor.getSigConstantOperand(); if (visitor instanceof OpcodeStackDetector && visitor.getOpcode() != Constants.INVOKESTATIC) { int params = PreorderVisitor.getNumberArguments(methodSig); OpcodeStackDetector oVisitor = (OpcodeStackDetector) visitor; if (!oVisitor.getStack().isTop() && oVisitor.getStack().getStackDepth() > params) { OpcodeStack.Item item = oVisitor.getStack().getStackItem(params); String cName = ClassName.fromFieldSignature(item.getSignature()); if (cName != null) { className = cName; } } } return fromCalledMethod(className, methodName, methodSig, visitor.getOpcode() == Constants.INVOKESTATIC); }
@Override public void sawOpcode(int seen) { if (stack.isTop()) { pendingUnreachableBranch = null; if (becameTop == -1) {
needToMerge = true; try { if (isTop()) { encountedTop = true; return;