Skip to content

Commit

Permalink
Upgrade Maven dependencies (#5553)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
calcmogul committed Aug 19, 2023
1 parent 7a2d336 commit 96f7fa6
Show file tree
Hide file tree
Showing 25 changed files with 66 additions and 38 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Expand Up @@ -7,7 +7,7 @@ buildscript {
}
}
dependencies {
classpath 'com.hubspot.jinjava:jinjava:2.6.0'
classpath 'com.hubspot.jinjava:jinjava:2.7.1'
}
}

Expand All @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion cameraserver/multiCameraServer/build.gradle
Expand Up @@ -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')
Expand Down
Expand Up @@ -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));

Expand Down
6 changes: 3 additions & 3 deletions fieldImages/build.gradle
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions hal/src/main/java/edu/wpi/first/hal/AccumulatorResult.java
Expand Up @@ -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;

Expand Down
8 changes: 8 additions & 0 deletions hal/src/main/java/edu/wpi/first/hal/AnalogJNI.java
Expand Up @@ -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.
*
Expand All @@ -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;
}
Expand Down Expand Up @@ -52,6 +56,7 @@ public interface AnalogTriggerType {
* @see "HAL_InitializeAnalogOutputPort"
*/
public static native int initializeAnalogOutputPort(int halPortHandle);

/**
* Frees an analog output port.
*
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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.
*
Expand All @@ -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.
*
Expand Down
2 changes: 2 additions & 0 deletions hal/src/main/java/edu/wpi/first/hal/CANData.java
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion ntcore/src/generate/java/NetworkTableInstance.java.jinja
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions shared/java/javacommon.gradle
Expand Up @@ -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
}
Expand All @@ -132,7 +132,7 @@ task run(type: JavaExec) {
build.dependsOn devClasses

jacoco {
toolVersion = "0.8.8"
toolVersion = "0.8.10"
}

jacocoTestReport {
Expand Down
4 changes: 2 additions & 2 deletions shared/java/javastyle.gradle
Expand Up @@ -2,15 +2,15 @@ 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"))
}

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"))
Expand Down
2 changes: 1 addition & 1 deletion styleguide/pmd-ruleset.xml
Expand Up @@ -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" />
Expand All @@ -74,6 +73,7 @@
<exclude name="FinalizeDoesNotCallSuperFinalize" />
<exclude name="JUnitSpelling" />
<exclude name="MissingSerialVersionUID" />
<exclude name="NonSerializableClass" />
<exclude name="NullAssignment" />
</rule>

Expand Down
2 changes: 2 additions & 0 deletions wpilibj/src/main/java/edu/wpi/first/wpilibj/Encoder.java
Expand Up @@ -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

Expand Down
Expand Up @@ -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;

Expand Down
Expand Up @@ -24,6 +24,7 @@
public class BooleanEvent implements BooleanSupplier {
/** Poller loop. */
protected final EventLoop m_loop;

/** Condition. */
private final BooleanSupplier m_signal;

Expand Down
Expand Up @@ -36,14 +36,19 @@
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<>();

Expand Down
Expand Up @@ -4,6 +4,7 @@

package edu.wpi.first.wpilibj;

@SuppressWarnings("PMD.TestClassWithoutTestCases")
class RobotControllerTest extends UtilityClassTest<RobotController> {
RobotControllerTest() {
super(RobotController.class);
Expand Down
Expand Up @@ -6,6 +6,7 @@

import edu.wpi.first.wpilibj.UtilityClassTest;

@SuppressWarnings("PMD.TestClassWithoutTestCases")
class LiveWindowTest extends UtilityClassTest<LiveWindow> {
LiveWindowTest() {
super(LiveWindow.class);
Expand Down
8 changes: 4 additions & 4 deletions wpilibjExamples/build.gradle
Expand Up @@ -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 {
Expand Down
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions wpimath/build.gradle
Expand Up @@ -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")
Expand Down
Expand Up @@ -24,10 +24,12 @@
@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.
Expand Down Expand Up @@ -93,6 +95,7 @@ public Rotation3d(Vector<N3> rvec) {
public Rotation3d(Vector<N3> axis, double angleRadians) {
double norm = axis.norm();
if (norm == 0.0) {
m_q = new Quaternion();
return;
}

Expand Down Expand Up @@ -186,6 +189,7 @@ public Rotation3d(Vector<N3> initial, Vector<N3> 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
Expand Down
14 changes: 7 additions & 7 deletions wpiutil/CMakeLists.txt
Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions wpiutil/build.gradle
Expand Up @@ -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
}
4 changes: 2 additions & 2 deletions wpiutil/src/main/java/edu/wpi/first/util/EventVector.java
Expand Up @@ -9,8 +9,8 @@
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.
Expand Down
Expand Up @@ -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();
Expand Down

0 comments on commit 96f7fa6

Please sign in to comment.