Class FindUnrelatedTypesInGenericContainer

java.lang.Object
edu.umd.cs.findbugs.detect.FindUnrelatedTypesInGenericContainer
All Implemented Interfaces:
Detector, Priorities

public class FindUnrelatedTypesInGenericContainer extends Object implements Detector
  • Field Details

    • bugReporter

      private final BugReporter bugReporter
    • DEBUG

      private static final boolean DEBUG
    • callMap

      Map classname, methodname and signature to an int []. Each position in the int [] corresponds to an argument in the methodSignature. For each argument i, the value at position i corresponds to the index of the corresponding type in the class type parameters. If the argument has no correspondence, then the value is -1.

      Get the String key by calling getCollectionsMapKey()

    • baseGenericTypes

      @StaticConstant static final Set<String> baseGenericTypes
  • Constructor Details

    • FindUnrelatedTypesInGenericContainer

      public FindUnrelatedTypesInGenericContainer(BugReporter bugReporter)
  • Method Details

    • addCheckedCall

      private void addCheckedCall(@DottedClassName String className, String methodName, String sig, int argumentParameterIndex, int typeParameterIndex)
    • addCheckedCall

      private void addCheckedCall(@DottedClassName String className, String methodName, int typeParameterIndex)
    • visitClassContext

      public void visitClassContext(ClassContext classContext)
      Visit the class context
      Specified by:
      visitClassContext in interface Detector
      Parameters:
      classContext - the ClassContext
      See Also:
    • prescreen

      public boolean prescreen(ClassContext classContext, org.apache.bcel.classfile.Method method)
      Use this to screen out methods that do not contain invocations.
    • isSynthetic

      private boolean isSynthetic(org.apache.bcel.classfile.Method m)
      Methods marked with the "Synthetic" attribute do not appear in the source code
    • isGenericCollection

      private boolean isGenericCollection(ClassDescriptor operandClass)
    • analyzeMethod

      private void analyzeMethod(ClassContext classContext, org.apache.bcel.classfile.Method method) throws CFGBuilderException, DataflowAnalysisException
      Throws:
      CFGBuilderException
      DataflowAnalysisException
    • compareTypes

      private IncompatibleTypes compareTypes(org.apache.bcel.generic.Type expectedType, org.apache.bcel.generic.Type actualType, boolean ignoreBaseType)
      Compare to see if the argument argType passed to the method matches the type of the corresponding parameter. The simplest case is when both are equal.

      This is a conservative comparison - returns true if it cannot decide. If the parameter type is a type variable (e.g. T) then we don't know enough (yet) to decide if they do not match so return true.

      Parameters:
      ignoreBaseType - TODO
    • compareTypeParameters

      private IncompatibleTypes compareTypeParameters(GenericObjectType parmGeneric, GenericObjectType argGeneric)
    • compareTypesOld

      private boolean compareTypesOld(org.apache.bcel.generic.Type parmType, org.apache.bcel.generic.Type argType)
    • report

      public void report()
      Empty
      Specified by:
      report in interface Detector
      See Also: