Skip to content

Commit 44b0408

Browse files
authored
Remove a few unnecessary guava usages (#100)
1 parent 2a027e3 commit 44b0408

File tree

6 files changed

+10
-13
lines changed

6 files changed

+10
-13
lines changed

third_party/src/main/java/com/jetbrains/lang/dart/analyzer/DartAnalysisServerService.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
package com.jetbrains.lang.dart.analyzer;
33

44
import com.google.common.collect.EvictingQueue;
5-
import com.google.common.collect.Sets;
65
import com.google.common.util.concurrent.Uninterruptibles;
76
import com.google.dart.server.*;
87
import com.google.dart.server.generated.AnalysisServer;
@@ -534,7 +533,7 @@ public void addCompletions(final @NotNull VirtualFile file,
534533
consumer.consumeCompletionSuggestion(convertedReplacementOffset, completionInfo.myReplacementLength, completion);
535534
}
536535

537-
final Set<String> includedKinds = Sets.newHashSet(completionInfo.myIncludedElementKinds);
536+
final Set<String> includedKinds = new HashSet<>(completionInfo.myIncludedElementKinds);
538537
final Map<String, IncludedSuggestionRelevanceTag> includedRelevanceTags = new HashMap<>();
539538
for (IncludedSuggestionRelevanceTag includedRelevanceTag : completionInfo.myIncludedSuggestionRelevanceTags) {
540539
includedRelevanceTags.put(includedRelevanceTag.getTag(), includedRelevanceTag);

third_party/src/main/java/com/jetbrains/lang/dart/analyzer/DartServerData.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
22
package com.jetbrains.lang.dart.analyzer;
33

4-
import com.google.common.collect.Sets;
54
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
65
import com.intellij.codeInsight.hints.declarative.impl.DeclarativeInlayHintsPassFactory;
76
import com.intellij.openapi.application.ApplicationManager;
@@ -24,6 +23,7 @@
2423
import org.jetbrains.annotations.*;
2524

2625
import java.util.*;
26+
import java.util.concurrent.ConcurrentHashMap;
2727

2828
public final class DartServerData {
2929
public interface OutlineListener extends EventListener {
@@ -46,10 +46,10 @@ public interface OutlineListener extends EventListener {
4646
private final Map<Integer, AvailableSuggestionSet> myAvailableSuggestionSetMap = Collections.synchronizedMap(new HashMap<>());
4747
private final Map<String, Map<String, Map<String, Set<String>>>> myExistingImports = Collections.synchronizedMap(new HashMap<>());
4848

49-
private final Set<DartLocalFileInfo> myLocalFilesWithUnsentChanges = Sets.newConcurrentHashSet();
49+
private final Set<DartLocalFileInfo> myLocalFilesWithUnsentChanges = ConcurrentHashMap.newKeySet();
5050

5151
// keeps track of files in which error regions have been updated by DocumentListener
52-
private final Set<DartLocalFileInfo> myLocalFilesWithOutdatedErrorInfo = Sets.newConcurrentHashSet();
52+
private final Set<DartLocalFileInfo> myLocalFilesWithOutdatedErrorInfo = ConcurrentHashMap.newKeySet();
5353

5454
private final Map<String, LightVirtualFile> myNotLocalFileUriToVirtualFileMap = Collections.synchronizedMap(new HashMap<>());
5555

third_party/src/main/java/com/jetbrains/lang/dart/assists/AssistUtils.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
22
package com.jetbrains.lang.dart.assists;
33

4-
import com.google.common.collect.Maps;
54
import com.intellij.codeInsight.FileModificationService;
65
import com.intellij.codeInsight.lookup.LookupElement;
76
import com.intellij.codeInsight.lookup.LookupElementBuilder;
@@ -153,7 +152,7 @@ public static List<SourceEditInfo> applySourceEdits(final @NotNull Project proje
153152
final @NotNull Set<String> excludedIds)
154153
throws DartSourceEditException {
155154

156-
final Map<VirtualFile, SourceFileEdit> map = Maps.newHashMap();
155+
final Map<VirtualFile, SourceFileEdit> map = new HashMap<>();
157156
final List<SourceFileEdit> fileEdits = sourceChange.getEdits();
158157
for (SourceFileEdit fileEdit : fileEdits) {
159158
boolean allEditsExcluded = true;

third_party/src/main/java/com/jetbrains/lang/dart/ide/actions/DartSortMembersAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
22
package com.jetbrains.lang.dart.ide.actions;
33

4-
import com.google.common.collect.Maps;
54
import com.intellij.CommonBundle;
65
import com.intellij.openapi.application.ApplicationManager;
76
import com.intellij.openapi.application.ex.ApplicationManagerEx;
@@ -26,6 +25,7 @@
2625
import org.jetbrains.annotations.NotNull;
2726

2827
import java.util.Collections;
28+
import java.util.HashMap;
2929
import java.util.List;
3030
import java.util.Map;
3131

@@ -88,7 +88,7 @@ protected void runOverFiles(final @NotNull Project project, final @NotNull List<
8888
return;
8989
}
9090

91-
final Map<VirtualFile, SourceFileEdit> fileToFileEditMap = Maps.newHashMap();
91+
final Map<VirtualFile, SourceFileEdit> fileToFileEditMap = new HashMap<>();
9292

9393
final Runnable runnable = () -> {
9494
double fraction = 0.0;

third_party/src/main/java/com/jetbrains/lang/dart/ide/refactoring/ServerExtractMethodRefactoring.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
22
package com.jetbrains.lang.dart.ide.refactoring;
33

4-
import com.google.common.collect.ImmutableList;
54
import com.intellij.openapi.project.Project;
65
import com.intellij.openapi.util.NlsSafe;
76
import com.intellij.openapi.vfs.VirtualFile;
@@ -18,7 +17,7 @@
1817
*/
1918
public class ServerExtractMethodRefactoring extends ServerRefactoring {
2019
private final ExtractMethodOptions options =
21-
new ExtractMethodOptions("returnType", false, "name", ImmutableList.of(), false);
20+
new ExtractMethodOptions("returnType", false, "name", List.of(), false);
2221
private ExtractMethodFeedback feedback;
2322

2423
public ServerExtractMethodRefactoring(final @NotNull Project project,

third_party/src/main/java/com/jetbrains/lang/dart/ide/runner/server/vmService/DartVmServiceDebugProcess.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
22
package com.jetbrains.lang.dart.ide.runner.server.vmService;
33

4-
import com.google.common.base.Charsets;
54
import com.intellij.execution.ExecutionException;
65
import com.intellij.execution.ExecutionResult;
76
import com.intellij.execution.process.ProcessEvent;
@@ -61,6 +60,7 @@
6160

6261
import java.io.File;
6362
import java.io.IOException;
63+
import java.nio.charset.StandardCharsets;
6464
import java.util.*;
6565

6666
/**
@@ -524,7 +524,7 @@ public void isolateExit(@NotNull IsolateRef isolateRef) {
524524
}
525525

526526
public void handleWriteEvent(String base64Data) {
527-
String message = new String(Base64.getDecoder().decode(base64Data), Charsets.UTF_8);
527+
String message = new String(Base64.getDecoder().decode(base64Data), StandardCharsets.UTF_8);
528528
getSession().getConsoleView().print(message, ConsoleViewContentType.NORMAL_OUTPUT);
529529
}
530530

0 commit comments

Comments
 (0)