diff --git a/RegExpSupport/intellij.regexp.iml b/RegExpSupport/intellij.regexp.iml index dacbda0a51db..9f0f4cb8b845 100644 --- a/RegExpSupport/intellij.regexp.iml +++ b/RegExpSupport/intellij.regexp.iml @@ -18,5 +18,6 @@ + \ No newline at end of file diff --git a/RegExpSupport/src/org/intellij/lang/regexp/intention/CheckRegExpForm.java b/RegExpSupport/src/org/intellij/lang/regexp/intention/CheckRegExpForm.java index ce57647a7407..cb14e6c934b8 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/intention/CheckRegExpForm.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/intention/CheckRegExpForm.java @@ -48,6 +48,7 @@ import org.jetbrains.annotations.TestOnly; import javax.swing.*; import java.awt.*; +import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -55,7 +56,7 @@ import java.util.regex.Pattern; /** * @author Konstantin Bulenkov */ -public class CheckRegExpForm { +public final class CheckRegExpForm { private static final Logger LOG = Logger.getInstance(CheckRegExpForm.class); public static final Key CHECK_REG_EXP_EDITOR = Key.create("CHECK_REG_EXP_EDITOR"); @@ -70,7 +71,7 @@ public class CheckRegExpForm { private final JBLabel myRegExpIcon = new JBLabel(); private final JBLabel mySampleIcon = new JBLabel(); - private final SmartList highlighters = new SmartList<>(); + private final List highlighters = new ArrayList<>(); public CheckRegExpForm(@NotNull PsiFile regexpFile) { final Project project = regexpFile.getProject(); diff --git a/images/intellij.platform.images.iml b/images/intellij.platform.images.iml index 626e6e4930c7..375af8a2c1ea 100644 --- a/images/intellij.platform.images.iml +++ b/images/intellij.platform.images.iml @@ -14,5 +14,6 @@ + \ No newline at end of file diff --git a/java/compiler/impl/intellij.java.compiler.impl.iml b/java/compiler/impl/intellij.java.compiler.impl.iml index f1779ade1bb2..ce9c926127af 100644 --- a/java/compiler/impl/intellij.java.compiler.impl.iml +++ b/java/compiler/impl/intellij.java.compiler.impl.iml @@ -36,6 +36,7 @@ + diff --git a/java/compiler/impl/src/com/intellij/ide/JavaExcludedFileIconPatcher.java b/java/compiler/impl/src/com/intellij/ide/JavaExcludedFileIconPatcher.java index bfcbdb1686d1..acecc89e731f 100644 --- a/java/compiler/impl/src/com/intellij/ide/JavaExcludedFileIconPatcher.java +++ b/java/compiler/impl/src/com/intellij/ide/JavaExcludedFileIconPatcher.java @@ -1,18 +1,4 @@ -/* - * 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.ide; import com.intellij.openapi.compiler.CompilerManager; @@ -20,13 +6,14 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ProjectFileIndex; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.ui.IconManager; import com.intellij.ui.LayeredIcon; import com.intellij.util.PlatformIcons; import org.jetbrains.annotations.Nullable; import javax.swing.*; -public class JavaExcludedFileIconPatcher implements FileIconPatcher { +public final class JavaExcludedFileIconPatcher implements FileIconPatcher { @Override public Icon patchIcon(Icon baseIcon, VirtualFile file, int flags, @Nullable Project project) { if (project == null) { @@ -34,7 +21,7 @@ public class JavaExcludedFileIconPatcher implements FileIconPatcher { } final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex(); if (fileIndex.isInSource(file) && CompilerManager.getInstance(project).isExcludedFromCompilation(file)) { - return new LayeredIcon(baseIcon, PlatformIcons.EXCLUDED_FROM_COMPILE_ICON); + return IconManager.getInstance().createLayered(new LayeredIcon(baseIcon, PlatformIcons.EXCLUDED_FROM_COMPILE_ICON)); } return baseIcon; } diff --git a/java/compiler/intellij.java.compiler.tests.iml b/java/compiler/intellij.java.compiler.tests.iml index 4ae75d924be1..c8560ffeb8b7 100644 --- a/java/compiler/intellij.java.compiler.tests.iml +++ b/java/compiler/intellij.java.compiler.tests.iml @@ -21,7 +21,7 @@ - + diff --git a/java/compiler/openapi/intellij.java.compiler.iml b/java/compiler/openapi/intellij.java.compiler.iml index aba5057a11ce..1606d36aee4e 100644 --- a/java/compiler/openapi/intellij.java.compiler.iml +++ b/java/compiler/openapi/intellij.java.compiler.iml @@ -14,6 +14,7 @@ + diff --git a/java/debugger/impl/intellij.java.debugger.impl.iml b/java/debugger/impl/intellij.java.debugger.impl.iml index f2b2c755d8b9..c2dd0f3acdf2 100644 --- a/java/debugger/impl/intellij.java.debugger.impl.iml +++ b/java/debugger/impl/intellij.java.debugger.impl.iml @@ -39,6 +39,7 @@ + diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/ArrayFilterInplaceEditor.kt b/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/ArrayFilterInplaceEditor.kt index a84bd056df61..da9624476c3b 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/ArrayFilterInplaceEditor.kt +++ b/java/debugger/impl/src/com/intellij/debugger/ui/tree/render/ArrayFilterInplaceEditor.kt @@ -1,8 +1,8 @@ // Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.debugger.ui.tree.render -import com.intellij.debugger.JavaDebuggerBundle import com.intellij.debugger.DebuggerManagerEx +import com.intellij.debugger.JavaDebuggerBundle import com.intellij.debugger.actions.ArrayAction import com.intellij.debugger.actions.ArrayFilterAction import com.intellij.debugger.engine.JavaValue @@ -33,7 +33,7 @@ import java.awt.Rectangle import javax.swing.event.TreeModelEvent import javax.swing.tree.TreeNode -class ArrayFilterInplaceEditor(node: XDebuggerTreeNode, val myTemp: Boolean, thisType: PsiType?) : XDebuggerTreeInplaceEditor(node, +final class ArrayFilterInplaceEditor(node: XDebuggerTreeNode, val myTemp: Boolean, thisType: PsiType?) : XDebuggerTreeInplaceEditor(node, "arrayFilter") { init { if (thisType != null) { diff --git a/java/debugger/openapi/intellij.java.debugger.iml b/java/debugger/openapi/intellij.java.debugger.iml index a2f322a18d83..91821a5f9f93 100644 --- a/java/debugger/openapi/intellij.java.debugger.iml +++ b/java/debugger/openapi/intellij.java.debugger.iml @@ -16,6 +16,7 @@ + diff --git a/java/execution/impl/intellij.java.execution.impl.iml b/java/execution/impl/intellij.java.execution.impl.iml index f8a7f81018a0..1203ab0ab1ac 100644 --- a/java/execution/impl/intellij.java.execution.impl.iml +++ b/java/execution/impl/intellij.java.execution.impl.iml @@ -33,6 +33,7 @@ + diff --git a/java/execution/openapi/intellij.java.execution.iml b/java/execution/openapi/intellij.java.execution.iml index 4f5b8dd9b659..9b8e929db710 100644 --- a/java/execution/openapi/intellij.java.execution.iml +++ b/java/execution/openapi/intellij.java.execution.iml @@ -11,6 +11,9 @@ + + + diff --git a/java/idea-ui/intellij.java.ui.iml b/java/idea-ui/intellij.java.ui.iml index 9b1a08bfea8e..177e89734ced 100644 --- a/java/idea-ui/intellij.java.ui.iml +++ b/java/idea-ui/intellij.java.ui.iml @@ -28,5 +28,6 @@ + \ No newline at end of file diff --git a/java/idea-ui/intellij.java.ui.tests.iml b/java/idea-ui/intellij.java.ui.tests.iml index 361806f301a3..d28fad6ddf6f 100644 --- a/java/idea-ui/intellij.java.ui.tests.iml +++ b/java/idea-ui/intellij.java.ui.tests.iml @@ -13,5 +13,6 @@ + \ No newline at end of file diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java index a709d6e4e9d3..5b8454d78d16 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java @@ -33,8 +33,8 @@ import com.intellij.util.ArrayUtilRt; import com.intellij.util.ObjectUtils; import com.intellij.util.containers.ContainerUtil; import com.siyeh.ig.psiutils.VariableAccessUtils; -import gnu.trove.THashMap; -import gnu.trove.THashSet; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; +import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -391,9 +391,9 @@ public final class GenericsHighlightUtil { final Collection signaturesWithSupers = aClass.getVisibleSignatures(); PsiManager manager = aClass.getManager(); Map sameErasureMethods = - new THashMap<>(MethodSignatureUtil.METHOD_PARAMETERS_ERASURE_EQUALITY); + new Object2ObjectOpenCustomHashMap<>(MethodSignatureUtil.METHOD_PARAMETERS_ERASURE_EQUALITY); - final Set foundProblems = new THashSet<>(MethodSignatureUtil.METHOD_PARAMETERS_ERASURE_EQUALITY); + final Set foundProblems = new ObjectOpenCustomHashSet<>(MethodSignatureUtil.METHOD_PARAMETERS_ERASURE_EQUALITY); for (HierarchicalMethodSignature signature : signaturesWithSupers) { HighlightInfo info = checkSameErasureNotSubSignatureInner(signature, manager, aClass, sameErasureMethods); if (info != null && foundProblems.add(signature)) { @@ -547,7 +547,7 @@ public final class GenericsHighlightUtil { final PsiClass superClass = psiClass.getSuperClass(); if (superClass != null && superClass.hasTypeParameters()) { final Collection visibleSignatures = superClass.getVisibleSignatures(); - final Map overrideEquivalent = new THashMap<>(MethodSignatureUtil.METHOD_PARAMETERS_ERASURE_EQUALITY); + final Map overrideEquivalent = new Object2ObjectOpenCustomHashMap<>(MethodSignatureUtil.METHOD_PARAMETERS_ERASURE_EQUALITY); for (HierarchicalMethodSignature hms : visibleSignatures) { final PsiMethod method = hms.getMethod(); if (method.isConstructor()) continue; diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaElementImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaElementImpl.java index 636d5fcd5048..0e9a4cea4504 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaElementImpl.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaElementImpl.java @@ -6,7 +6,8 @@ import com.intellij.analysis.AnalysisBundle; import com.intellij.java.analysis.JavaAnalysisBundle; import com.intellij.openapi.util.Iconable; import com.intellij.psi.*; -import com.intellij.util.IconUtil; +import com.intellij.ui.CoreAwareIconManager; +import com.intellij.ui.IconManager; import com.intellij.util.ObjectUtils; import com.intellij.util.containers.Stack; import gnu.trove.THashSet; @@ -268,8 +269,11 @@ public abstract class RefJavaElementImpl extends RefElementImpl implements RefJa if (isSyntheticJSP()) { final PsiElement element = getPsiElement(); if (element != null && element.isValid()) { - return IconUtil.getIcon(element.getContainingFile().getVirtualFile(), - Iconable.ICON_FLAG_VISIBILITY | Iconable.ICON_FLAG_READ_STATUS, element.getProject()); + IconManager iconManager = IconManager.getInstance(); + if (iconManager instanceof CoreAwareIconManager) { + return ((CoreAwareIconManager)iconManager).getIcon(element.getContainingFile().getVirtualFile(), + Iconable.ICON_FLAG_VISIBILITY | Iconable.ICON_FLAG_READ_STATUS, element.getProject()); + } } } return super.getIcon(expanded); diff --git a/java/java-impl/intellij.java.impl.iml b/java/java-impl/intellij.java.impl.iml index 56111f6643c5..1ba4e7d7ae2f 100644 --- a/java/java-impl/intellij.java.impl.iml +++ b/java/java-impl/intellij.java.impl.iml @@ -74,6 +74,7 @@ + diff --git a/java/java-impl/src/com/intellij/lang/java/actions/FieldExpression.kt b/java/java-impl/src/com/intellij/lang/java/actions/FieldExpression.kt index ccc36fd329c2..2d6662fc8513 100644 --- a/java/java-impl/src/com/intellij/lang/java/actions/FieldExpression.kt +++ b/java/java-impl/src/com/intellij/lang/java/actions/FieldExpression.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 com.intellij.lang.java.actions import com.intellij.codeInsight.completion.JavaLookupElementBuilder @@ -15,7 +15,8 @@ import com.intellij.psi.JavaPsiFacade import com.intellij.psi.PsiClass import com.intellij.psi.util.createSmartPointer import com.intellij.ui.LayeredIcon -import javax.swing.Icon + +private val newFieldIcon by lazy { LayeredIcon.create(AllIcons.Nodes.Field, AllIcons.Actions.New) } internal class FieldExpression( project: Project, @@ -23,11 +24,6 @@ internal class FieldExpression( private val fieldName: String, private val typeText: () -> String ) : Expression() { - - companion object { - private val newFieldIcon: Icon = LayeredIcon.create(AllIcons.Nodes.Field, AllIcons.Actions.New) - } - private val myClassPointer = target.createSmartPointer(project) private val myFactory = JavaPsiFacade.getElementFactory(project) diff --git a/java/java-impl/src/com/intellij/psi/impl/JavaDirectoryIconProvider.java b/java/java-impl/src/com/intellij/psi/impl/JavaDirectoryIconProvider.java index d7e84e1e9353..a7a83259bb36 100644 --- a/java/java-impl/src/com/intellij/psi/impl/JavaDirectoryIconProvider.java +++ b/java/java-impl/src/com/intellij/psi/impl/JavaDirectoryIconProvider.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.psi.impl; import com.intellij.icons.AllIcons; @@ -19,7 +19,6 @@ import com.intellij.psi.PsiDirectory; import com.intellij.psi.PsiElement; import com.intellij.psi.impl.file.PsiDirectoryFactory; import com.intellij.ui.IconManager; -import com.intellij.ui.IconWithToolTip; import com.intellij.util.PlatformIcons; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -54,7 +53,7 @@ final class JavaDirectoryIconProvider extends IconProvider implements DumbAware symbolIcon = AllIcons.Nodes.Module; } else if (isValidPackage(psiDirectory)) { - symbolIcon = IconWithToolTip.tooltipOnlyIfComposite(PlatformIcons.PACKAGE_ICON); + symbolIcon = IconManager.getInstance().tooltipOnlyIfComposite(PlatformIcons.PACKAGE_ICON); } else if (!Registry.is("ide.hide.excluded.files") && ProjectRootManager.getInstance(project).getFileIndex().isExcluded(vFile)) { symbolIcon = AllIcons.Modules.ExcludeRoot; diff --git a/java/java-impl/src/com/intellij/refactoring/introduceParameter/InplaceIntroduceParameterPopup.java b/java/java-impl/src/com/intellij/refactoring/introduceParameter/InplaceIntroduceParameterPopup.java index cb0d7278da9a..862a3a1f3ca9 100644 --- a/java/java-impl/src/com/intellij/refactoring/introduceParameter/InplaceIntroduceParameterPopup.java +++ b/java/java-impl/src/com/intellij/refactoring/introduceParameter/InplaceIntroduceParameterPopup.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.introduceParameter; import com.intellij.openapi.application.ApplicationManager; diff --git a/java/java-impl/src/com/intellij/refactoring/introduceParameter/InplaceIntroduceParameterUI.java b/java/java-impl/src/com/intellij/refactoring/introduceParameter/InplaceIntroduceParameterUI.java index 92fdabf8de91..2bbbb4f9a318 100644 --- a/java/java-impl/src/com/intellij/refactoring/introduceParameter/InplaceIntroduceParameterUI.java +++ b/java/java-impl/src/com/intellij/refactoring/introduceParameter/InplaceIntroduceParameterUI.java @@ -1,18 +1,4 @@ -/* - * 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.refactoring.introduceParameter; import com.intellij.java.refactoring.JavaRefactoringBundle; diff --git a/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterData.java b/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterData.java index f9844800dffb..d235df5c9314 100644 --- a/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterData.java +++ b/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterData.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2012 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-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.introduceParameter; import com.intellij.openapi.project.Project; diff --git a/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterDialog.java b/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterDialog.java index 8f90364918d3..342b6a998659 100644 --- a/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterDialog.java +++ b/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterDialog.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.refactoring.introduceParameter; import com.intellij.codeInspection.AnonymousCanBeLambdaInspection; diff --git a/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterProcessor.java b/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterProcessor.java index 8a40b975cf03..76254c7258a8 100644 --- a/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterProcessor.java +++ b/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterProcessor.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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.refactoring.introduceParameter; import com.intellij.analysis.AnalysisScope; @@ -27,7 +13,6 @@ import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.Ref; -import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.*; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.search.searches.MethodReferencesSearch; diff --git a/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterSettingsUI.java b/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterSettingsUI.java index e6c1b869a136..1bc105a76db1 100644 --- a/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterSettingsUI.java +++ b/java/java-impl/src/com/intellij/refactoring/introduceParameter/IntroduceParameterSettingsUI.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.introduceParameter; import com.intellij.java.refactoring.JavaRefactoringBundle; diff --git a/java/java-impl/src/com/intellij/slicer/SliceNullnessAnalyzerBase.java b/java/java-impl/src/com/intellij/slicer/SliceNullnessAnalyzerBase.java index 01d93102dc0a..42f3afee545f 100644 --- a/java/java-impl/src/com/intellij/slicer/SliceNullnessAnalyzerBase.java +++ b/java/java-impl/src/com/intellij/slicer/SliceNullnessAnalyzerBase.java @@ -17,7 +17,7 @@ import com.intellij.util.WalkingState; import com.intellij.util.containers.CollectionFactory; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.FactoryMap; -import gnu.trove.THashSet; +import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap; import org.jetbrains.annotations.NotNull; @@ -71,7 +71,7 @@ public abstract class SliceNullnessAnalyzerBase { } SliceLeafValueClassNode valueRoot = new SliceLeafValueClassNode(root.getProject(), root, nodeName); - Set uniqueValues = new THashSet<>(groupedByValue, myLeafEquality); + Set uniqueValues = new ObjectOpenCustomHashSet<>(groupedByValue, myLeafEquality); for (final PsiElement expression : uniqueValues) { SliceNode newRoot = SliceLeafAnalyzer.filterTree(oldRootStart, oldNode -> { if (oldNode.getDuplicate() != null) { diff --git a/java/java-indexing-api/intellij.java.indexing.iml b/java/java-indexing-api/intellij.java.indexing.iml index d4475c23fde0..cc12a0e57da5 100644 --- a/java/java-indexing-api/intellij.java.indexing.iml +++ b/java/java-indexing-api/intellij.java.indexing.iml @@ -13,5 +13,6 @@ + \ No newline at end of file diff --git a/java/java-indexing-api/src/com/intellij/psi/search/searches/ClassInheritorsSearch.java b/java/java-indexing-api/src/com/intellij/psi/search/searches/ClassInheritorsSearch.java index cd1dad1fea87..ab906cc1f108 100644 --- a/java/java-indexing-api/src/com/intellij/psi/search/searches/ClassInheritorsSearch.java +++ b/java/java-indexing-api/src/com/intellij/psi/search/searches/ClassInheritorsSearch.java @@ -13,7 +13,6 @@ import com.intellij.psi.SmartPointerManager; import com.intellij.psi.search.SearchScope; import com.intellij.psi.util.PsiUtilCore; import com.intellij.util.*; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; @@ -144,8 +143,9 @@ public final class ClassInheritorsSearch extends ExtensibleQueryFactory ReadAction.compute(() -> SmartPointerManager.getInstance(psiClass.getProject()).createSmartPsiElementPointer(psiClass))); + return INSTANCE.createUniqueResultsQuery(parameters, psiClass -> { + return ReadAction.compute(() -> SmartPointerManager.getInstance(psiClass.getProject()).createSmartPsiElementPointer(psiClass)); + }); } /** diff --git a/java/java-indexing-api/src/com/intellij/psi/search/searches/FunctionalExpressionSearch.java b/java/java-indexing-api/src/com/intellij/psi/search/searches/FunctionalExpressionSearch.java index 4f1bd4934793..545345f8e56a 100644 --- a/java/java-indexing-api/src/com/intellij/psi/search/searches/FunctionalExpressionSearch.java +++ b/java/java-indexing-api/src/com/intellij/psi/search/searches/FunctionalExpressionSearch.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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.psi.search.searches; import com.intellij.openapi.application.ReadAction; @@ -22,10 +8,9 @@ import com.intellij.psi.search.SearchScope; import com.intellij.psi.util.PsiUtilCore; import com.intellij.util.EmptyQuery; import com.intellij.util.Query; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; -public class FunctionalExpressionSearch extends ExtensibleQueryFactory { +public final class FunctionalExpressionSearch extends ExtensibleQueryFactory { private static final FunctionalExpressionSearch INSTANCE = new FunctionalExpressionSearch(); public static class SearchParameters { @@ -48,7 +33,7 @@ public class FunctionalExpressionSearch extends ExtensibleQueryFactory search(@NotNull final PsiClass aClass, @NotNull SearchScope scope) { - return INSTANCE.createUniqueResultsQuery(new SearchParameters(aClass, scope), ContainerUtil.canonicalStrategy(), SmartPointerManager::createPointer); + return INSTANCE.createUniqueResultsQuery(new SearchParameters(aClass, scope), SmartPointerManager::createPointer); } public static Query search(@NotNull final PsiMethod psiMethod) { diff --git a/java/java-indexing-api/src/com/intellij/psi/search/searches/ImplicitToStringSearch.java b/java/java-indexing-api/src/com/intellij/psi/search/searches/ImplicitToStringSearch.java index 78cd39a1061a..ba490b51ee4b 100644 --- a/java/java-indexing-api/src/com/intellij/psi/search/searches/ImplicitToStringSearch.java +++ b/java/java-indexing-api/src/com/intellij/psi/search/searches/ImplicitToStringSearch.java @@ -1,13 +1,12 @@ -// 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.psi.search.searches; import com.intellij.psi.*; import com.intellij.psi.search.SearchScope; import com.intellij.util.Query; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; -public class ImplicitToStringSearch extends ExtensibleQueryFactory { +public final class ImplicitToStringSearch extends ExtensibleQueryFactory { public static final ImplicitToStringSearch INSTANCE = new ImplicitToStringSearch(); public static class SearchParameters { @@ -32,9 +31,7 @@ public class ImplicitToStringSearch extends ExtensibleQueryFactory search(@NotNull PsiMethod targetMethod, @NotNull SearchScope scope) { - return INSTANCE.createUniqueResultsQuery(new SearchParameters(targetMethod, scope), - ContainerUtil.canonicalStrategy(), - SmartPointerManager::createPointer); + return INSTANCE.createUniqueResultsQuery(new SearchParameters(targetMethod, scope), SmartPointerManager::createPointer); } public static boolean isToStringMethod(@NotNull PsiElement element) { diff --git a/java/java-indexing-api/src/com/intellij/psi/search/searches/MethodReferencesSearch.java b/java/java-indexing-api/src/com/intellij/psi/search/searches/MethodReferencesSearch.java index c9d65e4aaa56..0bea78b1f1a1 100644 --- a/java/java-indexing-api/src/com/intellij/psi/search/searches/MethodReferencesSearch.java +++ b/java/java-indexing-api/src/com/intellij/psi/search/searches/MethodReferencesSearch.java @@ -9,12 +9,11 @@ import com.intellij.psi.PsiReference; import com.intellij.psi.search.*; import com.intellij.psi.util.PsiUtilCore; import com.intellij.util.*; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public final class MethodReferencesSearch extends ExtensibleQueryFactory { - public static final ExtensionPointName> EP_NAME = ExtensionPointName.create("com.intellij.methodReferencesSearch"); + public static final ExtensionPointName> EP_NAME = new ExtensionPointName<>("com.intellij.methodReferencesSearch"); public static final MethodReferencesSearch INSTANCE = new MethodReferencesSearch(); public static class SearchParameters implements DumbAwareSearchParameters { @@ -135,6 +134,6 @@ public final class MethodReferencesSearch extends ExtensibleQueryFactory uniqueResults(@NotNull Query composite) { - return new UniqueResultsQuery<>(composite, ContainerUtil.canonicalStrategy(), ReferenceDescriptor.MAPPER); + return new UniqueResultsQuery<>(composite, ReferenceDescriptor.MAPPER); } } \ No newline at end of file diff --git a/java/java-psi-api/intellij.java.psi.iml b/java/java-psi-api/intellij.java.psi.iml index b7bb61bb0c6e..2490aa83e5a0 100644 --- a/java/java-psi-api/intellij.java.psi.iml +++ b/java/java-psi-api/intellij.java.psi.iml @@ -9,9 +9,6 @@ - - - \ No newline at end of file diff --git a/java/java-psi-api/src/com/intellij/codeInsight/AnnotationUtil.java b/java/java-psi-api/src/com/intellij/codeInsight/AnnotationUtil.java index afe836c5cac7..c60706f2c68f 100644 --- a/java/java-psi-api/src/com/intellij/codeInsight/AnnotationUtil.java +++ b/java/java-psi-api/src/com/intellij/codeInsight/AnnotationUtil.java @@ -9,8 +9,6 @@ import com.intellij.psi.util.*; import com.intellij.util.*; import com.intellij.util.containers.ConcurrentFactoryMap; import com.intellij.util.containers.ContainerUtil; -import gnu.trove.THashMap; -import gnu.trove.THashSet; import org.intellij.lang.annotations.MagicConstant; import org.jetbrains.annotations.*; @@ -358,8 +356,12 @@ public class AnnotationUtil { if (BitUtil.isSet(flags, CHECK_HIERARCHY)) { if (listOwner instanceof PsiMethod) { PsiMethod method = (PsiMethod)listOwner; - if (processed == null) processed = new THashSet<>(); - if (!processed.add(method)) return false; + if (processed == null) { + processed = new HashSet<>(); + } + if (!processed.add(method)) { + return false; + } for (PsiMethod superMethod : method.findSuperMethods()) { if (isAnnotated(superMethod, annotationFQN, flags, processed)) { return true; @@ -368,8 +370,12 @@ public class AnnotationUtil { } else if (listOwner instanceof PsiClass) { PsiClass clazz = (PsiClass)listOwner; - if (processed == null) processed = new THashSet<>(); - if (!processed.add(clazz)) return false; + if (processed == null) { + processed = new HashSet<>(); + } + if (!processed.add(clazz)) { + return false; + } for (PsiClass superClass : clazz.getSupers()) { if (isAnnotated(superClass, annotationFQN, flags, processed)) { return true; @@ -477,7 +483,9 @@ public class AnnotationUtil { if (inHierarchy) { if (owner instanceof PsiClass) { for (PsiClass superClass : ((PsiClass)owner).getSupers()) { - if (visited == null) visited = new THashSet<>(); + if (visited == null) { + visited = new HashSet<>(); + } if (visited.add(superClass)) annotations = ArrayUtil.mergeArrays(annotations, getAllAnnotations(superClass, true, visited, withInferred)); } } @@ -491,9 +499,12 @@ public class AnnotationUtil { PsiResolveHelper resolveHelper = PsiResolveHelper.SERVICE.getInstance(aClass.getProject()); for (final HierarchicalMethodSignature superSignature : superSignatures) { final PsiMethod superMethod = superSignature.getMethod(); - if (visited == null) visited = new THashSet<>(); - if (!visited.add(superMethod)) continue; - if (!resolveHelper.isAccessible(superMethod, owner, null)) continue; + if (visited == null) { + visited = new HashSet<>(); + } + if (!visited.add(superMethod) || !resolveHelper.isAccessible(superMethod, owner, null)) { + continue; + } annotations = ArrayUtil.mergeArrays(annotations, getAllAnnotations(superMethod, true, visited, withInferred)); } } @@ -513,9 +524,12 @@ public class AnnotationUtil { PsiResolveHelper resolveHelper = PsiResolveHelper.SERVICE.getInstance(aClass.getProject()); for (final HierarchicalMethodSignature superSignature : superSignatures) { final PsiMethod superMethod = superSignature.getMethod(); - if (visited == null) visited = new THashSet<>(); - if (!visited.add(superMethod)) continue; - if (!resolveHelper.isAccessible(superMethod, owner, null)) continue; + if (visited == null) { + visited = new HashSet<>(); + } + if (!visited.add(superMethod) || !resolveHelper.isAccessible(superMethod, owner, null)) { + continue; + } PsiParameter[] superParameters = superMethod.getParameterList().getParameters(); if (index < superParameters.length) { annotations = ArrayUtil.mergeArrays(annotations, getAllAnnotations(superParameters[index], true, visited, withInferred)); @@ -617,8 +631,8 @@ public class AnnotationUtil { if (name == null || !name.equals(b.getQualifiedName())) { return false; } - final Map valueMap1 = new THashMap<>(2); - final Map valueMap2 = new THashMap<>(2); + final Map valueMap1 = new HashMap<>(2); + final Map valueMap2 = new HashMap<>(2); if (!fillValueMap(a.getParameterList(), valueMap1) || !fillValueMap(b.getParameterList(), valueMap2) || valueMap1.size() != valueMap2.size()) { return false; diff --git a/java/java-psi-api/src/com/intellij/codeInsight/ClassUtil.java b/java/java-psi-api/src/com/intellij/codeInsight/ClassUtil.java index 90a975e8c413..292429c923df 100644 --- a/java/java-psi-api/src/com/intellij/codeInsight/ClassUtil.java +++ b/java/java-psi-api/src/com/intellij/codeInsight/ClassUtil.java @@ -1,14 +1,13 @@ // Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - package com.intellij.codeInsight; import com.intellij.psi.*; import com.intellij.psi.util.PsiUtil; -import gnu.trove.THashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import java.util.Set; @@ -35,7 +34,7 @@ public final class ClassUtil { if (superClass != null && !superClass.hasModifierProperty(PsiModifier.ABSTRACT) && !superClass.isEnum() && aClass.getImplementsListTypes().length == 0) { return null; } - Set alreadyImplemented = new THashSet<>(); + Set alreadyImplemented = new HashSet<>(); for (HierarchicalMethodSignature signatureHierarchical : aClass.getVisibleSignatures()) { for (PsiMethod superS : signatureHierarchical.getMethod().findSuperMethods()) { add(superS, alreadyImplemented); diff --git a/java/java-psi-api/src/com/intellij/ide/util/JavaAnonymousClassesHelper.java b/java/java-psi-api/src/com/intellij/ide/util/JavaAnonymousClassesHelper.java index e66fbd60be9c..cb2591e33f01 100644 --- a/java/java-psi-api/src/com/intellij/ide/util/JavaAnonymousClassesHelper.java +++ b/java/java-psi-api/src/com/intellij/ide/util/JavaAnonymousClassesHelper.java @@ -4,10 +4,10 @@ package com.intellij.ide.util; import com.intellij.openapi.util.Key; import com.intellij.psi.*; import com.intellij.psi.util.*; -import gnu.trove.THashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.HashMap; import java.util.Map; /** @@ -15,7 +15,7 @@ import java.util.Map; */ public final class JavaAnonymousClassesHelper { private static final Key, PsiClass>> ANONYMOUS_CLASS_NAME = Key.create("ANONYMOUS_CLASS_NAME"); - public static final AnonClassProvider ANON_CLASS_PROVIDER = new AnonClassProvider(); + private static final AnonClassProvider ANON_CLASS_PROVIDER = new AnonClassProvider(); @Nullable public static String getName(@NotNull PsiAnonymousClass cls) { @@ -31,10 +31,10 @@ public final class JavaAnonymousClassesHelper { return value.getValue(upper).get(cls); } - private static class AnonClassProvider implements ParameterizedCachedValueProvider, PsiClass> { + private static final class AnonClassProvider implements ParameterizedCachedValueProvider, PsiClass> { @Override public CachedValueProvider.Result> compute(final PsiClass upper) { - final Map map = new THashMap<>(); + final Map map = new HashMap<>(); upper.accept(new JavaRecursiveElementWalkingVisitor() { int index; diff --git a/java/java-psi-api/src/com/intellij/ide/util/PsiLambdaNameHelper.java b/java/java-psi-api/src/com/intellij/ide/util/PsiLambdaNameHelper.java index 63df7c7234bf..8a0201a9327f 100644 --- a/java/java-psi-api/src/com/intellij/ide/util/PsiLambdaNameHelper.java +++ b/java/java-psi-api/src/com/intellij/ide/util/PsiLambdaNameHelper.java @@ -4,10 +4,10 @@ package com.intellij.ide.util; import com.intellij.openapi.util.Key; import com.intellij.psi.*; import com.intellij.psi.util.*; -import gnu.trove.THashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.HashMap; import java.util.Map; public final class PsiLambdaNameHelper { @@ -25,7 +25,7 @@ public final class PsiLambdaNameHelper { new ParameterizedCachedValueProvider, PsiClass>() { @Override public CachedValueProvider.Result> compute(final PsiClass upper) { - final Map map = new THashMap<>(); + final Map map = new HashMap<>(); upper.accept(new JavaRecursiveElementWalkingVisitor() { int index; diff --git a/java/java-psi-api/src/com/intellij/lang/jvm/util/JvmHierarchyUtil.java b/java/java-psi-api/src/com/intellij/lang/jvm/util/JvmHierarchyUtil.java index 14e1dabafac8..5d82c1aafe8f 100644 --- a/java/java-psi-api/src/com/intellij/lang/jvm/util/JvmHierarchyUtil.java +++ b/java/java-psi-api/src/com/intellij/lang/jvm/util/JvmHierarchyUtil.java @@ -3,10 +3,10 @@ package com.intellij.lang.jvm.util; import com.intellij.lang.jvm.JvmClass; import com.intellij.openapi.progress.ProgressManager; -import gnu.trove.THashSet; import org.jetbrains.annotations.NotNull; import java.util.ArrayDeque; +import java.util.HashSet; import java.util.Queue; import java.util.Set; import java.util.function.Function; @@ -16,7 +16,6 @@ import static com.intellij.lang.jvm.util.JvmUtil.resolveClass; import static com.intellij.lang.jvm.util.JvmUtil.resolveClasses; public final class JvmHierarchyUtil { - private JvmHierarchyUtil() {} public static boolean testSupers(@NotNull JvmClass start, boolean skipStart, @NotNull Predicate predicate) { @@ -54,7 +53,7 @@ public final class JvmHierarchyUtil { queue.offer(start); } - final Set visited = new THashSet<>(); + final Set visited = new HashSet<>(); while (!queue.isEmpty()) { ProgressManager.checkCanceled(); diff --git a/java/java-psi-api/src/com/intellij/psi/PsiPrimitiveType.java b/java/java-psi-api/src/com/intellij/psi/PsiPrimitiveType.java index 85b32f282119..035166738018 100644 --- a/java/java-psi-api/src/com/intellij/psi/PsiPrimitiveType.java +++ b/java/java-psi-api/src/com/intellij/psi/PsiPrimitiveType.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.psi; import com.intellij.lang.jvm.types.JvmPrimitiveType; @@ -6,22 +6,17 @@ import com.intellij.lang.jvm.types.JvmPrimitiveTypeKind; import com.intellij.pom.java.LanguageLevel; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.util.PsiUtil; -import gnu.trove.THashMap; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Collection; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Objects; +import java.util.*; /** * Represents primitive types of Java language. */ -public class PsiPrimitiveType extends PsiType.Stub implements JvmPrimitiveType { - - private static final Map ourQNameToUnboxed = new THashMap<>(); +public final class PsiPrimitiveType extends PsiType.Stub implements JvmPrimitiveType { + private static final Map ourQNameToUnboxed = new HashMap<>(); private final JvmPrimitiveTypeKind myKind; private final String myName; diff --git a/java/java-psi-api/src/com/intellij/psi/search/searches/DeepestSuperMethodsSearch.java b/java/java-psi-api/src/com/intellij/psi/search/searches/DeepestSuperMethodsSearch.java index 26ffa7e3b99e..8337df3dfc08 100644 --- a/java/java-psi-api/src/com/intellij/psi/search/searches/DeepestSuperMethodsSearch.java +++ b/java/java-psi-api/src/com/intellij/psi/search/searches/DeepestSuperMethodsSearch.java @@ -7,8 +7,8 @@ import com.intellij.util.Query; import com.intellij.util.QueryExecutor; public final class DeepestSuperMethodsSearch extends ExtensibleQueryFactory { - public static final ExtensionPointName> EP_NAME = ExtensionPointName.create("com.intellij.deepestSuperMethodsSearch"); - public static final DeepestSuperMethodsSearch DEEPEST_SUPER_METHODS_SEARCH_INSTANCE = new DeepestSuperMethodsSearch(); + public static final ExtensionPointName> EP_NAME = new ExtensionPointName<>("com.intellij.deepestSuperMethodsSearch"); + private static final DeepestSuperMethodsSearch DEEPEST_SUPER_METHODS_SEARCH_INSTANCE = new DeepestSuperMethodsSearch(); private DeepestSuperMethodsSearch() { super(EP_NAME); diff --git a/java/java-psi-api/src/com/intellij/psi/search/searches/SuperMethodsSearch.java b/java/java-psi-api/src/com/intellij/psi/search/searches/SuperMethodsSearch.java index c95c6f06fa19..478d430743b8 100644 --- a/java/java-psi-api/src/com/intellij/psi/search/searches/SuperMethodsSearch.java +++ b/java/java-psi-api/src/com/intellij/psi/search/searches/SuperMethodsSearch.java @@ -10,6 +10,7 @@ import com.intellij.psi.util.MethodSignatureUtil; import com.intellij.util.Query; import com.intellij.util.QueryExecutor; import com.intellij.util.QueryParameters; +import com.intellij.util.UniqueResultsQuery; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -90,8 +91,7 @@ public final class SuperMethodsSearch extends ExtensibleQueryFactory search(@NotNull SearchParameters parameters) { - return SUPER_METHODS_SEARCH_INSTANCE.createUniqueResultsQuery(parameters, MethodSignatureUtil.METHOD_BASED_HASHING_STRATEGY); + public static @NotNull Query search(@NotNull SearchParameters parameters) { + return new UniqueResultsQuery<>(SUPER_METHODS_SEARCH_INSTANCE.createQuery(parameters), MethodSignatureUtil.METHOD_BASED_HASHING_STRATEGY); } } diff --git a/java/java-psi-api/src/com/intellij/psi/util/InheritanceUtil.java b/java/java-psi-api/src/com/intellij/psi/util/InheritanceUtil.java index 0212ccf774ae..0a0ad1329279 100644 --- a/java/java-psi-api/src/com/intellij/psi/util/InheritanceUtil.java +++ b/java/java-psi-api/src/com/intellij/psi/util/InheritanceUtil.java @@ -4,7 +4,6 @@ package com.intellij.psi.util; import com.intellij.openapi.util.Condition; import com.intellij.psi.*; import com.intellij.util.Processor; -import gnu.trove.THashSet; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -35,7 +34,7 @@ public final class InheritanceUtil { if (includeSelf && !superProcessor.process(aClass)) return false; - return processSupers(aClass, superProcessor, new THashSet<>()); + return processSupers(aClass, superProcessor, new HashSet<>()); } private static boolean processSupers(@NotNull PsiClass aClass, @NotNull Processor superProcessor, @NotNull Set visited) { @@ -93,7 +92,7 @@ public final class InheritanceUtil { * @param includeNonProject */ public static void getSuperClasses(@NotNull PsiClass aClass, @NotNull Set results, boolean includeNonProject) { - getSuperClassesOfList(aClass.getSuperTypes(), results, includeNonProject, new THashSet<>(), aClass.getManager()); + getSuperClassesOfList(aClass.getSuperTypes(), results, includeNonProject, new HashSet<>(), aClass.getManager()); } public static LinkedHashSet getSuperClasses(@NotNull PsiClass aClass) { diff --git a/java/java-psi-api/src/com/intellij/psi/util/MethodSignatureUtil.java b/java/java-psi-api/src/com/intellij/psi/util/MethodSignatureUtil.java index ccafd334e428..813f57db3984 100644 --- a/java/java-psi-api/src/com/intellij/psi/util/MethodSignatureUtil.java +++ b/java/java-psi-api/src/com/intellij/psi/util/MethodSignatureUtil.java @@ -4,7 +4,7 @@ package com.intellij.psi.util; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Pair; import com.intellij.psi.*; -import gnu.trove.TObjectHashingStrategy; +import it.unimi.dsi.fastutil.Hash; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -14,33 +14,32 @@ import java.util.HashSet; import java.util.List; import java.util.Set; - public final class MethodSignatureUtil { private MethodSignatureUtil() { } - public static final TObjectHashingStrategy METHOD_BASED_HASHING_STRATEGY = - new TObjectHashingStrategy() { + public static final Hash.Strategy METHOD_BASED_HASHING_STRATEGY = + new Hash.Strategy() { @Override - public int computeHashCode(final MethodSignatureBackedByPsiMethod signature) { - return signature.getMethod().hashCode(); + public int hashCode(@Nullable MethodSignatureBackedByPsiMethod signature) { + return signature == null ? 0 : signature.getMethod().hashCode(); } @Override - public boolean equals(final MethodSignatureBackedByPsiMethod s1, final MethodSignatureBackedByPsiMethod s2) { - return s1.getMethod().equals(s2.getMethod()); + public boolean equals(@Nullable MethodSignatureBackedByPsiMethod s1, @Nullable MethodSignatureBackedByPsiMethod s2) { + return s1 == s2 || (s1 != null && s2 != null && s1.getMethod().equals(s2.getMethod())); } }; - public static final TObjectHashingStrategy METHOD_PARAMETERS_ERASURE_EQUALITY = - new TObjectHashingStrategy() { + public static final Hash.Strategy METHOD_PARAMETERS_ERASURE_EQUALITY = + new Hash.Strategy() { @Override - public int computeHashCode(final MethodSignature signature) { - return signature.hashCode(); + public int hashCode(final MethodSignature signature) { + return signature == null ? 0 : signature.hashCode(); } @Override - public boolean equals(MethodSignature method1, MethodSignature method2) { - return areSignaturesEqualLightweight(method1, method2) && areErasedParametersEqual(method1, method2); + public boolean equals(@Nullable MethodSignature method1, @Nullable MethodSignature method2) { + return method1 == method2 || (method1 != null && method2 != null && areSignaturesEqualLightweight(method1, method2) && areErasedParametersEqual(method1, method2)); } }; diff --git a/java/java-psi-api/src/com/intellij/psi/util/PsiSuperMethodUtil.java b/java/java-psi-api/src/com/intellij/psi/util/PsiSuperMethodUtil.java index 62e518b51999..5c129a00eca0 100644 --- a/java/java-psi-api/src/com/intellij/psi/util/PsiSuperMethodUtil.java +++ b/java/java-psi-api/src/com/intellij/psi/util/PsiSuperMethodUtil.java @@ -5,10 +5,11 @@ import com.intellij.openapi.roots.FileIndexFacade; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; import com.intellij.psi.search.GlobalSearchScope; -import gnu.trove.THashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.HashMap; import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; @@ -18,8 +19,8 @@ public final class PsiSuperMethodUtil { public static boolean isSuperMethod(@NotNull PsiMethod method, @NotNull PsiMethod superMethod) { HierarchicalMethodSignature signature = method.getHierarchicalMethodSignature(); - for (HierarchicalMethodSignature supsig : signature.getSuperSignatures()) { - PsiMethod supsigme = supsig.getMethod(); + for (HierarchicalMethodSignature superSignature : signature.getSuperSignatures()) { + PsiMethod supsigme = superSignature.getMethod(); if (superMethod.equals(supsigme) || isSuperMethod(supsigme, superMethod)) return true; } @@ -41,7 +42,7 @@ public final class PsiSuperMethodUtil { PsiType type = superSubstitutor.substitute(typeParameter); final PsiType t = derivedSubstitutor.substitute(type); if (map == null) { - map = new THashMap<>(); + map = new HashMap<>(); } map.put(typeParameter, t); } @@ -52,7 +53,7 @@ public final class PsiSuperMethodUtil { @NotNull public static Map> collectOverrideEquivalents(@NotNull PsiClass aClass) { final Map> overrideEquivalent = - new THashMap<>(MethodSignatureUtil.METHOD_PARAMETERS_ERASURE_EQUALITY); + new Object2ObjectOpenCustomHashMap<>(MethodSignatureUtil.METHOD_PARAMETERS_ERASURE_EQUALITY); final GlobalSearchScope resolveScope = aClass.getResolveScope(); PsiClass[] supers = aClass.getSupers(); for (int i = 0; i < supers.length; i++) { diff --git a/java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java b/java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java index fdae2be2f5c8..2f7584f33270 100644 --- a/java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java +++ b/java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java @@ -12,20 +12,16 @@ import com.intellij.psi.tree.IElementType; import com.intellij.util.ArrayUtilRt; import com.intellij.util.IncorrectOperationException; import com.intellij.util.containers.ContainerUtil; -import gnu.trove.THashMap; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; +import java.util.*; public final class PsiTypesUtil { - @NonNls private static final Map ourUnboxedTypes = new THashMap<>(); - @NonNls private static final Map ourBoxedTypes = new THashMap<>(); + @NonNls private static final Map ourUnboxedTypes = new HashMap<>(); + @NonNls private static final Map ourBoxedTypes = new HashMap<>(); static { ourUnboxedTypes.put(CommonClassNames.JAVA_LANG_BOOLEAN, "boolean"); @@ -247,7 +243,7 @@ public final class PsiTypesUtil { } } else if (parent instanceof PsiAssignmentExpression) { - if (((PsiAssignmentExpression)parent).getOperationSign().getTokenType() == JavaTokenType.EQ && + if (((PsiAssignmentExpression)parent).getOperationSign().getTokenType() == JavaTokenType.EQ && PsiUtil.checkSameExpression(element, ((PsiAssignmentExpression)parent).getRExpression())) { PsiType type = ((PsiAssignmentExpression)parent).getLExpression().getType(); return !PsiType.NULL.equals(type) ? type : null; diff --git a/java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java b/java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java index 8a0a86cb0862..432afb32ed09 100644 --- a/java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java +++ b/java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java @@ -12,9 +12,8 @@ import com.intellij.psi.*; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.tree.IElementType; import com.intellij.util.containers.ContainerUtil; -import gnu.trove.THashMap; -import gnu.trove.THashSet; -import gnu.trove.TObjectIntHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import org.intellij.lang.annotations.MagicConstant; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; @@ -37,7 +36,7 @@ public final class TypeConversionUtil { {false, false, false, false, false, false, true}, // double }; - private static final TObjectIntHashMap TYPE_TO_RANK_MAP = new TObjectIntHashMap<>(); + private static final Object2IntMap TYPE_TO_RANK_MAP = new Object2IntOpenHashMap<>(); @MagicConstant(intValues = {BYTE_RANK, SHORT_RANK, CHAR_RANK, INT_RANK, FLOAT_RANK, DOUBLE_RANK, BOOL_RANK, STRING_RANK, UNKNOWN_RANK}) @interface TypeRank { @@ -358,7 +357,9 @@ public final class TypeConversionUtil { if (!areSameArgumentTypes(derived, baseSubstitutor, derivedSubstitutor)) return false; } - if (visited == null) visited = new THashSet<>(); + if (visited == null) { + visited = new HashSet<>(); + } visited.add(derived); for (PsiClass aSuper : supers) { PsiSubstitutor s = getSuperClassSubstitutor(aSuper, derived, derivedSubstitutor); @@ -486,9 +487,13 @@ public final class TypeConversionUtil { type = unboxedType; } - int rank = TYPE_TO_RANK_MAP.get(type); - if (rank != 0) return rank; - if (type.equalsToText(JAVA_LANG_STRING)) return STRING_RANK; + int rank = TYPE_TO_RANK_MAP.getInt(type); + if (rank != 0) { + return rank; + } + if (type.equalsToText(JAVA_LANG_STRING)) { + return STRING_RANK; + } return UNKNOWN_RANK; } @@ -826,8 +831,8 @@ public final class TypeConversionUtil { if (!(left instanceof PsiPrimitiveType)) { return left instanceof PsiClassType && isBoxable((PsiClassType)left, (PsiPrimitiveType)right); } - int leftTypeIndex = TYPE_TO_RANK_MAP.get(left) - 1; - int rightTypeIndex = TYPE_TO_RANK_MAP.get(right) - 1; + int leftTypeIndex = TYPE_TO_RANK_MAP.getInt(left) - 1; + int rightTypeIndex = TYPE_TO_RANK_MAP.getInt(right) - 1; return leftTypeIndex >= 0 && rightTypeIndex >= 0 && rightTypeIndex < IS_ASSIGNABLE_BIT_SET.length && @@ -946,7 +951,7 @@ public final class TypeConversionUtil { project.putUserData(POSSIBLE_BOXED_HOLDER_TYPES, boxedHolderTypes = CachedValuesManager.getManager(manager.getProject()).createCachedValue( () -> { final JavaPsiFacade facade = JavaPsiFacade.getInstance(project); - final Set set = new THashSet<>(); + final Set set = new HashSet<>(); for (final String qname : JvmPrimitiveTypeKind.getBoxedFqns()) { final PsiClass boxedClass = facade.findClass(qname, GlobalSearchScope.allScope(project)); InheritanceUtil.processSupers(boxedClass, true, psiClass1 -> { @@ -1144,7 +1149,7 @@ public final class TypeConversionUtil { return type; } - private static final Set INTEGER_NUMBER_TYPES = new THashSet<>(5); + private static final Set INTEGER_NUMBER_TYPES = new HashSet<>(5); static { INTEGER_NUMBER_TYPES.add(PsiType.BYTE.getName()); @@ -1152,10 +1157,9 @@ public final class TypeConversionUtil { INTEGER_NUMBER_TYPES.add(PsiType.LONG.getName()); INTEGER_NUMBER_TYPES.add(PsiType.INT.getName()); INTEGER_NUMBER_TYPES.add(PsiType.SHORT.getName()); - ((THashSet)INTEGER_NUMBER_TYPES).compact(); } - private static final Set PRIMITIVE_TYPES = new THashSet<>(9); + private static final Set PRIMITIVE_TYPES = new HashSet<>(9); static { PRIMITIVE_TYPES.add(PsiType.VOID.getName()); @@ -1167,7 +1171,6 @@ public final class TypeConversionUtil { PRIMITIVE_TYPES.add(PsiType.INT.getName()); PRIMITIVE_TYPES.add(PsiType.SHORT.getName()); PRIMITIVE_TYPES.add(PsiType.BOOLEAN.getName()); - ((THashSet)PRIMITIVE_TYPES).compact(); } private static final Set PRIMITIVE_WRAPPER_FQNS = ContainerUtil.immutableSet( @@ -1226,7 +1229,7 @@ public final class TypeConversionUtil { if (extendsList.length > 0) { final PsiClass psiClass = extendsList[0].resolve(); if (psiClass instanceof PsiTypeParameter) { - Set visited = new THashSet<>(); + Set visited = new HashSet<>(); visited.add(psiClass); final PsiTypeParameter boundTypeParameter = (PsiTypeParameter)psiClass; if (beforeSubstitutor.getSubstitutionMap().containsKey(boundTypeParameter)) { @@ -1546,7 +1549,7 @@ public final class TypeConversionUtil { } } - private static final Map, PsiType> WRAPPER_TO_PRIMITIVE = new THashMap<>(8); + private static final Map, PsiType> WRAPPER_TO_PRIMITIVE = new HashMap<>(8); static { WRAPPER_TO_PRIMITIVE.put(Boolean.class, PsiType.BOOLEAN); diff --git a/java/java-psi-api/src/com/intellij/util/VisibilityIcons.java b/java/java-psi-api/src/com/intellij/util/VisibilityIcons.java index 016344c17620..4576807d7eb2 100644 --- a/java/java-psi-api/src/com/intellij/util/VisibilityIcons.java +++ b/java/java-psi-api/src/com/intellij/util/VisibilityIcons.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. /* * @author max @@ -8,25 +8,15 @@ package com.intellij.util; import com.intellij.psi.PsiModifier; import com.intellij.psi.PsiModifierList; import com.intellij.psi.util.PsiUtil; +import com.intellij.ui.IconManager; import com.intellij.ui.icons.RowIcon; -import com.intellij.util.ui.EmptyIcon; import org.intellij.lang.annotations.MagicConstant; -import org.jetbrains.annotations.ApiStatus; import javax.swing.*; public final class VisibilityIcons { private VisibilityIcons() {} - /** - * @deprecated use {@link #setVisibilityIcon(PsiModifierList, RowIcon)} - */ - @Deprecated - @ApiStatus.ScheduledForRemoval - public static void setVisibilityIcon(PsiModifierList modifierList, com.intellij.ui.RowIcon baseIcon) { - setVisibilityIcon(modifierList, ((RowIcon)baseIcon)); - } - public static void setVisibilityIcon(PsiModifierList modifierList, RowIcon baseIcon) { if (modifierList != null) { if (modifierList.hasModifierProperty(PsiModifier.PUBLIC)) { @@ -42,25 +32,16 @@ public final class VisibilityIcons { setVisibilityIcon(PsiUtil.ACCESS_LEVEL_PACKAGE_LOCAL, baseIcon); } else { - Icon emptyIcon = EmptyIcon.create(PlatformIcons.PUBLIC_ICON); + Icon emptyIcon = IconManager.getInstance().createEmptyIcon(PlatformIcons.PUBLIC_ICON); baseIcon.setIcon(emptyIcon, 1); } } else if (PlatformIcons.PUBLIC_ICON != null) { - Icon emptyIcon = EmptyIcon.create(PlatformIcons.PUBLIC_ICON); + Icon emptyIcon = IconManager.getInstance().createEmptyIcon(PlatformIcons.PUBLIC_ICON); baseIcon.setIcon(emptyIcon, 1); } } - /** - * @deprecated use {@link #setVisibilityIcon(int, RowIcon)} - */ - @Deprecated - @ApiStatus.ScheduledForRemoval - public static void setVisibilityIcon(@MagicConstant(intValues = {PsiUtil.ACCESS_LEVEL_PUBLIC, PsiUtil.ACCESS_LEVEL_PROTECTED, PsiUtil.ACCESS_LEVEL_PACKAGE_LOCAL, PsiUtil.ACCESS_LEVEL_PRIVATE}) int accessLevel, com.intellij.ui.RowIcon baseIcon) { - setVisibilityIcon(accessLevel, ((RowIcon)baseIcon)); - } - public static void setVisibilityIcon(@MagicConstant(intValues = {PsiUtil.ACCESS_LEVEL_PUBLIC, PsiUtil.ACCESS_LEVEL_PROTECTED, PsiUtil.ACCESS_LEVEL_PACKAGE_LOCAL, PsiUtil.ACCESS_LEVEL_PRIVATE}) int accessLevel, RowIcon baseIcon) { Icon icon; switch (accessLevel) { @@ -78,7 +59,7 @@ public final class VisibilityIcons { break; default: if (PlatformIcons.PUBLIC_ICON != null) { - icon = EmptyIcon.create(PlatformIcons.PUBLIC_ICON); + icon = IconManager.getInstance().createEmptyIcon(PlatformIcons.PUBLIC_ICON); } else { return; diff --git a/java/java-psi-impl/intellij.java.psi.impl.iml b/java/java-psi-impl/intellij.java.psi.impl.iml index 810d3b01bc48..4cbbb05e6435 100644 --- a/java/java-psi-impl/intellij.java.psi.impl.iml +++ b/java/java-psi-impl/intellij.java.psi.impl.iml @@ -13,8 +13,6 @@ - - diff --git a/java/java-psi-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java b/java/java-psi-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java index 79a865b7bb10..d5f8b27d0177 100644 --- a/java/java-psi-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java +++ b/java/java-psi-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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.codeInsight.completion.scope; import com.intellij.codeInsight.completion.CompletionUtilCoreImpl; @@ -28,7 +14,7 @@ import org.jetbrains.annotations.Nullable; import java.util.Arrays; -public class CompletionElement{ +public final class CompletionElement{ private final Object myElement; private final PsiSubstitutor mySubstitutor; private final Object myEqualityObject; @@ -101,7 +87,7 @@ public class CompletionElement{ @Override public int hashCode() { if (myEqualityObject instanceof MethodSignature) { - return MethodSignatureUtil.METHOD_PARAMETERS_ERASURE_EQUALITY.computeHashCode((MethodSignature)myEqualityObject); + return MethodSignatureUtil.METHOD_PARAMETERS_ERASURE_EQUALITY.hashCode((MethodSignature)myEqualityObject); } return myEqualityObject != null ? myEqualityObject.hashCode() : 0; } diff --git a/java/java-psi-impl/src/com/intellij/lang/java/lexer/JavaLexer.java b/java/java-psi-impl/src/com/intellij/lang/java/lexer/JavaLexer.java index 45b2c8ccf334..ff9a25333b72 100644 --- a/java/java-psi-impl/src/com/intellij/lang/java/lexer/JavaLexer.java +++ b/java/java-psi-impl/src/com/intellij/lang/java/lexer/JavaLexer.java @@ -7,28 +7,26 @@ import com.intellij.psi.JavaTokenType; import com.intellij.psi.TokenType; import com.intellij.psi.impl.source.tree.JavaDocElementType; import com.intellij.psi.tree.IElementType; +import com.intellij.util.containers.CollectionFactory; import com.intellij.util.text.CharArrayUtil; -import com.intellij.util.text.CharSequenceHashingStrategy; -import gnu.trove.THashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.util.Arrays; +import java.util.HashSet; import java.util.Set; import static com.intellij.psi.PsiKeyword.*; -public class JavaLexer extends LexerBase { - private static final Set KEYWORDS = new THashSet<>(Arrays.asList( +public final class JavaLexer extends LexerBase { + private static final Set KEYWORDS = new HashSet<>(Arrays.asList( ABSTRACT, BOOLEAN, BREAK, BYTE, CASE, CATCH, CHAR, CLASS, CONST, CONTINUE, DEFAULT, DO, DOUBLE, ELSE, EXTENDS, FINAL, FINALLY, FLOAT, FOR, GOTO, IF, IMPLEMENTS, IMPORT, INSTANCEOF, INT, INTERFACE, LONG, NATIVE, NEW, PACKAGE, PRIVATE, PROTECTED, PUBLIC, RETURN, SHORT, STATIC, STRICTFP, SUPER, SWITCH, SYNCHRONIZED, THIS, THROW, THROWS, TRANSIENT, TRY, VOID, VOLATILE, WHILE, TRUE, FALSE, NULL, NON_SEALED)); - private static final Set JAVA9_KEYWORDS = new THashSet<>( - Arrays.asList(OPEN, MODULE, REQUIRES, EXPORTS, OPENS, USES, PROVIDES, TRANSITIVE, TO, WITH), - CharSequenceHashingStrategy.CASE_SENSITIVE); + private static final Set JAVA9_KEYWORDS = CollectionFactory.createCharSequenceSet(Arrays.asList(OPEN, MODULE, REQUIRES, EXPORTS, OPENS, USES, PROVIDES, TRANSITIVE, TO, WITH)); public static boolean isKeyword(String id, @NotNull LanguageLevel level) { return KEYWORDS.contains(id) || @@ -146,8 +144,8 @@ public class JavaLexer extends LexerBase { } } break; - - case '#' : + + case '#' : if (myBufferIndex == 0 && myBufferIndex + 1 < myBufferEndOffset && charAt(myBufferIndex + 1) == '!') { myTokenType = JavaTokenType.END_OF_LINE_COMMENT; myTokenEndOffset = getLineTerminator(myBufferIndex + 2); diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/ElementPresentationUtil.java b/java/java-psi-impl/src/com/intellij/psi/impl/ElementPresentationUtil.java index f02ebe714a6c..016dd38ade35 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/ElementPresentationUtil.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/ElementPresentationUtil.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.psi.impl; import com.intellij.codeInsight.TestFrameworks; @@ -8,17 +8,15 @@ import com.intellij.ide.IconLayerProvider; import com.intellij.openapi.project.DumbService; import com.intellij.openapi.util.Iconable; import com.intellij.openapi.util.Key; -import com.intellij.openapi.util.text.StringUtil; +import com.intellij.openapi.util.text.Strings; import com.intellij.psi.*; import com.intellij.psi.util.*; import com.intellij.ui.IconManager; -import com.intellij.ui.IconWithToolTip; import com.intellij.ui.icons.RowIcon; import com.intellij.util.BitUtil; import com.intellij.util.PlatformIcons; import com.intellij.util.VisibilityIcons; -import gnu.trove.TIntObjectHashMap; -import org.jetbrains.annotations.ApiStatus; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import javax.swing.*; @@ -47,15 +45,6 @@ public final class ElementPresentationUtil implements PlatformIcons { return flags; } - /** - * @deprecated obsolete API, to be removed - */ - @Deprecated - @ApiStatus.ScheduledForRemoval - public static com.intellij.ui.RowIcon createLayeredIcon(Icon baseIcon, PsiModifierListOwner element, boolean isLocked) { - return (com.intellij.ui.RowIcon)IconManager.getInstance().createLayeredIcon(element, baseIcon, getFlags(element, isLocked)); - } - private static final int CLASS_KIND_INTERFACE = 10; private static final int CLASS_KIND_ANNOTATION = 20; public static final int CLASS_KIND_CLASS = 30; @@ -141,9 +130,9 @@ public final class ElementPresentationUtil implements PlatformIcons { return CLASS_KIND_CLASS; } - private static final TIntObjectHashMap BASE_ICON = new TIntObjectHashMap<>(20); + private static final Int2ObjectOpenHashMap BASE_ICON = new Int2ObjectOpenHashMap<>(20); static { - BASE_ICON.put(CLASS_KIND_CLASS, IconWithToolTip.tooltipOnlyIfComposite(CLASS_ICON)); + BASE_ICON.put(CLASS_KIND_CLASS, IconManager.getInstance().tooltipOnlyIfComposite(CLASS_ICON)); BASE_ICON.put(CLASS_KIND_CLASS | FLAGS_ABSTRACT, ABSTRACT_CLASS_ICON); BASE_ICON.put(CLASS_KIND_ANNOTATION, ANNOTATION_TYPE_ICON); BASE_ICON.put(CLASS_KIND_ANNOTATION | FLAGS_ABSTRACT, ANNOTATION_TYPE_ICON); @@ -155,9 +144,9 @@ public final class ElementPresentationUtil implements PlatformIcons { BASE_ICON.put(CLASS_KIND_ENUM | FLAGS_ABSTRACT, ENUM_ICON); BASE_ICON.put(CLASS_KIND_EXCEPTION, EXCEPTION_CLASS_ICON); BASE_ICON.put(CLASS_KIND_EXCEPTION | FLAGS_ABSTRACT, AllIcons.Nodes.AbstractException); - BASE_ICON.put(CLASS_KIND_INTERFACE, IconWithToolTip.tooltipOnlyIfComposite(INTERFACE_ICON)); - BASE_ICON.put(CLASS_KIND_INTERFACE | FLAGS_ABSTRACT, IconWithToolTip.tooltipOnlyIfComposite(INTERFACE_ICON)); - BASE_ICON.put(CLASS_KIND_JUNIT_TEST, IconWithToolTip.tooltipOnlyIfComposite(CLASS_ICON)); + BASE_ICON.put(CLASS_KIND_INTERFACE, IconManager.getInstance().tooltipOnlyIfComposite(INTERFACE_ICON)); + BASE_ICON.put(CLASS_KIND_INTERFACE | FLAGS_ABSTRACT, IconManager.getInstance().tooltipOnlyIfComposite(INTERFACE_ICON)); + BASE_ICON.put(CLASS_KIND_JUNIT_TEST, IconManager.getInstance().tooltipOnlyIfComposite(CLASS_ICON)); BASE_ICON.put(CLASS_KIND_JUNIT_TEST | FLAGS_ABSTRACT, ABSTRACT_CLASS_ICON); BASE_ICON.put(CLASS_KIND_RECORD, RECORD_ICON); BASE_ICON.put(CLASS_KIND_RUNNABLE, CLASS_ICON); @@ -211,7 +200,7 @@ public final class ElementPresentationUtil implements PlatformIcons { if (list != null) { int level = PsiUtil.getAccessLevel(list); if (level != PsiUtil.ACCESS_LEVEL_PUBLIC) { - adj.append(" ").append(StringUtil.capitalize(JavaPsiBundle.visibilityPresentation(PsiUtil.getAccessModifier(level)))); + adj.append(" ").append(Strings.capitalize(JavaPsiBundle.visibilityPresentation(PsiUtil.getAccessModifier(level)))); } } return adj.toString(); @@ -226,15 +215,6 @@ public final class ElementPresentationUtil implements PlatformIcons { iconManager.registerIconLayer(FLAGS_RUNNABLE, AllIcons.Nodes.RunnableMark); } - /** - * @deprecated use {@link #addVisibilityIcon(PsiModifierListOwner, int, RowIcon)} - */ - @Deprecated - @ApiStatus.ScheduledForRemoval - public static Icon addVisibilityIcon(PsiModifierListOwner element, final int flags, com.intellij.ui.RowIcon baseIcon) { - return addVisibilityIcon(element, flags, ((RowIcon)baseIcon)); - } - public static Icon addVisibilityIcon(final PsiModifierListOwner element, final int flags, final RowIcon baseIcon) { if (BitUtil.isSet(flags, Iconable.ICON_FLAG_VISIBILITY)) { VisibilityIcons.setVisibilityIcon(element.getModifierList(), baseIcon); diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/PsiClassImplUtil.java b/java/java-psi-impl/src/com/intellij/psi/impl/PsiClassImplUtil.java index 3d48e56e98d9..651fc0aafaa9 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/PsiClassImplUtil.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/PsiClassImplUtil.java @@ -26,15 +26,12 @@ import com.intellij.psi.search.PackageScope; import com.intellij.psi.search.SearchScope; import com.intellij.psi.stubs.StubElement; import com.intellij.psi.util.*; -import com.intellij.ui.IconDeferrer; import com.intellij.ui.IconManager; import com.intellij.ui.icons.RowIcon; import com.intellij.util.*; import com.intellij.util.containers.ConcurrentFactoryMap; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.JBTreeTraverser; -import gnu.trove.THashMap; -import gnu.trove.THashSet; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -43,6 +40,7 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.util.*; import java.util.concurrent.ConcurrentMap; +import java.util.function.Function; public final class PsiClassImplUtil { private static final Logger LOG = Logger.getInstance(PsiClassImplUtil.class); @@ -250,7 +248,9 @@ public final class PsiClassImplUtil { } private static final Function FULL_ICON_EVALUATOR = r -> { - if (!r.psiClass.isValid() || r.psiClass.getProject().isDisposed()) return null; + if (!r.psiClass.isValid() || r.psiClass.getProject().isDisposed()) { + return null; + } boolean isLocked = BitUtil.isSet(r.flags, Iconable.ICON_FLAG_READ_STATUS) && !r.psiClass.isWritable(); Icon symbolIcon = r.symbolIcon != null @@ -277,7 +277,7 @@ public final class PsiClassImplUtil { base = ElementPresentationUtil.addVisibilityIcon(aClass, flags, baseIcon); } - return IconDeferrer.getInstance().defer(base, new ClassIconRequest(aClass, flags, symbolIcon), FULL_ICON_EVALUATOR); + return IconManager.getInstance().createDeferredIcon(base, new ClassIconRequest(aClass, flags, symbolIcon), FULL_ICON_EVALUATOR); } @NotNull @@ -361,7 +361,7 @@ public final class PsiClassImplUtil { private static @NotNull ConcurrentMap> createMembersMap(@NotNull PsiClass psiClass, @NotNull GlobalSearchScope scope) { return ConcurrentFactoryMap.createMap(key -> { - Map> map = new THashMap<>(); + Map> map = new HashMap<>(); List allMembers = new ArrayList<>(); map.put(ALL, allMembers); @@ -380,7 +380,7 @@ public final class PsiClassImplUtil { map.computeIfAbsent(element.getName(), __ -> new SmartList<>()).add(element); } } - Map result = new THashMap<>(); + Map result = new HashMap<>(map.size()); for (Map.Entry> entry : map.entrySet()) { result.put(entry.getKey(), entry.getValue().toArray(PsiMember.EMPTY_ARRAY)); } @@ -655,8 +655,12 @@ public final class PsiClassImplUtil { @NotNull LanguageLevel languageLevel, @NotNull GlobalSearchScope resolveScope) { ProgressManager.checkCanceled(); - if (visited == null) visited = new THashSet<>(); - if (!visited.add(aClass)) return true; + if (visited == null) { + visited = new HashSet<>(); + } + if (!visited.add(aClass)) { + return true; + } processor.handleEvent(PsiScopeProcessor.Event.SET_DECLARATION_HOLDER, aClass); ElementClassHint classHint = processor.getHint(ElementClassHint.KEY); diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/PsiSubstitutorImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/PsiSubstitutorImpl.java index 8b0ec76df1e8..1a425d628d05 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/PsiSubstitutorImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/PsiSubstitutorImpl.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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.psi.impl; import com.intellij.openapi.diagnostic.Logger; @@ -37,7 +23,7 @@ import java.util.Set; /** * @author ik, dsl */ -public class PsiSubstitutorImpl implements PsiSubstitutor { +public final class PsiSubstitutorImpl implements PsiSubstitutor { private static final Logger LOG = Logger.getInstance(PsiSubstitutorImpl.class); private static final TObjectHashingStrategy PSI_EQUIVALENCE = new TObjectHashingStrategy() { diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/PsiSuperMethodImplUtil.java b/java/java-psi-impl/src/com/intellij/psi/impl/PsiSuperMethodImplUtil.java index 330a81a31d78..2ad9f43db0ed 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/PsiSuperMethodImplUtil.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/PsiSuperMethodImplUtil.java @@ -16,8 +16,8 @@ import com.intellij.util.SmartList; import com.intellij.util.containers.ConcurrentFactoryMap; import com.intellij.util.containers.hash.EqualityPolicy; import com.intellij.util.containers.hash.LinkedHashMap; -import gnu.trove.THashMap; import gnu.trove.THashSet; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -133,13 +133,12 @@ public final class PsiSuperMethodImplUtil { return false; } }); - final Map> sameParameterErasureMethods = - new THashMap<>(MethodSignatureUtil.METHOD_PARAMETERS_ERASURE_EQUALITY); + final Map> sameParameterErasureMethods = new Object2ObjectOpenCustomHashMap<>(MethodSignatureUtil.METHOD_PARAMETERS_ERASURE_EQUALITY); Map map = new LinkedHashMap<>(new EqualityPolicy() { @Override public int getHashCode(MethodSignature signature) { - return MethodSignatureUtil.METHOD_PARAMETERS_ERASURE_EQUALITY.computeHashCode(signature); + return MethodSignatureUtil.METHOD_PARAMETERS_ERASURE_EQUALITY.hashCode(signature); } @Override diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/ClassInnerStuffCache.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/ClassInnerStuffCache.java index e4f91e8532b7..910dd591fff1 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/ClassInnerStuffCache.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/ClassInnerStuffCache.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.psi.impl.source; import com.intellij.openapi.diagnostic.Logger; @@ -13,20 +13,19 @@ import com.intellij.psi.impl.light.LightMethod; import com.intellij.psi.util.CachedValuesManager; import com.intellij.psi.util.PsiUtil; import com.intellij.util.ArrayUtil; -import com.intellij.util.containers.*; -import gnu.trove.THashMap; +import com.intellij.util.containers.ConcurrentFactoryMap; +import com.intellij.util.containers.ContainerUtil; +import com.intellij.util.containers.Interner; +import com.intellij.util.containers.JBIterable; import org.jetbrains.annotations.ApiStatus; 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.Objects; +import java.util.*; import static com.intellij.util.ObjectUtils.notNull; -public class ClassInnerStuffCache { +public final class ClassInnerStuffCache { private final PsiExtensibleClass myClass; private final Ref>> myInterner = Ref.create(); @@ -157,7 +156,7 @@ public class ClassInnerStuffCache { @NotNull private Map getFieldsMap() { - Map cachedFields = new THashMap<>(); + Map cachedFields = new java.util.HashMap<>(); for (PsiField field : myClass.getOwnFields()) { String name = field.getName(); if (!cachedFields.containsKey(name)) { @@ -186,7 +185,7 @@ public class ClassInnerStuffCache { @NotNull private Map getInnerClassesMap() { - Map cachedInners = new THashMap<>(); + Map cachedInners = new HashMap<>(); for (PsiClass psiClass : myClass.getOwnInnerClasses()) { String name = psiClass.getName(); if (name == null) { diff --git a/java/java-tests/intellij.java.tests.iml b/java/java-tests/intellij.java.tests.iml index 16172e9f5c21..fdb4f29c01f9 100644 --- a/java/java-tests/intellij.java.tests.iml +++ b/java/java-tests/intellij.java.tests.iml @@ -73,6 +73,7 @@ - + + \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesTest.java index bd1fafbed5ec..60ddcdba5980 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesTest.java @@ -101,7 +101,6 @@ import com.intellij.util.io.storage.HeavyProcessLatch; import com.intellij.util.ref.GCWatcher; import com.intellij.util.ui.UIUtil; import com.intellij.xml.util.CheckDtdReferencesInspection; -import gnu.trove.THashSet; import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; import kotlin.Unit; import org.intellij.lang.annotations.Language; @@ -1651,8 +1650,8 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase { } public void testCodeFoldingInSplittedWindowAppliesToAllEditors() { - final Set applied = new THashSet<>(); - final Set collected = new THashSet<>(); + final Set applied = new HashSet<>(); + final Set collected = new HashSet<>(); registerFakePass(applied, collected); configureByText(PlainTextFileType.INSTANCE, ""); @@ -1696,8 +1695,8 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase { executeWithReparseDelay(0, () -> { runHeavyProcessing = false; try { - final Set applied = Collections.synchronizedSet(new THashSet<>()); - final Set collected = Collections.synchronizedSet(new THashSet<>()); + final Set applied = Collections.synchronizedSet(new HashSet<>()); + final Set collected = Collections.synchronizedSet(new HashSet<>()); registerFakePass(applied, collected); configureByText(PlainTextFileType.INSTANCE, ""); diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/HighlightStressTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/HighlightStressTest.java index a58f66cf39a6..2bf0475daded 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/HighlightStressTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/HighlightStressTest.java @@ -24,7 +24,6 @@ import com.intellij.testFramework.SkipSlowTestLocally; import com.intellij.util.ArrayUtil; import com.intellij.util.text.CharArrayUtil; import com.intellij.util.ui.UIUtil; -import gnu.trove.THashSet; import org.intellij.lang.annotations.Language; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -227,7 +226,7 @@ public class HighlightStressTest extends LightDaemonAnalyzerTestCase { } String qualifiedName = aClass.getQualifiedName(); if (qualifiedName.startsWith("java.lang.invoke")) continue ; // java.lang.invoke.MethodHandle has weird access attributes in recent rt.jar which causes spurious highlighting errors - if (!accessible(aClass, new THashSet<>())) continue; + if (!accessible(aClass, new HashSet<>())) continue; imports.append("import " + qualifiedName + ";\n"); usages.append("/**/ "+aClass.getName() + " var" + v + " = null; var" + v + ".toString();\n"); v++; diff --git a/java/java-tests/testSrc/com/intellij/java/psi/search/ClassInheritorsTest.java b/java/java-tests/testSrc/com/intellij/java/psi/search/ClassInheritorsTest.java index adabcd7908c3..f9f291c97de2 100644 --- a/java/java-tests/testSrc/com/intellij/java/psi/search/ClassInheritorsTest.java +++ b/java/java-tests/testSrc/com/intellij/java/psi/search/ClassInheritorsTest.java @@ -1,18 +1,4 @@ -/* - * 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.java.psi.search; import com.intellij.concurrency.JobScheduler; @@ -25,6 +11,7 @@ import com.intellij.openapi.progress.util.StandardProgressIndicatorBase; import com.intellij.openapi.roots.DependencyScope; import com.intellij.openapi.roots.ModuleRootModificationUtil; import com.intellij.psi.PsiClass; +import com.intellij.psi.PsiClassOwner; import com.intellij.psi.PsiJavaFile; import com.intellij.psi.impl.compiled.ClsClassImpl; import com.intellij.psi.impl.source.PsiClassImpl; @@ -34,7 +21,6 @@ import com.intellij.psi.search.searches.DirectClassInheritorsSearch; import com.intellij.testFramework.PsiTestUtil; import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase; import com.intellij.util.CommonProcessors; -import gnu.trove.THashSet; import java.io.IOException; import java.util.Collection; @@ -63,7 +49,7 @@ public class ClassInheritorsTest extends JavaCodeInsightFixtureTestCase { public void testStressInPresenceOfPCEs() { ApplicationManager.getApplication().assertIsDispatchThread(); // no write action can go through while we test int N = 1000; - PsiJavaFile file0 = (PsiJavaFile)myFixture.addFileToProject("C0.java", "class C0 { }"); + PsiClassOwner file0 = (PsiJavaFile)myFixture.addFileToProject("C0.java", "class C0 { }"); for (int i=1;i { - Collection inheritors = Collections.synchronizedSet(new THashSet<>()); + Collection inheritors = Collections.synchronizedSet(new HashSet<>()); ProgressManager.getInstance().executeProcessUnderProgress(()-> { boolean success = ClassInheritorsSearch.search(class0).forEach(new CommonProcessors.CollectProcessor<>(inheritors)); if (N - 1 != inheritors.size() || !success) { diff --git a/java/java-tests/testSrc/com/intellij/java/slicer/SliceTreeTest.java b/java/java-tests/testSrc/com/intellij/java/slicer/SliceTreeTest.java index 5e9f23ab6758..744c3f7fbb03 100644 --- a/java/java-tests/testSrc/com/intellij/java/slicer/SliceTreeTest.java +++ b/java/java-tests/testSrc/com/intellij/java/slicer/SliceTreeTest.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.java.slicer; import com.intellij.analysis.AnalysisScope; @@ -9,7 +9,7 @@ import com.intellij.openapi.wm.impl.ToolWindowHeadlessManagerImpl; import com.intellij.psi.*; import com.intellij.slicer.*; import com.intellij.util.containers.ContainerUtil; -import gnu.trove.TIntArrayList; +import it.unimi.dsi.fastutil.ints.IntArrayList; import one.util.streamex.EntryStream; import one.util.streamex.StreamEx; import org.jetbrains.annotations.NonNls; @@ -76,7 +76,7 @@ public class SliceTreeTest extends SliceTestCase { List nodes = new ArrayList<>(); expandNodesTo(root, nodes); - TIntArrayList hasDups = new TIntArrayList(); + IntArrayList hasDups = new IntArrayList(); for (SliceNode node : nodes) { if (node.getDuplicate() != null) { PsiElement element = node.getValue().getElement(); @@ -138,7 +138,7 @@ public class SliceTreeTest extends SliceTestCase { Collection leaves = analyzer.calcLeafExpressions(root, treeStructure, map); assertNotNull(leaves); List list = new ArrayList<>(leaves); - String message = ContainerUtil.map(list, element -> element.getClass() + ": '" + element.getText() + "' (" + JavaSlicerAnalysisUtil.LEAF_ELEMENT_EQUALITY.computeHashCode(element) + ") ").toString(); + String message = ContainerUtil.map(list, element -> element.getClass() + ": '" + element.getText() + "' (" + JavaSlicerAnalysisUtil.LEAF_ELEMENT_EQUALITY.hashCode(element) + ") ").toString(); assertEquals(map.entrySet()+"\n"+message, 2, leaves.size()); Collections.sort(list, Comparator.comparing(PsiElement::getText)); assertTrue(list.get(0) instanceof PsiLiteralExpression); diff --git a/java/manifest/intellij.java.manifest.iml b/java/manifest/intellij.java.manifest.iml index de466cea4c04..9b6adb187c65 100644 --- a/java/manifest/intellij.java.manifest.iml +++ b/java/manifest/intellij.java.manifest.iml @@ -20,5 +20,6 @@ + \ No newline at end of file diff --git a/java/openapi/intellij.java.iml b/java/openapi/intellij.java.iml index 98ae7b688a74..a543f3f38442 100644 --- a/java/openapi/intellij.java.iml +++ b/java/openapi/intellij.java.iml @@ -28,6 +28,7 @@ + \ No newline at end of file diff --git a/java/testFramework/intellij.java.testFramework.iml b/java/testFramework/intellij.java.testFramework.iml index b08e51358ca9..f2be801aa6ea 100644 --- a/java/testFramework/intellij.java.testFramework.iml +++ b/java/testFramework/intellij.java.testFramework.iml @@ -29,7 +29,7 @@ - + diff --git a/json/intellij.json.iml b/json/intellij.json.iml index c8b9e62e17db..85548a2e4153 100644 --- a/json/intellij.json.iml +++ b/json/intellij.json.iml @@ -18,5 +18,6 @@ + \ No newline at end of file diff --git a/jvm/jvm-analysis-impl/intellij.jvm.analysis.impl.iml b/jvm/jvm-analysis-impl/intellij.jvm.analysis.impl.iml index 3e72af21d826..00c5c0b8f22e 100644 --- a/jvm/jvm-analysis-impl/intellij.jvm.analysis.impl.iml +++ b/jvm/jvm-analysis-impl/intellij.jvm.analysis.impl.iml @@ -11,5 +11,6 @@ + \ No newline at end of file diff --git a/platform/analysis-api/intellij.platform.analysis.iml b/platform/analysis-api/intellij.platform.analysis.iml index 5482cd01bba8..52a6fd624962 100644 --- a/platform/analysis-api/intellij.platform.analysis.iml +++ b/platform/analysis-api/intellij.platform.analysis.iml @@ -16,5 +16,6 @@ + \ No newline at end of file diff --git a/platform/analysis-impl/intellij.platform.analysis.impl.iml b/platform/analysis-impl/intellij.platform.analysis.impl.iml index 9f53ababc5e1..508bfa72993c 100644 --- a/platform/analysis-impl/intellij.platform.analysis.impl.iml +++ b/platform/analysis-impl/intellij.platform.analysis.impl.iml @@ -26,5 +26,6 @@ + \ No newline at end of file diff --git a/platform/built-in-server/intellij.platform.builtInServer.impl.iml b/platform/built-in-server/intellij.platform.builtInServer.impl.iml index ab9554132bd5..b4b9d0406960 100644 --- a/platform/built-in-server/intellij.platform.builtInServer.impl.iml +++ b/platform/built-in-server/intellij.platform.builtInServer.impl.iml @@ -30,5 +30,7 @@ + + \ No newline at end of file diff --git a/platform/built-in-server/intellij.platform.builtInServer.tests.iml b/platform/built-in-server/intellij.platform.builtInServer.tests.iml index a983b86e17fd..0fb355b99b87 100644 --- a/platform/built-in-server/intellij.platform.builtInServer.tests.iml +++ b/platform/built-in-server/intellij.platform.builtInServer.tests.iml @@ -25,5 +25,6 @@ + \ No newline at end of file diff --git a/platform/configuration-store-impl/intellij.platform.configurationStore.impl.iml b/platform/configuration-store-impl/intellij.platform.configurationStore.impl.iml index ffcff08b2478..52491741f01b 100644 --- a/platform/configuration-store-impl/intellij.platform.configurationStore.impl.iml +++ b/platform/configuration-store-impl/intellij.platform.configurationStore.impl.iml @@ -25,5 +25,6 @@ + \ No newline at end of file diff --git a/platform/core-api/src/com/intellij/psi/search/searches/ExtensibleQueryFactory.java b/platform/core-api/src/com/intellij/psi/search/searches/ExtensibleQueryFactory.java index 29d360f6c6ad..75d300e67fa3 100644 --- a/platform/core-api/src/com/intellij/psi/search/searches/ExtensibleQueryFactory.java +++ b/platform/core-api/src/com/intellij/psi/search/searches/ExtensibleQueryFactory.java @@ -1,16 +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.psi.search.searches; import com.intellij.openapi.Disposable; import com.intellij.openapi.extensions.*; import com.intellij.openapi.util.Disposer; -import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.QueryExecutor; import com.intellij.util.QueryFactory; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; +import java.beans.Introspector; import java.util.List; /** @@ -47,7 +46,7 @@ public class ExtensibleQueryFactory extends QueryFactory= 0) { epName = epName.substring(pos+1); } - epName = epNamespace + "." + StringUtil.decapitalize(epName); + epName = epNamespace + "." + Introspector.decapitalize(epName); return Extensions.getRootArea().getExtensionPoint(epName); } }; diff --git a/platform/core-api/src/com/intellij/ui/CoreAwareIconManager.java b/platform/core-api/src/com/intellij/ui/CoreAwareIconManager.java new file mode 100644 index 000000000000..9b146dfe0bdc --- /dev/null +++ b/platform/core-api/src/com/intellij/ui/CoreAwareIconManager.java @@ -0,0 +1,20 @@ +// 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.ui; + +import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.Iconable; +import com.intellij.openapi.vfs.VirtualFile; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import javax.swing.*; + +public interface CoreAwareIconManager { + /** + * @return a deferred icon for the file, taking into account {@link FileIconProvider} and {@link FileIconPatcher} extensions. + * Use {@link #computeFileIcon} where possible (e.g. in background threads) to get a non-deferred icon. + */ + @NotNull Icon getIcon(@NotNull VirtualFile file, @Iconable.IconFlags int flags, @Nullable Project project); + + @NotNull Runnable wakeUpNeo(@NotNull Object reason); +} diff --git a/platform/core-api/src/com/intellij/util/FileIconKey.java b/platform/core-api/src/com/intellij/util/FileIconKey.java index ed8df86f1e27..c4ee04aa4672 100644 --- a/platform/core-api/src/com/intellij/util/FileIconKey.java +++ b/platform/core-api/src/com/intellij/util/FileIconKey.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.util; import com.intellij.lang.Language; @@ -7,6 +7,7 @@ import com.intellij.openapi.util.Iconable; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiManager; import com.intellij.testFramework.LightVirtualFile; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -15,7 +16,7 @@ import java.util.Objects; /** * @author Konstantin Bulenkov */ -class FileIconKey { +final class FileIconKey { private final VirtualFile myFile; private final Project myProject; private final @Iconable.IconFlags int myFlags; diff --git a/platform/core-api/src/com/intellij/util/QueryFactory.java b/platform/core-api/src/com/intellij/util/QueryFactory.java index 6a3078086a59..c593d92161e5 100644 --- a/platform/core-api/src/com/intellij/util/QueryFactory.java +++ b/platform/core-api/src/com/intellij/util/QueryFactory.java @@ -2,7 +2,6 @@ package com.intellij.util; import com.intellij.util.containers.ContainerUtil; -import gnu.trove.TObjectHashingStrategy; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -26,7 +25,6 @@ public class QueryFactory { return new ExecutorsQuery<>(parameters, getExecutors()); } - @NotNull protected List> getExecutors() { return myExecutors; @@ -47,26 +45,11 @@ public class QueryFactory { /** * @param parameters of the search - * @param hashingStrategy strategy to factor results - * @return query to perform the search. Obtained results are automatically filtered wrt. equals() relation. - */ - @NotNull - public final Query createUniqueResultsQuery(@NotNull Parameters parameters, - @NotNull TObjectHashingStrategy hashingStrategy) { - return new UniqueResultsQuery<>(createQuery(parameters), hashingStrategy); - } - - /** - * @param parameters of the search - * @param hashingStrategy strategy to factor results * @param mapper function that maps results to their mapping counterparts. * @return query to perform the search. Obtained results are mapped to whatever objects that are automatically filtered wrt. equals() * relation. Storing mapped objects instead of original elements may be wise wrt to memory consumption. */ - @NotNull - public final Query createUniqueResultsQuery(@NotNull Parameters parameters, - @NotNull TObjectHashingStrategy hashingStrategy, - @NotNull Function mapper) { - return new UniqueResultsQuery<>(createQuery(parameters), hashingStrategy, mapper); + public final @NotNull Query createUniqueResultsQuery(@NotNull Parameters parameters, @NotNull Function mapper) { + return new UniqueResultsQuery<>(createQuery(parameters), mapper); } } diff --git a/platform/core-api/src/com/intellij/util/UniqueResultsQuery.java b/platform/core-api/src/com/intellij/util/UniqueResultsQuery.java index 151dd230043a..8d1d512ef136 100644 --- a/platform/core-api/src/com/intellij/util/UniqueResultsQuery.java +++ b/platform/core-api/src/com/intellij/util/UniqueResultsQuery.java @@ -1,47 +1,58 @@ // 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; import com.intellij.concurrency.AsyncFuture; import com.intellij.openapi.progress.ProgressManager; -import com.intellij.util.containers.ContainerUtil; -import gnu.trove.THashSet; -import gnu.trove.TObjectHashingStrategy; +import it.unimi.dsi.fastutil.Hash; +import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; +import it.unimi.dsi.fastutil.objects.ObjectSets; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import java.util.*; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; -public class UniqueResultsQuery extends AbstractQuery { +public final class UniqueResultsQuery extends AbstractQuery { @NotNull private final Query myOriginal; - @NotNull private final TObjectHashingStrategy myHashingStrategy; + @Nullable private final Hash.Strategy myHashingStrategy; @NotNull private final Function myMapper; public UniqueResultsQuery(@NotNull Query original) { - this(original, ContainerUtil.canonicalStrategy(), Functions.identity()); + this(original, Functions.identity()); } - public UniqueResultsQuery(@NotNull Query original, @NotNull TObjectHashingStrategy hashingStrategy) { - this(original, hashingStrategy, Functions.identity()); - } - - public UniqueResultsQuery(@NotNull Query original, @NotNull TObjectHashingStrategy hashingStrategy, @NotNull Function mapper) { + public UniqueResultsQuery(@NotNull Query original, @NotNull Hash.Strategy hashingStrategy) { myOriginal = original; myHashingStrategy = hashingStrategy; + myMapper = Functions.identity(); + } + + public UniqueResultsQuery(@NotNull Query original, @NotNull Function mapper) { + myOriginal = original; + myHashingStrategy = null; myMapper = mapper; } @Override protected boolean processResults(@NotNull Processor consumer) { - return delegateProcessResults(myOriginal, new MyProcessor(Collections.synchronizedSet(new THashSet<>(myHashingStrategy)), consumer)); + return delegateProcessResults(myOriginal, new MyProcessor(createSet(), consumer)); + } + + private @NotNull Set createSet() { + if (myHashingStrategy == null) { + return Collections.synchronizedSet(new HashSet<>()); + } + return ObjectSets.synchronize(new ObjectOpenCustomHashSet<>(myHashingStrategy)); } @NotNull @Override public AsyncFuture forEachAsync(@NotNull Processor consumer) { - return myOriginal.forEachAsync(new MyProcessor(Collections.synchronizedSet(new THashSet<>(myHashingStrategy)), consumer)); + return myOriginal.forEachAsync(new MyProcessor(createSet(), consumer)); } - private class MyProcessor implements Processor { + private final class MyProcessor implements Processor { private final Set myProcessedElements; private final Processor myConsumer; diff --git a/platform/core-impl/intellij.platform.core.impl.iml b/platform/core-impl/intellij.platform.core.impl.iml index e2252ba35340..46d5edeb2b63 100644 --- a/platform/core-impl/intellij.platform.core.impl.iml +++ b/platform/core-impl/intellij.platform.core.impl.iml @@ -12,8 +12,6 @@ - - diff --git a/platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationUtil.java b/platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationUtil.java index e7d1e3972f17..9bf553a5d96f 100644 --- a/platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationUtil.java +++ b/platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationUtil.java @@ -13,7 +13,7 @@ import com.intellij.openapi.util.Computable; import com.intellij.openapi.util.Ref; import com.intellij.util.ExceptionUtil; import com.intellij.util.concurrency.Semaphore; -import com.intellij.util.ui.UIUtil; +import com.intellij.util.ui.EdtInvocationManager; import org.jetbrains.annotations.NotNull; import javax.swing.*; @@ -123,7 +123,7 @@ public final class ApplicationUtil { if (!SwingUtilities.isEventDispatchThread() && ApplicationManager.getApplication().isWriteThread()) { Logger.getInstance(ApplicationUtil.class).error("Can't invokeAndWait from WT to EDT: probably leads to deadlock"); } - UIUtil.invokeAndWaitIfNeeded(r); + EdtInvocationManager.invokeAndWaitIfNeeded(r); break; case WT: if (ApplicationManager.getApplication().isWriteThread()) { diff --git a/platform/core-impl/src/com/intellij/openapi/application/impl/LaterInvocator.java b/platform/core-impl/src/com/intellij/openapi/application/impl/LaterInvocator.java index 352091ad2c27..829979f2f90e 100644 --- a/platform/core-impl/src/com/intellij/openapi/application/impl/LaterInvocator.java +++ b/platform/core-impl/src/com/intellij/openapi/application/impl/LaterInvocator.java @@ -19,7 +19,7 @@ import com.intellij.util.concurrency.AppExecutorUtil; import com.intellij.util.concurrency.Semaphore; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.Stack; -import com.intellij.util.ui.UIUtil; +import com.intellij.util.ui.EdtInvocationManager; import org.jetbrains.annotations.*; import javax.swing.*; @@ -425,7 +425,7 @@ public final class LaterInvocator { semaphore.down(); invokeLater(semaphore::up, ModalityState.any(), true); while (!semaphore.isUp()) { - UIUtil.dispatchAllInvocationEvents(); + EdtInvocationManager.dispatchAllInvocationEvents(); } } } diff --git a/platform/core-impl/src/com/intellij/openapi/progress/util/AbstractProgressIndicatorBase.java b/platform/core-impl/src/com/intellij/openapi/progress/util/AbstractProgressIndicatorBase.java index f3adae8b7635..f6027bc5dd85 100644 --- a/platform/core-impl/src/com/intellij/openapi/progress/util/AbstractProgressIndicatorBase.java +++ b/platform/core-impl/src/com/intellij/openapi/progress/util/AbstractProgressIndicatorBase.java @@ -14,11 +14,12 @@ import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.progress.impl.CoreProgressManager; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.NlsContexts; +import com.intellij.openapi.util.SystemInfoRt; import com.intellij.openapi.util.UserDataHolderBase; import com.intellij.openapi.util.registry.Registry; -import com.intellij.ui.mac.foundation.MacUtil; +import com.intellij.ui.CoreAwareIconManager; +import com.intellij.ui.IconManager; import com.intellij.util.ObjectUtils; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.Stack; import it.unimi.dsi.fastutil.doubles.DoubleArrayList; import org.jetbrains.annotations.NonNls; @@ -26,8 +27,10 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Arrays; +import java.util.Collections; import java.util.Optional; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; public class AbstractProgressIndicatorBase extends UserDataHolderBase implements ProgressIndicator { private static final Logger LOG = Logger.getInstance(AbstractProgressIndicatorBase.class); @@ -41,8 +44,9 @@ public class AbstractProgressIndicatorBase extends UserDataHolderBase implements private volatile boolean myStopped; private volatile boolean myIndeterminate = Registry.is("ide.progress.indeterminate.by.default", true); - private volatile MacUtil.Activity myMacActivity; - private volatile boolean myShouldStartActivity = true; + private volatile Runnable myMacActivity; + // false by default - do not attempt to use such a relatively heavy code on start-up + private volatile boolean myShouldStartActivity = SystemInfoRt.isMac && Registry.is("idea.mac.prevent.app.nap", false); private Stack<@NlsContexts.ProgressText String> myTextStack; // guarded by this private DoubleArrayList myFractionStack; // guarded by this @@ -70,12 +74,21 @@ public class AbstractProgressIndicatorBase extends UserDataHolderBase implements myText = ""; myFraction = 0; myText2 = ""; - startSystemActivity(); + + if (myShouldStartActivity) { + IconManager iconManager = IconManager.getInstance(); + if (iconManager instanceof CoreAwareIconManager) { + myMacActivity = ((CoreAwareIconManager)iconManager).wakeUpNeo(this); + } + } + else { + myMacActivity = null; + } myRunning = true; } } - private static final Set> ourReportedReuseExceptions = ContainerUtil.newConcurrentSet(); + private static final Set> ourReportedReuseExceptions = Collections.newSetFromMap(new ConcurrentHashMap<>()); protected boolean isReuseable() { return false; @@ -91,14 +104,10 @@ public class AbstractProgressIndicatorBase extends UserDataHolderBase implements } } - private void startSystemActivity() { - myMacActivity = myShouldStartActivity ? MacUtil.wakeUpNeo(this) : null; - } - void stopSystemActivity() { - MacUtil.Activity macActivity = myMacActivity; + Runnable macActivity = myMacActivity; if (macActivity != null) { - macActivity.matrixHasYou(); + macActivity.run(); myMacActivity = null; } } diff --git a/platform/core-impl/src/com/intellij/psi/impl/DocumentCommitThread.java b/platform/core-impl/src/com/intellij/psi/impl/DocumentCommitThread.java index 7cbe4ea698c9..1a9f105f0d15 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/DocumentCommitThread.java +++ b/platform/core-impl/src/com/intellij/psi/impl/DocumentCommitThread.java @@ -30,7 +30,7 @@ import com.intellij.psi.text.BlockSupport; import com.intellij.util.SmartList; import com.intellij.util.concurrency.AppExecutorUtil; import com.intellij.util.concurrency.BoundedTaskExecutor; -import com.intellij.util.ui.UIUtil; +import com.intellij.util.ui.EdtInvocationManager; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -202,10 +202,10 @@ public final class DocumentCommitThread implements Disposable, DocumentCommitPro ApplicationManager.getApplication().assertIsWriteThread(); assert !ApplicationManager.getApplication().isWriteAccessAllowed(); - UIUtil.dispatchAllInvocationEvents(); + EdtInvocationManager.dispatchAllInvocationEvents(); while (!((BoundedTaskExecutor)executor).isEmpty()) { ((BoundedTaskExecutor)executor).waitAllTasksExecuted(timeout, timeUnit); - UIUtil.dispatchAllInvocationEvents(); + EdtInvocationManager.dispatchAllInvocationEvents(); } } diff --git a/platform/core-impl/src/com/intellij/psi/impl/ElementBase.java b/platform/core-impl/src/com/intellij/psi/impl/ElementBase.java index 2d7dc4d30516..21470078da2d 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/ElementBase.java +++ b/platform/core-impl/src/com/intellij/psi/impl/ElementBase.java @@ -19,11 +19,13 @@ import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.SmartPointerManager; import com.intellij.psi.SmartPsiElementPointer; +import com.intellij.ui.CoreAwareIconManager; import com.intellij.ui.IconManager; -import com.intellij.ui.LayeredIcon; import com.intellij.ui.icons.RowIcon; -import com.intellij.util.*; -import org.jetbrains.annotations.ApiStatus; +import com.intellij.util.AstLoadingFilter; +import com.intellij.util.BitUtil; +import com.intellij.util.PlatformIcons; +import com.intellij.util.PsiIconUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -150,16 +152,6 @@ public abstract class ElementBase extends UserDataHolderBase implements Iconable return false; } - @NotNull - public static Icon overlayIcons(Icon @NotNull ... icons) { - final LayeredIcon icon = new LayeredIcon(icons.length); - int i = 0; - for (Icon ic : icons) { - icon.setIcon(ic, i++); - } - return icon; - } - @NotNull public static RowIcon buildRowIcon(Icon baseIcon, Icon visibilityIcon) { return IconManager.getInstance().createRowIcon(baseIcon, visibilityIcon); @@ -199,10 +191,11 @@ public abstract class ElementBase extends UserDataHolderBase implements Iconable } } - @Nullable - protected Icon getElementIcon(@Iconable.IconFlags int flags) { + protected @Nullable Icon getElementIcon(@Iconable.IconFlags int flags) { PsiElement element = (PsiElement)this; - if (!element.isValid()) return null; + if (!element.isValid()) { + return null; + } boolean isLocked = BitUtil.isSet(flags, ICON_FLAG_READ_STATUS) && !element.isWritable(); int elementFlags = isLocked ? FLAGS_LOCKED : 0; @@ -217,33 +210,29 @@ public abstract class ElementBase extends UserDataHolderBase implements Iconable if (element instanceof PsiFile) { PsiFile psiFile = (PsiFile)element; VirtualFile vFile = psiFile.getVirtualFile(); - Icon baseIcon = vFile != null ? IconUtil.getIcon(vFile, flags & ~ICON_FLAG_READ_STATUS, psiFile.getProject()) - : psiFile.getFileType().getIcon(); + Icon baseIcon; + if (vFile == null) { + baseIcon = psiFile.getFileType().getIcon(); + } + else { + IconManager iconManager = IconManager.getInstance(); + if (iconManager instanceof CoreAwareIconManager) { + baseIcon = ((CoreAwareIconManager)iconManager).getIcon(vFile, flags & ~ICON_FLAG_READ_STATUS, psiFile.getProject()); + } + else { + return null; + } + } return IconManager.getInstance().createLayeredIcon(this, baseIcon, elementFlags); } return null; } - @NotNull - @Deprecated - @ApiStatus.ScheduledForRemoval - public static com.intellij.ui.RowIcon createLayeredIcon(@NotNull Iconable instance, Icon icon, int flags) { - return (com.intellij.ui.RowIcon)IconManager.getInstance().createLayeredIcon(instance, icon, flags); - } - public static int transformFlags(PsiElement element, @IconFlags int _flags) { int flags = BitUtil.clear(_flags, ICON_FLAG_READ_STATUS); final boolean isLocked = BitUtil.isSet(_flags, ICON_FLAG_READ_STATUS) && !element.isWritable(); if (isLocked) flags |= FLAGS_LOCKED; return flags; } - - /** - * @deprecated use {@link IconManager#registerIconLayer(int, Icon)} - */ - @Deprecated - public static void registerIconLayer(int flagMask, @NotNull Icon icon) { - IconManager.getInstance().registerIconLayer(flagMask, icon); - } } diff --git a/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java b/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java index 55261f64de4e..b3205a781ded 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java +++ b/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java @@ -38,7 +38,7 @@ import com.intellij.psi.util.PsiUtilCore; import com.intellij.util.*; import com.intellij.util.concurrency.Semaphore; import com.intellij.util.containers.ContainerUtil; -import com.intellij.util.ui.UIUtil; +import com.intellij.util.ui.EdtInvocationManager; import org.jetbrains.annotations.*; import javax.swing.*; @@ -613,7 +613,7 @@ public abstract class PsiDocumentManagerBase extends PsiDocumentManager implemen whenAllCommitted.run(); } else { - UIUtil.invokeLaterIfNeeded(() -> { if (!myProject.isDisposed()) performWhenAllCommitted(whenAllCommitted);}); + EdtInvocationManager.invokeLaterIfNeeded(() -> { if (!myProject.isDisposed()) performWhenAllCommitted(whenAllCommitted);}); } } diff --git a/platform/core-impl/src/com/intellij/psi/impl/file/PsiDirectoryImpl.java b/platform/core-impl/src/com/intellij/psi/impl/file/PsiDirectoryImpl.java index 4ed00604a3ba..4f64df5a5640 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/file/PsiDirectoryImpl.java +++ b/platform/core-impl/src/com/intellij/psi/impl/file/PsiDirectoryImpl.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.psi.impl.file; import com.intellij.core.CoreBundle; @@ -18,7 +18,10 @@ import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vfs.*; +import com.intellij.openapi.vfs.InvalidVirtualFileAccessException; +import com.intellij.openapi.vfs.NonPhysicalFileSystem; +import com.intellij.openapi.vfs.VfsUtilCore; +import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; import com.intellij.psi.impl.CheckUtil; import com.intellij.psi.impl.PsiElementBase; @@ -28,7 +31,7 @@ import com.intellij.psi.search.PsiElementProcessor; import com.intellij.psi.search.PsiFileSystemItemProcessor; import com.intellij.psi.util.PsiUtilCore; import com.intellij.testFramework.LightVirtualFile; -import com.intellij.ui.IconWithToolTip; +import com.intellij.ui.IconManager; import com.intellij.util.ArrayUtilRt; import com.intellij.util.IncorrectOperationException; import com.intellij.util.PlatformIcons; @@ -528,8 +531,8 @@ public class PsiDirectoryImpl extends PsiElementBase implements PsiDirectory, Qu } @Override - protected Icon getElementIcon(final int flags) { - return IconWithToolTip.tooltipOnlyIfComposite(PlatformIcons.FOLDER_ICON); + protected Icon getElementIcon(int flags) { + return IconManager.getInstance().tooltipOnlyIfComposite(PlatformIcons.FOLDER_ICON); } @Override diff --git a/platform/core-ui/intellij.platform.core.ui.iml b/platform/core-ui/intellij.platform.core.ui.iml index e25aca1bb687..a96c7cf2dc96 100644 --- a/platform/core-ui/intellij.platform.core.ui.iml +++ b/platform/core-ui/intellij.platform.core.ui.iml @@ -1,6 +1,6 @@ - + diff --git a/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/DataContext.java b/platform/core-ui/src/openapi/actionSystem/DataContext.java similarity index 95% rename from platform/editor-ui-api/src/com/intellij/openapi/actionSystem/DataContext.java rename to platform/core-ui/src/openapi/actionSystem/DataContext.java index 8d8397a1e192..7a1173fbb516 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/DataContext.java +++ b/platform/core-ui/src/openapi/actionSystem/DataContext.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.openapi.actionSystem; import org.jetbrains.annotations.NotNull; diff --git a/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/DataKey.java b/platform/core-ui/src/openapi/actionSystem/DataKey.java similarity index 100% rename from platform/editor-ui-api/src/com/intellij/openapi/actionSystem/DataKey.java rename to platform/core-ui/src/openapi/actionSystem/DataKey.java diff --git a/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/DataProvider.java b/platform/core-ui/src/openapi/actionSystem/DataProvider.java similarity index 68% rename from platform/editor-ui-api/src/com/intellij/openapi/actionSystem/DataProvider.java rename to platform/core-ui/src/openapi/actionSystem/DataProvider.java index f9ee24b93035..a5d7fd419321 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/DataProvider.java +++ b/platform/core-ui/src/openapi/actionSystem/DataProvider.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2013 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.openapi.actionSystem; import org.jetbrains.annotations.NonNls; diff --git a/platform/core-ui/src/ui/CoreIconManager.java b/platform/core-ui/src/ui/CoreIconManager.java index 1f2a3ffc8136..43135ae8e8f1 100644 --- a/platform/core-ui/src/ui/CoreIconManager.java +++ b/platform/core-ui/src/ui/CoreIconManager.java @@ -5,17 +5,21 @@ import com.intellij.AbstractBundle; import com.intellij.DynamicBundle; import com.intellij.ide.IconLayerProvider; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.project.Project; import com.intellij.openapi.util.IconLoader; import com.intellij.openapi.util.Iconable; import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.ui.mac.foundation.MacUtil; import com.intellij.util.BitUtil; import com.intellij.util.IconUtil; import com.intellij.util.SmartList; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.EmptyIcon; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; @@ -24,7 +28,7 @@ import java.util.ResourceBundle; import java.util.function.Function; import java.util.function.Supplier; -public final class CoreIconManager implements IconManager { +public final class CoreIconManager implements IconManager, CoreAwareIconManager { private static final List ourIconLayers = ContainerUtil.createLockFreeCopyOnWriteList(); private static final int FLAGS_LOCKED = 0x800; private static final Logger LOG = Logger.getInstance(CoreIconManager.class); @@ -44,7 +48,7 @@ public final class CoreIconManager implements IconManager { @NotNull @Override - public Icon createDeferredIcon(@NotNull Icon base, T param, @NotNull Function f) { + public Icon createDeferredIcon(@Nullable Icon base, T param, @NotNull Function f) { return IconDeferrer.getInstance().defer(base, param, t -> f.apply(t)); } @@ -62,6 +66,21 @@ public final class CoreIconManager implements IconManager { ourIconLayers.add(new IconLayer(flagMask, icon)); } + @Override + public @NotNull Icon createOverlayIcon(Icon @NotNull ... icons) { + LayeredIcon icon = new LayeredIcon(icons.length); + int i = 0; + for (Icon ic : icons) { + icon.setIcon(ic, i++); + } + return icon; + } + + @Override + public @NotNull Icon tooltipOnlyIfComposite(@NotNull Icon icon) { + return new IconWrapperWithToolTipComposite(icon); + } + @NotNull @Override public com.intellij.ui.icons.RowIcon createRowIcon(int iconCount, com.intellij.ui.icons.RowIcon.Alignment alignment) { @@ -124,6 +143,16 @@ public final class CoreIconManager implements IconManager { return new LayeredIcon(icons); } + @Override + public @NotNull Icon getIcon(@NotNull VirtualFile file, int flags, @Nullable Project project) { + return IconUtil.getIcon(file, flags, project); + } + + @Override + public @NotNull Runnable wakeUpNeo(@NotNull Object reason) { + return MacUtil.wakeUpNeo(reason); + } + private static final class IconLayer { private final int flagMask; @NotNull diff --git a/platform/core-ui/src/ui/IconDeferrer.java b/platform/core-ui/src/ui/IconDeferrer.java index 24ef7b9b06c2..87fd4b05035f 100644 --- a/platform/core-ui/src/ui/IconDeferrer.java +++ b/platform/core-ui/src/ui/IconDeferrer.java @@ -1,41 +1,28 @@ -/* - * 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. /* * @author max */ package com.intellij.ui; -import com.intellij.openapi.components.ServiceManager; -import com.intellij.openapi.util.Comparing; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.util.Function; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.*; +import java.util.Objects; public abstract class IconDeferrer { public static IconDeferrer getInstance() { - return ServiceManager.getService(IconDeferrer.class); + return ApplicationManager.getApplication().getService(IconDeferrer.class); } - public abstract Icon defer(Icon base, T param, @NotNull Function f); + public abstract @NotNull Icon defer(@Nullable Icon base, T param, @NotNull Function f); public abstract Icon deferAutoUpdatable(Icon base, T param, @NotNull Function f); public boolean equalIcons(Icon icon1, Icon icon2) { - return Comparing.equal(icon1, icon2); + return Objects.equals(icon1, icon2); } } \ No newline at end of file diff --git a/platform/core-ui/src/ui/IconWithToolTip.java b/platform/core-ui/src/ui/IconWithToolTip.java index 426ed42c4b5d..d0946a94786e 100644 --- a/platform/core-ui/src/ui/IconWithToolTip.java +++ b/platform/core-ui/src/ui/IconWithToolTip.java @@ -28,8 +28,4 @@ public interface IconWithToolTip extends Icon { return new IconWrapperWithToolTip(icon, tooltip); } } - - static IconWithToolTip tooltipOnlyIfComposite(Icon icon) { - return new IconWrapperWithToolTipComposite(icon); - } } diff --git a/platform/core-ui/src/util/IconUtil.java b/platform/core-ui/src/util/IconUtil.java index 581f8f2040d8..5a07a0d53a91 100644 --- a/platform/core-ui/src/util/IconUtil.java +++ b/platform/core-ui/src/util/IconUtil.java @@ -28,6 +28,7 @@ import java.awt.image.BufferedImage; import java.awt.image.RGBImageFilter; import java.lang.ref.WeakReference; import java.util.Objects; +import java.util.function.Function; import java.util.function.Supplier; import static com.intellij.ui.scale.ScaleType.OBJ_SCALE; @@ -132,8 +133,9 @@ public class IconUtil { }; } - private static final NullableFunction ICON_NULLABLE_FUNCTION = key -> - computeFileIcon(key.getFile(), key.getFlags(), key.getProject()); + private static final Function ICON_NULLABLE_FUNCTION = key -> { + return computeFileIcon(key.getFile(), key.getFlags(), key.getProject()); + }; /** * @return a deferred icon for the file, taking into account {@link FileIconProvider} and {@link FileIconPatcher} extensions. @@ -185,10 +187,10 @@ public class IconUtil { * @return a deferred icon for the file, taking into account {@link FileIconProvider} and {@link FileIconPatcher} extensions. * Use {@link #computeFileIcon} where possible (e.g. in background threads) to get a non-deferred icon. */ - public static Icon getIcon(@NotNull VirtualFile file, @Iconable.IconFlags int flags, @Nullable Project project) { + public static @NotNull Icon getIcon(@NotNull VirtualFile file, @Iconable.IconFlags int flags, @Nullable Project project) { Icon lastIcon = Iconable.LastComputedIcon.get(file, flags); Icon base = lastIcon != null ? lastIcon : computeBaseFileIcon(file); - return IconDeferrer.getInstance().defer(base, new FileIconKey(file, project, flags), ICON_NULLABLE_FUNCTION); + return IconManager.getInstance().createDeferredIcon(base, new FileIconKey(file, project, flags), ICON_NULLABLE_FUNCTION); } /** @@ -204,7 +206,7 @@ public class IconUtil { } FileType fileType = vFile.getFileType(); if (vFile.isDirectory() && !(fileType instanceof DirectoryFileType)) { - return IconWithToolTip.tooltipOnlyIfComposite(PlatformIcons.FOLDER_ICON); + return IconManager.getInstance().tooltipOnlyIfComposite(PlatformIcons.FOLDER_ICON); } icon = fileType.getIcon(); return icon != null ? icon : getEmptyIcon(false); @@ -221,7 +223,7 @@ public class IconUtil { @NotNull public static Icon getEmptyIcon(boolean showVisibility) { - RowIcon baseIcon = new RowIcon(2); + com.intellij.ui.icons.RowIcon baseIcon = new RowIcon(2); baseIcon.setIcon(EmptyIcon.create(PlatformIcons.CLASS_ICON), 0); if (showVisibility) { baseIcon.setIcon(EmptyIcon.create(PlatformIcons.PUBLIC_ICON), 1); diff --git a/platform/credential-store/intellij.platform.credentialStore.iml b/platform/credential-store/intellij.platform.credentialStore.iml index 83b9eb5db464..82e802eaa333 100644 --- a/platform/credential-store/intellij.platform.credentialStore.iml +++ b/platform/credential-store/intellij.platform.credentialStore.iml @@ -53,5 +53,6 @@ + \ No newline at end of file diff --git a/platform/diff-api/intellij.platform.diff.iml b/platform/diff-api/intellij.platform.diff.iml index 296a48bb375e..86323b1142cf 100644 --- a/platform/diff-api/intellij.platform.diff.iml +++ b/platform/diff-api/intellij.platform.diff.iml @@ -10,5 +10,6 @@ + \ No newline at end of file diff --git a/platform/diff-impl/intellij.platform.diff.impl.iml b/platform/diff-impl/intellij.platform.diff.impl.iml index 101168435b47..fa9733d16f54 100644 --- a/platform/diff-impl/intellij.platform.diff.impl.iml +++ b/platform/diff-impl/intellij.platform.diff.impl.iml @@ -17,5 +17,6 @@ + \ No newline at end of file diff --git a/platform/diff-impl/intellij.platform.diff.tests.iml b/platform/diff-impl/intellij.platform.diff.tests.iml index de9d7ca33a89..506a0bd914bd 100644 --- a/platform/diff-impl/intellij.platform.diff.tests.iml +++ b/platform/diff-impl/intellij.platform.diff.tests.iml @@ -19,5 +19,6 @@ + \ No newline at end of file diff --git a/platform/dvcs-impl/intellij.platform.vcs.dvcs.impl.iml b/platform/dvcs-impl/intellij.platform.vcs.dvcs.impl.iml index a57573b3f1ac..f5ccdff17fed 100644 --- a/platform/dvcs-impl/intellij.platform.vcs.dvcs.impl.iml +++ b/platform/dvcs-impl/intellij.platform.vcs.dvcs.impl.iml @@ -23,5 +23,7 @@ + + \ No newline at end of file diff --git a/platform/editor-ui-ex/intellij.platform.editor.ex.iml b/platform/editor-ui-ex/intellij.platform.editor.ex.iml index 0419dc9b7c22..19383c9339f2 100644 --- a/platform/editor-ui-ex/intellij.platform.editor.ex.iml +++ b/platform/editor-ui-ex/intellij.platform.editor.ex.iml @@ -16,6 +16,6 @@ - + \ No newline at end of file diff --git a/platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/util/LayeredLexerEditorHighlighter.java b/platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/util/LayeredLexerEditorHighlighter.java index 60c64a62d13d..0b3435062eb1 100644 --- a/platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/util/LayeredLexerEditorHighlighter.java +++ b/platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/util/LayeredLexerEditorHighlighter.java @@ -23,7 +23,7 @@ import com.intellij.psi.tree.IElementType; import com.intellij.util.ArrayUtil; import com.intellij.util.containers.FactoryMap; import com.intellij.util.text.MergingCharSequence; -import gnu.trove.TIntIntHashMap; +import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; import it.unimi.dsi.fastutil.ints.IntArrayList; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -64,12 +64,12 @@ public class LayeredLexerEditorHighlighter extends LexerEditorHighlighter { return (MappingSegments)super.getSegments(); } - private class LightMapper { + private final class LightMapper { final Mapper mapper; final StringBuilder text = new StringBuilder(); final IntArrayList lengths = new IntArrayList(); final List tokenTypes = new ArrayList<>(); - final TIntIntHashMap index2Global = new TIntIntHashMap(); + final Int2IntOpenHashMap index2Global = new Int2IntOpenHashMap(); private final String mySeparator; final int insertOffset; diff --git a/platform/execution-impl/intellij.platform.execution.impl.iml b/platform/execution-impl/intellij.platform.execution.impl.iml index 4ef27679c50c..715f0f6d106d 100644 --- a/platform/execution-impl/intellij.platform.execution.impl.iml +++ b/platform/execution-impl/intellij.platform.execution.impl.iml @@ -16,5 +16,6 @@ + \ No newline at end of file diff --git a/platform/external-system-api/intellij.platform.externalSystem.iml b/platform/external-system-api/intellij.platform.externalSystem.iml index 8edfdead86b3..34fa87da4dee 100644 --- a/platform/external-system-api/intellij.platform.externalSystem.iml +++ b/platform/external-system-api/intellij.platform.externalSystem.iml @@ -21,5 +21,6 @@ + \ No newline at end of file diff --git a/platform/external-system-impl/intellij.platform.externalSystem.impl.iml b/platform/external-system-impl/intellij.platform.externalSystem.impl.iml index 840091672981..9e706bd77f79 100644 --- a/platform/external-system-impl/intellij.platform.externalSystem.impl.iml +++ b/platform/external-system-impl/intellij.platform.externalSystem.impl.iml @@ -26,5 +26,6 @@ + \ No newline at end of file diff --git a/platform/external-system-impl/intellij.platform.externalSystem.tests.iml b/platform/external-system-impl/intellij.platform.externalSystem.tests.iml index b428f04c8c0c..5bd4c34aaeb1 100644 --- a/platform/external-system-impl/intellij.platform.externalSystem.tests.iml +++ b/platform/external-system-impl/intellij.platform.externalSystem.tests.iml @@ -24,6 +24,6 @@ - + \ No newline at end of file diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/task/ui/ConfigureTasksActivationDialog.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/task/ui/ConfigureTasksActivationDialog.java index 73055883b988..dcab037a7124 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/task/ui/ConfigureTasksActivationDialog.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/task/ui/ConfigureTasksActivationDialog.java @@ -14,9 +14,11 @@ import com.intellij.openapi.externalSystem.model.ProjectKeys; import com.intellij.openapi.externalSystem.model.ProjectSystemId; import com.intellij.openapi.externalSystem.model.project.ModuleData; import com.intellij.openapi.externalSystem.service.project.ProjectDataManager; +import com.intellij.openapi.externalSystem.service.project.manage.ExternalProjectsManagerImpl; import com.intellij.openapi.externalSystem.service.project.manage.ExternalProjectsManagerImpl.ExternalProjectsStateProvider; import com.intellij.openapi.externalSystem.service.project.manage.ExternalSystemTaskActivator; import com.intellij.openapi.externalSystem.service.project.manage.ExternalSystemTaskActivator.Phase; +import com.intellij.openapi.externalSystem.service.project.manage.ExternalSystemTaskActivator.TaskActivationEntry; import com.intellij.openapi.externalSystem.service.project.manage.TaskActivationState; import com.intellij.openapi.externalSystem.settings.AbstractExternalSystemSettings; import com.intellij.openapi.externalSystem.settings.ExternalProjectSettings; @@ -52,14 +54,7 @@ import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; import java.util.*; -import static com.intellij.openapi.externalSystem.service.project.manage.ExternalProjectsManagerImpl.getInstance; -import static com.intellij.openapi.externalSystem.service.project.manage.ExternalSystemTaskActivator.TaskActivationEntry; - -/** - * @author Vladislav.Soroka - */ -public class ConfigureTasksActivationDialog extends DialogWrapper { - +public final class ConfigureTasksActivationDialog extends DialogWrapper { @NotNull private final Project myProject; @NotNull private final ExternalSystemTaskActivator myTaskActivator; @NotNull ProjectSystemId myProjectSystemId; @@ -84,7 +79,7 @@ public class ConfigureTasksActivationDialog extends DialogWrapper { setModal(true); setTitle(ExternalSystemBundle.message("external.system.task.activation.title", externalSystemId.getReadableName())); init(); - myTaskActivator = getInstance(myProject).getTaskActivator(); + myTaskActivator = ExternalProjectsManagerImpl.getInstance(myProject).getTaskActivator(); } @Override @@ -204,7 +199,7 @@ public class ConfigureTasksActivationDialog extends DialogWrapper { final TreePath[] selectionPaths = tree.getSelectionPaths(); if (selectionPaths == null) return; - ContainerUtil.sort(selectionPaths, new Comparator() { + ContainerUtil.sort(selectionPaths, new Comparator<>() { @Override public int compare(TreePath o1, TreePath o2) { return -direction * compare(tree.getRowForPath(o1), tree.getRowForPath(o2)); @@ -381,17 +376,17 @@ public class ConfigureTasksActivationDialog extends DialogWrapper { @Override public PopupStep onChosen(final ProjectPopupItem projectPopupItem, final boolean finalChoice) { - return new BaseListPopupStep(ExternalSystemBundle.message("popup.title.choose.activation.phase"), Phase.values()) { + return new BaseListPopupStep<>(ExternalSystemBundle.message("popup.title.choose.activation.phase"), Phase.values()) { @Override public PopupStep onChosen(final Phase selectedPhase, boolean finalChoice) { final Map activationMap = - getInstance(myProject).getStateProvider().getProjectsTasksActivationMap(myProjectSystemId); + ExternalProjectsManagerImpl.getInstance(myProject).getStateProvider().getProjectsTasksActivationMap(myProjectSystemId); final String projectPath = projectPopupItem.myModuleData.getLinkedExternalProjectPath(); final List tasks = activationMap.get(projectPath).getTasks(selectedPhase); final List tasksToSuggest = new ArrayList<>(projectPopupItem.myTasks); tasksToSuggest.removeAll(tasks); - return new BaseListPopupStep(ExternalSystemBundle.message("popup.title.choose.task"), tasksToSuggest) { + return new BaseListPopupStep<>(ExternalSystemBundle.message("popup.title.choose.task"), tasksToSuggest) { @Override public PopupStep onChosen(final String taskName, boolean finalChoice) { return doFinalStep(() -> { @@ -430,7 +425,7 @@ public class ConfigureTasksActivationDialog extends DialogWrapper { RootNode() { super(ConfigureTasksActivationDialog.this.myProject, null); - myStateProvider = getInstance(ConfigureTasksActivationDialog.this.myProject).getStateProvider(); + myStateProvider = ExternalProjectsManagerImpl.getInstance(ConfigureTasksActivationDialog.this.myProject).getStateProvider(); } @Override diff --git a/platform/indexing-api/src/com/intellij/psi/search/searches/ReferencesSearch.java b/platform/indexing-api/src/com/intellij/psi/search/searches/ReferencesSearch.java index 45e0d2d76544..4437faa6d118 100644 --- a/platform/indexing-api/src/com/intellij/psi/search/searches/ReferencesSearch.java +++ b/platform/indexing-api/src/com/intellij/psi/search/searches/ReferencesSearch.java @@ -9,7 +9,6 @@ import com.intellij.psi.PsiReference; import com.intellij.psi.search.*; import com.intellij.psi.util.PsiUtilCore; import com.intellij.util.*; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -173,7 +172,7 @@ public final class ReferencesSearch extends ExtensibleQueryFactory uniqueResults(@NotNull Query composite) { - return new UniqueResultsQuery<>(composite, ContainerUtil.canonicalStrategy(), ReferenceDescriptor.MAPPER); + return new UniqueResultsQuery<>(composite, ReferenceDescriptor.MAPPER); } public static void searchOptimized(@NotNull PsiElement element, diff --git a/platform/lang-api/intellij.platform.lang.iml b/platform/lang-api/intellij.platform.lang.iml index fe09d3f747b2..d0ad44eda94d 100644 --- a/platform/lang-api/intellij.platform.lang.iml +++ b/platform/lang-api/intellij.platform.lang.iml @@ -24,6 +24,8 @@ + + \ No newline at end of file diff --git a/platform/lang-api/src/com/intellij/openapi/projectRoots/SdkType.java b/platform/lang-api/src/com/intellij/openapi/projectRoots/SdkType.java index 3e56d8816cff..be04defef71f 100644 --- a/platform/lang-api/src/com/intellij/openapi/projectRoots/SdkType.java +++ b/platform/lang-api/src/com/intellij/openapi/projectRoots/SdkType.java @@ -1,6 +1,7 @@ // 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.projectRoots; +import com.intellij.icons.AllIcons; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.openapi.fileChooser.FileChooserDescriptor; import com.intellij.openapi.progress.ProgressManager; @@ -12,7 +13,6 @@ import com.intellij.openapi.util.NlsContexts; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.Consumer; -import com.intellij.util.IconUtil; import org.jdom.Element; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; @@ -25,7 +25,7 @@ import java.util.Collections; import java.util.Comparator; public abstract class SdkType implements SdkTypeId { - public static final ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.sdkType"); + public static final ExtensionPointName EP_NAME = new ExtensionPointName<>("com.intellij.sdkType"); private static final Comparator ALPHABETICAL_COMPARATOR = (sdk1, sdk2) -> StringUtil.compare(sdk1.getName(), sdk2.getName(), true); @@ -166,7 +166,7 @@ public abstract class SdkType implements SdkTypeId { @NotNull public Icon getIconForAddAction() { - return IconUtil.getAddIcon(); + return AllIcons.General.Add; } @Override diff --git a/platform/lang-api/src/com/intellij/openapi/projectRoots/ui/PathEditor.java b/platform/lang-api/src/com/intellij/openapi/projectRoots/ui/PathEditor.java index e6b452bd9fa6..4ff0a42ed863 100644 --- a/platform/lang-api/src/com/intellij/openapi/projectRoots/ui/PathEditor.java +++ b/platform/lang-api/src/com/intellij/openapi/projectRoots/ui/PathEditor.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.openapi.projectRoots.ui; import com.intellij.icons.AllIcons; diff --git a/platform/lang-api/src/com/intellij/openapi/projectRoots/ui/SdkPathEditor.java b/platform/lang-api/src/com/intellij/openapi/projectRoots/ui/SdkPathEditor.java index cffe570306b1..05dfe9e9031a 100644 --- a/platform/lang-api/src/com/intellij/openapi/projectRoots/ui/SdkPathEditor.java +++ b/platform/lang-api/src/com/intellij/openapi/projectRoots/ui/SdkPathEditor.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.openapi.projectRoots.ui; import com.intellij.openapi.fileChooser.FileChooserDescriptor; diff --git a/platform/lang-impl/intellij.platform.lang.impl.iml b/platform/lang-impl/intellij.platform.lang.impl.iml index 57a76e2aae9b..8fe08c363357 100644 --- a/platform/lang-impl/intellij.platform.lang.impl.iml +++ b/platform/lang-impl/intellij.platform.lang.impl.iml @@ -50,6 +50,7 @@ + diff --git a/platform/lang-impl/intellij.platform.lang.tests.iml b/platform/lang-impl/intellij.platform.lang.tests.iml index cd72a1f0185d..2f15f3d4e007 100644 --- a/platform/lang-impl/intellij.platform.lang.tests.iml +++ b/platform/lang-impl/intellij.platform.lang.tests.iml @@ -40,5 +40,6 @@ + \ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/IntentionHintComponent.java b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/IntentionHintComponent.java index 0d7cdf2486b5..3f26a5ebeecb 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/IntentionHintComponent.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/IntentionHintComponent.java @@ -48,7 +48,6 @@ import com.intellij.ui.popup.list.ListPopupImpl; import com.intellij.util.Alarm; import com.intellij.util.ThreeState; import com.intellij.util.containers.ContainerUtil; -import com.intellij.util.ui.EmptyIcon; import kotlin.Unit; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -170,7 +169,7 @@ public final class IntentionHintComponent implements Disposable, ScrollAwareHint private static final Logger LOG = Logger.getInstance(IntentionHintComponent.class); - private static final Icon ourInactiveArrowIcon = EmptyIcon.create(AllIcons.General.ArrowDown); + private static final Icon ourInactiveArrowIcon = IconManager.getInstance().createEmptyIcon(AllIcons.General.ArrowDown); private static final int NORMAL_BORDER_SIZE = 6; private static final int SMALL_BORDER_SIZE = 4; diff --git a/platform/lang-impl/src/com/intellij/refactoring/ui/AbstractMemberSelectionTable.java b/platform/lang-impl/src/com/intellij/refactoring/ui/AbstractMemberSelectionTable.java index 408803f4a29a..ec14bbaa66b4 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/ui/AbstractMemberSelectionTable.java +++ b/platform/lang-impl/src/com/intellij/refactoring/ui/AbstractMemberSelectionTable.java @@ -18,7 +18,6 @@ import com.intellij.refactoring.classMembers.MemberInfoModel; import com.intellij.ui.*; import com.intellij.ui.icons.RowIcon; import com.intellij.ui.table.JBTable; -import com.intellij.util.ui.EmptyIcon; import com.intellij.util.ui.JBUI; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -40,7 +39,7 @@ public abstract class AbstractMemberSelectionTable> createMap() { - return ConcurrentFactoryMap.create(k -> ConcurrentCollectionFactory.createConcurrentSet(myLeafEquality), - () -> ConcurrentCollectionFactory.createMap(ContainerUtil.identityStrategy())); + return ConcurrentFactoryMap.create(k -> { + return ConcurrentCollectionFactory.createConcurrentSet(new TObjectHashingStrategy() { + @Override + public int computeHashCode(PsiElement object) { + return myLeafEquality.hashCode(object); + } + + @Override + public boolean equals(PsiElement o1, PsiElement o2) { + return myLeafEquality.equals(o1, o2); + } + }); + }, () -> { + return ConcurrentCollectionFactory.createMap(ContainerUtil.identityStrategy()); + }); } public static class SliceNodeGuide implements WalkingState.TreeGuide { @@ -239,7 +240,7 @@ public class SliceLeafAnalyzer { if (children.isEmpty() && sliceUsage != null && sliceUsage.canBeLeaf()) { PsiElement value = sliceUsage.getElement(); if (value != null) { - node(element, map).addAll(ContainerUtil.singleton(value, myLeafEquality)); + node(element, map).addAll(SingletonSet.withCustomStrategy(value, myLeafEquality)); } } }); diff --git a/platform/lang-impl/src/com/intellij/slicer/SliceLeafEquality.java b/platform/lang-impl/src/com/intellij/slicer/SliceLeafEquality.java index eb8f34dcf9af..31d4d0a81012 100644 --- a/platform/lang-impl/src/com/intellij/slicer/SliceLeafEquality.java +++ b/platform/lang-impl/src/com/intellij/slicer/SliceLeafEquality.java @@ -1,18 +1,4 @@ -/* - * 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.slicer; import com.intellij.codeInsight.PsiEquivalenceUtil; @@ -22,16 +8,18 @@ import com.intellij.psi.PsiElement; import com.intellij.psi.PsiNamedElement; import com.intellij.psi.impl.source.tree.AstBufferUtil; import gnu.trove.TObjectHashingStrategy; +import it.unimi.dsi.fastutil.Hash; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -public class SliceLeafEquality implements TObjectHashingStrategy { +public class SliceLeafEquality implements Hash.Strategy, TObjectHashingStrategy { @NotNull protected PsiElement substituteElement(@NotNull PsiElement element) { return element; } @Override - public int computeHashCode(final PsiElement element) { + public int hashCode(@Nullable PsiElement element) { if (element == null) return 0; String text = ReadAction.compute(() -> { PsiElement elementToCompare = substituteElement(element); @@ -42,8 +30,18 @@ public class SliceLeafEquality implements TObjectHashingStrategy { } @Override - public boolean equals(final PsiElement o1, final PsiElement o2) { - return ReadAction - .compute(() -> o1 != null && o2 != null && PsiEquivalenceUtil.areElementsEquivalent(o1, o2)); + public int computeHashCode(PsiElement object) { + return hashCode(object); + } + + @Override + public boolean equals(@Nullable PsiElement o1, @Nullable PsiElement o2) { + if (o1 == o2) { + return true; + } + if (o1 == null || o2 == null) { + return false; + } + return ReadAction.compute(() -> PsiEquivalenceUtil.areElementsEquivalent(o1, o2)); } } diff --git a/platform/lang-impl/src/com/intellij/ui/IconDeferrerImpl.java b/platform/lang-impl/src/com/intellij/ui/IconDeferrerImpl.java index 2e373d1119cf..de384dc10c02 100644 --- a/platform/lang-impl/src/com/intellij/ui/IconDeferrerImpl.java +++ b/platform/lang-impl/src/com/intellij/ui/IconDeferrerImpl.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. /* * @author max @@ -21,12 +21,13 @@ import com.intellij.util.Function; import com.intellij.util.containers.FixedHashMap; import com.intellij.util.messages.MessageBusConnection; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.util.List; import java.util.Map; -public class IconDeferrerImpl extends IconDeferrer { +public final class IconDeferrerImpl extends IconDeferrer { private final Object LOCK = new Object(); private final Map myIconsCache = new FixedHashMap<>(Registry.intValue("ide.icons.deferrerCacheSize")); private long myLastClearTimestamp; @@ -64,7 +65,7 @@ public class IconDeferrerImpl extends IconDeferrer { } @Override - public Icon defer(final Icon base, final T param, @NotNull final Function evaluator) { + public @NotNull Icon defer(@Nullable Icon base, T param, @NotNull Function evaluator) { return deferImpl(base, param, evaluator, false); } @@ -73,7 +74,7 @@ public class IconDeferrerImpl extends IconDeferrer { return deferImpl(base, param, evaluator, true); } - private Icon deferImpl(Icon base, T param, @NotNull Function evaluator, final boolean autoUpdatable) { + private @NotNull Icon deferImpl(Icon base, T param, @NotNull Function evaluator, final boolean autoUpdatable) { if (myEvaluationIsInProgress.get().booleanValue()) { return evaluator.fun(param); } diff --git a/platform/lvcs-impl/intellij.platform.lvcs.impl.iml b/platform/lvcs-impl/intellij.platform.lvcs.impl.iml index e3778027ffa5..a913a6c174c1 100644 --- a/platform/lvcs-impl/intellij.platform.lvcs.impl.iml +++ b/platform/lvcs-impl/intellij.platform.lvcs.impl.iml @@ -17,6 +17,7 @@ + diff --git a/platform/platform-api/intellij.platform.ide.iml b/platform/platform-api/intellij.platform.ide.iml index e34f6b2f2c72..67a82598b666 100644 --- a/platform/platform-api/intellij.platform.ide.iml +++ b/platform/platform-api/intellij.platform.ide.iml @@ -36,9 +36,9 @@ - - - + + + diff --git a/platform/platform-api/src/com/intellij/ui/DefaultIconDeferrer.java b/platform/platform-api/src/com/intellij/ui/DefaultIconDeferrer.java index d8e2062450b3..2921fdb0a717 100644 --- a/platform/platform-api/src/com/intellij/ui/DefaultIconDeferrer.java +++ b/platform/platform-api/src/com/intellij/ui/DefaultIconDeferrer.java @@ -1,18 +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. /* * @author max @@ -21,12 +7,13 @@ package com.intellij.ui; import com.intellij.util.Function; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.*; -public class DefaultIconDeferrer extends IconDeferrer { +public final class DefaultIconDeferrer extends IconDeferrer { @Override - public Icon defer(final Icon base, final T param, @NotNull final Function f) { + public @NotNull Icon defer(@Nullable Icon base, T param, @NotNull Function f) { return f.fun(param); } diff --git a/platform/platform-impl/intellij.platform.ide.impl.iml b/platform/platform-impl/intellij.platform.ide.impl.iml index 3a18ee875af2..4258f588fcb7 100644 --- a/platform/platform-impl/intellij.platform.ide.impl.iml +++ b/platform/platform-impl/intellij.platform.ide.impl.iml @@ -91,5 +91,7 @@ + + \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/encoding/ChooseFileEncodingAction.java b/platform/platform-impl/src/com/intellij/openapi/vfs/encoding/ChooseFileEncodingAction.java index 9a4d1520a18b..5c6347043b22 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/encoding/ChooseFileEncodingAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/encoding/ChooseFileEncodingAction.java @@ -14,7 +14,7 @@ import com.intellij.openapi.project.DumbAwareAction; import com.intellij.openapi.util.*; import com.intellij.openapi.vfs.CharsetToolkit; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.ui.IconDeferrer; +import com.intellij.ui.IconManager; import com.intellij.util.ArrayUtilRt; import com.intellij.util.Function; import com.intellij.util.ui.EmptyIcon; @@ -70,7 +70,7 @@ public abstract class ChooseFileEncodingAction extends ComboBoxAction { return ArrayUtilRt.EMPTY_BYTE_ARRAY; } }); - defer = IconDeferrer.getInstance().defer(null, Pair.create(virtualFile, charset), pair -> { + defer = IconManager.getInstance().createDeferredIcon(null, new Pair<>(virtualFile, charset), pair -> { VirtualFile myFile = pair.getFirst(); Charset charset = pair.getSecond(); CharSequence text = myText.getValue(); diff --git a/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.java b/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.java index f4d05cbce7d5..d13c16eb0220 100644 --- a/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.java +++ b/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.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.util.ui; import com.intellij.openapi.actionSystem.AnActionEvent; @@ -8,10 +8,7 @@ import com.intellij.openapi.util.NlsContexts; import com.intellij.openapi.util.NullableComputable; import com.intellij.openapi.util.Pair; import com.intellij.openapi.wm.IdeFocusManager; -import com.intellij.ui.AnActionButton; -import com.intellij.ui.AnActionButtonRunnable; -import com.intellij.ui.HoverHyperlinkLabel; -import com.intellij.ui.ToolbarDecorator; +import com.intellij.ui.*; import com.intellij.ui.table.TableView; import com.intellij.util.IconUtil; import org.jetbrains.annotations.NonNls; @@ -37,7 +34,7 @@ import java.util.List; public abstract class ValidatingTableEditor implements ComponentWithEmptyText { private static final Icon WARNING_ICON = UIUtil.getBalloonWarningIcon(); - private static final Icon EMPTY_ICON = EmptyIcon.create(WARNING_ICON); + private static final Icon EMPTY_ICON = IconManager.getInstance().createEmptyIcon(WARNING_ICON); @NonNls private static final String REMOVE_KEY = "REMOVE_SELECTED"; public interface RowHeightProvider { diff --git a/platform/platform-resources/src/brokenPlugins.txt b/platform/platform-resources/src/brokenPlugins.txt index 0f4d010dff39..cf593eed2de7 100644 --- a/platform/platform-resources/src/brokenPlugins.txt +++ b/platform/platform-resources/src/brokenPlugins.txt @@ -1297,4 +1297,8 @@ MIFCMNotification.MIFCMNotification 0.1 com.zxy.ijplugin.wechat-miniprogram IU-LATEST-EAP-SNAPSHOT 1.0.0 1.1 1.2 1.3 1.3.1 1.4 1.4.1 1.8.1 com.decentralized.internet.id 1.0 ch.raffael.idea.plugins.runpopup 1.1.0 -com.shizhuang.duapp.ideaplugin 0.9.1-SNAPSHOT \ No newline at end of file +com.shizhuang.duapp.ideaplugin 0.9.1-SNAPSHOT +com.mojojungle.webosstorm 1.2 +gw.gosu.ij 5.0.0 +com.illuminatedcloud.intellij 1.8.5.7-idea19 1.8.5.5-idea19 +edu.clemson.resolve.jetbrains 0.1.2a \ No newline at end of file diff --git a/platform/platform-tests/intellij.platform.tests.iml b/platform/platform-tests/intellij.platform.tests.iml index 812142e6840d..7c67e0e19556 100644 --- a/platform/platform-tests/intellij.platform.tests.iml +++ b/platform/platform-tests/intellij.platform.tests.iml @@ -49,5 +49,10 @@ + + + + + \ No newline at end of file diff --git a/platform/remote-servers/impl/intellij.platform.remoteServers.impl.iml b/platform/remote-servers/impl/intellij.platform.remoteServers.impl.iml index 07084a144e38..f4e385c77c99 100644 --- a/platform/remote-servers/impl/intellij.platform.remoteServers.impl.iml +++ b/platform/remote-servers/impl/intellij.platform.remoteServers.impl.iml @@ -18,5 +18,6 @@ + \ No newline at end of file diff --git a/platform/remote-servers/target-integration-tests/intellij.platform.remoteServers.targetsIntegrationTests.iml b/platform/remote-servers/target-integration-tests/intellij.platform.remoteServers.targetsIntegrationTests.iml index fde3e2e9e36c..7b12f5b9fbce 100644 --- a/platform/remote-servers/target-integration-tests/intellij.platform.remoteServers.targetsIntegrationTests.iml +++ b/platform/remote-servers/target-integration-tests/intellij.platform.remoteServers.targetsIntegrationTests.iml @@ -14,5 +14,6 @@ + \ No newline at end of file diff --git a/platform/script-debugger/debugger-ui/intellij.platform.scriptDebugger.ui.iml b/platform/script-debugger/debugger-ui/intellij.platform.scriptDebugger.ui.iml index e7f051a86c32..0117665cd258 100644 --- a/platform/script-debugger/debugger-ui/intellij.platform.scriptDebugger.ui.iml +++ b/platform/script-debugger/debugger-ui/intellij.platform.scriptDebugger.ui.iml @@ -19,5 +19,6 @@ + \ No newline at end of file diff --git a/platform/smRunner/intellij.platform.smRunner.iml b/platform/smRunner/intellij.platform.smRunner.iml index da556eb2f0a1..643f647dfcc2 100644 --- a/platform/smRunner/intellij.platform.smRunner.iml +++ b/platform/smRunner/intellij.platform.smRunner.iml @@ -21,5 +21,6 @@ + \ No newline at end of file diff --git a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/TestTreeRenderer.java b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/TestTreeRenderer.java index 59922389375c..e6a786d69f31 100644 --- a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/TestTreeRenderer.java +++ b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/TestTreeRenderer.java @@ -4,9 +4,12 @@ package com.intellij.execution.testframework.sm.runner.ui; import com.intellij.execution.testframework.TestConsoleProperties; import com.intellij.execution.testframework.sm.runner.SMTRunnerNodeDescriptor; import com.intellij.execution.testframework.sm.runner.SMTestProxy; +import com.intellij.ide.ui.UISettings; import com.intellij.openapi.util.NlsSafe; import com.intellij.ui.ColoredTreeCellRenderer; import com.intellij.ui.RelativeFont; +import com.intellij.ui.SimpleTextAttributes; +import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -14,13 +17,6 @@ import javax.swing.*; import javax.swing.tree.DefaultMutableTreeNode; import java.awt.*; -import static com.intellij.ide.ui.UISettings.setupAntialiasing; -import static com.intellij.ui.SimpleTextAttributes.GRAYED_ATTRIBUTES; -import static com.intellij.util.ui.UIUtil.getTreeSelectionForeground; - -/** - * @author: Roman Chernyatchik - */ public class TestTreeRenderer extends ColoredTreeCellRenderer { @NonNls private static final String SPACE_STRING = " "; @@ -73,7 +69,7 @@ public class TestTreeRenderer extends ColoredTreeCellRenderer { FontMetrics metrics = getFontMetrics(RelativeFont.SMALL.derive(getFont())); myDurationWidth = metrics.stringWidth(myDurationText); myDurationOffset = metrics.getHeight() / 2; // an empty area before and after the text - myDurationColor = selected ? getTreeSelectionForeground(hasFocus) : GRAYED_ATTRIBUTES.getFgColor(); + myDurationColor = selected ? UIUtil.getTreeSelectionForeground(hasFocus) : SimpleTextAttributes.GRAYED_ATTRIBUTES.getFgColor(); } } //Done @@ -83,7 +79,7 @@ public class TestTreeRenderer extends ColoredTreeCellRenderer { //strange node final @NlsSafe String text = node.toString(); //no icon - append(text != null ? text : SPACE_STRING, GRAYED_ATTRIBUTES); + append(text != null ? text : SPACE_STRING, SimpleTextAttributes.GRAYED_ATTRIBUTES); } @NotNull @@ -108,7 +104,7 @@ public class TestTreeRenderer extends ColoredTreeCellRenderer { @Override protected void paintComponent(Graphics g) { - setupAntialiasing(g); + UISettings.setupAntialiasing(g); Shape clip = null; int width = getWidth(); int height = getHeight(); diff --git a/platform/statistics/devkit/intellij.platform.statistics.devkit.iml b/platform/statistics/devkit/intellij.platform.statistics.devkit.iml index 51d7d6c4451d..6516791dc1a2 100644 --- a/platform/statistics/devkit/intellij.platform.statistics.devkit.iml +++ b/platform/statistics/devkit/intellij.platform.statistics.devkit.iml @@ -20,5 +20,6 @@ + \ No newline at end of file diff --git a/platform/statistics/envTests/intellij.platform.statistics.envTests.iml b/platform/statistics/envTests/intellij.platform.statistics.envTests.iml index cf90a260baf8..6fdf755ea541 100644 --- a/platform/statistics/envTests/intellij.platform.statistics.envTests.iml +++ b/platform/statistics/envTests/intellij.platform.statistics.envTests.iml @@ -13,5 +13,6 @@ + \ No newline at end of file diff --git a/platform/statistics/intellij.platform.statistics.iml b/platform/statistics/intellij.platform.statistics.iml index 1be70621bb4e..21e375faa742 100644 --- a/platform/statistics/intellij.platform.statistics.iml +++ b/platform/statistics/intellij.platform.statistics.iml @@ -18,5 +18,7 @@ + + \ No newline at end of file diff --git a/platform/statistics/src/com/intellij/internal/statistic/service/fus/collectors/FUStateUsagesLogger.java b/platform/statistics/src/com/intellij/internal/statistic/service/fus/collectors/FUStateUsagesLogger.java index 87f84c583a13..04507a5f4d67 100644 --- a/platform/statistics/src/com/intellij/internal/statistic/service/fus/collectors/FUStateUsagesLogger.java +++ b/platform/statistics/src/com/intellij/internal/statistic/service/fus/collectors/FUStateUsagesLogger.java @@ -26,7 +26,7 @@ import java.util.concurrent.CompletableFuture; * *

To record IDE events (e.g. invoked action, opened dialog) use {@link FUCounterUsageLogger}

*/ -public class FUStateUsagesLogger implements UsagesCollectorConsumer { +public final class FUStateUsagesLogger implements UsagesCollectorConsumer { private static final Logger LOG = Logger.getInstance(FUStateUsagesLogger.class); private static final Object LOCK = new Object(); diff --git a/platform/structuralsearch/intellij.platform.structuralSearch.iml b/platform/structuralsearch/intellij.platform.structuralSearch.iml index 0370af656526..715959457faa 100644 --- a/platform/structuralsearch/intellij.platform.structuralSearch.iml +++ b/platform/structuralsearch/intellij.platform.structuralSearch.iml @@ -19,6 +19,7 @@ + diff --git a/platform/structuralsearch/intellij.platform.structuralSearch.tests.iml b/platform/structuralsearch/intellij.platform.structuralSearch.tests.iml index 44fedcb1653d..5fac6cae9c5c 100644 --- a/platform/structuralsearch/intellij.platform.structuralSearch.tests.iml +++ b/platform/structuralsearch/intellij.platform.structuralSearch.tests.iml @@ -13,5 +13,6 @@ + \ No newline at end of file diff --git a/platform/tasks-platform-impl/intellij.platform.tasks.impl.iml b/platform/tasks-platform-impl/intellij.platform.tasks.impl.iml index 652f9b6efb02..f1cbd9acd78a 100644 --- a/platform/tasks-platform-impl/intellij.platform.tasks.impl.iml +++ b/platform/tasks-platform-impl/intellij.platform.tasks.impl.iml @@ -19,5 +19,6 @@ + \ No newline at end of file diff --git a/platform/tasks-platform-impl/src/com/intellij/tasks/impl/TaskManagerDecorator.java b/platform/tasks-platform-impl/src/com/intellij/tasks/impl/TaskManagerDecorator.java index cda916fe28f6..9b010e7d549b 100644 --- a/platform/tasks-platform-impl/src/com/intellij/tasks/impl/TaskManagerDecorator.java +++ b/platform/tasks-platform-impl/src/com/intellij/tasks/impl/TaskManagerDecorator.java @@ -9,7 +9,7 @@ import com.intellij.tasks.TaskManager; import com.intellij.ui.ColoredTreeCellRenderer; import org.jetbrains.annotations.NotNull; -public class TaskManagerDecorator implements ChangeListDecorator { +public final class TaskManagerDecorator implements ChangeListDecorator { private final Project myProject; public TaskManagerDecorator(@NotNull Project project) { diff --git a/platform/testFramework/extensions/intellij.platform.testExtensions.iml b/platform/testFramework/extensions/intellij.platform.testExtensions.iml index 2f188203f099..65e3ab446d50 100644 --- a/platform/testFramework/extensions/intellij.platform.testExtensions.iml +++ b/platform/testFramework/extensions/intellij.platform.testExtensions.iml @@ -15,6 +15,6 @@ - + \ No newline at end of file diff --git a/platform/testFramework/intellij.platform.testFramework.iml b/platform/testFramework/intellij.platform.testFramework.iml index b08a64cbf468..91040cf5d613 100644 --- a/platform/testFramework/intellij.platform.testFramework.iml +++ b/platform/testFramework/intellij.platform.testFramework.iml @@ -37,5 +37,6 @@ + \ No newline at end of file diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/TestLookupElementPresentation.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/TestLookupElementPresentation.java index bb80fc6b40de..c85662647d79 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/TestLookupElementPresentation.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/TestLookupElementPresentation.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.testFramework.fixtures; import com.intellij.codeInsight.lookup.LookupElement; @@ -15,8 +15,7 @@ import javax.swing.*; /** * @author peter */ -public class TestLookupElementPresentation extends LookupElementPresentation { - +public final class TestLookupElementPresentation extends LookupElementPresentation { @NotNull public static TestLookupElementPresentation renderReal(@NotNull LookupElement e) { TestLookupElementPresentation p = new TestLookupElementPresentation(); @@ -40,5 +39,4 @@ public class TestLookupElementPresentation extends LookupElementPresentation { else return icon; } } - } diff --git a/platform/testGuiFramework/intellij.platform.testGuiFramework.iml b/platform/testGuiFramework/intellij.platform.testGuiFramework.iml index 9319106ac8d4..03b4ce9ccd33 100644 --- a/platform/testGuiFramework/intellij.platform.testGuiFramework.iml +++ b/platform/testGuiFramework/intellij.platform.testGuiFramework.iml @@ -28,5 +28,6 @@ + \ No newline at end of file diff --git a/platform/testRunner/intellij.platform.testRunner.iml b/platform/testRunner/intellij.platform.testRunner.iml index 01475461d1a3..1d0d494ae8ad 100644 --- a/platform/testRunner/intellij.platform.testRunner.iml +++ b/platform/testRunner/intellij.platform.testRunner.iml @@ -15,5 +15,6 @@ + \ No newline at end of file diff --git a/platform/usageView/intellij.platform.usageView.iml b/platform/usageView/intellij.platform.usageView.iml index 3e4011cda79d..30373d6902d7 100644 --- a/platform/usageView/intellij.platform.usageView.iml +++ b/platform/usageView/intellij.platform.usageView.iml @@ -13,5 +13,6 @@ + \ No newline at end of file diff --git a/platform/usageView/src/com/intellij/usages/impl/UsageViewTreeCellRenderer.java b/platform/usageView/src/com/intellij/usages/impl/UsageViewTreeCellRenderer.java index 04e51d8bc8a0..86d39e698fbc 100644 --- a/platform/usageView/src/com/intellij/usages/impl/UsageViewTreeCellRenderer.java +++ b/platform/usageView/src/com/intellij/usages/impl/UsageViewTreeCellRenderer.java @@ -30,7 +30,7 @@ import javax.swing.*; import javax.swing.tree.DefaultMutableTreeNode; import java.awt.*; -class UsageViewTreeCellRenderer extends ColoredTreeCellRenderer { +final class UsageViewTreeCellRenderer extends ColoredTreeCellRenderer { private static final Logger LOG = Logger.getInstance(UsageViewTreeCellRenderer.class); private static final EditorColorsScheme ourColorsScheme = UsageTreeColorsScheme.getInstance().getScheme(); private static final SimpleTextAttributes ourInvalidAttributes = SimpleTextAttributes.fromTextAttributes(ourColorsScheme.getAttributes(UsageTreeColors.INVALID_PREFIX)); diff --git a/platform/util/src/com/intellij/ui/IconManager.java b/platform/util/src/com/intellij/ui/IconManager.java index c31c2077c245..aa7df2a166e9 100644 --- a/platform/util/src/com/intellij/ui/IconManager.java +++ b/platform/util/src/com/intellij/ui/IconManager.java @@ -5,6 +5,7 @@ import com.intellij.openapi.util.Iconable; import com.intellij.ui.icons.RowIcon; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.TestOnly; import javax.swing.*; @@ -54,7 +55,7 @@ public interface IconManager { Icon getAnalyzeIcon(); @NotNull - Icon createDeferredIcon(@NotNull Icon base, T param, @NotNull Function f); + Icon createDeferredIcon(@Nullable Icon base, T param, @NotNull Function f); @NotNull RowIcon createLayeredIcon(@NotNull Iconable instance, Icon icon, int flags); @@ -71,6 +72,10 @@ public interface IconManager { RowIcon createRowIcon(Icon @NotNull ... icons); void registerIconLayer(int flagMask, @NotNull Icon icon); + + @NotNull Icon createOverlayIcon(Icon @NotNull ... icons); + + @NotNull Icon tooltipOnlyIfComposite(@NotNull Icon icon); } final class IconManagerHelper { @@ -123,6 +128,16 @@ final class DummyIconManager implements IconManager { public void registerIconLayer(int flagMask, @NotNull Icon icon) { } + @Override + public @NotNull Icon createOverlayIcon(Icon @NotNull ... icons) { + return new DummyIcon(); + } + + @Override + public @NotNull Icon tooltipOnlyIfComposite(@NotNull Icon icon) { + return new DummyIcon(); + } + @NotNull @Override public Icon createDeferredIcon(@NotNull Icon base, T param, @NotNull Function f) { @@ -150,9 +165,6 @@ final class DummyIconManager implements IconManager { private static class DummyIcon implements Icon { static final DummyIcon INSTANCE = new DummyIcon(); - private DummyIcon() { - } - @Override public void paintIcon(Component c, Graphics g, int x, int y) { } diff --git a/platform/util/src/com/intellij/util/containers/CollectionFactory.java b/platform/util/src/com/intellij/util/containers/CollectionFactory.java index 154e22f1bfe1..b26e63a0ca82 100644 --- a/platform/util/src/com/intellij/util/containers/CollectionFactory.java +++ b/platform/util/src/com/intellij/util/containers/CollectionFactory.java @@ -53,6 +53,10 @@ public final class CollectionFactory { return new ObjectOpenCustomHashSet<>(expectedSize, loadFactor, FastUtilHashingStrategies.getCharSequenceStrategy(caseSensitive)); } + public static @NotNull Set createCharSequenceSet(List items) { + return new ObjectOpenCustomHashSet<>(items, FastUtilHashingStrategies.getCharSequenceStrategy(true)); + } + public static @NotNull Set createCharSequenceSet(boolean caseSensitive, int expectedSize) { return new ObjectOpenCustomHashSet<>(expectedSize, FastUtilHashingStrategies.getCharSequenceStrategy(caseSensitive)); } diff --git a/platform/util/ui/src/com/intellij/util/ui/EDT.java b/platform/util/src/com/intellij/util/ui/EDT.java similarity index 100% rename from platform/util/ui/src/com/intellij/util/ui/EDT.java rename to platform/util/src/com/intellij/util/ui/EDT.java diff --git a/platform/util/ui/src/com/intellij/util/ui/EdtInvocationManager.java b/platform/util/src/com/intellij/util/ui/EdtInvocationManager.java similarity index 53% rename from platform/util/ui/src/com/intellij/util/ui/EdtInvocationManager.java rename to platform/util/src/com/intellij/util/ui/EdtInvocationManager.java index bd6ed8d713c1..db5d0e7dc982 100644 --- a/platform/util/ui/src/com/intellij/util/ui/EdtInvocationManager.java +++ b/platform/util/src/com/intellij/util/ui/EdtInvocationManager.java @@ -2,12 +2,18 @@ package com.intellij.util.ui; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.util.ExceptionUtil; +import com.intellij.util.ReflectionUtil; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.TestOnly; import java.awt.*; +import java.awt.event.InvocationEvent; import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Objects; import java.util.concurrent.atomic.AtomicReference; /** @@ -22,6 +28,69 @@ import java.util.concurrent.atomic.AtomicReference; public abstract class EdtInvocationManager { private static final AtomicReference ourInstance = new AtomicReference<>(); + private static final Method dispatchEventMethod = + Objects.requireNonNull(ReflectionUtil.getDeclaredMethod(EventQueue.class, "dispatchEvent", AWTEvent.class)); + + /** + * Dispatch all pending invocation events (if any) in the {@link com.intellij.ide.IdeEventQueue}, ignores and removes all other events from the queue. + * In tests, consider using {@link com.intellij.testFramework.PlatformTestUtil#dispatchAllInvocationEventsInIdeEventQueue()} + * @see UIUtil#pump() + */ + @TestOnly + public static void dispatchAllInvocationEvents() { + assert getInstance().isEventDispatchThread() : Thread.currentThread() + "; EDT: " + getEventQueueThread(); + EventQueue eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue(); + for (int i = 1; ; i++) { + AWTEvent event = eventQueue.peekEvent(); + if (event == null) break; + try { + event = eventQueue.getNextEvent(); + if (event instanceof InvocationEvent) { + dispatchEventMethod.invoke(eventQueue, event); + } + } + catch (InvocationTargetException e) { + ExceptionUtil.rethrowAllAsUnchecked(e.getCause()); + } + catch (Exception e) { + ExceptionUtil.rethrow(e); + } + + if (i % 10000 == 0) { + //noinspection UseOfSystemOutOrSystemErr + System.out.println("Suspiciously many (" + i + ") AWT events, last dispatched " + event); + } + } + } + + private static @NotNull Thread getEventQueueThread() { + EventQueue eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue(); + try { + Method method = ReflectionUtil.getDeclaredMethod(EventQueue.class, "getDispatchThread"); + //noinspection ConstantConditions + return (Thread)method.invoke(eventQueue); + } + catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * Please use Application.invokeLater() with a modality state (or GuiUtils, or TransactionGuard methods), unless you work with Swings internals + * and 'runnable' deals with Swings components only and doesn't access any PSI, VirtualFiles, project/module model or other project settings. For those, use GuiUtils, application.invoke* or TransactionGuard methods.

+ * + * On AWT thread, invoked runnable immediately, otherwise do {@link SwingUtilities#invokeLater(Runnable)} on it. + */ + public static void invokeLaterIfNeeded(@NotNull Runnable runnable) { + EdtInvocationManager edtInvocationManager = getInstance(); + if (edtInvocationManager.isEventDispatchThread()) { + runnable.run(); + } + else { + edtInvocationManager.invokeLater(runnable); + } + } + public abstract boolean isEventDispatchThread(); public abstract void invokeLater(@NotNull Runnable task); @@ -59,13 +128,14 @@ public abstract class EdtInvocationManager { * is event queue thread. * DO NOT INVOKE THIS METHOD FROM UNDER READ ACTION. */ - public void invokeAndWaitIfNeeded(@NotNull Runnable runnable) { - if (isEventDispatchThread()) { + public static void invokeAndWaitIfNeeded(@NotNull Runnable runnable) { + EdtInvocationManager manager = getInstance(); + if (manager.isEventDispatchThread()) { runnable.run(); } else { try { - invokeAndWait(runnable); + manager.invokeAndWait(runnable); } catch (Exception e) { Logger.getInstance(EdtInvocationManager.class).error(e); diff --git a/platform/util/strings/src/com/intellij/util/text/StringSearcher.java b/platform/util/strings/src/com/intellij/util/text/StringSearcher.java index d775e0832465..b68f3ab7f684 100644 --- a/platform/util/strings/src/com/intellij/util/text/StringSearcher.java +++ b/platform/util/strings/src/com/intellij/util/text/StringSearcher.java @@ -3,11 +3,11 @@ package com.intellij.util.text; import com.intellij.openapi.util.text.Strings; import gnu.trove.TIntArrayList; -import gnu.trove.TIntProcedure; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Arrays; +import java.util.function.IntPredicate; public class StringSearcher { private final String myPattern; @@ -95,14 +95,17 @@ public class StringSearcher { } - public boolean processOccurrences(@NotNull CharSequence text, @NotNull TIntProcedure consumer) { + public boolean processOccurrences(@NotNull CharSequence text, @NotNull IntPredicate consumer) { int end = text.length(); - for (int index = 0; index < end; index++) { //noinspection AssignmentToForLoopParameter index = scan(text, index, end); - if (index < 0) break; - if (!consumer.execute(index)) return false; + if (index < 0) { + break; + } + if (!consumer.test(index)) { + return false; + } } return true; } diff --git a/platform/util/ui/src/com/intellij/ui/mac/foundation/MacUtil.java b/platform/util/ui/src/com/intellij/ui/mac/foundation/MacUtil.java index af7f1d32b595..791e9bd0c40a 100644 --- a/platform/util/ui/src/com/intellij/ui/mac/foundation/MacUtil.java +++ b/platform/util/ui/src/com/intellij/ui/mac/foundation/MacUtil.java @@ -28,7 +28,7 @@ import static com.intellij.ui.mac.foundation.Foundation.*; */ public final class MacUtil { private static final Logger LOG = Logger.getInstance(MacUtil.class); - public static final String MAC_NATIVE_WINDOW_SHOWING = "MAC_NATIVE_WINDOW_SHOWING"; + private static final String MAC_NATIVE_WINDOW_SHOWING = "MAC_NATIVE_WINDOW_SHOWING"; private MacUtil() { } @@ -50,7 +50,7 @@ public final class MacUtil { if (ID.NIL.equals(window)) break; final ID windowTitle = invoke(window, "title"); - if (windowTitle != null && !ID.NIL.equals(windowTitle)) { + if (!ID.NIL.equals(windowTitle)) { final String titleString = toStringViaUTF8(windowTitle); if (Objects.equals(titleString, title)) { focusedWindow = window; @@ -178,7 +178,7 @@ public final class MacUtil { } @SuppressWarnings("unused") - private static class NSActivityOptions { + private static final class NSActivityOptions { // Used for activities that require the computer to not idle sleep. This is included in NSActivityUserInitiated. private static final long idleSystemSleepDisabled = 1L << 20; @@ -190,14 +190,7 @@ public final class MacUtil { private static final long latencyCritical = 0xFF00000000L; } - public interface Activity { - /** - * Ends activity, allowing macOS to trigger AppNap (idempotent). - */ - void matrixHasYou(); - } - - private static final class ActivityImpl extends AtomicReference implements Activity { + private static final class ActivityImpl extends AtomicReference implements Runnable { private static final ID processInfoCls = getObjcClass("NSProcessInfo"); private static final Pointer processInfoSel = createSelector("processInfo"); private static final Pointer beginActivityWithOptionsReasonSel = createSelector("beginActivityWithOptions:reason:"); @@ -209,8 +202,13 @@ public final class MacUtil { super(begin(reason)); } + /** + * Ends activity, allowing macOS to trigger AppNap (idempotent). + */ @Override - public void matrixHasYou() { end(getAndSet(null)); } + public void run() { + end(getAndSet(null)); + } private static ID getProcessInfo() { return invoke(processInfoCls, processInfoSel); } @@ -223,14 +221,16 @@ public final class MacUtil { } private static void end(@Nullable ID activityToken) { - if (activityToken == null) return; + if (activityToken == null) { + return; + } invoke(getProcessInfo(), endActivitySel, activityToken); invoke(activityToken, releaseSel); } } - public static Activity wakeUpNeo(@NotNull Object reason) { - return SystemInfoRt.isMac && Registry.is("idea.mac.prevent.app.nap") ? new ActivityImpl(reason) : null; + public static @NotNull Runnable wakeUpNeo(@NotNull Object reason) { + return new ActivityImpl(reason); } @NotNull diff --git a/platform/util/ui/src/com/intellij/util/ui/JBCachingScalableIcon.java b/platform/util/ui/src/com/intellij/util/ui/JBCachingScalableIcon.java index ea0556e221cd..91842d9bf0f0 100644 --- a/platform/util/ui/src/com/intellij/util/ui/JBCachingScalableIcon.java +++ b/platform/util/ui/src/com/intellij/util/ui/JBCachingScalableIcon.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.ui; import com.intellij.openapi.util.ScalableIcon; @@ -13,7 +13,7 @@ import static com.intellij.ui.scale.ScaleType.OBJ_SCALE; * @author tav * @author Aleksey Pivovarov */ -public abstract class JBCachingScalableIcon extends JBUI.JBIcon implements CopyableIcon { +public abstract class JBCachingScalableIcon extends JBScalableIcon implements CopyableIcon { private T myScaledIconCache; protected JBCachingScalableIcon() {} diff --git a/platform/util/ui/src/com/intellij/util/ui/UIUtil.java b/platform/util/ui/src/com/intellij/util/ui/UIUtil.java index c5201740fd00..207e2da81b11 100644 --- a/platform/util/ui/src/com/intellij/util/ui/UIUtil.java +++ b/platform/util/ui/src/com/intellij/util/ui/UIUtil.java @@ -66,7 +66,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.lang.ref.WeakReference; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URL; import java.nio.charset.StandardCharsets; @@ -1723,8 +1722,6 @@ public final class UIUtil { g.setComposite(X_RENDER_ACTIVE.getValue() ? AlphaComposite.SrcOver : AlphaComposite.Src); } - private static final Method dispatchEventMethod = - Objects.requireNonNull(ReflectionUtil.getDeclaredMethod(EventQueue.class, "dispatchEvent", AWTEvent.class)); /** * Dispatch all pending invocation events (if any) in the {@link com.intellij.ide.IdeEventQueue}, ignores and removes all other events from the queue. * In tests, consider using {@link com.intellij.testFramework.PlatformTestUtil#dispatchAllInvocationEventsInIdeEventQueue()} @@ -1732,41 +1729,7 @@ public final class UIUtil { */ @TestOnly public static void dispatchAllInvocationEvents() { - assert EdtInvocationManager.getInstance().isEventDispatchThread() : Thread.currentThread() + "; EDT: "+getEventQueueThread(); - EventQueue eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue(); - for (int i = 1; ; i++) { - AWTEvent event = eventQueue.peekEvent(); - if (event == null) break; - try { - event = eventQueue.getNextEvent(); - if (event instanceof InvocationEvent) { - dispatchEventMethod.invoke(eventQueue, event); - } - } - catch (InvocationTargetException e) { - ExceptionUtil.rethrowAllAsUnchecked(e.getCause()); - } - catch (Exception e) { - ExceptionUtil.rethrow(e); - } - - if (i % 10000 == 0) { - //noinspection UseOfSystemOutOrSystemErr - System.out.println("Suspiciously many (" + i + ") AWT events, last dispatched " + event); - } - } - } - - private static @NotNull Thread getEventQueueThread() { - EventQueue eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue(); - try { - Method method = ReflectionUtil.getDeclaredMethod(EventQueue.class, "getDispatchThread"); - //noinspection ConstantConditions - return (Thread)method.invoke(eventQueue); - } - catch (Exception e) { - throw new RuntimeException(e); - } + EdtInvocationManager.dispatchAllInvocationEvents(); } public static void addAwtListener(final @NotNull AWTEventListener listener, long mask, @NotNull Disposable parent) { diff --git a/platform/vcs-api/intellij.platform.vcs.iml b/platform/vcs-api/intellij.platform.vcs.iml index 87f52d976086..33733bcd3f94 100644 --- a/platform/vcs-api/intellij.platform.vcs.iml +++ b/platform/vcs-api/intellij.platform.vcs.iml @@ -19,5 +19,6 @@ + \ No newline at end of file diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/changes/ChangeListChange.kt b/platform/vcs-api/src/com/intellij/openapi/vcs/changes/ChangeListChange.kt index beea397e8f1c..5eaf0fe1927a 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/changes/ChangeListChange.kt +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/changes/ChangeListChange.kt @@ -2,9 +2,8 @@ package com.intellij.openapi.vcs.changes import com.intellij.openapi.util.NlsSafe -import gnu.trove.TObjectHashingStrategy +import it.unimi.dsi.fastutil.Hash import org.jetbrains.annotations.NonNls -import java.util.* class ChangeListChange( val change: Change, @@ -14,13 +13,15 @@ class ChangeListChange( companion object { @JvmField - val HASHING_STRATEGY: TObjectHashingStrategy = object : TObjectHashingStrategy { - override fun computeHashCode(o: Any): Int = Objects.hashCode(o) + val HASHING_STRATEGY: Hash.Strategy = object : Hash.Strategy { + override fun hashCode(o: Any?): Int = o?.hashCode() ?: 0 - override fun equals(o1: Any, o2: Any): Boolean = when { - o1 is ChangeListChange && o2 is ChangeListChange -> o1 == o2 && o1.changeListId == o2.changeListId - o1 is ChangeListChange || o2 is ChangeListChange -> false - else -> o1 == o2 + override fun equals(o1: Any?, o2: Any?): Boolean { + return when { + o1 is ChangeListChange && o2 is ChangeListChange -> o1 == o2 && o1.changeListId == o2.changeListId + o1 is ChangeListChange || o2 is ChangeListChange -> false + else -> o1 == o2 + } } } } diff --git a/platform/vcs-impl/intellij.platform.vcs.impl.iml b/platform/vcs-impl/intellij.platform.vcs.impl.iml index 9d32fc50380c..79b14acfec64 100644 --- a/platform/vcs-impl/intellij.platform.vcs.impl.iml +++ b/platform/vcs-impl/intellij.platform.vcs.impl.iml @@ -30,5 +30,6 @@ + \ No newline at end of file diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesListView.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesListView.java index e0182e4e1880..e40f623d53ad 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesListView.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesListView.java @@ -18,7 +18,7 @@ import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.UtilKt; import com.intellij.util.ui.tree.TreeUtil; import com.intellij.vcsUtil.VcsUtil; -import gnu.trove.THashSet; +import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -474,7 +474,7 @@ public class ChangesListView extends ChangesTree implements DataProvider, DnDAwa } private static class DistinctChangePredicate implements Predicate { - private final Set seen = new THashSet<>(ChangeListChange.HASHING_STRATEGY); + private final Set seen = new ObjectOpenCustomHashSet<>(ChangeListChange.HASHING_STRATEGY); @Override public boolean test(Change change) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/DefaultInclusionModel.kt b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/DefaultInclusionModel.kt index 20f02f0246fe..dcd1ba537e90 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/DefaultInclusionModel.kt +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/DefaultInclusionModel.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.openapi.vcs.changes.ui import com.intellij.openapi.vcs.changes.InclusionListener import com.intellij.openapi.vcs.changes.InclusionModel import com.intellij.util.EventDispatcher -import com.intellij.util.containers.ContainerUtil.canonicalStrategy import com.intellij.util.ui.ThreeStateCheckBox -import gnu.trove.THashSet -import gnu.trove.TObjectHashingStrategy -import java.util.Collections.unmodifiableSet +import it.unimi.dsi.fastutil.Hash +import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet +import java.util.* +import kotlin.collections.HashSet abstract class BaseInclusionModel : InclusionModel { private val inclusionEventDispatcher = EventDispatcher.create(InclusionListener::class.java) @@ -35,17 +35,16 @@ object NullInclusionModel : InclusionModel { } class DefaultInclusionModel( - private val inclusionHashingStrategy: TObjectHashingStrategy = canonicalStrategy() + private val inclusionHashingStrategy: Hash.Strategy? = null ) : BaseInclusionModel() { + private val inclusion: MutableSet = if (inclusionHashingStrategy == null) HashSet() else ObjectOpenCustomHashSet(inclusionHashingStrategy) - private val inclusion = THashSet(inclusionHashingStrategy) - - override fun getInclusion(): Set = unmodifiableSet(THashSet(inclusion, inclusionHashingStrategy)) + override fun getInclusion(): Set = Collections.unmodifiableSet((if (inclusionHashingStrategy == null) HashSet(inclusion) else ObjectOpenCustomHashSet(inclusion, inclusionHashingStrategy))) override fun getInclusionState(item: Any): ThreeStateCheckBox.State = if (item in inclusion) ThreeStateCheckBox.State.SELECTED else ThreeStateCheckBox.State.NOT_SELECTED - override fun isInclusionEmpty(): Boolean = inclusion.isEmpty + override fun isInclusionEmpty(): Boolean = inclusion.isEmpty() override fun addInclusion(items: Collection) { if (inclusion.addAll(items)) fireInclusionChanged() diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/PartiallyExcludedFilesStateHolder.kt b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/PartiallyExcludedFilesStateHolder.kt index 5ab5a8019274..ce3b047b8b59 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/PartiallyExcludedFilesStateHolder.kt +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/PartiallyExcludedFilesStateHolder.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.openapi.vcs.changes.ui import com.intellij.openapi.Disposable @@ -8,18 +8,16 @@ import com.intellij.openapi.vcs.ex.LineStatusTracker import com.intellij.openapi.vcs.ex.PartialLocalLineStatusTracker import com.intellij.openapi.vcs.impl.LineStatusTrackerManager import com.intellij.util.concurrency.annotations.RequiresEdt -import com.intellij.util.containers.ContainerUtil.canonicalStrategy import com.intellij.util.ui.update.MergingUpdateQueue import com.intellij.util.ui.update.Update -import gnu.trove.THashMap -import gnu.trove.THashSet -import gnu.trove.TObjectHashingStrategy +import it.unimi.dsi.fastutil.Hash +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap +import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet abstract class PartiallyExcludedFilesStateHolder( project: Project, - private val hashingStrategy: TObjectHashingStrategy = canonicalStrategy() + private val hashingStrategy: Hash.Strategy? = null ) : Disposable { - private fun PartialLocalLineStatusTracker.setExcludedFromCommit(element: T, isExcluded: Boolean) = getChangeListId(element)?.let { setExcludedFromCommit(it, isExcluded) } @@ -29,8 +27,8 @@ abstract class PartiallyExcludedFilesStateHolder( protected val myUpdateQueue = MergingUpdateQueue(PartiallyExcludedFilesStateHolder::class.java.name, 300, true, MergingUpdateQueue.ANY_COMPONENT, this) - private val myIncludedElements = THashSet(hashingStrategy) - private val myTrackerExclusionStates = THashMap(hashingStrategy) + private val myIncludedElements: MutableSet = if (hashingStrategy == null) HashSet() else ObjectOpenCustomHashSet(hashingStrategy) + private val myTrackerExclusionStates: MutableMap = if (hashingStrategy == null) HashMap() else Object2ObjectOpenCustomHashMap(hashingStrategy) init { MyTrackerManagerListener().install(project) @@ -107,7 +105,7 @@ abstract class PartiallyExcludedFilesStateHolder( } fun getIncludedSet(): Set { - val set = THashSet(myIncludedElements, hashingStrategy) + val set: MutableSet = if (hashingStrategy == null) HashSet(myIncludedElements) else ObjectOpenCustomHashSet(myIncludedElements, hashingStrategy) myTrackerExclusionStates.forEach { (element, state) -> if (state == ExclusionState.ALL_EXCLUDED) set -= element else set += element } @@ -115,7 +113,7 @@ abstract class PartiallyExcludedFilesStateHolder( } fun setIncludedElements(elements: Collection) { - val set = THashSet(elements, hashingStrategy) + val set: MutableSet = if (hashingStrategy == null) HashSet(elements) else ObjectOpenCustomHashSet(elements, hashingStrategy) trackers.forEach { (element, tracker) -> tracker.setExcludedFromCommit(element, element !in set) } diff --git a/platform/vcs-impl/src/com/intellij/vcs/commit/ChangesViewCommitWorkflowHandler.kt b/platform/vcs-impl/src/com/intellij/vcs/commit/ChangesViewCommitWorkflowHandler.kt index 3a5b9c4cebb6..8ca9783f8e0d 100644 --- a/platform/vcs-impl/src/com/intellij/vcs/commit/ChangesViewCommitWorkflowHandler.kt +++ b/platform/vcs-impl/src/com/intellij/vcs/commit/ChangesViewCommitWorkflowHandler.kt @@ -19,11 +19,11 @@ import com.intellij.openapi.vcs.checkin.CheckinHandlerFactory import com.intellij.openapi.vcs.checkin.VcsCheckinHandlerFactory import com.intellij.util.EventDispatcher import com.intellij.vcs.commit.AbstractCommitWorkflow.Companion.getCommitExecutors -import gnu.trove.THashSet +import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet import java.util.* import kotlin.properties.Delegates.observable -private fun Collection.toPartialAwareSet() = THashSet(this, ChangeListChange.HASHING_STRATEGY) +private fun Collection.toPartialAwareSet() = ObjectOpenCustomHashSet(this, ChangeListChange.HASHING_STRATEGY) internal class ChangesViewCommitWorkflowHandler( override val workflow: ChangesViewCommitWorkflow, @@ -146,7 +146,7 @@ internal class ChangesViewCommitWorkflowHandler( fun synchronizeInclusion(changeLists: List, unversionedFiles: List) { if (!inclusionModel.isInclusionEmpty()) { - val possibleInclusion = changeLists.flatMapTo(THashSet(ChangeListChange.HASHING_STRATEGY)) { it.changes } + val possibleInclusion = changeLists.flatMapTo(ObjectOpenCustomHashSet(ChangeListChange.HASHING_STRATEGY)) { it.changes } possibleInclusion.addAll(unversionedFiles) inclusionModel.retainInclusion(possibleInclusion) diff --git a/platform/vcs-impl/src/com/intellij/vcs/commit/PartialCommitInclusionModel.kt b/platform/vcs-impl/src/com/intellij/vcs/commit/PartialCommitInclusionModel.kt index 4b53848f1e69..bf82867edeab 100644 --- a/platform/vcs-impl/src/com/intellij/vcs/commit/PartialCommitInclusionModel.kt +++ b/platform/vcs-impl/src/com/intellij/vcs/commit/PartialCommitInclusionModel.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.vcs.commit import com.intellij.openapi.Disposable @@ -16,7 +16,6 @@ import com.intellij.openapi.vcs.impl.PartialChangesUtil.getPartialTracker import com.intellij.util.ui.ThreeStateCheckBox class PartialCommitInclusionModel(private val project: Project) : BaseInclusionModel(), Disposable { - var changeLists: Collection = emptyList() set(value) { field = value diff --git a/platform/vcs-log/api/intellij.platform.vcs.log.iml b/platform/vcs-log/api/intellij.platform.vcs.log.iml index 2e82a9807e57..6e32213dc97f 100644 --- a/platform/vcs-log/api/intellij.platform.vcs.log.iml +++ b/platform/vcs-log/api/intellij.platform.vcs.log.iml @@ -15,5 +15,6 @@ + \ No newline at end of file diff --git a/platform/vcs-log/impl/intellij.platform.vcs.log.impl.iml b/platform/vcs-log/impl/intellij.platform.vcs.log.impl.iml index 22dfefa3dfc5..fd58cadc2c27 100644 --- a/platform/vcs-log/impl/intellij.platform.vcs.log.impl.iml +++ b/platform/vcs-log/impl/intellij.platform.vcs.log.impl.iml @@ -32,5 +32,6 @@ + \ No newline at end of file diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistory.kt b/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistory.kt index 6cf71b06dc9c..13f6a4103b21 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistory.kt +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistory.kt @@ -7,18 +7,15 @@ import com.intellij.openapi.util.UnorderedPair import com.intellij.openapi.util.registry.Registry import com.intellij.openapi.vcs.FilePath import com.intellij.util.containers.MultiMap -import com.intellij.util.containers.Stack import com.intellij.vcs.log.data.index.VcsLogPathsIndex.ChangeKind import com.intellij.vcs.log.graph.api.LinearGraph import com.intellij.vcs.log.graph.api.LiteLinearGraph -import com.intellij.vcs.log.graph.api.permanent.PermanentCommitsInfo import com.intellij.vcs.log.graph.api.permanent.PermanentGraphInfo import com.intellij.vcs.log.graph.collapsing.CollapsedGraph import com.intellij.vcs.log.graph.impl.facade.* -import com.intellij.vcs.log.graph.utils.* -import com.intellij.vcs.log.graph.utils.impl.BitSetFlags +import com.intellij.vcs.log.graph.utils.LinearGraphUtils +import com.intellij.vcs.log.graph.utils.isAncestor import com.intellij.vcsUtil.VcsFileUtil -import gnu.trove.THashSet import gnu.trove.TIntHashSet import gnu.trove.TIntObjectHashMap import it.unimi.dsi.fastutil.Hash @@ -26,7 +23,6 @@ import it.unimi.dsi.fastutil.ints.IntOpenHashSet import it.unimi.dsi.fastutil.ints.IntSet import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet -import java.util.* import java.util.function.BiConsumer class FileHistory internal constructor(val commitsToPathsMap: Map, diff --git a/platform/vcs-tests/intellij.platform.vcs.testFramework.iml b/platform/vcs-tests/intellij.platform.vcs.testFramework.iml index 83a97d823203..61e26666b060 100644 --- a/platform/vcs-tests/intellij.platform.vcs.testFramework.iml +++ b/platform/vcs-tests/intellij.platform.vcs.testFramework.iml @@ -10,5 +10,6 @@ + \ No newline at end of file diff --git a/platform/vcs-tests/intellij.platform.vcs.tests.iml b/platform/vcs-tests/intellij.platform.vcs.tests.iml index 7394ea0b329e..e85811dd4eaa 100644 --- a/platform/vcs-tests/intellij.platform.vcs.tests.iml +++ b/platform/vcs-tests/intellij.platform.vcs.tests.iml @@ -19,7 +19,8 @@ - + + \ No newline at end of file diff --git a/platform/vcs-tests/testSrc/com/intellij/openapi/vcs/BasePartiallyExcludedChangesTest.kt b/platform/vcs-tests/testSrc/com/intellij/openapi/vcs/BasePartiallyExcludedChangesTest.kt index 4e991769b9be..b13adb195aac 100644 --- a/platform/vcs-tests/testSrc/com/intellij/openapi/vcs/BasePartiallyExcludedChangesTest.kt +++ b/platform/vcs-tests/testSrc/com/intellij/openapi/vcs/BasePartiallyExcludedChangesTest.kt @@ -8,7 +8,7 @@ import com.intellij.openapi.vcs.ex.PartialLocalLineStatusTracker import com.intellij.openapi.vcs.impl.PartialChangesUtil abstract class BasePartiallyExcludedChangesTest : BaseLineStatusTrackerManagerTest() { - protected lateinit var stateHolder: MyStateHolder + private lateinit var stateHolder: MyStateHolder override fun setUp() { super.setUp() @@ -87,10 +87,7 @@ abstract class BasePartiallyExcludedChangesTest : BaseLineStatusTrackerManagerTe val actual = stateHolder.getExclusionState(this.toFilePath) assertEquals(holderState, actual) - val tracker = this.toFilePath.virtualFile?.tracker as? PartialLocalLineStatusTracker - if (tracker != null) { - tracker.assertExcludedState(trackerState, DEFAULT) - } + (toFilePath.virtualFile?.tracker as? PartialLocalLineStatusTracker)?.assertExcludedState(trackerState, DEFAULT) } protected fun PartialLocalLineStatusTracker.exclude(index: Int, isExcluded: Boolean) { diff --git a/platform/workspaceModel/ide/tests/intellij.platform.workspaceModel.ide.tests.iml b/platform/workspaceModel/ide/tests/intellij.platform.workspaceModel.ide.tests.iml index d424b0537957..0cedb961536e 100644 --- a/platform/workspaceModel/ide/tests/intellij.platform.workspaceModel.ide.tests.iml +++ b/platform/workspaceModel/ide/tests/intellij.platform.workspaceModel.ide.tests.iml @@ -16,6 +16,7 @@ + \ No newline at end of file diff --git a/platform/xdebugger-api/intellij.platform.debugger.iml b/platform/xdebugger-api/intellij.platform.debugger.iml index 7982c95a4ad6..52bd676a7de7 100644 --- a/platform/xdebugger-api/intellij.platform.debugger.iml +++ b/platform/xdebugger-api/intellij.platform.debugger.iml @@ -10,5 +10,7 @@ + + \ No newline at end of file diff --git a/platform/xdebugger-impl/intellij.platform.debugger.impl.iml b/platform/xdebugger-impl/intellij.platform.debugger.impl.iml index ac20162613c5..0bd19b9cae6b 100644 --- a/platform/xdebugger-impl/intellij.platform.debugger.impl.iml +++ b/platform/xdebugger-impl/intellij.platform.debugger.impl.iml @@ -20,5 +20,6 @@ + \ No newline at end of file diff --git a/platform/xdebugger-testFramework/intellij.platform.debugger.testFramework.iml b/platform/xdebugger-testFramework/intellij.platform.debugger.testFramework.iml index a9df01fa55bb..a151df035ec7 100644 --- a/platform/xdebugger-testFramework/intellij.platform.debugger.testFramework.iml +++ b/platform/xdebugger-testFramework/intellij.platform.debugger.testFramework.iml @@ -13,5 +13,6 @@ + \ No newline at end of file diff --git a/plugins/ByteCodeViewer/intellij.java.byteCodeViewer.iml b/plugins/ByteCodeViewer/intellij.java.byteCodeViewer.iml index 9b355e61e987..ee5fcf71ce04 100644 --- a/plugins/ByteCodeViewer/intellij.java.byteCodeViewer.iml +++ b/plugins/ByteCodeViewer/intellij.java.byteCodeViewer.iml @@ -19,5 +19,6 @@ + \ No newline at end of file diff --git a/plugins/IntelliLang/intellij.java.langInjection.iml b/plugins/IntelliLang/intellij.java.langInjection.iml index f3a19901ce43..bca6f765fb9d 100644 --- a/plugins/IntelliLang/intellij.java.langInjection.iml +++ b/plugins/IntelliLang/intellij.java.langInjection.iml @@ -18,6 +18,7 @@ + diff --git a/plugins/IntelliLang/intellij.platform.langInjection.iml b/plugins/IntelliLang/intellij.platform.langInjection.iml index 6692f1a436d8..035265f82385 100644 --- a/plugins/IntelliLang/intellij.platform.langInjection.iml +++ b/plugins/IntelliLang/intellij.platform.langInjection.iml @@ -15,6 +15,7 @@ + diff --git a/plugins/IntelliLang/intellij.xml.langInjection.iml b/plugins/IntelliLang/intellij.xml.langInjection.iml index b098ffdb74df..97c10463230f 100644 --- a/plugins/IntelliLang/intellij.xml.langInjection.iml +++ b/plugins/IntelliLang/intellij.xml.langInjection.iml @@ -16,6 +16,7 @@ + diff --git a/plugins/ant/intellij.ant.iml b/plugins/ant/intellij.ant.iml index 3b2220d16a03..2b3dc72c3808 100644 --- a/plugins/ant/intellij.ant.iml +++ b/plugins/ant/intellij.ant.iml @@ -35,6 +35,7 @@ + diff --git a/plugins/changeReminder/intellij.vcs.changeReminder.iml b/plugins/changeReminder/intellij.vcs.changeReminder.iml index 0f92ef10eb85..acfff6be2fc9 100644 --- a/plugins/changeReminder/intellij.vcs.changeReminder.iml +++ b/plugins/changeReminder/intellij.vcs.changeReminder.iml @@ -29,5 +29,6 @@ + \ No newline at end of file diff --git a/plugins/commander/intellij.commander.iml b/plugins/commander/intellij.commander.iml index db2d04cc8f75..74da75f543d5 100644 --- a/plugins/commander/intellij.commander.iml +++ b/plugins/commander/intellij.commander.iml @@ -13,6 +13,7 @@ + diff --git a/plugins/completion-ml-ranking/intellij.completionMlRanking.iml b/plugins/completion-ml-ranking/intellij.completionMlRanking.iml index ac66d1516457..1097ebcf1d7e 100644 --- a/plugins/completion-ml-ranking/intellij.completionMlRanking.iml +++ b/plugins/completion-ml-ranking/intellij.completionMlRanking.iml @@ -26,5 +26,6 @@ + \ No newline at end of file diff --git a/plugins/completion-ml-ranking/intellij.completionMlRanking.tests.iml b/plugins/completion-ml-ranking/intellij.completionMlRanking.tests.iml index a5d117220133..a9597358723d 100644 --- a/plugins/completion-ml-ranking/intellij.completionMlRanking.tests.iml +++ b/plugins/completion-ml-ranking/intellij.completionMlRanking.tests.iml @@ -23,5 +23,6 @@ + \ No newline at end of file diff --git a/plugins/copyright/intellij.copyright.iml b/plugins/copyright/intellij.copyright.iml index 882c19f391b5..9a981c92248f 100644 --- a/plugins/copyright/intellij.copyright.iml +++ b/plugins/copyright/intellij.copyright.iml @@ -21,5 +21,6 @@ + \ No newline at end of file diff --git a/plugins/coverage-common/intellij.platform.coverage.iml b/plugins/coverage-common/intellij.platform.coverage.iml index 5a67b8638c5b..22f7666bd7b9 100644 --- a/plugins/coverage-common/intellij.platform.coverage.iml +++ b/plugins/coverage-common/intellij.platform.coverage.iml @@ -21,5 +21,6 @@ + \ No newline at end of file diff --git a/plugins/coverage-common/src/com/intellij/coverage/AbstractCoverageProjectViewNodeDecorator.java b/plugins/coverage-common/src/com/intellij/coverage/AbstractCoverageProjectViewNodeDecorator.java index 680359a26dcc..bd3a9d279a77 100644 --- a/plugins/coverage-common/src/com/intellij/coverage/AbstractCoverageProjectViewNodeDecorator.java +++ b/plugins/coverage-common/src/com/intellij/coverage/AbstractCoverageProjectViewNodeDecorator.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.coverage; import com.intellij.ide.projectView.ProjectViewNodeDecorator; @@ -9,9 +9,6 @@ import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -/** - * @author Roman.Chernyatchik - */ public abstract class AbstractCoverageProjectViewNodeDecorator implements ProjectViewNodeDecorator { private Project myProject; diff --git a/plugins/coverage/intellij.java.coverage.iml b/plugins/coverage/intellij.java.coverage.iml index b5c54b83040e..b8d8716337ea 100644 --- a/plugins/coverage/intellij.java.coverage.iml +++ b/plugins/coverage/intellij.java.coverage.iml @@ -36,5 +36,6 @@ + \ No newline at end of file diff --git a/plugins/coverage/src/com/intellij/execution/configurations/coverage/CoverageClassFilterEditor.java b/plugins/coverage/src/com/intellij/execution/configurations/coverage/CoverageClassFilterEditor.java index c8b1f1635e32..bf96807656af 100644 --- a/plugins/coverage/src/com/intellij/execution/configurations/coverage/CoverageClassFilterEditor.java +++ b/plugins/coverage/src/com/intellij/execution/configurations/coverage/CoverageClassFilterEditor.java @@ -1,6 +1,7 @@ // 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.configurations.coverage; +import com.intellij.icons.AllIcons; import com.intellij.ide.util.ClassFilter; import com.intellij.ide.util.PackageChooserDialog; import com.intellij.java.coverage.JavaCoverageBundle; @@ -10,7 +11,6 @@ import com.intellij.openapi.wm.IdeFocusManager; import com.intellij.psi.PsiClass; import com.intellij.psi.PsiPackage; import com.intellij.ui.classFilter.ClassFilterEditor; -import com.intellij.util.IconUtil; import javax.swing.*; import java.util.List; @@ -54,6 +54,6 @@ class CoverageClassFilterEditor extends ClassFilterEditor { @Override protected Icon getAddPatternButtonIcon() { - return IconUtil.getAddPackageIcon(); + return AllIcons.ToolbarDecorator.AddFolder; } } diff --git a/plugins/devkit/devkit-core/intellij.devkit.iml b/plugins/devkit/devkit-core/intellij.devkit.iml index d7aad67a69d2..460a8f8d8cb0 100644 --- a/plugins/devkit/devkit-core/intellij.devkit.iml +++ b/plugins/devkit/devkit-core/intellij.devkit.iml @@ -57,5 +57,6 @@ + \ No newline at end of file diff --git a/plugins/devkit/devkit-java-tests/intellij.devkit.java.tests.iml b/plugins/devkit/devkit-java-tests/intellij.devkit.java.tests.iml index c1a7b58a7384..8398e7696e53 100644 --- a/plugins/devkit/devkit-java-tests/intellij.devkit.java.tests.iml +++ b/plugins/devkit/devkit-java-tests/intellij.devkit.java.tests.iml @@ -15,5 +15,6 @@ + \ No newline at end of file diff --git a/plugins/eclipse/intellij.eclipse.iml b/plugins/eclipse/intellij.eclipse.iml index 1155de00e8e2..c4d2b8184f08 100644 --- a/plugins/eclipse/intellij.eclipse.iml +++ b/plugins/eclipse/intellij.eclipse.iml @@ -22,6 +22,6 @@ - + \ No newline at end of file diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/CachedXmlDocumentSet.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/CachedXmlDocumentSet.java index 9d85720373cc..e734d1153281 100644 --- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/CachedXmlDocumentSet.java +++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/CachedXmlDocumentSet.java @@ -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. package org.jetbrains.idea.eclipse.config; import com.intellij.openapi.util.JDOMUtil; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; -import gnu.trove.THashMap; import org.jdom.Element; import org.jdom.JDOMException; import org.jetbrains.annotations.NotNull; @@ -28,11 +13,12 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; -public class CachedXmlDocumentSet { - private final Map nameToDir = new THashMap<>(); +public final class CachedXmlDocumentSet { + private final Map nameToDir = new HashMap<>(); @Nullable public Element load(@NotNull String name, boolean refresh) throws IOException, JDOMException { diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/ClasspathSaveSession.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/ClasspathSaveSession.java index f88b0703adba..5f0cdf1dbbe9 100644 --- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/ClasspathSaveSession.java +++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/ClasspathSaveSession.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 org.jetbrains.idea.eclipse.config; import com.intellij.configurationStore.SaveSession; @@ -13,8 +13,6 @@ import com.intellij.openapi.util.JDOMUtil; import com.intellij.openapi.vfs.SafeWriteRequestor; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.ThrowableRunnable; -import gnu.trove.THashMap; -import gnu.trove.THashSet; import org.jdom.Element; import org.jdom.output.EclipseJDOMUtil; import org.jetbrains.annotations.NotNull; @@ -30,12 +28,14 @@ import java.io.OutputStreamWriter; import java.io.Writer; import java.nio.charset.StandardCharsets; import java.nio.file.Paths; +import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.Set; final class ClasspathSaveSession implements SaveSessionProducer, SaveSession, SafeWriteRequestor { - private final Map modifiedContent = new THashMap<>(); - private final Set deletedContent = new THashSet<>(); + private final Map modifiedContent = new HashMap<>(); + private final Set deletedContent = new HashSet<>(); private final Module module; diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EclipseClasspathReader.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EclipseClasspathReader.java index 8be095fb6d59..4d4df43d70a3 100644 --- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EclipseClasspathReader.java +++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EclipseClasspathReader.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 org.jetbrains.idea.eclipse.conversion; @@ -17,7 +17,6 @@ import com.intellij.openapi.vfs.JarFileSystem; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileManager; import com.intellij.util.ArrayUtil; -import gnu.trove.THashSet; import org.jdom.Element; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -29,6 +28,7 @@ import org.jetbrains.idea.eclipse.util.ErrorLog; import java.io.IOException; import java.util.Collection; +import java.util.HashSet; import java.util.List; import java.util.Set; @@ -75,7 +75,7 @@ public class EclipseClasspathReader extends AbstractEclipseClasspathReader sink = new THashSet<>(); + Set sink = new HashSet<>(); readClasspath(model, sink, sink, sink, null, classpathElement); } @@ -92,7 +92,7 @@ public class EclipseClasspathReader extends AbstractEclipseClasspathReader libs = new THashSet<>(); + Set libs = new HashSet<>(); for (Element o : classpathElement.getChildren(EclipseXml.CLASSPATHENTRY_TAG)) { try { readClasspathEntry(model, unknownLibraries, unknownJdks, refsToModules, testPattern, o, idx++, diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EclipseClasspathWriter.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EclipseClasspathWriter.java index d0f8b9ca5389..c6790ff0483f 100644 --- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EclipseClasspathWriter.java +++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/conversion/EclipseClasspathWriter.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 org.jetbrains.idea.eclipse.conversion; @@ -25,7 +11,6 @@ import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.ArrayUtil; -import gnu.trove.THashMap; import org.jdom.Element; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -35,12 +20,13 @@ import org.jetbrains.idea.eclipse.EclipseXml; import org.jetbrains.idea.eclipse.IdeaXml; import org.jetbrains.idea.eclipse.config.EclipseModuleManagerImpl; +import java.util.HashMap; import java.util.Map; public class EclipseClasspathWriter { public static final Logger LOG = Logger.getInstance(EclipseClasspathWriter.class); - private final Map myOldEntries = new THashMap<>(); + private final Map myOldEntries = new HashMap<>(); @NotNull public Element writeClasspath(@Nullable Element oldRoot, @NotNull ModuleRootModel model) { diff --git a/plugins/editorconfig/intellij.editorconfig.iml b/plugins/editorconfig/intellij.editorconfig.iml index 147edcb3b9a5..1cc5a48ab1b4 100644 --- a/plugins/editorconfig/intellij.editorconfig.iml +++ b/plugins/editorconfig/intellij.editorconfig.iml @@ -33,6 +33,6 @@ - + \ No newline at end of file diff --git a/plugins/editorconfig/src/org/editorconfig/language/services/impl/EditorConfigOptionDescriptorStorage.kt b/plugins/editorconfig/src/org/editorconfig/language/services/impl/EditorConfigOptionDescriptorStorage.kt index efdf04a3b198..ad420a05a397 100644 --- a/plugins/editorconfig/src/org/editorconfig/language/services/impl/EditorConfigOptionDescriptorStorage.kt +++ b/plugins/editorconfig/src/org/editorconfig/language/services/impl/EditorConfigOptionDescriptorStorage.kt @@ -1,9 +1,8 @@ -// 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.editorconfig.language.services.impl import com.intellij.psi.PsiElement -import com.intellij.util.text.CaseInsensitiveStringHashingStrategy -import gnu.trove.THashMap +import com.intellij.util.containers.CollectionFactory import org.editorconfig.language.schema.descriptors.impl.EditorConfigOptionDescriptor import org.editorconfig.language.util.EditorConfigDescriptorUtil @@ -14,7 +13,7 @@ class EditorConfigOptionDescriptorStorage(source: Iterable() - val descriptors = THashMap>(CaseInsensitiveStringHashingStrategy()) + val descriptors = CollectionFactory.createCaseInsensitiveStringMap>() val badDescriptors = mutableListOf() for (optionDescriptor in source) { allDescriptors.add(optionDescriptor) diff --git a/plugins/filePrediction/intellij.filePrediction.iml b/plugins/filePrediction/intellij.filePrediction.iml index 110cede29972..a6bd18b360ba 100644 --- a/plugins/filePrediction/intellij.filePrediction.iml +++ b/plugins/filePrediction/intellij.filePrediction.iml @@ -34,5 +34,6 @@ + \ No newline at end of file diff --git a/plugins/git4idea/intellij.vcs.git.iml b/plugins/git4idea/intellij.vcs.git.iml index 38159a278aac..120ade05833d 100644 --- a/plugins/git4idea/intellij.vcs.git.iml +++ b/plugins/git4idea/intellij.vcs.git.iml @@ -51,5 +51,6 @@ + \ No newline at end of file diff --git a/plugins/github/intellij.vcs.github.iml b/plugins/github/intellij.vcs.github.iml index adaef20eea51..d3411c57a162 100644 --- a/plugins/github/intellij.vcs.github.iml +++ b/plugins/github/intellij.vcs.github.iml @@ -43,5 +43,6 @@ + \ No newline at end of file diff --git a/plugins/google-app-engine/intellij.java.googleAppEngine.iml b/plugins/google-app-engine/intellij.java.googleAppEngine.iml index 418f189bdf62..98b94a7c24b4 100644 --- a/plugins/google-app-engine/intellij.java.googleAppEngine.iml +++ b/plugins/google-app-engine/intellij.java.googleAppEngine.iml @@ -29,5 +29,6 @@ + \ No newline at end of file diff --git a/plugins/gradle/intellij.gradle.common.iml b/plugins/gradle/intellij.gradle.common.iml index 68f59ca2f20c..73a3aa5a2d30 100644 --- a/plugins/gradle/intellij.gradle.common.iml +++ b/plugins/gradle/intellij.gradle.common.iml @@ -31,5 +31,6 @@ + \ No newline at end of file diff --git a/plugins/gradle/intellij.gradle.tests.iml b/plugins/gradle/intellij.gradle.tests.iml index f1880067976b..e37ae0c6180f 100644 --- a/plugins/gradle/intellij.gradle.tests.iml +++ b/plugins/gradle/intellij.gradle.tests.iml @@ -26,5 +26,6 @@ + \ No newline at end of file diff --git a/plugins/gradle/java/intellij.gradle.java.iml b/plugins/gradle/java/intellij.gradle.java.iml index 56ec6e33f4cd..4b79237c9a82 100644 --- a/plugins/gradle/java/intellij.gradle.java.iml +++ b/plugins/gradle/java/intellij.gradle.java.iml @@ -37,5 +37,6 @@ + \ No newline at end of file diff --git a/plugins/gradle/java/intellij.gradle.java.tests.iml b/plugins/gradle/java/intellij.gradle.java.tests.iml index fbb03f1d1f47..352d863e2474 100644 --- a/plugins/gradle/java/intellij.gradle.java.tests.iml +++ b/plugins/gradle/java/intellij.gradle.java.tests.iml @@ -25,5 +25,6 @@ + \ No newline at end of file diff --git a/plugins/grazie/intellij.grazie.iml b/plugins/grazie/intellij.grazie.iml index 928f1e10f7ad..027169de1180 100644 --- a/plugins/grazie/intellij.grazie.iml +++ b/plugins/grazie/intellij.grazie.iml @@ -206,7 +206,6 @@ - @@ -247,5 +246,6 @@ + \ No newline at end of file diff --git a/plugins/groovy/groovy-psi/intellij.groovy.psi.iml b/plugins/groovy/groovy-psi/intellij.groovy.psi.iml index 5ec1c63f476a..eb82d3df8228 100644 --- a/plugins/groovy/groovy-psi/intellij.groovy.psi.iml +++ b/plugins/groovy/groovy-psi/intellij.groovy.psi.iml @@ -27,5 +27,6 @@ + \ No newline at end of file diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/transformations/TransformationContextImpl.kt b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/transformations/TransformationContextImpl.kt index 968c4ad81f35..847e6266b88b 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/transformations/TransformationContextImpl.kt +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/transformations/TransformationContextImpl.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 org.jetbrains.plugins.groovy.transformations import com.intellij.openapi.project.Project @@ -9,7 +9,7 @@ import com.intellij.psi.util.MethodSignature import com.intellij.psi.util.MethodSignatureUtil.METHOD_PARAMETERS_ERASURE_EQUALITY import com.intellij.util.containers.FactoryMap import com.intellij.util.containers.toArray -import gnu.trove.THashSet +import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition import org.jetbrains.plugins.groovy.lang.psi.impl.PsiImplUtil.getAnnotation @@ -22,7 +22,6 @@ import org.jetbrains.plugins.groovy.transformations.dsl.MemberBuilder import java.util.* internal class TransformationContextImpl(private val myCodeClass: GrTypeDefinition) : TransformationContext { - private val myProject: Project = myCodeClass.project private val myPsiManager: PsiManager = myCodeClass.manager private val myPsiFacade: JavaPsiFacade = JavaPsiFacade.getInstance(myProject) @@ -46,7 +45,7 @@ internal class TransformationContextImpl(private val myCodeClass: GrTypeDefiniti getReferenceListTypes(myCodeClass.extendsClause).toMutableList() } private val mySignaturesCache: Map> = FactoryMap.create { name -> - val result = THashSet(METHOD_PARAMETERS_ERASURE_EQUALITY) + val result = ObjectOpenCustomHashSet(METHOD_PARAMETERS_ERASURE_EQUALITY) for (existingMethod in myMethods) { if (existingMethod.name == name) { result.add(existingMethod.getSignature(PsiSubstitutor.EMPTY)) @@ -225,6 +224,7 @@ internal class TransformationContextImpl(private val myCodeClass: GrTypeDefiniti extendsTypes.toArray(PsiClassType.EMPTY_ARRAY) ) - private fun enumMethods() : List = - if (myCodeClass is GrEnumTypeDefinitionImpl) myCodeClass.defEnumMethods else emptyList() + private fun enumMethods() : List { + return if (myCodeClass is GrEnumTypeDefinitionImpl) myCodeClass.defEnumMethods else emptyList() + } } diff --git a/plugins/groovy/intellij.groovy.iml b/plugins/groovy/intellij.groovy.iml index 1a4ba6095b35..4b5f9e231fba 100644 --- a/plugins/groovy/intellij.groovy.iml +++ b/plugins/groovy/intellij.groovy.iml @@ -44,5 +44,7 @@ + + \ No newline at end of file diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/extract/closure/ExtractClosureHelperImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/extract/closure/ExtractClosureHelperImpl.java index cdf3eb9a493c..d1cd82c7dd06 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/extract/closure/ExtractClosureHelperImpl.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/extract/closure/ExtractClosureHelperImpl.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 org.jetbrains.plugins.groovy.refactoring.extract.closure; diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceClosureParameterProcessor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceClosureParameterProcessor.java index 05d224a885ea..9d3d3cfbb004 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceClosureParameterProcessor.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceClosureParameterProcessor.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 org.jetbrains.plugins.groovy.refactoring.introduce.parameter; import com.intellij.codeInsight.ChangeContextUtil; diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceExpressionSettingsImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceExpressionSettingsImpl.java index f56eec354891..12e836c98613 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceExpressionSettingsImpl.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceExpressionSettingsImpl.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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 org.jetbrains.plugins.groovy.refactoring.introduce.parameter; import com.intellij.psi.PsiType; diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceParameterProcessor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceParameterProcessor.java index 15a9c851db52..8f8b8e54be9d 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceParameterProcessor.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceParameterProcessor.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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 org.jetbrains.plugins.groovy.refactoring.introduce.parameter; import com.intellij.java.refactoring.JavaRefactoringBundle; diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceParameterSettings.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceParameterSettings.java index d0766d694249..60feaf8aacfe 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceParameterSettings.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceParameterSettings.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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 org.jetbrains.plugins.groovy.refactoring.introduce.parameter; import com.intellij.refactoring.IntroduceParameterRefactoring; diff --git a/plugins/groovy/structuralsearch-groovy/intellij.groovy.structuralSearch.iml b/plugins/groovy/structuralsearch-groovy/intellij.groovy.structuralSearch.iml index 572808c8616d..beb6c10074bd 100644 --- a/plugins/groovy/structuralsearch-groovy/intellij.groovy.structuralSearch.iml +++ b/plugins/groovy/structuralsearch-groovy/intellij.groovy.structuralSearch.iml @@ -16,5 +16,6 @@ + \ No newline at end of file diff --git a/plugins/hg4idea/intellij.vcs.hg.iml b/plugins/hg4idea/intellij.vcs.hg.iml index 5c1bb7ad175c..e8beddc0daf5 100644 --- a/plugins/hg4idea/intellij.vcs.hg.iml +++ b/plugins/hg4idea/intellij.vcs.hg.iml @@ -24,5 +24,6 @@ + \ No newline at end of file diff --git a/plugins/java-decompiler/plugin/intellij.java.decompiler.iml b/plugins/java-decompiler/plugin/intellij.java.decompiler.iml index fcaa39f22470..5e5dbaa0fec4 100644 --- a/plugins/java-decompiler/plugin/intellij.java.decompiler.iml +++ b/plugins/java-decompiler/plugin/intellij.java.decompiler.iml @@ -16,5 +16,6 @@ + \ No newline at end of file diff --git a/plugins/java-i18n/intellij.java.i18n.iml b/plugins/java-i18n/intellij.java.i18n.iml index 601a4cdbbf8f..9b9b3b1e79ec 100644 --- a/plugins/java-i18n/intellij.java.i18n.iml +++ b/plugins/java-i18n/intellij.java.i18n.iml @@ -25,5 +25,6 @@ + \ No newline at end of file diff --git a/plugins/java-i18n/src/com/intellij/codeInspection/capitalization/AnnotateCapitalizationIntention.java b/plugins/java-i18n/src/com/intellij/codeInspection/capitalization/AnnotateCapitalizationIntention.java index 7ac3f5f1546b..0ae3ebe1e511 100644 --- a/plugins/java-i18n/src/com/intellij/codeInspection/capitalization/AnnotateCapitalizationIntention.java +++ b/plugins/java-i18n/src/com/intellij/codeInspection/capitalization/AnnotateCapitalizationIntention.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.codeInspection.capitalization; import com.intellij.codeInsight.AnnotationUtil; @@ -70,15 +56,15 @@ public class AnnotateCapitalizationIntention implements IntentionAction { if (modifierListOwner == null) throw new IncorrectOperationException(); BaseListPopupStep step = - new BaseListPopupStep(null, Nls.Capitalization.Title, Nls.Capitalization.Sentence) { + new BaseListPopupStep<>(null, Nls.Capitalization.Title, Nls.Capitalization.Sentence) { @Override public PopupStep onChosen(final Nls.Capitalization selectedValue, boolean finalChoice) { WriteCommandAction.writeCommandAction(project).run(() -> { String nls = Nls.class.getName(); PsiAnnotation annotation = JavaPsiFacade.getInstance(project).getElementFactory() - .createAnnotationFromText("@" + nls + "(capitalization = " + - nls + ".Capitalization." + selectedValue.toString() + ")", - modifierListOwner); + .createAnnotationFromText("@" + nls + "(capitalization = " + + nls + ".Capitalization." + selectedValue.toString() + ")", + modifierListOwner); new AddAnnotationFix(Nls.class.getName(), modifierListOwner, annotation.getParameterList().getAttributes()).applyFix(); }); return FINAL_CHOICE; diff --git a/plugins/javaFX/intellij.javaFX.iml b/plugins/javaFX/intellij.javaFX.iml index defd04b990a7..d4c763083e6a 100644 --- a/plugins/javaFX/intellij.javaFX.iml +++ b/plugins/javaFX/intellij.javaFX.iml @@ -31,5 +31,6 @@ + \ No newline at end of file diff --git a/plugins/javaFX/javaFX-CE/intellij.javaFX.community.iml b/plugins/javaFX/javaFX-CE/intellij.javaFX.community.iml index 61ada8a8c40d..f5befcecc2f2 100644 --- a/plugins/javaFX/javaFX-CE/intellij.javaFX.community.iml +++ b/plugins/javaFX/javaFX-CE/intellij.javaFX.community.iml @@ -18,5 +18,6 @@ + \ No newline at end of file diff --git a/plugins/junit/intellij.junit.iml b/plugins/junit/intellij.junit.iml index c8aec4981f19..217a0f245619 100644 --- a/plugins/junit/intellij.junit.iml +++ b/plugins/junit/intellij.junit.iml @@ -26,6 +26,7 @@ + diff --git a/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java b/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java index db64d8dc2a97..62fb3caf86df 100644 --- a/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java +++ b/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java @@ -1,4 +1,4 @@ -// Copyright 2000-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.execution.junit2.configuration; @@ -13,6 +13,7 @@ import com.intellij.execution.junit.TestClassFilter; import com.intellij.execution.testframework.SourceScope; import com.intellij.execution.testframework.TestSearchScope; import com.intellij.execution.ui.*; +import com.intellij.icons.AllIcons; import com.intellij.ide.util.ClassFilter; import com.intellij.ide.util.PackageChooserDialog; import com.intellij.openapi.fileChooser.FileChooser; @@ -41,7 +42,6 @@ import com.intellij.ui.*; import com.intellij.ui.components.JBLabel; import com.intellij.ui.components.fields.ExpandableTextField; import com.intellij.util.ArrayUtilRt; -import com.intellij.util.IconUtil; import com.intellij.util.ui.UIUtil; import gnu.trove.TIntArrayList; import org.jetbrains.annotations.NotNull; @@ -154,7 +154,7 @@ public class JUnitConfigurable extends SettingsEdi panel.setLayout(new BorderLayout()); myPatternTextField = new TextFieldWithBrowseButton(new ExpandableTextField(text -> Arrays.asList(text.split("\\|\\|")), strings -> StringUtil.join(strings, "||"))); - myPatternTextField.setButtonIcon(IconUtil.getAddIcon()); + myPatternTextField.setButtonIcon(AllIcons.General.Add); panel.add(myPatternTextField, BorderLayout.CENTER); myTestLocations[JUnitConfigurationModel.PATTERN] = myPattern; @@ -370,7 +370,7 @@ public class JUnitConfigurable extends SettingsEdi myPattern.setVisible(selectedType == JUnitConfigurationModel.PATTERN); myDir.setVisible(selectedType == JUnitConfigurationModel.DIR); myClass.setVisible(selectedType == JUnitConfigurationModel.CLASS || - selectedType == JUnitConfigurationModel.METHOD || + selectedType == JUnitConfigurationModel.METHOD || selectedType == JUnitConfigurationModel.BY_SOURCE_POSITION); myMethod.setVisible(selectedType == JUnitConfigurationModel.PATTERN || selectedType == JUnitConfigurationModel.METHOD || diff --git a/plugins/laf/macos/intellij.laf.macos.iml b/plugins/laf/macos/intellij.laf.macos.iml index 8334807c841f..d186b32c6ef3 100644 --- a/plugins/laf/macos/intellij.laf.macos.iml +++ b/plugins/laf/macos/intellij.laf.macos.iml @@ -11,5 +11,6 @@ + \ No newline at end of file diff --git a/plugins/laf/win10/intellij.laf.win10.iml b/plugins/laf/win10/intellij.laf.win10.iml index 724063566374..5bf60c881419 100644 --- a/plugins/laf/win10/intellij.laf.win10.iml +++ b/plugins/laf/win10/intellij.laf.win10.iml @@ -10,5 +10,6 @@ + \ No newline at end of file diff --git a/plugins/markdown/intellij.markdown.iml b/plugins/markdown/intellij.markdown.iml index 727b04cf6b28..aeac88af58de 100644 --- a/plugins/markdown/intellij.markdown.iml +++ b/plugins/markdown/intellij.markdown.iml @@ -36,8 +36,8 @@ - + \ No newline at end of file diff --git a/plugins/markdown/src/org/intellij/plugins/markdown/lang/MarkdownFileViewProvider.kt b/plugins/markdown/src/org/intellij/plugins/markdown/lang/MarkdownFileViewProvider.kt index a71ced3aeb87..d6b70c6615d1 100644 --- a/plugins/markdown/src/org/intellij/plugins/markdown/lang/MarkdownFileViewProvider.kt +++ b/plugins/markdown/src/org/intellij/plugins/markdown/lang/MarkdownFileViewProvider.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 org.intellij.plugins.markdown.lang import com.intellij.lang.Language @@ -8,18 +8,17 @@ import com.intellij.openapi.vfs.VirtualFile import com.intellij.psi.* import com.intellij.psi.impl.source.PsiFileImpl import com.intellij.psi.templateLanguages.TemplateLanguageFileViewProvider -import gnu.trove.THashSet import org.intellij.plugins.markdown.lang.MarkdownElementTypes.MARKDOWN_TEMPLATE_DATA import org.intellij.plugins.markdown.lang.psi.impl.MarkdownFile class MarkdownFileViewProvider(manager: PsiManager, virtualFile: VirtualFile, eventSystemEnabled: Boolean) : MultiplePsiFilesPerDocumentFileViewProvider(manager, virtualFile, eventSystemEnabled), TemplateLanguageFileViewProvider { - private val myRelevantLanguages = THashSet() + private val relevantLanguages = HashSet() init { - myRelevantLanguages.add(baseLanguage) - myRelevantLanguages.add(templateDataLanguage) + relevantLanguages.add(baseLanguage) + relevantLanguages.add(templateDataLanguage) } override fun createFile(lang: Language): PsiFile? { @@ -39,7 +38,7 @@ class MarkdownFileViewProvider(manager: PsiManager, virtualFile: VirtualFile, ev override fun getBaseLanguage(): Language = MarkdownLanguage.INSTANCE - override fun getLanguages(): Set = myRelevantLanguages + override fun getLanguages(): Set = relevantLanguages override fun getTemplateDataLanguage(): Language = HTMLLanguage.INSTANCE diff --git a/plugins/markdown/src/org/intellij/plugins/markdown/ui/preview/accessor/SafeLinkOpener.java b/plugins/markdown/src/org/intellij/plugins/markdown/ui/preview/accessor/SafeLinkOpener.java index 93307a425c44..746bbe2829b0 100644 --- a/plugins/markdown/src/org/intellij/plugins/markdown/ui/preview/accessor/SafeLinkOpener.java +++ b/plugins/markdown/src/org/intellij/plugins/markdown/ui/preview/accessor/SafeLinkOpener.java @@ -44,12 +44,9 @@ import java.util.Set; final class SafeLinkOpener { private static final Logger LOG = Logger.getInstance(SafeLinkOpener.class); - private static final Set SCHEMES = ContainerUtil.newTroveSet( - "http", - "https" - ); + private static final Set SCHEMES = Set.of("http", "https"); - private static final Set SAFE_LOCAL_EXTENSIONS = ContainerUtil.newTroveSet( + private static final Set SAFE_LOCAL_EXTENSIONS = Set.of( "md", "png", "gif", @@ -163,7 +160,7 @@ final class SafeLinkOpener { private static void showHeadersPopup(@NotNull Collection headers, @NotNull RelativePoint point) { ListPopupStep headersPopup = - new BaseListPopupStep(MarkdownBundle.message("markdown.navigate.to.header"), new ArrayList<>(headers)) { + new BaseListPopupStep<>(MarkdownBundle.message("markdown.navigate.to.header"), new ArrayList<>(headers)) { @NotNull @Override public String getTextFor(PsiElement value) { diff --git a/plugins/maven/intellij.maven.iml b/plugins/maven/intellij.maven.iml index 9c277b80d614..0875f22849bf 100644 --- a/plugins/maven/intellij.maven.iml +++ b/plugins/maven/intellij.maven.iml @@ -87,6 +87,7 @@ + diff --git a/plugins/properties/intellij.properties.iml b/plugins/properties/intellij.properties.iml index 4120406b8519..541f48160ee5 100644 --- a/plugins/properties/intellij.properties.iml +++ b/plugins/properties/intellij.properties.iml @@ -23,5 +23,6 @@ + \ No newline at end of file diff --git a/plugins/properties/properties-psi-api/intellij.properties.psi.iml b/plugins/properties/properties-psi-api/intellij.properties.psi.iml index 5599783f5cd6..5fb2cc0801c4 100644 --- a/plugins/properties/properties-psi-api/intellij.properties.psi.iml +++ b/plugins/properties/properties-psi-api/intellij.properties.psi.iml @@ -21,6 +21,6 @@ - + \ No newline at end of file diff --git a/plugins/properties/properties-psi-impl/intellij.properties.psi.impl.iml b/plugins/properties/properties-psi-impl/intellij.properties.psi.impl.iml index f77cd1a8aec1..83d607e066af 100644 --- a/plugins/properties/properties-psi-impl/intellij.properties.psi.impl.iml +++ b/plugins/properties/properties-psi-impl/intellij.properties.psi.impl.iml @@ -19,5 +19,6 @@ + \ No newline at end of file diff --git a/plugins/properties/properties-resource-bundle-editor/intellij.properties.resource.bundle.editor.iml b/plugins/properties/properties-resource-bundle-editor/intellij.properties.resource.bundle.editor.iml index 88a39283ff50..a885eef095e1 100644 --- a/plugins/properties/properties-resource-bundle-editor/intellij.properties.resource.bundle.editor.iml +++ b/plugins/properties/properties-resource-bundle-editor/intellij.properties.resource.bundle.editor.iml @@ -15,5 +15,6 @@ + \ No newline at end of file diff --git a/plugins/settings-repository/intellij.settingsRepository.iml b/plugins/settings-repository/intellij.settingsRepository.iml index c29d10747dcb..c73e3629cc54 100644 --- a/plugins/settings-repository/intellij.settingsRepository.iml +++ b/plugins/settings-repository/intellij.settingsRepository.iml @@ -39,5 +39,6 @@ + \ No newline at end of file diff --git a/plugins/sh/intellij.sh.iml b/plugins/sh/intellij.sh.iml index 5ad2bd62ef9a..56bfc218b1a6 100644 --- a/plugins/sh/intellij.sh.iml +++ b/plugins/sh/intellij.sh.iml @@ -24,6 +24,7 @@ - + + \ No newline at end of file diff --git a/plugins/sh/src/com/intellij/sh/completion/ShCommandCompletionContributor.java b/plugins/sh/src/com/intellij/sh/completion/ShCommandCompletionContributor.java index c1491a9664b4..e6a577fb22ff 100644 --- a/plugins/sh/src/com/intellij/sh/completion/ShCommandCompletionContributor.java +++ b/plugins/sh/src/com/intellij/sh/completion/ShCommandCompletionContributor.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.sh.completion; import com.intellij.codeInsight.completion.*; @@ -21,13 +21,13 @@ import com.intellij.util.PlatformIcons; import com.intellij.util.ProcessingContext; import com.intellij.util.SmartList; import com.intellij.util.containers.ContainerUtil; -import gnu.trove.THashSet; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Arrays; import java.util.Collection; +import java.util.HashSet; import java.util.List; import static com.intellij.patterns.PlatformPatterns.psiElement; @@ -37,19 +37,23 @@ public class ShCommandCompletionContributor extends CompletionContributor implem private static final int BUILTIN_PRIORITY = -10; public ShCommandCompletionContributor() { - extend(CompletionType.BASIC, elementPattern(), new CompletionProvider() { + extend(CompletionType.BASIC, elementPattern(), new CompletionProvider<>() { @Override - protected void addCompletions(@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) { + protected void addCompletions(@NotNull CompletionParameters parameters, + @NotNull ProcessingContext context, + @NotNull CompletionResultSet result) { if (endsWithDot(parameters)) return; Collection kws = new SmartList<>(); PsiElement original = parameters.getOriginalPosition(); if (original == null || !original.getText().contains("/")) { result.addAllElements(ContainerUtil.map(BUILTIN, - s -> PrioritizedLookupElement.withPriority(LookupElementBuilder - .create(s) - .withIcon(PlatformIcons.FUNCTION_ICON) - .withInsertHandler(AddSpaceInsertHandler.INSTANCE), BUILTIN_PRIORITY))); + s -> PrioritizedLookupElement.withPriority(LookupElementBuilder + .create(s) + .withIcon(PlatformIcons.FUNCTION_ICON) + .withInsertHandler( + AddSpaceInsertHandler.INSTANCE), + BUILTIN_PRIORITY))); kws = suggestKeywords(parameters.getPosition()); for (String keywords : kws) { @@ -66,7 +70,7 @@ public class ShCommandCompletionContributor extends CompletionContributor implem } CompletionResultSet resultSetWithPrefix = result.withPrefixMatcher(prefix); - WordCompletionContributor.addWordCompletionVariants(resultSetWithPrefix, parameters, new THashSet<>(kws)); + WordCompletionContributor.addWordCompletionVariants(resultSetWithPrefix, parameters, new HashSet<>(kws)); } }); } @@ -104,8 +108,8 @@ public class ShCommandCompletionContributor extends CompletionContributor implem } @NonNls private static final List BUILTIN = - new SmartList<>("alias", "bg", "bind", "break", "builtin", "caller", "cd", "command", "compgen", "complete", "continue", "declare", - "dirs", "disown", "echo", "enable", "eval", "exec", "exit", "export", "false", "fc", "fg", "getopts", "hash", "help", "history", - "jobs", "kill", "let", "local", "logout", "popd", "printf", "pushd", "pwd", "read", "readonly", "return", "set", "shift", "shopt", - "source", "suspend", "test", "times", "trap", "true", "type", "typeset", "ulimit", "umask", "unalias", "unset", "wait"); + Arrays.asList("alias", "bg", "bind", "break", "builtin", "caller", "cd", "command", "compgen", "complete", "continue", "declare", + "dirs", "disown", "echo", "enable", "eval", "exec", "exit", "export", "false", "fc", "fg", "getopts", "hash", "help", "history", + "jobs", "kill", "let", "local", "logout", "popd", "printf", "pushd", "pwd", "read", "readonly", "return", "set", "shift", "shopt", + "source", "suspend", "test", "times", "trap", "true", "type", "typeset", "ulimit", "umask", "unalias", "unset", "wait"); } diff --git a/plugins/sh/src/com/intellij/sh/highlighting/ShTextOccurrencesUtil.java b/plugins/sh/src/com/intellij/sh/highlighting/ShTextOccurrencesUtil.java index 60063ac94101..6e847b4932dd 100644 --- a/plugins/sh/src/com/intellij/sh/highlighting/ShTextOccurrencesUtil.java +++ b/plugins/sh/src/com/intellij/sh/highlighting/ShTextOccurrencesUtil.java @@ -4,6 +4,7 @@ package com.intellij.sh.highlighting; import com.intellij.codeInsight.editorActions.SelectWordUtil; import com.intellij.openapi.editor.Caret; import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.util.Segment; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.CollectConsumer; @@ -59,7 +60,7 @@ public final class ShTextOccurrencesUtil { }); } - private static boolean isWordExpandableOutside(@NotNull CharSequence documentText, @NotNull TextRange textRange) { + private static boolean isWordExpandableOutside(@NotNull CharSequence documentText, @NotNull Segment textRange) { if (textRange.getStartOffset() > 0) { char ch = documentText.charAt(textRange.getStartOffset() - 1); if (isWordPartCondition(ch)) { diff --git a/plugins/sh/src/com/intellij/sh/parser/ShParserUtil.java b/plugins/sh/src/com/intellij/sh/parser/ShParserUtil.java index abde1f0b4590..7eb32335bb12 100644 --- a/plugins/sh/src/com/intellij/sh/parser/ShParserUtil.java +++ b/plugins/sh/src/com/intellij/sh/parser/ShParserUtil.java @@ -1,26 +1,28 @@ -// 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.sh.parser; import com.intellij.lang.PsiBuilder; +import com.intellij.lang.SyntaxTreeBuilder; import com.intellij.lang.parser.GeneratedParserUtilBase; import com.intellij.openapi.util.Key; import com.intellij.psi.tree.IElementType; import com.intellij.sh.ShBundle; import com.intellij.sh.ShTypes; import com.intellij.sh.lexer.ShTokenTypes; -import gnu.trove.TObjectLongHashMap; +import it.unimi.dsi.fastutil.objects.Object2LongMap; +import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; public class ShParserUtil extends GeneratedParserUtilBase { - private static final Key> MODES_KEY = Key.create("MODES_KEY"); + private static final Key> MODES_KEY = Key.create("MODES_KEY"); - private static TObjectLongHashMap getParsingModes(PsiBuilder b) { - TObjectLongHashMap flags = b.getUserData(MODES_KEY); - if (flags == null) b.putUserData(MODES_KEY, flags = new TObjectLongHashMap<>()); + private static Object2LongMap getParsingModes(PsiBuilder b) { + Object2LongMap flags = b.getUserData(MODES_KEY); + if (flags == null) b.putUserData(MODES_KEY, flags = new Object2LongOpenHashMap<>()); return flags; } static boolean isModeOn(PsiBuilder b, @SuppressWarnings("UnusedParameters") int level, String mode) { - return getParsingModes(b).get(mode) > 0; + return getParsingModes(b).getLong(mode) > 0; } static boolean withOn(PsiBuilder b, int level_, String mode, Parser parser) { @@ -28,8 +30,8 @@ public class ShParserUtil extends GeneratedParserUtilBase { } private static boolean withImpl(PsiBuilder b, int level_, String mode, boolean onOff, Parser whenOn, Parser whenOff) { - TObjectLongHashMap map = getParsingModes(b); - long prev = map.get(mode); + Object2LongMap map = getParsingModes(b); + long prev = map.getLong(mode); boolean change = ((prev & 1) == 0) == onOff; if (change) map.put(mode, prev << 1 | (onOff ? 1 : 0)); boolean result = (change ? whenOn : whenOff).parse(b, level_); @@ -41,13 +43,13 @@ public class ShParserUtil extends GeneratedParserUtilBase { return consumeTokenFast(b, "\\\n"); } - static boolean notQuote(PsiBuilder b, @SuppressWarnings("UnusedParameters") int level) { + static boolean notQuote(SyntaxTreeBuilder b, @SuppressWarnings("UnusedParameters") int level) { if (b.getTokenType() == ShTypes.OPEN_QUOTE || b.getTokenType() == ShTypes.CLOSE_QUOTE) return false; b.advanceLexer(); return true; } - static boolean differentBracketsWarning(PsiBuilder b, @SuppressWarnings("UnusedParameters") int level) { + static boolean differentBracketsWarning(SyntaxTreeBuilder b, @SuppressWarnings("UnusedParameters") int level) { b.error(ShBundle.message("sh.parser.expected.similar.close.bracket")); return true; } @@ -75,7 +77,7 @@ public class ShParserUtil extends GeneratedParserUtilBase { return false; } - static boolean functionNameKeywordsRemapped(PsiBuilder b, @SuppressWarnings("UnusedParameters") int level) { + static boolean functionNameKeywordsRemapped(SyntaxTreeBuilder b, @SuppressWarnings("UnusedParameters") int level) { IElementType type = b.getTokenType(); if (ShTokenTypes.identifierKeywords.contains(type)) { b.remapCurrentToken(ShTypes.WORD); diff --git a/plugins/space/intellij.space.iml b/plugins/space/intellij.space.iml index fbf2d81798a0..12075c0c4365 100644 --- a/plugins/space/intellij.space.iml +++ b/plugins/space/intellij.space.iml @@ -125,5 +125,7 @@ + + \ No newline at end of file diff --git a/plugins/stats-collector/intellij.statsCollector.iml b/plugins/stats-collector/intellij.statsCollector.iml index 8153318e80f8..d83a98444cf3 100644 --- a/plugins/stats-collector/intellij.statsCollector.iml +++ b/plugins/stats-collector/intellij.statsCollector.iml @@ -28,5 +28,6 @@ + \ No newline at end of file diff --git a/plugins/stats-collector/intellij.statsCollector.tests.iml b/plugins/stats-collector/intellij.statsCollector.tests.iml index 548f72559ee9..f4c6201e0ac6 100644 --- a/plugins/stats-collector/intellij.statsCollector.tests.iml +++ b/plugins/stats-collector/intellij.statsCollector.tests.iml @@ -26,5 +26,6 @@ + \ No newline at end of file diff --git a/plugins/stream-debugger/intellij.java.debugger.streams.iml b/plugins/stream-debugger/intellij.java.debugger.streams.iml index 925db5fac1ef..fe2c9fba934c 100644 --- a/plugins/stream-debugger/intellij.java.debugger.streams.iml +++ b/plugins/stream-debugger/intellij.java.debugger.streams.iml @@ -20,5 +20,6 @@ + \ No newline at end of file diff --git a/plugins/svn4idea/intellij.vcs.svn.iml b/plugins/svn4idea/intellij.vcs.svn.iml index 9d6cc9d9994e..66012b00fdda 100644 --- a/plugins/svn4idea/intellij.vcs.svn.iml +++ b/plugins/svn4idea/intellij.vcs.svn.iml @@ -40,5 +40,6 @@ + \ No newline at end of file diff --git a/plugins/svn4idea/intellij.vcs.svn.tests.iml b/plugins/svn4idea/intellij.vcs.svn.tests.iml index db19cac866d5..39bb582d206c 100644 --- a/plugins/svn4idea/intellij.vcs.svn.tests.iml +++ b/plugins/svn4idea/intellij.vcs.svn.tests.iml @@ -20,5 +20,6 @@ + \ No newline at end of file diff --git a/plugins/tasks/tasks-api/intellij.tasks.iml b/plugins/tasks/tasks-api/intellij.tasks.iml index 52f6ca649a8f..85ecf9c2afad 100644 --- a/plugins/tasks/tasks-api/intellij.tasks.iml +++ b/plugins/tasks/tasks-api/intellij.tasks.iml @@ -11,5 +11,6 @@ + \ No newline at end of file diff --git a/plugins/tasks/tasks-core/intellij.tasks.core.iml b/plugins/tasks/tasks-core/intellij.tasks.core.iml index b3bc68d5b917..f92801d75193 100644 --- a/plugins/tasks/tasks-core/intellij.tasks.core.iml +++ b/plugins/tasks/tasks-core/intellij.tasks.core.iml @@ -69,6 +69,7 @@ - + + \ No newline at end of file diff --git a/plugins/tasks/tasks-core/jira/intellij.tasks.jira.iml b/plugins/tasks/tasks-core/jira/intellij.tasks.jira.iml index 3e6459fce686..76f0d64d5230 100644 --- a/plugins/tasks/tasks-core/jira/intellij.tasks.jira.iml +++ b/plugins/tasks/tasks-core/jira/intellij.tasks.jira.iml @@ -13,5 +13,6 @@ + \ No newline at end of file diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/config/RecentTaskRepositories.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/config/RecentTaskRepositories.java index f66c53bbebfe..2f35f200dd77 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/config/RecentTaskRepositories.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/config/RecentTaskRepositories.java @@ -12,10 +12,11 @@ import com.intellij.tasks.TaskRepositoryType; import com.intellij.tasks.impl.TaskManagerImpl; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.xmlb.XmlSerializer; -import gnu.trove.THashSet; -import gnu.trove.TObjectHashingStrategy; +import it.unimi.dsi.fastutil.Hash; +import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; import org.jdom.Element; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.*; @@ -23,19 +24,18 @@ import java.util.*; * @author Dmitry Avdeev */ @State(name = "RecentTaskRepositories", storages = @Storage("other.xml")) -public class RecentTaskRepositories implements PersistentStateComponent, Disposable { +public final class RecentTaskRepositories implements PersistentStateComponent, Disposable { + private final Set myRepositories = new ObjectOpenCustomHashSet<>(HASHING_STRATEGY); - private final Set myRepositories = new THashSet<>(HASHING_STRATEGY); - - private static final TObjectHashingStrategy HASHING_STRATEGY = new TObjectHashingStrategy() { + private static final Hash.Strategy HASHING_STRATEGY = new Hash.Strategy<>() { @Override - public int computeHashCode(TaskRepository object) { - return object.getUrl() == null ? 0 : object.getUrl().hashCode(); + public int hashCode(@Nullable TaskRepository object) { + return object == null || object.getUrl() == null ? 0 : object.getUrl().hashCode(); } @Override public boolean equals(TaskRepository o1, TaskRepository o2) { - return Objects.equals(o1.getUrl(), o2.getUrl()); + return o1 == o2 || (o1 != null && o2 != null && Objects.equals(o1.getUrl(), o2.getUrl())); } }; @@ -54,8 +54,9 @@ public class RecentTaskRepositories implements PersistentStateComponent } public Set getRepositories() { - return new THashSet<>(ContainerUtil.findAll(myRepositories, - repository -> !StringUtil.isEmptyOrSpaces(repository.getUrl())), HASHING_STRATEGY); + return new ObjectOpenCustomHashSet<>(ContainerUtil.findAll(myRepositories, repository -> { + return !StringUtil.isEmptyOrSpaces(repository.getUrl()); + }), HASHING_STRATEGY); } public void addRepositories(Collection repositories) { diff --git a/plugins/tasks/tasks-tests/intellij.tasks.tests.iml b/plugins/tasks/tasks-tests/intellij.tasks.tests.iml index c92b8827f1be..7be538440d79 100644 --- a/plugins/tasks/tasks-tests/intellij.tasks.tests.iml +++ b/plugins/tasks/tasks-tests/intellij.tasks.tests.iml @@ -31,5 +31,6 @@ + \ No newline at end of file diff --git a/plugins/terminal/intellij.terminal.iml b/plugins/terminal/intellij.terminal.iml index b5fcee5368ac..7cca216469c6 100644 --- a/plugins/terminal/intellij.terminal.iml +++ b/plugins/terminal/intellij.terminal.iml @@ -24,5 +24,6 @@ + \ No newline at end of file diff --git a/plugins/testng/intellij.testng.iml b/plugins/testng/intellij.testng.iml index d538887f4300..c938b6fd60c9 100644 --- a/plugins/testng/intellij.testng.iml +++ b/plugins/testng/intellij.testng.iml @@ -28,6 +28,7 @@ + diff --git a/plugins/testng_rt/tests/intellij.testng.rt.tests.iml b/plugins/testng_rt/tests/intellij.testng.rt.tests.iml index 63f3432da670..8cc739212381 100644 --- a/plugins/testng_rt/tests/intellij.testng.rt.tests.iml +++ b/plugins/testng_rt/tests/intellij.testng.rt.tests.iml @@ -13,5 +13,6 @@ + \ No newline at end of file diff --git a/plugins/textmate/intellij.textmate.iml b/plugins/textmate/intellij.textmate.iml index d2c309ebdf3c..79fef887939b 100644 --- a/plugins/textmate/intellij.textmate.iml +++ b/plugins/textmate/intellij.textmate.iml @@ -15,7 +15,7 @@ - + \ No newline at end of file diff --git a/plugins/textmate/src/org/jetbrains/plugins/textmate/TextMateServiceImpl.java b/plugins/textmate/src/org/jetbrains/plugins/textmate/TextMateServiceImpl.java index ad50b8d98a62..9d798967b8de 100644 --- a/plugins/textmate/src/org/jetbrains/plugins/textmate/TextMateServiceImpl.java +++ b/plugins/textmate/src/org/jetbrains/plugins/textmate/TextMateServiceImpl.java @@ -22,7 +22,6 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.containers.CollectionFactory; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.Interner; -import gnu.trove.THashMap; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -44,10 +43,7 @@ import org.jetbrains.plugins.textmate.plist.PlistReader; import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; public final class TextMateServiceImpl extends TextMateService { @@ -82,7 +78,7 @@ public final class TextMateServiceImpl extends TextMateService { } private void registerBundles(boolean fireEvents) { - Map oldExtensionsMapping = new THashMap<>(myExtensionsMapping); + Map oldExtensionsMapping = new HashMap<>(myExtensionsMapping); unregisterAllBundles(); TextMateSettings settings = TextMateSettings.getInstance(); @@ -92,7 +88,7 @@ public final class TextMateServiceImpl extends TextMateService { if (!ourBuiltinBundlesDisabled) { loadBuiltinBundles(settings); } - THashMap newExtensionsMapping = new THashMap<>(); + Map newExtensionsMapping = new HashMap<>(); for (BundleConfigBean bundleConfigBean : settings.getBundles()) { if (bundleConfigBean.isEnabled()) { VirtualFile bundleFile = LocalFileSystem.getInstance().findFileByPath(bundleConfigBean.getPath()); @@ -252,7 +248,7 @@ public final class TextMateServiceImpl extends TextMateService { } } - private boolean registerBundle(@Nullable VirtualFile directory, @NotNull THashMap extensionsMapping) { + private boolean registerBundle(@Nullable VirtualFile directory, @NotNull Map extensionsMapping) { final Bundle bundle = createBundle(directory); if (bundle != null) { registerLanguageSupport(bundle, extensionsMapping); @@ -302,7 +298,7 @@ public final class TextMateServiceImpl extends TextMateService { } } - private void registerLanguageSupport(@NotNull Bundle bundle, @NotNull THashMap extensionsMapping) { + private void registerLanguageSupport(@NotNull Bundle bundle, @NotNull Map extensionsMapping) { for (File grammarFile : bundle.getGrammarFiles()) { try { Plist plist = myPlistReader.read(grammarFile); diff --git a/plugins/ui-designer-core/intellij.uiDesigner.iml b/plugins/ui-designer-core/intellij.uiDesigner.iml index 1cc8b1d884b1..70b6dd74528b 100644 --- a/plugins/ui-designer-core/intellij.uiDesigner.iml +++ b/plugins/ui-designer-core/intellij.uiDesigner.iml @@ -17,5 +17,6 @@ + \ No newline at end of file diff --git a/plugins/ui-designer/intellij.java.guiForms.designer.iml b/plugins/ui-designer/intellij.java.guiForms.designer.iml index bf66968e5429..b4b629f426f9 100644 --- a/plugins/ui-designer/intellij.java.guiForms.designer.iml +++ b/plugins/ui-designer/intellij.java.guiForms.designer.iml @@ -35,6 +35,7 @@ + diff --git a/plugins/ui-designer/testSrc/com/intellij/uiDesigner/core/AsmCodeGeneratorTest.java b/plugins/ui-designer/testSrc/com/intellij/uiDesigner/core/AsmCodeGeneratorTest.java index 4de3b12d2991..3f1e0a5f9e9e 100644 --- a/plugins/ui-designer/testSrc/com/intellij/uiDesigner/core/AsmCodeGeneratorTest.java +++ b/plugins/ui-designer/testSrc/com/intellij/uiDesigner/core/AsmCodeGeneratorTest.java @@ -4,6 +4,7 @@ package com.intellij.uiDesigner.core; import com.intellij.DynamicBundle; import com.intellij.compiler.instrumentation.InstrumentationClassFinder; import com.intellij.diagnostic.StartUpMeasurer; +import com.intellij.ide.ui.UISettings; import com.intellij.openapi.actionSystem.DataProvider; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.PathManager; @@ -96,6 +97,7 @@ public class AsmCodeGeneratorTest extends JpsBuildTestCase { appendPath(cp, StartUpMeasurer.class); // intellij.platform.util.diagnostic appendPath(cp, NotNullFunction.class); // intellij.platform.util.rt appendPath(cp, SimpleTextAttributes.class); + appendPath(cp, UISettings.class); myClassFinder = new MyClassFinder(new URL[]{url}, cp.toArray(new URL[0])); } diff --git a/plugins/xpath/intellij.xpath.iml b/plugins/xpath/intellij.xpath.iml index 6bcb732593e3..91fa21711b04 100644 --- a/plugins/xpath/intellij.xpath.iml +++ b/plugins/xpath/intellij.xpath.iml @@ -27,5 +27,6 @@ + \ No newline at end of file diff --git a/plugins/xslt-debugger/intellij.xslt.debugger.iml b/plugins/xslt-debugger/intellij.xslt.debugger.iml index 64881b8345d0..998019eee1bc 100644 --- a/plugins/xslt-debugger/intellij.xslt.debugger.iml +++ b/plugins/xslt-debugger/intellij.xslt.debugger.iml @@ -23,5 +23,6 @@ + \ No newline at end of file diff --git a/plugins/yaml/intellij.yaml.iml b/plugins/yaml/intellij.yaml.iml index fac56b8aa308..c636f559da79 100644 --- a/plugins/yaml/intellij.yaml.iml +++ b/plugins/yaml/intellij.yaml.iml @@ -21,5 +21,6 @@ + \ No newline at end of file diff --git a/python/conda/intellij.python.conda.iml b/python/conda/intellij.python.conda.iml index c334f2fedc0e..346155bb3382 100644 --- a/python/conda/intellij.python.conda.iml +++ b/python/conda/intellij.python.conda.iml @@ -12,5 +12,6 @@ + \ No newline at end of file diff --git a/python/ide/impl/intellij.pycharm.community.customization.impl.iml b/python/ide/impl/intellij.pycharm.community.customization.impl.iml index 44dd956e1dbf..2c055957e3e4 100644 --- a/python/ide/impl/intellij.pycharm.community.customization.impl.iml +++ b/python/ide/impl/intellij.pycharm.community.customization.impl.iml @@ -19,5 +19,6 @@ + \ No newline at end of file diff --git a/python/intellij.pycharm.community.iml b/python/intellij.pycharm.community.iml index d9692af2e83c..40fedecfd9b6 100644 --- a/python/intellij.pycharm.community.iml +++ b/python/intellij.pycharm.community.iml @@ -15,5 +15,6 @@ + \ No newline at end of file diff --git a/python/intellij.python.community.impl.iml b/python/intellij.python.community.impl.iml index cae7d80f1640..a548be136d9c 100644 --- a/python/intellij.python.community.impl.iml +++ b/python/intellij.python.community.impl.iml @@ -72,5 +72,6 @@ + \ No newline at end of file diff --git a/python/intellij.python.pydev.iml b/python/intellij.python.pydev.iml index 2c72116714e5..898549d8c427 100644 --- a/python/intellij.python.pydev.iml +++ b/python/intellij.python.pydev.iml @@ -15,5 +15,6 @@ + \ No newline at end of file diff --git a/python/pluginCore/impl/intellij.python.community.plugin.impl.iml b/python/pluginCore/impl/intellij.python.community.plugin.impl.iml index c929e538b948..c39f0f44bacf 100644 --- a/python/pluginCore/impl/intellij.python.community.plugin.impl.iml +++ b/python/pluginCore/impl/intellij.python.community.plugin.impl.iml @@ -13,5 +13,6 @@ + \ No newline at end of file diff --git a/python/pluginJava/intellij.python.community.plugin.java.iml b/python/pluginJava/intellij.python.community.plugin.java.iml index 14ba624be3c4..9b297c4252c9 100644 --- a/python/pluginJava/intellij.python.community.plugin.java.iml +++ b/python/pluginJava/intellij.python.community.plugin.java.iml @@ -18,5 +18,6 @@ + \ No newline at end of file diff --git a/python/python-psi-impl/intellij.python.psi.impl.iml b/python/python-psi-impl/intellij.python.psi.impl.iml index a59c15e6460f..cd0a5ecfd326 100644 --- a/python/python-psi-impl/intellij.python.psi.impl.iml +++ b/python/python-psi-impl/intellij.python.psi.impl.iml @@ -23,5 +23,6 @@ + \ No newline at end of file diff --git a/python/python-rest/intellij.python.reStructuredText.iml b/python/python-rest/intellij.python.reStructuredText.iml index 77c80dfdece9..197180b41a80 100644 --- a/python/python-rest/intellij.python.reStructuredText.iml +++ b/python/python-rest/intellij.python.reStructuredText.iml @@ -15,5 +15,6 @@ + \ No newline at end of file diff --git a/python/rest/intellij.reStructuredText.iml b/python/rest/intellij.reStructuredText.iml index 2f0a3d4986d7..279053e65318 100644 --- a/python/rest/intellij.reStructuredText.iml +++ b/python/rest/intellij.reStructuredText.iml @@ -17,5 +17,6 @@ + \ No newline at end of file diff --git a/python/testSrc/intellij.python.community.tests.iml b/python/testSrc/intellij.python.community.tests.iml index 57f3e0784d47..af3f55e9025b 100644 --- a/python/testSrc/intellij.python.community.tests.iml +++ b/python/testSrc/intellij.python.community.tests.iml @@ -39,5 +39,6 @@ + \ No newline at end of file diff --git a/spellchecker/intellij.spellchecker.iml b/spellchecker/intellij.spellchecker.iml index 75edadf2ab94..226fd502849e 100644 --- a/spellchecker/intellij.spellchecker.iml +++ b/spellchecker/intellij.spellchecker.iml @@ -52,5 +52,6 @@ + \ No newline at end of file diff --git a/xml/dom-impl/intellij.xml.dom.impl.iml b/xml/dom-impl/intellij.xml.dom.impl.iml index 6410efba2e48..a650497b8b3b 100644 --- a/xml/dom-impl/intellij.xml.dom.impl.iml +++ b/xml/dom-impl/intellij.xml.dom.impl.iml @@ -18,6 +18,7 @@ + diff --git a/xml/dom-openapi/intellij.xml.dom.iml b/xml/dom-openapi/intellij.xml.dom.iml index 7449bdfc2bd1..a6b6ad478b7f 100644 --- a/xml/dom-openapi/intellij.xml.dom.iml +++ b/xml/dom-openapi/intellij.xml.dom.iml @@ -16,6 +16,7 @@ + diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/AddDomElementAction.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/AddDomElementAction.java index c2e33adac28c..bed2dc19a522 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/AddDomElementAction.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/AddDomElementAction.java @@ -1,6 +1,7 @@ -// 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.xml.ui.actions; +import com.intellij.icons.AllIcons; import com.intellij.ide.TypePresentationService; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.project.Project; @@ -8,7 +9,6 @@ import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.openapi.ui.popup.ListPopup; import com.intellij.openapi.util.NlsActions; import com.intellij.ui.CommonActionsPanel; -import com.intellij.util.IconUtil; import com.intellij.util.ReflectionUtil; import com.intellij.util.xml.*; import com.intellij.util.xml.reflect.DomCollectionChildDescription; @@ -23,7 +23,7 @@ import java.util.List; public abstract class AddDomElementAction extends AnAction { public AddDomElementAction() { - super(XmlDomBundle.messagePointer("dom.action.add"), IconUtil.getAddIcon()); + super(XmlDomBundle.messagePointer("dom.action.add"), AllIcons.General.Add); } @Override @@ -50,7 +50,7 @@ public abstract class AddDomElementAction extends AnAction { e.getPresentation().setText(actionText + (actions.length > 1 ? "..." : "")); } } - e.getPresentation().setIcon(IconUtil.getAddIcon()); + e.getPresentation().setIcon(AllIcons.General.Add); } @Override @@ -155,7 +155,7 @@ public abstract class AddDomElementAction extends AnAction { protected final ActionGroup myGroup; protected ShowPopupAction(ActionGroup group) { - super(XmlDomBundle.message("dom.action.add"), null, IconUtil.getAddIcon()); + super(XmlDomBundle.message("dom.action.add"), null, AllIcons.General.Add); myGroup = group; setShortcutSet(CommonActionsPanel.getCommonShortcut(CommonActionsPanel.Buttons.ADD)); } diff --git a/xml/impl/intellij.xml.impl.iml b/xml/impl/intellij.xml.impl.iml index 93401ea760fb..ac652a35e2d2 100644 --- a/xml/impl/intellij.xml.impl.iml +++ b/xml/impl/intellij.xml.impl.iml @@ -36,6 +36,7 @@ + diff --git a/xml/relaxng/intellij.relaxng.iml b/xml/relaxng/intellij.relaxng.iml index 5ec4221c111e..78d2458e112b 100644 --- a/xml/relaxng/intellij.relaxng.iml +++ b/xml/relaxng/intellij.relaxng.iml @@ -57,5 +57,6 @@ + \ No newline at end of file diff --git a/xml/tests/intellij.xml.tests.iml b/xml/tests/intellij.xml.tests.iml index 4e68e4938526..5c40b0b7eaeb 100644 --- a/xml/tests/intellij.xml.tests.iml +++ b/xml/tests/intellij.xml.tests.iml @@ -24,7 +24,7 @@ - + diff --git a/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java b/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java index d4c7d58ecd88..05e002921e71 100644 --- a/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java +++ b/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java @@ -54,7 +54,6 @@ import com.intellij.xml.XmlElementDescriptor; import com.intellij.xml.actions.validate.ValidateXmlActionHandler; import com.intellij.xml.impl.schema.XmlElementDescriptorImpl; import com.intellij.xml.util.*; -import gnu.trove.THashSet; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -1263,7 +1262,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase { List files = new ArrayList<>(6); files.add(findVirtualFile(BASE_PATH + getTestName(false) + ".xml")); - final Set usedFiles = new THashSet<>(); + final Set usedFiles = new HashSet<>(); final String base = BASE_PATH + getTestName(false) + "Schemas/"; for(String[] pair:urls) { diff --git a/xml/tests/src/com/intellij/xml/XmlHighlightsExtractorTest.java b/xml/tests/src/com/intellij/xml/XmlHighlightsExtractorTest.java index f893667d66ac..5bb926577390 100644 --- a/xml/tests/src/com/intellij/xml/XmlHighlightsExtractorTest.java +++ b/xml/tests/src/com/intellij/xml/XmlHighlightsExtractorTest.java @@ -1,24 +1,25 @@ -// 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.xml; import com.intellij.application.options.colors.highlighting.HighlightData; import com.intellij.application.options.colors.highlighting.HighlightsExtractor; import com.intellij.openapi.editor.colors.ColorKey; import com.intellij.openapi.editor.colors.TextAttributesKey; +import com.intellij.openapi.options.colors.ColorSettingsPage; import com.intellij.openapi.options.colors.pages.XMLColorsPage; import com.intellij.testFramework.LightPlatformTestCase; -import gnu.trove.THashMap; import org.jetbrains.annotations.NonNls; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; public class XmlHighlightsExtractorTest extends LightPlatformTestCase { private static final TextAttributesKey INLINE_KEY = TextAttributesKey.createTextAttributesKey("INLINE_KEY"); private static final ColorKey COLOR_KEY = ColorKey.createColorKey("COLOR_KEY"); - @NonNls private static final Map INLINE_ELEMENT_DESCRIPTORS = new THashMap<>(); + @NonNls private static final Map INLINE_ELEMENT_DESCRIPTORS = new HashMap<>(); static { INLINE_ELEMENT_DESCRIPTORS.put("inline", INLINE_KEY); } @@ -28,9 +29,9 @@ public class XmlHighlightsExtractorTest extends LightPlatformTestCase { } public void testXmlHighlights() { - XMLColorsPage page = new XMLColorsPage(); + ColorSettingsPage page = new XMLColorsPage(); Map map = page.getAdditionalHighlightingTagToDescriptorMap(); - ArrayList highlights = new ArrayList<>(); + List highlights = new ArrayList<>(); String s = new HighlightsExtractor(map, INLINE_ELEMENT_DESCRIPTORS, COLOR_KEY_MAPPING).extractHighlights(page.getDemoText(), highlights); assertEquals(8, highlights.size());