Compare commits
150 Commits
push/pdn_b
...
master_as2
30
.idea/artifacts/KotlinJpsPlugin.xml
generated
|
|
@@ -1,30 +0,0 @@
|
|||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="KotlinJpsPlugin">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/KotlinJpsPlugin</output-path>
|
||||
<properties id="ant-postprocessing">
|
||||
<options enabled="true">
|
||||
<file>file://$PROJECT_DIR$/idea-runner/runner.xml</file>
|
||||
<target>copy-runtime-for-jps-plugin</target>
|
||||
</options>
|
||||
</properties>
|
||||
<root id="archive" name="kotlin-jps-plugin.jar">
|
||||
<element id="directory" name="META-INF">
|
||||
<element id="dir-copy" path="$PROJECT_DIR$/jps-plugin/src/META-INF" />
|
||||
</element>
|
||||
<element id="module-output" name="cli-common" />
|
||||
<element id="module-output" name="idea-jps-common" />
|
||||
<element id="module-output" name="jps-plugin" />
|
||||
<element id="module-output" name="preloader" />
|
||||
<element id="module-output" name="util" />
|
||||
<element id="module-output" name="util.runtime" />
|
||||
<element id="file-copy" path="$PROJECT_DIR$/resources/kotlinManifest.properties" />
|
||||
<element id="module-output" name="daemon-client" />
|
||||
<element id="module-output" name="daemon-common" />
|
||||
<element id="module-output" name="deserialization" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/dependencies/native-platform-uberjar.jar" path-in-jar="/" />
|
||||
<element id="module-output" name="android-extensions-jps" />
|
||||
<element id="module-output" name="build-common" />
|
||||
<element id="module-output" name="compiler-runner" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
5
.idea/artifacts/KotlinPlugin.xml
generated
|
|
@@ -51,9 +51,7 @@
|
|||
<element id="module-output" name="idea-live-templates" />
|
||||
<element id="module-output" name="resolution" />
|
||||
<element id="module-output" name="plugin-api" />
|
||||
<element id="module-output" name="idea-ultimate" />
|
||||
<element id="module-output" name="formatter" />
|
||||
<element id="module-output" name="idea-maven" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/dependencies/protobuf-2.6.1.jar" path-in-jar="/" />
|
||||
<element id="module-output" name="backend.common" />
|
||||
<element id="module-output" name="ir.tree" />
|
||||
|
|
@@ -62,9 +60,6 @@
|
|||
<element id="module-output" name="annotation-based-compiler-plugins-ide-support" />
|
||||
</element>
|
||||
<element id="library" level="project" name="javax.inject" />
|
||||
<element id="directory" name="jps">
|
||||
<element id="artifact" artifact-name="KotlinJpsPlugin" />
|
||||
</element>
|
||||
<element id="library" level="project" name="markdown" />
|
||||
<element id="archive" name="kotlin-android-extensions-plugin.jar">
|
||||
<element id="module-output" name="android-extensions-idea" />
|
||||
|
|
|
|||
2
.idea/libraries/android_plugin.xml
generated
|
|
@@ -6,7 +6,7 @@
|
|||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/ideaSDK/plugins/android/lib" />
|
||||
<root url="file://$PROJECT_DIR$/ideaSDK/plugins/android/lib/jps" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/android-common.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/android-base-common.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
|
|
|
|||
2
.idea/libraries/asm.xml
generated
|
|
@@ -8,7 +8,7 @@
|
|||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/asm-src.zip!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/asm5-src.zip!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
4
.idea/libraries/guava.xml
generated
|
|
@@ -4,11 +4,11 @@
|
|||
<root url="file://$PROJECT_DIR$/annotations" />
|
||||
</ANNOTATIONS>
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/guava-19.0.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/lib/guava-17.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/guava-19.0-sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/guava-17.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
4
.idea/libraries/idea_full.xml
generated
|
|
@@ -9,9 +9,9 @@
|
|||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/guava-19.0-sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/guava-17.0-sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/asm5-src.zip!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/asm-src.zip!/" />
|
||||
</SOURCES>
|
||||
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/lib" recursive="false" />
|
||||
</library>
|
||||
|
|
|
|||
4
.idea/libraries/intellij_core.xml
generated
|
|
@@ -9,9 +9,9 @@
|
|||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/guava-19.0-sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/guava-17.0-sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/asm5-src.zip!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/sources/sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/dependencies/asm-src.zip!/" />
|
||||
</SOURCES>
|
||||
<jarDirectory url="file://$PROJECT_DIR$/ideaSDK/core" recursive="false" />
|
||||
</library>
|
||||
|
|
|
|||
1
.idea/libraries/properties.xml
generated
|
|
@@ -5,7 +5,6 @@
|
|||
</ANNOTATIONS>
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/plugins/properties/lib/properties.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/ideaSDK/plugins/properties/lib/resources_en.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
|
|
|
|||
1
.idea/misc.xml
generated
|
|
@@ -6,6 +6,7 @@
|
|||
</properties>
|
||||
</component>
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
<list size="1">
|
||||
<item index="0" class="java.lang.String" itemvalue="javax.inject.Inject" />
|
||||
</list>
|
||||
|
|
|
|||
5
.idea/modules.xml
generated
|
|
@@ -8,7 +8,6 @@
|
|||
<module fileurl="file://$PROJECT_DIR$/plugins/lint/android-annotations/android-annotations.iml" filepath="$PROJECT_DIR$/plugins/lint/android-annotations/android-annotations.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/android-extensions/android-extensions-compiler/android-extensions-compiler.iml" filepath="$PROJECT_DIR$/plugins/android-extensions/android-extensions-compiler/android-extensions-compiler.iml" group="plugins/android-extensions" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/android-extensions/android-extensions-idea/android-extensions-idea.iml" filepath="$PROJECT_DIR$/plugins/android-extensions/android-extensions-idea/android-extensions-idea.iml" group="plugins/android-extensions" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/android-extensions/android-extensions-jps/android-extensions-jps.iml" filepath="$PROJECT_DIR$/plugins/android-extensions/android-extensions-jps/android-extensions-jps.iml" group="plugins/android-extensions" />
|
||||
<module fileurl="file://$PROJECT_DIR$/android-studio/android-studio.iml" filepath="$PROJECT_DIR$/android-studio/android-studio.iml" group="ide" />
|
||||
<module fileurl="file://$PROJECT_DIR$/compiler/android-tests/android-tests.iml" filepath="$PROJECT_DIR$/compiler/android-tests/android-tests.iml" group="compiler" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/annotation-based-compiler-plugins-ide-support/annotation-based-compiler-plugins-ide-support.iml" filepath="$PROJECT_DIR$/plugins/annotation-based-compiler-plugins-ide-support/annotation-based-compiler-plugins-ide-support.iml" group="plugins" />
|
||||
|
|
@@ -52,7 +51,6 @@
|
|||
<module fileurl="file://$PROJECT_DIR$/idea/idea-core/idea-core.iml" filepath="$PROJECT_DIR$/idea/idea-core/idea-core.iml" group="ide" />
|
||||
<module fileurl="file://$PROJECT_DIR$/idea/idea-jps-common/idea-jps-common.iml" filepath="$PROJECT_DIR$/idea/idea-jps-common/idea-jps-common.iml" group="ide" />
|
||||
<module fileurl="file://$PROJECT_DIR$/idea/idea-live-templates/idea-live-templates.iml" filepath="$PROJECT_DIR$/idea/idea-live-templates/idea-live-templates.iml" group="ide" />
|
||||
<module fileurl="file://$PROJECT_DIR$/idea/idea-maven/idea-maven.iml" filepath="$PROJECT_DIR$/idea/idea-maven/idea-maven.iml" group="ide" />
|
||||
<module fileurl="file://$PROJECT_DIR$/idea/idea-repl/idea-repl.iml" filepath="$PROJECT_DIR$/idea/idea-repl/idea-repl.iml" group="ide" />
|
||||
<module fileurl="file://$PROJECT_DIR$/idea-runner/idea-runner.iml" filepath="$PROJECT_DIR$/idea-runner/idea-runner.iml" group="ide" />
|
||||
<module fileurl="file://$PROJECT_DIR$/idea/idea-test-framework/idea-test-framework.iml" filepath="$PROJECT_DIR$/idea/idea-test-framework/idea-test-framework.iml" group="ide" />
|
||||
|
|
@@ -63,8 +61,6 @@
|
|||
<module fileurl="file://$PROJECT_DIR$/compiler/ir/ir.tree/ir.tree.iml" filepath="$PROJECT_DIR$/compiler/ir/ir.tree/ir.tree.iml" group="compiler/ir" />
|
||||
<module fileurl="file://$PROJECT_DIR$/j2k/j2k.iml" filepath="$PROJECT_DIR$/j2k/j2k.iml" group="j2k" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/java-model-wrappers/java-model-wrappers.iml" filepath="$PROJECT_DIR$/plugins/java-model-wrappers/java-model-wrappers.iml" group="plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/jps-plugin/jps-plugin.iml" filepath="$PROJECT_DIR$/jps-plugin/jps-plugin.iml" group="ide/jps" />
|
||||
<module fileurl="file://$PROJECT_DIR$/jps-plugin/jps-tests/jps-tests.iml" filepath="$PROJECT_DIR$/jps-plugin/jps-tests/jps-tests.iml" group="ide/jps" />
|
||||
<module fileurl="file://$PROJECT_DIR$/js/js.ast/js.ast.iml" filepath="$PROJECT_DIR$/js/js.ast/js.ast.iml" group="compiler/js" />
|
||||
<module fileurl="file://$PROJECT_DIR$/js/js.frontend/js.frontend.iml" filepath="$PROJECT_DIR$/js/js.frontend/js.frontend.iml" group="compiler/js" />
|
||||
<module fileurl="file://$PROJECT_DIR$/js/js.inliner/js.inliner.iml" filepath="$PROJECT_DIR$/js/js.inliner/js.inliner.iml" group="compiler/js" />
|
||||
|
|
@@ -72,7 +68,6 @@
|
|||
<module fileurl="file://$PROJECT_DIR$/js/js.serializer/js.serializer.iml" filepath="$PROJECT_DIR$/js/js.serializer/js.serializer.iml" group="compiler/js" />
|
||||
<module fileurl="file://$PROJECT_DIR$/js/js.tests/js.tests.iml" filepath="$PROJECT_DIR$/js/js.tests/js.tests.iml" group="compiler/js" />
|
||||
<module fileurl="file://$PROJECT_DIR$/js/js.translator/js.translator.iml" filepath="$PROJECT_DIR$/js/js.translator/js.translator.iml" group="compiler/js" />
|
||||
<module fileurl="file://$PROJECT_DIR$/jps-plugin/kannotator-jps-plugin-test/kannotator-jps-plugin-test.iml" filepath="$PROJECT_DIR$/jps-plugin/kannotator-jps-plugin-test/kannotator-jps-plugin-test.iml" group="ide/jps" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/kapt3/kapt3.iml" filepath="$PROJECT_DIR$/plugins/kapt3/kapt3.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/idea/kotlin-gradle-tooling/kotlin-gradle-tooling.iml" filepath="$PROJECT_DIR$/idea/kotlin-gradle-tooling/kotlin-gradle-tooling.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/compiler/light-classes/light-classes.iml" filepath="$PROJECT_DIR$/compiler/light-classes/light-classes.iml" group="compiler/java" />
|
||||
|
|
|
|||
|
|
@@ -154,7 +154,7 @@
|
|||
<print-file-size-statistic path="${js.stdlib.output.dir}" file-name="${compiled.stdlib.js}"/>
|
||||
</target>
|
||||
|
||||
<target name="post_build" depends="zipArtifacts, revertTemplateFiles, printStatistics, remove_internal_artifacts, dont_remove_internal_artifacts"/>
|
||||
<target name="post_build" depends="patchXmlForAndroidStudio, zipArtifacts, revertTemplateFiles, printStatistics, remove_internal_artifacts, dont_remove_internal_artifacts"/>
|
||||
|
||||
<target name="none">
|
||||
<fail message="Either specify pre_build or post_build"/>
|
||||
|
|
@@ -192,4 +192,28 @@
|
|||
<target name="dont_remove_internal_artifacts" unless="need.remove.artifacts">
|
||||
<echo message="Internal artifacts left untouched"/>
|
||||
</target>
|
||||
|
||||
<macrodef name="patch_plugin_xml">
|
||||
<attribute name="plugin.xml" />
|
||||
<sequential>
|
||||
<replace file="@{plugin.xml}" token="<!-- DEPENDS-ON-AS-PLACEHOLDER -->" value="<depends>com.intellij.modules.androidstudio</depends>"/>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<target name="patchXmlForAndroidStudio">
|
||||
<unzip src="${artifact.output.path}/Kotlin/lib/kotlin-plugin.jar" dest="tmpAndroidStudio">
|
||||
<patternset>
|
||||
<include name="META-INF/plugin.xml"/>
|
||||
</patternset>
|
||||
</unzip>
|
||||
|
||||
<patch_plugin_xml plugin.xml="tmpAndroidStudio/META-INF/plugin.xml"/>
|
||||
|
||||
<jar destfile="${artifact.output.path}/Kotlin/lib/kotlin-plugin.jar" update="true">
|
||||
<fileset dir="tmpAndroidStudio"/>
|
||||
<file file="META-INF/plugin.xml"/>
|
||||
</jar>
|
||||
|
||||
<delete file="tmpAndroidStudio"/>
|
||||
</target>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@@ -28,8 +28,7 @@
|
|||
<property name="protobuf-lite.jar" value="${basedir}/dependencies/protobuf-2.6.1-lite.jar"/>
|
||||
<property name="javax.inject.jar" value="${basedir}/lib/javax.inject.jar"/>
|
||||
|
||||
<property name="java.target" value="1.8"/>
|
||||
<property name="java.target.1.6" value="1.6"/>
|
||||
<property name="java.target" value="1.6"/>
|
||||
|
||||
<condition property="bootstrap.or.local.build" value="true">
|
||||
<or>
|
||||
|
|
@@ -1073,7 +1072,7 @@
|
|||
</java>
|
||||
|
||||
<javac2 srcdir="${toString:src.dirset}" destdir="@{output}" debug="true" debuglevel="lines,vars,source"
|
||||
includeAntRuntime="false" source="${java.target.1.6}" target="${java.target.1.6}">
|
||||
includeAntRuntime="false" source="${java.target}" target="${java.target}">
|
||||
<skip pattern="kotlin/Metadata"/>
|
||||
<classpath>
|
||||
<path refid="classpath.path"/>
|
||||
|
|
|
|||
|
|
@@ -1,60 +0,0 @@
|
|||
/*
|
||||
* Copyright 2010-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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.android.tests;
|
||||
|
||||
import org.jetbrains.kotlin.jps.build.BaseKotlinJpsBuildTestCase;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class AndroidJpsBuildTestCase extends BaseKotlinJpsBuildTestCase {
|
||||
private static final String PROJECT_NAME = "android-module";
|
||||
private static final String SDK_NAME = "Android_SDK";
|
||||
|
||||
private final File workDir = new File(AndroidRunner.getPathManager().getTmpFolder());
|
||||
|
||||
public void doTest() {
|
||||
initProject();
|
||||
rebuildAllModules();
|
||||
buildAllModules().assertSuccessful();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getProjectName() {
|
||||
return "android-module";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runTest() throws Throwable {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "AndroidJpsTest";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected File doGetProjectDir() throws IOException {
|
||||
return workDir;
|
||||
}
|
||||
|
||||
private void initProject() {
|
||||
addJdk(SDK_NAME, AndroidRunner.getPathManager().getPlatformFolderInAndroidSdk() + "/android.jar");
|
||||
loadProject(workDir.getAbsolutePath() + File.separator + PROJECT_NAME + ".ipr");
|
||||
}
|
||||
}
|
||||
|
|
@@ -1,71 +0,0 @@
|
|||
/*
|
||||
* Copyright 2010-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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.android.tests;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import junit.framework.TestSuite;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
public class AndroidRunner extends TestSuite {
|
||||
|
||||
private static PathManager pathManager;
|
||||
|
||||
@NotNull
|
||||
public static PathManager getPathManager() {
|
||||
if (pathManager == null) {
|
||||
File tmpFolder = Files.createTempDir();
|
||||
System.out.println("Created temporary folder for running android tests: " + tmpFolder.getAbsolutePath());
|
||||
File rootFolder = new File("");
|
||||
pathManager = new PathManager(rootFolder.getAbsolutePath(), tmpFolder.getAbsolutePath());
|
||||
}
|
||||
return pathManager;
|
||||
}
|
||||
|
||||
public static TestSuite suite() throws Throwable {
|
||||
PathManager pathManager = getPathManager();
|
||||
|
||||
FileUtil.copyDir(new File(pathManager.getAndroidModuleRoot()), new File(pathManager.getTmpFolder()));
|
||||
writeAndroidSkdToLocalProperties();
|
||||
|
||||
CodegenTestsOnAndroidGenerator.generate(pathManager);
|
||||
|
||||
System.out.println("Run tests on android...");
|
||||
TestSuite suite = CodegenTestsOnAndroidRunner.getTestSuite(pathManager);
|
||||
//AndroidJpsBuildTestCase indirectly depends on UsefulTestCase which compiled against java 8
|
||||
//TODO: Need add separate run configuration for AndroidJpsBuildTestCase
|
||||
//suite.addTest(new AndroidJpsBuildTestCase());
|
||||
return suite;
|
||||
}
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
// Clear tmp folder where we run android tests
|
||||
FileUtil.delete(new File(pathManager.getTmpFolder()));
|
||||
}
|
||||
|
||||
private static void writeAndroidSkdToLocalProperties() throws IOException {
|
||||
System.out.println("Writing android sdk to local.properties: " + pathManager.getAndroidSdkRoot());
|
||||
File file = new File(pathManager.getTmpFolder() + "/local.properties");
|
||||
try (FileWriter fw = new FileWriter(file)) {
|
||||
fw.write("sdk.dir=" + pathManager.getAndroidSdkRoot());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@@ -158,11 +158,6 @@ class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJ
|
|||
return result
|
||||
}
|
||||
|
||||
override fun findModules(moduleName: String, scope: GlobalSearchScope): Collection<PsiJavaModule> {
|
||||
// TODO
|
||||
return emptySet()
|
||||
}
|
||||
|
||||
override fun getNonTrivialPackagePrefixes(): Collection<String> = emptyList()
|
||||
|
||||
companion object {
|
||||
|
|
|
|||
|
|
@@ -25,13 +25,10 @@ import com.intellij.core.CoreApplicationEnvironment
|
|||
import com.intellij.core.CoreJavaFileManager
|
||||
import com.intellij.core.JavaCoreApplicationEnvironment
|
||||
import com.intellij.core.JavaCoreProjectEnvironment
|
||||
import com.intellij.lang.MetaLanguage
|
||||
import com.intellij.lang.java.JavaParserDefinition
|
||||
import com.intellij.mock.MockApplication
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.application.TransactionGuard
|
||||
import com.intellij.openapi.application.TransactionGuardImpl
|
||||
import com.intellij.openapi.components.ServiceManager
|
||||
import com.intellij.openapi.extensions.Extensions
|
||||
import com.intellij.openapi.extensions.ExtensionsArea
|
||||
|
|
@@ -48,7 +45,6 @@ import com.intellij.openapi.vfs.impl.ZipHandler
|
|||
import com.intellij.psi.FileContextProvider
|
||||
import com.intellij.psi.PsiElementFinder
|
||||
import com.intellij.psi.augment.PsiAugmentProvider
|
||||
import com.intellij.psi.augment.TypeAnnotationModifier
|
||||
import com.intellij.psi.compiled.ClassFileDecompilers
|
||||
import com.intellij.psi.impl.JavaClassSupersImpl
|
||||
import com.intellij.psi.impl.PsiElementFinderImpl
|
||||
|
|
@@ -119,28 +115,6 @@ class KotlinCoreEnvironment private constructor(
|
|||
override fun preregisterServices() {
|
||||
registerProjectExtensionPoints(Extensions.getArea(project))
|
||||
}
|
||||
|
||||
override fun registerJavaPsiFacade() {
|
||||
with (project) {
|
||||
registerService(CoreJavaFileManager::class.java, ServiceManager.getService(this, JavaFileManager::class.java) as CoreJavaFileManager)
|
||||
|
||||
val cliLightClassGenerationSupport = CliLightClassGenerationSupport(this)
|
||||
registerService(LightClassGenerationSupport::class.java, cliLightClassGenerationSupport)
|
||||
registerService(CliLightClassGenerationSupport::class.java, cliLightClassGenerationSupport)
|
||||
registerService(CodeAnalyzerInitializer::class.java, cliLightClassGenerationSupport)
|
||||
|
||||
registerService(ExternalAnnotationsManager::class.java, MockExternalAnnotationsManager())
|
||||
registerService(InferredAnnotationsManager::class.java, MockInferredAnnotationsManager())
|
||||
|
||||
val area = Extensions.getArea(this)
|
||||
|
||||
area.getExtensionPoint(PsiElementFinder.EP_NAME).registerExtension(JavaElementFinder(this, cliLightClassGenerationSupport))
|
||||
area.getExtensionPoint(PsiElementFinder.EP_NAME).registerExtension(
|
||||
PsiElementFinderImpl(this, ServiceManager.getService(this, JavaFileManager::class.java)))
|
||||
}
|
||||
|
||||
super.registerJavaPsiFacade()
|
||||
}
|
||||
}
|
||||
private val sourceFiles = ArrayList<KtFile>()
|
||||
private val rootsIndex: JvmDependenciesDynamicCompoundIndex
|
||||
|
|
@@ -366,7 +340,7 @@ class KotlinCoreEnvironment private constructor(
|
|||
|
||||
@JvmStatic
|
||||
private fun setCompatibleBuild() {
|
||||
System.getProperties().setProperty("idea.plugins.compatible.build", "171.9999")
|
||||
//System.getProperties().setProperty("idea.plugins.compatible.build", "161.9999")
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
|
|
@@ -432,9 +406,6 @@ class KotlinCoreEnvironment private constructor(
|
|||
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ContainerProvider.EP_NAME, ContainerProvider::class.java)
|
||||
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ClsCustomNavigationPolicy.EP_NAME, ClsCustomNavigationPolicy::class.java)
|
||||
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), ClassFileDecompilers.EP_NAME, ClassFileDecompilers.Decompiler::class.java)
|
||||
//
|
||||
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), TypeAnnotationModifier.EP_NAME, TypeAnnotationModifier::class.java)
|
||||
CoreApplicationEnvironment.registerExtensionPoint(Extensions.getRootArea(), MetaLanguage.EP_NAME, MetaLanguage::class.java)
|
||||
}
|
||||
|
||||
private fun registerApplicationExtensionPointsAndExtensionsFrom(configuration: CompilerConfiguration, configFilePath: String) {
|
||||
|
|
@@ -468,7 +439,6 @@ class KotlinCoreEnvironment private constructor(
|
|||
registerParserDefinition(KotlinParserDefinition())
|
||||
application.registerService(KotlinBinaryClassCache::class.java, KotlinBinaryClassCache())
|
||||
application.registerService(JavaClassSupers::class.java, JavaClassSupersImpl::class.java)
|
||||
application.registerService(TransactionGuard::class.java, TransactionGuardImpl::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@@ -489,11 +459,23 @@ class KotlinCoreEnvironment private constructor(
|
|||
}
|
||||
|
||||
private fun registerProjectServicesForCLI(projectEnvironment: JavaCoreProjectEnvironment) {
|
||||
/**
|
||||
* Note that Kapt may restart code analysis process, and CLI services should be aware of that.
|
||||
* Use PsiManager.getModificationTracker() to ensure that all the data you cached is still valid.
|
||||
*/
|
||||
with (projectEnvironment.project) {
|
||||
registerService(CoreJavaFileManager::class.java, ServiceManager.getService(this, JavaFileManager::class.java) as CoreJavaFileManager)
|
||||
|
||||
val cliLightClassGenerationSupport = CliLightClassGenerationSupport(this)
|
||||
registerService(LightClassGenerationSupport::class.java, cliLightClassGenerationSupport)
|
||||
registerService(CliLightClassGenerationSupport::class.java, cliLightClassGenerationSupport)
|
||||
registerService(CodeAnalyzerInitializer::class.java, cliLightClassGenerationSupport)
|
||||
|
||||
registerService(ExternalAnnotationsManager::class.java, MockExternalAnnotationsManager())
|
||||
registerService(InferredAnnotationsManager::class.java, MockInferredAnnotationsManager())
|
||||
|
||||
val area = Extensions.getArea(this)
|
||||
|
||||
area.getExtensionPoint(PsiElementFinder.EP_NAME).registerExtension(JavaElementFinder(this, cliLightClassGenerationSupport))
|
||||
area.getExtensionPoint(PsiElementFinder.EP_NAME).registerExtension(
|
||||
PsiElementFinderImpl(this, ServiceManager.getService(this, JavaFileManager::class.java)))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -26,5 +26,11 @@ open class KotlinCoreProjectEnvironment(
|
|||
disposable: Disposable,
|
||||
applicationEnvironment: JavaCoreApplicationEnvironment
|
||||
) : JavaCoreProjectEnvironment(disposable, applicationEnvironment) {
|
||||
init {
|
||||
myProject.registerService<ControlFlowFactory>(ControlFlowFactory::class.java,
|
||||
ControlFlowFactory(myPsiManager))
|
||||
|
||||
}
|
||||
|
||||
override fun createCoreFileManager() = KotlinCliJavaFileManagerImpl(PsiManager.getInstance(project))
|
||||
}
|
||||
|
|
@@ -45,10 +45,6 @@ messages/**)
|
|||
-dontwarn com.google.j2objc.annotations.Weak
|
||||
-dontwarn org.iq80.snappy.HadoopSnappyCodec$SnappyCompressionInputStream
|
||||
-dontwarn org.iq80.snappy.HadoopSnappyCodec$SnappyCompressionOutputStream
|
||||
-dontwarn com.google.common.util.concurrent.*
|
||||
-dontwarn org.apache.xerces.dom.**
|
||||
-dontwarn org.apache.xerces.util.**
|
||||
-dontwarn org.w3c.dom.ElementTraversal
|
||||
|
||||
-libraryjars '<rtjar>'
|
||||
-libraryjars '<jssejar>'
|
||||
|
|
@@ -56,6 +52,7 @@ messages/**)
|
|||
-libraryjars '<bootstrap.reflect>'
|
||||
-libraryjars '<bootstrap.script.runtime>'
|
||||
|
||||
-target 1.6
|
||||
-dontoptimize
|
||||
-dontobfuscate
|
||||
|
||||
|
|
|
|||
|
|
@@ -20,14 +20,15 @@ import com.google.common.collect.*
|
|||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.Nullability.NOT_NULL
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.TypeUtils
|
||||
import org.jetbrains.kotlin.types.isFlexible
|
||||
import org.jetbrains.kotlin.types.typeUtil.isSubtypeOf
|
||||
import org.jetbrains.kotlin.utils.newLinkedHashSetWithExpectedSize
|
||||
import org.jetbrains.kotlin.types.typeUtil.*
|
||||
|
||||
import java.util.*
|
||||
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.Nullability.NOT_NULL
|
||||
|
||||
internal class DelegatingDataFlowInfo private constructor(
|
||||
private val parent: DataFlowInfo?,
|
||||
private val nullabilityInfo: ImmutableMap<DataFlowValue, Nullability>,
|
||||
|
|
@@ -120,7 +121,7 @@ internal class DelegatingDataFlowInfo private constructor(
|
|||
return types
|
||||
}
|
||||
|
||||
val enrichedTypes = newLinkedHashSetWithExpectedSize<KotlinType>(types.size + 1)
|
||||
val enrichedTypes = Sets.newHashSetWithExpectedSize<KotlinType>(types.size + 1)
|
||||
val originalType = key.type
|
||||
for (type in types) {
|
||||
enrichedTypes.add(TypeUtils.makeNotNullable(type))
|
||||
|
|
|
|||
|
|
@@ -61,7 +61,7 @@ open class KtLightClassForLocalDeclaration(
|
|||
if (createWrapper) {
|
||||
return object : LightMethod(myManager, method, containingClass!!, KotlinLanguage.INSTANCE) {
|
||||
override fun getParent(): PsiElement {
|
||||
return getContainingClass()
|
||||
return getContainingClass()!!
|
||||
}
|
||||
|
||||
override fun getName(): String {
|
||||
|
|
|
|||
|
|
@@ -23,7 +23,6 @@ import com.intellij.psi.PsiElementVisitor
|
|||
import com.intellij.psi.impl.compiled.ClsFileImpl
|
||||
import com.intellij.psi.stubs.PsiClassHolderFileStub
|
||||
import org.jetbrains.kotlin.asJava.classes.KtLightClass
|
||||
import org.jetbrains.kotlin.asJava.classes.KtLightClassForFacade
|
||||
import org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
|
|
@@ -70,13 +69,4 @@ open class FakeFileForLightClass(
|
|||
}
|
||||
|
||||
override fun isEquivalentTo(another: PsiElement?) = this == another
|
||||
|
||||
override fun setPackageName(packageName: String) {
|
||||
if (lightClass() is KtLightClassForFacade) {
|
||||
ktFile.packageDirective?.fqName = FqName(packageName)
|
||||
}
|
||||
else {
|
||||
super.setPackageName(packageName)
|
||||
}
|
||||
}
|
||||
}
|
||||
1
compiler/testData/cli/js/version.out
vendored
|
|
@@ -1,2 +1,3 @@
|
|||
info: Kotlin Compiler version $VERSION$
|
||||
warning: running the Kotlin compiler under Java 6 or 7 is unsupported and will no longer be possible in a future update.
|
||||
OK
|
||||
|
|
|
|||
|
|
@@ -1,4 +1,5 @@
|
|||
warning: flag is not supported by this version of the compiler: -Xabcdefghijklm
|
||||
warning: flag is not supported by this version of the compiler: -Xnopqrstuvwxyz
|
||||
warning: flag is not supported by this version of the compiler: -XXxxxxxxxxxxxx
|
||||
warning: running the Kotlin compiler under Java 6 or 7 is unsupported and will no longer be possible in a future update.
|
||||
OK
|
||||
|
|
|
|||
1
compiler/testData/cli/jvm/version.out
vendored
|
|
@@ -1,2 +1,3 @@
|
|||
info: Kotlin Compiler version $VERSION$
|
||||
warning: running the Kotlin compiler under Java 6 or 7 is unsupported and will no longer be possible in a future update.
|
||||
OK
|
||||
|
|
|
|||
|
|
@@ -2,16 +2,21 @@
|
|||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// FULL_JDK
|
||||
// WITH_RUNTIME
|
||||
|
||||
//This front-end problem test added to box ones only cause of FULL_JDK support
|
||||
import org.w3c.dom.Element
|
||||
import org.xml.sax.InputSource
|
||||
import javax.xml.parsers.DocumentBuilderFactory
|
||||
import java.io.StringReader
|
||||
|
||||
class MyElement(e: Element): Element by e {
|
||||
fun bar() = "OK"
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
val touch = MyElement::class.java
|
||||
return "OK"
|
||||
val factory = DocumentBuilderFactory.newInstance()!!;
|
||||
val builder = factory.newDocumentBuilder()!!;
|
||||
val source = InputSource(StringReader("<OK></OK>"));
|
||||
val doc = builder.parse(source)!!;
|
||||
val myElement = MyElement(doc.getDocumentElement()!!)
|
||||
return myElement.getTagName()!!
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -25,10 +25,8 @@ fun box(): String {
|
|||
|
||||
// Java class without nested classes
|
||||
assertEquals(emptyList<String>(), nestedNames(Error::class))
|
||||
// Java interface with nested classes
|
||||
assertEquals(listOf("Entry"), nestedNames(java.util.Map::class))
|
||||
// Java class with nested classes
|
||||
assertEquals(listOf("SimpleEntry", "SimpleImmutableEntry"), nestedNames(java.util.AbstractMap::class))
|
||||
assertEquals(listOf("State", "UncaughtExceptionHandler"), nestedNames(Thread::class))
|
||||
|
||||
// Built-ins
|
||||
assertEquals(emptyList<String>(), nestedNames(Array<Any>::class))
|
||||
|
|
|
|||
|
|
@@ -1,5 +1,5 @@
|
|||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
// IGNORE_BACKEND: JS, NATIVE, JVM
|
||||
|
||||
// WITH_REFLECT
|
||||
// FULL_JDK
|
||||
|
|
|
|||
|
|
@@ -16,10 +16,10 @@ open class TypeLiteral<T> {
|
|||
inline fun <reified T> typeLiteral(): TypeLiteral<T> = object : TypeLiteral<T>() {}
|
||||
|
||||
fun box(): String {
|
||||
assertEquals("java.lang.String", (typeLiteral<String>().type as Class<*>).canonicalName)
|
||||
assertEquals("class java.lang.String", typeLiteral<String>().type.toString())
|
||||
assertEquals("java.util.List<?>", typeLiteral<List<*>>().type.toString())
|
||||
assertEquals("java.lang.String[]", (typeLiteral<Array<String>>().type as Class<*>).canonicalName)
|
||||
assertEquals("java.lang.Integer[]", (typeLiteral<Array<Int>>().type as Class<*>).canonicalName)
|
||||
assertEquals("java.lang.String[][]", (typeLiteral<Array<Array<String>>>().type as Class<*>).canonicalName)
|
||||
assertEquals("java.lang.String[]", typeLiteral<Array<String>>().type.toString())
|
||||
assertEquals("java.lang.Integer[]", typeLiteral<Array<Int>>().type.toString())
|
||||
assertEquals("java.lang.String[][]", typeLiteral<Array<Array<String>>>().type.toString())
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -1,26 +0,0 @@
|
|||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// WITH_REFLECT
|
||||
// FULL_JDK
|
||||
// See KT-11258 Incorrect resolution sequence for Java field
|
||||
|
||||
//SHOULD BE deleted after KT-16616 fix
|
||||
import java.util.*
|
||||
|
||||
fun box(): String {
|
||||
listOf(
|
||||
ArrayList::class,
|
||||
LinkedList::class,
|
||||
AbstractList::class,
|
||||
HashSet::class,
|
||||
TreeSet::class,
|
||||
HashMap::class,
|
||||
TreeMap::class,
|
||||
AbstractMap::class,
|
||||
AbstractMap.SimpleEntry::class
|
||||
).map {
|
||||
it.members.map(Any::toString)
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
|
|
@@ -1,53 +0,0 @@
|
|||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// FULL_JDK
|
||||
// WITH_RUNTIME
|
||||
interface ImmutableCollection<out E> : Collection<E> {
|
||||
fun add(element: @UnsafeVariance E): ImmutableCollection<E>
|
||||
fun addAll(elements: Collection<@UnsafeVariance E>): ImmutableCollection<E>
|
||||
fun remove(element: @UnsafeVariance E): ImmutableCollection<E>
|
||||
}
|
||||
|
||||
class ImmutableCollectionmpl<E> : ImmutableCollection<E> {
|
||||
override val size: Int
|
||||
get() = throw UnsupportedOperationException()
|
||||
|
||||
override fun contains(element: E): Boolean {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
override fun containsAll(elements: Collection<E>): Boolean {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
override fun isEmpty(): Boolean {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
override fun iterator(): Iterator<E> {
|
||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
override fun add(element: E): ImmutableCollection<E> = this
|
||||
override fun addAll(elements: Collection<E>): ImmutableCollection<E> = this
|
||||
override fun remove(element: E): ImmutableCollection<E> = this
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val c = ImmutableCollectionmpl<String>()
|
||||
if (c.remove("") !== c) return "fail 1"
|
||||
if (c.add("") !== c) return "fail 2"
|
||||
if (c.addAll(java.util.ArrayList()) !== c) return "fail 3"
|
||||
|
||||
val method = c.javaClass.methods.single { it.name == "remove" && it.returnType == Boolean::class.javaPrimitiveType }
|
||||
|
||||
try {
|
||||
method.invoke(c, "")
|
||||
return "fail 4"
|
||||
} catch (e: java.lang.reflect.InvocationTargetException) {
|
||||
if (e.cause!!.message != "Operation is not supported for read-only collection") return "fail 5: ${e.cause!!.message}"
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
|
@@ -1,22 +0,0 @@
|
|||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS, NATIVE
|
||||
|
||||
// WITH_REFLECT
|
||||
// FILE: J.java
|
||||
|
||||
public class J {
|
||||
void foo(String s, int i) {}
|
||||
|
||||
static void bar(J j) {}
|
||||
}
|
||||
|
||||
// FILE: K.kt
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(listOf(null, "arg0", "arg1"), J::foo.parameters.map { it.name })
|
||||
assertEquals(listOf("arg0"), J::bar.parameters.map { it.name })
|
||||
|
||||
return "OK"
|
||||
}
|
||||
33
compiler/testData/codegen/light-analysis/builtinStubMethods/immutableRemove.txt
vendored
Normal file
|
|
@@ -0,0 +1,33 @@
|
|||
@kotlin.Metadata
|
||||
public interface ImmutableCollection {
|
||||
public abstract @org.jetbrains.annotations.NotNull method add(p0: java.lang.Object): ImmutableCollection
|
||||
public abstract @org.jetbrains.annotations.NotNull method addAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): ImmutableCollection
|
||||
public abstract @org.jetbrains.annotations.NotNull method remove(p0: java.lang.Object): ImmutableCollection
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class ImmutableCollectionmpl {
|
||||
public method <init>(): void
|
||||
public @org.jetbrains.annotations.NotNull method add(p0: java.lang.Object): ImmutableCollection
|
||||
public method add(p0: java.lang.Object): boolean
|
||||
public @org.jetbrains.annotations.NotNull method addAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): ImmutableCollection
|
||||
public method addAll(p0: java.util.Collection): boolean
|
||||
public method clear(): void
|
||||
public method contains(p0: java.lang.Object): boolean
|
||||
public method containsAll(@org.jetbrains.annotations.NotNull p0: java.util.Collection): boolean
|
||||
public method getSize(): int
|
||||
public method isEmpty(): boolean
|
||||
public @org.jetbrains.annotations.NotNull method iterator(): java.util.Iterator
|
||||
public @org.jetbrains.annotations.NotNull method remove(p0: java.lang.Object): ImmutableCollection
|
||||
public method remove(p0: java.lang.Object): boolean
|
||||
public method removeAll(p0: java.util.Collection): boolean
|
||||
public method retainAll(p0: java.util.Collection): boolean
|
||||
public final method size(): int
|
||||
public method toArray(): java.lang.Object[]
|
||||
public method toArray(p0: java.lang.Object[]): java.lang.Object[]
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class ImmutableRemoveKt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
4
compiler/testData/codegen/light-analysis/reflection/parameters/javaParametersHaveNoNames.txt
vendored
Normal file
|
|
@@ -0,0 +1,4 @@
|
|||
@kotlin.Metadata
|
||||
public final class KKt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
13
compiler/testData/compileJavaAgainstKotlin/sealed/Derived.txt
vendored
Normal file
|
|
@@ -0,0 +1,13 @@
|
|||
package test
|
||||
|
||||
public sealed class Season {
|
||||
private constructor Season()
|
||||
|
||||
public final class Cold : test.Season {
|
||||
public constructor Cold()
|
||||
}
|
||||
|
||||
public final class Warm : test.Season {
|
||||
public constructor Warm()
|
||||
}
|
||||
}
|
||||
13
compiler/testData/compileJavaAgainstKotlin/sealed/Instance.txt
vendored
Normal file
|
|
@@ -0,0 +1,13 @@
|
|||
package test
|
||||
|
||||
public sealed class Season {
|
||||
private constructor Season()
|
||||
|
||||
public final class Cold : test.Season {
|
||||
public constructor Cold()
|
||||
}
|
||||
|
||||
public final class Warm : test.Season {
|
||||
public constructor Warm()
|
||||
}
|
||||
}
|
||||
9
compiler/testData/compileJavaAgainstKotlin/targets/annotation.txt
vendored
Normal file
|
|
@@ -0,0 +1,9 @@
|
|||
package test
|
||||
|
||||
@test.meta public/*package*/ final annotation class MyAnn : kotlin.Annotation {
|
||||
public/*package*/ constructor MyAnn()
|
||||
}
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.ANNOTATION_CLASS}) public final annotation class meta : kotlin.Annotation {
|
||||
public constructor meta()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/classifier.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS}) public final annotation class classifier : kotlin.Annotation {
|
||||
public constructor classifier()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/constructor.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CONSTRUCTOR}) public final annotation class constructor : kotlin.Annotation {
|
||||
public constructor constructor()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/empty.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {}) public final annotation class empty : kotlin.Annotation {
|
||||
public constructor empty()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/field.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FIELD}) public final annotation class field : kotlin.Annotation {
|
||||
public constructor field()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/function.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) public final annotation class function : kotlin.Annotation {
|
||||
public constructor function()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/getter.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.PROPERTY_GETTER}) public final annotation class getter : kotlin.Annotation {
|
||||
public constructor getter()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/local.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.LOCAL_VARIABLE}) public final annotation class local : kotlin.Annotation {
|
||||
public constructor local()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/multiple.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.FUNCTION}) public final annotation class multiple : kotlin.Annotation {
|
||||
public constructor multiple()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/parameter.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.VALUE_PARAMETER}) public final annotation class parameter : kotlin.Annotation {
|
||||
public constructor parameter()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/property.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.PROPERTY}) public final annotation class property : kotlin.Annotation {
|
||||
public constructor property()
|
||||
}
|
||||
5
compiler/testData/compileJavaAgainstKotlin/targets/setter.txt
vendored
Normal file
|
|
@@ -0,0 +1,5 @@
|
|||
package test
|
||||
|
||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.PROPERTY_SETTER}) public final annotation class setter : kotlin.Annotation {
|
||||
public constructor setter()
|
||||
}
|
||||
|
|
@@ -5,11 +5,11 @@ build:
|
|||
[mkdir] Created dir: [Temp]/classes
|
||||
[javac] Compiling 1 source file to [Temp]/classes
|
||||
[javac] Running javac...
|
||||
[javac] [TestData]/J.java:3: error: cannot find symbol
|
||||
[javac] [TestData]/J.java:3: cannot find symbol
|
||||
[javac] symbol : class KClassesKt
|
||||
[javac] location: package kotlin.reflect
|
||||
[javac] import kotlin.reflect.KClassesKt;
|
||||
[javac] ^
|
||||
[javac] symbol: class KClassesKt
|
||||
[javac] location: package kotlin.reflect
|
||||
[javac] 1 error
|
||||
|
||||
ERR:
|
||||
|
|
|
|||
|
|
@@ -5,7 +5,7 @@ build:
|
|||
[mkdir] Created dir: [Temp]/classes
|
||||
[javac] Compiling 1 source file to [Temp]/classes
|
||||
[javac] Running javac...
|
||||
[javac] [TestData]/J.java:3: error: package kotlin does not exist
|
||||
[javac] [TestData]/J.java:3: package kotlin does not exist
|
||||
[javac] import kotlin.Unit;
|
||||
[javac] ^
|
||||
[javac] 1 error
|
||||
|
|
|
|||
|
|
@@ -1,5 +1,3 @@
|
|||
// FULL_JDK
|
||||
|
||||
package test;
|
||||
|
||||
public abstract class ClassDoesNotOverrideMethod extends java.util.Date {
|
||||
|
|
|
|||
|
|
@@ -1,5 +1,3 @@
|
|||
// FULL_JDK
|
||||
|
||||
package test;
|
||||
|
||||
public abstract class ClassWithTypePExtendsIterableP<P> implements java.lang.Iterable<P> {
|
||||
|
|
|
|||
14
compiler/testData/loadJava/compiledJava/InnerClassesInGeneric.runtime.txt
vendored
Normal file
|
|
@@ -0,0 +1,14 @@
|
|||
package test
|
||||
|
||||
public open class InnerClassesInGeneric</*0*/ P : kotlin.Any!, /*1*/ Q : kotlin.Any!> {
|
||||
public constructor InnerClassesInGeneric</*0*/ P : kotlin.Any!, /*1*/ Q : kotlin.Any!>()
|
||||
|
||||
public open inner class Inner /*captured type parameters: /*0*/ P : kotlin.Any!, /*1*/ Q : kotlin.Any!*/ {
|
||||
public constructor Inner()
|
||||
}
|
||||
|
||||
public open inner class Inner2 /*captured type parameters: /*0*/ P : kotlin.Any!, /*1*/ Q : kotlin.Any!*/ : test.InnerClassesInGeneric<kotlin.Any!, kotlin.Any!>.Inner {
|
||||
public constructor Inner2()
|
||||
public open operator fun iterator(): kotlin.collections.(Mutable)Iterator<P!>!
|
||||
}
|
||||
}
|
||||
28
compiler/testData/loadJava/compiledJava/InnerOfGeneric.runtime.txt
vendored
Normal file
|
|
@@ -0,0 +1,28 @@
|
|||
package test
|
||||
|
||||
public open class InnerOfGeneric {
|
||||
public constructor InnerOfGeneric()
|
||||
|
||||
public abstract inner class A</*0*/ K : kotlin.Any!> {
|
||||
public constructor A</*0*/ K : kotlin.Any!>()
|
||||
|
||||
public abstract inner class Inner /*captured type parameters: /*0*/ K : kotlin.Any!*/ : test.InnerOfGeneric.S<K!> {
|
||||
public constructor Inner()
|
||||
public open override /*1*/ /*fake_override*/ fun iterator(): kotlin.collections.(Mutable)Iterator<K!>!
|
||||
}
|
||||
}
|
||||
|
||||
public open inner class B</*0*/ L : kotlin.Any!> : test.InnerOfGeneric.A<L!> {
|
||||
public constructor B</*0*/ L : kotlin.Any!>()
|
||||
|
||||
public open inner class SubInner /*captured type parameters: /*0*/ L : kotlin.Any!*/ : test.InnerOfGeneric.A<kotlin.Any!>.Inner {
|
||||
public constructor SubInner()
|
||||
public open override /*1*/ fun iterator(): kotlin.collections.(Mutable)Iterator<L!>!
|
||||
}
|
||||
}
|
||||
|
||||
public open inner class S</*0*/ E : kotlin.Any!> {
|
||||
public constructor S</*0*/ E : kotlin.Any!>()
|
||||
public open operator fun iterator(): kotlin.collections.(Mutable)Iterator<E!>!
|
||||
}
|
||||
}
|
||||
|
|
@@ -0,0 +1,22 @@
|
|||
package test
|
||||
|
||||
public interface ReturnInnerSubclassOfSupersInner {
|
||||
|
||||
public open class Sub</*0*/ B : kotlin.Any!> : test.ReturnInnerSubclassOfSupersInner.Super<B!> {
|
||||
public constructor Sub</*0*/ B : kotlin.Any!>()
|
||||
|
||||
public/*package*/ open inner class Inner /*captured type parameters: /*0*/ B : kotlin.Any!*/ : test.ReturnInnerSubclassOfSupersInner.Super<kotlin.Any!>.Inner {
|
||||
public/*package*/ constructor Inner()
|
||||
public/*package*/ open override /*1*/ fun get(): test.ReturnInnerSubclassOfSupersInner.Sub<B!>!
|
||||
}
|
||||
}
|
||||
|
||||
public open class Super</*0*/ A : kotlin.Any!> {
|
||||
public constructor Super</*0*/ A : kotlin.Any!>()
|
||||
|
||||
public/*package*/ open inner class Inner /*captured type parameters: /*0*/ A : kotlin.Any!*/ {
|
||||
public/*package*/ constructor Inner()
|
||||
public/*package*/ open fun get(): test.ReturnInnerSubclassOfSupersInner.Super<A!>!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@@ -2,10 +2,8 @@
|
|||
|
||||
package test
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
annotation class A
|
||||
|
||||
interface Foo<T : @A Number> : @A Serializable {
|
||||
interface Foo<T : @A Number> : @A CharSequence {
|
||||
fun <E, F : @A E> bar()
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -4,6 +4,10 @@ public final annotation class A : kotlin.Annotation {
|
|||
/*primary*/ public constructor A()
|
||||
}
|
||||
|
||||
public interface Foo</*0*/ T : @test.A kotlin.Number> : @test.A java.io.Serializable {
|
||||
public interface Foo</*0*/ T : @test.A kotlin.Number> : @test.A kotlin.CharSequence {
|
||||
public abstract override /*1*/ /*fake_override*/ val length: kotlin.Int
|
||||
public abstract override /*1*/ /*fake_override*/ fun <get-length>(): kotlin.Int
|
||||
public abstract fun </*0*/ E, /*1*/ F : @test.A E> bar(): kotlin.Unit
|
||||
public abstract override /*1*/ /*fake_override*/ fun get(/*0*/ index: kotlin.Int): kotlin.Char
|
||||
public abstract override /*1*/ /*fake_override*/ fun subSequence(/*0*/ startIndex: kotlin.Int, /*1*/ endIndex: kotlin.Int): kotlin.CharSequence
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -1,5 +1,3 @@
|
|||
// FULL_JDK
|
||||
|
||||
package test
|
||||
|
||||
public abstract class ClassDoesNotOverrideMethod() : java.util.Date() {
|
||||
|
|
|
|||
|
|
@@ -1,5 +1,3 @@
|
|||
// FULL_JDK
|
||||
|
||||
package test
|
||||
|
||||
public abstract class ClassWithTypePExtendsIterableP<P>() : kotlin.collections.MutableIterable<P> {
|
||||
|
|
|
|||
|
|
@@ -1,5 +1,3 @@
|
|||
// FULL_JDK
|
||||
|
||||
package test
|
||||
|
||||
public interface HalfSubstitutedTypeParameters {
|
||||
|
|
|
|||
|
|
@@ -1,5 +1,3 @@
|
|||
// FULL_JDK
|
||||
|
||||
package test
|
||||
|
||||
public interface SubclassOfCollection<E>: MutableCollection<E> {
|
||||
|
|
|
|||
|
|
@@ -30,6 +30,7 @@ import com.intellij.openapi.fileEditor.FileDocumentManager;
|
|||
import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
|
||||
import com.intellij.openapi.fileTypes.FileTypeFactory;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.options.SchemesManagerFactory;
|
||||
import com.intellij.openapi.progress.EmptyProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.progress.impl.CoreProgressManager;
|
||||
|
|
@@ -103,6 +104,7 @@ 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>() {
|
||||
|
|
@@ -122,7 +124,6 @@ public abstract class KtParsingTestCase extends KtPlatformLiteFixture {
|
|||
myProject.registerService(PsiManager.class, myPsiManager);
|
||||
|
||||
this.registerExtensionPoint(FileTypeFactory.FILE_TYPE_FACTORY_EP, FileTypeFactory.class);
|
||||
registerExtensionPoint(MetaLanguage.EP_NAME, MetaLanguage.class);
|
||||
|
||||
for (ParserDefinition definition : myDefinitions) {
|
||||
addExplicitExtension(LanguageParserDefinitions.INSTANCE, definition.getFileNodeType().getLanguage(), definition);
|
||||
|
|
@@ -331,8 +332,7 @@ public abstract class KtParsingTestCase extends KtPlatformLiteFixture {
|
|||
public static void ensureCorrectReparse(@NotNull PsiFile file) {
|
||||
String psiToStringDefault = DebugUtil.psiToString(file, false, false);
|
||||
String fileText = file.getText();
|
||||
DiffLog diffLog = (new BlockSupportImpl(file.getProject())).reparseRange(
|
||||
file, file.getNode(), TextRange.allOf(fileText), fileText, new EmptyProgressIndicator(), fileText);
|
||||
DiffLog diffLog = (new BlockSupportImpl(file.getProject())).reparseRange(file, TextRange.allOf(fileText), fileText, new EmptyProgressIndicator(), fileText);
|
||||
diffLog.performActualPsiChange(file);
|
||||
|
||||
TestCase.assertEquals(psiToStringDefault, DebugUtil.psiToString(file, false, false));
|
||||
|
|
|
|||
|
|
@@ -37,7 +37,6 @@ import junit.framework.TestCase;
|
|||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
|
||||
import org.junit.Assert;
|
||||
|
||||
|
|
@@ -95,10 +94,10 @@ public abstract class KtUsefulTestCase extends TestCase {
|
|||
testName = new File(testName).getName(); // in case the test name contains file separators
|
||||
myTempDir = new File(ORIGINAL_TEMP_DIR, TEMP_DIR_MARKER + testName).getPath();
|
||||
FileUtil.resetCanonicalTempPathCache(myTempDir);
|
||||
boolean isStressTest = isStressTest();
|
||||
ApplicationInfoImpl.setInStressTest(isStressTest);
|
||||
boolean isPerformanceTest = isPerformanceTest();
|
||||
ApplicationInfoImpl.setInPerformanceTest(isPerformanceTest);
|
||||
// turn off Disposer debugging for performance tests
|
||||
oldDisposerDebug = Disposer.setDebugMode(Disposer.isDebugMode() && !isStressTest);
|
||||
oldDisposerDebug = Disposer.setDebugMode(Disposer.isDebugMode() && !isPerformanceTest);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@@ -450,29 +449,8 @@ public abstract class KtUsefulTestCase extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
private static boolean isPerformanceTest(@Nullable String testName, @Nullable String className) {
|
||||
return testName != null && testName.contains("Performance") ||
|
||||
className != null && className.contains("Performance");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true for a test which performs A LOT of computations.
|
||||
* Such test should typically avoid performing expensive checks, e.g. data structure consistency complex validations.
|
||||
* If you want your test to be treated as "Stress", please mention one of these words in its name: "Stress", "Slow".
|
||||
* For example: {@code public void testStressPSIFromDifferentThreads()}
|
||||
*/
|
||||
|
||||
private boolean isStressTest() {
|
||||
return isStressTest(getName(), getClass().getName());
|
||||
}
|
||||
|
||||
private static boolean isStressTest(String testName, String className) {
|
||||
return isPerformanceTest(testName, className) ||
|
||||
containsStressWords(testName) ||
|
||||
containsStressWords(className);
|
||||
}
|
||||
|
||||
private static boolean containsStressWords(@Nullable String name) {
|
||||
return name != null && (name.contains("Stress") || name.contains("Slow"));
|
||||
private boolean isPerformanceTest() {
|
||||
String name = getName();
|
||||
return name != null && name.contains("Performance") || getClass().getName().contains("Performance");
|
||||
}
|
||||
}
|
||||
|
|
@@ -15,7 +15,6 @@
|
|||
*/
|
||||
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;
|
||||
|
|
@@ -140,18 +139,8 @@ public class MockPsiDocumentManager extends PsiDocumentManager {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performLaterWhenAllCommitted(@NotNull Runnable runnable) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reparseFiles(@NotNull Collection<VirtualFile> files, boolean includeOpenFiles) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performLaterWhenAllCommitted(@NotNull Runnable runnable, ModalityState modalityState) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -21,7 +21,6 @@ import com.intellij.openapi.project.Project;
|
|||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Key;
|
||||
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.psi.impl.PsiModificationTrackerImpl;
|
||||
|
|
@@ -139,9 +138,6 @@ public class MockPsiManager extends PsiManagerEx {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAssertOnFileLoadingFilter(@NotNull VirtualFileFilter filter, @NotNull Disposable parentDisposable) {}
|
||||
|
||||
@Override
|
||||
public boolean isAssertOnFileLoading(@NotNull VirtualFile file) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
|
|
@@ -1391,6 +1391,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("immutableRemove.kt")
|
||||
public void testImmutableRemove() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/builtinStubMethods/immutableRemove.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("implementationInTrait.kt")
|
||||
public void testImplementationInTrait() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/builtinStubMethods/implementationInTrait.kt");
|
||||
|
|
@@ -15013,6 +15019,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("javaParametersHaveNoNames.kt")
|
||||
public void testJavaParametersHaveNoNames() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/parameters/javaParametersHaveNoNames.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kinds.kt")
|
||||
public void testKinds() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/parameters/kinds.kt");
|
||||
|
|
|
|||
|
|
@@ -138,21 +138,6 @@ public class BlackBoxWithJava8CodegenTestGenerated extends AbstractBlackBoxCodeg
|
|||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/java8/box/builtinStubMethods")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class BuiltinStubMethods extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInBuiltinStubMethods() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/box/builtinStubMethods"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("immutableRemove.kt")
|
||||
public void testImmutableRemove() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/builtinStubMethods/immutableRemove.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/java8/box/delegationBy")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
|
@@ -607,20 +592,5 @@ public class BlackBoxWithJava8CodegenTestGenerated extends AbstractBlackBoxCodeg
|
|||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/reflection/synthesizedParameterNames.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/java8/box/reflection/parameters")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Parameters extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInParameters() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/box/reflection/parameters"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("javaParametersHaveDefaultNames.kt")
|
||||
public void testJavaParametersHaveDefaultNames() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/reflection/parameters/javaParametersHaveDefaultNames.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -1,92 +0,0 @@
|
|||
/*
|
||||
* Copyright 2010-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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.jvm.compiler;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class LoadJava8TestGenerated extends AbstractLoadJava8Test {
|
||||
@TestMetadata("compiler/testData/loadJava8/compiledJava")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class CompiledJava extends AbstractLoadJava8Test {
|
||||
public void testAllFilesPresentInCompiledJava() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/loadJava8/compiledJava"), Pattern.compile("^(.+)\\.java$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("InnerClassTypeAnnotation.java")
|
||||
public void testInnerClassTypeAnnotation() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/InnerClassTypeAnnotation.java");
|
||||
doTestCompiledJava(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("MapRemove.java")
|
||||
public void testMapRemove() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/MapRemove.java");
|
||||
doTestCompiledJava(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TypeAnnotations.java")
|
||||
public void testTypeAnnotations() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/TypeAnnotations.java");
|
||||
doTestCompiledJava(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TypeParameterAnnotations.java")
|
||||
public void testTypeParameterAnnotations() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/TypeParameterAnnotations.java");
|
||||
doTestCompiledJava(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/loadJava8/sourceJava")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class SourceJava extends AbstractLoadJava8Test {
|
||||
public void testAllFilesPresentInSourceJava() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/loadJava8/sourceJava"), Pattern.compile("^(.+)\\.java$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("MapRemove.java")
|
||||
public void testMapRemove() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/sourceJava/MapRemove.java");
|
||||
doTestSourceJava(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TypeAnnotations.java")
|
||||
public void testTypeAnnotations() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/sourceJava/TypeAnnotations.java");
|
||||
doTestSourceJava(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TypeParameterAnnotations.java")
|
||||
public void testTypeParameterAnnotations() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/sourceJava/TypeParameterAnnotations.java");
|
||||
doTestSourceJava(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@@ -1,62 +0,0 @@
|
|||
/*
|
||||
* Copyright 2010-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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.jvm.runtime;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/loadJava8/compiledJava")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class Jvm8RuntimeDescriptorLoaderTestGenerated extends AbstractJvm8RuntimeDescriptorLoaderTest {
|
||||
public void testAllFilesPresentInCompiledJava() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/loadJava8/compiledJava"), Pattern.compile("^(.+)\\.java$"), TargetBackend.ANY, true, "sam", "kotlinSignature/propagation");
|
||||
}
|
||||
|
||||
@TestMetadata("InnerClassTypeAnnotation.java")
|
||||
public void testInnerClassTypeAnnotation() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/InnerClassTypeAnnotation.java");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("MapRemove.java")
|
||||
public void testMapRemove() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/MapRemove.java");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TypeAnnotations.java")
|
||||
public void testTypeAnnotations() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/TypeAnnotations.java");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TypeParameterAnnotations.java")
|
||||
public void testTypeParameterAnnotations() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/loadJava8/compiledJava/TypeParameterAnnotations.java");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
|
@@ -1391,6 +1391,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("immutableRemove.kt")
|
||||
public void testImmutableRemove() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/builtinStubMethods/immutableRemove.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("implementationInTrait.kt")
|
||||
public void testImplementationInTrait() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/builtinStubMethods/implementationInTrait.kt");
|
||||
|
|
@@ -15013,6 +15019,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("javaParametersHaveNoNames.kt")
|
||||
public void testJavaParametersHaveNoNames() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/parameters/javaParametersHaveNoNames.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kinds.kt")
|
||||
public void testKinds() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/parameters/kinds.kt");
|
||||
|
|
|
|||
|
|
@@ -64,13 +64,12 @@ public abstract class AbstractCompileJavaAgainstKotlinTest extends TestCaseWithT
|
|||
Assert.assertTrue(ktFilePath.endsWith(".kt"));
|
||||
File ktFile = new File(ktFilePath);
|
||||
File javaFile = new File(ktFilePath.replaceFirst("\\.kt$", ".java"));
|
||||
File expectedFile = new File(ktFilePath.replaceFirst("\\.kt$", ".txt"));
|
||||
File javaErrorFile = new File(ktFilePath.replaceFirst("\\.kt$", ".javaerr.txt"));
|
||||
|
||||
File out = new File(tmpdir, "out");
|
||||
boolean compiledSuccessfully =
|
||||
compileKotlinWithJava(Collections.singletonList(javaFile), Collections.singletonList(ktFile),
|
||||
out, getTestRootDisposable(), javaErrorFile);
|
||||
if (!compiledSuccessfully) return;
|
||||
compileKotlinWithJava(Collections.singletonList(javaFile), Collections.singletonList(ktFile),
|
||||
out, getTestRootDisposable(), javaErrorFile);
|
||||
|
||||
KotlinCoreEnvironment environment = KotlinCoreEnvironment.createForTests(
|
||||
getTestRootDisposable(),
|
||||
|
|
@@ -82,7 +81,6 @@ public abstract class AbstractCompileJavaAgainstKotlinTest extends TestCaseWithT
|
|||
PackageViewDescriptor packageView = analysisResult.getModuleDescriptor().getPackage(LoadDescriptorUtil.TEST_PACKAGE_FQNAME);
|
||||
assertFalse("Nothing found in package " + LoadDescriptorUtil.TEST_PACKAGE_FQNAME, packageView.isEmpty());
|
||||
|
||||
File expectedFile = new File(ktFilePath.replaceFirst("\\.kt$", ".txt"));
|
||||
validateAndCompareDescriptorWithFile(packageView, CONFIGURATION, expectedFile);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -24,11 +24,10 @@ import org.jetbrains.kotlin.config.LanguageVersion
|
|||
import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
import org.junit.Assert
|
||||
import org.xml.sax.Attributes
|
||||
import org.xml.sax.helpers.DefaultHandler
|
||||
import org.w3c.dom.Element
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
import javax.xml.parsers.SAXParserFactory
|
||||
import javax.xml.parsers.DocumentBuilderFactory
|
||||
|
||||
class KotlinVersionsTest : KtUsefulTestCase() {
|
||||
fun testVersionsAreConsistent() {
|
||||
|
|
@@ -73,13 +72,13 @@ class KotlinVersionsTest : KtUsefulTestCase() {
|
|||
)
|
||||
|
||||
versions.add(
|
||||
loadValueFromPomXml("libraries/pom.xml", listOf("project", "properties", "kotlin.language.version"))
|
||||
loadValueFromPomXml("libraries/pom.xml", listOf("properties", "kotlin.language.version"))
|
||||
?.toVersion("kotlin.language.version in pom.xml")
|
||||
?: error("No kotlin.language.version in libraries/pom.xml")
|
||||
)
|
||||
|
||||
versions.add(
|
||||
loadValueFromPomXml("libraries/pom.xml", listOf("project", "version"))
|
||||
loadValueFromPomXml("libraries/pom.xml", listOf("version"))
|
||||
?.toVersion("version in pom.xml")
|
||||
?: error("No version in libraries/pom.xml")
|
||||
)
|
||||
|
|
@@ -103,8 +102,8 @@ class KotlinVersionsTest : KtUsefulTestCase() {
|
|||
|
||||
FileUtil.processFilesRecursively(File("libraries"), Processor { file ->
|
||||
if (file.name == "pom.xml") {
|
||||
if (loadValueFromPomXml(file.path, listOf("project", "parent", "artifactId")) == "kotlin-project") {
|
||||
val version = loadValueFromPomXml(file.path, listOf("project", "parent", "version"))
|
||||
if (loadValueFromPomXml(file.path, listOf("parent", "artifactId")) == "kotlin-project") {
|
||||
val version = loadValueFromPomXml(file.path, listOf("version"))
|
||||
?: error("No version found in pom.xml at $file")
|
||||
poms.add(Pom(file.path, version))
|
||||
}
|
||||
|
|
@@ -128,29 +127,12 @@ class KotlinVersionsTest : KtUsefulTestCase() {
|
|||
private fun loadValueFromPomXml(filePath: String, query: List<String>): String? {
|
||||
assert(filePath.endsWith("pom.xml")) { filePath }
|
||||
|
||||
var result: String? = null
|
||||
val docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder()
|
||||
val input = docBuilder.parse(File(filePath).inputStream())
|
||||
|
||||
SAXParserFactory.newInstance().newSAXParser().parse(File(filePath), object : DefaultHandler() {
|
||||
val currentPath = mutableListOf<String>()
|
||||
|
||||
override fun startElement(uri: String, localName: String, qName: String, attributes: Attributes) {
|
||||
currentPath.add(qName)
|
||||
}
|
||||
|
||||
override fun endElement(uri: String, localName: String, qName: String) {
|
||||
assert(currentPath.lastOrNull() == qName) { "Invalid XML at $filePath: mismatched tag '$qName'" }
|
||||
currentPath.removeAt(currentPath.lastIndex)
|
||||
}
|
||||
|
||||
override fun characters(ch: CharArray, start: Int, length: Int) {
|
||||
if (currentPath == query) {
|
||||
assert(result == null) { "More than one value found for $query in $filePath" }
|
||||
result = String(ch, start, length).trim()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return result
|
||||
return query.fold(input.documentElement) { element, tagName ->
|
||||
element?.getElementsByTagName(tagName)?.item(0) as? Element
|
||||
}?.textContent
|
||||
}
|
||||
|
||||
private fun Collection<Any>.areEqual(): Boolean = all(first()::equals)
|
||||
|
|
|
|||
|
|
@@ -20,7 +20,6 @@
|
|||
<orderEntry type="module" module-name="descriptor.loader.java" scope="TEST" />
|
||||
<orderEntry type="module" module-name="descriptors.runtime" scope="TEST" />
|
||||
<orderEntry type="module" module-name="js.tests" scope="TEST" />
|
||||
<orderEntry type="module" module-name="jps-tests" scope="TEST" />
|
||||
<orderEntry type="module" module-name="j2k" scope="TEST" />
|
||||
<orderEntry type="library" scope="TEST" name="jps-test" level="project" />
|
||||
<orderEntry type="module" module-name="js.ast" scope="TEST" />
|
||||
|
|
@@ -28,7 +27,6 @@
|
|||
<orderEntry type="module" module-name="util" scope="TEST" />
|
||||
<orderEntry type="module" module-name="android-extensions-compiler" scope="TEST" />
|
||||
<orderEntry type="module" module-name="android-extensions-idea" scope="TEST" />
|
||||
<orderEntry type="module" module-name="android-extensions-jps" scope="TEST" />
|
||||
<orderEntry type="module" module-name="idea-test-framework" scope="TEST" />
|
||||
<orderEntry type="module" module-name="idea-completion" scope="TEST" />
|
||||
<orderEntry type="module" module-name="annotation-collector" scope="TEST" />
|
||||
|
|
@@ -38,7 +36,6 @@
|
|||
<orderEntry type="module" module-name="plugins-tests" scope="TEST" />
|
||||
<orderEntry type="module" module-name="idea-android" scope="TEST" />
|
||||
<orderEntry type="module" module-name="idea-android-output-parser" scope="TEST" />
|
||||
<orderEntry type="module" module-name="idea-maven" scope="TEST" />
|
||||
<orderEntry type="module" module-name="uast-kotlin" scope="TEST" />
|
||||
<orderEntry type="module" module-name="kapt3" scope="TEST" />
|
||||
</component>
|
||||
|
|
|
|||
|
|
@@ -102,8 +102,6 @@ import org.jetbrains.kotlin.idea.intentions.declarations.AbstractJoinLinesTest
|
|||
import org.jetbrains.kotlin.idea.internal.AbstractBytecodeToolWindowTest
|
||||
import org.jetbrains.kotlin.idea.kdoc.AbstractKDocHighlightingTest
|
||||
import org.jetbrains.kotlin.idea.kdoc.AbstractKDocTypingTest
|
||||
import org.jetbrains.kotlin.idea.maven.AbstractKotlinMavenInspectionTest
|
||||
import org.jetbrains.kotlin.idea.maven.configuration.AbstractMavenConfigureProjectByChangingFileTest
|
||||
import org.jetbrains.kotlin.idea.navigation.*
|
||||
import org.jetbrains.kotlin.idea.parameterInfo.AbstractParameterInfoTest
|
||||
import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixMultiFileTest
|
||||
|
|
@@ -133,9 +131,6 @@ import org.jetbrains.kotlin.ir.AbstractIrTextTestCase
|
|||
import org.jetbrains.kotlin.j2k.AbstractJavaToKotlinConverterForWebDemoTest
|
||||
import org.jetbrains.kotlin.j2k.AbstractJavaToKotlinConverterMultiFileTest
|
||||
import org.jetbrains.kotlin.j2k.AbstractJavaToKotlinConverterSingleFileTest
|
||||
import org.jetbrains.kotlin.jps.build.*
|
||||
import org.jetbrains.kotlin.jps.build.android.AbstractAndroidJpsTestCase
|
||||
import org.jetbrains.kotlin.jps.incremental.AbstractProtoComparisonTest
|
||||
import org.jetbrains.kotlin.js.test.semantics.*
|
||||
import org.jetbrains.kotlin.jvm.compiler.*
|
||||
import org.jetbrains.kotlin.jvm.runtime.AbstractJvm8RuntimeDescriptorLoaderTest
|
||||
|
|
@@ -893,10 +888,8 @@ fun main(args: Array<String>) {
|
|||
model("refactoring/pullUp/j2k", extension = "java", singleClass = true, testClassName = "J2K", testMethod = "doJavaTest")
|
||||
}
|
||||
|
||||
testClass<AbstractPushDownTest> {
|
||||
model("refactoring/pushDown/k2k", extension = "kt", singleClass = true, testClassName = "K2K", testMethod = "doKotlinTest")
|
||||
model("refactoring/pushDown/k2j", extension = "kt", singleClass = true, testClassName = "K2J", testMethod = "doKotlinTest")
|
||||
model("refactoring/pushDown/j2k", extension = "java", singleClass = true, testClassName = "J2K", testMethod = "doJavaTest")
|
||||
testClass<AbstractPushDownTest>() {
|
||||
model("refactoring/pushDown", extension = "kt", singleClass = true)
|
||||
}
|
||||
|
||||
testClass<AbstractSelectExpressionForDebuggerTest> {
|
||||
|
|
@@ -961,17 +954,6 @@ fun main(args: Array<String>) {
|
|||
}
|
||||
}
|
||||
|
||||
testGroup("idea/idea-maven/test", "idea/idea-maven/testData") {
|
||||
testClass<AbstractMavenConfigureProjectByChangingFileTest> {
|
||||
model("configurator/jvm", extension = null, recursive = false, testMethod = "doTestWithMaven")
|
||||
model("configurator/js", extension = null, recursive = false, testMethod = "doTestWithJSMaven")
|
||||
}
|
||||
|
||||
testClass<AbstractKotlinMavenInspectionTest> {
|
||||
model("maven-inspections", pattern = "^([\\w\\-]+).xml$", singleClass = true)
|
||||
}
|
||||
}
|
||||
|
||||
testGroup("idea/tests", "compiler/testData") {
|
||||
testClass<AbstractResolveByStubTest> {
|
||||
model("loadJava/compiledKotlin")
|
||||
|
|
@@ -1087,62 +1069,6 @@ fun main(args: Array<String>) {
|
|||
}
|
||||
}
|
||||
|
||||
testGroup("jps-plugin/jps-tests/test", "jps-plugin/testData") {
|
||||
testClass<AbstractIncrementalJpsTest> {
|
||||
model("incremental/multiModule", extension = null, excludeParentDirs = true)
|
||||
model("incremental/pureKotlin", extension = null, recursive = false)
|
||||
model("incremental/withJava", extension = null, excludeParentDirs = true)
|
||||
model("incremental/inlineFunCallSite", extension = null, excludeParentDirs = true)
|
||||
}
|
||||
testClass<AbstractLookupTrackerTest> {
|
||||
model("incremental/lookupTracker", extension = null, recursive = false)
|
||||
}
|
||||
|
||||
testClass(AbstractIncrementalLazyCachesTest::class.java) {
|
||||
model("incremental/lazyKotlinCaches", extension = null, excludeParentDirs = true)
|
||||
}
|
||||
|
||||
testClass(AbstractIncrementalCacheVersionChangedTest::class.java) {
|
||||
model("incremental/cacheVersionChanged", extension = null, excludeParentDirs = true)
|
||||
}
|
||||
}
|
||||
|
||||
testGroup("jps-plugin/jps-tests/test", "jps-plugin/testData") {
|
||||
testClass<AbstractExperimentalIncrementalJpsTest> {
|
||||
model("incremental/multiModule", extension = null, excludeParentDirs = true)
|
||||
model("incremental/pureKotlin", extension = null, recursive = false)
|
||||
model("incremental/withJava", extension = null, excludeParentDirs = true)
|
||||
model("incremental/inlineFunCallSite", extension = null, excludeParentDirs = true)
|
||||
model("incremental/classHierarchyAffected", extension = null, excludeParentDirs = true)
|
||||
}
|
||||
|
||||
testClass<AbstractExperimentalIncrementalLazyCachesTest> {
|
||||
model("incremental/lazyKotlinCaches", extension = null, excludeParentDirs = true)
|
||||
}
|
||||
|
||||
testClass<AbstractExperimentalIncrementalCacheVersionChangedTest> {
|
||||
model("incremental/cacheVersionChanged", extension = null, excludeParentDirs = true)
|
||||
}
|
||||
|
||||
testClass<AbstractDataContainerVersionChangedTest> {
|
||||
model("incremental/cacheVersionChanged", extension = null, excludeParentDirs = true)
|
||||
}
|
||||
|
||||
testClass<AbstractExperimentalChangeIncrementalOptionTest> {
|
||||
model("incremental/changeIncrementalOption", extension = null, excludeParentDirs = true)
|
||||
}
|
||||
}
|
||||
|
||||
testGroup("jps-plugin/jps-tests/test", "jps-plugin/testData") {
|
||||
testClass<AbstractProtoComparisonTest> {
|
||||
model("comparison/classSignatureChange", extension = null, excludeParentDirs = true)
|
||||
model("comparison/classPrivateOnlyChange", extension = null, excludeParentDirs = true)
|
||||
model("comparison/classMembersOnlyChanged", extension = null, excludeParentDirs = true)
|
||||
model("comparison/packageMembers", extension = null, excludeParentDirs = true)
|
||||
model("comparison/unchanged", extension = null, excludeParentDirs = true)
|
||||
}
|
||||
}
|
||||
|
||||
testGroup("plugins/plugins-tests/tests", "plugins/android-extensions/android-extensions-compiler/testData") {
|
||||
testClass<AbstractAndroidSyntheticPropertyDescriptorTest> {
|
||||
model("descriptors", recursive = false, extension = null)
|
||||
|
|
@@ -1253,14 +1179,7 @@ fun main(args: Array<String>) {
|
|||
}
|
||||
}
|
||||
|
||||
testGroup("plugins/plugins-tests/tests", "plugins/android-extensions/android-extensions-jps/testData") {
|
||||
testClass<AbstractAndroidJpsTestCase> {
|
||||
model("android", recursive = false, extension = null)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: repair these tests
|
||||
//generateTestDataForReservedWords()
|
||||
generateTestDataForReservedWords()
|
||||
|
||||
testGroup("js/js.tests/test", "js/js.translator/testData") {
|
||||
testClass<AbstractBoxJsTest> {
|
||||
|
|
|
|||
|
|
@@ -145,9 +145,4 @@ val KtElement.languageVersionSettings: LanguageVersionSettings
|
|||
}
|
||||
|
||||
val KtElement.jvmTarget: JvmTarget
|
||||
get() {
|
||||
if (ServiceManager.getService(containingKtFile.project, ProjectFileIndex::class.java) == null) {
|
||||
return JvmTarget.DEFAULT
|
||||
}
|
||||
return ModuleUtilCore.findModuleForPsiElement(this)?.targetPlatform?.version as? JvmTarget ?: JvmTarget.DEFAULT
|
||||
}
|
||||
get() = ModuleUtilCore.findModuleForPsiElement(this)?.targetPlatform?.version as? JvmTarget ?: JvmTarget.DEFAULT
|
||||
|
|
|
|||
|
|
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.idea.vfilefinder
|
|||
|
||||
import com.intellij.util.indexing.*
|
||||
import com.intellij.util.io.DataExternalizer
|
||||
import com.intellij.util.io.DataInputOutputUtil
|
||||
import com.intellij.util.io.IOUtil
|
||||
import com.intellij.util.io.KeyDescriptor
|
||||
import org.jetbrains.kotlin.load.kotlin.ModuleMapping
|
||||
|
|
@@ -25,6 +26,24 @@ import org.jetbrains.kotlin.load.kotlin.PackageParts
|
|||
import org.jetbrains.kotlin.serialization.deserialization.DeserializationConfiguration
|
||||
import java.io.DataInput
|
||||
import java.io.DataOutput
|
||||
import java.io.IOException
|
||||
import java.util.*
|
||||
|
||||
private fun writeStringList(out: DataOutput, list: Collection<String>) {
|
||||
DataInputOutputUtil.writeINT(out, list.size)
|
||||
for (s in list) {
|
||||
IOUtil.writeUTF(out, s)
|
||||
}
|
||||
}
|
||||
|
||||
private fun readStringList(`in`: DataInput): List<String> {
|
||||
val size = DataInputOutputUtil.readINT(`in`)
|
||||
val strings = ArrayList<String>(size)
|
||||
for (i in 0..size - 1) {
|
||||
strings.add(IOUtil.readUTF(`in`))
|
||||
}
|
||||
return strings
|
||||
}
|
||||
|
||||
object KotlinModuleMappingIndex : FileBasedIndexExtension<String, PackageParts>() {
|
||||
|
||||
|
|
@@ -43,19 +62,19 @@ object KotlinModuleMappingIndex : FileBasedIndexExtension<String, PackageParts>(
|
|||
private val VALUE_EXTERNALIZER = object : DataExternalizer<PackageParts> {
|
||||
override fun read(input: DataInput): PackageParts? =
|
||||
PackageParts(IOUtil.readUTF(input)).apply {
|
||||
val shortPartNames = IOUtil.readStringList(input)
|
||||
val shortFacadeNames = IOUtil.readStringList(input)
|
||||
val shortPartNames = readStringList(input)
|
||||
val shortFacadeNames = readStringList(input)
|
||||
for ((partName, facadeName) in shortPartNames zip shortFacadeNames) {
|
||||
addPart(partName, if (facadeName.isNotEmpty()) facadeName else null)
|
||||
}
|
||||
IOUtil.readStringList(input).forEach(this::addMetadataPart)
|
||||
readStringList(input).forEach(this::addMetadataPart)
|
||||
}
|
||||
|
||||
override fun save(out: DataOutput, value: PackageParts) {
|
||||
IOUtil.writeUTF(out, value.packageFqName)
|
||||
IOUtil.writeStringList(out, value.parts)
|
||||
IOUtil.writeStringList(out, value.parts.map { value.getMultifileFacadeName(it).orEmpty() })
|
||||
IOUtil.writeStringList(out, value.metadataParts)
|
||||
writeStringList(out, value.parts)
|
||||
writeStringList(out, value.parts.map { value.getMultifileFacadeName(it).orEmpty() })
|
||||
writeStringList(out, value.metadataParts)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright 2010-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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.android.configure
|
||||
|
||||
import com.android.tools.idea.gradle.AndroidGradleModel
|
||||
import com.intellij.openapi.externalSystem.model.DataNode
|
||||
import com.intellij.openapi.externalSystem.model.Key
|
||||
import com.intellij.openapi.externalSystem.model.ProjectKeys
|
||||
import com.intellij.openapi.externalSystem.model.project.ProjectData
|
||||
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider
|
||||
import com.intellij.openapi.externalSystem.service.project.manage.AbstractProjectDataService
|
||||
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.idea.configuration.GradleProjectImportHandler
|
||||
import org.jetbrains.kotlin.idea.configuration.configureFacetByGradleModule
|
||||
|
||||
class KotlinGradleAndroidModuleModelProjectDataService : AbstractProjectDataService<AndroidGradleModel, Void>() {
|
||||
companion object {
|
||||
val KEY = Key<AndroidGradleModel>(AndroidGradleModel::class.qualifiedName!!, 0)
|
||||
}
|
||||
|
||||
override fun getTargetDataKey() = KEY
|
||||
|
||||
override fun postProcess(
|
||||
toImport: MutableCollection<DataNode<AndroidGradleModel>>,
|
||||
projectData: ProjectData?,
|
||||
project: Project,
|
||||
modelsProvider: IdeModifiableModelsProvider
|
||||
) {
|
||||
super.postProcess(toImport, projectData, project, modelsProvider)
|
||||
for (moduleModelNode in toImport) {
|
||||
val moduleNode = ExternalSystemApiUtil.findParent(moduleModelNode, ProjectKeys.MODULE) ?: continue
|
||||
val moduleData = moduleNode.data
|
||||
val ideModule = modelsProvider.findIdeModule(moduleData) ?: continue
|
||||
val kotlinFacet = configureFacetByGradleModule(moduleNode, null, ideModule, modelsProvider) ?: continue
|
||||
GradleProjectImportHandler.getInstances(project).forEach { it.importByModule(kotlinFacet, moduleNode) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@@ -75,8 +75,6 @@ class IllegalIdentifierInspection : AbstractKotlinInspection() {
|
|||
override fun getName() = "Rename"
|
||||
override fun getFamilyName() = name
|
||||
|
||||
override fun startInWriteAction(): Boolean = false
|
||||
|
||||
override fun applyFix(project: Project, descriptor: ProblemDescriptor) {
|
||||
val element = descriptor.psiElement ?: return
|
||||
val file = element.containingFile ?: return
|
||||
|
|
|
|||
|
|
@@ -72,7 +72,7 @@ public abstract class KotlinAndroidTestCaseBase extends UsefulTestCase {
|
|||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
TestUtilsKt.doKotlinTearDown(getProject(), new RunnableWithException() {
|
||||
TestUtilsKt.unInvalidateBuiltinsAndStdLib(getProject(), new RunnableWithException() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
KotlinAndroidTestCaseBase.super.tearDown();
|
||||
|
|
|
|||
|
|
@@ -25,7 +25,7 @@ abstract class AbstractAndroidResourceFoldingTest : KotlinAndroidTestCase() {
|
|||
fun doTest(path: String) {
|
||||
myFixture.copyFileToProject("values.xml", "res/values/values.xml")
|
||||
myFixture.copyFileToProject("R.java", "gen/com/myapp/R.java")
|
||||
myFixture.testFoldingWithCollapseStatus(path, "${myFixture.tempDirPath}/src/main.kt")
|
||||
myFixture.testFoldingWithCollapseStatus("${myFixture.tempDirPath}/src/main.kt")
|
||||
}
|
||||
|
||||
override fun createManifest() {
|
||||
|
|
|
|||
|
|
@@ -29,14 +29,14 @@ import org.jetbrains.kotlin.idea.test.KotlinTestImportFilter;
|
|||
public abstract class AbstractAndroidQuickFixMultiFileTest extends AbstractQuickFixMultiFileTest {
|
||||
|
||||
@Override
|
||||
protected void setUp() {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
addAndroidFacet();
|
||||
Extensions.getRootArea().getExtensionPoint(ImportFilter.EP_NAME).registerExtension(KotlinTestImportFilter.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() {
|
||||
protected void tearDown() throws Exception {
|
||||
Extensions.getRootArea().getExtensionPoint(ImportFilter.EP_NAME).unregisterExtension(KotlinTestImportFilter.INSTANCE);
|
||||
AndroidFacet facet = FacetManager.getInstance(myModule).getFacetByType(AndroidFacet.getFacetType().getId());
|
||||
FacetUtil.deleteFacet(facet);
|
||||
|
|
@@ -49,6 +49,12 @@ public abstract class AbstractAndroidQuickFixMultiFileTest extends AbstractQuick
|
|||
super.doTestWithExtraFile(beforeFileName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doTestWithoutExtraFile(String beforeFileName) throws Exception {
|
||||
addManifest();
|
||||
super.doTestWithoutExtraFile(beforeFileName);
|
||||
}
|
||||
|
||||
private void addAndroidFacet() {
|
||||
FacetManager facetManager = FacetManager.getInstance(myModule);
|
||||
AndroidFacet facet = facetManager.createFacet(AndroidFacet.getFacetType(), "Android", null);
|
||||
|
|
@@ -64,6 +70,6 @@ public abstract class AbstractAndroidQuickFixMultiFileTest extends AbstractQuick
|
|||
}
|
||||
|
||||
private void addManifest() throws Exception {
|
||||
myFixture.configureByFile("idea/testData/android/AndroidManifest.xml");
|
||||
configureByFile("idea/testData/android/AndroidManifest.xml");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -412,7 +412,6 @@ fun ImportableFqNameClassifier.isImportableDescriptorImported(descriptor: Declar
|
|||
|
||||
fun OffsetMap.tryGetOffset(key: OffsetKey): Int? {
|
||||
try {
|
||||
if (!containsOffset(key)) return null
|
||||
return getOffset(key).takeIf { it != -1 } // prior to IDEA 2016.3 getOffset() returned -1 if not found, now it throws exception
|
||||
}
|
||||
catch(e: Exception) {
|
||||
|
|
|
|||
|
|
@@ -50,6 +50,8 @@ class KotlinCompletionContributor : CompletionContributor() {
|
|||
|
||||
companion object {
|
||||
val DEFAULT_DUMMY_IDENTIFIER: String = CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED + "$" // add '$' to ignore context after the caret
|
||||
|
||||
private val STRING_TEMPLATE_AFTER_DOT_REAL_START_OFFSET = OffsetKey.create("STRING_TEMPLATE_AFTER_DOT_REAL_START_OFFSET")
|
||||
}
|
||||
|
||||
init {
|
||||
|
|
@@ -80,6 +82,7 @@ class KotlinCompletionContributor : CompletionContributor() {
|
|||
val prefix = tokenBefore.text.substring(0, offset - tokenBefore.startOffset)
|
||||
context.dummyIdentifier = "{" + expression.text + prefix + CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED + "}"
|
||||
context.offsetMap.addOffset(CompletionInitializationContext.START_OFFSET, expression.startOffset)
|
||||
context.offsetMap.addOffset(STRING_TEMPLATE_AFTER_DOT_REAL_START_OFFSET, offset + 1)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
@@ -238,13 +241,8 @@ class KotlinCompletionContributor : CompletionContributor() {
|
|||
val expression = (position.parent as KtBlockStringTemplateEntry).expression
|
||||
if (expression is KtDotQualifiedExpression) {
|
||||
val correctedPosition = (expression.selectorExpression as KtNameReferenceExpression).firstChild
|
||||
// Workaround for KT-16848
|
||||
// ex:
|
||||
// expression: some.IntellijIdeaRulezzz
|
||||
// correctedOffset: ^
|
||||
// expression: some.funcIntellijIdeaRulezzz
|
||||
// correctedOffset ^
|
||||
val correctedOffset = correctedPosition.endOffset - CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED.length
|
||||
val context = position.getUserData(CompletionContext.COMPLETION_CONTEXT_KEY)!!
|
||||
val correctedOffset = context.offsetMap.getOffset(STRING_TEMPLATE_AFTER_DOT_REAL_START_OFFSET)
|
||||
val correctedParameters = parameters.withPosition(correctedPosition, correctedOffset)
|
||||
doComplete(correctedParameters, toFromOriginalFileMapper, result,
|
||||
lookupElementPostProcessor = { wrapLookupElementForStringTemplateAfterDotCompletion(it) })
|
||||
|
|
|
|||
|
|
@@ -68,7 +68,7 @@ public class KotlinConfidenceTest extends LightCompletionTestCase {
|
|||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
TestUtilsKt.doKotlinTearDown(getProject(), new RunnableWithException() {
|
||||
TestUtilsKt.unInvalidateBuiltinsAndStdLib(getProject(), new RunnableWithException() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
KotlinConfidenceTest.super.tearDown();
|
||||
|
|
|
|||
|
|
@@ -22,6 +22,8 @@ import com.intellij.codeInsight.lookup.LookupElementPresentation
|
|||
import com.intellij.codeInsight.lookup.LookupEvent
|
||||
import com.intellij.codeInsight.lookup.LookupManager
|
||||
import com.intellij.codeInsight.lookup.impl.LookupImpl
|
||||
import com.intellij.openapi.application.Result
|
||||
import com.intellij.openapi.command.WriteCommandAction
|
||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
|
||||
import org.jetbrains.kotlin.idea.completion.test.ExpectedCompletionUtils
|
||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
||||
|
|
@@ -115,7 +117,14 @@ abstract class CompletionHandlerTestBase() : KotlinLightCodeInsightFixtureTestCa
|
|||
}
|
||||
lookup.focusDegree = LookupImpl.FocusDegree.FOCUSED
|
||||
if (LookupEvent.isSpecialCompletionChar(completionChar)) {
|
||||
lookup.finishLookup(completionChar)
|
||||
(object : WriteCommandAction.Simple<Any>(project) {
|
||||
override fun run(result: Result<Any>) {
|
||||
run()
|
||||
}
|
||||
override fun run() {
|
||||
lookup.finishLookup(completionChar)
|
||||
}
|
||||
}).execute().throwException()
|
||||
}
|
||||
else {
|
||||
fixture.type(completionChar)
|
||||
|
|
|
|||
|
|
@@ -57,10 +57,11 @@ class KotlinConsoleKeeper(val project: Project) {
|
|||
|
||||
private fun createCommandLine(module: Module): GeneralCommandLine? {
|
||||
val javaParameters = createJavaParametersWithSdk(module)
|
||||
val sdk = javaParameters.jdk ?: return null
|
||||
val sdkType = sdk.sdkType
|
||||
val exePath = (sdkType as JavaSdkType).getVMExecutablePath(sdk)
|
||||
|
||||
javaParameters.mainClass = "dummy"
|
||||
|
||||
val commandLine = javaParameters.toCommandLine()
|
||||
val commandLine = JdkUtil.setupJVMCommandLine(exePath, javaParameters, true)
|
||||
|
||||
val paramList = commandLine.parametersList
|
||||
paramList.clearAll()
|
||||
|
|
|
|||
|
|
@@ -60,7 +60,10 @@ public class JdkAndMockLibraryProjectDescriptor extends KotlinLightProjectDescri
|
|||
|
||||
@Override
|
||||
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model) {
|
||||
File libraryJar = MockLibraryUtil.compileLibraryToJar(sourcesPath, LIBRARY_NAME, withSources, isJsLibrary, allowKotlinPackage, classpath);
|
||||
String libraryHash = sourcesPath + withSources + isJsLibrary + allowKotlinPackage;
|
||||
String libraryFileName = LIBRARY_NAME + "_" + Integer.toHexString(libraryHash.hashCode());
|
||||
|
||||
File libraryJar = MockLibraryUtil.compileLibraryToJar(sourcesPath, libraryFileName, withSources, isJsLibrary, allowKotlinPackage, classpath);
|
||||
String jarUrl = getJarUrl(libraryJar);
|
||||
|
||||
Library.ModifiableModel libraryModel = model.getModuleLibraryTable().getModifiableModel().createLibrary(LIBRARY_NAME).getModifiableModel();
|
||||
|
|
|
|||
|
|
@@ -16,7 +16,6 @@
|
|||
|
||||
package org.jetbrains.kotlin.idea.test
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightTestCase
|
||||
import com.intellij.codeInsight.daemon.impl.EditorTracker
|
||||
import com.intellij.ide.startup.impl.StartupManagerImpl
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces
|
||||
|
|
@@ -50,8 +49,6 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
|
|||
|
||||
protected val module: Module get() = myFixture.module
|
||||
|
||||
protected open val captureExceptions = true
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
(StartupManager.getInstance(project) as StartupManagerImpl).runPostStartupActivities()
|
||||
|
|
@@ -64,15 +61,12 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
|
|||
|
||||
invalidateLibraryCache(project)
|
||||
|
||||
if (captureExceptions) {
|
||||
LoggedErrorProcessor.setNewInstance(object : LoggedErrorProcessor() {
|
||||
override fun processError(message: String?, t: Throwable?, details: Array<out String>?, logger: Logger) {
|
||||
exceptions.addIfNotNull(t)
|
||||
super.processError(message, t, details, logger)
|
||||
}
|
||||
})
|
||||
}
|
||||
CodeInsightTestCase.fixTemplates()
|
||||
LoggedErrorProcessor.setNewInstance(object : LoggedErrorProcessor() {
|
||||
override fun processError(message: String?, t: Throwable?, details: Array<out String>?, logger: Logger) {
|
||||
exceptions.addIfNotNull(t)
|
||||
super.processError(message, t, details, logger)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun tearDown() {
|
||||
|
|
@@ -81,7 +75,7 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
|
|||
KotlinInternalMode.enabled = kotlinInternalModeOriginalValue
|
||||
VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory())
|
||||
|
||||
doKotlinTearDown(project) {
|
||||
unInvalidateBuiltinsAndStdLib(project) {
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
|
|
@@ -122,9 +116,6 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
|
|||
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME_WITH_KOTLIN_TEST")) {
|
||||
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_WITH_KOTLIN_TEST
|
||||
}
|
||||
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME_WITH_FULL_JDK")) {
|
||||
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_FULL_JDK
|
||||
}
|
||||
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME") ||
|
||||
InTextDirectivesUtils.isDirectiveDefined(fileText, "WITH_RUNTIME")) {
|
||||
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||
|
|
|
|||
|
|
@@ -40,7 +40,7 @@ abstract class KotlinLightPlatformCodeInsightFixtureTestCase: LightPlatformCodeI
|
|||
KotlinInternalMode.enabled = kotlinInternalModeOriginalValue
|
||||
VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory())
|
||||
|
||||
doKotlinTearDown(project) {
|
||||
unInvalidateBuiltinsAndStdLib(project) {
|
||||
super.tearDown()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -42,9 +42,7 @@ abstract class KotlinMultiFileTestCase : MultiFileTestCase() {
|
|||
object : VirtualFileVisitor<Any>() {
|
||||
override fun visitFile(file: VirtualFile): Boolean {
|
||||
if (!file.isDirectory && file.name.endsWith(ModuleFileType.DOT_DEFAULT_EXTENSION)) {
|
||||
val module = createModule(File(file.path), StdModuleTypes.JAVA)
|
||||
val contentRoot = file.parent.findChild("src")!!
|
||||
PsiTestUtil.addSourceContentToRoots(module, contentRoot)
|
||||
createModule(File(file.path), StdModuleTypes.JAVA)
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@@ -38,7 +38,6 @@ import org.jetbrains.kotlin.idea.decompiler.KotlinDecompiledFileViewProvider
|
|||
import org.jetbrains.kotlin.idea.decompiler.KtDecompiledFile
|
||||
import org.jetbrains.kotlin.idea.util.application.runWriteAction
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import java.lang.IllegalArgumentException
|
||||
import java.util.*
|
||||
|
||||
enum class ModuleKind {
|
||||
|
|
@@ -48,16 +47,18 @@ enum class ModuleKind {
|
|||
|
||||
fun Module.configureAs(descriptor: KotlinLightProjectDescriptor) {
|
||||
val module = this
|
||||
updateModel(module, Consumer<ModifiableRootModel> { model ->
|
||||
if (descriptor.sdk != null) {
|
||||
model.sdk = descriptor.sdk
|
||||
}
|
||||
val entries = model.contentEntries
|
||||
if (entries.isEmpty()) {
|
||||
descriptor.configureModule(module, model)
|
||||
}
|
||||
else {
|
||||
descriptor.configureModule(module, model, entries[0])
|
||||
updateModel(module, object : Consumer<ModifiableRootModel> {
|
||||
override fun consume(model: ModifiableRootModel) {
|
||||
if (descriptor.sdk != null) {
|
||||
model.sdk = descriptor.sdk
|
||||
}
|
||||
val entries = model.contentEntries
|
||||
if (entries.isEmpty()) {
|
||||
descriptor.configureModule(module, model)
|
||||
}
|
||||
else {
|
||||
descriptor.configureModule(module, model, entries[0])
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@@ -75,26 +76,17 @@ fun Module.configureAs(kind: ModuleKind) {
|
|||
}
|
||||
|
||||
fun KtFile.dumpTextWithErrors(): String {
|
||||
val diagnostics = analyzeFullyAndGetResult().bindingContext.diagnostics
|
||||
val errors = diagnostics.filter { it.severity == Severity.ERROR }
|
||||
val diagnostics = analyzeFullyAndGetResult().bindingContext.getDiagnostics()
|
||||
val errors = diagnostics.filter { it.getSeverity() == Severity.ERROR }
|
||||
if (errors.isEmpty()) return text
|
||||
val header = errors.map { "// ERROR: " + DefaultErrorMessages.render(it).replace('\n', ' ') }.joinToString("\n", postfix = "\n")
|
||||
return header + text
|
||||
}
|
||||
|
||||
fun closeAndDeleteProject() = LightPlatformTestCase.closeAndDeleteProject()
|
||||
fun closeAndDeleteProject(): Unit =
|
||||
ApplicationManager.getApplication().runWriteAction() { LightPlatformTestCase.closeAndDeleteProject() }
|
||||
|
||||
fun doKotlinTearDown(project: Project, runnable: RunnableWithException) {
|
||||
doKotlinTearDown(project) { runnable.run() }
|
||||
}
|
||||
|
||||
fun doKotlinTearDown(project: Project, runnable: () -> Unit) {
|
||||
unInvalidateBuiltinsAndStdLib(project) {
|
||||
runnable()
|
||||
}
|
||||
}
|
||||
|
||||
fun unInvalidateBuiltinsAndStdLib(project: Project, runnable: () -> Unit) {
|
||||
fun unInvalidateBuiltinsAndStdLib(project: Project, runnable: RunnableWithException) {
|
||||
val stdLibViewProviders = HashSet<KotlinDecompiledFileViewProvider>()
|
||||
val vFileToViewProviderMap = ((PsiManager.getInstance(project) as PsiManagerEx).fileManager as FileManagerImpl).vFileToViewProviderMap
|
||||
for ((file, viewProvider) in vFileToViewProviderMap) {
|
||||
|
|
@@ -103,7 +95,7 @@ fun unInvalidateBuiltinsAndStdLib(project: Project, runnable: () -> Unit) {
|
|||
}
|
||||
}
|
||||
|
||||
runnable()
|
||||
runnable.run()
|
||||
|
||||
// Base tearDown() invalidates builtins and std-lib files. Restore them with brute force.
|
||||
fun unInvalidateFile(file: PsiFileImpl) {
|
||||
|
|
@@ -114,12 +106,16 @@ fun unInvalidateBuiltinsAndStdLib(project: Project, runnable: () -> Unit) {
|
|||
|
||||
stdLibViewProviders.forEach {
|
||||
it.allFiles.forEach { unInvalidateFile(it as KtDecompiledFile) }
|
||||
vFileToViewProviderMap[it.virtualFile] = it
|
||||
vFileToViewProviderMap.set(it.virtualFile, it)
|
||||
}
|
||||
}
|
||||
|
||||
private val VirtualFile.isStdLibFile: Boolean get() = presentableUrl.contains("kotlin-runtime.jar")
|
||||
|
||||
fun unInvalidateBuiltinsAndStdLib(project: Project, runnable: () -> Unit) {
|
||||
unInvalidateBuiltinsAndStdLib(project, RunnableWithException { runnable() })
|
||||
}
|
||||
|
||||
fun invalidateLibraryCache(project: Project) {
|
||||
LibraryModificationTracker.getInstance(project).incModificationCount()
|
||||
}
|
||||
|
|
@@ -132,7 +128,7 @@ fun Document.extractMultipleMarkerOffsets(project: Project, caretMarker: String
|
|||
val offsets = ArrayList<Int>()
|
||||
|
||||
runWriteAction {
|
||||
val text = StringBuilder(text)
|
||||
val text = StringBuilder(getText())
|
||||
while (true) {
|
||||
val offset = text.indexOf(caretMarker)
|
||||
if (offset >= 0) {
|
||||
|
|
@@ -149,4 +145,4 @@ fun Document.extractMultipleMarkerOffsets(project: Project, caretMarker: String
|
|||
PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(this)
|
||||
|
||||
return offsets
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@@ -17,12 +17,12 @@
|
|||
</content>
|
||||
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="idea-full" level="project" />
|
||||
<orderEntry type="module" module-name="backend" />
|
||||
<orderEntry type="module" module-name="frontend" />
|
||||
<orderEntry type="module" module-name="frontend.java" />
|
||||
<orderEntry type="module" module-name="light-classes" />
|
||||
<orderEntry type="module" module-name="cli-common" />
|
||||
<orderEntry type="library" name="idea-full" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="intellilang-plugin" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="junit-plugin" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="testng-plugin" level="project" />
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 278 B After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 758 B After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 220 B After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 525 B After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 626 B After Width: | Height: | Size: 2.2 KiB |