diff --git a/.idea/libraries/fastutil_min.xml b/.idea/libraries/fastutil_min.xml
index a0fbf968439e..093fc5abd6c2 100644
--- a/.idea/libraries/fastutil_min.xml
+++ b/.idea/libraries/fastutil_min.xml
@@ -1,8 +1,8 @@
-
+
-
+
diff --git a/java/execution/impl/intellij.java.execution.impl.iml b/java/execution/impl/intellij.java.execution.impl.iml
index 33b02cfea857..8d961f350c07 100644
--- a/java/execution/impl/intellij.java.execution.impl.iml
+++ b/java/execution/impl/intellij.java.execution.impl.iml
@@ -30,6 +30,7 @@
+
diff --git a/java/execution/impl/src/com/intellij/execution/testDiscovery/indices/DiscoveredTestDataHolder.java b/java/execution/impl/src/com/intellij/execution/testDiscovery/indices/DiscoveredTestDataHolder.java
index 3cd09e90bb5c..e0c383113423 100644
--- a/java/execution/impl/src/com/intellij/execution/testDiscovery/indices/DiscoveredTestDataHolder.java
+++ b/java/execution/impl/src/com/intellij/execution/testDiscovery/indices/DiscoveredTestDataHolder.java
@@ -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-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.
package com.intellij.execution.testDiscovery.indices;
import com.intellij.openapi.Disposable;
@@ -9,7 +9,8 @@ import com.intellij.openapi.util.LowMemoryWatcher;
import com.intellij.util.containers.MultiMap;
import com.intellij.util.indexing.StorageException;
import com.intellij.util.io.*;
-import gnu.trove.TIntArrayList;
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
+import it.unimi.dsi.fastutil.ints.IntArrayList;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -182,11 +183,10 @@ public final class DiscoveredTestDataHolder {
@NotNull List usedFiles,
@Nullable String moduleName,
byte frameworkId) throws IOException {
-
final int testNameId = myTestEnumerator.enumerate(createTestId(testClassName, testMethodName, frameworkId));
- Map result = new HashMap<>();
+ Int2ObjectOpenHashMap result = new Int2ObjectOpenHashMap<>();
for (Map.Entry> e : usedMethods.entrySet()) {
- TIntArrayList methodIds = new TIntArrayList(e.getValue().size());
+ IntArrayList methodIds = new IntArrayList(e.getValue().size());
result.put(myClassEnumerator.enumerate(e.getKey()), methodIds);
for (String methodName : e.getValue()) {
methodIds.add(myMethodEnumerator.enumerate(methodName));
diff --git a/java/execution/impl/src/com/intellij/execution/testDiscovery/indices/DiscoveredTestsIndex.java b/java/execution/impl/src/com/intellij/execution/testDiscovery/indices/DiscoveredTestsIndex.java
index 0faae0bb3f5b..724ccf29223c 100644
--- a/java/execution/impl/src/com/intellij/execution/testDiscovery/indices/DiscoveredTestsIndex.java
+++ b/java/execution/impl/src/com/intellij/execution/testDiscovery/indices/DiscoveredTestsIndex.java
@@ -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-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.
package com.intellij.execution.testDiscovery.indices;
import com.intellij.openapi.progress.ProgressManager;
@@ -9,16 +9,18 @@ import com.intellij.util.indexing.impl.MapIndexStorage;
import com.intellij.util.indexing.impl.MapReduceIndex;
import com.intellij.util.indexing.impl.forward.KeyCollectionForwardIndexAccessor;
import com.intellij.util.indexing.impl.forward.PersistentMapBasedForwardIndex;
-import com.intellij.util.io.*;
-import gnu.trove.TIntArrayList;
+import com.intellij.util.io.DataExternalizer;
+import com.intellij.util.io.EnumeratorIntegerDescriptor;
+import com.intellij.util.io.IntCollectionDataExternalizer;
+import com.intellij.util.io.KeyDescriptor;
+import it.unimi.dsi.fastutil.ints.IntArrayList;
import org.jetbrains.annotations.NotNull;
-import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
-public class DiscoveredTestsIndex extends MapReduceIndex {
- protected DiscoveredTestsIndex(@NotNull Path file) throws IOException {
+public final class DiscoveredTestsIndex extends MapReduceIndex {
+ DiscoveredTestsIndex(@NotNull Path file) throws IOException {
super(INDEX_EXTENSION,
new MyIndexStorage(file),
new PersistentMapBasedForwardIndex(file.resolve("forward.idx"), false),
@@ -39,7 +41,7 @@ public class DiscoveredTestsIndex extends MapReduceIndex {
+ private static class MyIndexStorage extends MapIndexStorage {
protected MyIndexStorage(@NotNull Path storageFile) throws IOException {
super(storageFile, EnumeratorIntegerDescriptor.INSTANCE, IntArrayExternalizer.INSTANCE, 4 * 1024, false);
}
@@ -50,16 +52,18 @@ public class DiscoveredTestsIndex extends MapReduceIndex INDEX_EXTENSION = new IndexExtension() {
+ private static final IndexExtension INDEX_EXTENSION = new IndexExtension() {
@NotNull
@Override
- public IndexId getName() {
+ public IndexId getName() {
return IndexId.create("jvm.discovered.tests");
}
@NotNull
@Override
- public DataIndexer getIndexer() {return inputData -> inputData.myUsedMethods;}
+ public DataIndexer getIndexer() {
+ return inputData -> inputData.myUsedMethods;
+ }
@NotNull
@Override
@@ -69,7 +73,7 @@ public class DiscoveredTestsIndex extends MapReduceIndex getValueExternalizer() {
+ public DataExternalizer getValueExternalizer() {
return IntArrayExternalizer.INSTANCE;
}
diff --git a/java/execution/impl/src/com/intellij/execution/testDiscovery/indices/IntArrayExternalizer.java b/java/execution/impl/src/com/intellij/execution/testDiscovery/indices/IntArrayExternalizer.java
index 97537a812895..0b850de40b76 100644
--- a/java/execution/impl/src/com/intellij/execution/testDiscovery/indices/IntArrayExternalizer.java
+++ b/java/execution/impl/src/com/intellij/execution/testDiscovery/indices/IntArrayExternalizer.java
@@ -1,20 +1,20 @@
-// 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-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.
package com.intellij.execution.testDiscovery.indices;
import com.intellij.util.io.DataExternalizer;
import com.intellij.util.io.DataInputOutputUtil;
-import gnu.trove.TIntArrayList;
+import it.unimi.dsi.fastutil.ints.IntArrayList;
import org.jetbrains.annotations.NotNull;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
-class IntArrayExternalizer implements DataExternalizer {
+final class IntArrayExternalizer implements DataExternalizer {
static final IntArrayExternalizer INSTANCE = new IntArrayExternalizer();
@Override
- public void save(@NotNull DataOutput out, TIntArrayList value) throws IOException {
+ public void save(@NotNull DataOutput out, IntArrayList value) throws IOException {
DataInputOutputUtil.writeINT(out, value.size());
for (int i = 0; i < value.size(); i++) {
DataInputOutputUtil.writeINT(out, value.get(i));
@@ -22,9 +22,9 @@ class IntArrayExternalizer implements DataExternalizer {
}
@Override
- public TIntArrayList read(@NotNull DataInput in) throws IOException {
+ public IntArrayList read(@NotNull DataInput in) throws IOException {
int size = DataInputOutputUtil.readINT(in);
- TIntArrayList array = new TIntArrayList(size);
+ IntArrayList array = new IntArrayList(size);
for (int i = 0; i < size; i++) {
array.add(DataInputOutputUtil.readINT(in));
}
diff --git a/java/execution/impl/src/com/intellij/execution/testDiscovery/indices/UsedSources.java b/java/execution/impl/src/com/intellij/execution/testDiscovery/indices/UsedSources.java
index c3546b9d2dbc..a01119313d5c 100644
--- a/java/execution/impl/src/com/intellij/execution/testDiscovery/indices/UsedSources.java
+++ b/java/execution/impl/src/com/intellij/execution/testDiscovery/indices/UsedSources.java
@@ -1,17 +1,19 @@
-// 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-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.
package com.intellij.execution.testDiscovery.indices;
-import gnu.trove.TIntArrayList;
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
+import it.unimi.dsi.fastutil.ints.IntArrayList;
import org.jetbrains.annotations.NotNull;
import java.util.Map;
-class UsedSources {
+final class UsedSources {
@NotNull
- final Map myUsedMethods;
+ final Int2ObjectOpenHashMap myUsedMethods;
@NotNull
final Map myUsedFiles;
- UsedSources(@NotNull Map methods, @NotNull Map files) {
+
+ UsedSources(@NotNull Int2ObjectOpenHashMap methods, @NotNull Map files) {
myUsedMethods = methods;
myUsedFiles = files;
}
diff --git a/java/idea-ui/intellij.java.ui.iml b/java/idea-ui/intellij.java.ui.iml
index 713509b3e97a..566c287db127 100644
--- a/java/idea-ui/intellij.java.ui.iml
+++ b/java/idea-ui/intellij.java.ui.iml
@@ -26,5 +26,6 @@
+
\ No newline at end of file
diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/SidePanel.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/SidePanel.java
index fce8a1026e1a..104f6f27f65f 100644
--- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/SidePanel.java
+++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/SidePanel.java
@@ -11,6 +11,7 @@ import com.intellij.ui.popup.list.GroupedItemsListRenderer;
import com.intellij.util.ui.EmptyIcon;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -19,15 +20,13 @@ import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
-import java.util.HashMap;
-import java.util.Map;
-public class SidePanel extends JPanel {
+public final class SidePanel extends JPanel {
private final JList myList;
private final DefaultListModel myModel;
private final Place.Navigator myNavigator;
- private final Map myIndex2Separator = new HashMap<>();
+ private final Int2ObjectOpenHashMap myIndex2Separator = new Int2ObjectOpenHashMap<>();
public SidePanel(Place.Navigator navigator) {
myNavigator = navigator;
diff --git a/java/java-tests/intellij.java.tests.iml b/java/java-tests/intellij.java.tests.iml
index f88c8e9f1534..07f57f023c01 100644
--- a/java/java-tests/intellij.java.tests.iml
+++ b/java/java-tests/intellij.java.tests.iml
@@ -4,6 +4,7 @@
+
diff --git a/json/intellij.json.iml b/json/intellij.json.iml
index 1205c8749da9..c8b9e62e17db 100644
--- a/json/intellij.json.iml
+++ b/json/intellij.json.iml
@@ -17,5 +17,6 @@
+
\ No newline at end of file
diff --git a/json/src/com/jetbrains/jsonSchema/impl/MatchResult.java b/json/src/com/jetbrains/jsonSchema/impl/MatchResult.java
index 6bcca9dd3255..5d42473ae7f8 100644
--- a/json/src/com/jetbrains/jsonSchema/impl/MatchResult.java
+++ b/json/src/com/jetbrains/jsonSchema/impl/MatchResult.java
@@ -1,9 +1,8 @@
-// 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-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.
package com.jetbrains.jsonSchema.impl;
import com.intellij.util.Processor;
-import com.intellij.util.containers.ContainerUtil;
-import com.intellij.util.containers.MultiMap;
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import org.jetbrains.annotations.NotNull;
import java.util.*;
@@ -11,7 +10,7 @@ import java.util.*;
/**
* @author Irina.Chernushina on 4/22/2017.
*/
-public class MatchResult {
+public final class MatchResult {
public final List mySchemas;
public final List> myExcludingSchemas;
@@ -22,7 +21,7 @@ public class MatchResult {
public static MatchResult create(@NotNull JsonSchemaTreeNode root) {
List schemas = new ArrayList<>();
- MultiMap oneOfGroups = MultiMap.create();
+ Int2ObjectOpenHashMap> oneOfGroups = new Int2ObjectOpenHashMap<>();
iterateTree(root, node -> {
if (node.isAny()) return true;
int groupNumber = node.getExcludingGroupNumber();
@@ -30,15 +29,16 @@ public class MatchResult {
schemas.add(node.getSchema());
}
else {
- oneOfGroups.putValue(groupNumber, node.getSchema());
+ oneOfGroups.computeIfAbsent(groupNumber, __ -> new ArrayList<>()).add(node.getSchema());
}
return true;
});
- List> result = oneOfGroups.isEmpty()
- ? ContainerUtil.emptyList()
- : new ArrayList<>(oneOfGroups.keySet().size());
- for (Map.Entry> entry: oneOfGroups.entrySet()) {
- result.add(entry.getValue());
+ List> result;
+ if (oneOfGroups.isEmpty()) {
+ result = Collections.emptyList();
+ }
+ else {
+ result = new ArrayList<>(oneOfGroups.values());
}
return new MatchResult(schemas, result);
}
diff --git a/platform/diff-api/src/com/intellij/diff/util/IntPair.java b/platform/diff-api/src/com/intellij/diff/util/IntPair.java
index efbb84b175e6..67d08bcda501 100644
--- a/platform/diff-api/src/com/intellij/diff/util/IntPair.java
+++ b/platform/diff-api/src/com/intellij/diff/util/IntPair.java
@@ -1,21 +1,11 @@
-/*
- * 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-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.
package com.intellij.diff.util;
-public class IntPair {
+/**
+ * @deprecated Use {@link com.intellij.util.IntPair}
+ */
+@Deprecated
+public final class IntPair {
public final int val1;
public final int val2;
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 607daeb00314..8a67f49e9eb1 100644
--- a/platform/diff-impl/src/com/intellij/diff/comparison/ChangeCorrector.java
+++ b/platform/diff-impl/src/com/intellij/diff/comparison/ChangeCorrector.java
@@ -1,26 +1,12 @@
-/*
- * 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-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.
package com.intellij.diff.comparison;
import com.intellij.diff.comparison.ByLine.Line;
import com.intellij.diff.comparison.iterables.DiffIterableUtil;
import com.intellij.diff.comparison.iterables.FairDiffIterable;
-import com.intellij.diff.util.IntPair;
import com.intellij.diff.util.Range;
import com.intellij.openapi.progress.ProgressIndicator;
+import com.intellij.util.IntPair;
import gnu.trove.TIntArrayList;
import org.jetbrains.annotations.NotNull;
@@ -71,10 +57,10 @@ abstract class ChangeCorrector {
IntPair range1 = getOriginalRange1(ch.start1 + i);
IntPair range2 = getOriginalRange2(ch.start2 + i);
- int start1 = range1.val1;
- int start2 = range2.val1;
- int end1 = range1.val2;
- int end2 = range2.val2;
+ int start1 = range1.first;
+ int start2 = range2.first;
+ int end1 = range1.second;
+ int end2 = range2.second;
matchGap(last1, start1, last2, start2);
myBuilder.markEqual(start1, start2, end1, end2);
diff --git a/platform/diff-impl/src/com/intellij/diff/comparison/ComparisonManagerImpl.java b/platform/diff-impl/src/com/intellij/diff/comparison/ComparisonManagerImpl.java
index b0d2c75e15b0..c87001c4ff81 100644
--- a/platform/diff-impl/src/com/intellij/diff/comparison/ComparisonManagerImpl.java
+++ b/platform/diff-impl/src/com/intellij/diff/comparison/ComparisonManagerImpl.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-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.
package com.intellij.diff.comparison;
import com.intellij.diff.comparison.iterables.DiffIterable;
@@ -21,14 +7,13 @@ import com.intellij.diff.comparison.iterables.FairDiffIterable;
import com.intellij.diff.fragments.*;
import com.intellij.diff.tools.util.text.LineOffsets;
import com.intellij.diff.tools.util.text.LineOffsetsUtil;
-import com.intellij.diff.util.IntPair;
import com.intellij.diff.util.MergeRange;
import com.intellij.diff.util.Range;
-import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.Consumer;
+import com.intellij.util.IntPair;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.diff.FilesTooBigForDiffException;
import com.intellij.util.text.CharSequenceSubSequence;
@@ -43,9 +28,7 @@ import java.util.List;
import static com.intellij.diff.comparison.iterables.DiffIterableUtil.fair;
import static java.util.Collections.singletonList;
-public class ComparisonManagerImpl extends ComparisonManager {
- private static final Logger LOG = Logger.getInstance(ComparisonManagerImpl.class);
-
+public final class ComparisonManagerImpl extends ComparisonManager {
@NotNull
public static ComparisonManagerImpl getInstanceImpl() {
return (ComparisonManagerImpl)getInstance();
@@ -369,7 +352,7 @@ public class ComparisonManagerImpl extends ComparisonManager {
IntPair offsets2 = getOffsets(lineOffsets2, startLine2, endLine2);
fragments.add(new LineFragmentImpl(startLine1, endLine1, startLine2, endLine2,
- offsets1.val1, offsets1.val2, offsets2.val1, offsets2.val2));
+ offsets1.first, offsets1.second, offsets2.first, offsets2.second));
}
return fragments;
}
@@ -763,7 +746,7 @@ public class ComparisonManagerImpl extends ComparisonManager {
@NotNull
private static TextRange trimIgnoredRange(int start, int end, @NotNull BitSet ignored, int offset) {
IntPair intPair = TrimUtil.trim(offset + start, offset + end, ignored);
- return new TextRange(intPair.val1 - offset, intPair.val2 - offset);
+ return new TextRange(intPair.first - offset, intPair.second - offset);
}
private static boolean isIgnoredRange(@NotNull BitSet ignored, int start, int end) {
diff --git a/platform/diff-impl/src/com/intellij/diff/comparison/TrimUtil.kt b/platform/diff-impl/src/com/intellij/diff/comparison/TrimUtil.kt
index a9e895af8992..9fd3ee2c657b 100644
--- a/platform/diff-impl/src/com/intellij/diff/comparison/TrimUtil.kt
+++ b/platform/diff-impl/src/com/intellij/diff/comparison/TrimUtil.kt
@@ -1,24 +1,9 @@
-/*
- * 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-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.
@file:JvmName("TrimUtil")
@file:Suppress("NAME_SHADOWING")
package com.intellij.diff.comparison
-import com.intellij.diff.util.IntPair
import com.intellij.diff.util.MergeRange
import com.intellij.diff.util.Range
import com.intellij.openapi.util.text.StringUtil.isWhiteSpace
@@ -60,12 +45,12 @@ fun isContinuousScript(c: Int): Boolean {
script == Character.UnicodeScript.JAVANESE
}
-fun trim(text: CharSequence, start: Int, end: Int): IntPair {
+fun trim(text: CharSequence, start: Int, end: Int): com.intellij.util.IntPair {
return trim(start, end,
{ index -> isWhiteSpace(text[index]) })
}
-fun trim(start: Int, end: Int, ignored: BitSet): IntPair {
+fun trim(start: Int, end: Int, ignored: BitSet): com.intellij.util.IntPair {
return trim(start, end,
{ index -> ignored[index] })
}
@@ -313,14 +298,14 @@ private inline fun trim(start1: Int, start2: Int, start3: Int, end1: Int, end2:
}
private inline fun trim(start: Int, end: Int,
- ignored: (Int) -> Boolean): IntPair {
+ ignored: (Int) -> Boolean): com.intellij.util.IntPair {
var start = start
var end = end
start = trimStart(start, end, ignored)
end = trimEnd(start, end, ignored)
- return IntPair(start, end)
+ return com.intellij.util.IntPair(start, end)
}
private inline fun trimStart(start: Int, end: Int,
@@ -534,12 +519,12 @@ private inline fun trimExpand(start1: Int, start2: Int, end1: Int, end2: Int,
var end2 = end2
val starts = trimExpandForward(start1, start2, end1, end2, equals, ignored1, ignored2)
- start1 = starts.val1
- start2 = starts.val2
+ start1 = starts.first
+ start2 = starts.second
val ends = trimExpandBackward(start1, start2, end1, end2, equals, ignored1, ignored2)
- end1 = ends.val1
- end2 = ends.val2
+ end1 = ends.first
+ end2 = ends.second
return Range(start1, end1, start2, end2)
}
@@ -547,7 +532,7 @@ private inline fun trimExpand(start1: Int, start2: Int, end1: Int, end2: Int,
private inline fun trimExpandForward(start1: Int, start2: Int, end1: Int, end2: Int,
equals: (Int, Int) -> Boolean,
ignored1: (Int) -> Boolean,
- ignored2: (Int) -> Boolean): IntPair {
+ ignored2: (Int) -> Boolean): com.intellij.util.IntPair {
var start1 = start1
var start2 = start2
@@ -573,13 +558,13 @@ private inline fun trimExpandForward(start1: Int, start2: Int, end1: Int, end2:
start1 = trimStart(start1, end1, ignored1)
start2 = trimStart(start2, end2, ignored2)
- return IntPair(start1, start2)
+ return com.intellij.util.IntPair(start1, start2)
}
private inline fun trimExpandBackward(start1: Int, start2: Int, end1: Int, end2: Int,
equals: (Int, Int) -> Boolean,
ignored1: (Int) -> Boolean,
- ignored2: (Int) -> Boolean): IntPair {
+ ignored2: (Int) -> Boolean): com.intellij.util.IntPair {
var end1 = end1
var end2 = end2
@@ -605,5 +590,5 @@ private inline fun trimExpandBackward(start1: Int, start2: Int, end1: Int, end2:
end1 = trimEnd(start1, end1, ignored1)
end2 = trimEnd(start2, end2, ignored2)
- return IntPair(end1, end2)
+ return com.intellij.util.IntPair(end1, end2)
}
diff --git a/platform/diff-impl/src/com/intellij/openapi/vcs/ex/LineStatusMarkerRenderer.java b/platform/diff-impl/src/com/intellij/openapi/vcs/ex/LineStatusMarkerRenderer.java
index cf65d05087c1..1bd2d3aee909 100644
--- a/platform/diff-impl/src/com/intellij/openapi/vcs/ex/LineStatusMarkerRenderer.java
+++ b/platform/diff-impl/src/com/intellij/openapi/vcs/ex/LineStatusMarkerRenderer.java
@@ -1,9 +1,8 @@
-// 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-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.
package com.intellij.openapi.vcs.ex;
import com.intellij.diff.util.DiffDrawUtil;
import com.intellij.diff.util.DiffUtil;
-import com.intellij.diff.util.IntPair;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.diff.DiffBundle;
import com.intellij.openapi.diff.DiffColors;
@@ -21,6 +20,7 @@ import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.TextRange;
import com.intellij.ui.paint.LinePainter2D;
import com.intellij.ui.scale.JBUIScale;
+import com.intellij.util.IntPair;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.update.MergingUpdateQueue;
import com.intellij.util.ui.update.Update;
@@ -273,7 +273,7 @@ public abstract class LineStatusMarkerRenderer {
IntPair area = getGutterArea(editor);
int y = editor.visualLineToY(startLine);
int endY = editor.visualLineToY(endLine);
- return new Rectangle(area.val1, y, area.val2 - area.val1, endY - y);
+ return new Rectangle(area.first, y, area.second - area.first, endY - y);
}
protected boolean shouldPaintGutter() {
@@ -309,8 +309,8 @@ public abstract class LineStatusMarkerRenderer {
int line2 = block.get(block.size() - 1).line2;
IntPair area = getGutterArea(editor);
- final int x = area.val1;
- final int endX = area.val2;
+ final int x = area.first;
+ final int endX = area.second;
final int y = editorImpl.visualLineToY(line1);
final int endY = editorImpl.visualLineToY(line2);
@@ -389,8 +389,8 @@ public abstract class LineStatusMarkerRenderer {
public static void paintSimpleRange(Graphics g, Editor editor, int line1, int line2, @Nullable Color color) {
IntPair horizontalArea = getGutterArea(editor);
- int x = horizontalArea.val1;
- int endX = horizontalArea.val2;
+ int x = horizontalArea.first;
+ int endX = horizontalArea.second;
int y = lineToY(editor, line1);
int endY = lineToY(editor, line2);
diff --git a/platform/diff-impl/tests/testSrc/com/intellij/diff/comparison/ComparisonMergeUtilTestBase.kt b/platform/diff-impl/tests/testSrc/com/intellij/diff/comparison/ComparisonMergeUtilTestBase.kt
index 1d62188b8c11..c39ddac0b17b 100644
--- a/platform/diff-impl/tests/testSrc/com/intellij/diff/comparison/ComparisonMergeUtilTestBase.kt
+++ b/platform/diff-impl/tests/testSrc/com/intellij/diff/comparison/ComparisonMergeUtilTestBase.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-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.
package com.intellij.diff.comparison
import com.intellij.diff.DiffTestCase
import com.intellij.diff.fragments.MergeLineFragment
-import com.intellij.diff.util.IntPair
import com.intellij.diff.util.MergeRange
import com.intellij.diff.util.ThreeSide
import com.intellij.openapi.editor.Document
import com.intellij.openapi.editor.impl.DocumentImpl
import com.intellij.openapi.util.Couple
+import com.intellij.util.IntPair
import java.util.*
abstract class ComparisonMergeUtilTestBase : DiffTestCase() {
@@ -215,8 +215,8 @@ abstract class ComparisonMergeUtilTestBase : DiffTestCase() {
val starts = Trio(start1, start2, start3)
val ends = Trio(end1, end2, end3)
- fun start(side: ThreeSide): Int = this(side).val1
- fun end(side: ThreeSide): Int = this(side).val2
+ fun start(side: ThreeSide): Int = this(side).first
+ fun end(side: ThreeSide): Int = this(side).second
override fun toString(): String {
return "($start1, $end1) - ($start2, $end2) - ($start3, $end3)"
diff --git a/platform/diff-impl/tests/testSrc/com/intellij/diff/comparison/ComparisonUtilTest.kt b/platform/diff-impl/tests/testSrc/com/intellij/diff/comparison/ComparisonUtilTest.kt
index 4750a6bbb611..7509b7016e3b 100644
--- a/platform/diff-impl/tests/testSrc/com/intellij/diff/comparison/ComparisonUtilTest.kt
+++ b/platform/diff-impl/tests/testSrc/com/intellij/diff/comparison/ComparisonUtilTest.kt
@@ -1,22 +1,8 @@
-/*
- * 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-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.
package com.intellij.diff.comparison
import com.intellij.diff.DiffTestCase
-import com.intellij.diff.util.IntPair
+import com.intellij.util.IntPair
class ComparisonUtilTest : DiffTestCase() {
fun testTrimEquals() {
@@ -133,14 +119,14 @@ class ComparisonUtilTest : DiffTestCase() {
assertTrue(fragments.size == 1, "Side: ${fragments.size})")
val fragment = fragments[0]
- assertEquals(offsets1.val1, fragment.startOffset1, fragment.toString())
- assertEquals(offsets1.val2, fragment.endOffset1, fragment.toString())
- assertEquals(offsets2.val1, fragment.startOffset2, fragment.toString())
- assertEquals(offsets2.val2, fragment.endOffset2, fragment.toString())
- assertEquals(lines1.val1, fragment.startLine1, fragment.toString())
- assertEquals(lines1.val2, fragment.endLine1, fragment.toString())
- assertEquals(lines2.val1, fragment.startLine2, fragment.toString())
- assertEquals(lines2.val2, fragment.endLine2, fragment.toString())
+ assertEquals(offsets1.first, fragment.startOffset1, fragment.toString())
+ assertEquals(offsets1.second, fragment.endOffset1, fragment.toString())
+ assertEquals(offsets2.first, fragment.startOffset2, fragment.toString())
+ assertEquals(offsets2.second, fragment.endOffset2, fragment.toString())
+ assertEquals(lines1.first, fragment.startLine1, fragment.toString())
+ assertEquals(lines1.second, fragment.endLine1, fragment.toString())
+ assertEquals(lines2.first, fragment.startLine2, fragment.toString())
+ assertEquals(lines2.second, fragment.endLine2, fragment.toString())
}
private fun doTestTrim(expected: Boolean, string1: String, string2: String) {
diff --git a/platform/diff-impl/tests/testSrc/com/intellij/diff/comparison/ComparisonUtilTestBase.kt b/platform/diff-impl/tests/testSrc/com/intellij/diff/comparison/ComparisonUtilTestBase.kt
index 1c645094d137..cc68ef5842e3 100644
--- a/platform/diff-impl/tests/testSrc/com/intellij/diff/comparison/ComparisonUtilTestBase.kt
+++ b/platform/diff-impl/tests/testSrc/com/intellij/diff/comparison/ComparisonUtilTestBase.kt
@@ -1,15 +1,15 @@
-// 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-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.
package com.intellij.diff.comparison
import com.intellij.diff.DiffTestCase
import com.intellij.diff.fragments.DiffFragment
import com.intellij.diff.fragments.LineFragment
import com.intellij.diff.fragments.MergeWordFragment
-import com.intellij.diff.util.IntPair
import com.intellij.diff.util.ThreeSide
import com.intellij.openapi.editor.Document
import com.intellij.openapi.editor.impl.DocumentImpl
import com.intellij.openapi.util.Couple
+import com.intellij.util.IntPair
import java.util.*
abstract class ComparisonUtilTestBase : DiffTestCase() {
diff --git a/platform/diff-impl/tests/testSrc/com/intellij/diff/comparison/IgnoreComparisonUtilTest.kt b/platform/diff-impl/tests/testSrc/com/intellij/diff/comparison/IgnoreComparisonUtilTest.kt
index f7db25df5ddd..c2e3356cf00e 100644
--- a/platform/diff-impl/tests/testSrc/com/intellij/diff/comparison/IgnoreComparisonUtilTest.kt
+++ b/platform/diff-impl/tests/testSrc/com/intellij/diff/comparison/IgnoreComparisonUtilTest.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-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.
package com.intellij.diff.comparison
import com.intellij.diff.DiffTestCase
@@ -8,10 +8,10 @@ import com.intellij.diff.comparison.ComparisonUtilTestBase.Companion.ins
import com.intellij.diff.comparison.ComparisonUtilTestBase.Companion.mod
import com.intellij.diff.fragments.LineFragment
import com.intellij.diff.tools.util.text.LineOffsetsUtil
-import com.intellij.diff.util.IntPair
import com.intellij.diff.util.Range
import com.intellij.openapi.util.Couple
import com.intellij.openapi.util.TextRange
+import com.intellij.util.IntPair
import java.util.*
class IgnoreComparisonUtilTest : DiffTestCase() {
diff --git a/platform/diff-impl/tests/testSrc/com/intellij/diff/util/LineOffsetsTest.kt b/platform/diff-impl/tests/testSrc/com/intellij/diff/util/LineOffsetsTest.kt
index 44eca6e4c223..2057fb22821c 100644
--- a/platform/diff-impl/tests/testSrc/com/intellij/diff/util/LineOffsetsTest.kt
+++ b/platform/diff-impl/tests/testSrc/com/intellij/diff/util/LineOffsetsTest.kt
@@ -1,23 +1,10 @@
-/*
- * Copyright 2000-2017 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-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.
package com.intellij.diff.util
import com.intellij.diff.DiffTestCase
import com.intellij.diff.tools.util.text.LineOffsetsUtil
import com.intellij.openapi.editor.impl.DocumentImpl
+import com.intellij.util.IntPair
class LineOffsetsTest : DiffTestCase() {
fun testWithDocument() {
@@ -64,8 +51,8 @@ class LineOffsetsTest : DiffTestCase() {
assertEquals(offsets.size, lineOffsets.lineCount)
offsets.forEachIndexed { line, value ->
- assertEquals(lineOffsets.getLineStart(line), value.val1)
- assertEquals(lineOffsets.getLineEnd(line), value.val2)
+ assertEquals(lineOffsets.getLineStart(line), value.first)
+ assertEquals(lineOffsets.getLineEnd(line), value.second)
for (offset in lineOffsets.getLineStart(line)..lineOffsets.getLineEnd(line)) {
assertEquals(line, lineOffsets.getLineNumber(offset))
@@ -74,6 +61,6 @@ class LineOffsetsTest : DiffTestCase() {
}
private operator fun Int.not(): IntPairHelper = IntPairHelper(this)
- private operator fun IntPairHelper.minus(col: Int): IntPair = IntPair(this.line, col)
+ private operator fun IntPairHelper.minus(col: Int) = IntPair(this.line, col)
private class IntPairHelper(val line: Int)
}
\ No newline at end of file
diff --git a/platform/duplicates-analysis/intellij.platform.duplicates.analysis.iml b/platform/duplicates-analysis/intellij.platform.duplicates.analysis.iml
index e87ff43eb430..b61d10ea4bc1 100644
--- a/platform/duplicates-analysis/intellij.platform.duplicates.analysis.iml
+++ b/platform/duplicates-analysis/intellij.platform.duplicates.analysis.iml
@@ -15,5 +15,6 @@
+
\ No newline at end of file
diff --git a/platform/duplicates-analysis/src/com/intellij/dupLocator/index/DuplicatesIndex.java b/platform/duplicates-analysis/src/com/intellij/dupLocator/index/DuplicatesIndex.java
index 5cdbfd967f3b..2747a6d7b4db 100644
--- a/platform/duplicates-analysis/src/com/intellij/dupLocator/index/DuplicatesIndex.java
+++ b/platform/duplicates-analysis/src/com/intellij/dupLocator/index/DuplicatesIndex.java
@@ -32,8 +32,10 @@ import com.intellij.util.io.DataExternalizer;
import com.intellij.util.io.DataInputOutputUtil;
import com.intellij.util.io.EnumeratorIntegerDescriptor;
import com.intellij.util.io.KeyDescriptor;
-import gnu.trove.THashMap;
-import gnu.trove.TIntArrayList;
+import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
+import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
+import it.unimi.dsi.fastutil.ints.IntArrayList;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -42,19 +44,17 @@ import org.jetbrains.annotations.TestOnly;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
-import java.util.Collections;
-import java.util.Map;
/**
* @author Maxim.Mossienko on 12/11/13.
*/
-public class DuplicatesIndex extends FileBasedIndexExtension {
+public class DuplicatesIndex extends FileBasedIndexExtension {
static boolean ourEnabled = SystemProperties.getBooleanProperty("idea.enable.duplicates.online.calculation",
true);
static final boolean ourEnabledLightProfiles = true;
private static boolean ourEnabledOldProfiles = false;
- @NonNls public static final ID NAME = ID.create("DuplicatesIndex");
+ @NonNls public static final ID NAME = ID.create("DuplicatesIndex");
private static final int myBaseVersion = 25;
private final FileBasedIndex.InputFilter myInputFilter = file -> {
@@ -70,36 +70,36 @@ public class DuplicatesIndex extends FileBasedIndexExtension myValueExternalizer = new DataExternalizer() {
+ private final DataExternalizer myValueExternalizer = new DataExternalizer() {
@Override
- public void save(@NotNull DataOutput out, TIntArrayList list) throws IOException {
+ public void save(@NotNull DataOutput out, IntArrayList list) throws IOException {
if (list.size() == 2) {
- DataInputOutputUtil.writeINT(out, list.getQuick(0));
- DataInputOutputUtil.writeINT(out, list.getQuick(1));
+ DataInputOutputUtil.writeINT(out, list.getInt(0));
+ DataInputOutputUtil.writeINT(out, list.getInt(1));
}
else {
DataInputOutputUtil.writeINT(out, -list.size());
int prev = 0;
for (int i = 0, len = list.size(); i < len; i+=2) {
- int value = list.getQuick(i);
+ int value = list.getInt(i);
DataInputOutputUtil.writeINT(out, value - prev);
prev = value;
- DataInputOutputUtil.writeINT(out, list.getQuick(i + 1));
+ DataInputOutputUtil.writeINT(out, list.getInt(i + 1));
}
}
}
@Override
- public TIntArrayList read(@NotNull DataInput in) throws IOException {
+ public IntArrayList read(@NotNull DataInput in) throws IOException {
int capacityOrValue = DataInputOutputUtil.readINT(in);
if (capacityOrValue >= 0) {
- TIntArrayList list = new TIntArrayList(2);
+ IntArrayList list = new IntArrayList(2);
list.add(capacityOrValue);
list.add(DataInputOutputUtil.readINT(in));
return list;
}
capacityOrValue = -capacityOrValue;
- TIntArrayList list = new TIntArrayList(capacityOrValue);
+ IntArrayList list = new IntArrayList(capacityOrValue);
int prev = 0;
while(capacityOrValue > 0) {
int value = DataInputOutputUtil.readINT(in) + prev;
@@ -112,28 +112,30 @@ public class DuplicatesIndex extends FileBasedIndexExtension myIndexer = new DataIndexer() {
+ private final DataIndexer myIndexer = new DataIndexer() {
@Override
@NotNull
- public Map map(@NotNull final FileContent inputData) {
+ public Int2ObjectMap map(@NotNull final FileContent inputData) {
FileType type = inputData.getFileType();
DuplicatesProfile profile = findDuplicatesProfile(type);
- if (profile == null || !profile.acceptsContentForIndexing(inputData)) return Collections.emptyMap();
+ if (profile == null || !profile.acceptsContentForIndexing(inputData)) {
+ return Int2ObjectMaps.emptyMap();
+ }
try {
PsiDependentFileContent fileContent = (PsiDependentFileContent)inputData;
if (profile instanceof LightDuplicateProfile && ourEnabledLightProfiles) {
- final THashMap result = new THashMap<>();
+ final Int2ObjectOpenHashMap result = new Int2ObjectOpenHashMap<>();
LighterAST ast = fileContent.getLighterAST();
((LightDuplicateProfile)profile).process(ast, new LightDuplicateProfile.Callback() {
@Override
public void process(int hash, int hash2, @NotNull LighterAST ast, LighterASTNode @NotNull ... nodes) {
- TIntArrayList list = result.get(hash);
+ IntArrayList list = result.get(hash);
if (list == null) {
- result.put(hash, list = new TIntArrayList(2));
+ result.put(hash, list = new IntArrayList(2));
}
list.add(nodes[0].getStartOffset());
list.add(hash2);
@@ -147,8 +149,9 @@ public class DuplicatesIndex extends FileBasedIndexExtension getName() {
+ public ID getName() {
return NAME;
}
@NotNull
@Override
- public DataIndexer getIndexer() {
+ public DataIndexer getIndexer() {
return myIndexer;
}
@NotNull
@Override
- public DataExternalizer getValueExternalizer() {
+ public DataExternalizer getValueExternalizer() {
return myValueExternalizer;
}
@@ -206,8 +209,8 @@ public class DuplicatesIndex extends FileBasedIndexExtension myMap = new THashMap<>();
+ private static final class MyFragmentsCollector implements FragmentsCollector {
+ private final Int2ObjectOpenHashMap myMap = new Int2ObjectOpenHashMap<>();
private final DuplicatesProfile myProfile;
private final DuplocatorState myDuplocatorState;
@@ -224,13 +227,13 @@ public class DuplicatesIndex extends FileBasedIndexExtension getMap() {
+ public Int2ObjectOpenHashMap getMap() {
return myMap;
}
}
diff --git a/platform/duplicates-analysis/src/com/intellij/dupLocator/index/DuplicatesInspectionBase.java b/platform/duplicates-analysis/src/com/intellij/dupLocator/index/DuplicatesInspectionBase.java
index 81734db97b87..7771425a76a7 100644
--- a/platform/duplicates-analysis/src/com/intellij/dupLocator/index/DuplicatesInspectionBase.java
+++ b/platform/duplicates-analysis/src/com/intellij/dupLocator/index/DuplicatesInspectionBase.java
@@ -40,18 +40,10 @@ import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.tree.ILightStubFileElementType;
import com.intellij.util.SmartList;
import com.intellij.util.indexing.FileBasedIndex;
-import gnu.trove.TIntArrayList;
-import gnu.trove.TIntIntHashMap;
-import gnu.trove.TIntLongHashMap;
-import gnu.trove.TIntObjectHashMap;
+import it.unimi.dsi.fastutil.ints.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
public class DuplicatesInspectionBase extends LocalInspectionTool {
public boolean myFilterOutGeneratedCode;
private static final int MIN_FRAGMENT_SIZE = 3; // todo 3 statements constant
@@ -80,8 +72,8 @@ public class DuplicatesInspectionBase extends LocalInspectionTool {
final SmartList descriptors = new SmartList<>();
final VirtualFile baseDir = project.getBaseDir();
- for (Map.Entry entry : processor.reportedRanges.entrySet()) {
- final Integer offset = entry.getKey();
+ for (Int2ObjectMap.Entry entry : processor.reportedRanges.int2ObjectEntrySet()) {
+ int offset = entry.getIntKey();
if (!usingLightProfile && processor.fragmentSize.get(offset) < MIN_FRAGMENT_SIZE) continue;
final VirtualFile file = processor.reportedFiles.get(offset);
String path = null;
@@ -178,7 +170,7 @@ public class DuplicatesInspectionBase extends LocalInspectionTool {
return null;
}
- private class LightDuplicatedCodeProcessor extends DuplicatedCodeProcessor {
+ private final class LightDuplicatedCodeProcessor extends DuplicatedCodeProcessor {
private final TreeBackedLighterAST myAst;
private LightDuplicatedCodeProcessor(@NotNull TreeBackedLighterAST ast, VirtualFile file, Project project) {
@@ -212,7 +204,7 @@ public class DuplicatesInspectionBase extends LocalInspectionTool {
}
}
- class OldDuplicatedCodeProcessor extends DuplicatedCodeProcessor {
+ final class OldDuplicatedCodeProcessor extends DuplicatedCodeProcessor {
private OldDuplicatedCodeProcessor(VirtualFile file, Project project) {
super(file, project, myFilterOutGeneratedCode);
}
@@ -255,13 +247,13 @@ public class DuplicatesInspectionBase extends LocalInspectionTool {
}
}
- abstract static class DuplicatedCodeProcessor implements FileBasedIndex.ValueProcessor {
- final TreeMap reportedRanges = new TreeMap<>();
- final TIntObjectHashMap reportedFiles = new TIntObjectHashMap<>();
- final TIntObjectHashMap reportedPsi = new TIntObjectHashMap<>();
- final TIntIntHashMap reportedOffsetInOtherFiles = new TIntIntHashMap();
- final TIntIntHashMap fragmentSize = new TIntIntHashMap();
- final TIntLongHashMap fragmentHash = new TIntLongHashMap();
+ abstract static class DuplicatedCodeProcessor implements FileBasedIndex.ValueProcessor {
+ final Int2ObjectRBTreeMap reportedRanges = new Int2ObjectRBTreeMap<>();
+ final Int2ObjectOpenHashMap reportedFiles = new Int2ObjectOpenHashMap<>();
+ final Int2ObjectOpenHashMap reportedPsi = new Int2ObjectOpenHashMap<>();
+ final Int2IntOpenHashMap reportedOffsetInOtherFiles = new Int2IntOpenHashMap();
+ final Int2IntOpenHashMap fragmentSize = new Int2IntOpenHashMap();
+ final Int2LongOpenHashMap fragmentHash = new Int2LongOpenHashMap();
final VirtualFile virtualFile;
final Project project;
final FileIndex myFileIndex;
@@ -288,12 +280,12 @@ public class DuplicatesInspectionBase extends LocalInspectionTool {
}
@Override
- public boolean process(@NotNull VirtualFile file, TIntArrayList list) {
+ public boolean process(@NotNull VirtualFile file, IntArrayList list) {
for(int i = 0, len = list.size(); i < len; i+=2) {
ProgressManager.checkCanceled();
- if (list.getQuick(i + 1) != myHash2) continue;
- int offset = list.getQuick(i);
+ if (list.getInt(i + 1) != myHash2) continue;
+ int offset = list.getInt(i);
if (myFileIndex.isInSourceContent(virtualFile)) {
if (!myFileIndex.isInSourceContent(file)) return true;
@@ -312,13 +304,13 @@ public class DuplicatesInspectionBase extends LocalInspectionTool {
PsiElement target = getPsi(myNode);
TextRange rangeInElement = getRangeInElement(myNode);
- Integer fragmentStartOffsetInteger = startOffset;
- SortedMap map = reportedRanges.subMap(fragmentStartOffsetInteger, endOffset);
+ int fragmentStartOffsetInteger = startOffset;
+ Int2ObjectSortedMap map = reportedRanges.subMap(fragmentStartOffsetInteger, endOffset);
int newFragmentSize = !map.isEmpty() ? 0:1;
- Iterator iterator = map.keySet().iterator();
+ IntBidirectionalIterator iterator = map.keySet().iterator();
while(iterator.hasNext()) {
- Integer next = iterator.next();
+ int next = iterator.nextInt();
iterator.remove();
reportedFiles.remove(next);
reportedOffsetInOtherFiles.remove(next);
diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/InlayModel.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/InlayModel.java
index 14c7b416d1ad..21b21b7b10d3 100644
--- a/platform/editor-ui-api/src/com/intellij/openapi/editor/InlayModel.java
+++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/InlayModel.java
@@ -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-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.
package com.intellij.openapi.editor;
import com.intellij.openapi.Disposable;
@@ -30,7 +30,7 @@ public interface InlayModel {
/**
* Introduces an inline visual element at a given offset, its width and appearance is defined by the provided renderer.
*
- * @param relatesToPrecedingText whether element is associated with preceding or following text
+ * @param relatesToPrecedingText whether element is associated with preceding or following text
* (see {@link Inlay#isRelatedToPrecedingText()})
* @return {@code null} if requested element cannot be created, e.g. if corresponding functionality
* is not supported by current editor instance.
@@ -76,7 +76,7 @@ public interface InlayModel {
* Both visible and invisible (due to folding) elements are returned.
*/
@NotNull
- List getInlineElementsInRange(int startOffset, int endOffset);
+ List> getInlineElementsInRange(int startOffset, int endOffset);
/**
* Same as {@link #getInlineElementsInRange(int, int)}, but returned list contains only inlays with renderer of given type.
@@ -192,7 +192,7 @@ public interface InlayModel {
* @see #addAfterLineEndElement(int, boolean, EditorCustomElementRenderer)
*/
@NotNull
- List getAfterLineEndElementsForLogicalLine(int logicalLine);
+ List> getAfterLineEndElementsForLogicalLine(int logicalLine);
/**
* When text is inserted at inline element's offset, resulting element's position is determined by its
diff --git a/platform/execution-impl/intellij.platform.execution.impl.iml b/platform/execution-impl/intellij.platform.execution.impl.iml
index 4c2545dc3f53..4ef27679c50c 100644
--- a/platform/execution-impl/intellij.platform.execution.impl.iml
+++ b/platform/execution-impl/intellij.platform.execution.impl.iml
@@ -15,5 +15,6 @@
+
\ No newline at end of file
diff --git a/platform/execution-impl/src/com/intellij/execution/ui/layout/impl/RunnerLayout.java b/platform/execution-impl/src/com/intellij/execution/ui/layout/impl/RunnerLayout.java
index ebfdb71d5ce5..b126c7c46b14 100644
--- a/platform/execution-impl/src/com/intellij/execution/ui/layout/impl/RunnerLayout.java
+++ b/platform/execution-impl/src/com/intellij/execution/ui/layout/impl/RunnerLayout.java
@@ -10,20 +10,15 @@ import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.content.Content;
import com.intellij.util.containers.hash.LinkedHashMap;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.TreeSet;
-import javax.swing.Icon;
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import javax.swing.*;
+import java.util.*;
+
public class RunnerLayout {
public static final Key DEFAULT_INDEX = Key.create("RunnerLayoutDefaultIndex");
public static final Key DROP_INDEX = Key.create("RunnerLayoutDropIndex");
@@ -32,7 +27,7 @@ public class RunnerLayout {
private final Map myDefaultViews = new HashMap<>();
protected Set myTabs = new TreeSet<>(Comparator.comparingInt(TabImpl::getIndex));
- private final Map myDefaultTabs = new HashMap<>();
+ private final Int2ObjectOpenHashMap myDefaultTabs = new Int2ObjectOpenHashMap<>();
protected General myGeneral = new General();
private final Map> myDefaultFocus = new HashMap<>();
diff --git a/platform/lang-api/intellij.platform.lang.iml b/platform/lang-api/intellij.platform.lang.iml
index 18f41a6b6bdf..2e44a1114732 100644
--- a/platform/lang-api/intellij.platform.lang.iml
+++ b/platform/lang-api/intellij.platform.lang.iml
@@ -21,5 +21,6 @@
+
\ No newline at end of file
diff --git a/platform/lang-api/src/com/intellij/application/options/codeStyle/properties/AbstractCodeStylePropertyMapper.java b/platform/lang-api/src/com/intellij/application/options/codeStyle/properties/AbstractCodeStylePropertyMapper.java
index c3747cec0afc..1bd590214a0b 100644
--- a/platform/lang-api/src/com/intellij/application/options/codeStyle/properties/AbstractCodeStylePropertyMapper.java
+++ b/platform/lang-api/src/com/intellij/application/options/codeStyle/properties/AbstractCodeStylePropertyMapper.java
@@ -1,14 +1,18 @@
-// 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-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.
package com.intellij.application.options.codeStyle.properties;
import com.intellij.openapi.util.AtomicNotNullLazyValue;
import com.intellij.psi.codeStyle.CodeStyleSettings;
+import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import java.util.stream.Collectors;
public abstract class AbstractCodeStylePropertyMapper {
@@ -25,7 +29,7 @@ public abstract class AbstractCodeStylePropertyMapper {
}
private Map> createMap() {
- Map> accessorMap = new HashMap<>();
+ Object2ObjectOpenHashMap> accessorMap = new Object2ObjectOpenHashMap<>();
for (CodeStyleObjectDescriptor descriptor : getSupportedFields()) {
addAccessorsFor(accessorMap, descriptor.getCodeStyleObject(), descriptor.getSupportedFields());
}
diff --git a/platform/lang-api/src/com/intellij/application/options/codeStyle/properties/ExternalStringAccessor.java b/platform/lang-api/src/com/intellij/application/options/codeStyle/properties/ExternalStringAccessor.java
index 5d633639931c..1dcc55156990 100644
--- a/platform/lang-api/src/com/intellij/application/options/codeStyle/properties/ExternalStringAccessor.java
+++ b/platform/lang-api/src/com/intellij/application/options/codeStyle/properties/ExternalStringAccessor.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-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.
package com.intellij.application.options.codeStyle.properties;
import org.jetbrains.annotations.NotNull;
@@ -7,7 +7,6 @@ import org.jetbrains.annotations.Nullable;
import java.lang.reflect.Field;
public abstract class ExternalStringAccessor extends CodeStyleFieldAccessor {
-
public ExternalStringAccessor(@NotNull Object object, @NotNull Field field) {
super(object, field);
}
diff --git a/platform/lang-api/src/com/intellij/application/options/codeStyle/properties/MagicIntegerConstAccessor.java b/platform/lang-api/src/com/intellij/application/options/codeStyle/properties/MagicIntegerConstAccessor.java
index 058e4de6ba28..76021ecae4a9 100644
--- a/platform/lang-api/src/com/intellij/application/options/codeStyle/properties/MagicIntegerConstAccessor.java
+++ b/platform/lang-api/src/com/intellij/application/options/codeStyle/properties/MagicIntegerConstAccessor.java
@@ -1,7 +1,9 @@
-// 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-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.
package com.intellij.application.options.codeStyle.properties;
-import com.intellij.util.containers.BidirectionalMap;
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
+import it.unimi.dsi.fastutil.ints.IntArrayList;
+import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -10,7 +12,8 @@ import java.util.ArrayList;
import java.util.List;
public class MagicIntegerConstAccessor extends ExternalStringAccessor implements CodeStyleChoiceList {
- private final BidirectionalMap myValueMap = new BidirectionalMap<>();
+ private final Int2ObjectOpenHashMap myValueMap = new Int2ObjectOpenHashMap<>();
+ private final Object2ObjectOpenHashMap myValueToKeysMap = new Object2ObjectOpenHashMap<>();
public MagicIntegerConstAccessor(@NotNull Object object,
@NotNull Field field,
@@ -18,26 +21,26 @@ public class MagicIntegerConstAccessor extends ExternalStringAccessor i
String[] strValues) {
super(object, field);
for (int i = 0; i < Math.min(intValues.length, strValues.length); i ++) {
- myValueMap.put(intValues[i], strValues[i]);
+ String value = strValues[i];
+ int intValue = intValues[i];
+ myValueMap.put(intValue, value);
+ myValueToKeysMap.computeIfAbsent(value, __ -> new IntArrayList()).add(intValue);
}
}
- @Nullable
@Override
- protected final Integer fromExternal(@NotNull String str) {
- List keys = myValueMap.getKeysByValue(str);
- return keys != null && keys.size() > 0 ? keys.get(0) : null;
+ protected final @Nullable Integer fromExternal(@NotNull String str) {
+ IntArrayList keys = myValueToKeysMap.get(str);
+ return keys != null && keys.size() > 0 ? keys.getInt(0) : null;
}
- @NotNull
@Override
- protected final String toExternal(@NotNull Integer value) {
- return myValueMap.get(value);
+ protected final @NotNull String toExternal(@NotNull Integer value) {
+ return myValueMap.get(value.intValue());
}
- @NotNull
@Override
- public final List getChoices() {
+ public final @NotNull List getChoices() {
return new ArrayList<>(myValueMap.values());
}
}
diff --git a/platform/lang-api/src/com/intellij/execution/testframework/TestIconMapper.java b/platform/lang-api/src/com/intellij/execution/testframework/TestIconMapper.java
index 0630c59281e6..77d8a0dc76ad 100644
--- a/platform/lang-api/src/com/intellij/execution/testframework/TestIconMapper.java
+++ b/platform/lang-api/src/com/intellij/execution/testframework/TestIconMapper.java
@@ -1,35 +1,19 @@
-/*
- * 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-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.
package com.intellij.execution.testframework;
import com.intellij.execution.testframework.sm.runner.states.TestStateInfo;
import com.intellij.icons.AllIcons;
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
-import java.util.HashMap;
-import java.util.Map;
/**
* @author Dmitry Avdeev
*/
-public class TestIconMapper implements PoolOfTestIcons {
-
- private final static Map magnitudes = new HashMap<>();
+public final class TestIconMapper implements PoolOfTestIcons {
+ private final static Int2ObjectOpenHashMap magnitudes = new Int2ObjectOpenHashMap<>();
static {
for (TestStateInfo.Magnitude value : TestStateInfo.Magnitude.values()) {
diff --git a/platform/lang-api/src/com/intellij/formatting/WrapType.java b/platform/lang-api/src/com/intellij/formatting/WrapType.java
index f9c0bf1a6e63..d00a0a9133fd 100644
--- a/platform/lang-api/src/com/intellij/formatting/WrapType.java
+++ b/platform/lang-api/src/com/intellij/formatting/WrapType.java
@@ -1,11 +1,9 @@
-// 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-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.
package com.intellij.formatting;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
-
-import java.util.HashMap;
-import java.util.Map;
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
/**
* Defines possible types of a wrap.
@@ -40,7 +38,7 @@ public enum WrapType {
*/
CHOP_DOWN_IF_LONG(CommonCodeStyleSettings.WRAP_ON_EVERY_ITEM);
- private static final Map LEGACY_MAPPINGS = new HashMap<>();
+ private static final Int2ObjectOpenHashMap LEGACY_MAPPINGS = new Int2ObjectOpenHashMap<>();
static {
for (WrapType wrapType : values()) {
diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/extractor/values/Generation.java b/platform/lang-api/src/com/intellij/psi/codeStyle/extractor/values/Generation.java
index cbc3e8b8179f..0692af5ea160 100644
--- a/platform/lang-api/src/com/intellij/psi/codeStyle/extractor/values/Generation.java
+++ b/platform/lang-api/src/com/intellij/psi/codeStyle/extractor/values/Generation.java
@@ -1,20 +1,19 @@
// 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.
package com.intellij.psi.codeStyle.extractor.values;
-import com.intellij.openapi.util.Pair;
import com.intellij.psi.codeStyle.extractor.Utils;
import com.intellij.psi.codeStyle.extractor.differ.Differ;
+import com.intellij.util.IntPair;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
-public class Generation {
-
+public final class Generation {
private static final int GENERATION_POOL_SIZE = 45;
private static final int MUTATION_PER_GEN = 10;
- public static int GEN_COUNT = 40;
+ public static int GEN_COUNT = 40;
private List myGensPool;
private int myAge;
private final int myParentKind;
@@ -75,12 +74,12 @@ public class Generation {
}
private int reduceToSize(@NotNull Differ differ, int newPoolSize) {
- List> ranges = new ArrayList<>(myGensPool.size());
+ List ranges = new ArrayList<>(myGensPool.size());
int i = 0;
for (final Gens gens : myGensPool) {
int range = differ.getDifference(gens);
- ranges.add(Pair.create(range, i++));
+ ranges.add(new IntPair(range, i++));
if (range == 0) {
myAge = GEN_COUNT;
newPoolSize = 1;
@@ -93,7 +92,7 @@ public class Generation {
final ArrayList gensPool = new ArrayList<>(newPoolSize);
int count = 0;
int worseForward = 0;
- for (final Pair pair : ranges) {
+ for (IntPair pair : ranges) {
if (count >= newPoolSize) {
break;
}
diff --git a/platform/lang-impl/intellij.platform.lang.impl.iml b/platform/lang-impl/intellij.platform.lang.impl.iml
index 3d282594d8ca..4eaff235d558 100644
--- a/platform/lang-impl/intellij.platform.lang.impl.iml
+++ b/platform/lang-impl/intellij.platform.lang.impl.iml
@@ -46,5 +46,6 @@
+
-
+
\ No newline at end of file
diff --git a/platform/lang-impl/intellij.platform.lang.tests.iml b/platform/lang-impl/intellij.platform.lang.tests.iml
index 02f169f08aa2..5f7eb2ea9b59 100644
--- a/platform/lang-impl/intellij.platform.lang.tests.iml
+++ b/platform/lang-impl/intellij.platform.lang.tests.iml
@@ -37,5 +37,6 @@
+
\ No newline at end of file
diff --git a/platform/lang-impl/src/com/intellij/codeEditor/printing/ExportToHTMLManager.java b/platform/lang-impl/src/com/intellij/codeEditor/printing/ExportToHTMLManager.java
index 0bd3018b21c6..22930eb22aa5 100644
--- a/platform/lang-impl/src/com/intellij/codeEditor/printing/ExportToHTMLManager.java
+++ b/platform/lang-impl/src/com/intellij/codeEditor/printing/ExportToHTMLManager.java
@@ -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-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.
package com.intellij.codeEditor.printing;
@@ -18,6 +18,7 @@ import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.psi.*;
import com.intellij.psi.impl.file.PsiDirectoryFactory;
+import it.unimi.dsi.fastutil.ints.Int2ObjectRBTreeMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -134,7 +135,7 @@ class ExportToHTMLManager {
@NotNull
protected static String doPaint(@NotNull String dirName,
@NotNull HTMLTextPainter textPainter,
- @Nullable Map refMap) throws IOException {
+ @Nullable Int2ObjectRBTreeMap refMap) throws IOException {
String htmlFile = dirName + File.separator + getHTMLFileName(textPainter.getPsiFile());
try (OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(htmlFile), StandardCharsets.UTF_8)) {
textPainter.paint(refMap, writer, true);
@@ -156,11 +157,11 @@ class ExportToHTMLManager {
if (!psiFile.isValid()) {
return;
}
- Map refMap = null;
+ Int2ObjectRBTreeMap refMap = null;
for (PrintOption printOption : PrintOption.EP_NAME.getExtensionList()) {
final TreeMap map = printOption.collectReferences(psiFile, filesMap);
if (map != null) {
- refMap = new TreeMap<>(map);
+ refMap = new Int2ObjectRBTreeMap<>(map);
}
}
diff --git a/platform/lang-impl/src/com/intellij/codeEditor/printing/HTMLTextPainter.java b/platform/lang-impl/src/com/intellij/codeEditor/printing/HTMLTextPainter.java
index b261a6c1800e..0e51996e6296 100644
--- a/platform/lang-impl/src/com/intellij/codeEditor/printing/HTMLTextPainter.java
+++ b/platform/lang-impl/src/com/intellij/codeEditor/printing/HTMLTextPainter.java
@@ -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-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.
package com.intellij.codeEditor.printing;
import com.intellij.application.options.CodeStyle;
@@ -22,6 +22,8 @@ import com.intellij.psi.impl.file.PsiDirectoryFactory;
import com.intellij.ui.ColorUtil;
import com.intellij.ui.Gray;
import com.intellij.ui.JBColor;
+import it.unimi.dsi.fastutil.ints.Int2ObjectRBTreeMap;
+import it.unimi.dsi.fastutil.ints.IntIterator;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -30,7 +32,10 @@ import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.StringTokenizer;
public class HTMLTextPainter {
private static final Logger LOG = Logger.getInstance(HTMLTextPainter.class);
@@ -106,7 +111,7 @@ public class HTMLTextPainter {
myFirstLineNumber = firstLineNumber;
}
- public void paint(@Nullable Map refMap, @NotNull Writer writer, boolean isStandalone) throws IOException {
+ public void paint(@Nullable Int2ObjectRBTreeMap refMap, @NotNull Writer writer, boolean isStandalone) throws IOException {
HighlighterIterator hIterator = myHighlighter.createIterator(myOffset);
if (hIterator.atEnd()) {
return;
@@ -114,16 +119,15 @@ public class HTMLTextPainter {
lineCount = myFirstLineNumber;
TextAttributes prevAttributes = null;
- Iterator refKeys = null;
-
+ IntIterator refKeys = null;
int refOffset = -1;
PsiReference ref = null;
if (refMap != null) {
refKeys = refMap.keySet().iterator();
if (refKeys.hasNext()) {
- Integer key = refKeys.next();
+ int key = refKeys.nextInt();
ref = refMap.get(key);
- refOffset = key.intValue();
+ refOffset = key;
}
}
@@ -201,9 +205,9 @@ public class HTMLTextPainter {
writer.write("");
referenceEnd = -1;
if (refKeys.hasNext()) {
- Integer key = refKeys.next();
+ int key = refKeys.nextInt();
ref = refMap.get(key);
- refOffset = key.intValue();
+ refOffset = key;
}
}
hIterator.advance();
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoComponent.java b/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoComponent.java
index d19472ce4537..b29bef42f162 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoComponent.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoComponent.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-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.
package com.intellij.codeInsight.hint;
@@ -24,6 +24,9 @@ import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.accessibility.AccessibleContextUtil;
import com.intellij.xml.util.XmlStringUtil;
+import it.unimi.dsi.fastutil.ints.Int2IntMap;
+import it.unimi.dsi.fastutil.ints.Int2IntMaps;
+import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
@@ -519,7 +522,7 @@ public class ParameterInfoComponent extends JPanel {
}
}
- private class OneLineComponent extends JPanel {
+ private final class OneLineComponent extends JPanel {
JLabel myLabel = new JLabel("", SwingConstants.LEFT);
private OneLineComponent(){
@@ -586,7 +589,7 @@ public class ParameterInfoComponent extends JPanel {
// flagsMap is supposed to use TEXT_RANGE_COMPARATOR
private String buildLabelText(@NotNull final String text, @NotNull final TreeMap flagsMap) {
final StringBuilder labelText = new StringBuilder(text);
- final Map faultMap = new HashMap<>();
+ final Int2IntOpenHashMap faultMap = new Int2IntOpenHashMap();
for (Map.Entry entry : flagsMap.entrySet()) {
final TextRange highlightRange = entry.getKey();
@@ -599,10 +602,10 @@ public class ParameterInfoComponent extends JPanel {
int startOffset = highlightRange.getStartOffset();
int endOffset = highlightRange.getEndOffset() + tag.length();
- for (Map.Entry entry1 : faultMap.entrySet()) {
- if (entry1.getKey() <= highlightRange.getStartOffset()) {
- startOffset += entry1.getValue();
- endOffset += entry1.getValue();
+ for (Int2IntMap.Entry entry1 : Int2IntMaps.fastIterable(faultMap)) {
+ if (entry1.getIntKey() <= highlightRange.getStartOffset()) {
+ startOffset += entry1.getIntValue();
+ endOffset += entry1.getIntValue();
}
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupCellRenderer.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupCellRenderer.java
index 76fbfb3c1640..f1a38e43a50f 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupCellRenderer.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupCellRenderer.java
@@ -3,8 +3,10 @@
package com.intellij.codeInsight.lookup.impl;
import com.google.common.annotations.VisibleForTesting;
-import com.intellij.codeInsight.lookup.*;
-import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.codeInsight.lookup.LookupElement;
+import com.intellij.codeInsight.lookup.LookupElementPresentation;
+import com.intellij.codeInsight.lookup.LookupElementRenderer;
+import com.intellij.codeInsight.lookup.LookupFocusDegree;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.editor.colors.EditorColorsUtil;
@@ -29,13 +31,16 @@ import com.intellij.util.ui.EmptyIcon;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.accessibility.AccessibleContextUtil;
+import it.unimi.dsi.fastutil.ints.Int2BooleanOpenHashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.border.Border;
import java.awt.*;
-import java.util.*;
+import java.util.HashSet;
+import java.util.Objects;
+import java.util.Set;
import static com.intellij.codeInsight.documentation.DocumentationComponent.COLOR_KEY;
@@ -43,9 +48,7 @@ import static com.intellij.codeInsight.documentation.DocumentationComponent.COLO
* @author peter
* @author Konstantin Bulenkov
*/
-public class LookupCellRenderer implements ListCellRenderer {
- private static final Logger LOG = Logger.getInstance(LookupCellRenderer.class);
-
+public final class LookupCellRenderer implements ListCellRenderer {
private Icon myEmptyIcon = EmptyIcon.ICON_0;
private final Font myNormalFont;
private final Font myBoldFont;
@@ -66,7 +69,7 @@ public class LookupCellRenderer implements ListCellRenderer {
private final SimpleColoredComponent myTailComponent;
private final SimpleColoredComponent myTypeLabel;
private final LookupPanel myPanel;
- private final Map mySelected = new HashMap<>();
+ private final Int2BooleanOpenHashMap mySelected = new Int2BooleanOpenHashMap();
private static final String ELLIPSIS = "\u2026";
private int myMaxWidth = -1;
@@ -525,7 +528,7 @@ public class LookupCellRenderer implements ListCellRenderer {
return 0;
}
- private static class MySimpleColoredComponent extends SimpleColoredComponent {
+ private static final class MySimpleColoredComponent extends SimpleColoredComponent {
private MySimpleColoredComponent() {
setFocusBorderAroundIcon(true);
}
diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/RenameUtil.java b/platform/lang-impl/src/com/intellij/refactoring/rename/RenameUtil.java
index 839454a7a209..ddd7d33db232 100644
--- a/platform/lang-impl/src/com/intellij/refactoring/rename/RenameUtil.java
+++ b/platform/lang-impl/src/com/intellij/refactoring/rename/RenameUtil.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-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.
package com.intellij.refactoring.rename;
@@ -38,13 +38,15 @@ import com.intellij.usageView.UsageInfoFactory;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.Processor;
import com.intellij.util.containers.MultiMap;
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
+import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
-public class RenameUtil {
+public final class RenameUtil {
private static final Logger LOG = Logger.getInstance(RenameUtil.class);
private RenameUtil() {
@@ -288,7 +290,7 @@ public class RenameUtil {
public static void renameNonCodeUsages(@NotNull Project project, NonCodeUsageInfo @NotNull [] usages) {
PsiDocumentManager.getInstance(project).commitAllDocuments();
- Map> docsToOffsetsMap = new HashMap<>();
+ Object2ObjectOpenHashMap> docsToOffsetsMap = new Object2ObjectOpenHashMap<>();
final PsiDocumentManager psiDocumentManager = PsiDocumentManager.getInstance(project);
for (NonCodeUsageInfo usage : usages) {
PsiElement element = usage.getElement();
@@ -315,9 +317,9 @@ public class RenameUtil {
}
int fileOffset = replaceRange.getStartOffset();
- Map offsetMap = docsToOffsetsMap.get(document);
+ Int2ObjectOpenHashMap offsetMap = docsToOffsetsMap.get(document);
if (offsetMap == null) {
- offsetMap = new HashMap<>();
+ offsetMap = new Int2ObjectOpenHashMap<>();
docsToOffsetsMap.put(document, offsetMap);
}
final UsageOffset substitution = new UsageOffset(fileOffset, fileOffset + rangeInElement.getLength(), usage.newText);
diff --git a/platform/lvcs-impl/intellij.platform.lvcs.impl.iml b/platform/lvcs-impl/intellij.platform.lvcs.impl.iml
index 360c145e01a4..31efcf89d6a7 100644
--- a/platform/lvcs-impl/intellij.platform.lvcs.impl.iml
+++ b/platform/lvcs-impl/intellij.platform.lvcs.impl.iml
@@ -14,6 +14,7 @@
+
diff --git a/platform/lvcs-impl/src/com/intellij/history/integration/ui/models/SelectionCalculator.java b/platform/lvcs-impl/src/com/intellij/history/integration/ui/models/SelectionCalculator.java
index cdd9aac71d22..a0e352e256e9 100644
--- a/platform/lvcs-impl/src/com/intellij/history/integration/ui/models/SelectionCalculator.java
+++ b/platform/lvcs-impl/src/com/intellij/history/integration/ui/models/SelectionCalculator.java
@@ -1,19 +1,4 @@
-/*
- * Copyright 2000-2009 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-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.
package com.intellij.history.integration.ui.models;
import com.intellij.diff.Block;
@@ -21,20 +6,19 @@ import com.intellij.history.core.Content;
import com.intellij.history.core.revisions.Revision;
import com.intellij.history.core.tree.Entry;
import com.intellij.history.integration.IdeaGateway;
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import org.jetbrains.annotations.Nullable;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
-public class SelectionCalculator {
+public final class SelectionCalculator {
private static final Block EMPTY_BLOCK = new Block("", 0, 0);
-
+
private final IdeaGateway myGateway;
private final List extends Revision> myRevisions;
private final int myFromLine;
private final int myToLine;
- private final Map myCache = new HashMap<>();
+ private final Int2ObjectOpenHashMap myCache = new Int2ObjectOpenHashMap<>();
public SelectionCalculator(IdeaGateway gw, List extends Revision> rr, int fromLine, int toLine) {
myGateway = gw;
@@ -71,7 +55,7 @@ public class SelectionCalculator {
Block result;
if (content == null) {
- result = EMPTY_BLOCK;
+ result = EMPTY_BLOCK;
} else if (revisionIndex == 0) {
result = new Block(content, myFromLine, myToLine + 1);
}
diff --git a/platform/platform-api/intellij.platform.ide.iml b/platform/platform-api/intellij.platform.ide.iml
index 9db5af9f8498..c69df393e493 100644
--- a/platform/platform-api/intellij.platform.ide.iml
+++ b/platform/platform-api/intellij.platform.ide.iml
@@ -45,5 +45,6 @@
+
\ No newline at end of file
diff --git a/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizardEx.java b/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizardEx.java
index f9a7ec6f033e..38bc05055dc7 100644
--- a/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizardEx.java
+++ b/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizardEx.java
@@ -1,19 +1,4 @@
-/*
- * Copyright 2000-2010 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-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.
package com.intellij.ide.wizard;
import com.intellij.openapi.project.Project;
@@ -21,6 +6,7 @@ import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.ui.JBCardLayout;
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -29,10 +15,9 @@ import java.util.List;
import java.util.Map;
public class AbstractWizardEx extends AbstractWizard {
-
private final String myTitle;
private final Map