From efc14fe563a59bfe26f87272f24dbec722a39b8f Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Tue, 19 Jul 2016 12:32:33 +0200 Subject: [PATCH 1/7] Cleanup (better name for module ref. element) --- .../com/intellij/psi/formatter/java/AbstractJavaBlock.java | 2 +- .../src/com/intellij/psi/JavaElementVisitor.java | 2 +- java/java-psi-api/src/com/intellij/psi/PsiJavaModule.java | 3 ++- ...uleReference.java => PsiJavaModuleReferenceElement.java} | 2 +- .../com/intellij/psi/impl/compiled/ClsJavaModuleImpl.java | 6 +++--- ...enceImpl.java => ClsJavaModuleReferenceElementImpl.java} | 6 +++--- .../src/com/intellij/psi/impl/source/PsiJavaModuleImpl.java | 4 ++-- ...enceImpl.java => PsiJavaModuleReferenceElementImpl.java} | 4 ++-- .../com/intellij/psi/impl/source/tree/JavaElementType.java | 2 +- 9 files changed, 16 insertions(+), 15 deletions(-) rename java/java-psi-api/src/com/intellij/psi/{PsiJavaModuleReference.java => PsiJavaModuleReferenceElement.java} (92%) rename java/java-psi-impl/src/com/intellij/psi/impl/compiled/{ClsJavaModuleReferenceImpl.java => ClsJavaModuleReferenceElementImpl.java} (88%) rename java/java-psi-impl/src/com/intellij/psi/impl/source/{PsiJavaModuleReferenceImpl.java => PsiJavaModuleReferenceElementImpl.java} (90%) diff --git a/java/java-impl/src/com/intellij/psi/formatter/java/AbstractJavaBlock.java b/java/java-impl/src/com/intellij/psi/formatter/java/AbstractJavaBlock.java index 1343dd0834b7..372aa1f881a3 100644 --- a/java/java-impl/src/com/intellij/psi/formatter/java/AbstractJavaBlock.java +++ b/java/java-impl/src/com/intellij/psi/formatter/java/AbstractJavaBlock.java @@ -203,7 +203,7 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo InjectedLanguageUtil.hasInjections((PsiLanguageInjectionHost)child)) { return new CommentWithInjectionBlock(child, wrap, alignment, indent, settings, javaSettings); } - if (child instanceof LeafElement || childPsi instanceof PsiJavaModuleReference) { + if (child instanceof LeafElement || childPsi instanceof PsiJavaModuleReferenceElement) { final LeafBlock block = new LeafBlock(child, wrap, alignment, actualIndent); block.setStartOffset(startOffset); return block; diff --git a/java/java-psi-api/src/com/intellij/psi/JavaElementVisitor.java b/java/java-psi-api/src/com/intellij/psi/JavaElementVisitor.java index a0b0ea22d8f2..6002fc8ea273 100644 --- a/java/java-psi-api/src/com/intellij/psi/JavaElementVisitor.java +++ b/java/java-psi-api/src/com/intellij/psi/JavaElementVisitor.java @@ -391,7 +391,7 @@ public abstract class JavaElementVisitor extends PsiElementVisitor { visitElement(module); } - public void visitModuleReference(PsiJavaModuleReference moduleRef) { + public void visitModuleReference(PsiJavaModuleReferenceElement moduleRef) { visitElement(moduleRef); } diff --git a/java/java-psi-api/src/com/intellij/psi/PsiJavaModule.java b/java/java-psi-api/src/com/intellij/psi/PsiJavaModule.java index 37a2d2b332ec..35f763621067 100644 --- a/java/java-psi-api/src/com/intellij/psi/PsiJavaModule.java +++ b/java/java-psi-api/src/com/intellij/psi/PsiJavaModule.java @@ -26,6 +26,7 @@ public interface PsiJavaModule extends NavigatablePsiElement { String MODULE_INFO_CLASS = "module-info"; String MODULE_INFO_FILE = MODULE_INFO_CLASS + ".java"; - @NotNull PsiJavaModuleReference getNameElement(); + @NotNull + PsiJavaModuleReferenceElement getNameElement(); @NotNull String getModuleName(); } \ No newline at end of file diff --git a/java/java-psi-api/src/com/intellij/psi/PsiJavaModuleReference.java b/java/java-psi-api/src/com/intellij/psi/PsiJavaModuleReferenceElement.java similarity index 92% rename from java/java-psi-api/src/com/intellij/psi/PsiJavaModuleReference.java rename to java/java-psi-api/src/com/intellij/psi/PsiJavaModuleReferenceElement.java index 0dae11ea5584..64a2bb1d79d6 100644 --- a/java/java-psi-api/src/com/intellij/psi/PsiJavaModuleReference.java +++ b/java/java-psi-api/src/com/intellij/psi/PsiJavaModuleReferenceElement.java @@ -22,6 +22,6 @@ import org.jetbrains.annotations.NotNull; * * @since 2016.3 */ -public interface PsiJavaModuleReference extends PsiElement { +public interface PsiJavaModuleReferenceElement extends PsiElement { @NotNull String getReferenceText(); } \ No newline at end of file diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsJavaModuleImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsJavaModuleImpl.java index d5100fd2f30a..cab4baad5c02 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsJavaModuleImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsJavaModuleImpl.java @@ -25,16 +25,16 @@ import com.intellij.psi.impl.source.tree.TreeElement; import org.jetbrains.annotations.NotNull; public class ClsJavaModuleImpl extends ClsRepositoryPsiElement implements PsiJavaModule { - private PsiJavaModuleReference myReference; + private PsiJavaModuleReferenceElement myReference; public ClsJavaModuleImpl(PsiJavaModuleStub stub) { super(stub); - myReference = new ClsJavaModuleReferenceImpl(this, stub.getName()); + myReference = new ClsJavaModuleReferenceElementImpl(this, stub.getName()); } @NotNull @Override - public PsiJavaModuleReference getNameElement() { + public PsiJavaModuleReferenceElement getNameElement() { return myReference; } diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsJavaModuleReferenceImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsJavaModuleReferenceElementImpl.java similarity index 88% rename from java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsJavaModuleReferenceImpl.java rename to java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsJavaModuleReferenceElementImpl.java index d290f3a5e09f..5734c5b7f467 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsJavaModuleReferenceImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsJavaModuleReferenceElementImpl.java @@ -18,16 +18,16 @@ package com.intellij.psi.impl.compiled; import com.intellij.psi.JavaElementVisitor; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElementVisitor; -import com.intellij.psi.PsiJavaModuleReference; +import com.intellij.psi.PsiJavaModuleReferenceElement; import com.intellij.psi.impl.source.tree.JavaElementType; import com.intellij.psi.impl.source.tree.TreeElement; import org.jetbrains.annotations.NotNull; -public class ClsJavaModuleReferenceImpl extends ClsElementImpl implements PsiJavaModuleReference { +public class ClsJavaModuleReferenceElementImpl extends ClsElementImpl implements PsiJavaModuleReferenceElement { private final PsiElement myParent; private final String myText; - public ClsJavaModuleReferenceImpl(PsiElement parent, String text) { + public ClsJavaModuleReferenceElementImpl(PsiElement parent, String text) { myParent = parent; myText = text; } diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaModuleImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaModuleImpl.java index 36d754083fe4..975d8badbead 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaModuleImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaModuleImpl.java @@ -35,8 +35,8 @@ public class PsiJavaModuleImpl extends JavaStubPsiElement imp @NotNull @Override - public PsiJavaModuleReference getNameElement() { - return PsiTreeUtil.getRequiredChildOfType(this, PsiJavaModuleReference.class); + public PsiJavaModuleReferenceElement getNameElement() { + return PsiTreeUtil.getRequiredChildOfType(this, PsiJavaModuleReferenceElement.class); } @NotNull diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaModuleReferenceImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaModuleReferenceElementImpl.java similarity index 90% rename from java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaModuleReferenceImpl.java rename to java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaModuleReferenceElementImpl.java index 0f9cf99c101b..1f3062e2f26c 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaModuleReferenceImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaModuleReferenceElementImpl.java @@ -20,8 +20,8 @@ import com.intellij.psi.impl.source.tree.CompositePsiElement; import com.intellij.psi.impl.source.tree.JavaElementType; import org.jetbrains.annotations.NotNull; -public class PsiJavaModuleReferenceImpl extends CompositePsiElement implements PsiJavaModuleReference { - public PsiJavaModuleReferenceImpl() { +public class PsiJavaModuleReferenceElementImpl extends CompositePsiElement implements PsiJavaModuleReferenceElement { + public PsiJavaModuleReferenceElementImpl() { super(JavaElementType.MODULE_REFERENCE); } diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaElementType.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaElementType.java index d751a3a75339..f1e0f2e083ca 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaElementType.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaElementType.java @@ -140,7 +140,7 @@ public interface JavaElementType { IElementType ANNOTATION_ARRAY_INITIALIZER = new JavaCompositeElementType("ANNOTATION_ARRAY_INITIALIZER", PsiArrayInitializerMemberValueImpl.class); IElementType RECEIVER_PARAMETER = new JavaCompositeElementType("RECEIVER", PsiReceiverParameterImpl.class); - IElementType MODULE_REFERENCE = new JavaCompositeElementType("MODULE_REFERENCE", PsiJavaModuleReferenceImpl.class); + IElementType MODULE_REFERENCE = new JavaCompositeElementType("MODULE_REFERENCE", PsiJavaModuleReferenceElementImpl.class); IElementType REQUIRES_STATEMENT = new JavaCompositeElementType("REQUIRES_STATEMENT", PsiRequiresStatementImpl.class); IElementType EXPORTS_STATEMENT = new JavaCompositeElementType("EXPORTS_STATEMENT", PsiExportsStatementImpl.class); IElementType USES_STATEMENT = new JavaCompositeElementType("USES_STATEMENT", PsiUsesStatementImpl.class); From 859595a52daa35c172c95a319d37d962801a3549 Mon Sep 17 00:00:00 2001 From: Yaroslav Lepenkin Date: Fri, 15 Jul 2016 16:29:58 +0300 Subject: [PATCH 2/7] removed 2 excess copyrights --- .../formatting/AdjustFormatRangesState.kt | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/formatting/AdjustFormatRangesState.kt b/platform/lang-impl/src/com/intellij/formatting/AdjustFormatRangesState.kt index 7e37e318929b..b376ad7a6290 100644 --- a/platform/lang-impl/src/com/intellij/formatting/AdjustFormatRangesState.kt +++ b/platform/lang-impl/src/com/intellij/formatting/AdjustFormatRangesState.kt @@ -1,33 +1,3 @@ -/* - * 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-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-2016 JetBrains s.r.o. * From f889dffc0fb388aaaaf8b34028ce94071054f6a4 Mon Sep 17 00:00:00 2001 From: Yaroslav Lepenkin Date: Tue, 19 Jul 2016 00:45:21 +0300 Subject: [PATCH 3/7] enable smart reformat of vcs changed lines --- platform/util/resources/misc/registry.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index c974b9f66666..617eda4b2e81 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -151,7 +151,7 @@ editor.navigation.history.stack.size=25 editor.navigation.history.stack.size.description=Stack size limit for back/forward and last/next edit location navigation editor.reformat.on.typing=false -smart.reformat.vcs.changes=false +smart.reformat.vcs.changes=true ide.showIndexRebuildMessage=false From 0692649e3a053294760108551fb28d307a99020d Mon Sep 17 00:00:00 2001 From: Alexey Ushakov Date: Tue, 19 Jul 2016 13:26:19 +0300 Subject: [PATCH 4/7] IDEA-158611 BootJDK switcher incorrectly handles arrow keys Fixed CCE --- .../intellij/openapi/util/SwitchBootJdkAction.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/openapi/util/SwitchBootJdkAction.java b/platform/lang-impl/src/com/intellij/openapi/util/SwitchBootJdkAction.java index 59405572e49a..4d4411069e43 100644 --- a/platform/lang-impl/src/com/intellij/openapi/util/SwitchBootJdkAction.java +++ b/platform/lang-impl/src/com/intellij/openapi/util/SwitchBootJdkAction.java @@ -90,6 +90,11 @@ public class SwitchBootJdkAction extends AnAction implements DumbAware { SwitchBootJdkDialog dialog = new SwitchBootJdkDialog(); if (dialog.showAndGet()) { File selectedJdkBundleFile = dialog.getSelectedFile(); + if (selectedJdkBundleFile == null) { + LOG.error("SwitchBootJdkDialog returns null selection"); + return; + } + FileWriter fooWriter = null; try { //noinspection IOResourceOpenedButNotSafelyClosed @@ -199,6 +204,7 @@ public class SwitchBootJdkAction extends AnAction implements DumbAware { throw new Exception("Invalid JDK bundle!"); } if (selectedBundle.getBitness() != JdkBundle.runtimeBitness) { + //noinspection SpellCheckingInspection throw new Exception("JDK arch mismatch! Your IDE's arch is " + JdkBundle.runtimeBitness); } } @@ -264,8 +270,14 @@ public class SwitchBootJdkAction extends AnAction implements DumbAware { return myComboBox; } + @Nullable public File getSelectedFile() { - return ((JdkBundle)myComboBox.getSelectedItem()).getLocation(); + final JdkBundleItem item = (JdkBundleItem)myComboBox.getSelectedItem(); + if (item == null) return null; + + final JdkBundle bundle = item.getBundle(); + + return bundle != null ? bundle.getLocation() : null; } } From 969b831714a8ca7f37e08e9a48ce6e6293199a00 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Tue, 19 Jul 2016 13:44:38 +0300 Subject: [PATCH 5/7] IDEA-97406 tune performance of dots on Mac --- .../com/intellij/ui/paint/EffectPainter.java | 75 ++++++++----------- 1 file changed, 30 insertions(+), 45 deletions(-) diff --git a/platform/platform-api/src/com/intellij/ui/paint/EffectPainter.java b/platform/platform-api/src/com/intellij/ui/paint/EffectPainter.java index 5c5eb3471e9d..008dcdb4db3f 100644 --- a/platform/platform-api/src/com/intellij/ui/paint/EffectPainter.java +++ b/platform/platform-api/src/com/intellij/ui/paint/EffectPainter.java @@ -131,17 +131,7 @@ public enum EffectPainter implements RegionPainter { WavePainter.forColor(g.getColor()).paint(g, x, x + width, y + height); } else if (width > 0 && height > 0) { - if (paint == null) paint = g.getPaint(); - g = (Graphics2D)g.create(x, y, width, height); - g.setComposite(AlphaComposite.SrcOver); - g.clipRect(0, 0, width, height); - BufferedImage image = WAVE_FACTORY.get(g, paint, height); - int length = image.getWidth(); // the spatial period of the wave - int dx = -((x % length + length) % length); // normalize - for (; dx < width; dx += length) { - UIUtil.drawImage(g, image, dx, 0, null); - } - g.dispose(); + WAVE_FACTORY.paint(g, x, y, width, height, paint); } } }, @@ -191,67 +181,62 @@ public enum EffectPainter implements RegionPainter { height = thickness; } if (painter == BOLD_DOTTED_UNDERSCORE) { - int length = 2 * height; // the spatial period - int dx = -((x % length + length) % length); // normalize - if (-dx >= height) { - dx += length; - } - Composite old = g.getComposite(); - g.setComposite(AlphaComposite.SrcOver); - BufferedImage image = BOLD_DOTTED_FACTORY.get(g, g.getPaint(), height); - for (; dx < width; dx += length) { - if (image != null) { - UIUtil.drawImage(g, image, x + dx, y, null); - } - else { - //noinspection SuspiciousNameCombination - RectanglePainter.FILL.paint(g, x + dx, y, height, height, null); - } - } - g.setComposite(old); + BOLD_DOTTED_FACTORY.paint(g, x, y, width, height, null); } else { g.fillRect(x, y, width, height); } } - private static abstract class Factory { + private static abstract class Factory implements RegionPainter { private final ConcurrentHashMap myCache = new ConcurrentHashMap<>(); abstract BufferedImage create(Graphics2D g, Paint paint, int height); - BufferedImage get(Graphics2D g, Paint paint, int height) { + @Override + public void paint(Graphics2D g, int x, int y, int width, int height, Paint paint) { + if (paint == null) paint = g.getPaint(); + g = (Graphics2D)g.create(x, y, width, height); + g.setComposite(AlphaComposite.SrcOver); + BufferedImage image; if (paint instanceof Color) { Color color = (Color)paint; Long key = color.getRGB() ^ ((long)height << 32); - BufferedImage image = myCache.get(key); + image = myCache.get(key); boolean exists = image != null; if (!exists || UIUtil.isRetina(g) != (image instanceof JBHiDPIScaledImage)) { image = create(g, paint, height); - if (image != null) { - myCache.put(key, image); - } - else if (exists) { - myCache.remove(key); - } + myCache.put(key, image); } - return image; } - return create(g, paint, height); + else { + image = create(g, paint, height); + } + int length = image.getWidth(); + int dx = -((x % length + length) % length); // normalize + for (; dx < width; dx += length) { + UIUtil.drawImage(g, image, dx, 0, null); + } + g.dispose(); } } private static final Factory BOLD_DOTTED_FACTORY = new Factory() { @Override BufferedImage create(Graphics2D graphics, Paint paint, int height) { - if (height <= 2 && !UIUtil.isRetina(graphics)) return null; + Integer round = height <= 2 && !UIUtil.isRetina(graphics) ? null : height; //noinspection SuspiciousNameCombination - BufferedImage image = UIUtil.createImageForGraphics(graphics, height, height, BufferedImage.TYPE_INT_ARGB); + int width = height << 8; + BufferedImage image = UIUtil.createImageForGraphics(graphics, width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g = image.createGraphics(); + g.setPaint(paint); try { - g.setPaint(paint); - //noinspection SuspiciousNameCombination - RectanglePainter.FILL.paint(g, 0, 0, height, height, height); + int dx = 0; + while (dx < width) { + //noinspection SuspiciousNameCombination + RectanglePainter.FILL.paint(g, dx, 0, height, height, round); + dx += height + height; + } } finally { g.dispose(); From 1996140c4f1c651454a5706a51e4a5fc90daefd4 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Tue, 19 Jul 2016 13:39:41 +0200 Subject: [PATCH 6/7] encapsulate myTestRootDisposable --- .../compiler/BaseCompilerTestCase.java | 6 +++--- .../codeInsight/GenerateConstructorTest.java | 4 ++-- .../completion/SmartTypeCompletionTest.java | 19 ++++++++++++++--- .../daemon/AdvHighlightingJdk7Test.java | 5 ++--- .../daemon/GenericsHighlightingTest.java | 4 ++-- .../daemon/LightAdvHighlightingJdk6Test.java | 4 ++-- .../daemon/LightAdvHighlightingJdk7Test.java | 2 +- .../daemon/LightAdvHighlightingTest.java | 2 +- .../daemon/PsiAugmentProviderTest.java | 2 +- .../impl/DaemonRespondToChangesTest.java | 11 ++++++---- .../lambda/GenericsHighlighting8Test.java | 4 ++-- .../GenericsHighlightingGenerated8Test.java | 4 ++-- .../ReplaceWithOfNullableFixTest.java | 4 ++-- .../codeInspection/CanBeFinalTest.java | 19 +++++++++++++++-- .../DataFlowInspection8Test.java | 4 ++-- .../MagicConstantInspectionTest.java | 2 +- .../NullableStuffInspectionTest.java | 18 +++++++++++++++- .../codeInspection/RedundantSuppressTest.java | 21 +++++++++++++++++-- .../RedundantTypeArgsInspectionTest.java | 20 +++++++++++++++--- .../com/intellij/find/FindInEditorTest.java | 4 ++-- .../projectView/ProjectTreeStructureTest.java | 17 ++++++++++++++- .../intellij/psi/ModifyAnnotationsTest.java | 4 ++-- .../intellij/psi/Src15RepositoryUseTest.java | 6 +++--- .../intellij/psi/SrcRepositoryUseTest.java | 4 ++-- .../psi/impl/file/impl/PsiEventsTest.java | 4 ++-- .../psi/resolve/ResolveClassTest.java | 2 +- .../psi/resolve/ResolveMethod15Test.java | 19 +++++++++++++++-- .../AbstractJavaInplaceIntroduceTest.java | 5 ++--- .../com/intellij/roots/RootsChangedTest.java | 4 ++-- .../codeInsight/CodeInsightTestCase.java | 3 +-- .../daemon/DaemonAnalyzerTestCase.java | 5 ++--- .../daemon/LightDaemonAnalyzerTestCase.java | 6 +++--- .../projectView/BaseProjectViewTestCase.java | 7 ++----- .../intellij/json/JsonLiveTemplateTest.java | 17 ++++++++++++++- .../JsonSchemaDocumentationTest.java | 17 ++++++++++++++- .../JsonSchemaHighlightingTest.java | 17 ++++++++++++++- .../project/ExternalProjectServiceTest.groovy | 4 ++-- .../SelectUnselectOccurrenceActionsTest.java | 4 ++-- .../openapi/editor/impl/EditorImplTest.java | 2 +- .../fileEditor/NonProjectFileAccessTest.java | 8 +++---- .../openapi/fileTypes/impl/FileTypesTest.java | 4 ++-- .../progress/impl/ProgressIndicatorTest.java | 2 +- .../com/intellij/platform/ProjectSetTest.java | 12 ++++++----- .../psi/impl/meta/MetaRegistryTest.java | 6 +++--- .../testFramework/PlatformLiteFixture.java | 6 ++---- .../testFramework/UsefulTestCase.java | 6 +++--- .../com/intellij/vcs/test/VcsPlatformTest.kt | 2 +- .../groovy/compiler/GroovyDebuggerTest.groovy | 2 +- .../properties/PropertiesProjectViewTest.java | 4 ++-- .../com/intellij/tasks/TaskManagerTest.java | 4 ++-- .../intellij/tasks/vcs/TaskBranchesTest.java | 4 ++-- .../fixtures/PyMultiFileResolveTestCase.java | 5 ++--- .../util/xml/DomConcurrencyStressTest.java | 8 +++---- .../intellij/util/xml/DomExtensionsTest.java | 6 ++---- .../intellij/util/xml/impl/DomTestCase.java | 4 ++-- .../util/xml/stubs/DomStubBuilderTest.java | 4 ++-- .../util/xml/stubs/DomStubUsingTest.java | 2 +- .../relaxNG/RngXmlHighlightingTest.java | 12 +++++------ .../intellij/codeInsight/XmlEventsTest.java | 4 ++-- .../completion/XmlCompletionTest.java | 4 ++-- 60 files changed, 279 insertions(+), 136 deletions(-) diff --git a/java/compiler/impl/testSrc/com/intellij/compiler/BaseCompilerTestCase.java b/java/compiler/impl/testSrc/com/intellij/compiler/BaseCompilerTestCase.java index 3e34ee657a4c..8544f14e254a 100644 --- a/java/compiler/impl/testSrc/com/intellij/compiler/BaseCompilerTestCase.java +++ b/java/compiler/impl/testSrc/com/intellij/compiler/BaseCompilerTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -66,7 +66,7 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase { @Override protected void setUp() throws Exception { super.setUp(); - myProject.getMessageBus().connect(myTestRootDisposable).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() { + myProject.getMessageBus().connect(getTestRootDisposable()).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() { @Override public void rootsChanged(ModuleRootEvent event) { //todo[nik] projectOpened isn't called in tests so we need to add this listener manually @@ -249,7 +249,7 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase { public void fileGenerated(String outputRoot, String relativePath) { generatedFilePaths.add(relativePath); } - }, myTestRootDisposable); + }, getTestRootDisposable()); UIUtil.invokeAndWaitIfNeeded(new Runnable() { @Override public void run() { diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/GenerateConstructorTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/GenerateConstructorTest.java index 76a4ef1d869b..ae4f20828d80 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/GenerateConstructorTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/GenerateConstructorTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -81,7 +81,7 @@ public class GenerateConstructorTest extends LightCodeInsightFixtureTestCase { myFixture.addClass("package foo;\n\nimport java.lang.annotation.*;\n\n@Target(ElementType.TYPE_USE) public @interface TestNotNull { }"); NullableNotNullManager manager = NullableNotNullManager.getInstance(getProject()); manager.setNotNulls("foo.TestNotNull"); - Disposer.register(myTestRootDisposable, manager::setNotNulls); + Disposer.register(getTestRootDisposable(), manager::setNotNulls); doTest(); } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java index 4af789b6fffb..3aaaeba526f9 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartTypeCompletionTest.java @@ -1,9 +1,23 @@ +/* + * 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. + */ package com.intellij.codeInsight.completion; import com.intellij.JavaTestUtil; import com.intellij.codeInsight.CodeInsightSettings; import com.intellij.codeInsight.lookup.Lookup; -import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.LookupElementPresentation; import com.intellij.codeInsight.template.SmartCompletionContextType; import com.intellij.codeInsight.template.Template; @@ -12,7 +26,6 @@ import com.intellij.codeInsight.template.TemplateManager; import com.intellij.codeInsight.template.impl.TemplateImpl; import com.intellij.lang.java.JavaLanguage; import com.intellij.openapi.fileEditor.FileDocumentManager; -import com.intellij.openapi.util.Condition; import com.intellij.psi.codeStyle.CodeStyleSettings; import com.intellij.psi.codeStyle.CodeStyleSettingsManager; import com.intellij.psi.codeStyle.CommonCodeStyleSettings; @@ -656,7 +669,7 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase { final SmartCompletionContextType completionContextType = ContainerUtil.findInstance(TemplateContextType.EP_NAME.getExtensions(), SmartCompletionContextType.class); ((TemplateImpl)template).getTemplateContext().setEnabled(completionContextType, true); - CodeInsightTestUtil.addTemplate(template, myTestRootDisposable); + CodeInsightTestUtil.addTemplate(template, getTestRootDisposable()); doTest(); } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java index a69e12f07e24..a71a4cf03446 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * 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. @@ -18,7 +18,6 @@ package com.intellij.codeInsight.daemon; import com.intellij.codeInspection.LocalInspectionTool; import com.intellij.codeInspection.defUse.DefUseInspection; import com.intellij.openapi.projectRoots.JavaSdkVersion; -import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.roots.LanguageLevelProjectExtension; import com.intellij.pom.java.LanguageLevel; import com.intellij.testFramework.IdeaTestUtil; @@ -79,7 +78,7 @@ public class AdvHighlightingJdk7Test extends DaemonAnalyzerTestCase { //ambiguous method calls private void doTestAmbiguous(@NotNull JavaSdkVersion javaSdkVersion) throws Exception { final String name = getTestName(true); - IdeaTestUtil.setTestVersion(javaSdkVersion, getModule(), myTestRootDisposable); + IdeaTestUtil.setTestVersion(javaSdkVersion, getModule(), getTestRootDisposable()); doTest(BASE_PATH + name + "/pck/AmbiguousMethodCall.java", BASE_PATH + "/" + name, false, false); } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java index 227dcf0ad2ff..76a517c4e176 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * 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. @@ -55,7 +55,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase { private void doTest(@NotNull LanguageLevel languageLevel, @NotNull JavaSdkVersion sdkVersion, boolean checkWarnings) { LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject()).setLanguageLevel(languageLevel); - IdeaTestUtil.setTestVersion(sdkVersion, getModule(), myTestRootDisposable); + IdeaTestUtil.setTestVersion(sdkVersion, getModule(), getTestRootDisposable()); doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, false); } private void doTest5(boolean checkWarnings) { doTest(LanguageLevel.JDK_1_5, JavaSdkVersion.JDK_1_6, checkWarnings); } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk6Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk6Test.java index 1d52f336b2f7..930860265462 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk6Test.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk6Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -31,7 +31,7 @@ public class LightAdvHighlightingJdk6Test extends LightDaemonAnalyzerTestCase { super.setUp(); enableInspectionTools(new UnusedDeclarationInspection(), new UncheckedWarningLocalInspection(), new JavacQuirksInspection(), new RedundantCastInspection()); setLanguageLevel(LanguageLevel.JDK_1_6); - IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_6, getModule(), myTestRootDisposable); + IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_6, getModule(), getTestRootDisposable()); } private void doTest(boolean checkWarnings, boolean checkInfos) { diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java index 07bae515ea7d..e29a3ebf3081 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java @@ -46,7 +46,7 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase { super.setUp(); enableInspectionTools(new UnusedDeclarationInspection(), new UncheckedWarningLocalInspection(), new JavacQuirksInspection(), new RedundantCastInspection()); setLanguageLevel(LanguageLevel.JDK_1_7); - IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_7, getModule(), myTestRootDisposable); + IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_7, getModule(), getTestRootDisposable()); } private void doTest(boolean checkWarnings, boolean checkInfos, InspectionProfileEntry... inspections) { diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingTest.java index a389d9a5ab1c..8048bbfaaff8 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingTest.java @@ -199,7 +199,7 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase { public void testUnused() { doTest(true, false); } public void testQualifierBeforeClassName() { doTest(false, false); } public void testQualifiedSuper() { - IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_6, getModule(), myTestRootDisposable); + IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_6, getModule(), getTestRootDisposable()); doTest(false, false); } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/PsiAugmentProviderTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/PsiAugmentProviderTest.java index 801672bfe5f9..521b126f873e 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/PsiAugmentProviderTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/PsiAugmentProviderTest.java @@ -39,7 +39,7 @@ public class PsiAugmentProviderTest extends LightCodeInsightFixtureTestCase { @Override public void setUp() throws Exception { super.setUp(); - PlatformTestUtil.registerExtension(PsiAugmentProvider.EP_NAME, new TestAugmentProvider(), myTestRootDisposable); + PlatformTestUtil.registerExtension(PsiAugmentProvider.EP_NAME, new TestAugmentProvider(), getTestRootDisposable()); myFixture.addClass("package lombok;\npublic @interface val { }"); } 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 4180debcb29a..d88664a0cbd5 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 @@ -58,7 +58,10 @@ import com.intellij.lang.annotation.ExternalAnnotator; import com.intellij.lang.annotation.HighlightSeverity; import com.intellij.lang.java.JavaLanguage; import com.intellij.openapi.Disposable; -import com.intellij.openapi.actionSystem.*; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.CommonDataKeys; +import com.intellij.openapi.actionSystem.DataContext; +import com.intellij.openapi.actionSystem.IdeActions; import com.intellij.openapi.actionSystem.impl.SimpleDataContext; import com.intellij.openapi.application.AccessToken; import com.intellij.openapi.application.ApplicationManager; @@ -883,7 +886,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase { } }; LineMarkerProviders.INSTANCE.addExplicitExtension(JavaLanguage.INSTANCE, provider); - Disposer.register(myTestRootDisposable, () -> LineMarkerProviders.INSTANCE.removeExplicitExtension(JavaLanguage.INSTANCE, provider)); + Disposer.register(getTestRootDisposable(), () -> LineMarkerProviders.INSTANCE.removeExplicitExtension(JavaLanguage.INSTANCE, provider)); myDaemonCodeAnalyzer.restart(); try { TextRange range = FileStatusMap.getDirtyTextRange(getEditor(), Pass.UPDATE_ALL); @@ -2194,7 +2197,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase { } }; IntentionManager.getInstance().addAction(longLongUpdate); - Disposer.register(myTestRootDisposable, () -> IntentionManager.getInstance().unregisterIntention(longLongUpdate)); + Disposer.register(getTestRootDisposable(), () -> IntentionManager.getInstance().unregisterIntention(longLongUpdate)); configureByText(JavaFileType.INSTANCE, "class X { }"); makeEditorWindowVisible(new Point(0, 0)); doHighlighting(); @@ -2221,7 +2224,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase { ((EditorImpl)myEditor).getScrollPane().getViewport().setSize(1000, 1000); final Set visibleHints = ContainerUtil.newIdentityTroveSet(); - getProject().getMessageBus().connect(myTestRootDisposable).subscribe(EditorHintListener.TOPIC, new EditorHintListener() { + getProject().getMessageBus().connect(getTestRootDisposable()).subscribe(EditorHintListener.TOPIC, new EditorHintListener() { @Override public void hintShown(final Project project, final LightweightHint hint, final int flags) { visibleHints.add(hint); diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlighting8Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlighting8Test.java index 82d2f2e7151f..6cf13ad22cb9 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlighting8Test.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlighting8Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -803,7 +803,7 @@ public class GenericsHighlighting8Test extends LightDaemonAnalyzerTestCase { private void doTest(boolean warnings) { LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject()).setLanguageLevel(LanguageLevel.JDK_1_8); - IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), myTestRootDisposable); + IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable()); doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, false); } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlightingGenerated8Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlightingGenerated8Test.java index 383d3deb0ee9..020befac8ee1 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlightingGenerated8Test.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlightingGenerated8Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -43,7 +43,7 @@ public class GenericsHighlightingGenerated8Test extends LightDaemonAnalyzerTestC private void doTest() { LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject()).setLanguageLevel(LanguageLevel.JDK_1_8); - IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), myTestRootDisposable); + IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable()); doTest(BASE_PATH + "/" + getTestName(false) + ".java", false, false); } } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/ReplaceWithOfNullableFixTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/ReplaceWithOfNullableFixTest.java index 9c5c07013b7e..8df4cf22e5c5 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/ReplaceWithOfNullableFixTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/ReplaceWithOfNullableFixTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -45,7 +45,7 @@ public class ReplaceWithOfNullableFixTest extends LightQuickFixParameterizedTest @Override protected void beforeActionStarted(String testName, String contents) { if (testName.contains("Guava")) { - ReplaceFromOfNullableFixTest.addGuavaOptional(myTestRootDisposable); + ReplaceFromOfNullableFixTest.addGuavaOptional(getTestRootDisposable()); } super.beforeActionStarted(testName, contents); } diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/CanBeFinalTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/CanBeFinalTest.java index d48fd3263215..859e985f80a4 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/CanBeFinalTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/CanBeFinalTest.java @@ -1,3 +1,19 @@ +/* + * 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. + */ + /* * Created by IntelliJ IDEA. * User: max @@ -11,7 +27,6 @@ package com.intellij.codeInspection; import com.intellij.JavaTestUtil; import com.intellij.codeInsight.daemon.ImplicitUsageProvider; import com.intellij.codeInspection.canBeFinal.CanBeFinalInspection; -import com.intellij.openapi.extensions.Extensions; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiField; import com.intellij.psi.PsiNamedElement; @@ -143,7 +158,7 @@ public class CanBeFinalTest extends InspectionTestCase { public boolean isImplicitWrite(PsiElement element) { return element instanceof PsiField && "implicitWrite".equals(((PsiNamedElement)element).getName()); } - }, myTestRootDisposable); + }, getTestRootDisposable()); doTest(); } diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspection8Test.java b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspection8Test.java index a382393b7fec..653a90b39d81 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspection8Test.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspection8Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -75,7 +75,7 @@ public class DataFlowInspection8Test extends DataFlowInspectionTestCase { NullableNotNullManager nnnManager = NullableNotNullManager.getInstance(getProject()); nnnManager.setNotNulls("foo.NotNull"); nnnManager.setNullables("foo.Nullable"); - Disposer.register(myTestRootDisposable, () -> { + Disposer.register(getTestRootDisposable(), () -> { nnnManager.setNotNulls(); nnnManager.setNullables(); }); diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/MagicConstantInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/MagicConstantInspectionTest.java index 7cf6062df848..8588e37d1fbf 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/MagicConstantInspectionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/MagicConstantInspectionTest.java @@ -57,7 +57,7 @@ public class MagicConstantInspectionTest extends InspectionTestCase { protected void setUp() throws Exception { super.setUp(); myFilter = new FileTreeAccessFilter(); - PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(myFilter, myTestRootDisposable); + PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(myFilter, getTestRootDisposable()); } @Override diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/NullableStuffInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/NullableStuffInspectionTest.java index 4a27815e27d2..4747a86311e8 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/NullableStuffInspectionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/NullableStuffInspectionTest.java @@ -1,3 +1,19 @@ +/* + * 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. + */ + /* * Created by IntelliJ IDEA. * User: Alexey @@ -127,7 +143,7 @@ public class NullableStuffInspectionTest extends LightCodeInsightFixtureTestCase final NullableNotNullManager nnnManager = NullableNotNullManager.getInstance(getProject()); nnnManager.setNullables("custom.CheckForNull"); - Disposer.register(myTestRootDisposable, new Disposable() { + Disposer.register(getTestRootDisposable(), new Disposable() { @Override public void dispose() { nnnManager.setNullables(); diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/RedundantSuppressTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/RedundantSuppressTest.java index 2e41a4d960d6..69b4b7c3a794 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/RedundantSuppressTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/RedundantSuppressTest.java @@ -1,8 +1,25 @@ +/* + * 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. + */ package com.intellij.codeInspection; import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection; import com.intellij.codeInspection.emptyMethod.EmptyMethodInspection; -import com.intellij.codeInspection.ex.*; +import com.intellij.codeInspection.ex.GlobalInspectionToolWrapper; +import com.intellij.codeInspection.ex.InspectionToolWrapper; +import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; import com.intellij.codeInspection.i18n.I18nInspection; import com.intellij.psi.PsiElement; import com.intellij.psi.impl.source.tree.injected.MyTestInjector; @@ -55,7 +72,7 @@ public class RedundantSuppressTest extends InspectionTestCase { public void testInjections() throws Exception { MyTestInjector testInjector = new MyTestInjector(getPsiManager()); - testInjector.injectAll(myTestRootDisposable); + testInjector.injectAll(getTestRootDisposable()); doTest(); } diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/RedundantTypeArgsInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/RedundantTypeArgsInspectionTest.java index fbcdfd0e14c4..88c33f2b0d55 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/RedundantTypeArgsInspectionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/RedundantTypeArgsInspectionTest.java @@ -1,3 +1,19 @@ +/* + * 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. + */ + /* * User: anna * Date: 19-Apr-2010 @@ -10,8 +26,6 @@ import com.intellij.codeInspection.miscGenerics.RedundantTypeArgsInspection; import com.intellij.openapi.projectRoots.JavaSdkVersion; import com.intellij.pom.java.LanguageLevel; import com.intellij.testFramework.IdeaTestUtil; -import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; -import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase; import org.jetbrains.annotations.NotNull; public class RedundantTypeArgsInspectionTest extends LightDaemonAnalyzerTestCase { @@ -34,7 +48,7 @@ public class RedundantTypeArgsInspectionTest extends LightDaemonAnalyzerTestCase } private void doTest() throws Throwable { - IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_6, getModule(), myTestRootDisposable); + IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_6, getModule(), getTestRootDisposable()); doTest("/inspection/redundantTypeArgs/" + getTestName(false) + ".java", true, false); } diff --git a/java/java-tests/testSrc/com/intellij/find/FindInEditorTest.java b/java/java-tests/testSrc/com/intellij/find/FindInEditorTest.java index 6a469b3b3260..39ac4dfa709b 100644 --- a/java/java-tests/testSrc/com/intellij/find/FindInEditorTest.java +++ b/java/java-tests/testSrc/com/intellij/find/FindInEditorTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -45,7 +45,7 @@ public class FindInEditorTest extends LightCodeInsightTestCase { myOutputStream = new ByteArrayOutputStream(); LivePreview.ourTestOutput = new PrintStream(myOutputStream); EditorHintListener listener = (project, hint, flags) -> LivePreview.processNotFound(); - ApplicationManager.getApplication().getMessageBus().connect(myTestRootDisposable).subscribe(EditorHintListener.TOPIC, listener); + ApplicationManager.getApplication().getMessageBus().connect(getTestRootDisposable()).subscribe(EditorHintListener.TOPIC, listener); } private void initFind() { diff --git a/java/java-tests/testSrc/com/intellij/projectView/ProjectTreeStructureTest.java b/java/java-tests/testSrc/com/intellij/projectView/ProjectTreeStructureTest.java index 017f1d310ba1..46fb031dd4bd 100644 --- a/java/java-tests/testSrc/com/intellij/projectView/ProjectTreeStructureTest.java +++ b/java/java-tests/testSrc/com/intellij/projectView/ProjectTreeStructureTest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ package com.intellij.projectView; import com.intellij.openapi.module.Module; @@ -127,7 +142,7 @@ public class ProjectTreeStructureTest extends BaseProjectViewTestCase { ModuleManagerImpl.getInstanceImpl(myProject).setModuleGroupPath(module, new String[]{"modules"}); PsiTestUtil.addContentRoot(module, mainModuleRoot.findFileByRelativePath("src/com/package1/p2/p3")); - TestProjectTreeStructure structure = new TestProjectTreeStructure(myProject, myTestRootDisposable); + TestProjectTreeStructure structure = new TestProjectTreeStructure(myProject, getTestRootDisposable()); structure.setShowLibraryContents(false); String structureContent = PlatformTestUtil.print(structure, structure.getRootElement(), 0, null, 10, ' ', myPrintInfo).toString(); diff --git a/java/java-tests/testSrc/com/intellij/psi/ModifyAnnotationsTest.java b/java/java-tests/testSrc/com/intellij/psi/ModifyAnnotationsTest.java index e9d03cf7b4b6..21a8c74684e8 100644 --- a/java/java-tests/testSrc/com/intellij/psi/ModifyAnnotationsTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/ModifyAnnotationsTest.java @@ -41,7 +41,7 @@ public class ModifyAnnotationsTest extends PsiTestCase { public void testReplaceAnnotation() throws Exception { //be sure not to load tree - PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.ALL, myTestRootDisposable); + PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.ALL, getTestRootDisposable()); PsiClass aClass = myJavaFacade.findClass("Test", GlobalSearchScope.allScope(myProject)); assertNotNull(aClass); final PsiAnnotation[] annotations = aClass.getModifierList().getAnnotations(); @@ -49,7 +49,7 @@ public class ModifyAnnotationsTest extends PsiTestCase { assertEquals("A", annotations[0].getNameReferenceElement().getReferenceName()); final PsiAnnotation newAnnotation = myJavaFacade.getElementFactory().createAnnotationFromText("@B", null); //here the tree is going to be loaded - PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, myTestRootDisposable); + PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, getTestRootDisposable()); CommandProcessor.getInstance().executeCommand(myProject, () -> WriteCommandAction.runWriteCommandAction(null, () -> { try { annotations[0].replace(newAnnotation); diff --git a/java/java-tests/testSrc/com/intellij/psi/Src15RepositoryUseTest.java b/java/java-tests/testSrc/com/intellij/psi/Src15RepositoryUseTest.java index 7a1577548608..e7b3885234b6 100644 --- a/java/java-tests/testSrc/com/intellij/psi/Src15RepositoryUseTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/Src15RepositoryUseTest.java @@ -299,7 +299,7 @@ public class Src15RepositoryUseTest extends PsiTestCase { public boolean accept(final VirtualFile file) { return !"package-info.java".equals(file.getName()); } - }, myTestRootDisposable); + }, getTestRootDisposable()); final PsiClass annotationTypeClass = findClass("annotations.AnnotationType"); assertTrue(annotationTypeClass.isAnnotationType()); @@ -321,11 +321,11 @@ public class Src15RepositoryUseTest extends PsiTestCase { } private void setupLoadingFilter() { - PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.ALL, myTestRootDisposable); + PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.ALL, getTestRootDisposable()); } private void tearDownLoadingFilter() { - PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, myTestRootDisposable); + PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, getTestRootDisposable()); } @NotNull diff --git a/java/java-tests/testSrc/com/intellij/psi/SrcRepositoryUseTest.java b/java/java-tests/testSrc/com/intellij/psi/SrcRepositoryUseTest.java index 3d0aab8f0542..88239ad2e4db 100644 --- a/java/java-tests/testSrc/com/intellij/psi/SrcRepositoryUseTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/SrcRepositoryUseTest.java @@ -585,11 +585,11 @@ public class SrcRepositoryUseTest extends PsiTestCase{ } private void teardownLoadingFilter() { - PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, myTestRootDisposable); + PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, getTestRootDisposable()); } private void setupLoadingFilter() { - PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.ALL, myTestRootDisposable); + PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.ALL, getTestRootDisposable()); } public void testAnonymousClass2() throws Exception { diff --git a/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/PsiEventsTest.java b/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/PsiEventsTest.java index 98e99059211a..0cb3282622b9 100644 --- a/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/PsiEventsTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/PsiEventsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -781,7 +781,7 @@ public class PsiEventsTest extends PsiTestCase { public void propertyChanged(@NotNull PsiTreeChangeEvent event) { checkCommitted(true, event); } - }, myTestRootDisposable); + }, getTestRootDisposable()); PsiDocumentManager documentManager = PsiDocumentManager.getInstance(getProject()); Document document = documentManager.getDocument(getFile()); diff --git a/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveClassTest.java b/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveClassTest.java index 21e7aa9fdd04..81ef00ffdbbb 100644 --- a/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveClassTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveClassTest.java @@ -236,7 +236,7 @@ public class ResolveClassTest extends ResolveTestCase { } public void testQualifiedAnonymousClass() throws Exception { - RecursionManager.assertOnRecursionPrevention(myTestRootDisposable); + RecursionManager.assertOnRecursionPrevention(getTestRootDisposable()); PsiReference ref = configure(); VirtualFile file = ref.getElement().getContainingFile().getVirtualFile(); diff --git a/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveMethod15Test.java b/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveMethod15Test.java index 983efed50466..72e62ae63cd5 100644 --- a/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveMethod15Test.java +++ b/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveMethod15Test.java @@ -1,3 +1,18 @@ +/* + * 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. + */ package com.intellij.psi.resolve; import com.intellij.navigation.NavigationItem; @@ -243,7 +258,7 @@ public class ResolveMethod15Test extends Resolve15TestCase { assertTrue(!((PsiMethod) element).isVarArgs()); } public void testFilterFixedVsVarargs9() throws Exception { - RecursionManager.assertOnRecursionPrevention(myTestRootDisposable); + RecursionManager.assertOnRecursionPrevention(getTestRootDisposable()); final PsiReference ref = configureByFile(); assertThat(ref, instanceOf(PsiReferenceExpression.class)); @@ -488,7 +503,7 @@ public class ResolveMethod15Test extends Resolve15TestCase { } public void testInheritance4() throws Exception{ - RecursionManager.assertOnRecursionPrevention(myTestRootDisposable); + RecursionManager.assertOnRecursionPrevention(getTestRootDisposable()); PsiReference ref = configureByFile(); PsiElement target = ref.resolve(); diff --git a/java/java-tests/testSrc/com/intellij/refactoring/AbstractJavaInplaceIntroduceTest.java b/java/java-tests/testSrc/com/intellij/refactoring/AbstractJavaInplaceIntroduceTest.java index c7a6d9112f3c..d8ccf02640bf 100644 --- a/java/java-tests/testSrc/com/intellij/refactoring/AbstractJavaInplaceIntroduceTest.java +++ b/java/java-tests/testSrc/com/intellij/refactoring/AbstractJavaInplaceIntroduceTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * 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. @@ -26,7 +26,6 @@ import com.intellij.psi.PsiReferenceExpression; import com.intellij.psi.impl.source.tree.injected.MyTestInjector; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.refactoring.introduce.inplace.AbstractInplaceIntroducer; -import com.intellij.testFramework.IdeaTestCase; import com.intellij.testFramework.IdeaTestUtil; import com.intellij.testFramework.LightPlatformTestCase; import org.jetbrains.annotations.NotNull; @@ -84,7 +83,7 @@ public abstract class AbstractJavaInplaceIntroduceTest extends AbstractInplaceIn protected void doTestInsideInjection(final Pass pass) { MyTestInjector testInjector = new MyTestInjector(getPsiManager()); - testInjector.injectAll(myTestRootDisposable); + testInjector.injectAll(getTestRootDisposable()); doTest(pass); } diff --git a/java/java-tests/testSrc/com/intellij/roots/RootsChangedTest.java b/java/java-tests/testSrc/com/intellij/roots/RootsChangedTest.java index 28de3f097ae1..1648e6b42eb4 100644 --- a/java/java-tests/testSrc/com/intellij/roots/RootsChangedTest.java +++ b/java/java-tests/testSrc/com/intellij/roots/RootsChangedTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -49,7 +49,7 @@ public class RootsChangedTest extends ModuleTestCase { @Override protected void setUp() throws Exception { super.setUp(); - MessageBusConnection connection = myProject.getMessageBus().connect(myTestRootDisposable); + MessageBusConnection connection = myProject.getMessageBus().connect(getTestRootDisposable()); myModuleRootListener = new MyModuleRootListener(); connection.subscribe(ProjectTopics.PROJECT_ROOTS, myModuleRootListener); } diff --git a/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java b/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java index 854e65f002dd..e1c97dfa9cfe 100644 --- a/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java +++ b/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java @@ -50,7 +50,6 @@ import com.intellij.psi.impl.source.PostprocessReformattingAspect; import com.intellij.psi.search.ProjectScope; import com.intellij.testFramework.*; import com.intellij.util.ArrayUtil; -import com.intellij.util.Function; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -124,7 +123,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase { } private void allowRootAccess(final String filePath) { - VfsRootAccess.allowRootAccess(myTestRootDisposable, filePath); + VfsRootAccess.allowRootAccess(getTestRootDisposable(), filePath); } protected VirtualFile configureByFile(String filePath, @Nullable String projectRoot) throws Exception { diff --git a/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java b/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java index 6cb743768282..b5be6dd83c7f 100644 --- a/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java +++ b/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java @@ -50,7 +50,6 @@ import com.intellij.openapi.module.Module; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ModuleRootManager; import com.intellij.openapi.startup.StartupManager; -import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.io.FileUtil; @@ -250,7 +249,7 @@ public abstract class DaemonAnalyzerTestCase extends CodeInsightTestCase { data.init(); PsiDocumentManager.getInstance(myProject).commitAllDocuments(); - PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(myVirtualFileFilter, myTestRootDisposable); + PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(myVirtualFileFilter, getTestRootDisposable()); try { Collection infos = doHighlighting(); @@ -261,7 +260,7 @@ public abstract class DaemonAnalyzerTestCase extends CodeInsightTestCase { return infos; } finally { - PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, myTestRootDisposable); + PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, getTestRootDisposable()); } } diff --git a/java/testFramework/src/com/intellij/codeInsight/daemon/LightDaemonAnalyzerTestCase.java b/java/testFramework/src/com/intellij/codeInsight/daemon/LightDaemonAnalyzerTestCase.java index ab439829ce9a..6545648813f3 100644 --- a/java/testFramework/src/com/intellij/codeInsight/daemon/LightDaemonAnalyzerTestCase.java +++ b/java/testFramework/src/com/intellij/codeInsight/daemon/LightDaemonAnalyzerTestCase.java @@ -89,7 +89,7 @@ public abstract class LightDaemonAnalyzerTestCase extends LightCodeInsightTestCa } protected void doTestConfiguredFile(boolean checkWarnings, boolean checkWeakWarnings, boolean checkInfos, @Nullable String filePath) { - PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, myTestRootDisposable); + PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, getTestRootDisposable()); ExpectedHighlightingData data = getExpectedHighlightingData(checkWarnings, checkWeakWarnings, checkInfos); checkHighlighting(data, composeLocalPath(filePath)); @@ -110,7 +110,7 @@ public abstract class LightDaemonAnalyzerTestCase extends LightCodeInsightTestCa PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); getFile().getText(); //to load text myJavaFilesFilter.allowTreeAccessForFile(getVFile()); - PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(myJavaFilesFilter, myTestRootDisposable); + PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(myJavaFilesFilter, getTestRootDisposable()); try { Collection infos = doHighlighting(); @@ -118,7 +118,7 @@ public abstract class LightDaemonAnalyzerTestCase extends LightCodeInsightTestCa data.checkResult(infos, getEditor().getDocument().getText(), filePath); } finally { - PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, myTestRootDisposable); + PsiManagerEx.getInstanceEx(getProject()).setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, getTestRootDisposable()); } } diff --git a/java/testFramework/src/com/intellij/projectView/BaseProjectViewTestCase.java b/java/testFramework/src/com/intellij/projectView/BaseProjectViewTestCase.java index c578c7cffd8e..70fec7bcf19f 100644 --- a/java/testFramework/src/com/intellij/projectView/BaseProjectViewTestCase.java +++ b/java/testFramework/src/com/intellij/projectView/BaseProjectViewTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -20,16 +20,13 @@ import com.intellij.ide.projectView.impl.AbstractProjectTreeStructure; import com.intellij.ide.projectView.impl.ClassesTreeStructureProvider; import com.intellij.ide.projectView.impl.nodes.PackageElementNode; import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode; -import com.intellij.ide.util.treeView.AbstractTreeNode; import com.intellij.ide.util.treeView.AbstractTreeStructure; import com.intellij.openapi.application.ex.PathManagerEx; import com.intellij.openapi.ui.Queryable; -import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiDirectory; import com.intellij.testFramework.PlatformTestUtil; import com.intellij.testFramework.ProjectViewTestUtil; import com.intellij.testFramework.TestSourceBasedTestCase; -import com.intellij.util.Function; import org.jetbrains.annotations.NonNls; import javax.swing.*; @@ -43,7 +40,7 @@ public abstract class BaseProjectViewTestCase extends TestSourceBasedTestCase { protected void setUp() throws Exception { super.setUp(); - myStructure = new TestProjectTreeStructure(myProject, myTestRootDisposable); + myStructure = new TestProjectTreeStructure(myProject, getTestRootDisposable()); } @Override diff --git a/json/tests/test/com/intellij/json/JsonLiveTemplateTest.java b/json/tests/test/com/intellij/json/JsonLiveTemplateTest.java index c4b0822d8131..c6fc841d3b0c 100644 --- a/json/tests/test/com/intellij/json/JsonLiveTemplateTest.java +++ b/json/tests/test/com/intellij/json/JsonLiveTemplateTest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ package com.intellij.json; import com.intellij.codeInsight.lookup.Lookup; @@ -36,7 +51,7 @@ public class JsonLiveTemplateTest extends JsonTestCase { assertNotNull(context); ((TemplateImpl)template).getTemplateContext().setEnabled(context, true); - CodeInsightTestUtil.addTemplate(template, myTestRootDisposable); + CodeInsightTestUtil.addTemplate(template, getTestRootDisposable()); return template; } diff --git a/json/tests/test/com/jetbrains/jsonSchema/JsonSchemaDocumentationTest.java b/json/tests/test/com/jetbrains/jsonSchema/JsonSchemaDocumentationTest.java index e437f05bc97d..5c1bbaf854a5 100644 --- a/json/tests/test/com/jetbrains/jsonSchema/JsonSchemaDocumentationTest.java +++ b/json/tests/test/com/jetbrains/jsonSchema/JsonSchemaDocumentationTest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ package com.jetbrains.jsonSchema; import com.intellij.codeInsight.documentation.DocumentationManager; @@ -43,7 +58,7 @@ public class JsonSchemaDocumentationTest extends LightPlatformCodeInsightFixture JsonSchemaHighlightingTest.registerProvider(getProject(), schemaText); final JsonSchemaDocumentationProvider provider = new JsonSchemaDocumentationProvider(); LanguageDocumentation.INSTANCE.addExplicitExtension(JsonLanguage.INSTANCE, provider); - Disposer.register(myTestRootDisposable, new Disposable() { + Disposer.register(getTestRootDisposable(), new Disposable() { @Override public void dispose() { LanguageDocumentation.INSTANCE.removeExplicitExtension(JsonLanguage.INSTANCE, provider); diff --git a/json/tests/test/com/jetbrains/jsonSchema/JsonSchemaHighlightingTest.java b/json/tests/test/com/jetbrains/jsonSchema/JsonSchemaHighlightingTest.java index 020c5b4d615e..e07730d73567 100644 --- a/json/tests/test/com/jetbrains/jsonSchema/JsonSchemaHighlightingTest.java +++ b/json/tests/test/com/jetbrains/jsonSchema/JsonSchemaHighlightingTest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ package com.jetbrains.jsonSchema; import com.intellij.codeInsight.daemon.DaemonAnalyzerTestCase; @@ -291,7 +306,7 @@ public class JsonSchemaHighlightingTest extends DaemonAnalyzerTestCase { registerProvider(getProject(), schema); LanguageAnnotators.INSTANCE.addExplicitExtension(JsonLanguage.INSTANCE, annotator); - Disposer.register(myTestRootDisposable, new Disposable() { + Disposer.register(getTestRootDisposable(), new Disposable() { @Override public void dispose() { LanguageAnnotators.INSTANCE.removeExplicitExtension(JsonLanguage.INSTANCE, annotator); diff --git a/platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/service/project/ExternalProjectServiceTest.groovy b/platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/service/project/ExternalProjectServiceTest.groovy index 4a9e23e7af20..da799ea0438d 100644 --- a/platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/service/project/ExternalProjectServiceTest.groovy +++ b/platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/service/project/ExternalProjectServiceTest.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -205,7 +205,7 @@ public class ExternalProjectServiceTest extends AbstractExternalSystemTest { List allowedRoots = new ArrayList(); allowedRoots.add(myJdkHome); allowedRoots.addAll(collectRootsInside(myJdkHome)); - VfsRootAccess.allowRootAccess(myTestRootDisposable, ArrayUtil.toStringArray(allowedRoots)); + VfsRootAccess.allowRootAccess(testRootDisposable, ArrayUtil.toStringArray(allowedRoots)); new WriteAction() { @Override diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/SelectUnselectOccurrenceActionsTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/SelectUnselectOccurrenceActionsTest.java index 2bab6a25686e..cf82305e0d4a 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/SelectUnselectOccurrenceActionsTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/SelectUnselectOccurrenceActionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -38,7 +38,7 @@ public class SelectUnselectOccurrenceActionsTest extends LightPlatformCodeInsigh hintCount++; } }; - ApplicationManager.getApplication().getMessageBus().connect(myTestRootDisposable).subscribe(EditorHintListener.TOPIC, listener); + ApplicationManager.getApplication().getMessageBus().connect(getTestRootDisposable()).subscribe(EditorHintListener.TOPIC, listener); } public void testAllWithoutInitialSelection() throws Exception { diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorImplTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorImplTest.java index 6f80ee23c22a..0a0191ed796f 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorImplTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorImplTest.java @@ -375,7 +375,7 @@ public class EditorImplTest extends AbstractEditorTest { } } }; - getProject().getMessageBus().connect(myTestRootDisposable).subscribe(DocumentBulkUpdateListener.TOPIC, listener); + getProject().getMessageBus().connect(getTestRootDisposable()).subscribe(DocumentBulkUpdateListener.TOPIC, listener); initText("abcdef"); DocumentEx document = (DocumentEx)myEditor.getDocument(); new WriteCommandAction.Simple(getProject()) { diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/NonProjectFileAccessTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/NonProjectFileAccessTest.java index d1e9b6666b24..861facf7fe3a 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/NonProjectFileAccessTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/NonProjectFileAccessTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -60,7 +60,7 @@ public class NonProjectFileAccessTest extends HeavyFileEditorManagerTestCase { super.setUp(); EditorNotifications notifications = new EditorNotificationsImpl(getProject()); ((ComponentManagerImpl)getProject()).registerComponentInstance(EditorNotifications.class, notifications); - NonProjectFileWritingAccessProvider.enableChecksInTests(myTestRootDisposable); + NonProjectFileWritingAccessProvider.enableChecksInTests(getTestRootDisposable()); ProjectManagerEx.getInstanceEx().blockReloadingProjectOnExternalChanges(); } @@ -322,7 +322,7 @@ public class NonProjectFileAccessTest extends HeavyFileEditorManagerTestCase { public boolean isPotentiallyWritable(@NotNull VirtualFile file) { return true; } - }, myTestRootDisposable); + }, getTestRootDisposable()); return requested; } @@ -339,7 +339,7 @@ public class NonProjectFileAccessTest extends HeavyFileEditorManagerTestCase { return filesToDeny.contains(file); } }, - myTestRootDisposable); + getTestRootDisposable()); } @NotNull diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/impl/FileTypesTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/impl/FileTypesTest.java index 9d1d3cf2407c..578e2084f7fb 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/impl/FileTypesTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/impl/FileTypesTest.java @@ -596,7 +596,7 @@ public class FileTypesTest extends PlatformTestCase { } public void _testStressPlainTextFileWithEverIncreasingLength() throws IOException, InterruptedException { - FrequentEventDetector.disableUntil(myTestRootDisposable); + FrequentEventDetector.disableUntil(getTestRootDisposable()); File f = createTempFile("xx.lkjlkjlkjlj", "a"); VirtualFile virtualFile = getVirtualFile(f); @@ -658,7 +658,7 @@ public class FileTypesTest extends PlatformTestCase { } public void _testStressPlainTextFileWithEverIncreasingLength2() throws IOException, InterruptedException { - FrequentEventDetector.disableUntil(myTestRootDisposable); + FrequentEventDetector.disableUntil(getTestRootDisposable()); File f = createTempFile("xx.asdkjfhlkasjdhf", StringUtil.repeatSymbol(' ', (int)PersistentFSConstants.FILE_LENGTH_TO_CACHE_THRESHOLD - 100)); VirtualFile virtualFile = getVirtualFile(f); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/progress/impl/ProgressIndicatorTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/progress/impl/ProgressIndicatorTest.java index 230c21c64c6f..7daea1cb009c 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/progress/impl/ProgressIndicatorTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/progress/impl/ProgressIndicatorTest.java @@ -268,7 +268,7 @@ public class ProgressIndicatorTest extends LightPlatformTestCase { private void ensureCheckCanceledCalled(@NotNull ProgressIndicator indicator) { myFlag = false; - Alarm alarm = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, myTestRootDisposable); + Alarm alarm = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, getTestRootDisposable()); alarm.addRequest(() -> myFlag = true, 100); final long start = System.currentTimeMillis(); try { diff --git a/platform/platform-tests/testSrc/com/intellij/platform/ProjectSetTest.java b/platform/platform-tests/testSrc/com/intellij/platform/ProjectSetTest.java index 31db5bf5e343..802a1d408fe1 100644 --- a/platform/platform-tests/testSrc/com/intellij/platform/ProjectSetTest.java +++ b/platform/platform-tests/testSrc/com/intellij/platform/ProjectSetTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -20,7 +20,6 @@ import com.google.gson.JsonParser; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.project.ex.ProjectManagerEx; -import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.Ref; import com.intellij.openapi.vcs.VcsCheckoutProcessor; @@ -38,7 +37,10 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; /** * @author Dmitry Avdeev @@ -61,7 +63,7 @@ public class ProjectSetTest extends LightPlatformTestCase { public void processEntries(@NotNull List> entries, @NotNull Context context, @NotNull Runnable runNext) { ref.set(entries); } - }, myTestRootDisposable); + }, getTestRootDisposable()); ProjectSetProcessor.Context context = new ProjectSetProcessor.Context(); context.directory = getSourceRoot(); @@ -89,7 +91,7 @@ public class ProjectSetTest extends LightPlatformTestCase { pairs.add(Pair.create(parameters.get("url"), directoryName)); return true; } - }, myTestRootDisposable); + }, getTestRootDisposable()); ProjectSetProcessor.Context context = new ProjectSetProcessor.Context(); context.directoryName = "newDir"; diff --git a/platform/platform-tests/testSrc/com/intellij/psi/impl/meta/MetaRegistryTest.java b/platform/platform-tests/testSrc/com/intellij/psi/impl/meta/MetaRegistryTest.java index ba2870adaa37..846c875c2bfb 100644 --- a/platform/platform-tests/testSrc/com/intellij/psi/impl/meta/MetaRegistryTest.java +++ b/platform/platform-tests/testSrc/com/intellij/psi/impl/meta/MetaRegistryTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -44,7 +44,7 @@ public class MetaRegistryTest extends LightPlatformTestCase { public boolean isClassAcceptable(Class hintClass) { return true; } - }, MyTrueMetaData.class, myTestRootDisposable); + }, MyTrueMetaData.class, getTestRootDisposable()); MetaRegistry.addMetadataBinding(new ElementFilter() { @Override public boolean isAcceptable(Object element, PsiElement context) { @@ -55,7 +55,7 @@ public class MetaRegistryTest extends LightPlatformTestCase { public boolean isClassAcceptable(Class hintClass) { return true; } - }, MyFalseMetaData.class, myTestRootDisposable); + }, MyFalseMetaData.class, getTestRootDisposable()); final XmlTag tag = ((XmlFile)LightPlatformTestCase.createFile("a.xml", "")).getDocument().getRootTag(); UsefulTestCase.assertInstanceOf(tag.getMetaData(), MyFalseMetaData.class); diff --git a/platform/testFramework/src/com/intellij/testFramework/PlatformLiteFixture.java b/platform/testFramework/src/com/intellij/testFramework/PlatformLiteFixture.java index f832e4b90ab6..f92bdaaba24d 100644 --- a/platform/testFramework/src/com/intellij/testFramework/PlatformLiteFixture.java +++ b/platform/testFramework/src/com/intellij/testFramework/PlatformLiteFixture.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -24,8 +24,6 @@ import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.extensions.ExtensionsArea; import com.intellij.openapi.fileTypes.FileTypeManager; -import com.intellij.openapi.fileTypes.FileTypeRegistry; -import com.intellij.openapi.util.Getter; import com.intellij.openapi.vfs.encoding.EncodingManager; import com.intellij.openapi.vfs.encoding.EncodingManagerImpl; import org.jetbrains.annotations.NotNull; @@ -73,7 +71,7 @@ public abstract class PlatformLiteFixture extends UsefulTestCase { registerExtensionPoint(area, name, (Class)t.getClass()); - PlatformTestUtil.registerExtension(area, name, t, myTestRootDisposable); + PlatformTestUtil.registerExtension(area, name, t, getTestRootDisposable()); } protected void registerExtensionPoint(final ExtensionPointName extensionPointName, final Class aClass) { diff --git a/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java b/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java index 77e27365c04d..76036affeb62 100644 --- a/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java @@ -92,7 +92,7 @@ public abstract class UsefulTestCase extends TestCase { private static final Map TOTAL_TEARDOWN_COST_MILLIS = new HashMap<>(); @NotNull - protected final Disposable myTestRootDisposable = new Disposable() { + private final Disposable myTestRootDisposable = new Disposable() { @Override public void dispose() { } @@ -152,7 +152,7 @@ public abstract class UsefulTestCase extends TestCase { @Override protected void tearDown() throws Exception { try { - Disposer.dispose(myTestRootDisposable); + Disposer.dispose(getTestRootDisposable()); cleanupSwingDataStructures(); cleanupDeleteOnExitHookList(); } @@ -716,7 +716,7 @@ public abstract class UsefulTestCase extends TestCase { } protected T disposeOnTearDown(final T disposable) { - Disposer.register(myTestRootDisposable, disposable); + Disposer.register(getTestRootDisposable(), disposable); return disposable; } diff --git a/platform/vcs-tests/testSrc/com/intellij/vcs/test/VcsPlatformTest.kt b/platform/vcs-tests/testSrc/com/intellij/vcs/test/VcsPlatformTest.kt index 162f55382acd..37ffb300f54d 100644 --- a/platform/vcs-tests/testSrc/com/intellij/vcs/test/VcsPlatformTest.kt +++ b/platform/vcs-tests/testSrc/com/intellij/vcs/test/VcsPlatformTest.kt @@ -133,7 +133,7 @@ abstract class VcsPlatformTest : PlatformTestCase() { } private fun enableDebugLogging(): String { - TestLoggerFactory.enableDebugLogging(myTestRootDisposable, *ArrayUtil.toStringArray(getDebugLogCategories())) + TestLoggerFactory.enableDebugLogging(testRootDisposable, *ArrayUtil.toStringArray(getDebugLogCategories())) val testStartedIndicator = createTestStartedIndicator() LOG.info(testStartedIndicator) return testStartedIndicator diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyDebuggerTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyDebuggerTest.groovy index 0836bd0d6047..a30de41e887e 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyDebuggerTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyDebuggerTest.groovy @@ -57,7 +57,7 @@ class GroovyDebuggerTest extends GroovyCompilerTestCase implements DebuggerMetho } private void enableDebugLogging() { - TestLoggerFactory.enableDebugLogging(myTestRootDisposable, + TestLoggerFactory.enableDebugLogging(testRootDisposable, "#com.intellij.debugger.engine.DebugProcessImpl", "#com.intellij.debugger.engine.DebugProcessEvents", "#org.jetbrains.plugins.groovy.compiler.GroovyDebuggerTest"); diff --git a/plugins/properties/testSrc/com/intellij/lang/properties/PropertiesProjectViewTest.java b/plugins/properties/testSrc/com/intellij/lang/properties/PropertiesProjectViewTest.java index 9417754ad4e0..5cb22a9ef9c1 100644 --- a/plugins/properties/testSrc/com/intellij/lang/properties/PropertiesProjectViewTest.java +++ b/plugins/properties/testSrc/com/intellij/lang/properties/PropertiesProjectViewTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * 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. @@ -30,7 +30,7 @@ public class PropertiesProjectViewTest extends LightPlatformCodeInsightFixtureTe @Override protected void setUp() throws Exception { super.setUp(); - myStructure = new TestProjectTreeStructure(getProject(), myTestRootDisposable); + myStructure = new TestProjectTreeStructure(getProject(), getTestRootDisposable()); } @Override diff --git a/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskManagerTest.java b/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskManagerTest.java index 416ad5f20f94..7d6ce8e094de 100644 --- a/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskManagerTest.java +++ b/plugins/tasks/tasks-tests/test/com/intellij/tasks/TaskManagerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -46,7 +46,7 @@ public class TaskManagerTest extends TaskManagerTestCase { count.set(count.get() + 1); } }; - myTaskManager.addTaskListener(listener, myTestRootDisposable); + myTaskManager.addTaskListener(listener, getTestRootDisposable()); LocalTask localTask = myTaskManager.createLocalTask("foo"); myTaskManager.activateTask(localTask, false); assertEquals(1, count.get().intValue()); diff --git a/plugins/tasks/tasks-tests/test/com/intellij/tasks/vcs/TaskBranchesTest.java b/plugins/tasks/tasks-tests/test/com/intellij/tasks/vcs/TaskBranchesTest.java index 944752198d1a..e72dfe803be1 100644 --- a/plugins/tasks/tasks-tests/test/com/intellij/tasks/vcs/TaskBranchesTest.java +++ b/plugins/tasks/tasks-tests/test/com/intellij/tasks/vcs/TaskBranchesTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -146,7 +146,7 @@ public abstract class TaskBranchesTest extends PlatformTestCase { String defaultBranchName = getDefaultBranchName(); LocalTaskImpl task = myTaskManager.createLocalTask("foo"); OpenTaskDialog dialog = new OpenTaskDialog(getProject(), task); - Disposer.register(myTestRootDisposable, dialog.getDisposable()); + Disposer.register(getTestRootDisposable(), dialog.getDisposable()); dialog.createTask(); assertEquals("foo", myTaskManager.getActiveTask().getSummary()); List branches = task.getBranches(true); diff --git a/python/testSrc/com/jetbrains/python/fixtures/PyMultiFileResolveTestCase.java b/python/testSrc/com/jetbrains/python/fixtures/PyMultiFileResolveTestCase.java index fe5d5bb52967..a41db1d88840 100644 --- a/python/testSrc/com/jetbrains/python/fixtures/PyMultiFileResolveTestCase.java +++ b/python/testSrc/com/jetbrains/python/fixtures/PyMultiFileResolveTestCase.java @@ -20,7 +20,6 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileFilter; import com.intellij.psi.*; import com.intellij.psi.impl.PsiManagerEx; -import com.intellij.util.Function; import com.intellij.util.containers.ContainerUtil; import com.jetbrains.python.PythonFileType; import com.jetbrains.python.PythonTestUtil; @@ -50,7 +49,7 @@ public abstract class PyMultiFileResolveTestCase extends PyResolveTestCase { FileType fileType = file.getFileType(); return fileType == PythonFileType.INSTANCE; } - }, myTestRootDisposable); + }, getTestRootDisposable()); final PsiElement result; if (ref instanceof PsiPolyVariantReference) { final ResolveResult[] resolveResults = ((PsiPolyVariantReference)ref).multiResolve(false); @@ -59,7 +58,7 @@ public abstract class PyMultiFileResolveTestCase extends PyResolveTestCase { else { result = ref.resolve(); } - psiManager.setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, myTestRootDisposable); + psiManager.setAssertOnFileLoadingFilter(VirtualFileFilter.NONE, getTestRootDisposable()); return result; } diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomConcurrencyStressTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomConcurrencyStressTest.java index 88faf95ea656..4f2a1bdcd755 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/DomConcurrencyStressTest.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/DomConcurrencyStressTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -49,7 +49,7 @@ public class DomConcurrencyStressTest extends DomTestCase { private static final int ITERATIONS = Timings.adjustAccordingToMySpeed(239, true); public void testInternalDomLocksReadConsistency() throws Throwable { - getDomManager().registerFileDescription(new DomFileDescription(MyElement.class, "a"), myTestRootDisposable); + getDomManager().registerFileDescription(new DomFileDescription(MyElement.class, "a"), getTestRootDisposable()); registerExtender(MyElement.class, MyExtender.class); @@ -111,7 +111,7 @@ public class DomConcurrencyStressTest extends DomTestCase { final DomExtenderEP extenderEP = new DomExtenderEP(); extenderEP.domClassName = elementClass.getName(); extenderEP.extenderClassName = extenderClass.getName(); - PlatformTestUtil.registerExtension(Extensions.getRootArea(), DomExtenderEP.EP_NAME, extenderEP, myTestRootDisposable); + PlatformTestUtil.registerExtension(Extensions.getRootArea(), DomExtenderEP.EP_NAME, extenderEP, getTestRootDisposable()); } private static void runThreads(int threadCount, final Runnable runnable) throws Throwable { @@ -187,7 +187,7 @@ public class DomConcurrencyStressTest extends DomTestCase { } public void testBigCustomFile() throws Throwable { - getDomManager().registerFileDescription(new DomFileDescription(MyAllCustomElement.class, "component"), myTestRootDisposable); + getDomManager().registerFileDescription(new DomFileDescription(MyAllCustomElement.class, "component"), getTestRootDisposable()); registerExtender(MyAllCustomElement.class, MyAllCustomExtender.class); diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomExtensionsTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomExtensionsTest.java index d1e980be2f5f..489a55438136 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/DomExtensionsTest.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/DomExtensionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -17,9 +17,7 @@ package com.intellij.util.xml; import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.util.Key; -import com.intellij.testFramework.IdeaTestUtil; import com.intellij.testFramework.PlatformTestUtil; -import com.intellij.util.Consumer; import com.intellij.util.ParameterizedTypeImpl; import com.intellij.util.ReflectionUtil; import com.intellij.util.xml.impl.DomTestCase; @@ -192,7 +190,7 @@ public class DomExtensionsTest extends DomTestCase { final DomExtenderEP extenderEP = new DomExtenderEP(); extenderEP.domClassName = domClass.getName(); extenderEP.extenderClassName = extenderClass.getName(); - PlatformTestUtil.registerExtension(Extensions.getRootArea(), DomExtenderEP.EP_NAME, extenderEP, myTestRootDisposable); + PlatformTestUtil.registerExtension(Extensions.getRootArea(), DomExtenderEP.EP_NAME, extenderEP, getTestRootDisposable()); } diff --git a/xml/dom-tests/tests/com/intellij/util/xml/impl/DomTestCase.java b/xml/dom-tests/tests/com/intellij/util/xml/impl/DomTestCase.java index ea38162e0f3d..298d49275ccb 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/impl/DomTestCase.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/impl/DomTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -49,7 +49,7 @@ public abstract class DomTestCase extends LightIdeaTestCase { protected void setUp() throws Exception { super.setUp(); myCallRegistry = new CallRegistry(); - getDomManager().addDomEventListener(myListener, myTestRootDisposable); + getDomManager().addDomEventListener(myListener, getTestRootDisposable()); } protected void assertCached(final DomElement element, final XmlElement xmlElement) { diff --git a/xml/dom-tests/tests/com/intellij/util/xml/stubs/DomStubBuilderTest.java b/xml/dom-tests/tests/com/intellij/util/xml/stubs/DomStubBuilderTest.java index 59f0d74e27a6..e88127948fcc 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/stubs/DomStubBuilderTest.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/stubs/DomStubBuilderTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -81,7 +81,7 @@ public class DomStubBuilderTest extends DomStubTest { DomExtenderEP ep = new DomExtenderEP(); ep.domClassName = Bar.class.getName(); ep.extenderClassName = TestExtender.class.getName(); - PlatformTestUtil.registerExtension(Extensions.getRootArea(), DomExtenderEP.EP_NAME, ep, myTestRootDisposable); + PlatformTestUtil.registerExtension(Extensions.getRootArea(), DomExtenderEP.EP_NAME, ep, getTestRootDisposable()); doBuilderTest("extender.xml", "File:foo\n" + " Element:foo\n" + diff --git a/xml/dom-tests/tests/com/intellij/util/xml/stubs/DomStubUsingTest.java b/xml/dom-tests/tests/com/intellij/util/xml/stubs/DomStubUsingTest.java index 76610f2fe3d2..a7b398a050a9 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/stubs/DomStubUsingTest.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/stubs/DomStubUsingTest.java @@ -122,7 +122,7 @@ public class DomStubUsingTest extends DomStubTest { public void testFileLoading() throws Exception { XmlFile file = prepareFile("foo.xml"); - ((PsiManagerEx)getPsiManager()).setAssertOnFileLoadingFilter(VirtualFileFilter.ALL, myTestRootDisposable); + ((PsiManagerEx)getPsiManager()).setAssertOnFileLoadingFilter(VirtualFileFilter.ALL, getTestRootDisposable()); DomFileElement element = DomManager.getDomManager(getProject()).getFileElement(file, Foo.class); assertNotNull(element); GenericDomValue id = element.getRootElement().getId(); diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlHighlightingTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlHighlightingTest.java index 412b24e8d8f7..9e5912d6ba1f 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlHighlightingTest.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlHighlightingTest.java @@ -40,18 +40,18 @@ public class RngXmlHighlightingTest extends HighlightingTestBase { ApplicationManager.getApplication().runWriteAction(() -> { final ExternalResourceManagerEx m = ExternalResourceManagerEx.getInstanceEx(); ExternalResourceManagerExImpl - .addTestResource("urn:test:simple.rng", toAbsolutePath("highlighting/simple.rng"), myTestRootDisposable); + .addTestResource("urn:test:simple.rng", toAbsolutePath("highlighting/simple.rng"), getTestRootDisposable()); ExternalResourceManagerExImpl.addTestResource("urn:test:addressBook", toAbsolutePath("highlighting/rnc/addressbook.rnc"), - myTestRootDisposable); + getTestRootDisposable()); //m.addResource("http://www.w3.org/1999/XSL/Transform", toAbsolutePath("highlighting/relaxng.rng")); ExternalResourceManagerExImpl.addTestResource("http://www.w3.org/1999/XSL/Format", toAbsolutePath("highlighting/rnc/fo/main.rnc"), - myTestRootDisposable); + getTestRootDisposable()); ExternalResourceManagerExImpl.addTestResource("http://docbook.org/ns/docbook", toAbsolutePath("highlighting/docbook.rng"), - myTestRootDisposable); + getTestRootDisposable()); ExternalResourceManagerExImpl.addTestResource("urn:intelliForm:AttachmentFilter", - toAbsolutePath("highlighting/attachment-filter.rng"), myTestRootDisposable); + toAbsolutePath("highlighting/attachment-filter.rng"), getTestRootDisposable()); ExternalResourceManagerExImpl - .addTestResource("http://www.w3.org/1999/xhtml", toAbsolutePath("highlighting/html5/xhtml5.rnc"), myTestRootDisposable); + .addTestResource("http://www.w3.org/1999/xhtml", toAbsolutePath("highlighting/html5/xhtml5.rnc"), getTestRootDisposable()); m.addIgnoredResource("urn:intelliForm:Spaces"); m.addIgnoredResource("http://www.w3.org/1999/xlink"); diff --git a/xml/tests/src/com/intellij/codeInsight/XmlEventsTest.java b/xml/tests/src/com/intellij/codeInsight/XmlEventsTest.java index f9b255862dc8..4194e078c584 100644 --- a/xml/tests/src/com/intellij/codeInsight/XmlEventsTest.java +++ b/xml/tests/src/com/intellij/codeInsight/XmlEventsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * 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. @@ -49,7 +49,7 @@ public class XmlEventsTest extends LightCodeInsightTestCase { private Listener addPomListener() { final PomModel model = PomManager.getModel(getProject()); final Listener listener = new Listener(model.getModelAspect(XmlAspect.class)); - model.addModelListener(listener,myTestRootDisposable); + model.addModelListener(listener, getTestRootDisposable()); return listener; } diff --git a/xml/tests/src/com/intellij/codeInsight/completion/XmlCompletionTest.java b/xml/tests/src/com/intellij/codeInsight/completion/XmlCompletionTest.java index 40cb6c29d392..8056b81e0abd 100644 --- a/xml/tests/src/com/intellij/codeInsight/completion/XmlCompletionTest.java +++ b/xml/tests/src/com/intellij/codeInsight/completion/XmlCompletionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * 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. @@ -78,7 +78,7 @@ public class XmlCompletionTest extends LightCodeInsightFixtureTestCase { return; } - ExternalResourceManagerExImpl.addTestResource(url, location, myTestRootDisposable); + ExternalResourceManagerExImpl.addTestResource(url, location, getTestRootDisposable()); } @Override From 88e2960b440103d40f46c6cc2e8d3de3c686d7d3 Mon Sep 17 00:00:00 2001 From: "Vassiliy.Kudryashov" Date: Tue, 19 Jul 2016 14:43:34 +0300 Subject: [PATCH 7/7] IDEA-156735 Bookmarks causing typing slowness --- .../com/intellij/ide/bookmarks/Bookmark.java | 71 ++++++++++++------- 1 file changed, 46 insertions(+), 25 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/bookmarks/Bookmark.java b/platform/lang-impl/src/com/intellij/ide/bookmarks/Bookmark.java index 4836d1265948..6782c8cc545e 100644 --- a/platform/lang-impl/src/com/intellij/ide/bookmarks/Bookmark.java +++ b/platform/lang-impl/src/com/intellij/ide/bookmarks/Bookmark.java @@ -49,17 +49,19 @@ import com.intellij.pom.Navigatable; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiManager; +import com.intellij.reference.SoftReference; import com.intellij.ui.ColorUtil; import com.intellij.ui.JBColor; import com.intellij.ui.RetrievableIcon; -import com.intellij.util.NotNullProducer; import com.intellij.util.PlatformIcons; -import com.intellij.util.Processor; +import com.intellij.util.containers.WeakHashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; +import java.lang.ref.Reference; +import java.lang.ref.WeakReference; public class Bookmark implements Navigatable, Comparable { public static final Icon DEFAULT_ICON = new MyCheckedIcon(); @@ -67,6 +69,7 @@ public class Bookmark implements Navigatable, Comparable { private final VirtualFile myFile; @NotNull private OpenFileDescriptor myTarget; private final Project myProject; + private WeakHashMap> myHighlighterRefs; private String myDescription; private char myMnemonic = 0; @@ -106,33 +109,37 @@ public class Bookmark implements Navigatable, Comparable { } public RangeHighlighter createHighlighter(@NotNull MarkupModelEx markup) { - final RangeHighlighterEx myHighlighter; + final RangeHighlighterEx highlighter; int line = getLine(); if (line >= 0) { - myHighlighter = markup.addPersistentLineHighlighter(line, HighlighterLayer.ERROR + 1, null); - if (myHighlighter != null) { - myHighlighter.setGutterIconRenderer(new MyGutterIconRenderer(this)); + highlighter = markup.addPersistentLineHighlighter(line, HighlighterLayer.ERROR + 1, null); + if (highlighter != null) { + highlighter.setGutterIconRenderer(new MyGutterIconRenderer(this)); TextAttributes textAttributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.BOOKMARKS_ATTRIBUTES); Color stripeColor = textAttributes.getErrorStripeColor(); - myHighlighter.setErrorStripeMarkColor(stripeColor != null ? stripeColor : Color.black); - myHighlighter.setErrorStripeTooltip(getBookmarkTooltip()); + highlighter.setErrorStripeMarkColor(stripeColor != null ? stripeColor : Color.black); + highlighter.setErrorStripeTooltip(getBookmarkTooltip()); - TextAttributes attributes = myHighlighter.getTextAttributes(); + TextAttributes attributes = highlighter.getTextAttributes(); if (attributes == null) { attributes = new TextAttributes(); } attributes.setBackgroundColor(textAttributes.getBackgroundColor()); attributes.setForegroundColor(textAttributes.getForegroundColor()); - myHighlighter.setTextAttributes(attributes); + highlighter.setTextAttributes(attributes); } } else { - myHighlighter = null; + highlighter = null; } - return myHighlighter; + if (myHighlighterRefs == null) myHighlighterRefs = new WeakHashMap<>(); + if (highlighter != null) { + myHighlighterRefs.put(markup.getDocument(), new WeakReference(highlighter)); + } + return highlighter; } @Nullable @@ -141,24 +148,33 @@ public class Bookmark implements Navigatable, Comparable { } public void release() { - int line = getLine(); - if (line < 0) { - return; - } - final Document document = getDocument(); - if (document == null) return; - MarkupModelEx markup = (MarkupModelEx)DocumentMarkupModel.forDocument(document, myProject, true); - final Document markupDocument = markup.getDocument(); - if (markupDocument.getLineCount() <= line) return; - RangeHighlighterEx highlighter = findMyHighlighter(); - if (highlighter != null) { - highlighter.dispose(); + try { + int line = getLine(); + if (line < 0) { + return; + } + final Document document = getDocument(); + if (document == null) return; + MarkupModelEx markup = (MarkupModelEx)DocumentMarkupModel.forDocument(document, myProject, true); + final Document markupDocument = markup.getDocument(); + if (markupDocument.getLineCount() <= line) return; + RangeHighlighterEx highlighter = findMyHighlighter(); + if (highlighter != null) { + highlighter.dispose(); + } + } finally { + myHighlighterRefs = null; } } private RangeHighlighterEx findMyHighlighter() { final Document document = getDocument(); if (document == null) return null; + Reference reference = myHighlighterRefs != null ? myHighlighterRefs.get(document) : null; + RangeHighlighterEx result = SoftReference.dereference(reference); + if (result != null) { + return result; + } MarkupModelEx markup = (MarkupModelEx)DocumentMarkupModel.forDocument(document, myProject, true); final Document markupDocument = markup.getDocument(); final int startOffset = 0; @@ -173,7 +189,12 @@ public class Bookmark implements Navigatable, Comparable { } return true; }); - return found.get(); + result = found.get(); + if (result != null) { + if (myHighlighterRefs == null) myHighlighterRefs = new WeakHashMap<>(); + myHighlighterRefs.put(document, new WeakReference(result)); + } + return result; } public Icon getIcon() {