only: refactoring: get rid of redundant class instantiation when we need just call a static method

This commit is contained in:
kifir 2024-08-13 14:27:26 +03:00 committed by rusefillc
parent 07ce7f5691
commit c7fefcef25
1 changed files with 3 additions and 6 deletions

View File

@ -77,12 +77,9 @@ public class DfuFlasher {
callbacks.logLine("Using selected " + port + "\n");
IoStream stream = BufferedSerialIoStream.openPort(port);
AtomicReference<String> signature = new AtomicReference<>();
new SerialAutoChecker(PortDetector.DetectorMode.DETECT_TS, port, new CountDownLatch(1)).checkResponse(stream, new Function<SerialAutoChecker.CallbackContext, Void>() {
@Override
public Void apply(SerialAutoChecker.CallbackContext callbackContext) {
signature.set(callbackContext.getSignature());
return null;
}
SerialAutoChecker.checkResponse(stream, callbackContext -> {
signature.set(callbackContext.getSignature());
return null;
});
if (signature.get() == null) {
callbacks.appendLine("");