From ae0f480588607ea0bdaed0880a07c0ba982e9ccb Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Fri, 29 May 2020 10:06:09 +0200 Subject: [PATCH] cleanup, migrate from trove int collections to fastutil GitOrigin-RevId: b23aafcf94ac76c8fd88d022c32ecac6a33a0be9 --- .../compiler/BaseCompilerTestCase.java | 6 +-- .../compiler/CompilerEncodingServiceTest.java | 5 ++- .../PackagingValidationTestCase.java | 9 ++-- .../FrameworkSupportUtil.java | 11 +++-- .../com/intellij/uast/UastMetaLanguage.java | 6 +-- .../openapi/editor/impl/CaretModelImpl.java | 27 ++++++------ .../vfs/newvfs/persistent/FSRecords.java | 7 +-- .../backend/src/debugger/SuspendContext.kt | 4 +- .../src/debugger/sourcemap/NestedSourceMap.kt | 6 +-- .../src/debugger/sourcemap/SourceResolver.kt | 43 ++++++++++++------- .../util/containers/EmptyIntHashSet.java | 6 +-- 11 files changed, 71 insertions(+), 59 deletions(-) diff --git a/java/compiler/tests/com/intellij/compiler/BaseCompilerTestCase.java b/java/compiler/tests/com/intellij/compiler/BaseCompilerTestCase.java index 6b9641bb246b..e02d1c946a04 100644 --- a/java/compiler/tests/com/intellij/compiler/BaseCompilerTestCase.java +++ b/java/compiler/tests/com/intellij/compiler/BaseCompilerTestCase.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.compiler; import com.intellij.ProjectTopics; @@ -26,11 +26,11 @@ import com.intellij.packaging.impl.compiler.ArtifactCompileScope; import com.intellij.pom.java.LanguageLevel; import com.intellij.testFramework.*; import com.intellij.util.concurrency.Semaphore; +import com.intellij.util.containers.CollectionFactory; import com.intellij.util.io.DirectoryContentSpec; import com.intellij.util.io.DirectoryContentSpecKt; import com.intellij.util.io.TestFileSystemBuilder; import com.intellij.util.ui.UIUtil; -import gnu.trove.THashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jps.util.JpsPathUtil; @@ -399,7 +399,7 @@ public abstract class BaseCompilerTestCase extends JavaModuleTestCase { myExternalBuildUpToDate = externalBuildUpToDate; myErrors = errors; myWarnings = warnings; - myGeneratedPaths = new THashSet<>(generatedFilePaths, FileUtil.PATH_HASHING_STRATEGY); + myGeneratedPaths = CollectionFactory.createFilePathSet(generatedFilePaths); } public void assertUpToDate() { diff --git a/java/compiler/tests/com/intellij/compiler/CompilerEncodingServiceTest.java b/java/compiler/tests/com/intellij/compiler/CompilerEncodingServiceTest.java index 4dd638f46a2e..3ffce5e7ed98 100644 --- a/java/compiler/tests/com/intellij/compiler/CompilerEncodingServiceTest.java +++ b/java/compiler/tests/com/intellij/compiler/CompilerEncodingServiceTest.java @@ -1,16 +1,17 @@ +// 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.compiler; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.encoding.EncodingProjectManager; import com.intellij.testFramework.JavaPsiTestCase; import com.intellij.testFramework.PsiTestUtil; -import gnu.trove.THashSet; import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.nio.charset.Charset; import java.util.Arrays; import java.util.Collection; +import java.util.HashSet; import java.util.Set; public class CompilerEncodingServiceTest extends JavaPsiTestCase { @@ -18,7 +19,7 @@ public class CompilerEncodingServiceTest extends JavaPsiTestCase { private static final Charset WINDOWS_1252 = Charset.forName("windows-1252"); private Collection projectDefaultPlus(Charset @NotNull ... charsets) { - Set result = new THashSet<>(); + Set result = new HashSet<>(); result.add(getProjectDefault()); result.addAll(Arrays.asList(charsets)); return result; diff --git a/java/compiler/tests/com/intellij/compiler/artifacts/PackagingValidationTestCase.java b/java/compiler/tests/com/intellij/compiler/artifacts/PackagingValidationTestCase.java index 82ee2d62e049..dfcea75d1126 100644 --- a/java/compiler/tests/com/intellij/compiler/artifacts/PackagingValidationTestCase.java +++ b/java/compiler/tests/com/intellij/compiler/artifacts/PackagingValidationTestCase.java @@ -1,3 +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. package com.intellij.compiler.artifacts; import com.intellij.openapi.util.text.StringUtil; @@ -8,14 +9,10 @@ import com.intellij.packaging.elements.PackagingElement; import com.intellij.packaging.impl.ui.ArtifactProblemsHolderBase; import com.intellij.packaging.ui.ArtifactProblemQuickFix; import com.intellij.util.containers.ContainerUtil; -import gnu.trove.THashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; public abstract class PackagingValidationTestCase extends PackagingElementsTestCase { protected PackagingValidationTestCase() { @@ -32,7 +29,7 @@ public abstract class PackagingValidationTestCase extends PackagingElementsTestC protected class MockArtifactProblemsHolder extends ArtifactProblemsHolderBase { private final List myProblems = new ArrayList<>(); - private final Map myQuickFixes = new THashMap<>(); + private final Map myQuickFixes = new HashMap<>(); public MockArtifactProblemsHolder() { super(new MockPackagingEditorContext(new MockArtifactsStructureConfigurableContext(), null)); diff --git a/java/idea-ui/src/com/intellij/ide/util/frameworkSupport/FrameworkSupportUtil.java b/java/idea-ui/src/com/intellij/ide/util/frameworkSupport/FrameworkSupportUtil.java index d126e348e215..92c431759462 100644 --- a/java/idea-ui/src/com/intellij/ide/util/frameworkSupport/FrameworkSupportUtil.java +++ b/java/idea-ui/src/com/intellij/ide/util/frameworkSupport/FrameworkSupportUtil.java @@ -1,5 +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.ide.util.frameworkSupport; import com.intellij.framework.FrameworkTypeEx; @@ -10,7 +9,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleType; import com.intellij.openapi.roots.ui.configuration.FacetsProvider; -import com.intellij.openapi.util.Couple; +import com.intellij.openapi.util.Pair; import com.intellij.util.graph.CachingSemiGraph; import com.intellij.util.graph.DFSTBuilder; import com.intellij.util.graph.GraphGenerator; @@ -20,7 +19,7 @@ import org.jetbrains.annotations.Nullable; import java.util.*; -public class FrameworkSupportUtil { +public final class FrameworkSupportUtil { private static final Logger LOG = Logger.getInstance(FrameworkSupportUtil.class); private FrameworkSupportUtil() { @@ -38,7 +37,7 @@ public class FrameworkSupportUtil { @Nullable Module module, @NotNull FacetsProvider facetsProvider) { List allProviders = getAllProviders(); - ArrayList result = new ArrayList<>(); + List result = new ArrayList<>(); for (FrameworkSupportInModuleProvider provider : allProviders) { if (provider.isEnabledForModuleType(moduleType) && (module == null || provider.canAddSupport(module, facetsProvider))) { result.add(provider); @@ -82,7 +81,7 @@ public class FrameworkSupportUtil { DFSTBuilder builder = new DFSTBuilder<>(GraphGenerator.generate(CachingSemiGraph.cache(new ProvidersGraph(types)))); if (!builder.isAcyclic()) { - Couple pair = builder.getCircularDependency(); + Pair pair = builder.getCircularDependency(); LOG.error("Circular dependency between types '" + pair.getFirst().getFrameworkType().getId() + "' and '" + pair.getSecond().getFrameworkType().getId() + "' was found."); } diff --git a/java/java-analysis-api/src/com/intellij/uast/UastMetaLanguage.java b/java/java-analysis-api/src/com/intellij/uast/UastMetaLanguage.java index ae1126b66c69..2592398d7bfe 100644 --- a/java/java-analysis-api/src/com/intellij/uast/UastMetaLanguage.java +++ b/java/java-analysis-api/src/com/intellij/uast/UastMetaLanguage.java @@ -3,22 +3,22 @@ package com.intellij.uast; import com.intellij.lang.Language; import com.intellij.lang.MetaLanguage; -import gnu.trove.THashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.uast.UastLanguagePlugin; import java.util.Collection; import java.util.Collections; +import java.util.HashSet; import java.util.Set; public final class UastMetaLanguage extends MetaLanguage { private final Set myLanguages; - protected UastMetaLanguage() { + private UastMetaLanguage() { super("UAST"); Collection languagePlugins = UastLanguagePlugin.Companion.getInstances(); - myLanguages = new THashSet<>(languagePlugins.size()); + myLanguages = new HashSet<>(languagePlugins.size()); initLanguages(languagePlugins); UastLanguagePlugin.Companion.getExtensionPointName().addChangeListener(() -> { diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretModelImpl.java index 035820f6f7c3..381bccaced95 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretModelImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretModelImpl.java @@ -18,7 +18,8 @@ import com.intellij.openapi.util.Disposer; import com.intellij.util.EventDispatcher; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.EmptyClipboardOwner; -import gnu.trove.TIntArrayList; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntCollection; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.TestOnly; @@ -29,7 +30,7 @@ import java.awt.datatransfer.StringSelection; import java.util.List; import java.util.*; -public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener, Disposable, Dumpable, InlayModel.Listener { +public final class CaretModelImpl implements CaretModel, PrioritizedDocumentListener, Disposable, Dumpable, InlayModel.Listener { private final EditorImpl myEditor; private final EventDispatcher myCaretListeners = EventDispatcher.create(CaretListener.class); @@ -428,10 +429,10 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener, int index = 0; int oldCaretCount = myCarets.size(); Iterator caretIterator = myCarets.iterator(); - TIntArrayList selectionStartsBefore = null; - TIntArrayList selectionStartsAfter = null; - TIntArrayList selectionEndsBefore = null; - TIntArrayList selectionEndsAfter = null; + IntCollection selectionStartsBefore = null; + IntCollection selectionStartsAfter = null; + IntCollection selectionEndsBefore = null; + IntCollection selectionEndsAfter = null; for (CaretState caretState : caretStates) { CaretImpl caret; if (index++ < oldCaretCount) { @@ -458,10 +459,10 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener, if (caretState != null && caretState.getSelectionStart() != null && caretState.getSelectionEnd() != null) { if (selectionStartsBefore == null) { int capacity = caretStates.size(); - selectionStartsBefore = new TIntArrayList(capacity); - selectionStartsAfter = new TIntArrayList(capacity); - selectionEndsBefore = new TIntArrayList(capacity); - selectionEndsAfter = new TIntArrayList(capacity); + selectionStartsBefore = new IntArrayList(capacity); + selectionStartsAfter = new IntArrayList(capacity); + selectionEndsBefore = new IntArrayList(capacity); + selectionEndsAfter = new IntArrayList(capacity); } selectionStartsBefore.add(caret.getSelectionStart()); selectionEndsBefore.add(caret.getSelectionEnd()); @@ -488,8 +489,8 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener, updateSystemSelection(); } if (selectionStartsBefore != null) { - SelectionEvent event = new SelectionEvent(myEditor, selectionStartsBefore.toNativeArray(), selectionEndsBefore.toNativeArray(), - selectionStartsAfter.toNativeArray(), selectionEndsAfter.toNativeArray()); + SelectionEvent event = new SelectionEvent(myEditor, selectionStartsBefore.toIntArray(), selectionEndsBefore.toIntArray(), + selectionStartsAfter.toIntArray(), selectionEndsAfter.toIntArray()); myEditor.getSelectionModel().fireSelectionChanged(event); } }); @@ -582,7 +583,7 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener, if (placement == Inlay.Placement.INLINE) { doWithCaretMerging(() -> { for (CaretImpl caret : myCarets) { - caret.onInlayRemoved(inlay.getOffset(), ((InlineInlayImpl)inlay).getOrder()); + caret.onInlayRemoved(inlay.getOffset(), ((InlineInlayImpl)inlay).getOrder()); } }); } diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java index 6c7f0b1f6b40..56191867cd22 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecords.java @@ -33,6 +33,7 @@ import com.intellij.util.io.storage.*; import gnu.trove.TIntArrayList; import gnu.trove.TObjectHashingStrategy; import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; import org.jetbrains.annotations.*; import javax.swing.*; @@ -181,7 +182,7 @@ public final class FSRecords { private static ContentHashEnumerator myContentHashesEnumerator; private static File myRootsFile; private static final VfsDependentEnum myAttributesList = new VfsDependentEnum<>("attrib", EnumeratorStringDescriptor.INSTANCE, 1); - private static final TIntArrayList myFreeRecords = new TIntArrayList(); + private static final IntList myFreeRecords = new IntArrayList(); private static volatile boolean myDirty; /** accessed under {@link #r}/{@link #w} */ @@ -214,7 +215,7 @@ public final class FSRecords { } static int getFreeRecord() { - return myFreeRecords.isEmpty() ? 0 : myFreeRecords.remove(myFreeRecords.size() - 1); + return myFreeRecords.isEmpty() ? 0 : myFreeRecords.removeInt(myFreeRecords.size() - 1); } private static void createBrokenMarkerFile(@Nullable Throwable reason) { @@ -1116,7 +1117,7 @@ public final class FSRecords { int nameId = dup.getNameId(); assert nameId > 0 : existingList; ChildInfoImpl replaced = new ChildInfoImpl(oldChild.getId(), nameId, dup.getFileAttributes(), dup.getChildren(), - dup.getSymLinkTarget()); + dup.getSymLinkTarget()); result.set(dupI, replaced); } j++; diff --git a/platform/script-debugger/backend/src/debugger/SuspendContext.kt b/platform/script-debugger/backend/src/debugger/SuspendContext.kt index 511d6d89ef63..dc62b6a8170e 100755 --- a/platform/script-debugger/backend/src/debugger/SuspendContext.kt +++ b/platform/script-debugger/backend/src/debugger/SuspendContext.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-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 org.jetbrains.debugger import org.jetbrains.concurrency.Promise @@ -22,7 +22,7 @@ interface SuspendContext { var methodReturnValue: Variable? get() = null - set(v) {} + set(_) {} /** * Call frames for the current suspended state (from the innermost (top) frame to the main (bottom) frame) diff --git a/platform/script-debugger/backend/src/debugger/sourcemap/NestedSourceMap.kt b/platform/script-debugger/backend/src/debugger/sourcemap/NestedSourceMap.kt index a8db8c3d3083..dde9800c3ed2 100644 --- a/platform/script-debugger/backend/src/debugger/sourcemap/NestedSourceMap.kt +++ b/platform/script-debugger/backend/src/debugger/sourcemap/NestedSourceMap.kt @@ -1,9 +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 org.jetbrains.debugger.sourcemap import com.intellij.openapi.vfs.VirtualFile import com.intellij.util.Url -import gnu.trove.THashMap +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap class NestedSourceMap(private val childMap: SourceMap, private val parentMap: SourceMap) : SourceMap { override val sourceResolver: SourceResolver @@ -14,7 +14,7 @@ class NestedSourceMap(private val childMap: SourceMap, private val parentMap: So private val sourceIndexToSourceMappings = arrayOfNulls(parentMap.sources.size) - private val childMappingToTransformed = THashMap() + private val childMappingToTransformed = Object2ObjectOpenHashMap() override val outFile: String? get() = childMap.outFile diff --git a/platform/script-debugger/backend/src/debugger/sourcemap/SourceResolver.kt b/platform/script-debugger/backend/src/debugger/sourcemap/SourceResolver.kt index 5830cfd9357a..0ef24bdfaf59 100644 --- a/platform/script-debugger/backend/src/debugger/sourcemap/SourceResolver.kt +++ b/platform/script-debugger/backend/src/debugger/sourcemap/SourceResolver.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-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 org.jetbrains.debugger.sourcemap import com.intellij.openapi.util.SystemInfo @@ -8,8 +8,11 @@ import com.intellij.openapi.vfs.VfsUtilCore import com.intellij.openapi.vfs.VirtualFile import com.intellij.util.Url import com.intellij.util.Urls -import com.intellij.util.containers.ObjectIntHashMap import com.intellij.util.io.URLUtil +import it.unimi.dsi.fastutil.Hash +import it.unimi.dsi.fastutil.objects.Object2IntMap +import it.unimi.dsi.fastutil.objects.Object2IntOpenCustomHashMap +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap import org.jetbrains.debugger.ScriptDebuggerUrls import java.io.File @@ -17,7 +20,7 @@ interface SourceFileResolver { /** * Return -1 if no match */ - fun resolve(map: ObjectIntHashMap): Int = -1 + fun resolve(map: Object2IntMap): Int = -1 fun resolve(rawSources: List): Int = -1 } @@ -33,15 +36,19 @@ class SourceResolver(private val rawSources: List, Array(rawSources.size) { canonicalizeUrl(rawSources[it], baseUrl, trimFileScheme, baseUrlIsFile) } } - private val canonicalizedUrlToSourceIndex: ObjectIntHashMap by lazy { - ( - if (SystemInfo.isFileSystemCaseSensitive) ObjectIntHashMap(rawSources.size) - else ObjectIntHashMap(rawSources.size, Urls.caseInsensitiveUrlHashingStrategy) - ).also { - for (i in rawSources.indices) { - it.put(canonicalizedUrls[i], i) - } + private val canonicalizedUrlToSourceIndex: Object2IntMap by lazy { + val map: Object2IntMap = if (SystemInfo.isFileSystemCaseSensitive) { + Object2IntOpenHashMap(rawSources.size) } + else { + Object2IntOpenCustomHashMap(rawSources.size, CaseInsensitiveUrlHashingStrategy) + } + map.defaultReturnValue(-1) + + for (i in rawSources.indices) { + map.put(canonicalizedUrls[i], i) + } + map } fun getSource(entry: MappingEntry): Url? { @@ -49,7 +56,7 @@ class SourceResolver(private val rawSources: List, return if (index < 0) null else canonicalizedUrls[index] } - fun getSourceIndex(url: Url): Int = canonicalizedUrlToSourceIndex[url] + fun getSourceIndex(url: Url): Int = canonicalizedUrlToSourceIndex.getInt(url) internal fun findSourceIndex(resolver: SourceFileResolver): Int { val resolveByCanonicalizedUrls = resolver.resolve(canonicalizedUrlToSourceIndex) @@ -57,7 +64,7 @@ class SourceResolver(private val rawSources: List, } fun findSourceIndex(sourceUrl: Url, sourceFile: VirtualFile?, localFileUrlOnly: Boolean): Int { - val index = canonicalizedUrlToSourceIndex.get(sourceUrl) + val index = canonicalizedUrlToSourceIndex.getInt(sourceUrl) if (index != -1) { return index } @@ -70,7 +77,7 @@ class SourceResolver(private val rawSources: List, internal fun findSourceIndexByFile(sourceFile: VirtualFile, localFileUrlOnly: Boolean): Int { if (!localFileUrlOnly) { - val index = canonicalizedUrlToSourceIndex.get(Urls.newFromVirtualFile(sourceFile).trimParameters()) + val index = canonicalizedUrlToSourceIndex.getInt(Urls.newFromVirtualFile(sourceFile).trimParameters()) if (index != -1) { return index } @@ -80,7 +87,7 @@ class SourceResolver(private val rawSources: List, return -1 } - val index = canonicalizedUrlToSourceIndex.get(ScriptDebuggerUrls.newLocalFileUrl(sourceFile)) + val index = canonicalizedUrlToSourceIndex.getInt(ScriptDebuggerUrls.newLocalFileUrl(sourceFile)) if (index != -1) { return index } @@ -160,3 +167,9 @@ fun doCanonicalize(url: String, baseUrl: Url, baseUrlIsFile: Boolean, asLocalFil return Urls.newUrl(baseUrl.scheme, baseUrl.authority, split[0], if (split.size > 1) '?' + split[1] else null) } } + +private object CaseInsensitiveUrlHashingStrategy: Hash.Strategy { + override fun hashCode(url: Url?) = url?.hashCodeCaseInsensitive() ?: 0 + + override fun equals(url1: Url, url2: Url) = Urls.equals(url1, url2, caseSensitive = false, ignoreParameters = false) +} \ No newline at end of file diff --git a/platform/util/src/com/intellij/util/containers/EmptyIntHashSet.java b/platform/util/src/com/intellij/util/containers/EmptyIntHashSet.java index 6c47a5f91be9..93351fff7a0d 100644 --- a/platform/util/src/com/intellij/util/containers/EmptyIntHashSet.java +++ b/platform/util/src/com/intellij/util/containers/EmptyIntHashSet.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.util.containers; import com.intellij.util.ArrayUtilRt; @@ -9,9 +9,9 @@ import gnu.trove.TIntProcedure; import java.util.NoSuchElementException; -public class EmptyIntHashSet extends TIntHashSet { +public final class EmptyIntHashSet extends TIntHashSet { public static final TIntHashSet INSTANCE = new EmptyIntHashSet(); - public static final TIntIterator EMPTY_INT_ITERATOR = new TIntIterator(INSTANCE) { + private static final TIntIterator EMPTY_INT_ITERATOR = new TIntIterator(INSTANCE) { @Override public int next() { throw new NoSuchElementException();