Java cleanups (#1776)

* Remove extra ';'s
* Remove unnecessary conversions to String
* Use StandardCharsets object
* Replace infinite while with check for interrupted thread
* Remove redundant local vars
* Remove redundant throws clause
* Remove redundant primitive wrapping
* Fix malformed Nested class test
* Remove unnecessary unboxing
* Remove unnecessary explicit type argument
* Replace lambdas with method references
* Replace statement lambdas with expression lambdas
* Replace null check with method call
* Replace number comparison with method call
* Fix broken javadoc comments
* Replace Arrays.asList with singletonLists
* Remove excessive lambda usage
* Remove redundant string operation
* Remove redundant type casts
* Remove unnecessary returns
* Remove redundant suppressions
* Fix unresolved file reference
* static analysis fixes
This commit is contained in:
Austin Shalit
2019-08-01 01:19:48 -04:00
committed by Peter Johnson
parent 39561751fc
commit df12fc2a86
43 changed files with 129 additions and 180 deletions

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -61,7 +61,7 @@ public class Elevator extends PIDSubsystem {
* The log method puts interesting information to the SmartDashboard.
*/
public void log() {
SmartDashboard.putData("Elevator Pot", (AnalogPotentiometer) m_pot);
SmartDashboard.putData("Elevator Pot", m_pot);
}
/**

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -58,7 +58,7 @@ public class Wrist extends PIDSubsystem {
* The log method puts interesting information to the SmartDashboard.
*/
public void log() {
SmartDashboard.putData("Wrist Angle", (AnalogPotentiometer) m_pot);
SmartDashboard.putData("Wrist Angle", m_pot);
}
/**

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -61,7 +61,7 @@ public class Robot extends TimedRobot {
oi = new OI();
// instantiate the command used for the autonomous period
m_autoChooser = new SendableChooser<Command>();
m_autoChooser = new SendableChooser<>();
m_autoChooser.setDefaultOption("Drive and Shoot", new DriveAndShootAutonomous());
m_autoChooser.addOption("Drive Forward", new DriveForward());
SmartDashboard.putData("Auto Mode", m_autoChooser);
@@ -69,7 +69,7 @@ public class Robot extends TimedRobot {
@Override
public void autonomousInit() {
m_autonomousCommand = (Command) m_autoChooser.getSelected();
m_autonomousCommand = m_autoChooser.getSelected();
m_autonomousCommand.start();
}

View File

@@ -41,7 +41,7 @@ public class Robot extends RobotBase {
// Tell the DS that the robot is ready to be enabled
HAL.observeUserProgramStarting();
while (true) {
while (!Thread.currentThread().isInterrupted()) {
if (isDisabled()) {
m_ds.InDisabled(true);
disabled();