Skip to content

[SpotBugs] Static state & concurrency (58 findings) #33

Description

@clrozeboom

Priority: HIGH-MED · 58 findings (8 high-confidence P1) · SpotBugs category 2/5

Instance methods writing static fields (34 sites), unsynchronized singleton getters, lazy static init races, a thread started in a constructor, and constructors that can throw partially-initialized. This independently confirms the static-state problems found during the offseason architecture review (see the deferred Phase 3 de-static work: YAGSLSwerveDrivetrain.swerveDrive, RobotParser statics, GenericRobot.subsystemParser). Fixing these is refactoring work, best done deliberately with the test suite as a guard — not batch-mechanical.

Patterns

  • ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD — 34 findings
  • CT_CONSTRUCTOR_THROW — 8 findings
  • MS_CANNOT_BE_FINAL — 8 findings
  • SING_SINGLETON_GETTER_NOT_SYNCHRONIZED — 3 findings
  • LI_LAZY_INIT_STATIC — 3 findings
  • SC_START_IN_CTOR — 1 finding
  • SING_SINGLETON_HAS_NONPRIVATE_CONSTRUCTOR — 1 finding

High-confidence (P1) findings — start here

  • ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD at frc/robot/RobotContainer.java:20
  • ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD at org/frc5010/common/arch/GenericRobot.java:95
  • ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD at org/frc5010/common/arch/GenericRobot.java:260
  • ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD at org/frc5010/common/auto/pathplanner/PathFinderCommand.java:281
  • ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD at org/frc5010/common/auto/pathplanner/PathFinderCommand.java:449
  • ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD at org/frc5010/common/drive/swerve/GenericSwerveDrivetrain.java:84
  • ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD at org/frc5010/common/drive/swerve/akit/ModuleIOSpark.java:202
  • ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD at org/frc5010/common/drive/swerve/akit/ModuleIOSparkTalon.java:180

All findings, grouped by file

  • org/frc5010/common/config/RobotParser.java — 6: ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD×5, CT_CONSTRUCTOR_THROW×1 (lines 90, 100, 101, 106, 107, 124)
  • org/frc5010/common/auto/pathplanner/PathFinderCommand.java — 5: ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD×5 (lines 129, 178, 281, 291, 449)
  • org/frc5010/common/drive/swerve/akit/TalonFXOdometryThread.java — 4: ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD×2, SING_SINGLETON_GETTER_NOT_SYNCHRONIZED×1, LI_LAZY_INIT_STATIC×1 (lines 43, 47, 55, 56)
  • org/frc5010/common/arch/GenericRobot.java — 3: ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD×3 (lines 95, 260, 292)
  • org/frc5010/common/config/json/RobotJson.java — 3: ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD×3 (lines 82, 83, 84)
  • org/frc5010/common/constants/Constants.java — 3: MS_CANNOT_BE_FINAL×3 (lines 19, 20, 21)
  • org/frc5010/common/drive/swerve/YAGSLSwerveDrivetrain.java — 3: ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD×2, CT_CONSTRUCTOR_THROW×1 (lines 98, 102, 105)
  • org/frc5010/common/drive/swerve/akit/PhoenixOdometryThread.java — 3: SING_SINGLETON_GETTER_NOT_SYNCHRONIZED×1, LI_LAZY_INIT_STATIC×1, ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD×1 (lines 47, 51, 58)
  • org/frc5010/common/drive/swerve/akit/SparkOdometryThread.java — 3: LI_LAZY_INIT_STATIC×1, SING_SINGLETON_GETTER_NOT_SYNCHRONIZED×1, ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD×1 (lines 33, 39, 44)
  • org/frc5010/common/sensors/camera/QuestNavInterface.java — 3: ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD×3 (lines 245, 246, 293)
  • org/frc5010/common/config/json/AKitSwerveDrivetrainJson.java — 2: ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD×2 (lines 86, 99)
  • org/frc5010/common/drive/DifferentialDrivetrain.java — 2: CT_CONSTRUCTOR_THROW×1, ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD×1 (lines 61, 166)
  • org/frc5010/common/drive/swerve/SwerveDriveFunctions.java — 2: MS_CANNOT_BE_FINAL×2 (lines 38, 39)
  • frc/robot/RobotContainer.java — 1: ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD (line 20)
  • org/frc5010/common/drive/swerve/GenericSwerveDrivetrain.java — 1: ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD (line 84)
  • org/frc5010/common/drive/swerve/akit/ModuleIOSpark.java — 1: ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD (line 202)
  • org/frc5010/common/drive/swerve/akit/ModuleIOSparkTalon.java — 1: ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD (line 180)
  • frc/robot/Robot.java — 1: ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD (line 81)
  • org/frc5010/common/arch/GenericCommandSequence.java — 1: CT_CONSTRUCTOR_THROW (line 36)
  • org/frc5010/common/config/RobotsParser.java — 1: CT_CONSTRUCTOR_THROW (line 30)
  • org/frc5010/common/drive/GenericDrivetrain.java — 1: MS_CANNOT_BE_FINAL (line 78)
  • org/frc5010/common/drive/swerve/akit/AkitSwerveDrive.java — 1: SC_START_IN_CTOR (line 132)
  • org/frc5010/common/drive/swerve/akit/ModuleIOTalonFX.java — 1: CT_CONSTRUCTOR_THROW (line 114)
  • org/frc5010/common/drive/swerve/akit/util/SparkUtil.java — 1: MS_CANNOT_BE_FINAL (line 19)
  • org/frc5010/common/motors/control/TalonFXController.java — 1: CT_CONSTRUCTOR_THROW (line 44)
  • …plus 4 more files (4 findings) — see the full table in the triage doc.

Full detail

Complete file:line table: docs/SPOTBUGS_TRIAGE.md (section 2).
Regenerate the report with ./gradlew spotbugsMainbuild/reports/spotbugs/main.html.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions