Skip to content

Static analysis code remediation: xsd-fu Java templates

Following static analysis of the ome-model source tree, the following remediation of the xsd-fu Java templates has been performed:

OME Model Object template:

  • Removal of unnecessary casts
  • Removal of unused variables
  • Special-casing of String and numeric type member usage to remove unnecessary use of toString and valueOf
  • Removal of special-cases which are never used
  • Suppression of warnings for methods which are unused [within this source tree; many are used externally]

OME Model Enums and Handlers templates:

  • Correction of double-assignment of units
  • Suppression of unused method warnings [within this source tree; many are used externally]

OME Model Object and Enums templates:

  • Use <> for generics where the type can be inferred
  • Removal of unused imports

MetadataStore and MetadataRetrieve class templates:

  • Addition of missing final qualifiers
  • Javadoc comment fixes
  • Use of new-style enhanced for loops
  • Removal of unnecessary casts
  • Correct usage of lastIndexOf to not use length

Total static analysis warnings fixed: 9042 (12303 before, 3261 after)

Testing:

The refactoring should not result in any behavioural changes. All unit tests and integration tests should continue to pass. There should be no compatibility changes for downstream consumers.

Edited by Roger Leigh

Merge request reports