Java Code Examples for org.apache.bcel.Const#INVOKEINTERFACE
The following examples show how to use
org.apache.bcel.Const#INVOKEINTERFACE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FindRunInvocations.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void sawOpcode(int seen) { if (alreadySawStart) { return; } if ((seen == Const.INVOKEVIRTUAL || seen == Const.INVOKEINTERFACE) && "()V".equals(getSigConstantOperand()) && isThread(getDottedClassConstantOperand())) { if ("start".equals(getNameConstantOperand())) { alreadySawStart = true; } else { boolean isJustThread = !"java.lang.Thread".equals(getDottedClassConstantOperand()); if (amVisitingMainMethod() && getPC() == getCode().getLength() - 4 && isJustThread) { return; } else if ("run".equals(getNameConstantOperand())) { bugAccumulator.accumulateBug(new BugInstance(this, "RU_INVOKE_RUN", isJustThread ? HIGH_PRIORITY : NORMAL_PRIORITY).addClassAndMethod(this), this); } } } }
Example 2
Source File: WaitInLoop.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void sawOpcode(int seen) { if ((seen == Const.INVOKEVIRTUAL || seen == Const.INVOKEINTERFACE) && "notify".equals(getNameConstantOperand()) && "()V".equals(getSigConstantOperand())) { sawNotify = true; notifyPC = getPC(); } if (!(sawWait || sawAwait) && (seen == Const.INVOKEVIRTUAL || seen == Const.INVOKEINTERFACE) && (isMonitorWait() || isConditionAwait())) { if ("wait".equals(getNameConstantOperand())) { sawWait = true; } else { sawAwait = true; } waitHasTimeout = !"()V".equals(getSigConstantOperand()); waitAt = getPC(); earliestJump = getPC() + 1; return; } if (seen >= Const.IFEQ && seen <= Const.GOTO || seen >= Const.IFNULL && seen <= Const.GOTO_W) { earliestJump = Math.min(earliestJump, getBranchTarget()); } }
Example 3
Source File: FindHEmismatch.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void sawOpcode(int seen) { if (seen == Const.INVOKEVIRTUAL || seen == Const.INVOKEINTERFACE) { String className = getClassConstantOperand(); if ("java/util/Map".equals(className) || "java/util/HashMap".equals(className) || "java/util/LinkedHashMap".equals(className) || "java/util/concurrent/ConcurrentHashMap".equals(className) || className.contains("Hash") && Subtypes2.instanceOf(ClassName.toDottedClassName(className), "java.util.Map")) { if ("put".equals(getNameConstantOperand()) && "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;".equals(getSigConstantOperand()) && stack.getStackDepth() >= 3) { check(1); } else if (("get".equals(getNameConstantOperand()) || "remove".equals(getNameConstantOperand())) && getSigConstantOperand().startsWith("(Ljava/lang/Object;)") && stack.getStackDepth() >= 2) { check(0); } } else if ("java/util/Set".equals(className) || "java/util/HashSet".equals(className) || className.contains("Hash") && Subtypes2.instanceOf(ClassName.toDottedClassName(className), "java.util.Set")) { if ("add".equals(getNameConstantOperand()) || "contains".equals(getNameConstantOperand()) || "remove".equals(getNameConstantOperand()) && "(Ljava/lang/Object;)Z".equals(getSigConstantOperand()) && stack.getStackDepth() >= 2) { check(0); } } } }
Example 4
Source File: BuildInterproceduralCallGraph.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void sawOpcode(int seen) { switch (seen) { case Const.INVOKESTATIC: case Const.INVOKEVIRTUAL: case Const.INVOKEINTERFACE: case Const.INVOKESPECIAL: MethodDescriptor called = getMethodDescriptorOperand(); XMethod calledXMethod = XFactory.createXMethod(called); InterproceduralCallGraphVertex calledVertex = findVertex(calledXMethod); callGraph.createEdge(currentVertex, calledVertex); break; default: break; } }
Example 5
Source File: IntCast2LongAsInstant.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void sawOpcode(int seen) { if (seen == Const.SIPUSH) { lastConstantForSIPUSH = getIntConstant(); } if (seen == Const.INVOKEINTERFACE || seen == Const.INVOKEVIRTUAL || seen == Const.INVOKESPECIAL || seen == Const.INVOKESTATIC) { String signature = getSigConstantOperand(); int numberArguments = PreorderVisitor.getNumberArguments(signature); for (int i = 0; i < numberArguments; i++) { Item item = stack.getStackItem(numberArguments - 1 - i); if (item.getSpecialKind() == OpcodeStack.Item.RESULT_OF_I2L) { ParameterProperty property = database.getProperty(getMethodDescriptorOperand()); if (property != null && property.hasProperty(i)) { int priority = NORMAL_PRIORITY; if (getPrevOpcode(1) == Const.I2L && getPrevOpcode(2) == Const.IMUL && getPrevOpcode(3) == Const.SIPUSH && lastConstantForSIPUSH == 1000) { priority = HIGH_PRIORITY; } else if (getPrevOpcode(1) == Const.I2L && getPrevOpcode(2) == Const.IMUL && getPrevOpcode(4) == Const.SIPUSH && lastConstantForSIPUSH == 1000) { priority = HIGH_PRIORITY; } BugInstance bug = new BugInstance(this, "ICAST_INT_2_LONG_AS_INSTANT", priority).addClassAndMethod(this) .addCalledMethod(this).addValueSource(item, this).addSourceLine(this); bugReporter.reportBug(bug); } } } } }
Example 6
Source File: FieldSetAnalysis.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
private void handleInstruction(InstructionHandle handle, BasicBlock basicBlock, FieldSet fact) { Instruction ins = handle.getInstruction(); short opcode = ins.getOpcode(); XField field; switch (opcode) { case Const.GETFIELD: case Const.GETSTATIC: field = lookupField(handle, (FieldInstruction) ins); if (field != null) { sawLoad(fact, field); } break; case Const.PUTFIELD: case Const.PUTSTATIC: field = lookupField(handle, (FieldInstruction) ins); if (field != null) { sawStore(fact, field); } break; case Const.INVOKEINTERFACE: case Const.INVOKESPECIAL: case Const.INVOKESTATIC: case Const.INVOKEVIRTUAL: // Assume that the called method assigns loads and stores all // possible fields fact.setBottom(); break; default: break; } }
Example 7
Source File: INVOKEINTERFACE.java From commons-bcel with Apache License 2.0 | 5 votes |
public INVOKEINTERFACE(final int index, final int nargs) { super(Const.INVOKEINTERFACE, index); super.setLength(5); if (nargs < 1) { throw new ClassGenException("Number of arguments must be > 0 " + nargs); } this.nargs = nargs; }
Example 8
Source File: BadResultSetAccess.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void sawOpcode(int seen) { if (seen == Const.INVOKEINTERFACE) { String methodName = getNameConstantOperand(); String clsConstant = getClassConstantOperand(); if (("java/sql/ResultSet".equals(clsConstant) && ((methodName.startsWith("get") && dbFieldTypesSet .contains(methodName.substring(3))) || (methodName.startsWith("update") && dbFieldTypesSet .contains(methodName.substring(6))))) || (("java/sql/PreparedStatement".equals(clsConstant) && ((methodName.startsWith("set") && dbFieldTypesSet .contains(methodName.substring(3))))))) { String signature = getSigConstantOperand(); int numParms = PreorderVisitor.getNumberArguments(signature); if (stack.getStackDepth() >= numParms) { OpcodeStack.Item item = stack.getStackItem(numParms - 1); if ("I".equals(item.getSignature()) && item.couldBeZero()) { bugReporter.reportBug(new BugInstance(this, "java/sql/PreparedStatement".equals(clsConstant) ? "SQL_BAD_PREPARED_STATEMENT_ACCESS" : "SQL_BAD_RESULTSET_ACCESS", item.mustBeZero() ? HIGH_PRIORITY : NORMAL_PRIORITY) .addClassAndMethod(this).addSourceLine(this)); } } } } }
Example 9
Source File: DismantleBytecode.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
public boolean isMethodCall() { switch (opcode) { default: return false; case Const.INVOKEINTERFACE: case Const.INVOKESPECIAL: case Const.INVOKEVIRTUAL: case Const.INVOKESTATIC: return true; } }
Example 10
Source File: OverridingEqualsNotSymmetrical.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
private boolean callToInvoke(int seen) { if (seen == Const.INVOKEVIRTUAL || seen == Const.INVOKEINTERFACE || seen == Const.INVOKESPECIAL) { return invokesMethodWithEqualLikeName() && EQUALS_SIGNATURE.equals(getSigConstantOperand()); } if (seen == Const.INVOKESTATIC) { String sig = getSigConstantOperand(); return invokesMethodWithEqualLikeName() && sig.endsWith("Ljava/lang/Object;)Z"); } return false; }
Example 11
Source File: NoteDirectlyRelevantTypeQualifiers.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void sawOpcode(int seen) { switch (seen) { case Const.INVOKEINTERFACE: case Const.INVOKEVIRTUAL: case Const.INVOKESTATIC: case Const.INVOKESPECIAL: // We don't need to look for method invocations // if Analysis.FIND_EFFECTIVE_RELEVANT_QUALIFIERS is enabled - // that will build an interprocedural call graph which // we'll use at a later point to find relevant qualifiers // stemming from called methods. if (!Analysis.FIND_EFFECTIVE_RELEVANT_QUALIFIERS) { XMethod m = getXMethodOperand(); if (m != null) { updateApplicableAnnotations(m); } } break; case Const.GETSTATIC: case Const.PUTSTATIC: case Const.GETFIELD: case Const.PUTFIELD: { XField f = getXFieldOperand(); if (f != null) { Collection<TypeQualifierAnnotation> annotations = TypeQualifierApplications.getApplicableApplications(f); Analysis.addKnownTypeQualifiers(applicableApplications, annotations); } break; } default: break; } }
Example 12
Source File: OpcodeStack.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
public Item getItemMethodInvokedOn(DismantleBytecode dbc) { int opcode = dbc.getOpcode(); switch (opcode) { case Const.INVOKEVIRTUAL: case Const.INVOKEINTERFACE: case Const.INVOKESPECIAL: String signature = dbc.getSigConstantOperand(); int stackOffset = PreorderVisitor.getNumberArguments(signature); return getStackItem(stackOffset); } throw new IllegalArgumentException("Not visiting an instance method call"); }
Example 13
Source File: RepeatedConditionals.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
private boolean hasSideEffect(int seen) { if (seen == Const.INVOKEVIRTUAL || seen == Const.INVOKESPECIAL || seen == Const.INVOKEINTERFACE || seen == Const.INVOKESTATIC) { return noSideEffectMethods.is(getMethodDescriptorOperand(), MethodSideEffectStatus.SE, MethodSideEffectStatus.OBJ); } return isRegisterStore() || isReturn(seen) || isSwitch(seen) || seen == Const.INVOKEDYNAMIC || seen == Const.PUTFIELD || seen == Const.PUTSTATIC; }
Example 14
Source File: Noise.java From spotbugs with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void sawOpcode(int seen) { int priority; switch (seen) { case Const.INVOKEINTERFACE: case Const.INVOKEVIRTUAL: case Const.INVOKESPECIAL: case Const.INVOKESTATIC: hq.pushHash(getClassConstantOperand()); if (getNameConstantOperand().indexOf('$') == -1) { hq.pushHash(getNameConstantOperand()); } hq.pushHash(getSigConstantOperand()); priority = hq.getPriority(); if (priority <= Priorities.LOW_PRIORITY) { accumulator.accumulateBug(new BugInstance(this, "NOISE_METHOD_CALL", priority).addClassAndMethod(this) .addCalledMethod(this), this); } break; case Const.GETFIELD: case Const.PUTFIELD: case Const.GETSTATIC: case Const.PUTSTATIC: hq.pushHash(getClassConstantOperand()); if (getNameConstantOperand().indexOf('$') == -1) { hq.pushHash(getNameConstantOperand()); } hq.pushHash(getSigConstantOperand()); priority = hq.getPriority(); if (priority <= Priorities.LOW_PRIORITY) { accumulator.accumulateBug(new BugInstance(this, "NOISE_FIELD_REFERENCE", priority).addClassAndMethod(this) .addReferencedField(this), this); } break; case Const.CHECKCAST: case Const.INSTANCEOF: case Const.NEW: hq.pushHash(getClassConstantOperand()); break; case Const.IFEQ: case Const.IFNE: case Const.IFNONNULL: case Const.IFNULL: case Const.IF_ICMPEQ: case Const.IF_ICMPNE: case Const.IF_ICMPLE: case Const.IF_ICMPGE: case Const.IF_ICMPGT: case Const.IF_ICMPLT: case Const.IF_ACMPEQ: case Const.IF_ACMPNE: case Const.RETURN: case Const.ARETURN: case Const.IRETURN: case Const.MONITORENTER: case Const.MONITOREXIT: case Const.IINC: case Const.NEWARRAY: case Const.TABLESWITCH: case Const.LOOKUPSWITCH: case Const.LCMP: case Const.INEG: case Const.IADD: case Const.IMUL: case Const.ISUB: case Const.IDIV: case Const.IREM: case Const.IXOR: case Const.ISHL: case Const.ISHR: case Const.IUSHR: case Const.IAND: case Const.IOR: case Const.LAND: case Const.LOR: case Const.LADD: case Const.LMUL: case Const.LSUB: case Const.LDIV: case Const.LSHL: case Const.LSHR: case Const.LUSHR: case Const.AALOAD: case Const.AASTORE: case Const.IALOAD: case Const.IASTORE: case Const.BALOAD: case Const.BASTORE: hq.push(seen); priority = hq.getPriority(); if (priority <= Priorities.LOW_PRIORITY) { accumulator.accumulateBug( new BugInstance(this, "NOISE_OPERATION", priority).addClassAndMethod(this).addString(Const.getOpcodeName(seen)), this); } break; default: break; } }
Example 15
Source File: VarArgsProblems.java From spotbugs with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void sawOpcode(int seen) { // System.out.println("State:" + state); if (seen == Const.GOTO && getBranchOffset() == 4) { state = SEEN_GOTO; } else { switch (state) { case SEEN_NOTHING: if ((seen == Const.ICONST_1)) { state = SEEN_ICONST_1; } break; case SEEN_ICONST_1: if (seen == Const.ANEWARRAY && primitiveArray.matcher(getClassConstantOperand()).matches()) { // System.out.println("Allocation of array of type " + // getClassConstantOperand()); primitiveArraySig = getClassConstantOperand(); state = SEEN_ANEWARRAY; } else { state = SEEN_NOTHING; } break; case SEEN_ANEWARRAY: if (seen == Const.DUP) { state = SEEN_DUP; } else { state = SEEN_NOTHING; } break; case SEEN_DUP: if (seen == Const.ICONST_0) { state = SEEN_ICONST_0; } else { state = SEEN_NOTHING; } break; case SEEN_ICONST_0: if (((seen >= Const.ALOAD_0) && (seen < Const.ALOAD_3)) || (seen == Const.ALOAD)) { state = SEEN_ALOAD; } else { state = SEEN_NOTHING; } break; case SEEN_ALOAD: if (seen == Const.AASTORE) { state = SEEN_AASTORE; } else { state = SEEN_NOTHING; } break; case SEEN_AASTORE: if (seen == Const.INVOKESTATIC || seen == Const.INVOKEINTERFACE || seen == Const.INVOKESPECIAL || seen == Const.INVOKEVIRTUAL) { // System.out.println(getClassConstantOperand()); // System.out.println(getNameConstantOperand()); // System.out.println(getSigConstantOperand()); if (getSigConstantOperand().indexOf("Ljava/lang/Object;)") == -1) { break; } int priority = NORMAL_PRIORITY; if ("asList".equals(getNameConstantOperand()) && "java/util/Arrays".equals(getClassConstantOperand())) { priority = HIGH_PRIORITY; } bugReporter.reportBug(new BugInstance(this, "VA_PRIMITIVE_ARRAY_PASSED_TO_OBJECT_VARARG", priority) .addClassAndMethod(this).addType(primitiveArraySig).describe(TypeAnnotation.FOUND_ROLE) .addCalledMethod(this).addSourceLine(this)); } state = SEEN_NOTHING; break; case SEEN_GOTO: state = SEEN_NOTHING; break; default: throw new IllegalStateException("State " + state + " not expected"); } } }
Example 16
Source File: FindInconsistentSync2.java From spotbugs with GNU Lesser General Public License v2.1 | 4 votes |
/** * Determine whether or not the the given method is a getter method. I.e., * if it just returns the value of an instance field. * * @param classContext * the ClassContext for the class containing the method * @param method * the method */ public static boolean isGetterMethod(ClassContext classContext, Method method) { MethodGen methodGen = classContext.getMethodGen(method); if (methodGen == null) { return false; } InstructionList il = methodGen.getInstructionList(); // System.out.println("Checking getter method: " + method.getName()); if (il.getLength() > 60) { return false; } int count = 0; for (InstructionHandle ih : il) { switch (ih.getInstruction().getOpcode()) { case Const.GETFIELD: count++; if (count > 1) { return false; } break; case Const.PUTFIELD: case Const.BALOAD: case Const.CALOAD: case Const.DALOAD: case Const.FALOAD: case Const.IALOAD: case Const.LALOAD: case Const.SALOAD: case Const.AALOAD: case Const.BASTORE: case Const.CASTORE: case Const.DASTORE: case Const.FASTORE: case Const.IASTORE: case Const.LASTORE: case Const.SASTORE: case Const.AASTORE: case Const.PUTSTATIC: return false; case Const.INVOKESTATIC: case Const.INVOKEVIRTUAL: case Const.INVOKEINTERFACE: case Const.INVOKESPECIAL: case Const.GETSTATIC: // no-op } } // System.out.println("Found getter method: " + method.getName()); return true; }
Example 17
Source File: FormatStringChecker.java From spotbugs with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void sawOpcode(int seen) { // System.out.println(getPC() + " " + Const.getOpcodeName(seen) + " " + state); if (stack.getStackDepth() < stackDepth) { state = FormatState.NONE; stackDepth = 0; arguments = null; } if (seen == Const.ANEWARRAY && stack.getStackDepth() >= 2) { Object size = stack.getStackItem(0).getConstant(); Object formatStr = stack.getStackItem(1).getConstant(); if (size instanceof Integer && formatStr instanceof String) { arguments = new OpcodeStack.Item[(Integer) size]; this.formatString = (String) formatStr; state = FormatState.READY_FOR_FORMAT; stackDepth = stack.getStackDepth(); } } else if (state == FormatState.READY_FOR_FORMAT && seen == Const.DUP) { state = FormatState.EXPECTING_ASSIGNMENT; } else if (state == FormatState.EXPECTING_ASSIGNMENT && stack.getStackDepth() == stackDepth + 3 && seen == Const.AASTORE) { Object pos = stack.getStackItem(1).getConstant(); OpcodeStack.Item value = stack.getStackItem(0); if (pos instanceof Integer) { int index = (Integer) pos; if (index >= 0 && index < arguments.length) { arguments[index] = value; state = FormatState.READY_FOR_FORMAT; } else { state = FormatState.NONE; } } else { state = FormatState.NONE; } } else if (state == FormatState.READY_FOR_FORMAT && (seen == Const.INVOKESPECIAL || seen == Const.INVOKEVIRTUAL || seen == Const.INVOKESTATIC || seen == Const.INVOKEINTERFACE) && stack.getStackDepth() == stackDepth) { String cl = getClassConstantOperand(); String nm = getNameConstantOperand(); String sig = getSigConstantOperand(); XMethod m = getXMethodOperand(); if ((m == null || m.isVarArgs()) && sig.indexOf("Ljava/lang/String;[Ljava/lang/Object;)") >= 0 && ("java/util/Formatter".equals(cl) && "format".equals(nm) || "java/lang/String".equals(cl) && "format".equals(nm) || "java/io/PrintStream".equals(cl) && "format".equals(nm) || "java/io/PrintStream".equals(cl) && "printf".equals(nm) || cl.endsWith("Writer") && "format".equals(nm) || cl.endsWith("Writer") && "printf".equals(nm)) || cl.endsWith("Logger") && nm.endsWith("fmt")) { if (formatString.indexOf('\n') >= 0) { bugReporter.reportBug(new BugInstance(this, "VA_FORMAT_STRING_USES_NEWLINE", NORMAL_PRIORITY) .addClassAndMethod(this).addCalledMethod(this).addString(formatString) .describe(StringAnnotation.FORMAT_STRING_ROLE).addSourceLine(this)); } } } }
Example 18
Source File: InefficientToArray.java From spotbugs with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void sawOpcode(int seen) { if (DEBUG) { System.out.println("State: " + state + " Opcode: " + Const.getOpcodeName(seen)); } switch (state) { case SEEN_NOTHING: if (seen == Const.ICONST_0) { state = SEEN_ICONST_0; } break; case SEEN_ICONST_0: if (seen == Const.ANEWARRAY) { state = SEEN_ANEWARRAY; } else { state = SEEN_NOTHING; } break; case SEEN_ANEWARRAY: if (((seen == Const.INVOKEVIRTUAL) || (seen == Const.INVOKEINTERFACE)) && ("toArray".equals(getNameConstantOperand())) && ("([Ljava/lang/Object;)[Ljava/lang/Object;".equals(getSigConstantOperand()))) { try { String clsName = getDottedClassConstantOperand(); JavaClass cls = Repository.lookupClass(clsName); if (cls.implementationOf(collectionClass)) { bugAccumulator.accumulateBug( new BugInstance(this, "ITA_INEFFICIENT_TO_ARRAY", LOW_PRIORITY).addClassAndMethod(this), this); } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } } state = SEEN_NOTHING; break; default: state = SEEN_NOTHING; break; } }
Example 19
Source File: FindNoSideEffectMethods.java From spotbugs with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void sawOpcode(int seen) { if (!allowedFields.isEmpty() && seen == Const.PUTFIELD) { Item objItem = getStack().getStackItem(1); if (objItem.getRegisterNumber() == 0) { if (allowedFields.contains(getFieldDescriptorOperand())) { Item valueItem = getStack().getStackItem(0); if (!isNew(valueItem) && !valueItem.isNull()) { allowedFields.remove(getFieldDescriptorOperand()); } } } } if (status == SideEffectStatus.SIDE_EFFECT && allowedFields.isEmpty()) { // Nothing to do: skip the rest of the method throw new EarlyExitException(); } if (status == SideEffectStatus.SIDE_EFFECT) { return; } switch (seen) { case Const.ASTORE: case Const.ASTORE_0: case Const.ASTORE_1: case Const.ASTORE_2: case Const.ASTORE_3: if (finallyTargets.contains(getPC())) { finallyExceptionRegisters.add(getRegisterOperand()); } break; case Const.ATHROW: { Item exceptionItem = getStack().getStackItem(0); if (!finallyExceptionRegisters.remove(exceptionItem.getRegisterNumber())) { uselessVoidCandidate = false; try { JavaClass javaClass = exceptionItem.getJavaClass(); if (javaClass != null && ALLOWED_EXCEPTIONS.contains(javaClass.getClassName())) { break; } } catch (ClassNotFoundException e) { } status = SideEffectStatus.SIDE_EFFECT; } break; } case Const.PUTSTATIC: if (classInit) { if (getClassConstantOperand().equals(getClassName())) { break; } } status = SideEffectStatus.SIDE_EFFECT; break; case Const.INVOKEDYNAMIC: status = SideEffectStatus.SIDE_EFFECT; break; case Const.PUTFIELD: sawCall(getMethodCall(FIELD_STORE_STUB_METHOD), false); break; case Const.AASTORE: case Const.DASTORE: case Const.CASTORE: case Const.BASTORE: case Const.IASTORE: case Const.LASTORE: case Const.FASTORE: case Const.SASTORE: sawCall(getMethodCall(ARRAY_STORE_STUB_METHOD), false); break; case Const.INVOKESTATIC: if (changesOnlyNewObjects(getMethodDescriptorOperand())) { break; } sawCall(new MethodCall(getMethodDescriptorOperand(), TARGET_OTHER), false); break; case Const.INVOKESPECIAL: case Const.INVOKEINTERFACE: case Const.INVOKEVIRTUAL: { XMethod xMethodOperand = getXMethodOperand(); MethodDescriptor methodDescriptorOperand = xMethodOperand == null ? getMethodDescriptorOperand() : xMethodOperand .getMethodDescriptor(); if (changesOnlyNewObjects(getMethodDescriptorOperand())) { break; } MethodCall methodCall = getMethodCall(methodDescriptorOperand); sawCall(methodCall, false); break; } default: break; } }
Example 20
Source File: FindNonShortCircuit.java From spotbugs with GNU Lesser General Public License v2.1 | 4 votes |
private void scanForDanger(int seen) { switch (seen) { case Const.AALOAD: case Const.BALOAD: case Const.SALOAD: case Const.CALOAD: case Const.IALOAD: case Const.LALOAD: case Const.FALOAD: case Const.DALOAD: sawArrayDanger = true; sawDanger = true; break; case Const.INVOKEVIRTUAL: if ("length".equals(getNameConstantOperand()) && "java/lang/String".equals(getClassConstantOperand())) { break; } sawDanger = true; sawMethodCall = true; break; case Const.INVOKEINTERFACE: case Const.INVOKESPECIAL: case Const.INVOKESTATIC: sawDanger = true; sawMethodCall = true; break; case Const.IDIV: case Const.IREM: case Const.LDIV: case Const.LREM: sawDanger = true; break; case Const.ARRAYLENGTH: case Const.GETFIELD: // null pointer detector will handle these break; default: break; } }