Upgrade spotless and shadow (#385)

Fixes Log4J vulnerability
This commit is contained in:
Tyler Veness
2022-01-10 11:56:45 -08:00
committed by GitHub
parent 43c35286f3
commit 46fa17dfd8
62 changed files with 978 additions and 978 deletions

View File

@@ -26,20 +26,20 @@ public class Packet {
int readPos, writePos;
/**
* Constructs an empty packet.
*
* @param size The size of the packet buffer.
*/
* Constructs an empty packet.
*
* @param size The size of the packet buffer.
*/
public Packet(int size) {
this.size = size;
packetData = new byte[size];
}
/**
* Constructs a packet with the given data.
*
* @param data The packet data.
*/
* Constructs a packet with the given data.
*
* @param data The packet data.
*/
public Packet(byte[] data) {
packetData = data;
size = packetData.length;
@@ -57,38 +57,38 @@ public class Packet {
}
/**
* Returns the packet data.
*
* @return The packet data.
*/
* Returns the packet data.
*
* @return The packet data.
*/
public byte[] getData() {
return packetData;
}
/**
* Sets the packet data.
*
* @param data The packet data.
*/
* Sets the packet data.
*
* @param data The packet data.
*/
public void setData(byte[] data) {
packetData = data;
size = data.length;
}
/**
* Encodes the byte into the packet.
*
* @param src The byte to encode.
*/
* Encodes the byte into the packet.
*
* @param src The byte to encode.
*/
public void encode(byte src) {
packetData[writePos++] = src;
}
/**
* Encodes the integer into the packet.
*
* @param src The integer to encode.
*/
* Encodes the integer into the packet.
*
* @param src The integer to encode.
*/
public void encode(int src) {
packetData[writePos++] = (byte) (src >>> 24);
packetData[writePos++] = (byte) (src >>> 16);
@@ -97,10 +97,10 @@ public class Packet {
}
/**
* Encodes the double into the packet.
*
* @param src The double to encode.
*/
* Encodes the double into the packet.
*
* @param src The double to encode.
*/
public void encode(double src) {
long data = Double.doubleToRawLongBits(src);
packetData[writePos++] = (byte) ((data >> 56) & 0xff);
@@ -114,28 +114,28 @@ public class Packet {
}
/**
* Encodes the boolean into the packet.
*
* @param src The boolean to encode.
*/
* Encodes the boolean into the packet.
*
* @param src The boolean to encode.
*/
public void encode(boolean src) {
packetData[writePos++] = src ? (byte) 1 : (byte) 0;
}
/**
* Returns a decoded byte from the packet.
*
* @return A decoded byte from the packet.
*/
* Returns a decoded byte from the packet.
*
* @return A decoded byte from the packet.
*/
public byte decodeByte() {
return packetData[readPos++];
}
/**
* Returns a decoded int from the packet.
*
* @return A decoded int from the packet.
*/
* Returns a decoded int from the packet.
*
* @return A decoded int from the packet.
*/
public int decodeInt() {
return (0xff & packetData[readPos++]) << 24
| (0xff & packetData[readPos++]) << 16
@@ -144,10 +144,10 @@ public class Packet {
}
/**
* Returns a decoded double from the packet.
*
* @return A decoded double from the packet.
*/
* Returns a decoded double from the packet.
*
* @return A decoded double from the packet.
*/
public double decodeDouble() {
long data =
(long) (0xff & packetData[readPos++]) << 56
@@ -162,10 +162,10 @@ public class Packet {
}
/**
* Returns a decoded boolean from the packet.
*
* @return A decoded boolean from the packet.
*/
* Returns a decoded boolean from the packet.
*
* @return A decoded boolean from the packet.
*/
public boolean decodeBoolean() {
return packetData[readPos++] == 1;
}

View File

@@ -35,31 +35,31 @@ public class PhotonPipelineResult {
public PhotonPipelineResult() {}
/**
* Constructs a pipeline result.
*
* @param latencyMillis The latency in the pipeline.
* @param targets The list of targets identified by the pipeline.
*/
* Constructs a pipeline result.
*
* @param latencyMillis The latency in the pipeline.
* @param targets The list of targets identified by the pipeline.
*/
public PhotonPipelineResult(double latencyMillis, List<PhotonTrackedTarget> targets) {
this.latencyMillis = latencyMillis;
this.targets.addAll(targets);
}
/**
* Returns the size of the packet needed to store this pipeline result.
*
* @return The size of the packet needed to store this pipeline result.
*/
* Returns the size of the packet needed to store this pipeline result.
*
* @return The size of the packet needed to store this pipeline result.
*/
public int getPacketSize() {
return targets.size() * PhotonTrackedTarget.PACK_SIZE_BYTES + 8 + 2;
}
/**
* Returns the best target in this pipeline result. If there are no targets, this method will
* return null. The best target is determined by the target sort mode in the PhotonVision UI.
*
* @return The best target of the pipeline result.
*/
* Returns the best target in this pipeline result. If there are no targets, this method will
* return null. The best target is determined by the target sort mode in the PhotonVision UI.
*
* @return The best target of the pipeline result.
*/
public PhotonTrackedTarget getBestTarget() {
if (!hasTargets() && !HAS_WARNED) {
String errStr =
@@ -74,28 +74,28 @@ public class PhotonPipelineResult {
}
/**
* Returns the latency in the pipeline.
*
* @return The latency in the pipeline.
*/
* Returns the latency in the pipeline.
*
* @return The latency in the pipeline.
*/
public double getLatencyMillis() {
return latencyMillis;
}
/**
* Returns whether the pipeline has targets.
*
* @return Whether the pipeline has targets.
*/
* Returns whether the pipeline has targets.
*
* @return Whether the pipeline has targets.
*/
public boolean hasTargets() {
return targets.size() > 0;
}
/**
* Returns a copy of the vector of targets.
*
* @return A copy of the vector of targets.
*/
* Returns a copy of the vector of targets.
*
* @return A copy of the vector of targets.
*/
public List<PhotonTrackedTarget> getTargets() {
return new ArrayList<>(targets);
}
@@ -116,11 +116,11 @@ public class PhotonPipelineResult {
}
/**
* Populates the fields of the pipeline result from the packet.
*
* @param packet The incoming packet.
* @return The incoming packet.
*/
* Populates the fields of the pipeline result from the packet.
*
* @param packet The incoming packet.
* @return The incoming packet.
*/
public Packet createFromPacket(Packet packet) {
// Decode latency, existence of targets, and number of targets.
latencyMillis = packet.decodeDouble();
@@ -139,11 +139,11 @@ public class PhotonPipelineResult {
}
/**
* Populates the outgoing packet with information from this pipeline result.
*
* @param packet The outgoing packet.
* @return The outgoing packet.
*/
* Populates the outgoing packet with information from this pipeline result.
*
* @param packet The outgoing packet.
* @return The outgoing packet.
*/
public Packet populatePacket(Packet packet) {
// Encode latency, existence of targets, and number of targets.
packet.encode(latencyMillis);

View File

@@ -78,11 +78,11 @@ public class PhotonTrackedTarget {
}
/**
* Populates the fields of this class with information from the incoming packet.
*
* @param packet The incoming packet.
* @return The incoming packet.
*/
* Populates the fields of this class with information from the incoming packet.
*
* @param packet The incoming packet.
* @return The incoming packet.
*/
public Packet createFromPacket(Packet packet) {
yaw = packet.decodeDouble();
pitch = packet.decodeDouble();
@@ -99,11 +99,11 @@ public class PhotonTrackedTarget {
}
/**
* Populates the outgoing packet with information from the current target.
*
* @param packet The outgoing packet.
* @return The outgoing packet.
*/
* Populates the outgoing packet with information from the current target.
*
* @param packet The outgoing packet.
* @return The outgoing packet.
*/
public Packet populatePacket(Packet packet) {
packet.encode(yaw);
packet.encode(pitch);