Class MultipleInstantiationsOfSingletons

    • Field Detail

      • cloneableInterface

        private org.apache.bcel.classfile.JavaClass cloneableInterface
      • serializableInterface

        private org.apache.bcel.classfile.JavaClass serializableInterface
      • hasSingletonPostFix

        private boolean hasSingletonPostFix
      • hasPublicConstructor

        private boolean hasPublicConstructor
      • isCloneable

        private boolean isCloneable
      • implementsCloneableDirectly

        private boolean implementsCloneableDirectly
      • cloneMethod

        private XMethod cloneMethod
      • cloneOnlyThrowsException

        private boolean cloneOnlyThrowsException
      • cloneOnlyThrowsCloneNotSupportedException

        private boolean cloneOnlyThrowsCloneNotSupportedException
      • isSerializable

        private boolean isSerializable
      • isInstanceAssignOk

        private boolean isInstanceAssignOk
      • hasNoFactoryMethod

        private boolean hasNoFactoryMethod
      • isInstanceFieldLazilyInitialized

        private boolean isInstanceFieldLazilyInitialized
      • instanceField

        private XField instanceField
      • eagerlyInitializedFields

        private final java.util.Set<XField> eagerlyInitializedFields
      • instanceGetterMethods

        private final java.util.Map<XField,​XMethod> instanceGetterMethods
      • methodsUsingMonitor

        private final java.util.List<XMethod> methodsUsingMonitor
      • calledMethodsByMethods

        private final java.util.Map<XMethod,​java.util.List<XMethod>> calledMethodsByMethods
    • Constructor Detail

      • MultipleInstantiationsOfSingletons

        public MultipleInstantiationsOfSingletons​(BugReporter bugReporter)
    • Method Detail

      • visit

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

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

        private boolean isInstanceField​(XField field,
                                        java.lang.String clsName)
      • isMergedConstructorAndFieldStore

        private boolean isMergedConstructorAndFieldStore​(XField field)
      • pathHasSelfConstructor

        private boolean pathHasSelfConstructor​(CFG cfg,
                                               BasicBlock block,
                                               org.apache.bcel.generic.ConstantPoolGen cpg,
                                               int depth)
      • pathHasGetStaticOf

        private boolean pathHasGetStaticOf​(CFG cfg,
                                           BasicBlock block,
                                           XField field,
                                           org.apache.bcel.generic.ConstantPoolGen cpg,
                                           int depth)
      • blockHasSelfConstructor

        private boolean blockHasSelfConstructor​(BasicBlock block,
                                                org.apache.bcel.generic.ConstantPoolGen cpg)
      • blockHasGetStaticOf

        private boolean blockHasGetStaticOf​(BasicBlock block,
                                            XField field,
                                            org.apache.bcel.generic.ConstantPoolGen cpg)
      • isPassthroughBlock

        private boolean isPassthroughBlock​(BasicBlock block)
      • visitAfter

        public void visitAfter​(org.apache.bcel.classfile.JavaClass javaClass)
        Overrides:
        visitAfter in class PreorderVisitor
      • hasSynchronized

        private boolean hasSynchronized​(XMethod method,
                                        java.util.Set<XMethod> visitedMethods)
        Parameters:
        method - The method we are checking
        visitedMethods - The set of methods we have already visited, to break recursion when methods are called recursively. To be initially empty.
        Returns:
        true if the method (or one of the methods called recursively) is synchronized or uses a monitor.
      • getNumberOfEnumValues

        private int getNumberOfEnumValues​(org.apache.bcel.classfile.JavaClass javaClass)