Skip to content

Commit 31bb8f6

Browse files
authored
Code cleanup, redundant if statements Java inspection (#7686)
1 parent a7659bc commit 31bb8f6

File tree

6 files changed

+7
-24
lines changed

6 files changed

+7
-24
lines changed

flutter-idea/src/io/flutter/FlutterUtils.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,7 @@ private static boolean isInTestOrSourceRoot(@Nullable Module module, @NotNull Da
252252
}
253253
if (foundSourceRoot) {
254254
// The file is in a sources root but not marked as tests.
255-
if (file.getName().endsWith(("_test.dart")) && FlutterSettings.getInstance().isAllowTestsInSourcesRoot()) {
256-
return true;
257-
}
255+
return file.getName().endsWith(("_test.dart")) && FlutterSettings.getInstance().isAllowTestsInSourcesRoot();
258256
}
259257
return false;
260258
}

flutter-idea/src/io/flutter/editor/WidgetIndentsHighlightingPass.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,7 @@ public void paint(@NotNull Editor editor, @NotNull RangeHighlighter highlighter,
248248
final Point end = editor.visualPositionToXY(endPosition);
249249
double splitY = -1;
250250
int maxY = end.y;
251-
boolean includeLastLine = false;
252-
if (endPosition.line == editor.offsetToVisualPosition(doc.getTextLength()).line) {
253-
includeLastLine = true;
254-
}
251+
boolean includeLastLine = endPosition.line == editor.offsetToVisualPosition(doc.getTextLength()).line;
255252

256253
int endLine = doc.getLineNumber(endOffset);
257254
if (childLines != null && !childLines.isEmpty()) {

flutter-idea/src/io/flutter/run/test/FlutterTestEventsConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected boolean process(@NotNull JsonArray array) {
6464
final JsonElement params = getValue(element, "params");
6565
if (params != null) {
6666
final JsonElement uri = getValue(params, "observatoryUri");
67-
if (uri != null) return true;
67+
return uri != null;
6868
}
6969
}
7070
}

flutter-idea/src/io/flutter/sdk/FlutterSettingsConfigurable.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,7 @@ public boolean isModified() {
267267
return true;
268268
}
269269

270-
if (settings.isEnableJcefBrowser() != myEnableJcefBrowserCheckBox.isSelected()) {
271-
return true;
272-
}
273-
274-
return false;
270+
return settings.isEnableJcefBrowser() != myEnableJcefBrowserCheckBox.isSelected();
275271
}
276272

277273
@Override

flutter-idea/src/io/flutter/vmService/VMServiceManager.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -587,12 +587,7 @@ public void onError(RPCError error) {
587587

588588
@Override
589589
public void received(JsonObject object) {
590-
if (object == null) {
591-
ret.complete(null);
592-
}
593-
else {
594-
ret.complete(object);
595-
}
590+
ret.complete(object);
596591
}
597592
}
598593
);

flutter-idea/src/org/dartlang/analysis/server/protocol/ExtractWidgetFeedback.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,8 @@ public ExtractWidgetFeedback() {
3636

3737
@Override
3838
public boolean equals(Object obj) {
39-
if (obj instanceof ExtractWidgetFeedback other) {
40-
return
41-
true;
42-
}
43-
return false;
39+
return
40+
obj instanceof ExtractWidgetFeedback other;
4441
}
4542

4643
public static ExtractWidgetFeedback fromJson(JsonObject jsonObject) {

0 commit comments

Comments
 (0)