mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
Clean up AutoCloseable and other Java warnings (#1866)
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
package edu.wpi.first.wpilibj.test;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -107,11 +108,12 @@ public abstract class AbstractTestSuite {
|
||||
if (areAnySuperClassesOfTypeAbstractTestSuite(c)) {
|
||||
// Create a new instance of this class so that we can retrieve its data
|
||||
try {
|
||||
AbstractTestSuite suite = (AbstractTestSuite) c.newInstance();
|
||||
AbstractTestSuite suite = (AbstractTestSuite) c.getDeclaredConstructor().newInstance();
|
||||
// Add the tests from this suite that match the regex to the list of
|
||||
// tests to run
|
||||
runningList = suite.getAllContainedBaseTests(runningList);
|
||||
} catch (InstantiationException | IllegalAccessException ex) {
|
||||
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException
|
||||
| IllegalAccessException ex) {
|
||||
// This shouldn't happen unless the constructor is changed in some
|
||||
// way.
|
||||
logger.log(Level.SEVERE, "Test suites can not take paramaters in their constructors.",
|
||||
@@ -200,13 +202,14 @@ public abstract class AbstractTestSuite {
|
||||
if (areAnySuperClassesOfTypeAbstractTestSuite(c)) {
|
||||
// Create a new instance of this class so that we can retrieve its
|
||||
// data.
|
||||
suite = (AbstractTestSuite) c.newInstance();
|
||||
suite = (AbstractTestSuite) c.getDeclaredConstructor().newInstance();
|
||||
// Add the tests from this suite that match the regex to the list of
|
||||
// tests to run
|
||||
runningList = suite.getSuiteOrTestMatchingRegex(regex, runningList);
|
||||
}
|
||||
|
||||
} catch (InstantiationException | IllegalAccessException ex) {
|
||||
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException
|
||||
| IllegalAccessException ex) {
|
||||
// This shouldn't happen unless the constructor is changed in some
|
||||
// way.
|
||||
logger.log(Level.SEVERE, "Test suites can not take paramaters in their constructors.",
|
||||
|
||||
@@ -208,14 +208,14 @@ public final class TestBench {
|
||||
List<List<Integer[]>> pairs = new ArrayList<List<Integer[]>>();
|
||||
List<Integer[]> setA =
|
||||
Arrays.asList(new Integer[][]{
|
||||
{new Integer(DIOCrossConnectA1), new Integer(DIOCrossConnectA2)},
|
||||
{new Integer(DIOCrossConnectA2), new Integer(DIOCrossConnectA1)}});
|
||||
{DIOCrossConnectA1, DIOCrossConnectA2},
|
||||
{DIOCrossConnectA2, DIOCrossConnectA1}});
|
||||
pairs.add(setA);
|
||||
|
||||
List<Integer[]> setB =
|
||||
Arrays.asList(new Integer[][]{
|
||||
{new Integer(DIOCrossConnectB1), new Integer(DIOCrossConnectB2)},
|
||||
{new Integer(DIOCrossConnectB2), new Integer(DIOCrossConnectB1)}});
|
||||
{DIOCrossConnectB1, DIOCrossConnectB2},
|
||||
{DIOCrossConnectB2, DIOCrossConnectB1}});
|
||||
pairs.add(setB);
|
||||
// NOTE: IF MORE DIOCROSSCONNECT PAIRS ARE ADDED ADD THEM HERE
|
||||
return pairs;
|
||||
|
||||
Reference in New Issue
Block a user