From d5903c53741d529102de77df5b4396e705113178 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 7 Jan 2016 14:01:59 +0100 Subject: [PATCH] workaround for KT-10590: ensure that the inherited getProject() method is public, not protected --- .../KotlinLightCodeInsightFixtureTestCase.kt | 3 +- ...inLightCodeInsightFixtureTestCaseBase.java | 42 +++++++++++++++++++ .../folding/AbstractKotlinFoldingTest.java | 4 +- 3 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java diff --git a/idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCase.kt b/idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCase.kt index 857cbb2a8ca..70fd8016d22 100644 --- a/idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCase.kt +++ b/idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCase.kt @@ -23,6 +23,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.Presentation import com.intellij.openapi.actionSystem.ex.ActionManagerEx import com.intellij.openapi.editor.ex.EditorEx +import com.intellij.openapi.project.Project import com.intellij.openapi.startup.StartupManager import com.intellij.openapi.util.io.FileUtil import com.intellij.openapi.util.text.StringUtil @@ -40,7 +41,7 @@ import java.io.File import java.io.IOException import java.util.* -abstract class KotlinLightCodeInsightFixtureTestCase : LightCodeInsightFixtureTestCase() { +abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFixtureTestCaseBase() { private var kotlinInternalModeOriginalValue = false private val exceptions = ArrayList() diff --git a/idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java b/idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java new file mode 100644 index 00000000000..4c235cac0e3 --- /dev/null +++ b/idea/idea-test-framework/src/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java @@ -0,0 +1,42 @@ +/* + * Copyright 2010-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 org.jetbrains.kotlin.idea.test; + +import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.project.Project; +import com.intellij.psi.PsiFile; +import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; +import org.jetbrains.annotations.NotNull; + +public abstract class KotlinLightCodeInsightFixtureTestCaseBase extends LightCodeInsightFixtureTestCase { + @NotNull + @Override + public Project getProject() { + return super.getProject(); + } + + @NotNull + @Override + public Editor getEditor() { + return super.getEditor(); + } + + @Override + public PsiFile getFile() { + return super.getFile(); + } +} diff --git a/idea/tests/org/jetbrains/kotlin/idea/folding/AbstractKotlinFoldingTest.java b/idea/tests/org/jetbrains/kotlin/idea/folding/AbstractKotlinFoldingTest.java index a19492ebaa4..3234d8277ae 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/folding/AbstractKotlinFoldingTest.java +++ b/idea/tests/org/jetbrains/kotlin/idea/folding/AbstractKotlinFoldingTest.java @@ -24,9 +24,9 @@ import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.testFramework.LightProjectDescriptor; import com.intellij.testFramework.PlatformTestCase; -import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl; import org.jetbrains.annotations.NotNull; +import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCaseBase; import org.jetbrains.kotlin.idea.test.KotlinLightProjectDescriptor; import org.jetbrains.kotlin.test.SettingsConfigurator; import org.junit.Assert; @@ -36,7 +36,7 @@ import java.io.File; import java.io.IOException; import java.nio.charset.Charset; -public abstract class AbstractKotlinFoldingTest extends LightCodeInsightFixtureTestCase { +public abstract class AbstractKotlinFoldingTest extends KotlinLightCodeInsightFixtureTestCaseBase { protected void doTest(@NotNull String path) { myFixture.testFolding(path); }