mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Use Java 17 features (#6691)
Uses enhanced instanceof (and simplify equals methods) Uses switch expressions and arrow labels Seal and finalize some Shuffleboard classes Co-authored-by: Sam Carlberg <sam@slfc.dev>
This commit is contained in:
@@ -156,8 +156,8 @@ public abstract class MotorEncoderFixture<T extends MotorController> implements
|
||||
public void teardown() {
|
||||
if (!m_tornDown) {
|
||||
if (m_motor != null) {
|
||||
if (m_motor instanceof PWM) {
|
||||
((PWM) m_motor).close();
|
||||
if (m_motor instanceof PWM motor) {
|
||||
motor.close();
|
||||
}
|
||||
m_motor = null;
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ public abstract class AbstractComsSetup {
|
||||
protected void failed(Throwable throwable, Description description, String status) {
|
||||
TestBench.out().println();
|
||||
// Instance of is the best way I know to retrieve this data.
|
||||
if (throwable instanceof MultipleFailureException) {
|
||||
if (throwable instanceof MultipleFailureException mfe) {
|
||||
/*
|
||||
* MultipleFailureExceptions hold multiple exceptions in one exception.
|
||||
* In order to properly display these stack traces we have to cast the
|
||||
@@ -114,8 +114,8 @@ public abstract class AbstractComsSetup {
|
||||
* it.
|
||||
*/
|
||||
int exceptionCount = 1; // Running exception count
|
||||
int failureCount = ((MultipleFailureException) throwable).getFailures().size();
|
||||
for (Throwable singleThrown : ((MultipleFailureException) throwable).getFailures()) {
|
||||
int failureCount = mfe.getFailures().size();
|
||||
for (Throwable singleThrown : mfe.getFailures()) {
|
||||
getClassLogger()
|
||||
.logp(
|
||||
Level.SEVERE,
|
||||
|
||||
Reference in New Issue
Block a user