Upgrade Maven dependencies (#5553)

The following source code changes were required:

* Whitespace changes from spotless
* PMD warning suppressions for utility class tests
* PMD warning rename from "BeanMembersShouldSerialize" to
  "NonSerializableClass"
* Declared more class members as final
This commit is contained in:
Tyler Veness
2023-08-18 19:18:33 -07:00
committed by GitHub
parent 7a2d336d52
commit 96f7fa662e
25 changed files with 66 additions and 38 deletions

View File

@@ -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')

View File

@@ -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')

View File

@@ -65,6 +65,7 @@ public class CameraServerCvJNI {
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));

View File

@@ -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 {

View File

@@ -9,6 +9,7 @@ package edu.wpi.first.hal;
public class AccumulatorResult {
/** The total value accumulated. */
public long value;
/** The number of sample value was accumulated over. */
public long count;

View File

@@ -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 {
/** <i>native declaration : AthenaJava\target\native\include\HAL\Analog.h:54</i> */
int kInWindow = 0;
/** <i>native declaration : AthenaJava\target\native\include\HAL\Analog.h:55</i> */
int kState = 1;
/** <i>native declaration : AthenaJava\target\native\include\HAL\Analog.h:56</i> */
int kRisingPulse = 2;
/** <i>native declaration : AthenaJava\target\native\include\HAL\Analog.h:57</i> */
int kFallingPulse = 3;
}
@@ -52,6 +56,7 @@ public class AnalogJNI extends JNIWrapper {
* @see "HAL_InitializeAnalogOutputPort"
*/
public static native int initializeAnalogOutputPort(int halPortHandle);
/**
* Frees an analog output port.
*
@@ -206,6 +211,7 @@ public class AnalogJNI extends JNIWrapper {
* @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 class AnalogJNI extends JNIWrapper {
*/
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 class AnalogJNI extends JNIWrapper {
*/
public static native void setAnalogTriggerAveraged(
int analogTriggerHandle, boolean useAveragedValue);
/**
* Configures the analog trigger to use a filtered value.
*

View File

@@ -8,8 +8,10 @@ package edu.wpi.first.hal;
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;

View File

@@ -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.

View File

@@ -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 {

View File

@@ -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"))

View File

@@ -64,7 +64,6 @@
<exclude name="AvoidCatchingThrowable" />
<exclude name="AvoidDuplicateLiterals" />
<exclude name="AvoidLiteralsInIfCondition" />
<exclude name="BeanMembersShouldSerialize" />
<exclude name="CloseResource" />
<exclude name="ConstructorCallsOverridableMethod" />
<exclude name="DataflowAnomalyAnalysis" />
@@ -74,6 +73,7 @@
<exclude name="FinalizeDoesNotCallSuperFinalize" />
<exclude name="JUnitSpelling" />
<exclude name="MissingSerialVersionUID" />
<exclude name="NonSerializableClass" />
<exclude name="NullAssignment" />
</rule>

View File

@@ -44,8 +44,10 @@ public class Encoder implements CounterBase, Sendable, AutoCloseable {
/** 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

View File

@@ -35,6 +35,7 @@ import java.util.EnumSet;
public final class Preferences {
/** The Preferences table name. */
private static final String TABLE_NAME = "Preferences";
/** The network table. */
private static NetworkTable m_table;

View File

@@ -24,6 +24,7 @@ import java.util.function.BooleanSupplier;
public class BooleanEvent implements BooleanSupplier {
/** Poller loop. */
protected final EventLoop m_loop;
/** Condition. */
private final BooleanSupplier m_signal;

View File

@@ -36,14 +36,19 @@ import java.util.function.Consumer;
public class SendableChooser<V> 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<String, V> m_map = new LinkedHashMap<>();

View File

@@ -4,6 +4,7 @@
package edu.wpi.first.wpilibj;
@SuppressWarnings("PMD.TestClassWithoutTestCases")
class RobotControllerTest extends UtilityClassTest<RobotController> {
RobotControllerTest() {
super(RobotController.class);

View File

@@ -6,6 +6,7 @@ package edu.wpi.first.wpilibj.livewindow;
import edu.wpi.first.wpilibj.UtilityClassTest;
@SuppressWarnings("PMD.TestClassWithoutTestCases")
class LiveWindowTest extends UtilityClassTest<LiveWindow> {
LiveWindowTest() {
super(LiveWindow.class);

View File

@@ -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 {

View File

@@ -16,8 +16,8 @@ import edu.wpi.first.wpilibj.examples.unittest.subsystems.Intake;
* 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

View File

@@ -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")

View File

@@ -24,10 +24,12 @@ import org.ejml.dense.row.factory.DecompositionFactory_DDRM;
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.NONE)
public class Rotation3d implements Interpolatable<Rotation3d> {
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 class Rotation3d implements Interpolatable<Rotation3d> {
public Rotation3d(Vector<N3> axis, double angleRadians) {
double norm = axis.norm();
if (norm == 0.0) {
m_q = new Quaternion();
return;
}
@@ -186,6 +189,7 @@ public class Rotation3d implements Interpolatable<Rotation3d> {
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

View File

@@ -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()

View File

@@ -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
}

View File

@@ -9,8 +9,8 @@ import java.util.List;
import java.util.concurrent.locks.ReentrantLock;
public class EventVector {
private ReentrantLock m_lock = new ReentrantLock();
private List<Integer> m_events = new ArrayList<>();
private final ReentrantLock m_lock = new ReentrantLock();
private final List<Integer> m_events = new ArrayList<>();
/**
* Adds an event to the event vector.

View File

@@ -19,6 +19,7 @@ class ReflectionCleanupTest {
}
}
@SuppressWarnings("PMD.TestClassWithoutTestCases")
static class CleanupTest implements ReflectionCleanup {
public CleanupClass m_class1 = new CleanupClass();
public CleanupClass m_class2 = new CleanupClass();