Class MultipleInstantiationsOfSingletons

All Implemented Interfaces:
Detector, Priorities, org.apache.bcel.classfile.Visitor

public class MultipleInstantiationsOfSingletons extends OpcodeStackDetector
  • Field Details

    • bugReporter

      private final BugReporter bugReporter
    • cloneableInterface

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

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

      private boolean hasSingletonPostFix
    • 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 Set<XField> eagerlyInitializedFields
    • instanceGetterMethods

      private final Map<XField,XMethod> instanceGetterMethods
    • methodsUsingMonitor

      private final List<XMethod> methodsUsingMonitor
  • Constructor Details

    • MultipleInstantiationsOfSingletons

      public MultipleInstantiationsOfSingletons(BugReporter bugReporter)
  • Method Details

    • visit

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

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

      public boolean beforeOpcode(int seen)
      Description copied from class: DismantleBytecode
      return false if we should skip calling sawOpcode
      Overrides:
      beforeOpcode in class OpcodeStackDetector
    • sawOpcode

      public void sawOpcode(int seen)
      Description copied from class: OpcodeStackDetector

      By default, this method will not be called when stack is TOP. To change this behavior, override #beforeOpcode(int) and change to return true even if stack is TOP.

      see Using FindBugs for Research to learn lattice and what TOP means.

      Specified by:
      sawOpcode in class OpcodeStackDetector
      See Also:
    • isInstanceField

      private boolean isInstanceField(XField field, String clsName)
    • visitAfter

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

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