diff --git a/jps/jps-builders-6/intellij.platform.jps.build.javac.rt.iml b/jps/jps-builders-6/intellij.platform.jps.build.javac.rt.iml index b2028be90cbe..55aedb2e3f10 100644 --- a/jps/jps-builders-6/intellij.platform.jps.build.javac.rt.iml +++ b/jps/jps-builders-6/intellij.platform.jps.build.javac.rt.iml @@ -10,7 +10,6 @@ - diff --git a/jps/jps-builders-6/src/org/jetbrains/jps/javac/DefaultFileOperations.java b/jps/jps-builders-6/src/org/jetbrains/jps/javac/DefaultFileOperations.java index d23865764710..12ea81920523 100644 --- a/jps/jps-builders-6/src/org/jetbrains/jps/javac/DefaultFileOperations.java +++ b/jps/jps-builders-6/src/org/jetbrains/jps/javac/DefaultFileOperations.java @@ -1,16 +1,13 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.jps.javac; import com.intellij.openapi.util.text.StringUtilRt; import com.intellij.util.BooleanFunction; import com.intellij.util.Function; -import gnu.trove.THashMap; -import gnu.trove.TObjectByteHashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.tools.JavaFileManager; -import javax.tools.JavaFileObject; +import javax.tools.*; import java.io.File; import java.io.IOException; import java.util.*; @@ -20,6 +17,7 @@ import java.util.zip.ZipFile; final class DefaultFileOperations implements FileOperations { private static final File[] NULL_FILE_ARRAY = new File[0]; private static final Archive NULL_ARCHIVE = new Archive() { + @NotNull @Override public Iterable list(String relPath, Set kinds, boolean recurse) { return Collections.emptyList(); @@ -28,14 +26,10 @@ final class DefaultFileOperations implements FileOperations { public void close(){ } }; - private static final byte UNKNOWN = 0; - private static final byte NO = 1; - private static final byte YES = 2; - - private final Map myDirectoryCache = new THashMap(); - private final Map myArchiveCache = new THashMap(); - private final TObjectByteHashMap myIsFile = new TObjectByteHashMap(); + private final Map myDirectoryCache = new HashMap(); + private final Map myArchiveCache = new HashMap(); + private final Map myIsFile = new HashMap(); @Override @NotNull @@ -79,12 +73,12 @@ final class DefaultFileOperations implements FileOperations { @Override public boolean isFile(File file) { - byte cachedIsFile = myIsFile.get(file); - if (cachedIsFile == UNKNOWN) { - cachedIsFile = file.isFile() ? YES : NO; + Boolean cachedIsFile = myIsFile.get(file); + if (cachedIsFile == null) { + cachedIsFile = file.isFile(); myIsFile.put(file, cachedIsFile); } - return cachedIsFile == YES; + return cachedIsFile == Boolean.TRUE; } @Override @@ -168,7 +162,7 @@ final class DefaultFileOperations implements FileOperations { private static class ZipArchive implements FileOperations.Archive { private final ZipFile myZip; - private final Map> myPaths = new THashMap>(); + private final Map> myPaths = new HashMap>(); private final Function myToFileObjectConverter; private static final FileObjectKindFilter ourEntryFilter = new FileObjectKindFilter(new Function() { @Override diff --git a/jps/jps-builders-6/src/org/jetbrains/jps/javac/ModulePath.java b/jps/jps-builders-6/src/org/jetbrains/jps/javac/ModulePath.java index bad6ffea7127..407c3ed310c2 100644 --- a/jps/jps-builders-6/src/org/jetbrains/jps/javac/ModulePath.java +++ b/jps/jps-builders-6/src/org/jetbrains/jps/javac/ModulePath.java @@ -1,13 +1,8 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.jps.javac; -import gnu.trove.THashMap; - import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Map; +import java.util.*; public abstract class ModulePath { public interface Builder { @@ -61,7 +56,7 @@ public abstract class ModulePath { public static Builder newBuilder() { return new Builder() { - private final Map myMap = new THashMap(); + private final Map myMap = new HashMap(); private final Collection myPath = new ArrayList(); @Override diff --git a/jps/jps-builders/src/org/jetbrains/jps/backwardRefs/BackwardReferenceIndexUtil.java b/jps/jps-builders/src/org/jetbrains/jps/backwardRefs/BackwardReferenceIndexUtil.java index c813d7a36c57..e960c5764c3a 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/backwardRefs/BackwardReferenceIndexUtil.java +++ b/jps/jps-builders/src/org/jetbrains/jps/backwardRefs/BackwardReferenceIndexUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.jps.backwardRefs; import com.intellij.openapi.diagnostic.Logger; @@ -125,13 +125,13 @@ public final class BackwardReferenceIndexUtil { } } - private static class AnonymousClassEnumerator { - private THashMap myAnonymousName2Id = null; + private static final class AnonymousClassEnumerator { + private Map myAnonymousName2Id = null; private CompilerRef.JavaCompilerAnonymousClassRef addAnonymous(String internalName, CompilerRef.JavaCompilerClassRef base) { if (myAnonymousName2Id == null) { - myAnonymousName2Id = new THashMap<>(); + myAnonymousName2Id = new HashMap<>(); } final int anonymousIdx = myAnonymousName2Id.size(); myAnonymousName2Id.put(internalName, base); diff --git a/jps/jps-builders/src/org/jetbrains/jps/builders/impl/BuildTargetIndexImpl.java b/jps/jps-builders/src/org/jetbrains/jps/builders/impl/BuildTargetIndexImpl.java index 2623605c10fd..e6da31c0b096 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/builders/impl/BuildTargetIndexImpl.java +++ b/jps/jps-builders/src/org/jetbrains/jps/builders/impl/BuildTargetIndexImpl.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.jps.builders.impl; import com.intellij.util.containers.ContainerUtil; @@ -6,7 +6,6 @@ import com.intellij.util.graph.DFSTBuilder; import com.intellij.util.graph.Graph; import com.intellij.util.graph.GraphGenerator; import com.intellij.util.graph.InboundSemiGraph; -import gnu.trove.THashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.jps.builders.*; import org.jetbrains.jps.incremental.CompileContext; @@ -14,7 +13,7 @@ import org.jetbrains.jps.model.module.JpsModule; import java.util.*; -public class BuildTargetIndexImpl implements BuildTargetIndex { +public final class BuildTargetIndexImpl implements BuildTargetIndex { private final BuildTargetRegistry myRegistry; private final BuildRootIndexImpl myBuildRootIndex; private final Map, Collection>> myDependencies; @@ -23,7 +22,7 @@ public class BuildTargetIndexImpl implements BuildTargetIndex { public BuildTargetIndexImpl(BuildTargetRegistry targetRegistry, BuildRootIndexImpl buildRootIndex) { myRegistry = targetRegistry; myBuildRootIndex = buildRootIndex; - myDependencies = new THashMap<>(); + myDependencies = new HashMap<>(); } @Override diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/CompilerEncodingConfiguration.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/CompilerEncodingConfiguration.java index cb3cd2e411f4..6e60e40166b1 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/incremental/CompilerEncodingConfiguration.java +++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/CompilerEncodingConfiguration.java @@ -1,24 +1,9 @@ -/* - * Copyright 2000-2012 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.jps.incremental; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.util.containers.ContainerUtil; -import gnu.trove.THashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jps.ModuleChunk; @@ -59,7 +44,7 @@ public class CompilerEncodingConfiguration { } private Map> computeModuleCharsetMap() { - final Map> map = new THashMap<>(); + final Map> map = new HashMap<>(); final Iterable builderExtensions = JpsServiceManager.getInstance().getExtensions(JavaBuilderExtension.class); for (Map.Entry entry : myUrlToCharset.entrySet()) { final String fileUrl = entry.getKey(); diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/instrumentation/RmiStubsGenerator.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/instrumentation/RmiStubsGenerator.java index f5a8ec78064d..0d57192d5788 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/incremental/instrumentation/RmiStubsGenerator.java +++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/instrumentation/RmiStubsGenerator.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.jps.incremental.instrumentation; import com.intellij.compiler.instrumentation.InstrumentationClassFinder; @@ -14,7 +14,6 @@ import com.intellij.util.ArrayUtilRt; import com.intellij.util.SmartList; import com.intellij.util.SystemProperties; import com.intellij.util.containers.FileCollectionFactory; -import gnu.trove.THashMap; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -76,7 +75,7 @@ public final class RmiStubsGenerator extends ClassProcessingBuilder { protected ExitCode performBuild(CompileContext context, ModuleChunk chunk, InstrumentationClassFinder finder, OutputConsumer outputConsumer) { ExitCode exitCode = ExitCode.NOTHING_DONE; if (!outputConsumer.getCompiledClasses().isEmpty()) { - final Map> remoteClasses = new THashMap<>(); + final Map> remoteClasses = new HashMap<>(); for (ModuleBuildTarget target : chunk.getTargets()) { for (CompiledClass compiledClass : outputConsumer.getTargetCompiledClasses(target)) { try { diff --git a/jps/model-impl/intellij.platform.jps.model.tests.iml b/jps/model-impl/intellij.platform.jps.model.tests.iml index 249c319a5d8c..19fd09b671e0 100644 --- a/jps/model-impl/intellij.platform.jps.model.tests.iml +++ b/jps/model-impl/intellij.platform.jps.model.tests.iml @@ -11,6 +11,5 @@ - \ No newline at end of file diff --git a/platform/build-scripts/icons/src/org/jetbrains/intellij/build/images/IconsClassGenerator.kt b/platform/build-scripts/icons/src/org/jetbrains/intellij/build/images/IconsClassGenerator.kt index 701111de6864..9e791b9c6dd8 100644 --- a/platform/build-scripts/icons/src/org/jetbrains/intellij/build/images/IconsClassGenerator.kt +++ b/platform/build-scripts/icons/src/org/jetbrains/intellij/build/images/IconsClassGenerator.kt @@ -83,6 +83,13 @@ internal open class IconsClassGenerator(private val projectHome: Path, val dir = module.getSourceRoots(JavaSourceRootType.SOURCE).first().file.absolutePath + '/' + packageName.replace('.', '/') outFile = Path.of(dir, "$className.java") } + "intellij.css" -> { + packageName = "com.intellij.lang.css" + className = "CssIcons" + + val dir = module.getSourceRoots(JavaSourceRootType.SOURCE).first().file.absolutePath + '/' + packageName.replace('.', '/') + outFile = Path.of(dir, "$className.java") + } "intellij.android.artwork" -> { packageName = "icons" diff --git a/platform/diff-impl/intellij.platform.diff.impl.iml b/platform/diff-impl/intellij.platform.diff.impl.iml index d52958340942..e221f03767dc 100644 --- a/platform/diff-impl/intellij.platform.diff.impl.iml +++ b/platform/diff-impl/intellij.platform.diff.impl.iml @@ -19,7 +19,7 @@ - + \ No newline at end of file diff --git a/platform/diff-impl/src/com/intellij/diff/comparison/ByChar.java b/platform/diff-impl/src/com/intellij/diff/comparison/ByChar.java index 541af21136dc..9dc83a6f2867 100644 --- a/platform/diff-impl/src/com/intellij/diff/comparison/ByChar.java +++ b/platform/diff-impl/src/com/intellij/diff/comparison/ByChar.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.diff.comparison; import com.intellij.diff.comparison.iterables.DiffIterable; @@ -6,7 +6,7 @@ import com.intellij.diff.comparison.iterables.FairDiffIterable; import com.intellij.diff.util.Range; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.util.Pair; -import gnu.trove.TIntArrayList; +import it.unimi.dsi.fastutil.ints.IntArrayList; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -206,7 +206,7 @@ public final class ByChar { // private static int @NotNull [] getAllCodePoints(@NotNull CharSequence text) { - TIntArrayList list = new TIntArrayList(text.length()); + IntArrayList list = new IntArrayList(text.length()); int len = text.length(); int offset = 0; @@ -220,13 +220,13 @@ public final class ByChar { offset += charCount; } - return list.toNativeArray(); + return list.toIntArray(); } @NotNull private static CodePointsOffsets getNonSpaceCodePoints(@NotNull CharSequence text) { - TIntArrayList codePoints = new TIntArrayList(text.length()); - TIntArrayList offsets = new TIntArrayList(text.length()); + IntArrayList codePoints = new IntArrayList(text.length()); + IntArrayList offsets = new IntArrayList(text.length()); int len = text.length(); int offset = 0; @@ -243,13 +243,13 @@ public final class ByChar { offset += charCount; } - return new CodePointsOffsets(codePoints.toNativeArray(), offsets.toNativeArray()); + return new CodePointsOffsets(codePoints.toIntArray(), offsets.toIntArray()); } @NotNull private static CodePointsOffsets getPunctuationChars(@NotNull CharSequence text) { - TIntArrayList codePoints = new TIntArrayList(text.length()); - TIntArrayList offsets = new TIntArrayList(text.length()); + IntArrayList codePoints = new IntArrayList(text.length()); + IntArrayList offsets = new IntArrayList(text.length()); for (int i = 0; i < text.length(); i++) { char c = text.charAt(i); @@ -259,7 +259,7 @@ public final class ByChar { } } - return new CodePointsOffsets(codePoints.toNativeArray(), offsets.toNativeArray()); + return new CodePointsOffsets(codePoints.toIntArray(), offsets.toIntArray()); } private static int countChars(int[] codePoints, int start, int end) { diff --git a/platform/diff-impl/src/com/intellij/diff/comparison/ByLine.java b/platform/diff-impl/src/com/intellij/diff/comparison/ByLine.java index 199e52c6de42..b5e261c4e79e 100644 --- a/platform/diff-impl/src/com/intellij/diff/comparison/ByLine.java +++ b/platform/diff-impl/src/com/intellij/diff/comparison/ByLine.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.diff.comparison; import com.intellij.diff.comparison.iterables.FairDiffIterable; @@ -8,7 +8,8 @@ import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.containers.ContainerUtil; -import gnu.trove.TIntArrayList; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -189,8 +190,8 @@ public final class ByLine { int start1 = Math.max(last1, builder.getIndex1()); int start2 = Math.max(last2, builder.getIndex2()); - TIntArrayList subLines1 = new TIntArrayList(); - TIntArrayList subLines2 = new TIntArrayList(); + IntArrayList subLines1 = new IntArrayList(); + IntArrayList subLines2 = new IntArrayList(); for (int i = start1; i < line1; i++) { if (StringUtil.equalsIgnoreWhitespaces(sample, lines1.get(i).getContent())) { subLines1.add(i); @@ -210,7 +211,7 @@ public final class ByLine { sample = null; } - private void alignExactMatching(TIntArrayList subLines1, TIntArrayList subLines2) { + private void alignExactMatching(IntList subLines1, IntList subLines2) { int n = Math.max(subLines1.size(), subLines2.size()); boolean skipAligning = n > 10 || // we use brute-force algorithm (C_n_k). This will limit search space by ~250 cases. subLines1.size() == subLines2.size(); // nothing to do @@ -218,8 +219,8 @@ public final class ByLine { if (skipAligning) { int count = Math.min(subLines1.size(), subLines2.size()); for (int i = 0; i < count; i++) { - int index1 = subLines1.get(i); - int index2 = subLines2.get(i); + int index1 = subLines1.getInt(i); + int index2 = subLines2.getInt(i); if (lines1.get(index1).equals(lines2.get(index2))) { builder.markEqual(index1, index2); } @@ -230,8 +231,8 @@ public final class ByLine { if (subLines1.size() < subLines2.size()) { int[] matching = getBestMatchingAlignment(subLines1, subLines2, lines1, lines2); for (int i = 0; i < subLines1.size(); i++) { - int index1 = subLines1.get(i); - int index2 = subLines2.get(matching[i]); + int index1 = subLines1.getInt(i); + int index2 = subLines2.getInt(matching[i]); if (lines1.get(index1).equals(lines2.get(index2))) { builder.markEqual(index1, index2); } @@ -240,8 +241,8 @@ public final class ByLine { else { int[] matching = getBestMatchingAlignment(subLines2, subLines1, lines2, lines1); for (int i = 0; i < subLines2.size(); i++) { - int index1 = subLines1.get(matching[i]); - int index2 = subLines2.get(i); + int index1 = subLines1.getInt(matching[i]); + int index2 = subLines2.getInt(i); if (lines1.get(index1).equals(lines2.get(index2))) { builder.markEqual(index1, index2); } @@ -253,8 +254,8 @@ public final class ByLine { return fair(builder.finish()); } - private static int @NotNull [] getBestMatchingAlignment(@NotNull final TIntArrayList subLines1, - @NotNull final TIntArrayList subLines2, + private static int @NotNull [] getBestMatchingAlignment(@NotNull final IntList subLines1, + @NotNull final IntList subLines2, @NotNull final List lines1, @NotNull final List lines2) { assert subLines1.size() < subLines2.size(); @@ -289,8 +290,8 @@ public final class ByLine { private void processCombination() { int weight = 0; for (int i = 0; i < size; i++) { - int index1 = subLines1.get(i); - int index2 = subLines2.get(comb[i]); + int index1 = subLines1.getInt(i); + int index2 = subLines2.getInt(comb[i]); if (lines1.get(index1).equals(lines2.get(index2))) weight++; } @@ -324,17 +325,17 @@ public final class ByLine { int threshold = ComparisonUtil.getUnimportantLineCharCount(); if (threshold == 0) return diff(lines1, lines2, indicator); - Pair, TIntArrayList> bigLines1 = getBigLines(lines1, threshold); - Pair, TIntArrayList> bigLines2 = getBigLines(lines2, threshold); + Pair, IntList> bigLines1 = getBigLines(lines1, threshold); + Pair, IntList> bigLines2 = getBigLines(lines2, threshold); FairDiffIterable changes = diff(bigLines1.first, bigLines2.first, indicator); return new ChangeCorrector.SmartLineChangeCorrector(bigLines1.second, bigLines2.second, lines1, lines2, changes, indicator).build(); } @NotNull - private static Pair, TIntArrayList> getBigLines(@NotNull List lines, int threshold) { + private static Pair, IntList> getBigLines(@NotNull List lines, int threshold) { List bigLines = new ArrayList<>(lines.size()); - TIntArrayList indexes = new TIntArrayList(lines.size()); + IntList indexes = new IntArrayList(lines.size()); for (int i = 0; i < lines.size(); i++) { Line line = lines.get(i); diff --git a/platform/diff-impl/src/com/intellij/diff/comparison/ChangeCorrector.java b/platform/diff-impl/src/com/intellij/diff/comparison/ChangeCorrector.java index 8a67f49e9eb1..b7490b90a4be 100644 --- a/platform/diff-impl/src/com/intellij/diff/comparison/ChangeCorrector.java +++ b/platform/diff-impl/src/com/intellij/diff/comparison/ChangeCorrector.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.diff.comparison; import com.intellij.diff.comparison.ByLine.Line; @@ -7,7 +7,7 @@ import com.intellij.diff.comparison.iterables.FairDiffIterable; import com.intellij.diff.util.Range; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.util.IntPair; -import gnu.trove.TIntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -128,14 +128,14 @@ abstract class ChangeCorrector { } } - public static class SmartLineChangeCorrector extends ChangeCorrector { - @NotNull private final TIntArrayList myIndexes1; - @NotNull private final TIntArrayList myIndexes2; + public static final class SmartLineChangeCorrector extends ChangeCorrector { + @NotNull private final IntList myIndexes1; + @NotNull private final IntList myIndexes2; @NotNull private final List myLines1; @NotNull private final List myLines2; - public SmartLineChangeCorrector(@NotNull TIntArrayList indexes1, - @NotNull TIntArrayList indexes2, + public SmartLineChangeCorrector(@NotNull IntList indexes1, + @NotNull IntList indexes2, @NotNull List lines1, @NotNull List lines2, @NotNull FairDiffIterable changes, @@ -166,13 +166,13 @@ abstract class ChangeCorrector { @Override protected IntPair getOriginalRange1(int index) { - int offset = myIndexes1.get(index); + int offset = myIndexes1.getInt(index); return new IntPair(offset, offset + 1); } @Override protected IntPair getOriginalRange2(int index) { - int offset = myIndexes2.get(index); + int offset = myIndexes2.getInt(index); return new IntPair(offset, offset + 1); } } diff --git a/platform/diff-impl/src/com/intellij/diff/merge/MergeModelBase.java b/platform/diff-impl/src/com/intellij/diff/merge/MergeModelBase.java index 533410af974c..4542c628f207 100644 --- a/platform/diff-impl/src/com/intellij/diff/merge/MergeModelBase.java +++ b/platform/diff-impl/src/com/intellij/diff/merge/MergeModelBase.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.diff.merge; import com.intellij.diff.util.DiffUtil; @@ -16,14 +16,17 @@ import com.intellij.openapi.util.NlsContexts; import com.intellij.util.SmartList; import com.intellij.util.concurrency.annotations.RequiresEdt; import com.intellij.util.concurrency.annotations.RequiresWriteLock; -import gnu.trove.TIntArrayList; -import gnu.trove.TIntHashSet; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; +import it.unimi.dsi.fastutil.ints.IntOpenHashSet; +import it.unimi.dsi.fastutil.ints.IntSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; +import java.util.function.IntConsumer; public abstract class MergeModelBase implements Disposable { private static final Logger LOG = Logger.getInstance(MergeModelBase.class); @@ -32,10 +35,10 @@ public abstract class MergeModelBase implements @NotNull private final Document myDocument; @Nullable private final UndoManager myUndoManager; - @NotNull private final TIntArrayList myStartLines = new TIntArrayList(); - @NotNull private final TIntArrayList myEndLines = new TIntArrayList(); + @NotNull private final IntArrayList myStartLines = new IntArrayList(); + @NotNull private final IntArrayList myEndLines = new IntArrayList(); - @NotNull private final TIntHashSet myChangesToUpdate = new TIntHashSet(); + @NotNull private final IntSet myChangesToUpdate = new IntOpenHashSet(); private int myBulkChangeUpdateDepth; private boolean myInsideCommand; @@ -71,16 +74,16 @@ public abstract class MergeModelBase implements } public int getLineStart(int index) { - return myStartLines.get(index); + return myStartLines.getInt(index); } public int getLineEnd(int index) { - return myEndLines.get(index); + return myEndLines.getInt(index); } public void setChanges(@NotNull List changes) { - myStartLines.clear(changes.size()); - myEndLines.clear(changes.size()); + myStartLines.clear(); + myEndLines.clear(); for (LineRange range : changes) { myStartLines.add(range.start); @@ -126,9 +129,8 @@ public abstract class MergeModelBase implements LOG.assertTrue(myBulkChangeUpdateDepth >= 0); if (myBulkChangeUpdateDepth == 0) { - myChangesToUpdate.forEach(index -> { + myChangesToUpdate.forEach((IntConsumer)index -> { reinstallHighlighters(index); - return true; }); myChangesToUpdate.clear(); } @@ -208,9 +210,9 @@ public abstract class MergeModelBase implements @Nullable String commandGroupId, @NotNull UndoConfirmationPolicy confirmationPolicy, boolean underBulkUpdate, - @Nullable TIntArrayList affectedChanges, + @Nullable IntList affectedChanges, @NotNull Runnable task) { - TIntArrayList allAffectedChanges = affectedChanges != null ? collectAffectedChanges(affectedChanges) : null; + IntList allAffectedChanges = affectedChanges != null ? collectAffectedChanges(affectedChanges) : null; return DiffUtil.executeWriteCommand(myProject, myDocument, commandName, commandGroupId, confirmationPolicy, underBulkUpdate, () -> { LOG.assertTrue(!myInsideCommand); @@ -236,15 +238,14 @@ public abstract class MergeModelBase implements }); } - private void registerUndoRedo(boolean undo, @Nullable TIntArrayList affectedChanges) { + private void registerUndoRedo(boolean undo, @Nullable IntList affectedChanges) { if (myUndoManager == null) return; List states; if (affectedChanges != null) { states = new ArrayList<>(affectedChanges.size()); - affectedChanges.forEach((index) -> { + affectedChanges.forEach((IntConsumer)(index) -> { states.add(storeChangeState(index)); - return true; }); } else { @@ -256,7 +257,7 @@ public abstract class MergeModelBase implements myUndoManager.undoableActionPerformed(new MyUndoableAction(this, states, undo)); } - private static class MyUndoableAction extends BasicUndoableAction { + private static final class MyUndoableAction extends BasicUndoableAction { @NotNull private final WeakReference myModelRef; @NotNull private final List myStates; private final boolean myUndo; @@ -375,13 +376,13 @@ public abstract class MergeModelBase implements */ @NotNull @RequiresEdt - private TIntArrayList collectAffectedChanges(@NotNull TIntArrayList directChanges) { - TIntArrayList result = new TIntArrayList(directChanges.size()); + private IntList collectAffectedChanges(@NotNull IntList directChanges) { + IntList result = new IntArrayList(directChanges.size()); int directArrayIndex = 0; int otherIndex = 0; while (directArrayIndex < directChanges.size() && otherIndex < getChangesCount()) { - int directIndex = directChanges.get(directArrayIndex); + int directIndex = directChanges.getInt(directArrayIndex); if (directIndex == otherIndex) { result.add(directIndex); diff --git a/platform/diff-impl/src/com/intellij/diff/merge/TextMergeViewer.java b/platform/diff-impl/src/com/intellij/diff/merge/TextMergeViewer.java index 56d53d471fb2..ec287539670d 100644 --- a/platform/diff-impl/src/com/intellij/diff/merge/TextMergeViewer.java +++ b/platform/diff-impl/src/com/intellij/diff/merge/TextMergeViewer.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.diff.merge; import com.intellij.diff.DiffContext; @@ -71,7 +71,8 @@ import com.intellij.util.concurrency.annotations.RequiresBackgroundThread; import com.intellij.util.concurrency.annotations.RequiresEdt; import com.intellij.util.concurrency.annotations.RequiresWriteLock; import com.intellij.util.containers.ContainerUtil; -import gnu.trove.TIntArrayList; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -775,9 +776,9 @@ public class TextMergeViewer implements MergeTool.MergeViewer { @NotNull Runnable task) { myContentModified = true; - TIntArrayList affectedIndexes = null; + IntList affectedIndexes = null; if (affected != null) { - affectedIndexes = new TIntArrayList(affected.size()); + affectedIndexes = new IntArrayList(affected.size()); for (TextMergeChange change : affected) { affectedIndexes.add(change.getIndex()); } diff --git a/platform/diff-impl/src/com/intellij/diff/tools/util/text/LineOffsetsUtil.java b/platform/diff-impl/src/com/intellij/diff/tools/util/text/LineOffsetsUtil.java index 8316369d40f4..87ae8ba519b7 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/util/text/LineOffsetsUtil.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/util/text/LineOffsetsUtil.java @@ -1,10 +1,10 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.diff.tools.util.text; import com.intellij.diff.util.DiffUtil; import com.intellij.openapi.editor.Document; import com.intellij.openapi.util.text.StringUtil; -import gnu.trove.TIntArrayList; +import it.unimi.dsi.fastutil.ints.IntArrayList; import org.jetbrains.annotations.NotNull; import java.util.Arrays; @@ -16,7 +16,7 @@ public final class LineOffsetsUtil { @NotNull public static LineOffsets create(@NotNull CharSequence text) { - TIntArrayList ends = new TIntArrayList(); + IntArrayList ends = new IntArrayList(); int index = 0; while (true) { @@ -31,7 +31,7 @@ public final class LineOffsetsUtil { } } - return new LineOffsetsImpl(ends.toNativeArray(), text.length()); + return new LineOffsetsImpl(ends.toIntArray(), text.length()); } private static final class LineOffsetsImpl implements LineOffsets { diff --git a/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java b/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java index f6108cb21a05..2f8690f92623 100644 --- a/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java +++ b/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.diff.util; import com.intellij.application.options.CodeStyle; @@ -96,7 +96,6 @@ import com.intellij.util.ui.JBUI; import com.intellij.util.ui.SingleComponentCenteringLayout; import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.components.BorderLayoutPanel; -import gnu.trove.Equality; import icons.PlatformDiffImplIcons; import org.jetbrains.annotations.*; @@ -111,11 +110,9 @@ import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.List; import java.util.*; +import java.util.function.BiPredicate; import java.util.function.IntUnaryOperator; -import static com.intellij.diff.util.DiffUserDataKeysEx.EDITORS_TITLE_CUSTOMIZER; -import static com.intellij.util.containers.ContainerUtil.notNullize; - public final class DiffUtil { private static final Logger LOG = Logger.getInstance(DiffUtil.class); @@ -526,7 +523,7 @@ public final class DiffUtil { List<@Nls String> titles = request.getContentTitles(); List components = new ArrayList<>(titles.size()); - List diffTitleCustomizers = request.getUserData(EDITORS_TITLE_CUSTOMIZER); + List diffTitleCustomizers = request.getUserData(DiffUserDataKeysEx.EDITORS_TITLE_CUSTOMIZER); for (int i = 0; i < contents.size(); i++) { JComponent title = createTitle(titles.get(i), diffTitleCustomizers != null ? diffTitleCustomizers.get(i) : null); @@ -549,7 +546,7 @@ public final class DiffUtil { List result = new ArrayList<>(contents.size()); - List diffTitleCustomizers = request.getUserData(EDITORS_TITLE_CUSTOMIZER); + List diffTitleCustomizers = request.getUserData(DiffUserDataKeysEx.EDITORS_TITLE_CUSTOMIZER); for (int i = 0; i < contents.size(); i++) { JComponent title = createTitle(titles.get(i), contents.get(i), @@ -1303,8 +1300,8 @@ public final class DiffUtil { @NotNull public static MergeConflictType getMergeType(@NotNull Condition emptiness, - @NotNull Equality equality, - @Nullable Equality trueEquality, + @NotNull BiPredicate equality, + @Nullable BiPredicate trueEquality, @NotNull BooleanGetter conflictResolver) { boolean isLeftEmpty = emptiness.value(ThreeSide.LEFT); boolean isBaseEmpty = emptiness.value(ThreeSide.BASE); @@ -1319,7 +1316,7 @@ public final class DiffUtil { return new MergeConflictType(TextDiffType.INSERTED, true, false); } else { // =-= - boolean equalModifications = equality.equals(ThreeSide.LEFT, ThreeSide.RIGHT); + boolean equalModifications = equality.test(ThreeSide.LEFT, ThreeSide.RIGHT); if (equalModifications) { return new MergeConflictType(TextDiffType.INSERTED, true, true); } @@ -1333,13 +1330,13 @@ public final class DiffUtil { return new MergeConflictType(TextDiffType.DELETED, true, true); } else { // -==, ==-, === - boolean unchangedLeft = equality.equals(ThreeSide.BASE, ThreeSide.LEFT); - boolean unchangedRight = equality.equals(ThreeSide.BASE, ThreeSide.RIGHT); + boolean unchangedLeft = equality.test(ThreeSide.BASE, ThreeSide.LEFT); + boolean unchangedRight = equality.test(ThreeSide.BASE, ThreeSide.RIGHT); if (unchangedLeft && unchangedRight) { assert trueEquality != null; - boolean trueUnchangedLeft = trueEquality.equals(ThreeSide.BASE, ThreeSide.LEFT); - boolean trueUnchangedRight = trueEquality.equals(ThreeSide.BASE, ThreeSide.RIGHT); + boolean trueUnchangedLeft = trueEquality.test(ThreeSide.BASE, ThreeSide.LEFT); + boolean trueUnchangedRight = trueEquality.test(ThreeSide.BASE, ThreeSide.RIGHT); assert !trueUnchangedLeft || !trueUnchangedRight; return new MergeConflictType(TextDiffType.MODIFIED, !trueUnchangedLeft, !trueUnchangedRight); } @@ -1347,7 +1344,7 @@ public final class DiffUtil { if (unchangedLeft) return new MergeConflictType(isRightEmpty ? TextDiffType.DELETED : TextDiffType.MODIFIED, false, true); if (unchangedRight) return new MergeConflictType(isLeftEmpty ? TextDiffType.DELETED : TextDiffType.MODIFIED, true, false); - boolean equalModifications = equality.equals(ThreeSide.LEFT, ThreeSide.RIGHT); + boolean equalModifications = equality.test(ThreeSide.LEFT, ThreeSide.RIGHT); if (equalModifications) { return new MergeConflictType(TextDiffType.MODIFIED, true, true); } @@ -1465,7 +1462,7 @@ public final class DiffUtil { @NotNull private static MergeConflictType getLeftToRightDiffType(@NotNull Condition emptiness, - @NotNull Equality equality) { + @NotNull BiPredicate equality) { boolean isLeftEmpty = emptiness.value(ThreeSide.LEFT); boolean isBaseEmpty = emptiness.value(ThreeSide.BASE); boolean isRightEmpty = emptiness.value(ThreeSide.RIGHT); @@ -1487,8 +1484,8 @@ public final class DiffUtil { return new MergeConflictType(TextDiffType.MODIFIED, true, true); } else { // -==, ==-, === - boolean unchangedLeft = equality.equals(ThreeSide.BASE, ThreeSide.LEFT); - boolean unchangedRight = equality.equals(ThreeSide.BASE, ThreeSide.RIGHT); + boolean unchangedLeft = equality.test(ThreeSide.BASE, ThreeSide.LEFT); + boolean unchangedRight = equality.test(ThreeSide.BASE, ThreeSide.RIGHT); assert !unchangedLeft || !unchangedRight; if (unchangedLeft) { @@ -1728,8 +1725,8 @@ public final class DiffUtil { @NotNull private static List getNotificationProviders(@NotNull UserDataHolder holder) { - List providers = notNullize(holder.getUserData(DiffUserDataKeys.NOTIFICATION_PROVIDERS)); - List components = notNullize(holder.getUserData(DiffUserDataKeys.NOTIFICATIONS)); + List providers = ContainerUtil.notNullize(holder.getUserData(DiffUserDataKeys.NOTIFICATION_PROVIDERS)); + List components = ContainerUtil.notNullize(holder.getUserData(DiffUserDataKeys.NOTIFICATIONS)); return ContainerUtil.concat(providers, ContainerUtil.map(components, component -> (viewer) -> component)); } diff --git a/platform/lvcs-impl/src/com/intellij/history/integration/ui/views/RevisionsList.java b/platform/lvcs-impl/src/com/intellij/history/integration/ui/views/RevisionsList.java index 3b06147ceb60..7df1fb214b88 100644 --- a/platform/lvcs-impl/src/com/intellij/history/integration/ui/views/RevisionsList.java +++ b/platform/lvcs-impl/src/com/intellij/history/integration/ui/views/RevisionsList.java @@ -1,5 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.history.integration.ui.views; import com.intellij.history.core.revisions.Revision; @@ -27,7 +26,6 @@ import com.intellij.util.ui.JBInsets; import com.intellij.util.ui.TextTransferable; import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.accessibility.AccessibleContextUtil; -import gnu.trove.THashMap; import gnu.trove.THashSet; import org.jetbrains.annotations.NotNull; @@ -45,7 +43,7 @@ import java.awt.*; import java.util.List; import java.util.*; -public class RevisionsList { +public final class RevisionsList { public static final int RECENT_PERIOD = 12; private final JBTable table; @@ -112,7 +110,7 @@ public class RevisionsList { Date today = new Date(); - Map periods = new THashMap<>(); + Map periods = new HashMap<>(); for (int i = 0; i < newRevs.size(); i++) { RevisionItem each = newRevs.get(i); boolean recent = today.getTime() - each.revision.getTimestamp() < 1000 * 60 * 60 * RECENT_PERIOD; diff --git a/platform/platform-api/src/com/intellij/ide/browsers/chrome/ChromeSettings.java b/platform/platform-api/src/com/intellij/ide/browsers/chrome/ChromeSettings.java index 8dca7c822b81..df9b22d99cfd 100644 --- a/platform/platform-api/src/com/intellij/ide/browsers/chrome/ChromeSettings.java +++ b/platform/platform-api/src/com/intellij/ide/browsers/chrome/ChromeSettings.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.browsers.chrome; import com.intellij.ide.browsers.BrowserSpecificSettings; @@ -9,13 +9,11 @@ import com.intellij.util.execution.ParametersListUtil; import com.intellij.util.xmlb.annotations.Tag; import com.intellij.util.xmlb.annotations.XMap; import gnu.trove.THashMap; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Objects; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.*; + public final class ChromeSettings extends BrowserSpecificSettings { public static final String USER_DATA_DIR_ARG = "--user-data-dir="; public static final String NO_FIRST_RUN_ARG = "--no-first-run"; @@ -24,7 +22,7 @@ public final class ChromeSettings extends BrowserSpecificSettings { private @Nullable String myCommandLineOptions; private @Nullable String myUserDataDirectoryPath; private boolean myUseCustomProfile; - private @NotNull Map myEnvironmentVariables = new THashMap<>(); + private @NotNull Map myEnvironmentVariables = new HashMap<>(); public ChromeSettings() { } diff --git a/platform/platform-api/src/com/intellij/util/config/ExternalizablePropertyContainer.java b/platform/platform-api/src/com/intellij/util/config/ExternalizablePropertyContainer.java index 1b5551a0a997..955e51801ec0 100644 --- a/platform/platform-api/src/com/intellij/util/config/ExternalizablePropertyContainer.java +++ b/platform/platform-api/src/com/intellij/util/config/ExternalizablePropertyContainer.java @@ -1,23 +1,23 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util.config; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.JDOMUtil; import com.intellij.util.SmartList; -import gnu.trove.THashMap; import org.jdom.Element; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; public final class ExternalizablePropertyContainer extends AbstractProperty.AbstractPropertyContainer { private static final Logger LOG = Logger.getInstance(ExternalizablePropertyContainer.class); - private final Map myValues = new THashMap<>(); - private final Map myExternalizers = new THashMap<>(); + private final Map myValues = new HashMap<>(); + private final Map myExternalizers = new HashMap<>(); public void registerProperty(AbstractProperty property, Externalizer externalizer) { String name = property.getName(); @@ -39,7 +39,7 @@ public final class ExternalizablePropertyContainer extends AbstractProperty.Abst } public void readExternal(@NotNull Element element) { - Map propertyByName = new THashMap<>(); + Map propertyByName = new HashMap<>(); for (AbstractProperty abstractProperty : myExternalizers.keySet()) { propertyByName.put(abstractProperty.getName(), abstractProperty); } diff --git a/platform/platform-tests/testSrc/com/intellij/psi/tree/IElementTypeTest.java b/platform/platform-tests/testSrc/com/intellij/psi/tree/IElementTypeTest.java index 6d8a0bd890e8..1b876e940677 100644 --- a/platform/platform-tests/testSrc/com/intellij/psi/tree/IElementTypeTest.java +++ b/platform/platform-tests/testSrc/com/intellij/psi/tree/IElementTypeTest.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.tree; import com.intellij.lang.*; @@ -11,7 +11,6 @@ import com.intellij.psi.PsiLanguageInjectionHost; import com.intellij.psi.impl.source.tree.CompositeElement; import com.intellij.testFramework.PlatformTestUtil; import com.intellij.testFramework.fixtures.BasePlatformTestCase; -import gnu.trove.THashMap; import gnu.trove.TObjectIntHashMap; import java.util.*; @@ -28,7 +27,7 @@ public class IElementTypeTest extends BasePlatformTestCase { List extensions = Extensions.getRootArea().getExtensionPoint(LanguageParserDefinitions.INSTANCE.getName()).getExtensionList(); LOG.debug("ParserDefinitions: " + extensions.size()); - THashMap languageMap = new THashMap<>(); + Map languageMap = new HashMap<>(); languageMap.put(Language.ANY, "platform"); final TObjectIntHashMap map = new TObjectIntHashMap<>(); for (LanguageExtensionPoint e : extensions) { diff --git a/platform/platform-tests/testSrc/com/intellij/ui/SvgRenderer.kt b/platform/platform-tests/testSrc/com/intellij/ui/SvgRenderer.kt index a38dfeaa0c5e..05e4c53ba584 100644 --- a/platform/platform-tests/testSrc/com/intellij/ui/SvgRenderer.kt +++ b/platform/platform-tests/testSrc/com/intellij/ui/SvgRenderer.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ui import com.intellij.icons.AllIcons @@ -9,7 +9,6 @@ import com.intellij.openapi.util.io.FileUtilRt import com.intellij.openapi.util.text.StringUtilRt import com.intellij.testFramework.assertions.Assertions.assertThat import com.intellij.util.ui.LafIconLookup -import gnu.trove.THashMap import org.apache.batik.anim.dom.SVGDOMImplementation import org.apache.batik.dom.GenericDOMImplementation import org.apache.batik.svggen.* @@ -87,7 +86,7 @@ internal class SvgRenderer(val svgFileDir: Path) { } context.idGenerator = object : SVGIDGenerator() { - private val prefixMap = THashMap() + private val prefixMap = HashMap() override fun generateID(prefix: String): String { val info = prefixMap.getOrPut(prefix) { PrefixInfo() } diff --git a/platform/platform-tests/testSrc/com/intellij/util/graph/CollectTest.java b/platform/platform-tests/testSrc/com/intellij/util/graph/CollectTest.java index 4f3f12a9744d..1186083ba491 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/graph/CollectTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/graph/CollectTest.java @@ -1,16 +1,12 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util.graph; import com.intellij.util.ArrayUtilRt; -import gnu.trove.THashMap; import gnu.trove.THashSet; import org.jetbrains.annotations.NotNull; import org.junit.Test; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import static org.assertj.core.api.Assertions.assertThat; @@ -18,7 +14,7 @@ public class CollectTest extends GraphTestCase { @Test public void testSimple() { - Map graph = new THashMap<>(); + Map graph = new HashMap<>(); graph.put("a", "b"); graph.put("b", "c"); graph.put("c", "c"); @@ -27,7 +23,7 @@ public class CollectTest extends GraphTestCase { @Test public void testFull() { - Map graph = new THashMap<>(); + Map graph = new HashMap<>(); graph.put("a", "bcd"); graph.put("b", "acd"); graph.put("c", "abd"); @@ -37,7 +33,7 @@ public class CollectTest extends GraphTestCase { @Test public void testVisitedNode() { - Map graph = new THashMap<>(); + Map graph = new HashMap<>(); graph.put("a", "bcd"); graph.put("b", "acd"); graph.put("c", "abd"); @@ -50,7 +46,7 @@ public class CollectTest extends GraphTestCase { @Test public void testBigGraph() { - Map graph = new THashMap<>(); + Map graph = new HashMap<>(); List answer = new ArrayList<>(); for (int i = 0; i < 10000; ++i) { graph.put(String.valueOf((char)i), String.valueOf((char)(i + 1))); diff --git a/platform/script-debugger/debugger-ui/intellij.platform.scriptDebugger.ui.iml b/platform/script-debugger/debugger-ui/intellij.platform.scriptDebugger.ui.iml index 0117665cd258..7145da256e35 100644 --- a/platform/script-debugger/debugger-ui/intellij.platform.scriptDebugger.ui.iml +++ b/platform/script-debugger/debugger-ui/intellij.platform.scriptDebugger.ui.iml @@ -16,7 +16,6 @@ - diff --git a/platform/script-debugger/debugger-ui/src/com/intellij/javascript/debugger/NameMapper.kt b/platform/script-debugger/debugger-ui/src/com/intellij/javascript/debugger/NameMapper.kt index a2cde0d904a0..28e7e03f6ab6 100644 --- a/platform/script-debugger/debugger-ui/src/com/intellij/javascript/debugger/NameMapper.kt +++ b/platform/script-debugger/debugger-ui/src/com/intellij/javascript/debugger/NameMapper.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.javascript.debugger import com.google.common.base.CharMatcher @@ -8,7 +8,6 @@ import com.intellij.openapi.vfs.VirtualFile import com.intellij.psi.PsiElement import com.intellij.psi.PsiNamedElement import com.intellij.psi.SyntaxTraverser -import gnu.trove.THashMap import org.jetbrains.debugger.sourcemap.MappingEntry import org.jetbrains.debugger.sourcemap.Mappings import org.jetbrains.debugger.sourcemap.MappingsProcessorInLine @@ -123,7 +122,7 @@ open class NameMapper(private val document: Document, private val transpiledDocu fun addMapping(generatedName: String, sourceName: String) { if (rawNameToSource == null) { - rawNameToSource = THashMap() + rawNameToSource = HashMap() } rawNameToSource!!.put(generatedName, sourceName) } @@ -149,7 +148,6 @@ open class NameMapper(private val document: Document, private val transpiledDocu } return document.immutableCharSequence.subSequence(lineStartOffset + sourceEntry.generatedColumn, endOffset) } - } fun warnSeveralMapping(element: PsiElement) { diff --git a/platform/script-debugger/protocol/protocol-reader-runtime/intellij.platform.scriptDebugger.protocolReaderRuntime.iml b/platform/script-debugger/protocol/protocol-reader-runtime/intellij.platform.scriptDebugger.protocolReaderRuntime.iml index 311540657200..11cd779e1f84 100644 --- a/platform/script-debugger/protocol/protocol-reader-runtime/intellij.platform.scriptDebugger.protocolReaderRuntime.iml +++ b/platform/script-debugger/protocol/protocol-reader-runtime/intellij.platform.scriptDebugger.protocolReaderRuntime.iml @@ -12,7 +12,6 @@ - \ No newline at end of file diff --git a/platform/script-debugger/protocol/protocol-reader-runtime/src/org/jetbrains/jsonProtocol/JsonReaders.java b/platform/script-debugger/protocol/protocol-reader-runtime/src/org/jetbrains/jsonProtocol/JsonReaders.java index a68aac796f83..46ecffa58f6c 100644 --- a/platform/script-debugger/protocol/protocol-reader-runtime/src/org/jetbrains/jsonProtocol/JsonReaders.java +++ b/platform/script-debugger/protocol/protocol-reader-runtime/src/org/jetbrains/jsonProtocol/JsonReaders.java @@ -1,19 +1,16 @@ +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.jsonProtocol; import com.google.gson.stream.JsonToken; import com.intellij.util.ArrayUtilRt; -import gnu.trove.TDoubleArrayList; -import gnu.trove.THashMap; -import gnu.trove.TIntArrayList; -import gnu.trove.TLongArrayList; +import it.unimi.dsi.fastutil.doubles.DoubleArrayList; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.longs.LongArrayList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.io.JsonReaderEx; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; +import java.util.*; public final class JsonReaders { public static final ObjectFactory STRING_OBJECT_FACTORY = new ObjectFactory<>() { @@ -30,9 +27,9 @@ public final class JsonReaders { return new MapFactory<>(valueFactory); } - private static void checkIsNull(JsonReaderEx reader, String fieldName) { + private static void checkIsNull(JsonReaderEx reader) { if (reader.peek() == JsonToken.NULL) { - throw new RuntimeException("Field is not nullable" + (fieldName == null ? "" : (": " + fieldName))); + throw new RuntimeException("Field is not nullable" + ""); } } @@ -124,7 +121,7 @@ public final class JsonReaders { return Collections.emptyMap(); } - Map map = new THashMap<>(); + Map map = new HashMap<>(); while (reader.hasNext()) { if (factory == null) { //noinspection unchecked @@ -165,7 +162,7 @@ public final class JsonReaders { } public static Map nextObject(JsonReaderEx reader) { - Map map = new THashMap<>(); + Map map = new HashMap<>(); while (reader.hasNext()) { map.put(reader.nextName(), read(reader)); } @@ -207,58 +204,58 @@ public final class JsonReaders { } public static long[] readLongArray(JsonReaderEx reader) { - checkIsNull(reader, null); + checkIsNull(reader); reader.beginArray(); if (!reader.hasNext()) { reader.endArray(); return ArrayUtilRt.EMPTY_LONG_ARRAY; } - TLongArrayList result = new TLongArrayList(); + LongArrayList result = new LongArrayList(); do { result.add(reader.nextLong()); } while (reader.hasNext()); reader.endArray(); - return result.toNativeArray(); + return result.toLongArray(); } public static double[] readDoubleArray(JsonReaderEx reader) { - checkIsNull(reader, null); + checkIsNull(reader); reader.beginArray(); if (!reader.hasNext()) { reader.endArray(); return new double[]{0}; } - TDoubleArrayList result = new TDoubleArrayList(); + DoubleArrayList result = new DoubleArrayList(); do { result.add(reader.nextDouble()); } while (reader.hasNext()); reader.endArray(); - return result.toNativeArray(); + return result.toDoubleArray(); } public static int[] readIntArray(JsonReaderEx reader) { - checkIsNull(reader, null); + checkIsNull(reader); reader.beginArray(); if (!reader.hasNext()) { reader.endArray(); return ArrayUtilRt.EMPTY_INT_ARRAY; } - TIntArrayList result = new TIntArrayList(); + IntArrayList result = new IntArrayList(); do { result.add(reader.nextInt()); } while (reader.hasNext()); reader.endArray(); - return result.toNativeArray(); + return result.toIntArray(); } public static List readIntStringPairs(JsonReaderEx reader) { - checkIsNull(reader, null); + checkIsNull(reader); reader.beginArray(); if (!reader.hasNext()) { reader.endArray(); diff --git a/platform/script-debugger/protocol/protocol-reader-runtime/src/org/jetbrains/jsonProtocol/OutMessage.kt b/platform/script-debugger/protocol/protocol-reader-runtime/src/org/jetbrains/jsonProtocol/OutMessage.kt index 5d8fdc5405aa..e2e7875f3133 100644 --- a/platform/script-debugger/protocol/protocol-reader-runtime/src/org/jetbrains/jsonProtocol/OutMessage.kt +++ b/platform/script-debugger/protocol/protocol-reader-runtime/src/org/jetbrains/jsonProtocol/OutMessage.kt @@ -1,14 +1,14 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.jsonProtocol import com.google.gson.stream.JsonWriter import com.intellij.util.containers.isNullOrEmpty import com.intellij.util.io.writeUtf8 -import gnu.trove.TIntArrayList -import gnu.trove.TIntHashSet import io.netty.buffer.ByteBuf import io.netty.buffer.ByteBufAllocator import io.netty.buffer.ByteBufUtf8Writer +import it.unimi.dsi.fastutil.ints.IntList +import it.unimi.dsi.fastutil.ints.IntSet import org.jetbrains.io.JsonUtil open class OutMessage { @@ -70,23 +70,23 @@ open class OutMessage { writer.endArray() } - fun writeIntSet(name: String, value: TIntHashSet) { + fun writeIntSet(name: String, value: IntSet) { beginArguments() writer.name(name) writer.beginArray() - value.forEach { value -> - writer.value(value.toLong()) - true + val iterator = value.iterator() + while (iterator.hasNext()) { + writer.value(iterator.nextInt().toLong()) } writer.endArray() } - fun writeIntList(name: String, value: TIntArrayList) { + fun writeIntList(name: String, value: IntList) { beginArguments() writer.name(name) writer.beginArray() - for (i in 0..value.size() - 1) { - writer.value(value.getQuick(i).toLong()) + for (i in 0 until value.size) { + writer.value(value.getInt(i).toLong()) } writer.endArray() } diff --git a/platform/script-debugger/protocol/protocol-reader/intellij.javascript.protocolReader.iml b/platform/script-debugger/protocol/protocol-reader/intellij.javascript.protocolReader.iml index 184972c2cdc0..f28360b611f7 100644 --- a/platform/script-debugger/protocol/protocol-reader/intellij.javascript.protocolReader.iml +++ b/platform/script-debugger/protocol/protocol-reader/intellij.javascript.protocolReader.iml @@ -7,7 +7,6 @@ - diff --git a/platform/script-debugger/protocol/protocol-reader/src/FieldProcessor.kt b/platform/script-debugger/protocol/protocol-reader/src/FieldProcessor.kt index 9bd7ee14cb4d..698d221445ab 100644 --- a/platform/script-debugger/protocol/protocol-reader/src/FieldProcessor.kt +++ b/platform/script-debugger/protocol/protocol-reader/src/FieldProcessor.kt @@ -1,7 +1,7 @@ +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.protocolReader import com.intellij.openapi.util.text.StringUtil -import gnu.trove.THashSet import org.jetbrains.jsonProtocol.JsonField import org.jetbrains.jsonProtocol.JsonSubtypeCasting import org.jetbrains.jsonProtocol.Optional @@ -35,12 +35,12 @@ internal class FieldProcessor(private val reader: InterfaceReader, typeClass: Cl init { val methods = typeClass.methods // todo sort by source location - Arrays.sort(methods, { o1, o2 -> o1.name.compareTo(o2.name) }) + Arrays.sort(methods) { o1, o2 -> o1.name.compareTo(o2.name) } - val skippedNames = THashSet() + val skippedNames = HashSet() for (method in methods) { - val annotation = method.getAnnotation(JsonField::class.java) - if (annotation != null && !annotation.primitiveValue.isEmpty()) { + val annotation = method.getAnnotation(JsonField::class.java) + if (annotation != null && annotation.primitiveValue.isNotEmpty()) { skippedNames.add(annotation.primitiveValue) skippedNames.add("${annotation.primitiveValue}Type") } @@ -91,7 +91,7 @@ internal class FieldProcessor(private val reader: InterfaceReader, typeClass: Cl } private fun createMethodHandler(member: KCallable<*>, method: Method, skipRead: Boolean): MethodHandler? { - var protocolName = member.annotation()?.name ?: member.name + val protocolName = member.annotation()?.name ?: member.name val genericReturnType = member.returnType.javaType val isNotNull: Boolean val isPrimitive = if (genericReturnType is Class<*>) genericReturnType.isPrimitive else genericReturnType !is ParameterizedType @@ -176,7 +176,7 @@ internal class FieldProcessor(private val reader: InterfaceReader, typeClass: Cl fieldTypeInfo = {scope, out -> fieldTypeParser.appendInternalValueTypeName(scope, out)} } else { - fieldTypeInfo = {scope, out -> fieldTypeParser.appendFinishedValueTypeName(out)} + fieldTypeInfo = { _, out -> fieldTypeParser.appendFinishedValueTypeName(out)} } val binding = VolatileFieldBinding(position, fieldTypeInfo) volatileFields.add(binding) diff --git a/platform/script-debugger/protocol/protocol-reader/src/GlobalScope.kt b/platform/script-debugger/protocol/protocol-reader/src/GlobalScope.kt index 13ffceb36c93..be4fd806d013 100644 --- a/platform/script-debugger/protocol/protocol-reader/src/GlobalScope.kt +++ b/platform/script-debugger/protocol/protocol-reader/src/GlobalScope.kt @@ -1,9 +1,6 @@ +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.protocolReader -import gnu.trove.THashMap -import gnu.trove.THashSet -import java.util.* - internal fun GlobalScope(typeWriters: Collection?>, basePackages: Collection, String>>) = GlobalScope(State(typeWriters, basePackages)) internal open class GlobalScope(val state: State) { @@ -19,15 +16,14 @@ internal open class GlobalScope(val state: State) { } internal class State(typeWriters: Collection?>, private val basePackages: Collection, String>>) { - private var typeToName: Map, String> - private val typesWithFactories = THashSet>() - val typesWithFactoriesList = ArrayList>(); + private var typeToName: Map?, String> + private val typesWithFactories = HashSet>() + val typesWithFactoriesList = ArrayList>() init { - var uniqueCode = 0 - val result = THashMap, String>(typeWriters.size) - for (handler in typeWriters) { - val conflict = result.put(handler, "M${Integer.toString(uniqueCode++, Character.MAX_RADIX)}") + val result = HashMap?, String>(typeWriters.size) + for ((uniqueCode, handler) in typeWriters.withIndex()) { + val conflict = result.put(handler, "M${uniqueCode.toString(Character.MAX_RADIX)}") if (conflict != null) { throw RuntimeException() } diff --git a/platform/script-debugger/protocol/protocol-reader/src/InterfaceReader.kt b/platform/script-debugger/protocol/protocol-reader/src/InterfaceReader.kt index 88162cb7247e..77b45a773d67 100644 --- a/platform/script-debugger/protocol/protocol-reader/src/InterfaceReader.kt +++ b/platform/script-debugger/protocol/protocol-reader/src/InterfaceReader.kt @@ -1,6 +1,6 @@ +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.protocolReader -import gnu.trove.THashSet import org.jetbrains.io.JsonReaderEx import org.jetbrains.jsonProtocol.JsonField import org.jetbrains.jsonProtocol.JsonSubtype @@ -10,7 +10,6 @@ import java.lang.reflect.Method import java.lang.reflect.ParameterizedType import java.lang.reflect.Type import java.lang.reflect.WildcardType -import java.util.* import kotlin.reflect.KCallable internal fun InterfaceReader(protocolInterfaces: List>): InterfaceReader { @@ -64,7 +63,7 @@ internal fun createHandler(typeToTypeHandler: LinkedHashMap, TypeWriter } internal class InterfaceReader(val typeToTypeHandler: LinkedHashMap, TypeWriter<*>?>) { - val processed = THashSet>() + val processed = HashSet>() private val refs = ArrayList>() val subtypeCasters = ArrayList() diff --git a/platform/script-debugger/protocol/protocol-reader/src/ReaderGenerator.kt b/platform/script-debugger/protocol/protocol-reader/src/ReaderGenerator.kt index 7397d6fa61a0..032d07394d27 100644 --- a/platform/script-debugger/protocol/protocol-reader/src/ReaderGenerator.kt +++ b/platform/script-debugger/protocol/protocol-reader/src/ReaderGenerator.kt @@ -1,11 +1,10 @@ +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.protocolReader -import gnu.trove.THashMap import java.nio.file.Paths -import java.util.* class GenerateConfiguration(val packageName: String, val className: String, readerRootClass: Class, protocolInterfaces: List>, basePackagesMap: Map, String>? = null) { - val basePackagesMap: List, String>> = if (basePackagesMap == null) listOf, String>>() else listOf(basePackagesMap) + val basePackagesMap: List, String>> = if (basePackagesMap == null) listOf() else listOf(basePackagesMap) internal val typeToTypeHandler = InterfaceReader(protocolInterfaces).go() internal val root = ReaderRoot(readerRootClass, typeToTypeHandler) @@ -63,7 +62,7 @@ private class StringParam { fun buildParserMap(configuration: GenerateConfiguration<*>): Map, String> { val fileScope = generate(configuration, StringBuilder()) - val typeToImplClassName = THashMap, String>() + val typeToImplClassName = HashMap, String>() for (typeWriter in configuration.typeToTypeHandler.values) { typeToImplClassName.put(typeWriter!!.typeClass, "${configuration.packageName}.${configuration.className}.${fileScope.getTypeImplShortName(typeWriter)}") } diff --git a/platform/script-debugger/protocol/protocol-reader/src/ReaderRoot.kt b/platform/script-debugger/protocol/protocol-reader/src/ReaderRoot.kt index c00abbe35f0a..7323bb652876 100644 --- a/platform/script-debugger/protocol/protocol-reader/src/ReaderRoot.kt +++ b/platform/script-debugger/protocol/protocol-reader/src/ReaderRoot.kt @@ -1,6 +1,6 @@ +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.protocolReader -import gnu.trove.THashSet import org.jetbrains.io.JsonReaderEx import org.jetbrains.jsonProtocol.JsonParseMethod import java.lang.reflect.Method @@ -8,8 +8,8 @@ import java.lang.reflect.ParameterizedType import java.util.* internal class ReaderRoot(val type: Class, private val typeToTypeHandler: LinkedHashMap, TypeWriter<*>?>) { - private val visitedInterfaces = THashSet>(1) - val methodMap = LinkedHashMap() + private val visitedInterfaces = HashSet>(1) + private val methodMap = LinkedHashMap() init { readInterfaceRecursive(type) diff --git a/platform/smRunner/intellij.platform.smRunner.iml b/platform/smRunner/intellij.platform.smRunner.iml index 643f647dfcc2..830ebcff773d 100644 --- a/platform/smRunner/intellij.platform.smRunner.iml +++ b/platform/smRunner/intellij.platform.smRunner.iml @@ -20,7 +20,6 @@ - \ No newline at end of file diff --git a/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/OutputEventSplitterTest.java b/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/OutputEventSplitterTest.java index af8ac46cb78f..a945798046b8 100644 --- a/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/OutputEventSplitterTest.java +++ b/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/OutputEventSplitterTest.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.execution.testframework.sm; import com.intellij.execution.impl.ConsoleBuffer; @@ -25,7 +11,6 @@ import com.intellij.openapi.util.text.StringUtil; import com.intellij.testFramework.LightPlatformTestCase; import com.intellij.testFramework.PlatformTestUtil; import com.intellij.util.containers.ContainerUtil; -import gnu.trove.THashMap; import jetbrains.buildServer.messages.serviceMessages.ServiceMessage; import org.hamcrest.core.IsCollectionContaining; import org.jetbrains.annotations.NotNull; @@ -52,7 +37,7 @@ public class OutputEventSplitterTest extends LightPlatformTestCase { ); private OutputEventSplitter mySplitter; - private final Map myOutput = new THashMap<>(); + private final Map myOutput = new HashMap<>(); @Override protected void setUp() throws Exception { diff --git a/platform/testFramework/src/com/intellij/testFramework/ExpectedHighlightingData.java b/platform/testFramework/src/com/intellij/testFramework/ExpectedHighlightingData.java index 75b4e6bb533b..5902bece0112 100644 --- a/platform/testFramework/src/com/intellij/testFramework/ExpectedHighlightingData.java +++ b/platform/testFramework/src/com/intellij/testFramework/ExpectedHighlightingData.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.testFramework; import com.intellij.AbstractBundle; @@ -29,7 +29,6 @@ import com.intellij.util.ArrayUtilRt; import com.intellij.util.DocumentUtil; import com.intellij.util.ThreeState; import com.intellij.util.containers.ContainerUtil; -import gnu.trove.THashMap; import gnu.trove.THashSet; import gnu.trove.TObjectHashingStrategy; import org.intellij.lang.annotations.JdkConstants; @@ -88,7 +87,7 @@ public class ExpectedHighlightingData { } private final Map myHighlightingTypes = new LinkedHashMap<>(); - private final Map> myLineMarkerInfos = new THashMap<>(); + private final Map> myLineMarkerInfos = new HashMap<>(); private final Document myDocument; private final String myText; private boolean myIgnoreExtraHighlighting; diff --git a/platform/util/src/com/intellij/util/SmartFMap.java b/platform/util/src/com/intellij/util/SmartFMap.java index 4ceac5e2416a..6660239a65fd 100644 --- a/platform/util/src/com/intellij/util/SmartFMap.java +++ b/platform/util/src/com/intellij/util/SmartFMap.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util; import com.intellij.openapi.util.Comparing; @@ -49,7 +49,7 @@ public final class SmartFMap implements Map { } } if (array.length == 2 * ARRAY_THRESHOLD) { - Map map = new THashMap<>(); + Map map = new HashMap<>(); for (int i = 0; i < array.length; i += 2) { map.put(array[i], array[i + 1]); } @@ -65,7 +65,7 @@ public final class SmartFMap implements Map { public SmartFMap minus(@NotNull K key) { if (myMap instanceof Map) { - Map newMap = new THashMap<>(asMap()); + Map newMap = new HashMap<>(asMap()); newMap.remove(key); if (newMap.size() <= ARRAY_THRESHOLD) { Object[] newArray = new Object[newMap.size() * 2]; diff --git a/platform/util/src/com/intellij/util/io/FileChannelUtil.java b/platform/util/src/com/intellij/util/io/FileChannelUtil.java index c98dadb6a045..3531947bd95c 100644 --- a/platform/util/src/com/intellij/util/io/FileChannelUtil.java +++ b/platform/util/src/com/intellij/util/io/FileChannelUtil.java @@ -1,8 +1,8 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util.io; import com.intellij.openapi.diagnostic.Logger; -import com.intellij.util.ExceptionUtil; +import com.intellij.util.ExceptionUtilRt; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -59,7 +59,8 @@ final class FileChannelUtil { } } catch (Throwable e) { - ExceptionUtil.rethrow(e); + ExceptionUtilRt.rethrowUnchecked(e); + throw new RuntimeException(e); } return channel; } diff --git a/platform/util/src/com/intellij/util/io/OpenChannelsCache.java b/platform/util/src/com/intellij/util/io/OpenChannelsCache.java index 2a6fe3433e9f..88dd2b673bdf 100644 --- a/platform/util/src/com/intellij/util/io/OpenChannelsCache.java +++ b/platform/util/src/com/intellij/util/io/OpenChannelsCache.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util.io; import org.jetbrains.annotations.ApiStatus; @@ -12,7 +12,7 @@ import java.nio.file.StandardOpenOption; import java.util.*; @ApiStatus.Internal -class OpenChannelsCache { // TODO: Will it make sense to have a background thread, that flushes the cache by timeout? +final class OpenChannelsCache { // TODO: Will it make sense to have a background thread, that flushes the cache by timeout? private final int myCacheSizeLimit; @NotNull private final Set myOpenOptions; @@ -88,7 +88,7 @@ class OpenChannelsCache { // TODO: Will it make sense to have a background threa } } - private static class ChannelDescriptor { + private static final class ChannelDescriptor { private int lockCount = 0; private final FileChannel myChannel; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesGroupingSupport.kt b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesGroupingSupport.kt index 52ab1bfb1170..b5e1bbbc1d6a 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesGroupingSupport.kt +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesGroupingSupport.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs.changes.ui import com.intellij.openapi.actionSystem.DataKey @@ -8,7 +8,6 @@ import com.intellij.openapi.util.KeyedExtensionFactory import com.intellij.openapi.vcs.changes.ui.ChangesGroupingSupport.Companion.DIRECTORY_GROUPING import com.intellij.openapi.vcs.changes.ui.ChangesGroupingSupport.Companion.MODULE_GROUPING import com.intellij.openapi.vcs.changes.ui.ChangesGroupingSupport.Companion.REPOSITORY_GROUPING -import gnu.trove.THashMap import org.jetbrains.annotations.NonNls import java.beans.PropertyChangeListener import java.beans.PropertyChangeSupport @@ -24,7 +23,7 @@ open class ChangesGroupingSupport(val project: Project, source: Any, val showCon get() = groupingConfig.filterValues { it }.keys init { - groupingConfig = THashMap() + groupingConfig = HashMap() for (epBean in ChangesGroupingPolicyFactory.EP_NAME.extensionList) { if (epBean.key != null) { groupingConfig.put(epBean.key, false) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/checkin/CodeAnalysisBeforeCheckinShowOnlyNew.kt b/platform/vcs-impl/src/com/intellij/openapi/vcs/checkin/CodeAnalysisBeforeCheckinShowOnlyNew.kt index c6e4373f4df2..79045207359a 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/checkin/CodeAnalysisBeforeCheckinShowOnlyNew.kt +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/checkin/CodeAnalysisBeforeCheckinShowOnlyNew.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs.checkin import com.intellij.codeInsight.CodeSmellInfo @@ -23,7 +23,6 @@ import com.intellij.openapi.vfs.VirtualFile import com.intellij.openapi.vfs.VirtualFileManager import com.intellij.psi.impl.PsiDocumentManagerImpl import com.intellij.util.containers.MultiMap -import gnu.trove.THashMap internal object CodeAnalysisBeforeCheckinShowOnlyNew { val LOG = logger() @@ -34,7 +33,7 @@ internal object CodeAnalysisBeforeCheckinShowOnlyNew { val codeSmellDetector = CodeSmellDetector.getInstance(project) val newCodeSmells = codeSmellDetector.findCodeSmells(selectedFiles) val location2CodeSmell = MultiMap, CodeSmellInfo>() - val fileToChanges: MutableMap> = THashMap() + val fileToChanges: MutableMap> = HashMap() val changeListManager = ChangeListManager.getInstance(project) val changes4Update = changeListManager.allChanges val fileDocumentManager = FileDocumentManager.getInstance() diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/AbstractCommonUpdateAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/AbstractCommonUpdateAction.java index 24b6ef5456e2..2efa649e65d1 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/AbstractCommonUpdateAction.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/AbstractCommonUpdateAction.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs.update; import com.intellij.configurationStore.StoreReloadManager; @@ -39,7 +39,6 @@ import com.intellij.util.containers.MultiMap; import com.intellij.util.ui.OptionsDialog; import com.intellij.vcs.ViewUpdateInfoNotification; import com.intellij.vcsUtil.VcsUtil; -import gnu.trove.THashMap; import org.jetbrains.annotations.*; import java.io.File; @@ -180,7 +179,7 @@ public abstract class AbstractCommonUpdateAction extends AbstractVcsAction imple } } - final Map> result = new THashMap<>(); + final Map> result = new HashMap<>(); for (Map.Entry> entry : resultPrep.entrySet()) { AbstractVcs vcs = entry.getKey(); result.put(vcs, vcs.filterUniqueRoots(new ArrayList<>(entry.getValue()), FilePath::getVirtualFile)); diff --git a/platform/xdebugger-testFramework/intellij.platform.debugger.testFramework.iml b/platform/xdebugger-testFramework/intellij.platform.debugger.testFramework.iml index a151df035ec7..ec94fae22660 100644 --- a/platform/xdebugger-testFramework/intellij.platform.debugger.testFramework.iml +++ b/platform/xdebugger-testFramework/intellij.platform.debugger.testFramework.iml @@ -12,7 +12,6 @@ - \ No newline at end of file diff --git a/plugins/gradle/java/src/config/GradleResourceCompilerConfigurationGenerator.java b/plugins/gradle/java/src/config/GradleResourceCompilerConfigurationGenerator.java index 2dd1baff59b0..ce3a5235ba77 100644 --- a/plugins/gradle/java/src/config/GradleResourceCompilerConfigurationGenerator.java +++ b/plugins/gradle/java/src/config/GradleResourceCompilerConfigurationGenerator.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.gradle.config; import com.intellij.ProjectTopics; @@ -26,7 +26,6 @@ import com.intellij.util.Function; import com.intellij.util.JdomKt; import com.intellij.util.containers.FactoryMap; import com.intellij.util.xmlb.XmlSerializer; -import gnu.trove.THashMap; import org.jdom.Element; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -97,7 +96,7 @@ public class GradleResourceCompilerConfigurationGenerator { boolean configurationUpdateRequired = context.isRebuild() || !gradleConfigFile.exists(); - final Map affectedConfigurationHash = new THashMap<>(); + final Map affectedConfigurationHash = new HashMap<>(); for (Map.Entry entry : affectedGradleModuleConfigurations.entrySet()) { Integer moduleLastConfigurationHash = myModulesConfigurationHash.get(entry.getKey()); int moduleCurrentConfigurationHash = entry.getValue().computeConfigurationHash(); @@ -153,7 +152,7 @@ public class GradleResourceCompilerConfigurationGenerator { } private @NotNull Map generateAffectedGradleModulesConfiguration(@NotNull CompileContext context) { - final Map affectedGradleModuleConfigurations = new THashMap<>(); + final Map affectedGradleModuleConfigurations = new HashMap<>(); final Map lazyExternalProjectMap = FactoryMap.create( gradleProjectPath1 -> externalProjectDataCache.getRootExternalProject(gradleProjectPath1)); diff --git a/plugins/gradle/java/testSources/importing/GradleMiscImportingTest.java b/plugins/gradle/java/testSources/importing/GradleMiscImportingTest.java index 5e6e271bbadc..fc638f816563 100644 --- a/plugins/gradle/java/testSources/importing/GradleMiscImportingTest.java +++ b/plugins/gradle/java/testSources/importing/GradleMiscImportingTest.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.gradle.importing; import com.intellij.ide.highlighter.ModuleFileType; @@ -23,7 +23,6 @@ import com.intellij.openapi.roots.TestModuleProperties; import com.intellij.pom.java.LanguageLevel; import com.intellij.util.ArrayUtilRt; import com.intellij.util.containers.ContainerUtil; -import gnu.trove.THashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.gradle.model.ExternalProject; import org.jetbrains.plugins.gradle.service.project.GradleProjectResolverUtil; @@ -343,7 +342,7 @@ public class GradleMiscImportingTest extends GradleJavaImportingTestCase { @NotNull private Map getExternalProjectsMap() { ExternalProject rootExternalProject = ExternalProjectDataCache.getInstance(myProject).getRootExternalProject(getProjectPath()); - final Map externalProjectMap = new THashMap<>(); + final Map externalProjectMap = new HashMap<>(); if (rootExternalProject == null) return externalProjectMap; ArrayDeque queue = new ArrayDeque<>(); queue.add(rootExternalProject); diff --git a/plugins/junit/intellij.junit.iml b/plugins/junit/intellij.junit.iml index 642b2c86c0f1..154386e0a44b 100644 --- a/plugins/junit/intellij.junit.iml +++ b/plugins/junit/intellij.junit.iml @@ -26,7 +26,7 @@ - + diff --git a/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java b/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java index dd8928a785ee..cd2ef62f4512 100644 --- a/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java +++ b/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.execution.junit2.configuration; @@ -44,7 +44,7 @@ import com.intellij.ui.components.fields.ExpandableTextField; import com.intellij.util.ArrayUtilRt; import com.intellij.util.indexing.DumbModeAccessType; import com.intellij.util.ui.UIUtil; -import gnu.trove.TIntArrayList; +import it.unimi.dsi.fastutil.ints.IntArrayList; import org.jetbrains.annotations.NotNull; import javax.swing.*; @@ -61,16 +61,16 @@ import java.util.Objects; import java.util.function.Supplier; public class JUnitConfigurable extends SettingsEditor implements PanelWithAnchor { - private static final List ourEnabledFields = Arrays.asList( - new TIntArrayList(new int[]{0}), - new TIntArrayList(new int[]{1}), - new TIntArrayList(new int[]{1, 2}), - new TIntArrayList(new int[]{3}), - new TIntArrayList(new int[]{4}), - new TIntArrayList(new int[]{5}), - new TIntArrayList(new int[]{1, 2}), - new TIntArrayList(new int[]{6}), - new TIntArrayList(new int[]{1, 2}) + private static final List ourEnabledFields = Arrays.asList( + new IntArrayList(new int[]{0}), + new IntArrayList(new int[]{1}), + new IntArrayList(new int[]{1, 2}), + new IntArrayList(new int[]{3}), + new IntArrayList(new int[]{4}), + new IntArrayList(new int[]{5}), + new IntArrayList(new int[]{1, 2}), + new IntArrayList(new int[]{6}), + new IntArrayList(new int[]{1, 2}) ); private static final String[] FORK_MODE_ALL = {JUnitConfiguration.FORK_NONE, JUnitConfiguration.FORK_METHOD, JUnitConfiguration.FORK_KLASS}; @@ -528,7 +528,7 @@ public class JUnitConfigurable extends SettingsEdi public void onTypeChanged(final int newType) { myTypeChooser.setSelectedItem(newType); - final TIntArrayList enabledFields = ourEnabledFields.size() > newType ? ourEnabledFields.get(newType) : null; + final IntArrayList enabledFields = ourEnabledFields.size() > newType ? ourEnabledFields.get(newType) : null; for (int i = 0; i < myTestLocations.length; i++) getTestLocation(i).setEnabled(enabledFields != null && enabledFields.contains(i)); /*if (newType == JUnitConfigurationModel.PATTERN) { diff --git a/python/python-common-tests/com/jetbrains/python/fixture/PythonCommonTestCase.java b/python/python-common-tests/com/jetbrains/python/fixture/PythonCommonTestCase.java index d432d4e5f0ee..863bebe0be99 100644 --- a/python/python-common-tests/com/jetbrains/python/fixture/PythonCommonTestCase.java +++ b/python/python-common-tests/com/jetbrains/python/fixture/PythonCommonTestCase.java @@ -17,8 +17,6 @@ import com.jetbrains.python.psi.impl.PyFileImpl; import com.jetbrains.python.psi.impl.PythonLanguageLevelPusher; import com.jetbrains.python.psi.types.TypeEvalContext; import com.jetbrains.python.sdk.PythonSdkUtil; -import gnu.trove.Equality; -import gnu.trove.THashSet; import junit.framework.TestCase; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; @@ -26,6 +24,7 @@ import org.jetbrains.annotations.Nullable; import org.junit.Assert; import java.util.*; +import java.util.function.BiPredicate; import java.util.function.Consumer; public abstract class PythonCommonTestCase extends TestCase { @@ -171,8 +170,8 @@ public abstract class PythonCommonTestCase extends TestCase { final StringBuilder builder = new StringBuilder(); for (final Object o : collection) { - if (o instanceof THashSet) { - builder.append(new TreeSet<>((THashSet)o)); + if (o instanceof Set) { + builder.append(new TreeSet<>((Set)o)); } else { builder.append(o); @@ -184,12 +183,13 @@ public abstract class PythonCommonTestCase extends TestCase { private static boolean equals(@NotNull Iterable a1, @NotNull Iterable a2, - @NotNull Equality comparator) { + @NotNull BiPredicate comparator) { Iterator it1 = a1.iterator(); Iterator it2 = a2.iterator(); while (it1.hasNext() || it2.hasNext()) { - if (!it1.hasNext() || !it2.hasNext()) return false; - if (!comparator.equals(it1.next(), it2.next())) return false; + if (!it1.hasNext() || !it2.hasNext() || !comparator.test(it1.next(), it2.next())) { + return false; + } } return true; } @@ -243,14 +243,13 @@ public abstract class PythonCommonTestCase extends TestCase { public static void assertOrderedEquals(@NotNull String errorMsg, @NotNull Iterable actual, @NotNull Iterable expected) { - //noinspection unchecked - assertOrderedEquals(errorMsg, actual, expected, Equality.CANONICAL); + assertOrderedEquals(errorMsg, actual, expected, (t, t2) -> Objects.equals(t, t2)); } public static void assertOrderedEquals(@NotNull String errorMsg, @NotNull Iterable actual, @NotNull Iterable expected, - @NotNull Equality comparator) { + @NotNull BiPredicate comparator) { if (!equals(actual, expected, comparator)) { String expectedString = toString(expected); String actualString = toString(actual); diff --git a/python/python-common-tests/intellij.python.commonTests.iml b/python/python-common-tests/intellij.python.commonTests.iml index 0d6a31a61a15..e7488721c301 100644 --- a/python/python-common-tests/intellij.python.commonTests.iml +++ b/python/python-common-tests/intellij.python.commonTests.iml @@ -18,6 +18,5 @@ - \ No newline at end of file