Skip to content

[CQ] Unnecessary code cleanup #8080

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 2 commits into from
Apr 18, 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
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ public void processTerminated(@NotNull ProcessEvent event) {
};
final Module module = pubRoot.getModule(project);
if (module != null) {
//noinspection ConstantConditions
sdk.flutterBuild(pubRoot, buildType.type).startInModuleConsole(module, pubRoot::refresh, processAdapter);
}
else {
//noinspection ConstantConditions
final ColoredProcessHandler processHandler = sdk.flutterBuild(pubRoot, buildType.type).startInConsole(project);
if (processHandler == null) {
progressHelper.done();
Expand Down
2 changes: 0 additions & 2 deletions flutter-idea/src/io/flutter/devtools/DevToolsUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
import org.dartlang.vm.service.VmServiceListener;
import org.jetbrains.annotations.NotNull;

import org.dartlang.vm.service.element.Event;

import com.google.gson.JsonObject;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.vfs.LocalFileSystem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public List<EditorEx> getActiveDartEditors() {
for (FileEditor fileEditor : editors) {
if (!(fileEditor instanceof TextEditor textEditor)) continue;
final Editor editor = textEditor.getEditor();
if (editor instanceof EditorEx && !editor.isDisposed() && FlutterUtils.isDartFile(((EditorEx)editor).getVirtualFile())) {
if (editor instanceof EditorEx && !editor.isDisposed() && FlutterUtils.isDartFile(editor.getVirtualFile())) {
dartEditors.add((EditorEx)editor);
}
}
Expand Down
4 changes: 2 additions & 2 deletions flutter-idea/src/io/flutter/font/FontPreviewProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ public void addClasses(@NotNull String packageName, @NotNull String filePath, @N
classesToAnalyze.addAll(
names.stream()
.map((each) -> new ClassInfo(packageName, filePath, each))
.collect(Collectors.toList()));
.toList());
}

void addFilesToRewrite(@NotNull String packageName, @NotNull Collection<VirtualFile> files) {
Expand All @@ -588,7 +588,7 @@ void addFilesToRewrite(@NotNull String packageName, @NotNull Collection<VirtualF
return !(packageIndex < 0 || isInSdk(path));
})
.map((each) -> new FileInfo(packageName, each.getPath(), each))
.collect(Collectors.toList()));
.toList());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ public Logger logger() {
case MISSING_PLATFORM_FILES -> "JX Browser platform files are missing";
case CLASS_LOAD_FAILED -> "JX Browser class load failed";
case CLASS_NOT_FOUND -> "JX Browser class not found";
default -> null;
};

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected void resetEditorFrom(@NotNull final SdkRunConfig config) {
}

@Override
protected void applyEditorTo(@NotNull final SdkRunConfig config) throws ConfigurationException {
protected void applyEditorTo(@NotNull final SdkRunConfig config) {
final SdkFields fields = new SdkFields();
fields.setFilePath(StringUtil.nullize(FileUtil.toSystemIndependentName(myFileField.getText().trim()), true));
fields.setBuildFlavor(StringUtil.nullize(myBuildFlavorField.getText().trim()));
Expand Down
2 changes: 1 addition & 1 deletion flutter-idea/src/io/flutter/run/FlutterReloadManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ private void handleSaveAllNotification(@Nullable Editor editor) {
if (file == null) {
return;
}
if (file.getPath().startsWith(configPath.toString())) {
if (file.getPath().startsWith(configPath)) {
return; // Ignore changes to scratch files.
}
if (System.currentTimeMillis() - file.getTimeStamp() > 500) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected void resetEditorFrom(@NotNull final BazelRunConfig configuration) {
}

@Override
protected void applyEditorTo(@NotNull final BazelRunConfig configuration) throws ConfigurationException {
protected void applyEditorTo(@NotNull final BazelRunConfig configuration) {
String target = myTarget.getText().trim();
final BazelFields fields = new BazelFields(
StringUtil.nullize(target.endsWith("dart") ? FileUtil.toSystemIndependentName(target) : target, true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public RunnerSettings createConfigurationData(@NotNull final ConfigurationInfoPr
@Override
@Nullable
protected RunContentDescriptor doExecute(final @NotNull RunProfileState state,
final @NotNull ExecutionEnvironment env) throws ExecutionException {
final @NotNull ExecutionEnvironment env) {
final RunContentDescriptor result = DefaultProgramRunnerKt.executeState(state, env, this);
if (result == null) {
return null;
Expand Down
4 changes: 1 addition & 3 deletions flutter-idea/src/io/flutter/run/test/TestForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SettingsEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.TextComponentAccessor;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.ui.ListCellRendererWrapper;
import io.flutter.run.test.TestFields.Scope;
Expand Down Expand Up @@ -96,12 +95,11 @@ protected void resetEditorFrom(@NotNull TestConfig config) {
}

@Override
protected void applyEditorTo(@NotNull TestConfig config) throws ConfigurationException {
protected void applyEditorTo(@NotNull TestConfig config) {
final TestFields fields = switch (getScope()) {
case NAME -> TestFields.forTestName(testName.getText(), testFile.getText());
case FILE -> TestFields.forFile(testFile.getText());
case DIRECTORY -> TestFields.forDir(testDir.getText());
default -> throw new ConfigurationException("unexpected scope: " + scope.getSelectedItem());
};
fields.setAdditionalArgs(additionalArgs.getText().trim());
config.setFields(fields);
Expand Down
2 changes: 1 addition & 1 deletion flutter-idea/src/io/flutter/view/EmbeddedJcefBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class EmbeddedJcefBrowserTab implements EmbeddedTab {
private JBCefBrowser browser;

public EmbeddedJcefBrowserTab() throws Exception {
public EmbeddedJcefBrowserTab() {
this.browser = new JBCefBrowser();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static String curly(String... pairs) {
for (String pair : pairs) {
final int colon = pair.indexOf(":");
if (!first) out.append(",");
out.append('"').append(pair.substring(0, colon)).append("\":").append(pair.substring(colon + 1));
out.append('"').append(pair, 0, colon).append("\":").append(pair.substring(colon + 1));
first = false;
}
out.append('}');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class AndroidModuleLibraryType extends LibraryType<AndroidModuleLibraryPr
public static final String LIBRARY_NAME = "Android Libraries";

public static final PersistentLibraryKind<AndroidModuleLibraryProperties> LIBRARY_KIND =
new PersistentLibraryKind<AndroidModuleLibraryProperties>("AndroidModuleLibraryType") {
new PersistentLibraryKind<>("AndroidModuleLibraryType") {
@Override
@NotNull
public AndroidModuleLibraryProperties createDefaultProperties() {
Expand Down