Package com.mebigfatguy.fbcontrib.detect
Class ConfusingAutoboxedOverloading
java.lang.Object
edu.umd.cs.findbugs.visitclass.BetterVisitor
edu.umd.cs.findbugs.visitclass.PreorderVisitor
com.mebigfatguy.fbcontrib.detect.ConfusingAutoboxedOverloading
- All Implemented Interfaces:
edu.umd.cs.findbugs.Detector,edu.umd.cs.findbugs.Priorities,org.apache.bcel.classfile.Visitor
public class ConfusingAutoboxedOverloading
extends edu.umd.cs.findbugs.visitclass.PreorderVisitor
implements edu.umd.cs.findbugs.Detector
looks for methods that have the same signature, except where one uses a
Character parameter, and the other uses an int, long, float, double
parameter. Since autoboxing is available in 1.5 one might assume that
test('a')
would map to
public void test(Character c)but instead maps to one that takes an int, long, float or double.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final edu.umd.cs.findbugs.BugReporterprivate static final intFields inherited from interface edu.umd.cs.findbugs.Priorities
EXP_PRIORITY, HIGH_PRIORITY, IGNORE_PRIORITY, LOW_PRIORITY, NORMAL_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionConfusingAutoboxedOverloading(edu.umd.cs.findbugs.BugReporter bugReporter) constructs a CAO detector given the reporter to report bugs on -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleanconfusingSignatures(String sig1, String sig2) returns if one signature is a Character and the other is a primitiveprivate static booleanreturns whether a method signature has either a Character or primitiveprivate voidpopulateMethodInfo(org.apache.bcel.classfile.JavaClass cls, Map<String, Set<String>> methodInfo) fills out a set of method details for possibly confusing method signaturesvoidreport()implements the detector with null implementationvoidvisitClassContext(edu.umd.cs.findbugs.ba.ClassContext classContext) overrides the visitor to look for confusing signaturesMethods inherited from class edu.umd.cs.findbugs.visitclass.PreorderVisitor
amVisitingMainMethod, asUnsignedByte, doVisitMethod, getClassDescriptor, getClassName, getCode, getConstantPool, getDottedClassName, getDottedFieldSig, getDottedMethodSig, getDottedSuperclassName, getField, getFieldDescriptor, getFieldIsStatic, getFieldName, getFieldSig, getFullyQualifiedFieldName, getFullyQualifiedMethodName, getMethod, getMethodDescriptor, getMethodName, getMethodSig, getMethodVisitOrder, getNumberArguments, getNumberMethodArguments, getPackageName, getSizeOfSurroundingTryBlock, getSizeOfSurroundingTryBlock, getSourceFile, getStringFromIndex, getSuperclassName, getSurroundingCaughtExceptions, getSurroundingCaughtExceptions, getSurroundingCaughtExceptionTypes, getSurroundingTryBlock, getSurroundingTryBlock, getThisClass, getXClass, getXField, getXMethod, hasInterestingClass, hasInterestingMethod, isVisitMethodsInCallOrder, setupVisitorForClass, setVisitMethodsInCallOrder, shouldVisit, toString, visitAfter, visitAfter, visitAnnotation, visitAnnotationDefault, visitAnnotationEntry, visitBootstrapMethods, visitCode, visitConstantInvokeDynamic, visitConstantMethodHandle, visitConstantMethodType, visitConstantModule, visitConstantPackage, visitConstantPool, visitEnclosingMethod, visitingField, visitingMethod, visitInnerClasses, visitJavaClass, visitLineNumberTable, visitLocalVariableTable, visitMethodParameters, visitParameterAnnotation, visitParameterAnnotationEntry, visitStackMap, visitStackMapEntryMethods inherited from class edu.umd.cs.findbugs.visitclass.BetterVisitor
clone, report, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitCodeException, visitConstantClass, visitConstantDouble, visitConstantFieldref, visitConstantFloat, visitConstantInteger, visitConstantInterfaceMethodref, visitConstantLong, visitConstantMethodref, visitConstantNameAndType, visitConstantString, visitConstantUtf8, visitConstantValue, visitDeprecated, visitExceptionTable, visitField, visitInnerClass, visitLineNumber, visitLocalVariable, visitLocalVariableTypeTable, visitMethod, visitSignature, visitSourceFile, visitSynthetic, visitUnknownMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.bcel.classfile.Visitor
visitConstantDynamic, visitMethodParameter, visitModule, visitModuleExports, visitModuleMainClass, visitModuleOpens, visitModulePackages, visitModuleProvides, visitModuleRequires, visitNestHost, visitNestMembers, visitRecord, visitRecordComponent, visitStackMapType
-
Field Details
-
JDK15_MAJOR
private static final int JDK15_MAJOR- See Also:
-
primitiveSigs
-
bugReporter
private final edu.umd.cs.findbugs.BugReporter bugReporter
-
-
Constructor Details
-
ConfusingAutoboxedOverloading
public ConfusingAutoboxedOverloading(edu.umd.cs.findbugs.BugReporter bugReporter) constructs a CAO detector given the reporter to report bugs on- Parameters:
bugReporter- the sync of bug reports
-
-
Method Details
-
visitClassContext
public void visitClassContext(edu.umd.cs.findbugs.ba.ClassContext classContext) overrides the visitor to look for confusing signatures- Specified by:
visitClassContextin interfaceedu.umd.cs.findbugs.Detector- Parameters:
classContext- the context object that holds the JavaClass currently being parsed
-
confusingSignatures
returns if one signature is a Character and the other is a primitive- Parameters:
sig1- the first method signaturesig2- the second method signature- Returns:
- if one signature is a Character and the other a primitive
-
populateMethodInfo
private void populateMethodInfo(org.apache.bcel.classfile.JavaClass cls, Map<String, Set<String>> methodInfo) fills out a set of method details for possibly confusing method signatures- Parameters:
cls- the current class being parsedmethodInfo- a collection to hold possibly confusing methods
-
isPossiblyConfusingSignature
returns whether a method signature has either a Character or primitive- Parameters:
sig- the method signature- Returns:
- whether a method signature has either a Character or primitive
-
report
public void report()implements the detector with null implementation- Specified by:
reportin interfaceedu.umd.cs.findbugs.Detector
-