Package edu.umd.cs.findbugs.detect
Class FindUnrelatedTypesInGenericContainer
- java.lang.Object
-
- edu.umd.cs.findbugs.detect.FindUnrelatedTypesInGenericContainer
-
- All Implemented Interfaces:
Detector,Priorities
public class FindUnrelatedTypesInGenericContainer extends java.lang.Object implements Detector
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classFindUnrelatedTypesInGenericContainer.Info
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.util.Set<java.lang.String>baseGenericTypesprivate BugReporterbugReporterprivate MultiMap<java.lang.String,FindUnrelatedTypesInGenericContainer.Info>callMapMap classname, methodname and signature to an int [].private static booleanDEBUG-
Fields inherited from interface edu.umd.cs.findbugs.Priorities
EXP_PRIORITY, HIGH_PRIORITY, IGNORE_PRIORITY, LOW_PRIORITY, NORMAL_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description FindUnrelatedTypesInGenericContainer(BugReporter bugReporter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddCheckedCall(java.lang.String className, java.lang.String methodName, int typeParameterIndex)private voidaddCheckedCall(java.lang.String className, java.lang.String methodName, java.lang.String sig, int argumentParameterIndex, int typeParameterIndex)private voidanalyzeMethod(ClassContext classContext, org.apache.bcel.classfile.Method method)private IncompatibleTypescompareTypeParameters(GenericObjectType parmGeneric, GenericObjectType argGeneric)private IncompatibleTypescompareTypes(org.apache.bcel.generic.Type expectedType, org.apache.bcel.generic.Type actualType, boolean ignoreBaseType)Compare to see if the argumentargTypepassed to the method matches the type of the corresponding parameter.private booleancompareTypesOld(org.apache.bcel.generic.Type parmType, org.apache.bcel.generic.Type argType)private booleanisGenericCollection(ClassDescriptor operandClass)private booleanisSynthetic(org.apache.bcel.classfile.Method m)Methods marked with the "Synthetic" attribute do not appear in the source codebooleanprescreen(ClassContext classContext, org.apache.bcel.classfile.Method method)Use this to screen out methods that do not contain invocations.voidreport()EmptyvoidvisitClassContext(ClassContext classContext)Visit the class context
-
-
-
Field Detail
-
bugReporter
private final BugReporter bugReporter
-
DEBUG
private static final boolean DEBUG
-
callMap
private final MultiMap<java.lang.String,FindUnrelatedTypesInGenericContainer.Info> 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 java.util.Set<java.lang.String> baseGenericTypes
-
-
Constructor Detail
-
FindUnrelatedTypesInGenericContainer
public FindUnrelatedTypesInGenericContainer(BugReporter bugReporter)
-
-
Method Detail
-
addCheckedCall
private void addCheckedCall(@DottedClassName java.lang.String className, java.lang.String methodName, java.lang.String sig, int argumentParameterIndex, int typeParameterIndex)
-
addCheckedCall
private void addCheckedCall(@DottedClassName java.lang.String className, java.lang.String methodName, int typeParameterIndex)
-
visitClassContext
public void visitClassContext(ClassContext classContext)
Visit the class context- Specified by:
visitClassContextin interfaceDetector- Parameters:
classContext- the ClassContext- See Also:
Detector.visitClassContext(edu.umd.cs.findbugs.ba.ClassContext)
-
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
-
compareTypes
private IncompatibleTypes compareTypes(org.apache.bcel.generic.Type expectedType, org.apache.bcel.generic.Type actualType, boolean ignoreBaseType)
Compare to see if the argumentargTypepassed 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:
reportin interfaceDetector- See Also:
Detector.report()
-
-