Skip to content

Commit 1210348

Browse files
committed
fixed some trivial warnings
1 parent b40f54a commit 1210348

File tree

13 files changed

+53
-46
lines changed

13 files changed

+53
-46
lines changed

app/src/cc/arduino/contributions/ui/InstallerJDialog.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171

7272
import cc.arduino.contributions.ui.listeners.AbstractKeyListener;
7373
import processing.app.Base;
74-
import processing.app.Theme;
7574

7675
public abstract class InstallerJDialog<T> extends JDialog {
7776

app/src/processing/app/Base.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -989,9 +989,9 @@ public boolean handleQuit() {
989989
// kill uploader (if still alive)
990990
UploaderUtils uploaderInstance = new UploaderUtils();
991991
Uploader uploader = uploaderInstance.getUploaderByPreferences(false);
992-
if (uploader != null && uploader.programmerPid != null && uploader.programmerPid.isAlive()) {
992+
if (uploader != null && Uploader.programmerPid != null && Uploader.programmerPid.isAlive()) {
993993
// kill the stuck programmer
994-
uploader.programmerPid.destroyForcibly();
994+
Uploader.programmerPid.destroyForcibly();
995995
}
996996

997997
if (handleQuitEach()) {
@@ -1568,7 +1568,7 @@ public void actionPerformed(ActionEvent e) {
15681568
};
15691569
List<TargetBoard> boards = (List<TargetBoard>) subAction.getValue("board");
15701570
if (boards == null) {
1571-
boards = new ArrayList<TargetBoard>();
1571+
boards = new ArrayList<>();
15721572
}
15731573
boards.add(board);
15741574
subAction.putValue("board", boards);
@@ -1946,6 +1946,7 @@ public void addEditorFontResizeMouseWheelListener(Component comp) {
19461946
*/
19471947
public void addEditorFontResizeKeyListener(Component comp) {
19481948
comp.addKeyListener(new KeyAdapter() {
1949+
@SuppressWarnings("incomplete-switch")
19491950
@Override
19501951
public void keyPressed(KeyEvent e) {
19511952
if (e.getModifiersEx() == KeyEvent.CTRL_DOWN_MASK

app/src/processing/app/CommandHistory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
public class CommandHistory {
1111

12-
private final LinkedList<String> commandHistory = new LinkedList<String>();
12+
private final LinkedList<String> commandHistory = new LinkedList<>();
1313
private final int maxHistorySize;
1414
private ListIterator<String> iterator = null;
1515
private boolean iteratorAsc;

app/src/processing/app/Editor.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@
8080
import javax.swing.event.MenuEvent;
8181
import javax.swing.event.MenuListener;
8282
import javax.swing.text.BadLocationException;
83-
import javax.swing.text.Document;
84-
import javax.swing.text.Element;
8583

8684
import org.fife.ui.rsyntaxtextarea.folding.FoldManager;
8785

@@ -237,7 +235,7 @@ public boolean test(SketchController controller) {
237235
private UploadHandler uploadUsingProgrammerHandler;
238236
private Runnable timeoutUploadHandler;
239237

240-
private Map<String, Tool> internalToolCache = new HashMap<String, Tool>();
238+
private Map<String, Tool> internalToolCache = new HashMap<>();
241239

242240
public Editor(Base ibase, File file, int[] storedLocation, int[] defaultLocation, Platform platform) throws Exception {
243241
super("Arduino");
@@ -1832,7 +1830,7 @@ public void updateTitle() {
18321830
SketchFile current = getCurrentTab().getSketchFile();
18331831
String customFormat = PreferencesData.get("editor.custom_title_format");
18341832
if (customFormat != null && !customFormat.trim().isEmpty()) {
1835-
Map<String, String> titleMap = new HashMap<String, String>();
1833+
Map<String, String> titleMap = new HashMap<>();
18361834
titleMap.put("file", current.getFileName());
18371835
String path = sketch.getFolder().getAbsolutePath();
18381836
titleMap.put("folder", path);

app/src/processing/app/EditorToolbar.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,9 @@ private void handleSelectionPressed(int sel) {
461461
private void handleSelectionPressed(int sel, boolean isShiftDown, int x, int y) {
462462
switch (sel) {
463463
case RUN:
464-
if (!editor.avoidMultipleOperations) {
464+
if (!Editor.avoidMultipleOperations) {
465465
editor.handleRun(false, editor.presentHandler, editor.runHandler);
466-
editor.avoidMultipleOperations = true;
466+
Editor.avoidMultipleOperations = true;
467467
}
468468
break;
469469

@@ -494,7 +494,7 @@ private void handleSelectionPressed(int sel, boolean isShiftDown, int x, int y)
494494

495495
case EXPORT:
496496
// launch a timeout timer which can reenable to upload button functionality an
497-
if (!editor.avoidMultipleOperations) {
497+
if (!Editor.avoidMultipleOperations) {
498498
editor.handleExport(isShiftDown);
499499
}
500500
break;

app/src/processing/app/SerialMonitor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public SerialMonitor(BoardPort port) {
7070

7171
// Add key listener to UP, DOWN, ESC keys for command history traversal.
7272
textField.addKeyListener(new KeyAdapter() {
73+
@SuppressWarnings("incomplete-switch")
7374
@Override
7475
public void keyPressed(KeyEvent e) {
7576
switch (e.getKeyCode()) {

app/src/processing/app/SerialPlotter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ public void windowGainedFocus(WindowEvent e) {
317317
noLineEndingAlert.setMinimumSize(minimumSize);
318318

319319

320-
lineEndings = new JComboBox<String>(new String[]{tr("No line ending"), tr("Newline"), tr("Carriage return"), tr("Both NL & CR")});
320+
lineEndings = new JComboBox<>(new String[]{tr("No line ending"), tr("Newline"), tr("Carriage return"), tr("Both NL & CR")});
321321
lineEndings.addActionListener((ActionEvent event) -> {
322322
PreferencesData.setInteger("serial.line_ending", lineEndings.getSelectedIndex());
323323
noLineEndingAlert.setForeground(pane.getBackground());

arduino-core/src/cc/arduino/packages/discoverers/PluggableDiscovery.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ public class PluggableDiscovery implements Discovery {
5656
private final String discoveryName;
5757
private final String[] cmd;
5858
private final List<BoardPort> portList = new ArrayList<>();
59-
private Process program=null;
59+
Process program = null;
6060
private Thread pollingThread;
6161

62-
private void debug(String x) {
62+
void debug(String x) {
6363
if (PreferencesData.getBoolean("discovery.debug"))
6464
System.out.println(discoveryName + ": " + x);
6565
}
@@ -211,6 +211,7 @@ private void startPolling() {
211211
debug("START");
212212
write("START\n");
213213
Thread pollingThread = new Thread() {
214+
@Override
214215
public void run() {
215216
try {
216217
while (program != null && program.isAlive()) {
@@ -238,7 +239,7 @@ public void stop() throws Exception {
238239
}
239240
}
240241

241-
private void write(String command) {
242+
void write(String command) {
242243
if (program != null && program.isAlive()) {
243244
OutputStream out = program.getOutputStream();
244245
try {

arduino-core/src/cc/arduino/packages/uploaders/SSHUploader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
public class SSHUploader extends Uploader {
6161

6262
private static final Set<String> FILES_NOT_TO_COPY =
63-
Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(".DS_Store", ".Trash", "Thumbs.db", "__MACOSX")));
63+
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(".DS_Store", ".Trash", "Thumbs.db", "__MACOSX")));
6464

6565
private final BoardPort port;
6666

arduino-core/src/cc/arduino/packages/uploaders/SerialUploader.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,14 @@ private String waitForUploadPort(String uploadPort, List<String> before) throws
232232
return waitForUploadPort(uploadPort, before, verbose, 10000);
233233
}
234234

235-
private String waitForUploadPort(String uploadPort, List<String> before, boolean verbose, int timeout) throws InterruptedException, RunnerException {
235+
private String waitForUploadPort(String uploadPort, List<String> before, boolean verboseDebug, int timeout) throws InterruptedException, RunnerException {
236236
// Wait for a port to appear on the list
237237
int elapsed = 0;
238238
while (elapsed < timeout) {
239239
List<String> now = Serial.list();
240240
List<String> diff = new ArrayList<>(now);
241241
diff.removeAll(before);
242-
if (verbose) {
242+
if (verboseDebug) {
243243
System.out.print("PORTS {");
244244
for (String p : before)
245245
System.out.print(p + ", ");
@@ -253,7 +253,7 @@ private String waitForUploadPort(String uploadPort, List<String> before, boolean
253253
}
254254
if (diff.size() > 0) {
255255
String newPort = diff.get(0);
256-
if (verbose)
256+
if (verboseDebug)
257257
System.out.println("Found upload port: " + newPort);
258258
return newPort;
259259
}
@@ -267,7 +267,7 @@ private String waitForUploadPort(String uploadPort, List<String> before, boolean
267267
// come back, so use a time out before assuming that the selected port is the
268268
// bootloader (not the sketch).
269269
if (elapsed >= 5000 && now.contains(uploadPort)) {
270-
if (verbose)
270+
if (verboseDebug)
271271
System.out.println("Uploading using selected port: " + uploadPort);
272272
return uploadPort;
273273
}

0 commit comments

Comments
 (0)