[build] Change defaults for Java lints (#4300)

Removes the need to individually suppress the "serial" warning.
This commit is contained in:
Starlight220
2022-06-07 03:06:43 +03:00
committed by GitHub
parent a4787130f4
commit f2d243fa68
16 changed files with 12 additions and 21 deletions

View File

@@ -5,7 +5,6 @@
package edu.wpi.first.hal.util;
/** Exception indicating that the resource is already allocated. */
@SuppressWarnings("serial")
public class AllocationException extends RuntimeException {
/**
* Create a new AllocationException.

View File

@@ -7,7 +7,6 @@ package edu.wpi.first.hal.util;
/**
* This exception represents an error in which a lower limit was set as higher than an upper limit.
*/
@SuppressWarnings("serial")
public class BoundaryException extends RuntimeException {
/**
* Create a new exception with the given message.

View File

@@ -8,7 +8,6 @@ package edu.wpi.first.hal.util;
* Exception indicating that the resource is already allocated This is meant to be thrown by the
* resource class.
*/
@SuppressWarnings("serial")
public class CheckedAllocationException extends Exception {
/**
* Create a new CheckedAllocationException.

View File

@@ -5,7 +5,6 @@
package edu.wpi.first.hal.util;
/** Exception indicating that an error has occurred with a HAL Handle. */
@SuppressWarnings("serial")
public class HalHandleException extends RuntimeException {
/**
* Create a new HalHandleException.

View File

@@ -5,7 +5,6 @@
package edu.wpi.first.hal.util;
/** Exception for bad status codes from the chip object. */
@SuppressWarnings("serial")
public final class UncleanStatusException extends IllegalStateException {
private final int m_statusCode;

View File

@@ -103,7 +103,11 @@ tasks.withType(JavaCompile).configureEach {
'-encoding',
'UTF8',
"-Werror",
"-Xlint:deprecation,removal",
"-Xlint:all",
// ignore AutoCloseable warnings
"-Xlint:-try",
// ignore missing serialVersionUID warnings
"-Xlint:-serial",
]
}

View File

@@ -351,8 +351,7 @@ public class ADIS16448_IMU implements AutoCloseable, NTSendable {
/** */
private static int toInt(int... buf) {
return (int)
((buf[0] & 0xFF) << 24 | (buf[1] & 0xFF) << 16 | (buf[2] & 0xFF) << 8 | (buf[3] & 0xFF));
return (buf[0] & 0xFF) << 24 | (buf[1] & 0xFF) << 16 | (buf[2] & 0xFF) << 8 | (buf[3] & 0xFF);
}
/** */

View File

@@ -392,8 +392,7 @@ public class ADIS16470_IMU implements AutoCloseable, NTSendable {
* @return
*/
private static int toInt(int... buf) {
return (int)
((buf[0] & 0xFF) << 24 | (buf[1] & 0xFF) << 16 | (buf[2] & 0xFF) << 8 | (buf[3] & 0xFF));
return (buf[0] & 0xFF) << 24 | (buf[1] & 0xFF) << 16 | (buf[2] & 0xFF) << 8 | (buf[3] & 0xFF);
}
/**

View File

@@ -16,7 +16,6 @@ import edu.wpi.first.wpilibj.AnalogTriggerOutput.AnalogTriggerType;
/** Class for creating and configuring Analog Triggers. */
public class AnalogTrigger implements Sendable, AutoCloseable {
/** Exceptions dealing with improper operation of the Analog trigger. */
@SuppressWarnings("serial")
public static class AnalogTriggerException extends RuntimeException {
/**
* Create a new exception with the given message.

View File

@@ -40,7 +40,6 @@ import edu.wpi.first.util.sendable.SendableBuilder;
*/
public class AnalogTriggerOutput extends DigitalSource implements Sendable {
/** Exceptions dealing with improper operation of the Analog trigger output. */
@SuppressWarnings("serial")
public static class AnalogTriggerOutputException extends RuntimeException {
/**
* Create a new exception with the given message.

View File

@@ -31,7 +31,6 @@ public class Relay extends MotorSafety implements Sendable, AutoCloseable {
* This class represents errors in trying to set relay values contradictory to the direction to
* which the relay is set.
*/
@SuppressWarnings("serial")
public static class InvalidValueException extends RuntimeException {
/**
* Create a new exception with the given message.

View File

@@ -57,7 +57,6 @@ public final class SplineParameterizer {
}
}
@SuppressWarnings("serial")
public static class MalformedSplineException extends RuntimeException {
/**
* Create a new exception with the given message.

View File

@@ -24,7 +24,7 @@ public final class NumericalIntegration {
* @param dtSeconds The time over which to integrate.
* @return the integration of dx/dt = f(x) for dt.
*/
@SuppressWarnings("ParameterName")
@SuppressWarnings({"ParameterName", "overloads"})
public static double rk4(DoubleFunction<Double> f, double x, double dtSeconds) {
final var h = dtSeconds;
final var k1 = f.apply(x);
@@ -44,7 +44,7 @@ public final class NumericalIntegration {
* @param dtSeconds The time over which to integrate.
* @return The result of Runge Kutta integration (4th order).
*/
@SuppressWarnings("ParameterName")
@SuppressWarnings({"ParameterName", "overloads"})
public static double rk4(
BiFunction<Double, Double, Double> f, double x, Double u, double dtSeconds) {
final var h = dtSeconds;
@@ -68,7 +68,7 @@ public final class NumericalIntegration {
* @param dtSeconds The time over which to integrate.
* @return the integration of dx/dt = f(x, u) for dt.
*/
@SuppressWarnings({"ParameterName", "MethodTypeParameterName"})
@SuppressWarnings({"ParameterName", "MethodTypeParameterName", "overloads"})
public static <States extends Num, Inputs extends Num> Matrix<States, N1> rk4(
BiFunction<Matrix<States, N1>, Matrix<Inputs, N1>, Matrix<States, N1>> f,
Matrix<States, N1> x,
@@ -93,7 +93,7 @@ public final class NumericalIntegration {
* @param dtSeconds The time over which to integrate.
* @return 4th order Runge-Kutta integration of dx/dt = f(x) for dt.
*/
@SuppressWarnings({"ParameterName", "MethodTypeParameterName"})
@SuppressWarnings({"ParameterName", "MethodTypeParameterName", "overloads"})
public static <States extends Num> Matrix<States, N1> rk4(
Function<Matrix<States, N1>, Matrix<States, N1>> f, Matrix<States, N1> x, double dtSeconds) {
final var h = dtSeconds;

View File

@@ -263,7 +263,6 @@ public final class TrajectoryGenerator {
}
// Work around type erasure signatures
@SuppressWarnings("serial")
public static class ControlVectorList extends ArrayList<Spline.ControlVector> {
public ControlVectorList(int initialCapacity) {
super(initialCapacity);

View File

@@ -320,7 +320,6 @@ public final class TrajectoryParameterizer {
}
}
@SuppressWarnings("serial")
public static class TrajectoryGenerationException extends RuntimeException {
public TrajectoryGenerationException(String message) {
super(message);

View File

@@ -144,7 +144,7 @@ public class DataLogReader implements Iterable<DataLogRecord> {
int size = 0;
for (int i = 0; i < sizeLen; i++) {
size |= ((int) (m_buf.get(pos + 1 + entryLen + i) & 0xff)) << (i * 8);
size |= (m_buf.get(pos + 1 + entryLen + i) & 0xff) << (i * 8);
}
return pos + headerLen + size;
}