Skip to content

[CQ] cleanup dead/redundant code #8367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/io/flutter/FlutterProjectActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ abstract class FlutterProjectActivity : ProjectActivity {
}

protected fun log(): Logger {
return log;
return log
}
}
1 change: 0 additions & 1 deletion src/io/flutter/actions/AttachDebuggerAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ private static class SelectConfigDialog extends DialogWrapper {
//noinspection DataFlowIssue
myPanel.add(myTextPane);
init();
//noinspection ConstantConditions
getButton(getCancelAction()).setVisible(false);
}

Expand Down
1 change: 0 additions & 1 deletion src/io/flutter/android/AndroidEmulator.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ public int hashCode() {
// This is: EmulatorSettings.getInstance().getLaunchInToolWindow();
// Beginning in 2022.2, Android Studio moved this class to a different package.
// IntelliJ did not adopt that change, and we cannot build separate plugins for the two.
@SuppressWarnings("ConstantConditions")
private boolean getLaunchInToolWindow() {
Class<?> aClass;
try {
Expand Down
1 change: 0 additions & 1 deletion src/io/flutter/jxbrowser/JxBrowserManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package io.flutter.jxbrowser;

import com.google.common.annotations.VisibleForTesting;
import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressIndicator;
Expand Down
1 change: 0 additions & 1 deletion src/io/flutter/run/bazelTest/BazelTestLaunchState.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
/**
* The Bazel version of the {@link io.flutter.run.test.TestLaunchState}.
*/
@SuppressWarnings("JavadocReference")
public class BazelTestLaunchState extends CommandLineState {
@NotNull
private final BazelTestConfig config;
Expand Down
2 changes: 1 addition & 1 deletion src/io/flutter/test/DartTestEventsConverterZ.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public class DartTestEventsConverterZ extends OutputToGeneralTestEventsConverter
private String myLocation;
private Key myCurrentOutputType;
private ServiceMessageVisitor myCurrentVisitor;
private final HashMap myTestIdToTimestamp;
private final HashMap<Integer, Long> myTestIdToTimestamp;
private final Map<Integer, Test> myTestData;
private final Map<Integer, Group> myGroupData;
private final Map<Integer, Suite> mySuiteData;
Expand Down
1 change: 0 additions & 1 deletion src/io/flutter/utils/GradleUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ private static GradleSettingsFile parseSettings(Project project) {
}
}

@SuppressWarnings("rawtypes")
private static BuildModelContext makeBuildModelContext(Project project) {
return BuildModelContext.create(project, new AndroidLocationProvider());
}
Expand Down
6 changes: 3 additions & 3 deletions src/io/flutter/vmService/frame/DartVmServiceValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@

public class DartVmServiceValue extends XNamedValue {
private static final LayeredIcon FINAL_FIELD_ICON =
new LayeredIcon().layeredIcon(() -> new Icon[]{AllIcons.Nodes.Field, AllIcons.Nodes.FinalMark});
LayeredIcon.layeredIcon(() -> new Icon[]{AllIcons.Nodes.Field, AllIcons.Nodes.FinalMark});
private static final LayeredIcon STATIC_FIELD_ICON =
new LayeredIcon().layeredIcon(() -> new Icon[]{AllIcons.Nodes.Field, AllIcons.Nodes.StaticMark});
LayeredIcon.layeredIcon(() -> new Icon[]{AllIcons.Nodes.Field, AllIcons.Nodes.StaticMark});
private static final LayeredIcon STATIC_FINAL_FIELD_ICON =
new LayeredIcon().layeredIcon(() -> new Icon[]{AllIcons.Nodes.Field, AllIcons.Nodes.StaticMark, AllIcons.Nodes.FinalMark});
LayeredIcon.layeredIcon(() -> new Icon[]{AllIcons.Nodes.Field, AllIcons.Nodes.StaticMark, AllIcons.Nodes.FinalMark});
private static final String JSON_STRING_TEMPLATE =
"'{'\"type\":\"@Instance\",\"class\":'{'\"type\":\"@Class\",\"fixedId\":\"true\",\"id\":\"classes/91\"," +
"\"name\":\"_OneByteString\"'}',\"kind\":\"String\",\"length\":\"{0}\",\"valueAsString\":\"{1}\"'}'";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public static VmService connect(final String url) throws IOException {
URI uri;
try {
uri = new URI(url);
} catch (URISyntaxException e) {
}
catch (URISyntaxException e) {
throw new IOException("Invalid URL: " + url, e);
}
String wsScheme = uri.getScheme();
Expand All @@ -65,7 +66,8 @@ public static VmService connect(final String url) throws IOException {
WebSocket webSocket;
try {
webSocket = new WebSocket(uri);
} catch (WebSocketException e) {
}
catch (WebSocketException e) {
throw new IOException("Failed to create websocket: " + url, e);
}
final VmService vmService = new VmService();
Expand All @@ -84,7 +86,8 @@ public void onMessage(WebSocketMessage message) {
Logging.getLogger().logInformation("VM message: " + message.getText());
try {
vmService.processMessage(message.getText());
} catch (Exception e) {
}
catch (Exception e) {
Logging.getLogger().logError(e.getMessage(), e);
}
}
Expand All @@ -106,12 +109,13 @@ public void onPong() {
});

// Establish WebSocket Connection
//noinspection TryWithIdenticalCatches
try {
webSocket.connect();
} catch (WebSocketException e) {
}
catch (WebSocketException e) {
throw new IOException("Failed to connect: " + url, e);
} catch (ArrayIndexOutOfBoundsException e) {
}
catch (ArrayIndexOutOfBoundsException e) {
// The weberknecht can occasionally throw an array index exception if a connect terminates on initial connect
// (de.roderick.weberknecht.WebSocket.connect, WebSocket.java:126).
throw new IOException("Failed to connect: " + url, e);
Expand All @@ -125,7 +129,7 @@ public void onPong() {
@Override
public void onError(RPCError error) {
String msg = "Failed to determine protocol version: " + error.getCode() + "\n message: "
+ error.getMessage() + "\n details: " + error.getDetails();
+ error.getMessage() + "\n details: " + error.getDetails();
Logging.getLogger().logInformation(msg);
errMsg[0] = msg;
}
Expand All @@ -145,7 +149,8 @@ public void received(Version version) {
if (errMsg[0] != null) {
throw new IOException(errMsg[0]);
}
} catch (InterruptedException e) {
}
catch (InterruptedException e) {
throw new RuntimeException("Interrupted while waiting for response", e);
}

Expand All @@ -156,7 +161,6 @@ public void received(Version version) {
* Connect to the VM observatory service on the given local port.
*
* @return an API object for interacting with the VM service (not {@code null}).
*
* @deprecated prefer the Url based constructor {@link VmServiceBase#connect}
*/
@Deprecated
Expand Down Expand Up @@ -253,8 +257,9 @@ public void onError(RPCError error) {
@Override
public void received(Obj response) {
if (response instanceof Instance) {
consumer.received((Instance) response);
} else {
consumer.received((Instance)response);
}
else {
onError(RPCError.unexpected("Instance", response));
}
}
Expand All @@ -280,8 +285,9 @@ public void onError(RPCError error) {
@Override
public void received(Obj response) {
if (response instanceof Library) {
consumer.received((Library) response);
} else {
consumer.received((Library)response);
}
else {
onError(RPCError.unexpected("Library", response));
}
}
Expand Down Expand Up @@ -343,7 +349,8 @@ public void connectionOpened() {
for (VmServiceListener listener : new ArrayList<>(vmListeners)) {
try {
listener.connectionOpened();
} catch (Exception e) {
}
catch (Exception e) {
Logging.getLogger().logError("Exception notifying listener", e);
}
}
Expand All @@ -353,7 +360,8 @@ private void forwardEvent(String streamId, Event event) {
for (VmServiceListener listener : new ArrayList<>(vmListeners)) {
try {
listener.received(streamId, event);
} catch (Exception e) {
}
catch (Exception e) {
Logging.getLogger().logError("Exception processing event: " + streamId + ", " + event.getJson(), e);
}
}
Expand All @@ -363,7 +371,8 @@ public void connectionClosed() {
for (VmServiceListener listener : new ArrayList<>(vmListeners)) {
try {
listener.connectionClosed();
} catch (Exception e) {
}
catch (Exception e) {
Logging.getLogger().logError("Exception notifying listener", e);
}
}
Expand Down Expand Up @@ -394,8 +403,9 @@ void processMessage(String jsonText) {
// Decode the JSON
JsonObject json;
try {
json = (JsonObject) JsonParser.parseString(jsonText);
} catch (Exception e) {
json = (JsonObject)JsonParser.parseString(jsonText);
}
catch (Exception e) {
Logging.getLogger().logError("Parse message failed: " + jsonText, e);
return;
}
Expand All @@ -415,12 +425,15 @@ void processMessage(String jsonText) {
}
if (json.has("id")) {
processRequest(json);
} else {
}
else {
processNotification(json);
}
} else if (json.has("result") || json.has("error")) {
}
else if (json.has("result") || json.has("error")) {
processResponse(json);
} else {
}
else {
Logging.getLogger().logError("Malformed message");
}
}
Expand All @@ -433,7 +446,8 @@ void processRequest(JsonObject json) {
String id;
try {
id = json.get(ID).getAsString();
} catch (Exception e) {
}
catch (Exception e) {
final String message = "Request malformed " + ID;
Logging.getLogger().logError(message, e);
final JsonObject error = new JsonObject();
Expand All @@ -449,7 +463,8 @@ void processRequest(JsonObject json) {
String method;
try {
method = json.get(METHOD).getAsString();
} catch (Exception e) {
}
catch (Exception e) {
final String message = "Request malformed " + METHOD;
Logging.getLogger().logError(message, e);
final JsonObject error = new JsonObject();
Expand All @@ -463,7 +478,8 @@ void processRequest(JsonObject json) {
JsonObject params;
try {
params = json.get(PARAMS).getAsJsonObject();
} catch (Exception e) {
}
catch (Exception e) {
final String message = "Request malformed " + METHOD;
Logging.getLogger().logError(message, e);
final JsonObject error = new JsonObject();
Expand Down Expand Up @@ -504,7 +520,8 @@ public void error(int code, String message, JsonObject data) {
requestSink.add(response);
}
});
} catch (Exception e) {
}
catch (Exception e) {
final String message = "Internal Server Error";
Logging.getLogger().logError(message, e);
final JsonObject error = new JsonObject();
Expand All @@ -516,48 +533,53 @@ public void error(int code, String message, JsonObject data) {
}

private static final RemoteServiceCompleter ignoreCallback =
new RemoteServiceCompleter() {
public void result(JsonObject result) {
// ignore
}
new RemoteServiceCompleter() {
public void result(JsonObject result) {
// ignore
}

public void error(int code, String message, JsonObject data) {
// ignore
}
};
public void error(int code, String message, JsonObject data) {
// ignore
}
};

void processNotification(JsonObject json) {
String method;
try {
method = json.get(METHOD).getAsString();
} catch (Exception e) {
}
catch (Exception e) {
Logging.getLogger().logError("Request malformed " + METHOD, e);
return;
}
JsonObject params;
try {
params = json.get(PARAMS).getAsJsonObject();
} catch (Exception e) {
}
catch (Exception e) {
Logging.getLogger().logError("Event missing " + PARAMS, e);
return;
}
if ("streamNotify".equals(method)) {
String streamId;
try {
streamId = params.get(STREAM_ID).getAsString();
} catch (Exception e) {
}
catch (Exception e) {
Logging.getLogger().logError("Event missing " + STREAM_ID, e);
return;
}
Event event;
try {
event = new Event(params.get(EVENT).getAsJsonObject());
} catch (Exception e) {
}
catch (Exception e) {
Logging.getLogger().logError("Event missing " + EVENT, e);
return;
}
forwardEvent(streamId, event);
} else {
}
else {
if (!remoteServiceRunners.containsKey(method)) {
Logging.getLogger().logError("Unknown service " + method);
return;
Expand All @@ -566,7 +588,8 @@ void processNotification(JsonObject json) {
final RemoteServiceRunner runner = remoteServiceRunners.get(method);
try {
runner.run(params, ignoreCallback);
} catch (Exception e) {
}
catch (Exception e) {
Logging.getLogger().logError("Internal Server Error", e);
}
}
Expand All @@ -587,7 +610,8 @@ void processResponse(JsonObject json) {
String id;
try {
id = idElem.getAsString();
} catch (Exception e) {
}
catch (Exception e) {
Logging.getLogger().logError("Response missing " + ID, e);
return;
}
Expand All @@ -603,7 +627,8 @@ void processResponse(JsonObject json) {
JsonObject result;
try {
result = resultElem.getAsJsonObject();
} catch (Exception e) {
}
catch (Exception e) {
Logging.getLogger().logError("Response has invalid " + RESULT, e);
return;
}
Expand All @@ -626,7 +651,8 @@ else if (!(consumer instanceof ServiceExtensionConsumer)) {
JsonObject error;
try {
error = resultElem.getAsJsonObject();
} catch (Exception e) {
}
catch (Exception e) {
Logging.getLogger().logError("Response has invalid " + RESULT, e);
return;
}
Expand Down