Files
allwpilib/javacPlugin/src
Sam Carlberg 98c03baf54 [javac] Add compiler check for integer division in floating-point contexts (#8885)
Useful for catching bad behavior when doing math or configuring ratios
with integers. Errors can be turned off with
`@SuppressWarnings("IntegerDivision")`

```java
double kV = 12 / 6000; // error: integer division in a floating-point context
double kV = 12. / 6000; // OK
double kV = 12 / 6000.; // OK

int kV = 12 / 6000; // OK, but evaluates to 0

double ratio = 42 / 12; // error: integer division in a floating-point context

@SuppressWarnings("IntegerDivision")
double ratio = 42 / 12; // OK, evaluates to 2
```

```
Execution failed for task ':developerRobot:compileJava'.
> Compilation failed; see the compiler output below.
  /Users/sam/code/wpilib/allwpilib/developerRobot/src/main/java/wpilib/robot/Robot.java:10: error: integer division in a floating-point context
    double kV = 12 / 6000;
                   ^
  1 error
```

Also adds the compiler plugin as a dependency to the developerRobot
project for dev testing
2026-06-04 21:56:22 -07:00
..