From fa9fd211f94be254af98b2d5a6a8f8c38babe271 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Mon, 11 Feb 2019 10:36:16 +0100 Subject: [PATCH] no need to use PlatformTestUtil.registerExtension() anymore (EP now supports parent disposable directly) --- .../codeInsight/JavaDocumentationTest.groovy | 6 +-- .../codeInsight/OverrideImplementTest.groovy | 18 +-------- .../LightUnusedHighlightingFixtureTest.java | 19 +-------- .../daemon/PsiAugmentProviderTest.java | 19 +-------- .../java/codeInspection/CanBeFinalTest.java | 21 ++-------- .../DataFlowInspectionTest.java | 39 ++++++------------- .../DirectoryIndexForExcludePatternsTest.java | 35 +++++------------ .../execution/impl/ConsoleViewImplTest.java | 2 +- .../editor/impl/DocumentMarkupModelTest.java | 20 ++-------- .../fileEditor/FileEditorManagerTest.java | 17 ++++---- .../fileEditor/NewDocumentHistoryTest.java | 6 +-- .../openapi/fileTypes/impl/FileTypesTest.java | 2 +- .../project/impl/ProjectOpeningTest.java | 2 +- .../com/intellij/platform/ProjectSetTest.java | 8 ++-- .../testFramework/PlatformTestUtil.java | 10 +++++ .../NonFinalUtilityClassInspectionTest.java | 6 +-- ...hMissingImplementationsInspectionTest.java | 23 ++--------- .../EditorConfigHighlightUsagesTest.kt | 7 +--- .../groovy/lang/GroovyMapAttributeTest.groovy | 6 +-- .../GroovyHighlightUsagesTest.groovy | 5 +-- .../resolve/GrImportContributorTest.groovy | 27 +++---------- .../resolve/GroovyResolveCacheTest.groovy | 21 ++-------- .../plugins/groovy/util/ThrowingDecompiler.kt | 8 +--- .../groovy/util/ThrowingTransformation.kt | 7 +--- .../python/PyMultiFileResolveTest.java | 7 ++-- 25 files changed, 92 insertions(+), 249 deletions(-) diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/JavaDocumentationTest.groovy b/java/java-tests/testSrc/com/intellij/java/codeInsight/JavaDocumentationTest.groovy index 209ac452d199..5d1dbff091c2 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/JavaDocumentationTest.groovy +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/JavaDocumentationTest.groovy @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.java.codeInsight import com.intellij.codeInsight.documentation.DocumentationManager @@ -9,11 +9,9 @@ import com.intellij.psi.JavaPsiFacade import com.intellij.psi.PsiExpressionList import com.intellij.psi.PsiMethod import com.intellij.psi.util.PsiTreeUtil -import com.intellij.testFramework.PlatformTestUtil import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase import com.intellij.util.ui.UIUtil import groovy.transform.CompileStatic - /** * @author peter */ @@ -174,7 +172,7 @@ class JavaDocumentationTest extends LightCodeInsightFixtureTestCase { JavaPsiFacade.getInstance(project).findClass('Foo', it.resolveScope)?.findMethodBySignature(it, false) } } - PlatformTestUtil.registerExtension DocumentationDelegateProvider.EP_NAME, provider, myFixture.testRootDisposable + DocumentationDelegateProvider.EP_NAME.getPoint(null).registerExtension(provider, myFixture.testRootDisposable) configure '''\ class Foo { diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/OverrideImplementTest.groovy b/java/java-tests/testSrc/com/intellij/java/codeInsight/OverrideImplementTest.groovy index 9f764ffa2fcb..f7b3f87cd015 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/OverrideImplementTest.groovy +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/OverrideImplementTest.groovy @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.java.codeInsight import com.intellij.JavaTestUtil @@ -216,7 +202,7 @@ class Test implements A { void testTypeAnnotationsInImplementedMethod() { def handler = new OverrideImplementsAnnotationsHandler() { @Override String[] getAnnotations(Project project) { return ["TA"] } } - PlatformTestUtil.registerExtension(OverrideImplementsAnnotationsHandler.EP_NAME, handler, testRootDisposable) + OverrideImplementsAnnotationsHandler.EP_NAME.getPoint(null).registerExtension(handler, testRootDisposable) myFixture.addClass """\ import java.lang.annotation.*; diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/LightUnusedHighlightingFixtureTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/LightUnusedHighlightingFixtureTest.java index 1091284e1ef9..6437a4108671 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/LightUnusedHighlightingFixtureTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/LightUnusedHighlightingFixtureTest.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.java.codeInsight.daemon; import com.intellij.JavaTestUtil; @@ -24,7 +10,6 @@ import com.intellij.psi.PsiElement; import com.intellij.psi.PsiField; import com.intellij.psi.PsiNamedElement; import com.intellij.testFramework.LightProjectDescriptor; -import com.intellij.testFramework.PlatformTestUtil; import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; import org.jetbrains.annotations.NotNull; @@ -34,7 +19,7 @@ public class LightUnusedHighlightingFixtureTest extends LightCodeInsightFixtureT protected void setUp() throws Exception { super.setUp(); myFixture.enableInspections(new UnusedDeclarationInspection(true)); - PlatformTestUtil.registerExtension(ImplicitUsageProvider.EP_NAME, new ImplicitUsageProvider() { + ImplicitUsageProvider.EP_NAME.getPoint(null).registerExtension(new ImplicitUsageProvider() { @Override public boolean isImplicitUsage(PsiElement element) { return false; diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/PsiAugmentProviderTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/PsiAugmentProviderTest.java index a291bf5d4192..14ecbbd34bbc 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/PsiAugmentProviderTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/PsiAugmentProviderTest.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.java.codeInsight.daemon; import com.intellij.JavaTestUtil; @@ -21,7 +7,6 @@ import com.intellij.psi.*; import com.intellij.psi.augment.PsiAugmentProvider; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.TypeConversionUtil; -import com.intellij.testFramework.PlatformTestUtil; import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; import com.intellij.util.containers.ContainerUtil; import gnu.trove.THashSet; @@ -39,7 +24,7 @@ public class PsiAugmentProviderTest extends LightCodeInsightFixtureTestCase { @Override public void setUp() throws Exception { super.setUp(); - PlatformTestUtil.registerExtension(PsiAugmentProvider.EP_NAME, new TestAugmentProvider(), myFixture.getTestRootDisposable()); + PsiAugmentProvider.EP_NAME.getPoint(null).registerExtension(new TestAugmentProvider(), myFixture.getTestRootDisposable()); myFixture.addClass("package lombok;\npublic @interface val { }"); } diff --git a/java/java-tests/testSrc/com/intellij/java/codeInspection/CanBeFinalTest.java b/java/java-tests/testSrc/com/intellij/java/codeInspection/CanBeFinalTest.java index 602166aa1aea..20295fb11e58 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInspection/CanBeFinalTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInspection/CanBeFinalTest.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.java.codeInspection; @@ -23,7 +9,6 @@ import com.intellij.psi.PsiElement; import com.intellij.psi.PsiField; import com.intellij.psi.PsiNamedElement; import com.intellij.testFramework.InspectionTestCase; -import com.intellij.testFramework.PlatformTestUtil; public class CanBeFinalTest extends InspectionTestCase { @Override @@ -50,7 +35,7 @@ public class CanBeFinalTest extends InspectionTestCase { public void testassignedFromLambda() { doTest(); } - + public void testassignedFromLambdaInClassInitializer() { doTest(); } @@ -143,7 +128,7 @@ public class CanBeFinalTest extends InspectionTestCase { } public void testfieldImplicitWrite() { - PlatformTestUtil.registerExtension(ImplicitUsageProvider.EP_NAME, new ImplicitUsageProvider() { + ImplicitUsageProvider.EP_NAME.getPoint(null).registerExtension(new ImplicitUsageProvider() { @Override public boolean isImplicitUsage(PsiElement element) { return isImplicitWrite(element); diff --git a/java/java-tests/testSrc/com/intellij/java/codeInspection/DataFlowInspectionTest.java b/java/java-tests/testSrc/com/intellij/java/codeInspection/DataFlowInspectionTest.java index a289a6ef9a0d..b0895fc6ccd5 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInspection/DataFlowInspectionTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInspection/DataFlowInspectionTest.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.java.codeInspection; import com.intellij.JavaTestUtil; @@ -23,7 +9,6 @@ import com.intellij.psi.PsiClass; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiField; import com.intellij.testFramework.LightProjectDescriptor; -import com.intellij.testFramework.PlatformTestUtil; import com.intellij.testFramework.PsiTestUtil; import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture; import com.intellij.util.containers.ContainerUtil; @@ -211,7 +196,7 @@ public class DataFlowInspectionTest extends DataFlowInspectionTestCase { public void testBoxedNaN() { doTest(); } public void testFloatEquality() { doTest(); } public void testLastConstantConditionInAnd() { doTest(); } - + public void testCompileTimeConstant() { doTest(); } public void testNoParenthesesWarnings() { doTest(); } @@ -286,8 +271,8 @@ public class DataFlowInspectionTest extends DataFlowInspectionTestCase { public void testFinalGetter() { doTest(); } public void testGetterResultsNotSame() { doTest(); } public void testIntersectionTypeInstanceof() { doTest(); } - - public void testKeepComments() { + + public void testKeepComments() { doTest(); checkIntentionResult("Simplify"); } @@ -324,7 +309,7 @@ public class DataFlowInspectionTest extends DataFlowInspectionTestCase { public void testDontMakeUnrelatedVariableNotNullWhenMerging() { doTest(); } public void testDontMakeUnrelatedVariableFalseWhenMerging() { doTest(); } public void testDontLoseInequalityInformation() { doTest(); } - + public void testNotEqualsTypo() { doTest(); } public void testAndEquals() { doTest(); } public void testXor() { doTest(); } @@ -333,7 +318,7 @@ public class DataFlowInspectionTest extends DataFlowInspectionTestCase { public void testEmptyCallDoesNotMakeNullable() { doTest(); } public void testGettersAndPureNoFlushing() { doTest(); } public void testFalseGetters() { doTest(); } - + public void testNotNullAfterDereference() { doTest(); } public void testNullableBoolean() { doTest(); } @@ -363,22 +348,22 @@ public class DataFlowInspectionTest extends DataFlowInspectionTestCase { public void testParametersAreNonnullByDefault() { addJavaxNullabilityAnnotations(myFixture); addJavaxDefaultNullabilityAnnotations(myFixture); - + myFixture.addClass("package foo; public class AnotherPackageNotNull { public static void foo(String s) {}}"); myFixture.addFileToProject("foo/package-info.java", "@javax.annotation.ParametersAreNonnullByDefault package foo;"); - - doTest(); + + doTest(); } public void testNullabilityDefaultVsMethodImplementing() { addJavaxDefaultNullabilityAnnotations(myFixture); - + DataFlowInspection inspection = new DataFlowInspection(); inspection.TREAT_UNKNOWN_MEMBERS_AS_NULLABLE = true; myFixture.enableInspections(inspection); myFixture.testHighlighting(true, false, true, getTestName(false) + ".java"); } - + public void testTypeQualifierNickname() { myFixture.addClass("package javax.annotation.meta; public @interface TypeQualifierNickname {}"); addJavaxNullabilityAnnotations(myFixture); @@ -550,7 +535,7 @@ public class DataFlowInspectionTest extends DataFlowInspectionTestCase { public void testFieldUsedBeforeInitialization() { doTest(); } public void testImplicitlyInitializedField() { - PlatformTestUtil.registerExtension(ImplicitUsageProvider.EP_NAME, new ImplicitUsageProvider() { + ImplicitUsageProvider.EP_NAME.getPoint(null).registerExtension(new ImplicitUsageProvider() { @Override public boolean isImplicitUsage(PsiElement element) { return false; diff --git a/java/java-tests/testSrc/com/intellij/openapi/roots/impl/DirectoryIndexForExcludePatternsTest.java b/java/java-tests/testSrc/com/intellij/openapi/roots/impl/DirectoryIndexForExcludePatternsTest.java index 70f56aa493f5..baeac6e74e5f 100644 --- a/java/java-tests/testSrc/com/intellij/openapi/roots/impl/DirectoryIndexForExcludePatternsTest.java +++ b/java/java-tests/testSrc/com/intellij/openapi/roots/impl/DirectoryIndexForExcludePatternsTest.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.roots.impl; import com.intellij.ide.projectView.actions.MarkRootActionBase; @@ -25,7 +11,6 @@ import com.intellij.openapi.roots.ex.ProjectRootManagerEx; import com.intellij.openapi.util.Condition; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.testFramework.PlatformTestUtil; import com.intellij.testFramework.PsiTestUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -211,14 +196,14 @@ public class DirectoryIndexForExcludePatternsTest extends DirectoryIndexTestCase private void registerLibrary(@NotNull VirtualFile root, @Nullable Condition excludePattern) { WriteAction.run(() -> ProjectRootManagerEx.getInstanceEx(myProject).makeRootsChange( - () -> PlatformTestUtil.registerExtension(AdditionalLibraryRootsProvider.EP_NAME, new AdditionalLibraryRootsProvider() { - @NotNull - @Override - public Collection getAdditionalProjectLibraries(@NotNull Project project) { - return myProject == project ? Collections.singletonList( - SyntheticLibrary.newImmutableLibrary(Collections.singleton(root), Collections.emptySet(), Collections.emptySet(), excludePattern) - ) : Collections.emptyList(); - } - }, getTestRootDisposable()), false, true)); + () -> AdditionalLibraryRootsProvider.EP_NAME.getPoint(null).registerExtension(new AdditionalLibraryRootsProvider() { + @NotNull + @Override + public Collection getAdditionalProjectLibraries(@NotNull Project project) { + return myProject == project ? Collections.singletonList( + SyntheticLibrary.newImmutableLibrary(Collections.singleton(root), Collections.emptySet(), Collections.emptySet(), excludePattern) + ) : Collections.emptyList(); + } + }, getTestRootDisposable()), false, true)); } } diff --git a/platform/platform-tests/testSrc/com/intellij/execution/impl/ConsoleViewImplTest.java b/platform/platform-tests/testSrc/com/intellij/execution/impl/ConsoleViewImplTest.java index 44cff0564c9c..116267dbf37a 100644 --- a/platform/platform-tests/testSrc/com/intellij/execution/impl/ConsoleViewImplTest.java +++ b/platform/platform-tests/testSrc/com/intellij/execution/impl/ConsoleViewImplTest.java @@ -407,7 +407,7 @@ public class ConsoleViewImplTest extends LightPlatformTestCase { return Collections.singletonList(Pair.create("+!" + text + "-!", contentType)); } }; - PlatformTestUtil.registerExtension(ConsoleInputFilterProvider.INPUT_FILTER_PROVIDERS, crazyProvider, getTestRootDisposable()); + ConsoleInputFilterProvider.INPUT_FILTER_PROVIDERS.getPoint(null).registerExtension(crazyProvider, getTestRootDisposable()); myConsole = createConsole(); StringBuilder expectedText = new StringBuilder(); List> expectedRegisteredTokens = new ArrayList<>(); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/DocumentMarkupModelTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/DocumentMarkupModelTest.java index 094924ef8aef..d5ce60e79f97 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/DocumentMarkupModelTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/DocumentMarkupModelTest.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.editor.impl; import com.intellij.lang.LanguageAnnotators; @@ -34,7 +20,6 @@ import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.openapi.fileTypes.PlainTextFileType; import com.intellij.psi.PsiElement; -import com.intellij.testFramework.PlatformTestUtil; import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase; import org.jetbrains.annotations.NotNull; @@ -50,7 +35,8 @@ public class DocumentMarkupModelTest extends LightPlatformCodeInsightFixtureTest LanguageExtensionPoint extension = new LanguageExtensionPoint<>(); extension.language="TEXT"; extension.implementationClass = TestAnnotator.class.getName(); - PlatformTestUtil.registerExtension(ExtensionPointName.create(LanguageAnnotators.EP_NAME), extension, myFixture.getTestRootDisposable()); + ExtensionPointName.>create(LanguageAnnotators.EP_NAME) + .getPoint(null).registerExtension(extension, myFixture.getTestRootDisposable()); myFixture.configureByText(PlainTextFileType.INSTANCE, "foo"); EditorColorsScheme scheme = new EditorColorsSchemeImpl(new DefaultColorsScheme()){{initFonts();}}; scheme.setAttributes(HighlighterColors.TEXT, new TextAttributes(Color.black, Color.white, null, null, Font.PLAIN)); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/FileEditorManagerTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/FileEditorManagerTest.java index a2a63891c871..8335546db471 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/FileEditorManagerTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/FileEditorManagerTest.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.fileEditor; import com.intellij.ide.ui.UISettings; @@ -114,8 +114,8 @@ public class FileEditorManagerTest extends FileEditorManagerTestCase { } public void testOpenRecentEditorTab() throws Exception { - PlatformTestUtil - .registerExtension(FileEditorProvider.EP_FILE_EDITOR_PROVIDER, new MyFileEditorProvider(), myFixture.getTestRootDisposable()); + FileEditorProvider.EP_FILE_EDITOR_PROVIDER + .getPoint(null).registerExtension(new MyFileEditorProvider(), myFixture.getTestRootDisposable()); openFiles(" \n" + " \n" + @@ -137,8 +137,8 @@ public class FileEditorManagerTest extends FileEditorManagerTestCase { } public void testTrackSelectedEditor() { - PlatformTestUtil - .registerExtension(FileEditorProvider.EP_FILE_EDITOR_PROVIDER, new MyFileEditorProvider(), myFixture.getTestRootDisposable()); + FileEditorProvider.EP_FILE_EDITOR_PROVIDER + .getPoint(null).registerExtension(new MyFileEditorProvider(), myFixture.getTestRootDisposable()); VirtualFile file = getFile("/src/1.txt"); assertNotNull(file); FileEditor[] editors = myManager.openFile(file, true); @@ -200,10 +200,9 @@ public class FileEditorManagerTest extends FileEditorManagerTestCase { } public void testOpenInDumbMode() { - PlatformTestUtil - .registerExtension(FileEditorProvider.EP_FILE_EDITOR_PROVIDER, new MyFileEditorProvider(), myFixture.getTestRootDisposable()); - PlatformTestUtil - .registerExtension(FileEditorProvider.EP_FILE_EDITOR_PROVIDER, new DumbAwareProvider(), myFixture.getTestRootDisposable()); + FileEditorProvider.EP_FILE_EDITOR_PROVIDER + .getPoint(null).registerExtension(new MyFileEditorProvider(), myFixture.getTestRootDisposable()); + FileEditorProvider.EP_FILE_EDITOR_PROVIDER.getPoint(null).registerExtension(new DumbAwareProvider(), myFixture.getTestRootDisposable()); try { DumbServiceImpl.getInstance(getProject()).setDumb(true); VirtualFile file = getFile("/src/foo.bar"); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/NewDocumentHistoryTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/NewDocumentHistoryTest.java index 173cc8357b84..cbf788ea57de 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/NewDocumentHistoryTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/fileEditor/NewDocumentHistoryTest.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.fileEditor; import com.intellij.codeInsight.navigation.NavigationUtil; @@ -7,7 +7,6 @@ import com.intellij.openapi.fileEditor.impl.IdeDocumentHistoryImpl; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiManager; -import com.intellij.testFramework.PlatformTestUtil; import org.junit.Assert; /** @@ -37,7 +36,8 @@ public class NewDocumentHistoryTest extends HeavyFileEditorManagerTestCase { } public void testBackNavigationBetweenEditors() { - PlatformTestUtil.registerExtension(FileEditorProvider.EP_FILE_EDITOR_PROVIDER, new FileEditorManagerTest.MyFileEditorProvider(), myFixture.getTestRootDisposable()); + FileEditorProvider.EP_FILE_EDITOR_PROVIDER + .getPoint(null).registerExtension(new FileEditorManagerTest.MyFileEditorProvider(), myFixture.getTestRootDisposable()); VirtualFile file = getFile("/src/1.txt"); assertNotNull(file); FileEditor[] editors = myManager.openFile(file, true); 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 24d13ea3ef0c..254b933423a1 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 @@ -465,7 +465,7 @@ public class FileTypesTest extends PlatformTestCase { //String s = JDOMUtil.writeElement(element); final AbstractFileType typeFromPlugin = new AbstractFileType(new SyntaxTable()); - PlatformTestUtil.registerExtension(FileTypeFactory.FILE_TYPE_FACTORY_EP, new FileTypeFactory() { + FileTypeFactory.FILE_TYPE_FACTORY_EP.getPoint(null).registerExtension(new FileTypeFactory() { @Override public void createFileTypes(@NotNull FileTypeConsumer consumer) { consumer.consume(typeFromPlugin, "fromPlugin"); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/project/impl/ProjectOpeningTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/project/impl/ProjectOpeningTest.java index 4a0923f022c9..ab88ee2c28c6 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/project/impl/ProjectOpeningTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/project/impl/ProjectOpeningTest.java @@ -28,7 +28,7 @@ public class ProjectOpeningTest extends PlatformTestCase { File foo = createTempDir("foo"); Project project = null; MyStartupActivity activity = new MyStartupActivity(); - PlatformTestUtil.registerExtension(POST_STARTUP_ACTIVITY, activity, getTestRootDisposable()); + POST_STARTUP_ACTIVITY.getPoint(null).registerExtension(activity, getTestRootDisposable()); try { ProjectManagerEx manager = ProjectManagerEx.getInstanceEx(); diff --git a/platform/platform-tests/testSrc/com/intellij/platform/ProjectSetTest.java b/platform/platform-tests/testSrc/com/intellij/platform/ProjectSetTest.java index 22db51af8148..bc9c34a5c715 100644 --- a/platform/platform-tests/testSrc/com/intellij/platform/ProjectSetTest.java +++ b/platform/platform-tests/testSrc/com/intellij/platform/ProjectSetTest.java @@ -39,15 +39,15 @@ public class ProjectSetTest extends LightPlatformTestCase { public void testProjectSetReader() throws IOException { final Ref>> ref = Ref.create(); - PlatformTestUtil.registerExtension(ProjectSetProcessor.EXTENSION_POINT_NAME, new ProjectSetProcessor() { + ProjectSetProcessor.EXTENSION_POINT_NAME.getPoint(null).registerExtension(new ProjectSetProcessor() { @Override public String getId() { return "test"; } @Override - public void processEntries(@NotNull List> entries, @NotNull Context context, @NotNull Runnable runNext) { - ref.set(entries); + public void processEntries(@NotNull List> entries1, @NotNull Context context1, @NotNull Runnable runNext) { + ref.set(entries1); } }, getTestRootDisposable()); @@ -64,7 +64,7 @@ public class ProjectSetTest extends LightPlatformTestCase { public void testVcsCheckoutProcessor() throws IOException { final List> pairs = new ArrayList<>(); - PlatformTestUtil.registerExtension(VcsCheckoutProcessor.EXTENSION_POINT_NAME, new VcsCheckoutProcessor() { + VcsCheckoutProcessor.EXTENSION_POINT_NAME.getPoint(null).registerExtension(new VcsCheckoutProcessor() { @NotNull @Override public String getId() { diff --git a/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java index 53a8b2794496..a0c6e6ef84ed 100644 --- a/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java +++ b/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java @@ -130,14 +130,24 @@ public class PlatformTestUtil { return uppercaseChars >= 3; } + /** + * @see ExtensionPointImpl#maskAll(List, Disposable) + */ public static void maskExtensions(@NotNull ExtensionPointName pointName, @NotNull List newExtensions, @NotNull Disposable parentDisposable) { ((ExtensionPointImpl)pointName.getPoint(null)).maskAll(newExtensions, parentDisposable); } + /** + * @see ExtensionPointImpl#maskAll(List, Disposable) + */ public static void maskExtensions(@NotNull ProjectExtensionPointName pointName, @NotNull Project project, @NotNull List newExtensions, @NotNull Disposable parentDisposable) { ((ExtensionPointImpl)pointName.getPoint(project)).maskAll(newExtensions, parentDisposable); } + /** + * @deprecated Use {@link ExtensionPointName#getPoint(AreaInstance)} and {@link ExtensionPoint#registerExtension(Object, Disposable)}. + */ + @Deprecated public static void registerExtension(@NotNull ExtensionPointName name, @NotNull T t, @NotNull Disposable parentDisposable) { registerExtension(Extensions.getRootArea(), name, t, parentDisposable); } diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/classlayout/NonFinalUtilityClassInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/classlayout/NonFinalUtilityClassInspectionTest.java index a2d866339e6c..8739898b82b5 100644 --- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/classlayout/NonFinalUtilityClassInspectionTest.java +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/classlayout/NonFinalUtilityClassInspectionTest.java @@ -1,10 +1,9 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.siyeh.ig.classlayout; import com.intellij.codeInspection.inheritance.ImplicitSubclassProvider; import com.intellij.psi.PsiClass; import com.intellij.testFramework.LightProjectDescriptor; -import com.intellij.testFramework.PlatformTestUtil; import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; import com.siyeh.ig.LightInspectionTestCase; import org.jetbrains.annotations.NotNull; @@ -24,8 +23,7 @@ public class NonFinalUtilityClassInspectionTest extends LightCodeInsightFixtureT @Override protected void setUp() throws Exception { super.setUp(); - PlatformTestUtil - .registerExtension(ImplicitSubclassProvider.EP_NAME, myImplicitSubclassProvider, getTestRootDisposable()); + ImplicitSubclassProvider.EP_NAME.getPoint(null).registerExtension(myImplicitSubclassProvider, getTestRootDisposable()); } @NotNull diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/inheritance/AbstractMethodWithMissingImplementationsInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/inheritance/AbstractMethodWithMissingImplementationsInspectionTest.java index 30cca177e5d9..e799d1db004e 100644 --- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/inheritance/AbstractMethodWithMissingImplementationsInspectionTest.java +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/inheritance/AbstractMethodWithMissingImplementationsInspectionTest.java @@ -1,25 +1,10 @@ -/* - * Copyright 2000-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.siyeh.ig.inheritance; import com.intellij.codeInspection.InspectionProfileEntry; import com.intellij.psi.PsiClass; import com.intellij.psi.PsiClassOwner; import com.intellij.psi.search.searches.ClassInheritorsSearch; -import com.intellij.testFramework.PlatformTestUtil; import com.intellij.util.Processor; import com.intellij.util.QueryExecutor; import com.intellij.util.containers.ContainerUtil; @@ -36,15 +21,15 @@ public class AbstractMethodWithMissingImplementationsInspectionTest extends Ligh public void testDuplicateClass() { doTest(); } - + public void testSearchReturnsUnrelatedClass() { - PlatformTestUtil.registerExtension(ClassInheritorsSearch.EP_NAME, new QueryExecutor() { + ClassInheritorsSearch.EP_NAME.getPoint(null).registerExtension(new QueryExecutor() { @Override public boolean execute(@NotNull ClassInheritorsSearch.SearchParameters p, @NotNull Processor consumer) { return ContainerUtil.process(((PsiClassOwner)p.getClassToProcess().getContainingFile()).getClasses(), consumer); } }, getTestRootDisposable()); - doTest(); + doTest(); } @Nullable diff --git a/plugins/editorconfig/test/org/editorconfig/language/codeinsight/EditorConfigHighlightUsagesTest.kt b/plugins/editorconfig/test/org/editorconfig/language/codeinsight/EditorConfigHighlightUsagesTest.kt index 68748f45cd4f..24edfe282b52 100644 --- a/plugins/editorconfig/test/org/editorconfig/language/codeinsight/EditorConfigHighlightUsagesTest.kt +++ b/plugins/editorconfig/test/org/editorconfig/language/codeinsight/EditorConfigHighlightUsagesTest.kt @@ -1,13 +1,10 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. import com.intellij.codeInsight.daemon.impl.HighlightInfoType.ELEMENT_UNDER_CARET_READ import com.intellij.codeInsight.daemon.impl.HighlightInfoType.ELEMENT_UNDER_CARET_WRITE import com.intellij.codeInsight.daemon.impl.IdentifierHighlighterPassFactory.doWithHighlightingEnabled import com.intellij.codeInsight.daemon.impl.SeveritiesProvider import com.intellij.openapi.application.ex.PathManagerEx import com.intellij.testFramework.ExpectedHighlightingData -import com.intellij.testFramework.PlatformTestUtil.registerExtension import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase class EditorConfigHighlightUsagesTest : LightPlatformCodeInsightFixtureTestCase() { @@ -22,7 +19,7 @@ class EditorConfigHighlightUsagesTest : LightPlatformCodeInsightFixtureTestCase( fun testDeclarationWithoutReferences() = doTest() private fun doTest() { - registerExtension(SeveritiesProvider.EP_NAME, SEVERITIES_PROVIDER, testRootDisposable) + SeveritiesProvider.EP_NAME.getPoint(null).registerExtension(SEVERITIES_PROVIDER, testRootDisposable) val name = getTestName(true) myFixture.configureByFile("${name}/.editorconfig") doWithHighlightingEnabled { diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyMapAttributeTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyMapAttributeTest.groovy index 81c03076dcb2..4766251b0fce 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyMapAttributeTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyMapAttributeTest.groovy @@ -3,7 +3,6 @@ package org.jetbrains.plugins.groovy.lang import com.intellij.codeInsight.lookup.LookupElement import com.intellij.testFramework.LightProjectDescriptor -import com.intellij.testFramework.PlatformTestUtil import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase import groovy.transform.CompileStatic import org.jetbrains.annotations.NotNull @@ -13,7 +12,6 @@ import org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyUncheckedAss import org.jetbrains.plugins.groovy.extensions.GroovyNamedArgumentProvider import org.jetbrains.plugins.groovy.extensions.NamedArgumentDescriptor import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.GrListOrMap - /** * @author Sergey Evdokimov */ @@ -439,13 +437,13 @@ class Test { } private doTestCompletionWithinMap(String text, String text2 = null) { - PlatformTestUtil.registerExtension GroovyNamedArgumentProvider.EP_NAME, new GroovyNamedArgumentProvider() { + GroovyNamedArgumentProvider.EP_NAME.getPoint(null).registerExtension(new GroovyNamedArgumentProvider() { @NotNull @Override Map getNamedArguments(@NotNull GrListOrMap literal) { ['foo': NamedArgumentDescriptor.SIMPLE_NORMAL, 'bar': NamedArgumentDescriptor.SIMPLE_NORMAL] } - }, myFixture.testRootDisposable + }, myFixture.testRootDisposable) myFixture.with { configureByText '_.groovy', text diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/GroovyHighlightUsagesTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/GroovyHighlightUsagesTest.groovy index a734f4241439..6122b6db91a9 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/GroovyHighlightUsagesTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/highlighting/GroovyHighlightUsagesTest.groovy @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.lang.highlighting import com.intellij.codeInsight.daemon.impl.HighlightInfoType @@ -12,7 +12,6 @@ import org.jetbrains.plugins.groovy.util.TestUtils import static com.intellij.codeInsight.daemon.impl.HighlightInfoType.ELEMENT_UNDER_CARET_READ import static com.intellij.codeInsight.daemon.impl.HighlightInfoType.ELEMENT_UNDER_CARET_WRITE import static com.intellij.codeInsight.daemon.impl.IdentifierHighlighterPassFactory.doWithHighlightingEnabled -import static com.intellij.testFramework.PlatformTestUtil.registerExtension @CompileStatic class GroovyHighlightUsagesTest extends LightGroovyTestCase { @@ -26,7 +25,7 @@ class GroovyHighlightUsagesTest extends LightGroovyTestCase { final String basePath = TestUtils.testDataPath + 'highlighting/usages/' private void doTest(boolean directoryTest = false) { - registerExtension(SeveritiesProvider.EP_NAME, SEVERITIES_PROVIDER, testRootDisposable) + SeveritiesProvider.EP_NAME.getPoint(null).registerExtension(SEVERITIES_PROVIDER, testRootDisposable) def name = getTestName() if (directoryTest) { fixture.copyDirectoryToProject(name, "") diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/GrImportContributorTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/GrImportContributorTest.groovy index 78db0723f9f2..92924c67746d 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/GrImportContributorTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/GrImportContributorTest.groovy @@ -1,22 +1,7 @@ -/* - * 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-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.lang.resolve import com.intellij.testFramework.LightProjectDescriptor -import com.intellij.testFramework.PlatformTestUtil import groovy.transform.CompileStatic import org.jetbrains.plugins.groovy.GroovyLightProjectDescriptor import org.jetbrains.plugins.groovy.LightGroovyTestCase @@ -42,7 +27,7 @@ public class MyClass { } void 'test regular import'() { - PlatformTestUtil.registerExtension(GrImportContributor.EP_NAME, { + GrImportContributor.EP_NAME.getPoint(null).registerExtension({ [new Import("foo.bar.MyClass", ImportType.REGULAR)] } as GrImportContributor, myFixture.testRootDisposable) fixture.with { @@ -52,7 +37,7 @@ public class MyClass { } void 'test static import method'() { - PlatformTestUtil.registerExtension(GrImportContributor.EP_NAME, { + GrImportContributor.EP_NAME.getPoint(null).registerExtension({ [new Import("foo.bar.MyClass.foo", ImportType.STATIC)] } as GrImportContributor, myFixture.testRootDisposable) fixture.with { @@ -62,7 +47,7 @@ public class MyClass { } void 'test static import field'() { - PlatformTestUtil.registerExtension(GrImportContributor.EP_NAME, { + GrImportContributor.EP_NAME.getPoint(null).registerExtension({ [new Import("foo.bar.MyClass.BAR", ImportType.STATIC)] } as GrImportContributor, myFixture.testRootDisposable) fixture.with { @@ -72,7 +57,7 @@ public class MyClass { } void 'test star import'() { - PlatformTestUtil.registerExtension(GrImportContributor.EP_NAME, { + GrImportContributor.EP_NAME.getPoint(null).registerExtension({ [new Import("foo.bar", ImportType.STAR)] } as GrImportContributor, myFixture.testRootDisposable) fixture.with { @@ -82,7 +67,7 @@ public class MyClass { } void 'test static star import'() { - PlatformTestUtil.registerExtension(GrImportContributor.EP_NAME, { + GrImportContributor.EP_NAME.getPoint(null).registerExtension({ [new Import("foo.bar.MyClass", ImportType.STATIC_STAR)] } as GrImportContributor, myFixture.testRootDisposable) fixture.with { diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/GroovyResolveCacheTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/GroovyResolveCacheTest.groovy index 6162753df07e..754e88be04d1 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/GroovyResolveCacheTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/GroovyResolveCacheTest.groovy @@ -1,24 +1,9 @@ -/* - * 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-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.lang.resolve import com.intellij.openapi.command.WriteCommandAction import com.intellij.psi.PsiFileFactory import com.intellij.testFramework.LightProjectDescriptor -import com.intellij.testFramework.PlatformTestUtil import groovy.transform.CompileStatic import org.jetbrains.plugins.groovy.GroovyFileType import org.jetbrains.plugins.groovy.GroovyLightProjectDescriptor @@ -38,7 +23,7 @@ class GroovyResolveCacheTest extends LightGroovyTestCase { void 'test drop caches on out of code block change'() { int counter = 0 - PlatformTestUtil.registerExtension(AstTransformationSupport.EP_NAME, { + AstTransformationSupport.EP_NAME.getPoint(null).registerExtension({ counter++ } as AstTransformationSupport, myFixture.testRootDisposable) def file = fixture.addFileToProject( @@ -61,7 +46,7 @@ class GroovyResolveCacheTest extends LightGroovyTestCase { void 'test do not drop caches on code block change'() { int counter = 0 - PlatformTestUtil.registerExtension(AstTransformationSupport.EP_NAME, { + AstTransformationSupport.EP_NAME.getPoint(null).registerExtension({ counter++ } as AstTransformationSupport, myFixture.testRootDisposable) def file = fixture.addFileToProject( diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/util/ThrowingDecompiler.kt b/plugins/groovy/test/org/jetbrains/plugins/groovy/util/ThrowingDecompiler.kt index 0187f4aeee59..93cb850f3709 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/util/ThrowingDecompiler.kt +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/util/ThrowingDecompiler.kt @@ -1,18 +1,14 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.util import com.intellij.openapi.Disposable import com.intellij.openapi.vfs.VirtualFile import com.intellij.psi.compiled.ClassFileDecompilers -import com.intellij.testFramework.PlatformTestUtil object ThrowingDecompiler : ClassFileDecompilers.Light() { - @JvmStatic fun disableDecompilers(parentDisposable: Disposable) { - PlatformTestUtil.registerExtension(ClassFileDecompilers.EP_NAME, this, parentDisposable) + ClassFileDecompilers.EP_NAME.getPoint(null).registerExtension(this, parentDisposable) } override fun accepts(file: VirtualFile): Boolean = true diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/util/ThrowingTransformation.kt b/plugins/groovy/test/org/jetbrains/plugins/groovy/util/ThrowingTransformation.kt index 5b9482488581..c62720004c01 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/util/ThrowingTransformation.kt +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/util/ThrowingTransformation.kt @@ -1,10 +1,7 @@ -/* - * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.util import com.intellij.openapi.Disposable -import com.intellij.testFramework.PlatformTestUtil.registerExtension import org.jetbrains.plugins.groovy.transformations.AstTransformationSupport import org.jetbrains.plugins.groovy.transformations.TransformationContext @@ -12,7 +9,7 @@ object ThrowingTransformation : AstTransformationSupport { @JvmStatic fun disableTransformations(parentDisposable: Disposable) { - registerExtension(AstTransformationSupport.EP_NAME, this, parentDisposable) + AstTransformationSupport.EP_NAME.getPoint(null).registerExtension(this, parentDisposable) } override fun applyTransformation(context: TransformationContext): Nothing { diff --git a/python/testSrc/com/jetbrains/python/PyMultiFileResolveTest.java b/python/testSrc/com/jetbrains/python/PyMultiFileResolveTest.java index b9836d58b689..a667c95df8c0 100644 --- a/python/testSrc/com/jetbrains/python/PyMultiFileResolveTest.java +++ b/python/testSrc/com/jetbrains/python/PyMultiFileResolveTest.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.jetbrains.python; import com.google.common.collect.Lists; @@ -8,7 +8,6 @@ import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; import com.intellij.psi.impl.source.PsiFileImpl; -import com.intellij.testFramework.PlatformTestUtil; import com.jetbrains.python.codeInsight.PyCustomMember; import com.jetbrains.python.fixtures.PyMultiFileResolveTestCase; import com.jetbrains.python.fixtures.PyResolveTestCase; @@ -92,7 +91,7 @@ public class PyMultiFileResolveTest extends PyMultiFileResolveTestCase { } public void testCustomPackageIdentifier() { - PlatformTestUtil.registerExtension(PyCustomPackageIdentifier.EP_NAME, new PyCustomPackageIdentifier() { + PyCustomPackageIdentifier.EP_NAME.getPoint(null).registerExtension(new PyCustomPackageIdentifier() { @Override public boolean isPackage(PsiDirectory directory) { return true; @@ -488,7 +487,7 @@ public class PyMultiFileResolveTest extends PyMultiFileResolveTestCase { runWithSourceRoots(Lists.newArrayList(myFixture.findFileInTempDir("root")), () -> { final PsiFile extSource = myFixture.getPsiManager().findFile(vf); PyImportResolver foreignResolver = (name, context, withRoots) -> name.toString().equals("m1") ? extSource : null; - PlatformTestUtil.registerExtension(PyImportResolver.EP_NAME, foreignResolver, getTestRootDisposable()); + PyImportResolver.EP_NAME.getPoint(null).registerExtension(foreignResolver, getTestRootDisposable()); final PsiFile psiFile = myFixture.configureByFile("a.py"); final PsiReference ref = PyResolveTestCase.findReferenceByMarker(psiFile);