Clean up Java warning suppressions (#4433)

Checkstyle naming conventions were changed to allow most of what's in
wpimath. Naming rules were disabled completely in wpimath since almost
all suppressions are for math notation.
This commit is contained in:
Tyler Veness
2022-09-24 00:13:55 -07:00
committed by GitHub
parent 17f504f548
commit a791470de7
233 changed files with 282 additions and 881 deletions

View File

@@ -56,7 +56,7 @@ public final class CombinedRuntimeLoader {
* @return List of all libraries that were extracted
* @throws IOException Thrown if resource not found or file could not be extracted
*/
@SuppressWarnings({"PMD.UnnecessaryCastRule", "unchecked"})
@SuppressWarnings("unchecked")
public static <T> List<String> extractLibraries(Class<T> clazz, String resourceName)
throws IOException {
TypeReference<HashMap<String, Object>> typeRef =

View File

@@ -80,7 +80,6 @@ public final class RuntimeLoader<T> {
*
* @throws IOException if the library fails to load
*/
@SuppressWarnings("PMD.PreserveStackTrace")
public void loadLibrary() throws IOException {
try {
// First, try loading path
@@ -132,7 +131,6 @@ public final class RuntimeLoader<T> {
*
* @throws IOException if the library failed to load
*/
@SuppressWarnings({"PMD.PreserveStackTrace", "PMD.EmptyWhileStmt"})
public void loadLibraryHashed() throws IOException {
try {
// First, try loading path

View File

@@ -22,7 +22,6 @@ package edu.wpi.first.util.datalog;
* For this reason (as well as the fact that timestamps can be set to arbitrary values), records in
* the log are not guaranteed to be sorted by timestamp.
*/
@SuppressWarnings({"PMD.TooManyMethods", "PMD.ExcessivePublicCount"})
public final class DataLog implements AutoCloseable {
/**
* Construct a new Data Log. The log will be initially created with a temporary filename.

View File

@@ -114,7 +114,6 @@ public class DataLogReader implements Iterable<DataLogRecord> {
return val;
}
@SuppressWarnings("PMD.PreserveStackTrace")
DataLogRecord getRecord(int pos) {
try {
int lenbyte = m_buf.get(pos) & 0xff;

View File

@@ -17,7 +17,6 @@ import java.util.InputMismatchException;
* A record in the data log. May represent either a control record (entry == 0) or a data record.
* Used only for reading (e.g. with DataLogReader).
*/
@SuppressWarnings("PMD.PreserveStackTrace")
public class DataLogRecord {
private static final int kControlStart = 0;
private static final int kControlFinish = 1;
@@ -125,6 +124,7 @@ public class DataLogRecord {
* Data contained in a start control record as created by DataLog.start() when writing the log.
* This can be read by calling getStartData().
*/
@SuppressWarnings("MemberName")
public static class StartRecordData {
StartRecordData(int entry, String name, String type, String metadata) {
this.entry = entry;
@@ -134,19 +134,15 @@ public class DataLogRecord {
}
/** Entry ID; this will be used for this entry in future records. */
@SuppressWarnings("MemberName")
public final int entry;
/** Entry name. */
@SuppressWarnings("MemberName")
public final String name;
/** Type of the stored data for this entry, as a string, e.g. "double". */
@SuppressWarnings("MemberName")
public final String type;
/** Initial metadata. */
@SuppressWarnings("MemberName")
public final String metadata;
}
@@ -173,6 +169,7 @@ public class DataLogRecord {
* Data contained in a set metadata control record as created by DataLog.setMetadata(). This can
* be read by calling getSetMetadataData().
*/
@SuppressWarnings("MemberName")
public static class MetadataRecordData {
MetadataRecordData(int entry, String metadata) {
this.entry = entry;
@@ -180,11 +177,9 @@ public class DataLogRecord {
}
/** Entry ID. */
@SuppressWarnings("MemberName")
public final int entry;
/** New metadata for the entry. */
@SuppressWarnings("MemberName")
public final String metadata;
}

View File

@@ -425,29 +425,24 @@ public final class SendableRegistry {
}
/** Data passed to foreachLiveWindow() callback function. */
@SuppressWarnings("MemberName")
public static class CallbackData {
/** Sendable object. */
@SuppressWarnings("MemberName")
public Sendable sendable;
/** Name. */
@SuppressWarnings("MemberName")
public String name;
/** Subsystem. */
@SuppressWarnings("MemberName")
public String subsystem;
/** Parent sendable object. */
@SuppressWarnings("MemberName")
public Sendable parent;
/** Data stored in object with setData(). Update this to change the data. */
@SuppressWarnings("MemberName")
public Object data;
/** Sendable builder for the sendable. */
@SuppressWarnings("MemberName")
public SendableBuilder builder;
}
@@ -462,7 +457,6 @@ public final class SendableRegistry {
* @param dataHandle data handle to get data object passed to callback
* @param callback function to call for each object
*/
@SuppressWarnings({"PMD.AvoidCatchingThrowable", "PMD.AvoidReassigningCatchVariables"})
public static synchronized void foreachLiveWindow(
int dataHandle, Consumer<CallbackData> callback) {
CallbackData cbdata = new CallbackData();