Class FieldCouldBeLocal.BlockState

java.lang.Object
com.mebigfatguy.fbcontrib.detect.FieldCouldBeLocal.BlockState
Enclosing class:
FieldCouldBeLocal

private static class FieldCouldBeLocal.BlockState extends Object
holds the parse state of the current basic block, and what fields are left to be checked the fields that are left to be checked are a reference from the parent block and a new collection is created on first write to the set to reduce memory concerns.
  • Field Details

    • basicBlock

      private final edu.umd.cs.findbugs.ba.BasicBlock basicBlock
    • uncheckedFields

      private Set<String> uncheckedFields
    • fieldsAreSharedWithParent

      private boolean fieldsAreSharedWithParent
  • Constructor Details

    • BlockState

      public BlockState(edu.umd.cs.findbugs.ba.BasicBlock bb, Set<String> fields)
      creates a BlockState consisting of the next basic block to parse, and what fields are to be checked
      Parameters:
      bb - the basic block to parse
      fields - the fields to look for first use
    • BlockState

      public BlockState(edu.umd.cs.findbugs.ba.BasicBlock bb, FieldCouldBeLocal.BlockState parentBlockState)
      creates a BlockState consisting of the next basic block to parse, and what fields are to be checked
      Parameters:
      bb - the basic block to parse
      parentBlockState - the basic block to copy from
  • Method Details

    • getBasicBlock

      public edu.umd.cs.findbugs.ba.BasicBlock getBasicBlock()
      get the basic block to parse
      Returns:
      the basic block
    • getUncheckedFieldSize

      public int getUncheckedFieldSize()
      returns the number of unchecked fields
      Returns:
      the number of unchecked fields
    • removeUncheckedField

      public boolean removeUncheckedField(String field)
      return the field from the set of unchecked fields if this occurs make a copy of the set on write to reduce memory usage
      Parameters:
      field - the field to be removed
      Returns:
      whether the object was removed.
    • toString

      public String toString()
      Overrides:
      toString in class Object