2729StormRobotics/Storm2016

Write to static field from instance method org.usfirst.frc.team2729.robot.Robot.robotInit()

Opened this issue · 0 comments

Static fields that this bug applies to:

public static DriveTrain driveTrain;
public static IntakeSystem intake;
public static ShootingSystem shoot;
public static HangingSystem hang;
public static VisionSystem vision;
public static OI oi;

...

public void robotInit() {
...
    driveTrain = new DriveTrain();
    intake = new IntakeSystem();
    shoot = new ShootingSystem();
    hang = new HangingSystem();
    oi = new OI();
    vision = new VisionSystem();

This instance method writes to a static field. This is tricky to get correct if multiple instances are being manipulated, and generally bad practice.