fix compilation against branch 163

This commit is contained in:
Dmitry Jemerov
2016-10-11 18:06:42 +02:00
parent 24c9b6e171
commit a2b0b3d6eb
19 changed files with 43 additions and 54 deletions
@@ -104,7 +104,6 @@ public abstract class KtParsingTestCase extends KtPlatformLiteFixture {
myFileFactory = new PsiFileFactoryImpl(myPsiManager);
MutablePicoContainer appContainer = getApplication().getPicoContainer();
registerComponentInstance(appContainer, MessageBus.class, MessageBusFactory.newMessageBus(getApplication()));
registerComponentInstance(appContainer, SchemesManagerFactory.class, new MockSchemesManagerFactory());
final MockEditorFactory editorFactory = new MockEditorFactory();
registerComponentInstance(appContainer, EditorFactory.class, editorFactory);
registerComponentInstance(appContainer, FileDocumentManager.class, new MockFileDocumentManagerImpl(new Function<CharSequence, Document>() {
@@ -15,6 +15,7 @@
*/
package org.jetbrains.kotlin.test.testFramework.mock;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.util.Computable;
@@ -148,4 +149,9 @@ public class MockPsiDocumentManager extends PsiDocumentManager {
public void reparseFiles(@NotNull Collection<VirtualFile> files, boolean includeOpenFiles) {
throw new UnsupportedOperationException();
}
@Override
public void performLaterWhenAllCommitted(@NotNull Runnable runnable, ModalityState modalityState) {
throw new UnsupportedOperationException();
}
}
@@ -1,34 +0,0 @@
/*
* 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.test.testFramework.mock;
import com.intellij.openapi.components.RoamingType;
import com.intellij.openapi.options.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class MockSchemesManagerFactory extends SchemesManagerFactory {
private static final SchemesManager EMPTY = new EmptySchemesManager();
@Override
protected <T extends Scheme, E extends ExternalizableScheme> SchemesManager<T, E> create(@NotNull String directoryName,
@NotNull SchemeProcessor<E> processor,
@NotNull RoamingType roamingType,
@Nullable String presentableName) {
//noinspection unchecked
return EMPTY;
}
}
@@ -71,7 +71,7 @@ abstract class KotlinGenerateTestSupportActionBase(
if (ApplicationManager.getApplication().isUnitTestMode) return consumer(frameworks.first())
val list = JBList(*frameworks.toTypedArray())
val list = JBList<TestFramework>(*frameworks.toTypedArray())
list.cellRenderer = TestFrameworkListCellRenderer()
PopupChooserBuilder(list)
@@ -113,7 +113,7 @@ class KotlinRecursiveCallLineMarkerProvider : LineMarkerProvider {
callElement,
callElement.textRange,
AllIcons.Gutter.RecursiveMethod,
Pass.UPDATE_OVERRIDEN_MARKERS,
Pass.LINE_MARKERS,
{ "Recursive call" },
null,
GutterIconRenderer.Alignment.RIGHT
@@ -171,7 +171,7 @@ private fun collectSuperDeclarationMarkers(declaration: KtDeclaration, result: M
declaration,
anchor.textRange,
if (implements) IMPLEMENTING_MARK else OVERRIDING_MARK,
Pass.UPDATE_OVERRIDDEN_MARKERS,
Pass.LINE_MARKERS,
SuperDeclarationMarkerTooltip,
SuperDeclarationMarkerNavigationHandler(),
GutterIconRenderer.Alignment.RIGHT
@@ -194,7 +194,7 @@ private fun collectInheritedClassMarker(element: KtClass, result: MutableCollect
anchor,
anchor.textRange,
if (isTrait) IMPLEMENTED_MARK else OVERRIDDEN_MARK,
Pass.UPDATE_OVERRIDDEN_MARKERS,
Pass.LINE_MARKERS,
SUBCLASSED_CLASS.tooltip,
SUBCLASSED_CLASS.navigationHandler,
GutterIconRenderer.Alignment.RIGHT
@@ -225,7 +225,7 @@ private fun collectOverriddenPropertyAccessors(properties: Collection<KtNamedDec
anchor,
anchor.textRange,
if (isImplemented(property)) IMPLEMENTED_MARK else OVERRIDDEN_MARK,
Pass.UPDATE_OVERRIDDEN_MARKERS,
Pass.LINE_MARKERS,
OVERRIDDEN_PROPERTY.tooltip,
OVERRIDDEN_PROPERTY.navigationHandler,
GutterIconRenderer.Alignment.RIGHT
@@ -305,7 +305,7 @@ private fun collectOverriddenFunctions(functions: Collection<KtNamedFunction>, r
anchor,
anchor.textRange,
if (isImplemented(function)) IMPLEMENTED_MARK else OVERRIDDEN_MARK,
Pass.UPDATE_OVERRIDDEN_MARKERS, OVERRIDDEN_FUNCTION.tooltip,
Pass.LINE_MARKERS, OVERRIDDEN_FUNCTION.tooltip,
OVERRIDDEN_FUNCTION.navigationHandler,
GutterIconRenderer.Alignment.RIGHT
))
@@ -39,7 +39,7 @@ import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase
val KOTLIN_PLUGIN_CLASSPATH_MARKER = "${KotlinWithGradleConfigurator.GROUP_ID}:${KotlinWithGradleConfigurator.GRADLE_PLUGIN_ID}:"
abstract class KotlinGradleInspectionVisitor : BaseInspectionVisitor() {
override fun visitFile(file: GroovyFileBase?) {
override fun visitFile(file: GroovyFileBase) {
if (file == null || !FileUtilRt.extensionEquals(file.name, GradleConstants.EXTENSION)) return
val fileIndex = ProjectRootManager.getInstance(file.project).fileIndex
@@ -29,6 +29,7 @@ import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.options.SettingsEditor;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.WriteExternalException;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.util.xmlb.XmlSerializer;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
@@ -54,6 +55,11 @@ public final class K2JSRunConfiguration extends ModuleBasedConfiguration<RunConf
return Arrays.asList(ModuleManager.getInstance(getProject()).getModules());
}
@Override
public GlobalSearchScope getSearchScope() {
return SearchScopeProvider.createSearchScope(getModules());
}
@Override
protected ModuleBasedConfiguration createInstance() {
return new K2JSRunConfiguration(getName(), getConfigurationModule(), getFactory());
@@ -186,7 +186,7 @@ private fun smartSelectElement(
val highlighter = ScopeHighlighter(editor)
val list = JBList(model)
val list = JBList<PsiElement>(model)
list.cellRenderer = object : DefaultListCellRenderer() {
override fun getListCellRendererComponent(list: JList<*>, value: Any?, index: Int, isSelected: Boolean, cellHasFocus: Boolean): Component {
@@ -87,7 +87,7 @@ internal fun chooseApplicableComponentFunctions(
if (editor == null) return callback(emptyList())
val list = JBList("Create single variable", "Create destructuring declaration")
val list = JBList<String>("Create single variable", "Create destructuring declaration")
JBPopupFactory.getInstance()
.createListPopupBuilder(list)
.setMovable(true)
@@ -932,7 +932,7 @@ fun checkSuperMethodsWithPopup(
append(" of ")
append(SymbolPresentationUtil.getSymbolPresentableText(superClass))
}
val list = JBList(renameBase, renameCurrent)
val list = JBList<String>(renameBase, renameCurrent)
JBPopupFactory.getInstance()
.createListPopupBuilder(list)
.setTitle(title)
@@ -40,6 +40,7 @@ import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiPackage;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.refactoring.listeners.RefactoringElementAdapter;
import com.intellij.refactoring.listeners.RefactoringElementListener;
import kotlin.collections.ArraysKt;
@@ -84,6 +85,12 @@ public class JetRunConfiguration extends ModuleBasedConfiguration<RunConfigurati
return Arrays.asList(ModuleManager.getInstance(getProject()).getModules());
}
@Nullable
@Override
public GlobalSearchScope getSearchScope() {
return SearchScopeProvider.createSearchScope(getModules());
}
@NotNull
@Override
public SettingsEditor<? extends RunConfiguration> getConfigurationEditor() {
@@ -75,7 +75,7 @@ public abstract class ExternalSystemTestCase extends UsefulTestCase {
setUpFixtures();
myProject = myTestFixture.getProject();
edt(new Runnable() {
invokeTestRunnable(new Runnable() {
@Override
public void run() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@@ -172,7 +172,7 @@ class GradleInspectionTest : GradleImportingTestCase() {
val globalContext = CodeInsightTestFixtureImpl.createGlobalContextForTool(scope, myProject, inspectionManager, toolWrapper)
val resultRef = Ref<List<String>>()
UsefulTestCase.edt {
invokeTestRunnable {
InspectionTestUtil.runTool(toolWrapper, scope, globalContext)
val presentation = globalContext.getPresentation(toolWrapper)
@@ -197,7 +197,7 @@ abstract class AbstractKotlinEvaluateExpressionTest : KotlinDebuggerTestBase() {
val session = myDebuggerSession.xDebugSession as XDebugSessionImpl
val watchesView = XWatchesViewImpl(session, false)
Disposer.register(testRootDisposable, watchesView)
session.addSessionListener(XDebugViewSessionListener(watchesView), testRootDisposable)
session.addSessionListener(XDebugViewSessionListener(watchesView, session), testRootDisposable)
return watchesView
}
@@ -205,7 +205,7 @@ abstract class AbstractKotlinEvaluateExpressionTest : KotlinDebuggerTestBase() {
val session = myDebuggerSession.xDebugSession as XDebugSessionImpl
val variablesView = XVariablesView(session)
Disposer.register(testRootDisposable, variablesView)
session.addSessionListener(XDebugViewSessionListener(variablesView), testRootDisposable)
session.addSessionListener(XDebugViewSessionListener(variablesView, session), testRootDisposable)
return variablesView
}
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.quickfix;
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
import com.intellij.codeInsight.daemon.quickFix.QuickFixTestCase;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.SuppressIntentionAction;
import com.intellij.codeInspection.SuppressableProblemGroup;
@@ -35,6 +36,7 @@ import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.psi.PsiElement;
import com.intellij.psi.stubs.StubUpdatingIndex;
import com.intellij.rt.execution.junit.FileComparisonFailure;
import com.intellij.testFramework.InspectionTestUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.indexing.FileBasedIndex;
import kotlin.collections.CollectionsKt;
@@ -256,8 +258,10 @@ public abstract class AbstractQuickFixTest extends KotlinLightQuickFixTestCase {
File inspectionFile = QuickfixTestUtilsKt.findInspectionFile(new File(beforeFileName).getParentFile());
if (inspectionFile != null) {
String className = FileUtil.loadFile(inspectionFile).trim();
Class<?> inspectionClass = Class.forName(className);
enableInspectionTools(inspectionClass);
Class<InspectionProfileEntry> inspectionClass = (Class<InspectionProfileEntry>) Class.forName(className);
List<InspectionProfileEntry> tools = InspectionTestUtil.instantiateTools(
Collections.<Class<? extends InspectionProfileEntry>>singletonList(inspectionClass));
enableInspectionTools(tools.get(0));
}
}
@@ -78,6 +78,7 @@ abstract class AbstractJavaToKotlinConverterForWebDemoTest : TestCase() {
override fun isNullable(owner: PsiModifierListOwner, checkBases: Boolean) = !isNotNull(owner, checkBases)
override fun isNotNull(owner: PsiModifierListOwner, checkBases: Boolean) = true
override fun hasHardcodedContracts(element: PsiElement): Boolean = false
override fun getPredefinedNotNulls() = emptyList<String>()
})
applicationEnvironment.application.registerService(JavaClassSupers::class.java, JavaClassSupersImpl::class.java)
@@ -91,7 +91,7 @@ abstract class AbstractIncrementalJpsTest(
private fun enableDebugLogging() {
com.intellij.openapi.diagnostic.Logger.setFactory(TestLoggerFactory::class.java)
TestLoggerFactory.dumpLogToStdout("")
TestLoggerFactory.enableDebugLogging(myTestRootDisposable, "#org")
TestLoggerFactory.enableDebugLogging(testRootDisposable, "#org")
val console = ConsoleAppender()
console.layout = PatternLayout("%d [%p|%c|%C{1}] %m%n")
@@ -268,7 +268,7 @@ abstract class AbstractIncrementalJpsTest(
protected open fun doTest(testDataPath: String) {
testDataDir = File(testDataPath)
workDir = FileUtilRt.createTempDirectory(TEMP_DIRECTORY_TO_USE, "jps-build", null)
Disposer.register(myTestRootDisposable, Disposable { FileUtilRt.delete(workDir) })
Disposer.register(testRootDisposable, Disposable { FileUtilRt.delete(workDir) })
val moduleNames = configureModules()
initialMake()
@@ -20,5 +20,5 @@ import com.intellij.diagnostic.ITNReporter
import com.intellij.openapi.diagnostic.IdeaLoggingEvent
class AndroidExtensionsReportSubmitter : ITNReporter() {
override fun showErrorInRelease(event: IdeaLoggingEvent?) = true
override fun showErrorInRelease(event: IdeaLoggingEvent) = true
}