Class Naming

    • Field Detail

      • baseClassName

        java.lang.String baseClassName
      • classIsPublicOrProtected

        boolean classIsPublicOrProtected
      • canonicalToXMethod

        java.util.HashMap<java.lang.String,​java.util.TreeSet<XMethod>> canonicalToXMethod
      • visited

        java.util.HashSet<java.lang.String> visited
      • hasBadMethodNames

        boolean hasBadMethodNames
      • hasBadFieldNames

        boolean hasBadFieldNames
      • isEclipseNLS

        private boolean isEclipseNLS
        Eclipse uses reflection to initialize NLS message bundles. Classes which using this mechanism are usually extending org.eclipse.osgi.util.NLS class and contains lots of public static String fields which are used as message Constants. Unfortunately these fields often has bad names which does not follow Java code convention, so FB reports tons of warnings for such Eclipse message fields.
        See Also:
        MutableStaticFields
      • sigType

        private static final java.util.regex.Pattern sigType
    • Constructor Detail

    • Method Detail

      • definedIn

        @CheckForNull
        public static XMethod definedIn​(org.apache.bcel.classfile.JavaClass clazz,
                                        XMethod m)
      • confusingMethodNamesWrongCapitalization

        public static boolean confusingMethodNamesWrongCapitalization​(XMethod m1,
                                                                      XMethod m2)
      • confusingMethodNamesWrongPackage

        public static boolean confusingMethodNamesWrongPackage​(XMethod m1,
                                                               XMethod m2)
      • visitClassContext

        public void visitClassContext​(ClassContext classContext)
        Description copied from interface: Detector
        Visit the ClassContext for a class which should be analyzed for instances of bug patterns.
        Specified by:
        visitClassContext in interface Detector
        Parameters:
        classContext - the ClassContext
      • checkSuper

        private boolean checkSuper​(XMethod m,
                                   java.util.Set<XMethod> others)
      • allAbstract

        private boolean allAbstract​(java.util.Set<XMethod> overrides)
      • checkNonSuper

        private boolean checkNonSuper​(XMethod m,
                                      java.util.Set<XMethod> others)
      • report

        public void report()
        Description copied from interface: Detector
        This method is called after all classes to be visited. It should be used by any detectors which accumulate information over all visited classes to generate results.
        Specified by:
        report in interface Detector
      • stripPackageName

        public java.lang.String stripPackageName​(java.lang.String className)
      • sameSimpleName

        public boolean sameSimpleName​(java.lang.String class1,
                                      java.lang.String class2)
      • visitJavaClass

        public void visitJavaClass​(org.apache.bcel.classfile.JavaClass obj)
        Specified by:
        visitJavaClass in interface org.apache.bcel.classfile.Visitor
        Overrides:
        visitJavaClass in class PreorderVisitor
      • mightInheritFromException

        private static boolean mightInheritFromException​(ClassDescriptor d)
        Determine whether the class descriptor ultimately inherits from java.lang.Exception
        Parameters:
        d - class descriptor we want to check
        Returns:
        true iff the descriptor ultimately inherits from Exception
      • visit

        public void visit​(org.apache.bcel.classfile.JavaClass obj)
        Overrides:
        visit in class BetterVisitor
      • visit

        public void visit​(org.apache.bcel.classfile.Field obj)
        Overrides:
        visit in class BetterVisitor
      • badFieldName

        private boolean badFieldName​(org.apache.bcel.classfile.Field obj)
      • getSignatureOfOuterClass

        @CheckForNull
        private static java.lang.String getSignatureOfOuterClass​(org.apache.bcel.classfile.JavaClass obj)
      • markedAsNotUsable

        private boolean markedAsNotUsable​(org.apache.bcel.classfile.Method obj)
      • findVoidConstructor

        @CheckForNull
        private static org.apache.bcel.classfile.Method findVoidConstructor​(org.apache.bcel.classfile.JavaClass clazz)
      • visit

        public void visit​(org.apache.bcel.classfile.Method obj)
        Overrides:
        visit in class BetterVisitor
      • isVoidConstructor

        private static boolean isVoidConstructor​(org.apache.bcel.classfile.JavaClass clazz,
                                                 org.apache.bcel.classfile.Method m)
      • badMethodName

        private boolean badMethodName​(java.lang.String mName)
      • codeDoesSomething

        private boolean codeDoesSomething​(org.apache.bcel.classfile.Code code)
      • removePackageNamesFromSignature

        private static java.lang.String removePackageNamesFromSignature​(java.lang.String sig)