Class UnreadFields

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

public class UnreadFields extends OpcodeStackDetector
  • Field Details

    • DEBUG

      private static final boolean DEBUG
    • INITIALIZER_ANNOTATIONS

      private static final List<String> INITIALIZER_ANNOTATIONS
    • READ_BY_FRAMEWORK_ANNOTATIONS

      private static final List<ClassDescriptor> READ_BY_FRAMEWORK_ANNOTATIONS
      A list of annotations for fields that might be read by frameworks, even though they are private
    • hasNativeMethods

      boolean hasNativeMethods
    • isSerializable

      boolean isSerializable
    • sawSelfCallInConstructor

      boolean sawSelfCallInConstructor
    • bugReporter

      private final BugReporter bugReporter
    • bugAccumulator

      private final BugAccumulator bugAccumulator
    • publicOrProtectedConstructor

      boolean publicOrProtectedConstructor
    • anonymousClassAnnotation

      private final Map<String, List<BugAnnotation>> anonymousClassAnnotation
    • junitNestedAnnotation

      private final ClassDescriptor junitNestedAnnotation
    • DO_NOT_CONSIDER

      static final int DO_NOT_CONSIDER
      See Also:
    • externalizable

      final ClassDescriptor externalizable
    • serializable

      final ClassDescriptor serializable
    • remote

      final ClassDescriptor remote
    • count_aload_1

      int count_aload_1
    • previousOpcode

      private int previousOpcode
    • previousPreviousOpcode

      private int previousPreviousOpcode
    • seenInvokeStatic

      boolean seenInvokeStatic
    • seenMonitorEnter

      boolean seenMonitorEnter
    • pendingGetField

      XField pendingGetField
    • data

    • saState

      int saState
    • dontComplainAbout

      static Pattern dontComplainAbout
    • withinAnonymousClass

      static Pattern withinAnonymousClass
  • Constructor Details

    • UnreadFields

      public UnreadFields(BugReporter bugReporter)
  • Method Details

    • visit

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

      public static boolean classHasParameter(org.apache.bcel.classfile.JavaClass obj)
    • visitAfter

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

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

      public static boolean isSeleniumWebElement(String signature)
    • visitAnnotation

      public void visitAnnotation(String annotationClass, Map<String, org.apache.bcel.classfile.ElementValue> map, boolean runtimeVisible)
      Description copied from class: AnnotationVisitor
      Visit annotation on a class, field or method
      Overrides:
      visitAnnotation in class AnnotationVisitor
      Parameters:
      annotationClass - class of annotation
      map - map from names to values
      runtimeVisible - true if annotation is runtime visible
    • isInjectionAttribute

      public static boolean isInjectionAttribute(@DottedClassName String annotationClass)
    • visit

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

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

      public void visit(org.apache.bcel.classfile.Method obj)
      Overrides:
      visit in class BetterVisitor
    • 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:
    • isInitializerMethod

      private boolean isInitializerMethod()
      Returns:
      true if the method is considered to be an initializer method. Fields might be initialized outside of a constructor, for instance through JUnit's BeforeEach
    • 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
      Overrides:
      report in class BytecodeScanningDetector
    • addClassFieldAndAccess

      private BugInstance addClassFieldAndAccess(BugInstance instance, XField f)
    • containsSpecialAnnotation

      public static boolean containsSpecialAnnotation(Collection<AnnotationValue> annotationsToCheck)
      Checks whether the collection of annotations associated with a given element include annotations that indicate the "URF_UNREAD_FIELD" detector should be skipped.
      Parameters:
      annotationsToCheck - Collections of annotations associated with given element.
      Returns:
      If true, "URF_UNREAD_FIELD" detector should be ignored for given field.
      See Also: