diff --git a/flutter-idea/src/io/flutter/editor/FlutterIconLineMarkerProvider.java b/flutter-idea/src/io/flutter/editor/FlutterIconLineMarkerProvider.java index e525b34f54..43c4d4312c 100644 --- a/flutter-idea/src/io/flutter/editor/FlutterIconLineMarkerProvider.java +++ b/flutter-idea/src/io/flutter/editor/FlutterIconLineMarkerProvider.java @@ -28,7 +28,6 @@ import com.jetbrains.lang.dart.psi.impl.DartCallExpressionImpl; import com.jetbrains.lang.dart.util.DartPsiImplUtil; import com.jetbrains.lang.dart.util.DartResolveUtil; -import gnu.trove.THashSet; import info.debatty.java.stringsimilarity.JaroWinkler; import io.flutter.FlutterBundle; import io.flutter.sdk.FlutterSdk; @@ -62,9 +61,9 @@ public class FlutterIconLineMarkerProvider extends LineMarkerProviderDescriptor public static void initialize() { KnownPaths.clear(); - KnownPaths.put("Icons", new THashSet<>(Collections.singleton("packages/flutter/lib/src/material"))); - KnownPaths.put("IconData", new THashSet<>(Collections.singleton("packages/flutter/lib/src/widgets"))); - KnownPaths.put("CupertinoIcons", new THashSet<>(Collections.singleton("packages/flutter/lib/src/cupertino"))); + KnownPaths.put("Icons", new HashSet<>(Collections.singleton("packages/flutter/lib/src/material"))); + KnownPaths.put("IconData", new HashSet<>(Collections.singleton("packages/flutter/lib/src/widgets"))); + KnownPaths.put("CupertinoIcons", new HashSet<>(Collections.singleton("packages/flutter/lib/src/cupertino"))); BuiltInPaths.clear(); BuiltInPaths.put("Icons", MaterialRelativeIconsPath); BuiltInPaths.put("IconData", MaterialRelativeIconsPath); diff --git a/flutter-idea/src/io/flutter/font/FontPreviewProcessor.java b/flutter-idea/src/io/flutter/font/FontPreviewProcessor.java index ded56ed9cb..4e65929421 100644 --- a/flutter-idea/src/io/flutter/font/FontPreviewProcessor.java +++ b/flutter-idea/src/io/flutter/font/FontPreviewProcessor.java @@ -30,8 +30,6 @@ import com.jetbrains.lang.dart.resolve.ClassNameScopeProcessor; import com.jetbrains.lang.dart.resolve.DartPsiScopeProcessor; import com.jetbrains.lang.dart.util.DartResolveUtil; -import gnu.trove.THashMap; -import gnu.trove.THashSet; import io.flutter.FlutterBundle; import io.flutter.editor.FlutterIconLineMarkerProvider; import io.flutter.settings.FlutterSettings; @@ -55,13 +53,13 @@ public class FontPreviewProcessor { public static final String PACKAGE_SEPARATORS = "[,\r\n]"; - public static final Map UNSUPPORTED_PACKAGES = new THashMap<>(); + public static final Map UNSUPPORTED_PACKAGES = new HashMap<>(); // If there are triple quotes around a package URL they won't be recognized. private static final Pattern EXPORT_STATEMENT_PATTERN = Pattern.compile("^\\s*export\\s+[\"']([-_. $A-Za-z0-9/]+\\.dart)[\"'].*"); private static final Pattern IMPORT_STATEMENT_PATTERN = Pattern.compile("^\\s*import\\s+[\"']([-_. $A-Za-z0-9/]+\\.dart)[\"'].*"); - private static final Map> ANALYZED_PROJECT_FILES = new THashMap<>(); - private static final Map WORK_ITEMS = new THashMap<>(); + private static final Map> ANALYZED_PROJECT_FILES = new HashMap<>(); + private static final Map WORK_ITEMS = new HashMap<>(); private static Logger LOG = Logger.getInstance(FontPreviewProcessor.class); static { @@ -86,7 +84,7 @@ public void generate(@NotNull Project project) { } LOG = FlutterSettings.getInstance().isVerboseLogging() ? Logger.getInstance(FontPreviewProcessor.class) : null; log("Analyzing project ", project.getName()); - ANALYZED_PROJECT_FILES.put(project.getBasePath(), new THashSet<>()); + ANALYZED_PROJECT_FILES.put(project.getBasePath(), new HashSet<>()); ProjectManager.getInstance().addProjectManagerListener(project, new ProjectManagerListener() { @Override public void projectClosed(@NotNull Project project) { @@ -257,12 +255,12 @@ private void analyzeNextFile(@NotNull Project project, @NotNull WorkItem item) { log("Cannot get PSI file for ", file.getName()); return; } - final Set classNames = new THashSet<>(); + final Set classNames = new HashSet<>(); final DartPsiScopeProcessor processor = new ClassNameScopeProcessor(classNames); final boolean success = DumbService.getInstance(project).runReadActionInSmartMode(() -> { final boolean result = DartResolveUtil.processTopLevelDeclarations(psiFile, processor, file, null); if (result) { - final Set keep = new THashSet<>(); + final Set keep = new HashSet<>(); for (DartComponentName name : classNames) { if (file.equals(name.getContainingFile().getVirtualFile())) { keep.add(name); @@ -299,7 +297,7 @@ private void analyzeNextClass(@NotNull Project project, @NotNull WorkItem item) log("Adding ", name, " -> ", path); final Set knownPaths = KnownPaths.get(name); if (knownPaths == null) { - KnownPaths.put(name, new THashSet<>(Collections.singleton(path))); + KnownPaths.put(name, new HashSet<>(Collections.singleton(path))); } else { knownPaths.add(path); @@ -460,7 +458,7 @@ static class WorkItem { final Queue filesToRewrite = new LinkedList<>(); final Queue classesToAnalyze = new LinkedList<>(); final Queue filesToCheck = new LinkedList<>(); - final Map filesWithNoClasses = new THashMap<>(); + final Map filesWithNoClasses = new HashMap<>(); final String projectPath; boolean isCancelled = false; diff --git a/flutter-idea/src/io/flutter/inspections/FlutterDependencyInspection.java b/flutter-idea/src/io/flutter/inspections/FlutterDependencyInspection.java index 96f82db737..956f9d5f23 100644 --- a/flutter-idea/src/io/flutter/inspections/FlutterDependencyInspection.java +++ b/flutter-idea/src/io/flutter/inspections/FlutterDependencyInspection.java @@ -15,7 +15,6 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiFile; import com.jetbrains.lang.dart.psi.DartFile; -import gnu.trove.THashSet; import io.flutter.FlutterBundle; import io.flutter.FlutterUtils; import io.flutter.bazel.WorkspaceCache; @@ -27,10 +26,11 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.HashSet; import java.util.Set; public class FlutterDependencyInspection extends LocalInspectionTool { - private final Set myIgnoredPubspecPaths = new THashSet<>(); // remember for the current session only, do not serialize + private final Set myIgnoredPubspecPaths = new HashSet<>(); // remember for the current session only, do not serialize @Nullable @Override diff --git a/flutter-idea/src/io/flutter/perf/FlutterWidgetPerf.java b/flutter-idea/src/io/flutter/perf/FlutterWidgetPerf.java index c819d44e3a..556bbe9e64 100644 --- a/flutter-idea/src/io/flutter/perf/FlutterWidgetPerf.java +++ b/flutter-idea/src/io/flutter/perf/FlutterWidgetPerf.java @@ -5,6 +5,7 @@ */ package io.flutter.perf; +import com.android.tools.idea.io.netty.util.collection.IntObjectHashMap; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.HashMultimap; import com.google.common.collect.LinkedListMultimap; @@ -23,7 +24,6 @@ import com.intellij.openapi.util.TextRange; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.ui.EdtInvocationManager; -import gnu.trove.TIntObjectHashMap; import io.flutter.utils.AsyncUtils; import org.jetbrains.annotations.NotNull; @@ -52,7 +52,7 @@ public class FlutterWidgetPerf implements Disposable, WidgetPerfListener { public static final long IDLE_DELAY_MILISECONDS = 400; static class StatsForReportKind { - final TIntObjectHashMap data = new TIntObjectHashMap<>(); + final IntObjectHashMap data = new IntObjectHashMap<>(); private int lastStartTime = -1; private int lastNonEmptyReportTime = -1; } @@ -73,7 +73,7 @@ static class StatsForReportKind { * Note: any access of editorDecorations contents must happen on the UI thread. */ private final Map editorDecorations = new HashMap<>(); - private final TIntObjectHashMap knownLocationIds = new TIntObjectHashMap<>(); + private final IntObjectHashMap knownLocationIds = new IntObjectHashMap<>(); private final SetMultimap locationsPerFile = HashMultimap.create(); private final Map stats = new HashMap<>(); @@ -172,9 +172,10 @@ public void onWidgetPerfEvent(PerfReportKind kind, JsonObject json) { if (statsForReportKind.lastStartTime > startTimeMilis) { // We went backwards in time. There must have been a hot restart so // clear all old stats. - statsForReportKind.data.forEachValue((SlidingWindowStats entry) -> { - entry.clear(); - return true; + statsForReportKind.data.forEach((key,entry) -> { + if(entry != null) { + entry.clear(); + } }); } statsForReportKind.lastStartTime = startTimeMilis; @@ -296,9 +297,10 @@ else if (json.has("newLocations")) { public void onNavigation() { synchronized (this) { for (StatsForReportKind statsForKind : stats.values()) { - statsForKind.data.forEachValue((SlidingWindowStats entry) -> { - entry.onNavigation(); - return true; + statsForKind.data.forEach((key, entry) -> { + if (entry != null) { + entry.onNavigation(); + } }); } } @@ -417,7 +419,7 @@ private FilePerfInfo buildSummaryStats(TextEditor fileEditor) { if (forKind == null) { continue; } - final TIntObjectHashMap data = forKind.data; + final IntObjectHashMap data = forKind.data; for (Location location : locationsPerFile.get(path)) { final SlidingWindowStats entry = data.get(location.id); if (entry == null) { @@ -579,7 +581,7 @@ public ArrayList getStatsForMetric(ArrayList { + forKind.data.forEach((locationId, stats) -> { for (PerfMetric metric : metrics) { if (stats.getValue(metric, time) > 0) { final Location location = knownLocationIds.get(locationId); @@ -599,10 +601,8 @@ public ArrayList getStatsForMetric(ArrayList entries) { } final boolean previouslyEmpty = root.getChildCount() == 0; int childIndex = 0; - final TIntArrayList indicesChanged = new TIntArrayList(); - final TIntArrayList indicesInserted = new TIntArrayList(); + final ArrayList indicesChanged = new ArrayList(); + final ArrayList indicesInserted = new ArrayList(); for (SlidingWindowStatsSummary entry : entries) { if (entry.getLocation().equals(lastSelectedLocation)) { selectionIndex = childIndex; @@ -308,8 +307,8 @@ public void showStats(ArrayList entries) { childIndex++; } final int endChildIndex = childIndex; - final ArrayList nodesRemoved = new ArrayList<>(); - final TIntArrayList indicesRemoved = new TIntArrayList(); + final ArrayList nodesRemoved = new ArrayList(); + final ArrayList indicesRemoved = new ArrayList(); // Gather nodes to remove. for (int j = endChildIndex; j < root.getChildCount(); j++) { nodesRemoved.add(root.getChildAt(j)); @@ -322,6 +321,7 @@ public void showStats(ArrayList entries) { root.remove(lastChild); } + assert(model != null); if (previouslyEmpty) { // TODO(jacobr): I'm not clear why this event is needed in this case. model.nodeStructureChanged(root); @@ -329,13 +329,13 @@ public void showStats(ArrayList entries) { else { // Report events for all the changes made to the table. if (!indicesChanged.isEmpty()) { - model.nodesChanged(root, indicesChanged.toNativeArray()); + model.nodesChanged(root, indicesChanged.stream().mapToInt(i -> i).toArray());//.intStream().toArray()); } if (!indicesInserted.isEmpty()) { - model.nodesWereInserted(root, indicesInserted.toNativeArray()); + model.nodesWereInserted(root, indicesInserted.stream().mapToInt(i -> i).toArray()); } if (!indicesRemoved.isEmpty()) { - model.nodesWereRemoved(root, indicesRemoved.toNativeArray(), nodesRemoved.toArray()); + model.nodesWereRemoved(root, indicesRemoved.stream().mapToInt(i -> i).toArray(), nodesRemoved.toArray()); } } diff --git a/flutter-idea/src/io/flutter/run/FlutterPositionMapper.java b/flutter-idea/src/io/flutter/run/FlutterPositionMapper.java index 4c01bd8ceb..29da83a60e 100644 --- a/flutter-idea/src/io/flutter/run/FlutterPositionMapper.java +++ b/flutter-idea/src/io/flutter/run/FlutterPositionMapper.java @@ -22,7 +22,6 @@ import com.jetbrains.lang.dart.analyzer.DartAnalysisServerService; import com.jetbrains.lang.dart.util.DartResolveUtil; import com.jetbrains.lang.dart.util.DartUrlResolver; -import gnu.trove.THashMap; import io.flutter.FlutterInitializer; import io.flutter.FlutterUtils; import io.flutter.analytics.Analytics; @@ -36,10 +35,7 @@ import org.jetbrains.annotations.Nullable; import java.io.File; -import java.util.Collection; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; @@ -104,7 +100,7 @@ public class FlutterPositionMapper implements DartVmServiceDebugProcess.Position /** * A cache containing each file version downloaded from Observatory. The key is an isolate id. */ - private final Map fileCache = new THashMap<>(); + private final Map fileCache = new HashMap<>(); public FlutterPositionMapper(@NotNull Project project, @NotNull VirtualFile sourceRoot, diff --git a/flutter-idea/src/io/flutter/run/ObservatoryFile.java b/flutter-idea/src/io/flutter/run/ObservatoryFile.java index a3be79d555..4eddc902e3 100644 --- a/flutter-idea/src/io/flutter/run/ObservatoryFile.java +++ b/flutter-idea/src/io/flutter/run/ObservatoryFile.java @@ -5,19 +5,19 @@ */ package io.flutter.run; +import com.android.tools.idea.io.netty.util.collection.IntObjectHashMap; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.testFramework.LightVirtualFile; import com.intellij.util.PathUtil; import com.intellij.xdebugger.XDebuggerUtil; import com.intellij.xdebugger.XSourcePosition; import com.jetbrains.lang.dart.DartFileType; -import gnu.trove.THashMap; -import gnu.trove.TIntObjectHashMap; import io.flutter.vmService.DartVmServiceDebugProcess; import org.dartlang.vm.service.element.Script; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -36,7 +36,7 @@ class ObservatoryFile { * Maps an observatory token id to its line and column. */ @Nullable - private final TIntObjectHashMap positionMap; + private final IntObjectHashMap positionMap; /** * User-visible source code downloaded from Observatory. @@ -92,8 +92,8 @@ XSourcePosition createPosition(@Nullable VirtualFile local, int tokenPos) { *

See docs. */ @NotNull - private static TIntObjectHashMap createPositionMap(@NotNull final List> table) { - final TIntObjectHashMap result = new TIntObjectHashMap<>(); + private static IntObjectHashMap createPositionMap(@NotNull final List> table) { + final IntObjectHashMap result = new IntObjectHashMap<>(); for (List line : table) { // Each line consists of a line number followed by (tokenId, columnNumber) pairs. @@ -140,7 +140,7 @@ static class Cache { * A cache containing each file downloaded from Observatory. The key is a script id. * Each version of a file is stored as a separate entry. */ - private final Map versions = new THashMap<>(); + private final Map versions = new HashMap<>(); Cache(@NotNull String isolateId, @NotNull DartVmServiceDebugProcess.ScriptProvider provider) { this.isolateId = isolateId; diff --git a/flutter-idea/src/io/flutter/test/DartTestEventsConverterZ.java b/flutter-idea/src/io/flutter/test/DartTestEventsConverterZ.java index 49cdd3f34f..f2f1be490d 100644 --- a/flutter-idea/src/io/flutter/test/DartTestEventsConverterZ.java +++ b/flutter-idea/src/io/flutter/test/DartTestEventsConverterZ.java @@ -11,7 +11,6 @@ import com.intellij.util.PathUtil; import com.jetbrains.lang.dart.ide.runner.util.DartTestLocationProvider; import com.jetbrains.lang.dart.util.DartUrlResolver; -import gnu.trove.TIntLongHashMap; import io.flutter.utils.JsonUtils; import jetbrains.buildServer.messages.serviceMessages.ServiceMessageVisitor; import org.jetbrains.annotations.NotNull; @@ -94,7 +93,7 @@ public class DartTestEventsConverterZ extends OutputToGeneralTestEventsConverter private String myLocation; private Key myCurrentOutputType; private ServiceMessageVisitor myCurrentVisitor; - private final TIntLongHashMap myTestIdToTimestamp; + private final HashMap myTestIdToTimestamp; private final Map myTestData; private final Map myGroupData; private final Map mySuiteData; @@ -105,7 +104,7 @@ public DartTestEventsConverterZ(@NotNull final String testFrameworkName, @NotNull final DartUrlResolver urlResolver) { super(testFrameworkName, consoleProperties); myUrlResolver = urlResolver; - myTestIdToTimestamp = new TIntLongHashMap(); + myTestIdToTimestamp = new HashMap(); myTestData = new HashMap<>(); myGroupData = new HashMap<>(); mySuiteData = new HashMap<>(); @@ -268,7 +267,7 @@ private boolean handleTestDone(JsonObject obj) throws ParseException { //if (test.getMetadata().skip) return true; // skipped tests are reported as ignored in handleTestStart(). testFinished signal must follow ServiceMessageBuilder testFinished = ServiceMessageBuilder.testFinished(test.getBaseName()); - long duration = getTimestamp(obj) - myTestIdToTimestamp.get(test.getId()); + long duration = getTimestamp(obj) - (Long)myTestIdToTimestamp.get(test.getId()); testFinished.addAttribute("duration", Long.toString(duration)); return finishMessage(testFinished, test.getId(), test.getValidParentId()) && checkGroupDone(test.getParent()); diff --git a/flutter-idea/src/io/flutter/view/MultiIconSimpleColoredComponent.java b/flutter-idea/src/io/flutter/view/MultiIconSimpleColoredComponent.java index d95670825b..2f18b6f8ed 100644 --- a/flutter-idea/src/io/flutter/view/MultiIconSimpleColoredComponent.java +++ b/flutter-idea/src/io/flutter/view/MultiIconSimpleColoredComponent.java @@ -33,7 +33,6 @@ import com.intellij.util.ui.JBInsets; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.UIUtil; -import gnu.trove.TIntIntHashMap; import org.intellij.lang.annotations.JdkConstants; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -51,9 +50,7 @@ import java.text.AttributedCharacterIterator; import java.text.AttributedString; import java.text.CharacterIterator; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; +import java.util.*; import java.util.List; /** @@ -88,7 +85,7 @@ public PositionedIcon(Icon icon, int index) { private final List myAttributes; private List myFragmentTags = null; - private TIntIntHashMap myFragmentAlignment; + private HashMap myFragmentAlignment; /** * Internal padding @@ -117,7 +114,7 @@ public PositionedIcon(Icon icon, int index) { private int myMainTextLastIndex = -1; - private final TIntIntHashMap myFragmentPadding; + private final HashMap myFragmentPadding; @JdkConstants.HorizontalAlignment private int myTextAlign = SwingConstants.LEFT; @@ -135,8 +132,8 @@ public MultiIconSimpleColoredComponent() { myIpad = new JBInsets(1, 2, 1, 2); myIconTextGap = JBUI.scale(2); myBorder = new MyBorder(); - myFragmentPadding = new TIntIntHashMap(10); - myFragmentAlignment = new TIntIntHashMap(10); + myFragmentPadding = new HashMap(10); + myFragmentAlignment = new HashMap(10); setOpaque(true); updateUI(); } @@ -490,7 +487,7 @@ private float computeTextWidth(@NotNull Font font, final boolean mainTextOnly) { result += computeStringWidth(i, font); - final int fixedWidth = myFragmentPadding.get(i); + final int fixedWidth = (int)myFragmentPadding.get(i); if (fixedWidth > 0 && result < fixedWidth) { result = fixedWidth; } @@ -632,7 +629,7 @@ public int findFragmentAt(int x) { return i; } curX += curWidth; - final int fragmentPadding = myFragmentPadding.get(i); + final int fragmentPadding = (int)myFragmentPadding.get(i); if (fragmentPadding > 0 && curX < fragmentPadding) { curX = fragmentPadding; } @@ -834,7 +831,7 @@ protected int doPaintTextAndIcons(Graphics2D g, boolean focusAroundIcon) { final float fragmentWidth = computeStringWidth(i, font); - final int fragmentPadding = myFragmentPadding.get(i); + final int fragmentPadding = (int)myFragmentPadding.get(i); final Color bgColor = attributes.isSearchMatch() ? null : attributes.getBgColor(); if ((attributes.isOpaque() || isOpaque()) && bgColor != null) { @@ -851,7 +848,7 @@ protected int doPaintTextAndIcons(Graphics2D g, boolean focusAroundIcon) { } g.setColor(color); - final int fragmentAlignment = myFragmentAlignment.get(i); + final int fragmentAlignment = (int)myFragmentAlignment.get(i); final float endOffset; if (fragmentPadding > 0 && diff --git a/flutter-idea/src/io/flutter/vmService/DartVmServiceBreakpointHandler.java b/flutter-idea/src/io/flutter/vmService/DartVmServiceBreakpointHandler.java index ddbba39932..286ec7d7ef 100644 --- a/flutter-idea/src/io/flutter/vmService/DartVmServiceBreakpointHandler.java +++ b/flutter-idea/src/io/flutter/vmService/DartVmServiceBreakpointHandler.java @@ -17,8 +17,6 @@ import com.intellij.xdebugger.breakpoints.XBreakpointProperties; import com.intellij.xdebugger.breakpoints.XLineBreakpoint; import com.jetbrains.lang.dart.ide.runner.DartLineBreakpointType; -import gnu.trove.THashMap; -import gnu.trove.THashSet; import org.dartlang.vm.service.element.Breakpoint; import org.jetbrains.annotations.NotNull; @@ -29,9 +27,9 @@ public class DartVmServiceBreakpointHandler extends XBreakpointHandler> { private final DartVmServiceDebugProcess myDebugProcess; - private final Set> myXBreakpoints = new THashSet<>(); - private final Map myIsolateInfo = new THashMap<>(); - private final Map> myVmBreakpointIdToXBreakpointMap = new THashMap<>(); + private final Set> myXBreakpoints = new HashSet<>(); + private final Map myIsolateInfo = new HashMap<>(); + private final Map> myVmBreakpointIdToXBreakpointMap = new HashMap<>(); public DartVmServiceBreakpointHandler(@NotNull final DartVmServiceDebugProcess debugProcess) { super(DartLineBreakpointType.class); @@ -121,7 +119,7 @@ class IsolateBreakpointInfo { private final String myIsolateId; private final DartVmServiceDebugProcess myDebugProcess; private final List myTemporaryVmBreakpointIds = new ArrayList<>(); - private final Map, Set> myXBreakpointToVmBreakpointIdsMap = new THashMap<>(); + private final Map, Set> myXBreakpointToVmBreakpointIdsMap = new HashMap<>(); IsolateBreakpointInfo(@NotNull String isolateId, @NotNull DartVmServiceDebugProcess debugProcess) { this.myIsolateId = isolateId; diff --git a/flutter-idea/src/io/flutter/vmService/DartVmServiceDebugProcess.java b/flutter-idea/src/io/flutter/vmService/DartVmServiceDebugProcess.java index a3ef45cfa5..04b4841611 100644 --- a/flutter-idea/src/io/flutter/vmService/DartVmServiceDebugProcess.java +++ b/flutter-idea/src/io/flutter/vmService/DartVmServiceDebugProcess.java @@ -33,8 +33,6 @@ import com.jetbrains.lang.dart.ide.runner.actions.DartPopFrameAction; import com.jetbrains.lang.dart.ide.runner.base.DartDebuggerEditorsProvider; import com.jetbrains.lang.dart.util.DartUrlResolver; -import gnu.trove.THashMap; -import gnu.trove.TIntObjectHashMap; import io.flutter.FlutterBundle; import io.flutter.FlutterInitializer; import io.flutter.FlutterUtils; @@ -70,8 +68,7 @@ public abstract class DartVmServiceDebugProcess extends XDebugProcess { @NotNull private final XBreakpointHandler[] myBreakpointHandlers; private final IsolatesInfo myIsolatesInfo; @NotNull private final Map> mySuspendedIsolateIds = Collections.synchronizedMap(new HashMap<>()); - private final Map myScriptIdToContentMap = new THashMap<>(); - private final Map>> myScriptIdToLinesAndColumnsMap = new THashMap<>(); + private final Map myScriptIdToContentMap = new HashMap<>(); @Nullable private final VirtualFile myCurrentWorkingDirectory; @NotNull private final ObservatoryConnector myConnector; @NotNull private final ExecutionEnvironment executionEnvironment; @@ -596,25 +593,6 @@ private static boolean isDartPatchUri(@NotNull final String uri) { return uri.startsWith("dart:_") || uri.startsWith("dart:") && uri.contains("-patch/"); } - @NotNull - private static TIntObjectHashMap> createTokenPosToLineAndColumnMap(@NotNull final List> tokenPosTable) { - // Each subarray consists of a line number followed by (tokenPos, columnNumber) pairs - // see https://github.com/dart-lang/vm_service_drivers/blob/master/dart/tool/service.md#script - final TIntObjectHashMap> result = new TIntObjectHashMap<>(); - - for (List lineAndPairs : tokenPosTable) { - final Iterator iterator = lineAndPairs.iterator(); - final int line = Math.max(0, iterator.next() - 1); - while (iterator.hasNext()) { - final int tokenPos = iterator.next(); - final int column = Math.max(0, iterator.next() - 1); - result.put(tokenPos, Pair.create(line, column)); - } - } - - return result; - } - private static void focusProject(@NotNull Project project) { final WindowManager windowManager = WindowManager.getInstance(); if (windowManager == null) { diff --git a/flutter-idea/src/io/flutter/vmService/IsolatesInfo.java b/flutter-idea/src/io/flutter/vmService/IsolatesInfo.java index 7f42780de8..836d1a6d28 100644 --- a/flutter-idea/src/io/flutter/vmService/IsolatesInfo.java +++ b/flutter-idea/src/io/flutter/vmService/IsolatesInfo.java @@ -1,12 +1,12 @@ package io.flutter.vmService; -import gnu.trove.THashMap; import org.dartlang.vm.service.element.Isolate; import org.dartlang.vm.service.element.IsolateRef; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.function.Supplier; @@ -52,7 +52,7 @@ public String toString() { } } - private final Map myIsolateIdToInfoMap = new THashMap<>(); + private final HashMap myIsolateIdToInfoMap = new HashMap<>(); public synchronized boolean addIsolate(@NotNull final IsolateRef isolateRef) { if (myIsolateIdToInfoMap.containsKey(isolateRef.getId())) { diff --git a/flutter-idea/src/io/flutter/vmService/VMServiceManager.java b/flutter-idea/src/io/flutter/vmService/VMServiceManager.java index f8da87b809..20e22956e5 100644 --- a/flutter-idea/src/io/flutter/vmService/VMServiceManager.java +++ b/flutter-idea/src/io/flutter/vmService/VMServiceManager.java @@ -12,7 +12,6 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.text.StringUtil; -import gnu.trove.THashMap; import io.flutter.inspector.EvalOnDartLibrary; import io.flutter.run.daemon.FlutterApp; import io.flutter.utils.EventStream; @@ -40,13 +39,13 @@ public class VMServiceManager implements FlutterApp.FlutterAppListener, Disposab @NotNull private final FlutterApp app; @NotNull private final HeapMonitor heapMonitor; @NotNull private final FlutterFramesMonitor flutterFramesMonitor; - @NotNull private final Map> serviceExtensions = new THashMap<>(); + @NotNull private final Map> serviceExtensions = new HashMap<>(); /** * Boolean value applicable only for boolean service extensions indicating * whether the service extension is enabled or disabled. */ - @NotNull private final Map> serviceExtensionState = new THashMap<>(); + @NotNull private final Map> serviceExtensionState = new HashMap<>(); private final EventStream flutterIsolateRefStream; diff --git a/flutter-idea/src/io/flutter/vmService/frame/DartVmServiceEvaluator.java b/flutter-idea/src/io/flutter/vmService/frame/DartVmServiceEvaluator.java index ecd5f553c7..635b263b0b 100644 --- a/flutter-idea/src/io/flutter/vmService/frame/DartVmServiceEvaluator.java +++ b/flutter-idea/src/io/flutter/vmService/frame/DartVmServiceEvaluator.java @@ -21,7 +21,6 @@ import com.intellij.xdebugger.frame.XValue; import com.jetbrains.lang.dart.psi.*; import com.jetbrains.lang.dart.util.DartResolveUtil; -import gnu.trove.THashSet; import io.flutter.vmService.DartVmServiceDebugProcess; import io.flutter.vmService.VmServiceWrapper; import org.dartlang.vm.service.consumer.GetObjectConsumer; @@ -30,6 +29,7 @@ import org.jetbrains.annotations.Nullable; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.regex.Matcher; @@ -160,7 +160,7 @@ public void received(Sentinel response) { private LibraryRef findMatchingLibrary(Isolate isolate, List libraryFiles) { if (libraryFiles != null && !libraryFiles.isEmpty()) { - final Set uris = new THashSet<>(); + final Set uris = new HashSet<>(); for (VirtualFile libraryFile : libraryFiles) { uris.addAll(myDebugProcess.getUrisForFile(libraryFile)); diff --git a/tool/plugin/lib/lint.dart b/tool/plugin/lib/lint.dart index 6b7637d171..e72a921843 100644 --- a/tool/plugin/lib/lint.dart +++ b/tool/plugin/lib/lint.dart @@ -99,6 +99,9 @@ class LintCommand extends Command { // Not technically a bad import, but not all IntelliJ platforms provide // this library. 'org.apache.commons.io.', + + // gnu.trove. classes seem to all be deprecated, avoid into the future + 'gnu.trove.', ]; for (var import in proscribedImports) {