diff --git a/build.gradle b/build.gradle index fbba93794e4..fc1f33df98d 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { } } dependencies { - classpath 'com.hubspot.jinjava:jinjava:2.6.0' + classpath 'com.hubspot.jinjava:jinjava:2.7.1' } } @@ -22,8 +22,8 @@ plugins { id 'visual-studio' id 'net.ltgt.errorprone' version '3.1.0' apply false id 'com.github.johnrengelman.shadow' version '8.1.1' apply false - id 'com.diffplug.spotless' version '6.18.0' apply false - id 'com.github.spotbugs' version '5.0.14' apply false + id 'com.diffplug.spotless' version '6.20.0' apply false + id 'com.github.spotbugs' version '5.1.3' apply false } wpilibVersioning.buildServerMode = project.hasProperty('buildServer') diff --git a/cameraserver/multiCameraServer/build.gradle b/cameraserver/multiCameraServer/build.gradle index acd898d5428..a7cfa423f3e 100644 --- a/cameraserver/multiCameraServer/build.gradle +++ b/cameraserver/multiCameraServer/build.gradle @@ -29,7 +29,7 @@ repositories { } dependencies { - implementation 'com.google.code.gson:gson:2.8.9' + implementation 'com.google.code.gson:gson:2.10.1' implementation project(':wpiutil') implementation project(':wpinet') diff --git a/cscore/src/main/java/edu/wpi/first/cscore/CameraServerCvJNI.java b/cscore/src/main/java/edu/wpi/first/cscore/CameraServerCvJNI.java index 3527daef1c9..66195221f89 100644 --- a/cscore/src/main/java/edu/wpi/first/cscore/CameraServerCvJNI.java +++ b/cscore/src/main/java/edu/wpi/first/cscore/CameraServerCvJNI.java @@ -65,6 +65,7 @@ public static native int createCvSource( public static native void putSourceFrame(int source, long imageNativeObj); public static native int createCvSink(String name); + // public static native int createCvSinkCallback(String name, // void (*processFrame)(long time)); diff --git a/fieldImages/build.gradle b/fieldImages/build.gradle index 2f18d7279d8..c66d35fbb81 100644 --- a/fieldImages/build.gradle +++ b/fieldImages/build.gradle @@ -14,9 +14,9 @@ if (!project.hasProperty('onlylinuxathena')) { } dependencies { - implementation "com.fasterxml.jackson.core:jackson-annotations:2.12.4" - implementation "com.fasterxml.jackson.core:jackson-core:2.12.4" - implementation "com.fasterxml.jackson.core:jackson-databind:2.12.4" + implementation "com.fasterxml.jackson.core:jackson-annotations:2.15.2" + implementation "com.fasterxml.jackson.core:jackson-core:2.15.2" + implementation "com.fasterxml.jackson.core:jackson-databind:2.15.2" } ext { diff --git a/hal/src/main/java/edu/wpi/first/hal/AccumulatorResult.java b/hal/src/main/java/edu/wpi/first/hal/AccumulatorResult.java index 441ce9f4725..f416ff8192d 100644 --- a/hal/src/main/java/edu/wpi/first/hal/AccumulatorResult.java +++ b/hal/src/main/java/edu/wpi/first/hal/AccumulatorResult.java @@ -9,6 +9,7 @@ public class AccumulatorResult { /** The total value accumulated. */ public long value; + /** The number of sample value was accumulated over. */ public long count; diff --git a/hal/src/main/java/edu/wpi/first/hal/AnalogJNI.java b/hal/src/main/java/edu/wpi/first/hal/AnalogJNI.java index 551f3be8f58..bf8b27f4927 100644 --- a/hal/src/main/java/edu/wpi/first/hal/AnalogJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/AnalogJNI.java @@ -3,6 +3,7 @@ // the WPILib BSD license file in the root directory of this project. package edu.wpi.first.hal; + /** * Analog Input / Output / Accumulator / Trigger JNI Functions. * @@ -19,10 +20,13 @@ public class AnalogJNI extends JNIWrapper { public interface AnalogTriggerType { /** native declaration : AthenaJava\target\native\include\HAL\Analog.h:54 */ int kInWindow = 0; + /** native declaration : AthenaJava\target\native\include\HAL\Analog.h:55 */ int kState = 1; + /** native declaration : AthenaJava\target\native\include\HAL\Analog.h:56 */ int kRisingPulse = 2; + /** native declaration : AthenaJava\target\native\include\HAL\Analog.h:57 */ int kFallingPulse = 3; } @@ -52,6 +56,7 @@ public interface AnalogTriggerType { * @see "HAL_InitializeAnalogOutputPort" */ public static native int initializeAnalogOutputPort(int halPortHandle); + /** * Frees an analog output port. * @@ -206,6 +211,7 @@ public interface AnalogTriggerType { * @see "HAL_GetAnalogVoltsToValue" */ public static native int getAnalogVoltsToValue(int analogPortHandle, double voltage); + /** * Get the analog voltage from a raw value. * @@ -418,6 +424,7 @@ public static native void setAnalogTriggerLimitsDutyCycle( */ public static native void setAnalogTriggerLimitsVoltage( int analogTriggerHandle, double lower, double upper); + /** * Configures the analog trigger to use the averaged vs. raw values. * @@ -433,6 +440,7 @@ public static native void setAnalogTriggerLimitsVoltage( */ public static native void setAnalogTriggerAveraged( int analogTriggerHandle, boolean useAveragedValue); + /** * Configures the analog trigger to use a filtered value. * diff --git a/hal/src/main/java/edu/wpi/first/hal/CANData.java b/hal/src/main/java/edu/wpi/first/hal/CANData.java index 91362226265..0e2956888cb 100644 --- a/hal/src/main/java/edu/wpi/first/hal/CANData.java +++ b/hal/src/main/java/edu/wpi/first/hal/CANData.java @@ -8,8 +8,10 @@ public class CANData { /** Contents of the CAN frame. */ public final byte[] data = new byte[8]; + /** Length of the frame in bytes. */ public int length; + /** CAN frame timestamp in milliseconds. */ public long timestamp; diff --git a/ntcore/src/generate/java/NetworkTableInstance.java.jinja b/ntcore/src/generate/java/NetworkTableInstance.java.jinja index ff1b40734c6..7dabd1070ce 100644 --- a/ntcore/src/generate/java/NetworkTableInstance.java.jinja +++ b/ntcore/src/generate/java/NetworkTableInstance.java.jinja @@ -553,7 +553,7 @@ public final class NetworkTableInstance implements AutoCloseable { } } - private ListenerStorage m_listeners = new ListenerStorage(this); + private final ListenerStorage m_listeners = new ListenerStorage(this); /** * Remove a connection listener. diff --git a/shared/java/javacommon.gradle b/shared/java/javacommon.gradle index 9a0a2d5df17..57a864f4714 100644 --- a/shared/java/javacommon.gradle +++ b/shared/java/javacommon.gradle @@ -116,9 +116,9 @@ tasks.withType(JavaCompile).configureEach { } dependencies { - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' - testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.0' + testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.0' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.0' devImplementation sourceSets.main.output } @@ -132,7 +132,7 @@ task run(type: JavaExec) { build.dependsOn devClasses jacoco { - toolVersion = "0.8.8" + toolVersion = "0.8.10" } jacocoTestReport { diff --git a/shared/java/javastyle.gradle b/shared/java/javastyle.gradle index 7f5d9257d07..0cc7d3b0958 100644 --- a/shared/java/javastyle.gradle +++ b/shared/java/javastyle.gradle @@ -2,7 +2,7 @@ if (!project.hasProperty('skipJavaFormat')) { apply plugin: 'checkstyle' checkstyle { - toolVersion = "10.1" + toolVersion = "10.12.2" configDirectory = file("${project.rootDir}/styleguide") config = resources.text.fromFile(new File(configDirectory.get().getAsFile(), "checkstyle.xml")) } @@ -10,7 +10,7 @@ if (!project.hasProperty('skipJavaFormat')) { apply plugin: 'pmd' pmd { - toolVersion = '6.44.0' + toolVersion = '6.55.0' consoleOutput = true reportsDir = file("$project.buildDir/reports/pmd") ruleSetFiles = files(new File(rootDir, "styleguide/pmd-ruleset.xml")) diff --git a/styleguide/pmd-ruleset.xml b/styleguide/pmd-ruleset.xml index 54a4881cd28..3f0683a55aa 100644 --- a/styleguide/pmd-ruleset.xml +++ b/styleguide/pmd-ruleset.xml @@ -64,7 +64,6 @@ - @@ -74,6 +73,7 @@ + diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Encoder.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Encoder.java index 24762721ab9..2cbb5c769c9 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Encoder.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Encoder.java @@ -44,8 +44,10 @@ public enum IndexingType { /** The 'a' source. */ protected DigitalSource m_aSource; // the A phase of the quad encoder + /** The 'b' source. */ protected DigitalSource m_bSource; // the B phase of the quad encoder + /** The index source. */ protected DigitalSource m_indexSource; // Index on some encoders diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Preferences.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Preferences.java index a80fd453ffb..087c1566026 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Preferences.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Preferences.java @@ -35,6 +35,7 @@ public final class Preferences { /** The Preferences table name. */ private static final String TABLE_NAME = "Preferences"; + /** The network table. */ private static NetworkTable m_table; diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/event/BooleanEvent.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/event/BooleanEvent.java index a8100065636..0786f34d05a 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/event/BooleanEvent.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/event/BooleanEvent.java @@ -24,6 +24,7 @@ public class BooleanEvent implements BooleanSupplier { /** Poller loop. */ protected final EventLoop m_loop; + /** Condition. */ private final BooleanSupplier m_signal; diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SendableChooser.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SendableChooser.java index 33d218f0da0..bfca78100e2 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SendableChooser.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SendableChooser.java @@ -36,14 +36,19 @@ public class SendableChooser implements NTSendable, AutoCloseable { /** The key for the default value. */ private static final String DEFAULT = "default"; + /** The key for the selected option. */ private static final String SELECTED = "selected"; + /** The key for the active option. */ private static final String ACTIVE = "active"; + /** The key for the option array. */ private static final String OPTIONS = "options"; + /** The key for the instance number. */ private static final String INSTANCE = ".instance"; + /** A map linking strings to the objects they represent. */ private final Map m_map = new LinkedHashMap<>(); diff --git a/wpilibj/src/test/java/edu/wpi/first/wpilibj/RobotControllerTest.java b/wpilibj/src/test/java/edu/wpi/first/wpilibj/RobotControllerTest.java index 3c5647c4a84..cdc27c70e3b 100644 --- a/wpilibj/src/test/java/edu/wpi/first/wpilibj/RobotControllerTest.java +++ b/wpilibj/src/test/java/edu/wpi/first/wpilibj/RobotControllerTest.java @@ -4,6 +4,7 @@ package edu.wpi.first.wpilibj; +@SuppressWarnings("PMD.TestClassWithoutTestCases") class RobotControllerTest extends UtilityClassTest { RobotControllerTest() { super(RobotController.class); diff --git a/wpilibj/src/test/java/edu/wpi/first/wpilibj/livewindow/LiveWindowTest.java b/wpilibj/src/test/java/edu/wpi/first/wpilibj/livewindow/LiveWindowTest.java index 6d4a6669663..869fb8c3765 100644 --- a/wpilibj/src/test/java/edu/wpi/first/wpilibj/livewindow/LiveWindowTest.java +++ b/wpilibj/src/test/java/edu/wpi/first/wpilibj/livewindow/LiveWindowTest.java @@ -6,6 +6,7 @@ import edu.wpi.first.wpilibj.UtilityClassTest; +@SuppressWarnings("PMD.TestClassWithoutTestCases") class LiveWindowTest extends UtilityClassTest { LiveWindowTest() { super(LiveWindow.class); diff --git a/wpilibjExamples/build.gradle b/wpilibjExamples/build.gradle index 5ca6fff6bf6..570760f4cc7 100644 --- a/wpilibjExamples/build.gradle +++ b/wpilibjExamples/build.gradle @@ -37,13 +37,13 @@ dependencies { implementation project(':cameraserver') implementation project(':wpilibNewCommands') - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' - testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.0' + testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.0' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.0' } jacoco { - toolVersion = "0.8.8" + toolVersion = "0.8.10" } jacocoTestReport { diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/unittest/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/unittest/Robot.java index 9f66c27e944..1333a1c4fc4 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/unittest/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/unittest/Robot.java @@ -16,8 +16,8 @@ * project. */ public class Robot extends TimedRobot { - private Intake m_intake = new Intake(); - private Joystick m_joystick = new Joystick(Constants.kJoystickIndex); + private final Intake m_intake = new Intake(); + private final Joystick m_joystick = new Joystick(Constants.kJoystickIndex); /** This function is called periodically during operator control. */ @Override diff --git a/wpimath/build.gradle b/wpimath/build.gradle index f1e8b0258fb..0fd755f7241 100644 --- a/wpimath/build.gradle +++ b/wpimath/build.gradle @@ -38,9 +38,9 @@ model { dependencies { api "org.ejml:ejml-simple:0.42" - api "com.fasterxml.jackson.core:jackson-annotations:2.12.4" - api "com.fasterxml.jackson.core:jackson-core:2.12.4" - api "com.fasterxml.jackson.core:jackson-databind:2.12.4" + api "com.fasterxml.jackson.core:jackson-annotations:2.15.2" + api "com.fasterxml.jackson.core:jackson-core:2.15.2" + api "com.fasterxml.jackson.core:jackson-databind:2.15.2" } def wpilibNumberFileInput = file("src/generate/GenericNumber.java.jinja") diff --git a/wpimath/src/main/java/edu/wpi/first/math/geometry/Rotation3d.java b/wpimath/src/main/java/edu/wpi/first/math/geometry/Rotation3d.java index 171902f2482..1ad2f2aff04 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/geometry/Rotation3d.java +++ b/wpimath/src/main/java/edu/wpi/first/math/geometry/Rotation3d.java @@ -24,10 +24,12 @@ @JsonIgnoreProperties(ignoreUnknown = true) @JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.NONE) public class Rotation3d implements Interpolatable { - private Quaternion m_q = new Quaternion(); + private final Quaternion m_q; /** Constructs a Rotation3d with a default angle of 0 degrees. */ - public Rotation3d() {} + public Rotation3d() { + m_q = new Quaternion(); + } /** * Constructs a Rotation3d from a quaternion. @@ -93,6 +95,7 @@ public Rotation3d(Vector rvec) { public Rotation3d(Vector axis, double angleRadians) { double norm = axis.norm(); if (norm == 0.0) { + m_q = new Quaternion(); return; } @@ -186,6 +189,7 @@ public Rotation3d(Vector initial, Vector last) { if (dotNorm > 1.0 - 1E-9) { // If the dot product is 1, the two vectors point in the same direction so // there's no rotation. The default initialization of m_q will work. + m_q = new Quaternion(); return; } else if (dotNorm < -1.0 + 1E-9) { // If the dot product is -1, the two vectors point in opposite directions diff --git a/wpiutil/CMakeLists.txt b/wpiutil/CMakeLists.txt index 8422b612316..8deec27abc0 100644 --- a/wpiutil/CMakeLists.txt +++ b/wpiutil/CMakeLists.txt @@ -14,18 +14,18 @@ if (WITH_JAVA) include(UseJava) set(CMAKE_JAVA_COMPILE_FLAGS "-encoding" "UTF8" "-Xlint:unchecked") - if(NOT EXISTS "${WPILIB_BINARY_DIR}/wpiutil/thirdparty/jackson/jackson-core-2.12.4.jar") + if(NOT EXISTS "${WPILIB_BINARY_DIR}/wpiutil/thirdparty/jackson/jackson-core-2.15.2.jar") set(BASE_URL "https://search.maven.org/remotecontent?filepath=") set(JAR_ROOT "${WPILIB_BINARY_DIR}/wpiutil/thirdparty/jackson") message(STATUS "Downloading Jackson jarfiles...") - file(DOWNLOAD "${BASE_URL}com/fasterxml/jackson/core/jackson-core/2.12.4/jackson-core-2.12.4.jar" - "${JAR_ROOT}/jackson-core-2.12.4.jar") - file(DOWNLOAD "${BASE_URL}com/fasterxml/jackson/core/jackson-databind/2.12.4/jackson-databind-2.12.4.jar" - "${JAR_ROOT}/jackson-databind-2.12.4.jar") - file(DOWNLOAD "${BASE_URL}com/fasterxml/jackson/core/jackson-annotations/2.12.4/jackson-annotations-2.12.4.jar" - "${JAR_ROOT}/jackson-annotations-2.12.4.jar") + file(DOWNLOAD "${BASE_URL}com/fasterxml/jackson/core/jackson-core/2.15.2/jackson-core-2.15.2.jar" + "${JAR_ROOT}/jackson-core-2.15.2.jar") + file(DOWNLOAD "${BASE_URL}com/fasterxml/jackson/core/jackson-databind/2.15.2/jackson-databind-2.15.2.jar" + "${JAR_ROOT}/jackson-databind-2.15.2.jar") + file(DOWNLOAD "${BASE_URL}com/fasterxml/jackson/core/jackson-annotations/2.15.2/jackson-annotations-2.15.2.jar" + "${JAR_ROOT}/jackson-annotations-2.15.2.jar") message(STATUS "All files downloaded.") endif() diff --git a/wpiutil/build.gradle b/wpiutil/build.gradle index 964dcf57e97..4e8e3e87d68 100644 --- a/wpiutil/build.gradle +++ b/wpiutil/build.gradle @@ -276,9 +276,9 @@ task runPrintLog(type: JavaExec) { } dependencies { - api "com.fasterxml.jackson.core:jackson-annotations:2.12.4" - api "com.fasterxml.jackson.core:jackson-core:2.12.4" - api "com.fasterxml.jackson.core:jackson-databind:2.12.4" + api "com.fasterxml.jackson.core:jackson-annotations:2.15.2" + api "com.fasterxml.jackson.core:jackson-core:2.15.2" + api "com.fasterxml.jackson.core:jackson-databind:2.15.2" printlogImplementation sourceSets.main.output } diff --git a/wpiutil/src/main/java/edu/wpi/first/util/EventVector.java b/wpiutil/src/main/java/edu/wpi/first/util/EventVector.java index a85379e7927..4d2c80030a1 100644 --- a/wpiutil/src/main/java/edu/wpi/first/util/EventVector.java +++ b/wpiutil/src/main/java/edu/wpi/first/util/EventVector.java @@ -9,8 +9,8 @@ import java.util.concurrent.locks.ReentrantLock; public class EventVector { - private ReentrantLock m_lock = new ReentrantLock(); - private List m_events = new ArrayList<>(); + private final ReentrantLock m_lock = new ReentrantLock(); + private final List m_events = new ArrayList<>(); /** * Adds an event to the event vector. diff --git a/wpiutil/src/test/java/edu/wpi/first/util/cleanup/ReflectionCleanupTest.java b/wpiutil/src/test/java/edu/wpi/first/util/cleanup/ReflectionCleanupTest.java index 52fafb44146..7bf3d646832 100644 --- a/wpiutil/src/test/java/edu/wpi/first/util/cleanup/ReflectionCleanupTest.java +++ b/wpiutil/src/test/java/edu/wpi/first/util/cleanup/ReflectionCleanupTest.java @@ -19,6 +19,7 @@ public void close() { } } + @SuppressWarnings("PMD.TestClassWithoutTestCases") static class CleanupTest implements ReflectionCleanup { public CleanupClass m_class1 = new CleanupClass(); public CleanupClass m_class2 = new CleanupClass();