Skip to content
Closed
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
8 changes: 4 additions & 4 deletions src/io/flutter/sdk/AndroidEmulatorManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import io.flutter.logging.PluginLogger;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import com.intellij.util.SmartList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
Expand All @@ -37,23 +37,23 @@ public static AndroidEmulatorManager getInstance(@NotNull Project project) {
private final @NotNull Project project;
private final AtomicReference<ImmutableSet<Runnable>> listeners = new AtomicReference<>(ImmutableSet.of());

private @NotNull List<AndroidEmulator> cachedEmulators = new ArrayList<>();
private @NotNull List<AndroidEmulator> cachedEmulators = new SmartList<>();

private AndroidEmulatorManager(@NotNull Project project) {
this.project = project;
}

public void addListener(@NotNull Runnable callback) {
listeners.updateAndGet((old) -> {
final List<Runnable> changed = new ArrayList<>(old);
final List<Runnable> changed = new SmartList<>(old);
changed.add(callback);
return ImmutableSet.copyOf(changed);
});
}

public void removeListener(@NotNull Runnable callback) {
listeners.updateAndGet((old) -> {
final List<Runnable> changed = new ArrayList<>(old);
final List<Runnable> changed = new SmartList<>(old);
changed.remove(callback);
return ImmutableSet.copyOf(changed);
});
Expand Down
7 changes: 4 additions & 3 deletions src/io/flutter/sdk/FlutterCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.SmartList;
import io.flutter.FlutterBundle;
import io.flutter.FlutterMessages;
import io.flutter.android.IntelliJAndroidSdk;
Expand Down Expand Up @@ -65,7 +66,7 @@ public class FlutterCommand {
* Returns a displayable version of the command that will be run.
*/
public @NotNull String getDisplayCommand() {
final List<String> words = new ArrayList<>();
final List<String> words = new SmartList<>();
words.add("flutter");
words.addAll(type.subCommand);
words.addAll(args);
Expand All @@ -80,11 +81,11 @@ public String getSanitizedDisplayCommand() {
return getDisplayCommand();
}

final List<String> words = new ArrayList<>();
final List<String> words = new SmartList<>();
words.add("flutter");
words.addAll(type.subCommand);

final List<String> newArgs = new ArrayList<>(args);
final List<String> newArgs = new SmartList<>(args);
// For run, attach, and test commands, the last argument is typically a file path.
// We redact it to avoid logging user-specific information.
if (!newArgs.isEmpty() && (type == Type.RUN || type == Type.ATTACH || type == Type.TEST)) {
Expand Down
4 changes: 2 additions & 2 deletions src/io/flutter/sdk/FlutterCreateAdditionalSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.intellij.openapi.util.text.StringUtil;
import io.flutter.module.FlutterProjectType;
import io.flutter.module.settings.InitializeOnceBoolValueProperty;
import java.util.ArrayList;
import com.intellij.util.SmartList;
import java.util.List;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -100,7 +100,7 @@ public void setKotlin(boolean value) {
@NotNull
@NonNls
public List<String> getArgs() {
final List<String> args = new ArrayList<>();
final List<String> args = new SmartList<>();

if (Boolean.TRUE.equals(offlineMode)) {
args.add("--offline");
Expand Down
11 changes: 6 additions & 5 deletions src/io/flutter/sdk/FlutterSdk.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.util.SmartList;
import com.intellij.util.ui.EDT;
import com.jetbrains.lang.dart.sdk.DartSdk;
import git4idea.config.GitExecutableManager;
Expand Down Expand Up @@ -217,7 +218,7 @@ public FlutterCommand flutterDoctor() {
@NonNls
@NotNull
public FlutterCommand flutterCreate(@NotNull VirtualFile appDir, @Nullable FlutterCreateAdditionalSettings additionalSettings) {
final List<String> args = new ArrayList<>();
final List<String> args = new SmartList<>();
if (additionalSettings != null) {
args.addAll(additionalSettings.getArgs());
if (FlutterProjectType.PLUGIN.equals(additionalSettings.getType())) {
Expand Down Expand Up @@ -292,7 +293,7 @@ public FlutterCommand flutterRun(@NotNull PubRoot root,
@NotNull FlutterLaunchMode flutterLaunchMode,
@NotNull Project project,
String... additionalArgs) {
final List<String> args = new ArrayList<>();
final List<String> args = new SmartList<>();
args.add("--machine");
FlutterSettings settings = FlutterSettings.getInstance();
if (settings.isVerboseLogging()) {
Expand Down Expand Up @@ -336,7 +337,7 @@ else if (flutterLaunchMode == FlutterLaunchMode.RELEASE) {
@NotNull
public FlutterCommand flutterAttach(@NotNull PubRoot root, @NotNull VirtualFile main, @Nullable FlutterDevice device,
@NotNull FlutterLaunchMode flutterLaunchMode, String... additionalArgs) {
final List<String> args = new ArrayList<>();
final List<String> args = new SmartList<>();
args.add("--machine");
if (FlutterSettings.getInstance().isVerboseLogging()) {
args.add("--verbose");
Expand Down Expand Up @@ -371,7 +372,7 @@ else if (flutterLaunchMode == FlutterLaunchMode.RELEASE) {
public FlutterCommand flutterTest(@NotNull PubRoot root, @NotNull VirtualFile fileOrDir, @Nullable String testNameSubstring,
@NotNull RunMode mode, @Nullable String additionalArgs, TestFields.Scope scope, boolean useRegexp) {

final List<String> args = new ArrayList<>();
final List<String> args = new SmartList<>();
args.add("--machine");

// Starting the app paused so the IDE can catch early errors is ideal. However, we don't have a way to resume for multiple test files
Expand Down Expand Up @@ -417,7 +418,7 @@ public FlutterCommand flutterTest(@NotNull PubRoot root, @NotNull VirtualFile fi

@NotNull
public FlutterCommand widgetPreview(@NotNull PubRoot root, boolean isVerboseMode, @Nullable String dtdUri, @Nullable String devToolsUri) {
final List<String> args = new ArrayList<>();
final List<String> args = new SmartList<>();
args.add("start");
args.add("--web-server");
args.add("--machine");
Expand Down
4 changes: 2 additions & 2 deletions src/io/flutter/sdk/XcodeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import io.flutter.utils.SystemUtils;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import com.intellij.util.SmartList;
import java.util.Arrays;
import java.util.List;

Expand All @@ -38,7 +38,7 @@ public static boolean isSimulatorRunning() {
* {@link FlutterMessages#showError(String, String, Project)}.
*/
public static void openSimulator(@Nullable Project project, String... additionalArgs) {
final List<String> params = new ArrayList<>(Arrays.asList(additionalArgs));
final List<String> params = new SmartList<>(Arrays.asList(additionalArgs));
params.add("-a");
params.add("Simulator.app");

Expand Down
Loading