mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
Update and enable PMD 6.3.0 (#1107)
This commit is contained in:
committed by
Peter Johnson
parent
8eafe7f325
commit
e548a5f705
@@ -18,6 +18,7 @@ public class CANData {
|
||||
/**
|
||||
* API used from JNI to set the data.
|
||||
*/
|
||||
@SuppressWarnings("PMD.MethodReturnsInternalArray")
|
||||
public byte[] setData(int length, long timestamp) {
|
||||
this.length = length;
|
||||
this.timestamp = timestamp;
|
||||
|
||||
@@ -10,14 +10,14 @@ package edu.wpi.first.wpilibj.can;
|
||||
import edu.wpi.first.wpilibj.communication.NIRioStatus;
|
||||
import edu.wpi.first.wpilibj.util.UncleanStatusException;
|
||||
|
||||
public class CANExceptionFactory {
|
||||
public final class CANExceptionFactory {
|
||||
// FRC Error codes
|
||||
static final int ERR_CANSessionMux_InvalidBuffer = -44086;
|
||||
static final int ERR_CANSessionMux_MessageNotFound = -44087;
|
||||
static final int ERR_CANSessionMux_NotAllowed = -44088;
|
||||
static final int ERR_CANSessionMux_NotInitialized = -44089;
|
||||
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
@SuppressWarnings({"JavadocMethod", "PMD.CyclomaticComplexity"})
|
||||
public static void checkStatus(int status, int messageID) throws CANInvalidBufferException,
|
||||
CANMessageNotAllowedException, CANNotInitializedException, UncleanStatusException {
|
||||
switch (status) {
|
||||
@@ -41,4 +41,8 @@ public class CANExceptionFactory {
|
||||
status));
|
||||
}
|
||||
}
|
||||
|
||||
private CANExceptionFactory() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class FRCNetComm extends JNIWrapper {
|
||||
/**
|
||||
* Module type from LoadOut.h
|
||||
*/
|
||||
@SuppressWarnings("TypeName")
|
||||
@SuppressWarnings({"TypeName", "PMD.ConstantsInInterface"})
|
||||
public static final class tModuleType {
|
||||
private tModuleType() {
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class FRCNetComm extends JNIWrapper {
|
||||
/**
|
||||
* Target class from LoadOut.h
|
||||
*/
|
||||
@SuppressWarnings("TypeName")
|
||||
@SuppressWarnings({"TypeName", "PMD.ConstantsInInterface"})
|
||||
public static final class tTargetClass {
|
||||
private tTargetClass() {
|
||||
}
|
||||
@@ -51,7 +51,7 @@ public class FRCNetComm extends JNIWrapper {
|
||||
/**
|
||||
* Resource type from UsageReporting.h
|
||||
*/
|
||||
@SuppressWarnings("TypeName")
|
||||
@SuppressWarnings({"TypeName", "PMD.ConstantsInInterface"})
|
||||
public static final class tResourceType {
|
||||
private tResourceType() {
|
||||
}
|
||||
@@ -132,7 +132,7 @@ public class FRCNetComm extends JNIWrapper {
|
||||
/**
|
||||
* Instances from UsageReporting.h
|
||||
*/
|
||||
@SuppressWarnings("TypeName")
|
||||
@SuppressWarnings({"TypeName", "PMD.ConstantsInInterface"})
|
||||
public static final class tInstances {
|
||||
private tInstances() {
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ import java.nio.ByteBuffer;
|
||||
/**
|
||||
* JNI Wrapper for HAL<br>.
|
||||
*/
|
||||
@SuppressWarnings({"AbbreviationAsWordInName", "MethodName"})
|
||||
public class HAL extends JNIWrapper {
|
||||
@SuppressWarnings({"AbbreviationAsWordInName", "MethodName", "PMD.TooManyMethods"})
|
||||
public final class HAL extends JNIWrapper {
|
||||
public static native void waitForDSData();
|
||||
|
||||
public static native boolean initialize(int timeout, int mode);
|
||||
@@ -127,4 +127,8 @@ public class HAL extends JNIWrapper {
|
||||
public static native int getPortWithModule(byte module, byte channel);
|
||||
|
||||
public static native int getPort(byte channel);
|
||||
|
||||
private HAL() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
package edu.wpi.first.wpilibj.hal;
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public class HALUtil extends JNIWrapper {
|
||||
public final class HALUtil extends JNIWrapper {
|
||||
public static final int NULL_PARAMETER = -1005;
|
||||
public static final int SAMPLE_RATE_TOO_HIGH = 1001;
|
||||
public static final int VOLTAGE_OUT_OF_RANGE = 1002;
|
||||
@@ -37,4 +37,8 @@ public class HALUtil extends JNIWrapper {
|
||||
public static String getHALstrerror() {
|
||||
return getHALstrerror(getHALErrno());
|
||||
}
|
||||
|
||||
private HALUtil() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ package edu.wpi.first.wpilibj.sim;
|
||||
import edu.wpi.first.hal.sim.mockdata.AccelerometerDataJNI;
|
||||
|
||||
public class AccelerometerSim {
|
||||
private int m_index;
|
||||
private final int m_index;
|
||||
|
||||
public AccelerometerSim() {
|
||||
m_index = 0;
|
||||
|
||||
@@ -10,7 +10,7 @@ package edu.wpi.first.wpilibj.sim;
|
||||
import edu.wpi.first.hal.sim.mockdata.AnalogGyroDataJNI;
|
||||
|
||||
public class AnalogGyroSim {
|
||||
private int m_index;
|
||||
private final int m_index;
|
||||
|
||||
public AnalogGyroSim(int index) {
|
||||
m_index = index;
|
||||
|
||||
@@ -10,7 +10,7 @@ package edu.wpi.first.wpilibj.sim;
|
||||
import edu.wpi.first.hal.sim.mockdata.AnalogInDataJNI;
|
||||
|
||||
public class AnalogInSim {
|
||||
private int m_index;
|
||||
private final int m_index;
|
||||
|
||||
public AnalogInSim(int index) {
|
||||
m_index = index;
|
||||
|
||||
@@ -10,7 +10,7 @@ package edu.wpi.first.wpilibj.sim;
|
||||
import edu.wpi.first.hal.sim.mockdata.AnalogOutDataJNI;
|
||||
|
||||
public class AnalogOutSim {
|
||||
private int m_index;
|
||||
private final int m_index;
|
||||
|
||||
public AnalogOutSim(int index) {
|
||||
m_index = index;
|
||||
|
||||
@@ -10,7 +10,7 @@ package edu.wpi.first.wpilibj.sim;
|
||||
import edu.wpi.first.hal.sim.mockdata.AnalogTriggerDataJNI;
|
||||
|
||||
public class AnalogTriggerSim {
|
||||
private int m_index;
|
||||
private final int m_index;
|
||||
|
||||
public AnalogTriggerSim(int index) {
|
||||
m_index = index;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class CallbackStore implements AutoCloseable {
|
||||
|
||||
private int index;
|
||||
private int channel;
|
||||
private int uid;
|
||||
private final int uid;
|
||||
private CancelCallbackFunc cancelCallback;
|
||||
private CancelCallbackChannelFunc cancelCallbackChannel;
|
||||
private CancelCallbackNoIndexFunc cancelCallbackNoIndex;
|
||||
|
||||
@@ -10,7 +10,7 @@ package edu.wpi.first.wpilibj.sim;
|
||||
import edu.wpi.first.hal.sim.mockdata.DIODataJNI;
|
||||
|
||||
public class DIOSim {
|
||||
private int m_index;
|
||||
private final int m_index;
|
||||
|
||||
public DIOSim(int index) {
|
||||
m_index = index;
|
||||
|
||||
@@ -10,7 +10,7 @@ package edu.wpi.first.wpilibj.sim;
|
||||
import edu.wpi.first.hal.sim.mockdata.DigitalPWMDataJNI;
|
||||
|
||||
public class DigitalPWMSim {
|
||||
private int m_index;
|
||||
private final int m_index;
|
||||
|
||||
public DigitalPWMSim(int index) {
|
||||
m_index = index;
|
||||
|
||||
@@ -10,7 +10,7 @@ package edu.wpi.first.wpilibj.sim;
|
||||
import edu.wpi.first.hal.sim.mockdata.EncoderDataJNI;
|
||||
|
||||
public class EncoderSim {
|
||||
private int m_index;
|
||||
private final int m_index;
|
||||
|
||||
public EncoderSim(int index) {
|
||||
m_index = index;
|
||||
|
||||
@@ -10,7 +10,7 @@ package edu.wpi.first.wpilibj.sim;
|
||||
import edu.wpi.first.hal.sim.mockdata.I2CDataJNI;
|
||||
|
||||
public class I2CSim {
|
||||
private int m_index;
|
||||
private final int m_index;
|
||||
|
||||
public I2CSim(int index) {
|
||||
m_index = index;
|
||||
|
||||
@@ -14,21 +14,22 @@ public interface NotifyCallback {
|
||||
switch(type) {
|
||||
case 0x01:
|
||||
callback(name, SimValue.makeBoolean(value1 != 0));
|
||||
break;
|
||||
break;
|
||||
case 0x02:
|
||||
callback(name, SimValue.makeDouble(value2));
|
||||
break;
|
||||
break;
|
||||
case 0x16:
|
||||
callback(name, SimValue.makeEnum((int)value1));
|
||||
break;
|
||||
break;
|
||||
case 0x32:
|
||||
callback(name, SimValue.makeInt((int)value1));
|
||||
break;
|
||||
break;
|
||||
case 0x64:
|
||||
callback(name, SimValue.makeLong(value1));
|
||||
break;
|
||||
default:
|
||||
callback(name, SimValue.makeUnassigned());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ package edu.wpi.first.wpilibj.sim;
|
||||
import edu.wpi.first.hal.sim.mockdata.PCMDataJNI;
|
||||
|
||||
public class PCMSim {
|
||||
private int m_index;
|
||||
private final int m_index;
|
||||
|
||||
public PCMSim(int index) {
|
||||
m_index = index;
|
||||
|
||||
@@ -10,7 +10,7 @@ package edu.wpi.first.wpilibj.sim;
|
||||
import edu.wpi.first.hal.sim.mockdata.PDPDataJNI;
|
||||
|
||||
public class PDPSim {
|
||||
private int m_index;
|
||||
private final int m_index;
|
||||
|
||||
public PDPSim(int index) {
|
||||
m_index = index;
|
||||
|
||||
@@ -10,7 +10,7 @@ package edu.wpi.first.wpilibj.sim;
|
||||
import edu.wpi.first.hal.sim.mockdata.PWMDataJNI;
|
||||
|
||||
public class PWMSim {
|
||||
private int m_index;
|
||||
private final int m_index;
|
||||
|
||||
public PWMSim(int index) {
|
||||
m_index = index;
|
||||
|
||||
@@ -10,7 +10,7 @@ package edu.wpi.first.wpilibj.sim;
|
||||
import edu.wpi.first.hal.sim.mockdata.RelayDataJNI;
|
||||
|
||||
public class RelaySim {
|
||||
private int m_index;
|
||||
private final int m_index;
|
||||
|
||||
public RelaySim(int index) {
|
||||
m_index = index;
|
||||
|
||||
@@ -9,8 +9,9 @@ package edu.wpi.first.wpilibj.sim;
|
||||
|
||||
import edu.wpi.first.hal.sim.mockdata.RoboRioDataJNI;
|
||||
|
||||
@SuppressWarnings({"PMD.ExcessivePublicCount", "PMD.TooManyMethods"})
|
||||
public class RoboRioSim {
|
||||
private int m_index;
|
||||
private final int m_index;
|
||||
|
||||
public RoboRioSim(int index) {
|
||||
m_index = index;
|
||||
|
||||
@@ -10,7 +10,7 @@ package edu.wpi.first.wpilibj.sim;
|
||||
import edu.wpi.first.hal.sim.mockdata.SPIAccelerometerDataJNI;
|
||||
|
||||
public class SPIAccelerometerSim {
|
||||
private int m_index;
|
||||
private final int m_index;
|
||||
|
||||
public SPIAccelerometerSim(int index) {
|
||||
m_index = index;
|
||||
|
||||
@@ -10,7 +10,7 @@ package edu.wpi.first.wpilibj.sim;
|
||||
import edu.wpi.first.hal.sim.mockdata.SPIDataJNI;
|
||||
|
||||
public class SPISim {
|
||||
private int m_index;
|
||||
private final int m_index;
|
||||
|
||||
public SPISim(int index) {
|
||||
m_index = index;
|
||||
|
||||
@@ -9,7 +9,7 @@ package edu.wpi.first.wpilibj.sim;
|
||||
|
||||
import edu.wpi.first.hal.sim.mockdata.SimulatorJNI;
|
||||
|
||||
public class SimHooks {
|
||||
public final class SimHooks {
|
||||
private SimHooks() {
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
package edu.wpi.first.wpilibj.sim;
|
||||
|
||||
public class SimValue {
|
||||
public final class SimValue {
|
||||
private boolean v_boolean;
|
||||
private long v_long;
|
||||
private double v_double;
|
||||
|
||||
Reference in New Issue
Block a user