more code inspection cleanups

This commit is contained in:
Matthew Kennedy 2023-10-31 00:45:49 -07:00
parent 9293ee78b7
commit e89cba2b67
8 changed files with 10 additions and 16 deletions

View File

@ -6,7 +6,7 @@ import java.io.IOException;
* IO Exception which was already reported with a UI dialog
*/
public class ReportedIOException extends IOException {
private IOException e;
private final IOException e;
public ReportedIOException(IOException e) {
this.e = e;

View File

@ -79,8 +79,8 @@ public class RawIniFile {
* Immutable representation of since ini file line
*/
public static class Line {
private String rawText;
private String[] tokens;
private final String rawText;
private final String[] tokens;
private static final String namePattern = "[[\\w\\d\\s_]]+";
private static final Pattern DIRECTIVE = Pattern.compile("#(if\\s" + namePattern + "|else|elif\\s\" + namePattern + \"|endif)");

View File

@ -240,12 +240,7 @@ public class LinkManager implements Closeable {
@Override
public IoStream call() {
messageListener.postMessage(getClass(), "Opening port: " + port);
IoStream stream = BufferedSerialIoStream.openPort(port);
if (stream == null) {
// error already reported
return null;
}
return stream;
return BufferedSerialIoStream.openPort(port);
}
};
setConnector(new StreamConnector(this, ioStreamCallable));

View File

@ -21,7 +21,7 @@ public class SignatureHelper {
return null;
String fileName = s.getHash() + ".ini";
return new Pair("https://rusefi.com/online/ini/rusefi/" + s.getBranch() + SLASH + s.getYear() + SLASH +
return new Pair<>("https://rusefi.com/online/ini/rusefi/" + s.getBranch() + SLASH + s.getYear() + SLASH +
s.getMonth() + SLASH +
s.getDay() + SLASH +
s.getBundleTarget() + SLASH +

View File

@ -17,7 +17,7 @@ public class ChartScrollControl {
private final JPanel content = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 0));
private final AtomicInteger index = new AtomicInteger();
private static final JLabel info = new JLabel();
private ChartRepository.ChartRepositoryListener listener;
private final ChartRepository.ChartRepositoryListener listener;
public ChartScrollControl(final ChartRepository.ChartRepositoryListener listener) {

View File

@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.Random;
public class SoftLimiterSandbox {
private Random r = new Random();
private final Random r = new Random();
public static void main(String[] args) {
new SoftLimiterSandbox().testSoftLimit();

View File

@ -18,8 +18,7 @@ public class IoUtil2 {
try {
try (BufferedReader reader = new BufferedReader(new FileReader(fileName))) {
while (true) {
if (!((line = reader.readLine()) != null)) break;
while ((line = reader.readLine()) != null) {
stringBuilder.append(line);
stringBuilder.append(ls);
}

View File

@ -130,12 +130,12 @@ public class LiveDataProcessor {
if (constexpr != null) {
sdCardFieldsConsumer.home = constexpr;
sdCardFieldsConsumer.isPtr = isPtr;
state.addDestination((state1, structure) -> sdCardFieldsConsumer.handleEndStruct(state1, structure));
state.addDestination(sdCardFieldsConsumer::handleEndStruct);
outputValueConsumer.currentSectionPrefix = constexpr;
outputValueConsumer.conditional = conditional;
outputValueConsumer.isPtr = isPtr;
state.addDestination((state1, structure) -> outputValueConsumer.handleEndStruct(state1, structure));
state.addDestination(outputValueConsumer::handleEndStruct);
}