Resolve code quality warnings

This commit is contained in:
Brendan Robert 2023-07-03 20:30:14 -05:00
parent 9b51c7d733
commit dd89499e76
4 changed files with 7 additions and 11 deletions

View File

@ -3,7 +3,6 @@ package jace;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -68,9 +67,6 @@ import javafx.util.StringConverter;
*/ */
public class JaceUIController { public class JaceUIController {
@FXML
private URL location;
@FXML @FXML
private AnchorPane rootPane; private AnchorPane rootPane;

View File

@ -126,7 +126,7 @@ public class Configuration implements Reconfigurable {
public transient ConfigNode root; public transient ConfigNode root;
public transient ConfigNode parent; public transient ConfigNode parent;
private transient ObservableList<ConfigNode> children; private final transient ObservableList<ConfigNode> children;
public transient Reconfigurable subject; public transient Reconfigurable subject;
private transient boolean changed = true; private transient boolean changed = true;
@ -147,7 +147,7 @@ public class Configuration implements Reconfigurable {
private void readObject(java.io.ObjectInputStream in) private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException { throws IOException, ClassNotFoundException {
if (children == null) { if (children == null) {
children = getChildren(); children.setAll(getChildren());
} }
children.setAll(super.getChildren()); children.setAll(super.getChildren());
id = (String) in.readObject(); id = (String) in.readObject();

View File

@ -400,8 +400,7 @@ public class Utility {
} }
public static Object setChild(Object object, String fieldName, String value, boolean hex) { public static Object setChild(Object object, String fieldName, String value, boolean hex) {
if (object instanceof Map) { if (object instanceof Map map) {
Map map = (Map) object;
for (Object key : map.entrySet()) { for (Object key : map.entrySet()) {
if (key.toString().equalsIgnoreCase(fieldName)) { if (key.toString().equalsIgnoreCase(fieldName)) {
map.put(key, value); map.put(key, value);

View File

@ -11,6 +11,8 @@ import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -139,7 +141,7 @@ public class LawlessHacks extends Cheats {
try { try {
return new Media(path.toURI().toString()); return new Media(path.toURI().toString());
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
e.printStackTrace(); Logger.getLogger(getClass().getName()).log(Level.WARNING, "Unable to load audio track " + number + " from " + pathStr, e);
return null; return null;
} }
} }
@ -160,7 +162,7 @@ public class LawlessHacks extends Cheats {
private void stopSongEffect() { private void stopSongEffect() {
if (playbackEffect != null && playbackEffect.isAlive()) { if (playbackEffect != null && playbackEffect.isAlive()) {
playbackEffect.interrupt(); playbackEffect.interrupt();
Thread.yield(); Thread.onSpinWait();
} }
playbackEffect = null; playbackEffect = null;
} }
@ -331,7 +333,6 @@ public class LawlessHacks extends Cheats {
} }
if (COMMENT.matcher(line).matches() || line.trim().isEmpty()) { if (COMMENT.matcher(line).matches() || line.trim().isEmpty()) {
// System.out.println("Ignoring: "+line); // System.out.println("Ignoring: "+line);
return;
} else if (LABEL.matcher(line).matches()) { } else if (LABEL.matcher(line).matches()) {
currentScore = line.toLowerCase(Locale.ROOT); currentScore = line.toLowerCase(Locale.ROOT);
scores.put(currentScore, new HashMap<>()); scores.put(currentScore, new HashMap<>());