Refine search
for (JavaClass inf : infs) { if (xmlInterfaces.contains(inf.getClassName())) { bugReporter.reportBug(new BugInstance(this, "XFB_XML_FACTORY_BYPASS", LOW_PRIORITY).addClassAndMethod( this).addSourceLine(this)); rejectedXMLClasses.remove(newClsName); bugReporter.reportMissingClass(cnfe);
bugReporter.reportBug(new BugInstance(this, "SIO_SUPERFLUOUS_INSTANCEOF", LOW_PRIORITY) .addClassAndMethod(this).addSourceLine(this)); bugReporter.reportMissingClass(cnfe);
BugInstance bug = new BugInstance(this, "RI_REDUNDANT_INTERFACES", LOW_PRIORITY).addClass(obj); for (String redundantInfName : redundantInfNames) { bug.addClass(redundantInfName).describe("INTERFACE_TYPE"); bugReporter.reportMissingClass(cnfe);
if (cls.implementationOf(collectionClass)) { bugAccumulator.accumulateBug( new BugInstance(this, "ITA_INEFFICIENT_TO_ARRAY", LOW_PRIORITY).addClassAndMethod(this), this); bugReporter.reportMissingClass(cnfe);
@Override public void visitClassContext(ClassContext classContext) { if (!enabled()) { return; } JavaClass jClass = classContext.getJavaClass(); XClass xClass = classContext.getXClass(); try { if (!isJunit3TestCase(xClass)) { return; } if ((jClass.getAccessFlags() & Const.ACC_ABSTRACT) == 0) { if (!hasTestMethods(jClass)) { bugReporter.reportBug(new BugInstance(this, "IJU_NO_TESTS", LOW_PRIORITY).addClass(jClass)); } } directChildOfTestCase = "junit.framework.TestCase".equals(jClass.getSuperclassName()); jClass.accept(this); } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } }
@Override public void sawOpcode(int seen) { if (seen == Const.INVOKEVIRTUAL && "start".equals(getNameConstantOperand()) && "()V".equals(getSigConstantOperand())) { try { if (Hierarchy.isSubtype(getDottedClassConstantOperand(), "java.lang.Thread")) { int priority = Priorities.NORMAL_PRIORITY; if (getPC() + 4 >= getCode().getCode().length) { priority = Priorities.LOW_PRIORITY; } BugInstance bug = new BugInstance(this, "SC_START_IN_CTOR", priority).addClassAndMethod(this) .addCalledMethod(this); Subtypes2 subtypes2 = AnalysisContext.currentAnalysisContext().getSubtypes2(); Set<ClassDescriptor> directSubtypes = subtypes2.getDirectSubtypes(getClassDescriptor()); if (!directSubtypes.isEmpty()) { for (ClassDescriptor sub : directSubtypes) { bug.addClass(sub).describe(ClassAnnotation.SUBCLASS_ROLE); } bug.setPriority(Priorities.HIGH_PRIORITY); } bugAccumulator.accumulateBug(bug, this); } } catch (ClassNotFoundException e) { bugReporter.reportMissingClass(e); } } } }
if (assumedNonnullAt.size() < 4) { for (ProgramPoint p : assumedNonnullAt) { BugInstance bug = new BugInstance(this, "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", priority) .addClass(className).addField(f).addMethod(p.getMethodAnnotation()); bugAccumulator.accumulateBug(bug, p.getSourceLineAnnotation()); pattern = "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD"; bugReporter.reportBug(addClassFieldAndAccess(new BugInstance(this, pattern, priority), f)); for (ProgramPoint p : assumedNonNullAt) { bugAccumulator.accumulateBug( new BugInstance(this, pattern, npPriority).addClassAndMethod(p.method).addField(f), p.getSourceLineAnnotation()); bugReporter.reportMissingClass(e); } catch (CheckedAnalysisException e) { bugReporter.logError("Error getting outer XClass for " + outerClassName, e);
bugReporter.reportMissingClass(e); case 4: if (seen == Const.MONITORENTER) { pendingBug = new BugInstance(this, "WL_USING_GETCLASS_RATHER_THAN_CLASS_LITERAL", NORMAL_PRIORITY) .addClassAndMethod(this).addSourceLine(this);
bugReporter.reportBug(new BugInstance(this, "USM_USELESS_SUBCLASS_METHOD", LOW_PRIORITY).addClassAndMethod( this).addSourceLine(this, invokePC)); bugReporter.reportMissingClass(cnfe);
sawReadResolve = true; if (!"()Ljava/lang/Object;".equals(getMethodSig())) { bugReporter.reportBug(new BugInstance(this, "SE_READ_RESOLVE_MUST_RETURN_OBJECT", HIGH_PRIORITY) .addClassAndMethod(this)); } else if (obj.isStatic()) { bugReporter.reportBug(new BugInstance(this, "SE_READ_RESOLVE_IS_STATIC", HIGH_PRIORITY).addClassAndMethod(this)); } else if (obj.isPrivate()) { try { .getSubtypes(getClassDescriptor()); if (subtypes.size() > 1) { BugInstance bug = new BugInstance(this, "SE_PRIVATE_READ_RESOLVE_NOT_INHERITED", NORMAL_PRIORITY) .addClassAndMethod(this); boolean nasty = false; bugReporter.reportMissingClass(e);
pendingBug = new BugInstance(this, "UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLASS", priority).addClassAndMethod(this); potentialSuperCall = null; bugReporter.reportMissingClass(e);
bugReporter.reportBug(new BugInstance(this, "CN_IDIOM", NORMAL_PRIORITY).addClass(this)); priority--; BugInstance bug = new BugInstance(this, "CN_IDIOM_NO_SUPER_CALL", priority).addClass(this).addMethod( cloneMethodAnnotation); for (ClassDescriptor d : directSubtypes) { bugReporter.reportMissingClass(e); bugReporter.reportBug(new BugInstance(this, "CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE", priority).addClass(this) .addMethod(cloneMethodAnnotation));
String ref = getClassName(obj, i); if ((ref.startsWith("java") || ref.startsWith("org.w3c.dom")) && !defined.contains(ref)) { bugReporter.reportBug(new BugInstance(this, "VR_UNRESOLVABLE_REFERENCE", NORMAL_PRIORITY).addClass(obj) .addString(ref)); JavaClass target = Repository.lookupClass(className); if (!find(target, name, signature)) { bugReporter.reportBug(new BugInstance(this, "VR_UNRESOLVABLE_REFERENCE", NORMAL_PRIORITY).addClass(obj) .addString(getMemberName(target.getClassName(), name, signature))); bugReporter.reportMissingClass(e);
|| Subtypes2.instanceOf(fieldType, "javax.naming.Context")) { if (testingEnabled && obj.isTransient()) { bugReporter.reportBug(new BugInstance(this, "TESTING", NORMAL_PRIORITY).addClass(this) .addVisitedField(this) .addString("EJB implementation classes should not have fields of this type")); transientFieldsUpdates.put(getXField(), 0); } else if (reportTransientFieldOfNonSerializableClass) { bugReporter.reportBug(new BugInstance(this, "SE_TRANSIENT_FIELD_OF_NONSERIALIZABLE_CLASS", NORMAL_PRIORITY) .addClass(this).addVisitedField(this)); fieldWarningList.add(new BugInstance(this, "SE_BAD_FIELD_INNER_CLASS", priority).addClass(getThisClass() .getClassName())); } else if (isSerializable < 0.9) { System.out.println("Caught ClassNotFoundException"); bugReporter.reportMissingClass(e);
BugInstance bug = new BugInstance(this, "EQ_GETCLASS_AND_CLASS_CONSTANT", priority) .addClassAndMethod(this); bugReporter.reportMissingClass(e);
bugReporter.reportBug(new BugInstance(this, "JML_JSR166_CALLING_WAIT_RATHER_THAN_AWAIT", priority) .addClassAndMethod(classContext.getJavaClass(), method).addCalledMethod(cpg, iv).addMethod(m) .describe(MethodAnnotation.METHOD_ALTERNATIVE_TARGET).addType(classDescriptor) isSubtype = Hierarchy.isSubtype((ReferenceType) type, LOCK_TYPE); } catch (ClassNotFoundException e) { bugReporter.reportMissingClass(e); bugReporter.reportBug(new BugInstance(this, "JLM_JSR166_LOCK_MONITORENTER", isUtilConcurrentSig ? HIGH_PRIORITY : NORMAL_PRIORITY).addClassAndMethod(classContext.getJavaClass(), method).addType(sig) .addSourceForTopStackValue(classContext, method, location).addSourceLine(classContext, method, location)); bugReporter.reportBug(new BugInstance(this, "JLM_JSR166_UTILCONCURRENT_MONITORENTER", priority) .addClassAndMethod(classContext.getJavaClass(), method).addType(sig) .addSourceForTopStackValue(classContext, method, location).addSourceLine(classContext, method, location));
bugReporter.reportMissingClass(e); bugAccumulator.accumulateBug(new BugInstance(this, "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", priority) .addClassAndMethod(this).addField(f), this);
private void checkMonitorWait() { try { TypeDataflow typeDataflow = getClassContext().getTypeDataflow(getMethod()); TypeDataflow.LocationAndFactPair pair = typeDataflow.getLocationAndFactForInstruction(getPC()); if (pair == null) { return; } Type receiver = pair.frame.getInstance(pair.location.getHandle().getInstruction(), getClassContext() .getConstantPoolGen()); if (!(receiver instanceof ReferenceType)) { return; } if (Hierarchy.isSubtype((ReferenceType) receiver, CONDITION_TYPE)) { accumulator.accumulateBug( new BugInstance(this, "DM_MONITOR_WAIT_ON_CONDITION", HIGH_PRIORITY).addClassAndMethod(this), this); } } catch (ClassNotFoundException e) { bugReporter.reportMissingClass(e); } catch (DataflowAnalysisException e) { bugReporter.logError("Exception caught by DumbMethods", e); } catch (CFGBuilderException e) { bugReporter.logError("Exception caught by DumbMethods", e); } }
/** * */ private void check(ClassDescriptor c) { OpcodeStack.Item item = stack.getStackItem(0); if (item.isInitialParameter() && item.getRegisterNumber() == 1) { ClassDescriptor thisClassDescriptor = getClassDescriptor(); if (c.equals(thisClassDescriptor)) { return; } Subtypes2 subtypes2 = AnalysisContext.currentAnalysisContext().getSubtypes2(); try { if (!c.isArray() && (subtypes2.isSubtype(c, thisClassDescriptor) || subtypes2.isSubtype(thisClassDescriptor, c))) { return; } Type thisType = Type.getType(thisClassDescriptor.getSignature()); Type cType = Type.getType(c.getSignature()); IncompatibleTypes check = IncompatibleTypes.getPriorityForAssumingCompatible(thisType, cType, false); int priority = check.getPriority(); if ("java/lang/Object".equals(getSuperclassName()) && ClassName.isLocalOrAnonymous(getClassName())) { priority++; } bugAccumulator.accumulateBug(new BugInstance(this, "EQ_CHECK_FOR_OPERAND_NOT_COMPATIBLE_WITH_THIS", priority) .addClassAndMethod(this).addType(c).describe(TypeAnnotation.FOUND_ROLE), this); classSummary.checksForEqualTo(thisClassDescriptor, c); } catch (ClassNotFoundException e) { bugReporter.reportMissingClass(e); } } }
bugReporter.reportMissingClass(e); bugAccumulator.accumulateBug(new BugInstance(this, pos.bugType, pos.priority) .addClassAndMethod(methodGen, sourceFile).addTypeOfNamedClass(leakClass) .describe(TypeAnnotation.CLOSEIT_ROLE), SourceLineAnnotation.fromVisitedInstruction(classContext, methodGen,