Naming Rules ("rulesets/unused.xml ")

UnusedPrivateField Rule

Checks for private fields that are not referenced within the same class.

Known limitations:

  • Does not recognize field access when field name is a GString (e.g. this."$fieldName " )
  • Does not recognize access of private field of another instance (i.e. other than this )

UnusedPrivateMethod Rule

Checks for private methods that are not referenced within the same class.

Known limitations:

  • Does not recognize method reference through property access (e.g. getName() accessed as x.name )
  • Does not recognize method invocations when method name is a GString (e.g. this."$methodName "() )
  • Does not recognize invoking private method of another instance (i.e. other than this )
  • Does not differentiate between multiple private methods with the same name but different parameters (i.e., overloaded)
  • Does not check for unused constructors

UnusedVariable Rule

Checks for variables that are never referenced.

Known limitations:

  • Does not recognize variable references on the same line as the variable declaration.
  • Incorrectly considers a variable referenced if another variable with the same name is referenced elsewhere (in another scope/block).