diff --git a/buildSrc/gradle.properties.as31 b/buildSrc/gradle.properties.as31 deleted file mode 100644 index a2e24c7566f..00000000000 --- a/buildSrc/gradle.properties.as31 +++ /dev/null @@ -1,8 +0,0 @@ -org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx1600m -Dfile.encoding=UTF-8 - -cacheRedirectorEnabled=true - -#buildSrc.kotlin.repo=https://jcenter.bintray.com -#buildSrc.kotlin.version=1.1.50 - -intellijUltimateEnabled=false diff --git a/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidJpsBuildTestCase.java.as31 b/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidJpsBuildTestCase.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidRunner.java.as31 b/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidRunner.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt.as31 b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt.as31 deleted file mode 100644 index 716f1c7e740..00000000000 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt.as31 +++ /dev/null @@ -1,133 +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.load.java.structure.impl - -import com.intellij.openapi.diagnostic.Logger -import com.intellij.openapi.vfs.VirtualFile -import com.intellij.psi.PsiClass -import com.intellij.psi.PsiTypeParameter -import com.intellij.psi.search.SearchScope -import org.jetbrains.kotlin.asJava.KtLightClassMarker -import org.jetbrains.kotlin.descriptors.Visibility -import org.jetbrains.kotlin.load.java.structure.* -import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.psi.KtPsiUtil -import org.jetbrains.kotlin.psi.psiUtil.contains - -class JavaClassImpl(psiClass: PsiClass) : JavaClassifierImpl(psiClass), VirtualFileBoundJavaClass, JavaAnnotationOwnerImpl, JavaModifierListOwnerImpl { - init { - assert(psiClass !is PsiTypeParameter) { "PsiTypeParameter should be wrapped in JavaTypeParameter, not JavaClass: use JavaClassifier.create()" } - } - - override val innerClassNames: Collection - get() = psi.innerClasses.mapNotNull { it.name?.takeIf(Name::isValidIdentifier)?.let(Name::identifier) } - - override fun findInnerClass(name: Name): JavaClass? { - return psi.findInnerClassByName(name.asString(), false)?.let(::JavaClassImpl) - } - - override val fqName: FqName? - get() { - val qualifiedName = psi.qualifiedName - return if (qualifiedName == null) null else FqName(qualifiedName) - } - - override val name: Name - get() = KtPsiUtil.safeName(psi.name) - - override val isInterface: Boolean - get() = psi.isInterface - - override val isAnnotationType: Boolean - get() = psi.isAnnotationType - - override val isEnum: Boolean - get() = psi.isEnum - - override val outerClass: JavaClassImpl? - get() { - val outer = psi.containingClass - return if (outer == null) null else JavaClassImpl(outer) - } - - override val typeParameters: List - get() = typeParameters(psi.typeParameters) - - override val supertypes: Collection - get() = classifierTypes(psi.superTypes) - - override val methods: Collection - get() { - assertNotLightClass() - // We apply distinct here because PsiClass#getMethods() can return duplicate PSI methods, for example in Lombok (see KT-11778) - // Return type seems to be null for example for the 'clone' Groovy method generated by @AutoClone (see EA-73795) - return methods(psi.methods.filter { method -> !method.isConstructor && method.returnType != null }).distinct() - } - - override val fields: Collection - get() { - assertNotLightClass() - return fields(psi.fields.filter { field -> - val name = field.name - // ex. Android plugin generates LightFields for resources started from '.' (.DS_Store file etc) - name != null && Name.isValidIdentifier(name) - }) - } - - override val constructors: Collection - get() { - assertNotLightClass() - // See for example org.jetbrains.plugins.scala.lang.psi.light.ScFunctionWrapper, - // which is present in getConstructors(), but its isConstructor() returns false - return constructors(psi.constructors.filter { method -> method.isConstructor }) - } - - override val isAbstract: Boolean - get() = JavaElementUtil.isAbstract(this) - - override val isStatic: Boolean - get() = JavaElementUtil.isStatic(this) - - override val isFinal: Boolean - get() = JavaElementUtil.isFinal(this) - - override val visibility: Visibility - get() = JavaElementUtil.getVisibility(this) - - override val lightClassOriginKind: LightClassOriginKind? - get() = (psi as? KtLightClassMarker)?.originKind - - override val virtualFile: VirtualFile? - get() = psi.containingFile?.virtualFile - - override fun isFromSourceCodeInScope(scope: SearchScope): Boolean = psi.containingFile in scope - - override fun getAnnotationOwnerPsi() = psi.modifierList - - private fun assertNotLightClass() { - val psiClass = psi - if (psiClass !is KtLightClassMarker) return - - val message = "Querying members of JavaClass created for $psiClass of type ${psiClass::class.java} defined in file ${psiClass.containingFile?.virtualFile?.canonicalPath}" - LOGGER.error(message) - } - - companion object { - private val LOGGER = Logger.getInstance(JavaClassImpl::class.java) - } -} diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/KotlinBinaryClassCache.kt.as31 b/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/KotlinBinaryClassCache.kt.as31 deleted file mode 100644 index ad3c0b1e8cb..00000000000 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/KotlinBinaryClassCache.kt.as31 +++ /dev/null @@ -1,78 +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.load.kotlin - -import com.intellij.ide.highlighter.JavaClassFileType -import com.intellij.openapi.Disposable -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.components.ServiceManager -import com.intellij.openapi.util.Computable -import com.intellij.openapi.vfs.VirtualFile - -class KotlinBinaryClassCache : Disposable { - private class RequestCache { - internal var virtualFile: VirtualFile? = null - internal var modificationStamp: Long = 0 - internal var result: KotlinClassFinder.Result? = null - - fun cache( - file: VirtualFile, - result: KotlinClassFinder.Result? - ): KotlinClassFinder.Result? { - virtualFile = file - this.result = result - modificationStamp = file.modificationStamp - - return result - } - } - - private val cache = object : ThreadLocal() { - override fun initialValue(): RequestCache { - return RequestCache() - } - } - - override fun dispose() { - // This is only relevant for tests. We create a new instance of Application for each test, and so a new instance of this service is - // also created for each test. However all tests share the same event dispatch thread, which would collect all instances of this - // thread-local if they're not removed properly. Each instance would transitively retain VFS resulting in OutOfMemoryError - cache.remove() - } - - companion object { - fun getKotlinBinaryClassOrClassFileContent( - file: VirtualFile, fileContent: ByteArray? = null - ): KotlinClassFinder.Result? { - if (file.fileType !== JavaClassFileType.INSTANCE) return null - - val service = ServiceManager.getService(KotlinBinaryClassCache::class.java) - val requestCache = service.cache.get() - - if (file.modificationStamp == requestCache.modificationStamp && file == requestCache.virtualFile) { - return requestCache.result - } - - val aClass = ApplicationManager.getApplication().runReadAction(Computable { - @Suppress("DEPRECATION") - VirtualFileKotlinClass.create(file, fileContent) - }) - - return requestCache.cache(file, aClass) - } - } -} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java.as31 b/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java.as31 deleted file mode 100644 index c78eb4c6e0f..00000000000 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/KotlinTestUtils.java.as31 +++ /dev/null @@ -1,1299 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.test; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Lists; -import com.intellij.openapi.Disposable; -import com.intellij.openapi.editor.Caret; -import com.intellij.openapi.editor.Document; -import com.intellij.openapi.editor.Editor; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Comparing; -import com.intellij.openapi.util.ShutDownTracker; -import com.intellij.openapi.util.SystemInfo; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.util.text.StringUtilRt; -import com.intellij.openapi.vfs.CharsetToolkit; -import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiFileFactory; -import com.intellij.psi.impl.PsiFileFactoryImpl; -import com.intellij.rt.execution.junit.FileComparisonFailure; -import com.intellij.testFramework.LightVirtualFile; -import com.intellij.testFramework.TestDataFile; -import com.intellij.util.containers.ContainerUtil; -import junit.framework.TestCase; -import kotlin.collections.CollectionsKt; -import kotlin.collections.SetsKt; -import kotlin.jvm.functions.Function1; -import kotlin.text.StringsKt; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.TestOnly; -import org.jetbrains.kotlin.CoroutineTestUtilKt; -import org.jetbrains.kotlin.analyzer.AnalysisResult; -import org.jetbrains.kotlin.builtins.DefaultBuiltIns; -import org.jetbrains.kotlin.builtins.KotlinBuiltIns; -import org.jetbrains.kotlin.checkers.CompilerTestLanguageVersionSettings; -import org.jetbrains.kotlin.checkers.CompilerTestLanguageVersionSettingsKt; -import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys; -import org.jetbrains.kotlin.cli.common.config.ContentRootsKt; -import org.jetbrains.kotlin.cli.common.config.KotlinSourceRoot; -import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation; -import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity; -import org.jetbrains.kotlin.cli.common.messages.MessageCollector; -import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles; -import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment; -import org.jetbrains.kotlin.cli.jvm.config.JvmContentRootsKt; -import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime; -import org.jetbrains.kotlin.config.*; -import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl; -import org.jetbrains.kotlin.diagnostics.Diagnostic; -import org.jetbrains.kotlin.diagnostics.Errors; -import org.jetbrains.kotlin.diagnostics.Severity; -import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages; -import org.jetbrains.kotlin.idea.KotlinLanguage; -import org.jetbrains.kotlin.jvm.compiler.LoadDescriptorUtil; -import org.jetbrains.kotlin.lexer.KtTokens; -import org.jetbrains.kotlin.name.Name; -import org.jetbrains.kotlin.psi.KtExpression; -import org.jetbrains.kotlin.psi.KtFile; -import org.jetbrains.kotlin.psi.KtPsiFactoryKt; -import org.jetbrains.kotlin.resolve.BindingContext; -import org.jetbrains.kotlin.resolve.BindingTrace; -import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics; -import org.jetbrains.kotlin.resolve.lazy.JvmResolveUtil; -import org.jetbrains.kotlin.storage.LockBasedStorageManager; -import org.jetbrains.kotlin.test.util.JetTestUtilsKt; -import org.jetbrains.kotlin.types.KotlinType; -import org.jetbrains.kotlin.types.expressions.KotlinTypeInfo; -import org.jetbrains.kotlin.util.slicedMap.ReadOnlySlice; -import org.jetbrains.kotlin.util.slicedMap.SlicedMap; -import org.jetbrains.kotlin.util.slicedMap.WritableSlice; -import org.jetbrains.kotlin.utils.ExceptionUtilsKt; -import org.jetbrains.kotlin.utils.PathUtil; -import org.junit.Assert; - -import javax.tools.*; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.StringWriter; -import java.lang.reflect.Method; -import java.nio.charset.Charset; -import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import static org.jetbrains.kotlin.test.InTextDirectivesUtils.*; - -public class KotlinTestUtils { - public static String TEST_MODULE_NAME = "test-module"; - - public static final String TEST_GENERATOR_NAME = "org.jetbrains.kotlin.generators.tests.TestsPackage"; - private static final String PLEASE_REGENERATE_TESTS = "Please regenerate tests (GenerateTests.kt)"; - - private static final boolean RUN_IGNORED_TESTS_AS_REGULAR = - Boolean.getBoolean("org.jetbrains.kotlin.run.ignored.tests.as.regular"); - - private static final boolean PRINT_STACKTRACE_FOR_IGNORED_TESTS = - Boolean.getBoolean("org.jetbrains.kotlin.print.stacktrace.for.ignored.tests"); - - private static final boolean AUTOMATICALLY_UNMUTE_PASSED_TESTS = false; - private static final boolean AUTOMATICALLY_MUTE_FAILED_TESTS = false; - - private static final List filesToDelete = new ArrayList<>(); - - /** - * Syntax: - * - * // MODULE: name(dependency1, dependency2, ...) - * - * // FILE: name - * - * Several files may follow one module - */ - private static final String MODULE_DELIMITER = ",\\s*"; - - private static final Pattern FILE_OR_MODULE_PATTERN = Pattern.compile( - "(?://\\s*MODULE:\\s*([^()\\n]+)(?:\\(([^()]+(?:" + MODULE_DELIMITER + "[^()]+)*)\\))?\\s*(?:\\(([^()]+(?:" + MODULE_DELIMITER + "[^()]+)*)\\))?\\s*)?" + - "//\\s*FILE:\\s*(.*)$", Pattern.MULTILINE); - private static final Pattern DIRECTIVE_PATTERN = Pattern.compile("^//\\s*!([\\w_]+)(:\\s*(.*)$)?", Pattern.MULTILINE); - private static final Pattern LINE_SEPARATOR_PATTERN = Pattern.compile("\\r\\n|\\r|\\n"); - - public static final BindingTrace DUMMY_TRACE = new BindingTrace() { - @NotNull - @Override - public BindingContext getBindingContext() { - return new BindingContext() { - - @NotNull - @Override - public Diagnostics getDiagnostics() { - return Diagnostics.Companion.getEMPTY(); - } - - @Override - public V get(ReadOnlySlice slice, K key) { - return DUMMY_TRACE.get(slice, key); - } - - @NotNull - @Override - public Collection getKeys(WritableSlice slice) { - return DUMMY_TRACE.getKeys(slice); - } - - @NotNull - @TestOnly - @Override - public ImmutableMap getSliceContents(@NotNull ReadOnlySlice slice) { - return ImmutableMap.of(); - } - - @Nullable - @Override - public KotlinType getType(@NotNull KtExpression expression) { - return DUMMY_TRACE.getType(expression); - } - - @Override - public void addOwnDataTo(@NotNull BindingTrace trace, boolean commitDiagnostics) { - // do nothing - } - }; - } - - @Override - public void record(WritableSlice slice, K key, V value) { - } - - @Override - public void record(WritableSlice slice, K key) { - } - - @Override - @SuppressWarnings("unchecked") - public V get(ReadOnlySlice slice, K key) { - if (slice == BindingContext.PROCESSED) return (V) Boolean.FALSE; - return SlicedMap.DO_NOTHING.get(slice, key); - } - - @NotNull - @Override - public Collection getKeys(WritableSlice slice) { - assert slice.isCollective(); - return Collections.emptySet(); - } - - @Nullable - @Override - public KotlinType getType(@NotNull KtExpression expression) { - KotlinTypeInfo typeInfo = get(BindingContext.EXPRESSION_TYPE_INFO, expression); - return typeInfo != null ? typeInfo.getType() : null; - } - - @Override - public void recordType(@NotNull KtExpression expression, @Nullable KotlinType type) { - } - - @Override - public void report(@NotNull Diagnostic diagnostic) { - if (Errors.UNRESOLVED_REFERENCE_DIAGNOSTICS.contains(diagnostic.getFactory())) { - throw new IllegalStateException("Unresolved: " + diagnostic.getPsiElement().getText()); - } - } - - @Override - public boolean wantsDiagnostics() { - return false; - } - }; - - public static BindingTrace DUMMY_EXCEPTION_ON_ERROR_TRACE = new BindingTrace() { - @NotNull - @Override - public BindingContext getBindingContext() { - return new BindingContext() { - @NotNull - @Override - public Diagnostics getDiagnostics() { - throw new UnsupportedOperationException(); - } - - @Override - public V get(ReadOnlySlice slice, K key) { - return DUMMY_EXCEPTION_ON_ERROR_TRACE.get(slice, key); - } - - @NotNull - @Override - public Collection getKeys(WritableSlice slice) { - return DUMMY_EXCEPTION_ON_ERROR_TRACE.getKeys(slice); - } - - @NotNull - @TestOnly - @Override - public ImmutableMap getSliceContents(@NotNull ReadOnlySlice slice) { - return ImmutableMap.of(); - } - - @Nullable - @Override - public KotlinType getType(@NotNull KtExpression expression) { - return DUMMY_EXCEPTION_ON_ERROR_TRACE.getType(expression); - } - - @Override - public void addOwnDataTo(@NotNull BindingTrace trace, boolean commitDiagnostics) { - // do nothing - } - }; - } - - @Override - public void record(WritableSlice slice, K key, V value) { - } - - @Override - public void record(WritableSlice slice, K key) { - } - - @Override - public V get(ReadOnlySlice slice, K key) { - return null; - } - - @NotNull - @Override - public Collection getKeys(WritableSlice slice) { - assert slice.isCollective(); - return Collections.emptySet(); - } - - @Nullable - @Override - public KotlinType getType(@NotNull KtExpression expression) { - return null; - } - - @Override - public void recordType(@NotNull KtExpression expression, @Nullable KotlinType type) { - } - - @Override - public void report(@NotNull Diagnostic diagnostic) { - if (diagnostic.getSeverity() == Severity.ERROR) { - throw new IllegalStateException(DefaultErrorMessages.render(diagnostic)); - } - } - - @Override - public boolean wantsDiagnostics() { - return true; - } - }; - - // We suspect sequences of eight consecutive hexadecimal digits to be a package part hash code - private static final Pattern STRIP_PACKAGE_PART_HASH_PATTERN = Pattern.compile("\\$([0-9a-f]{8})"); - - private KotlinTestUtils() { - } - - @NotNull - public static AnalysisResult analyzeFile(@NotNull KtFile file, @NotNull KotlinCoreEnvironment environment) { - return JvmResolveUtil.analyze(file, environment); - } - - @NotNull - public static KotlinCoreEnvironment createEnvironmentWithMockJdkAndIdeaAnnotations(Disposable disposable) { - return createEnvironmentWithMockJdkAndIdeaAnnotations(disposable, ConfigurationKind.ALL); - } - - @NotNull - public static KotlinCoreEnvironment createEnvironmentWithMockJdkAndIdeaAnnotations(Disposable disposable, @NotNull ConfigurationKind configurationKind) { - return createEnvironmentWithJdkAndNullabilityAnnotationsFromIdea(disposable, configurationKind, TestJdkKind.MOCK_JDK); - } - - @NotNull - public static KotlinCoreEnvironment createEnvironmentWithJdkAndNullabilityAnnotationsFromIdea( - @NotNull Disposable disposable, - @NotNull ConfigurationKind configurationKind, - @NotNull TestJdkKind jdkKind - ) { - return KotlinCoreEnvironment.createForTests( - disposable, newConfiguration(configurationKind, jdkKind, getAnnotationsJar()), EnvironmentConfigFiles.JVM_CONFIG_FILES - ); - } - - @NotNull - public static KotlinCoreEnvironment createEnvironmentWithFullJdkAndIdeaAnnotations(Disposable disposable) { - return createEnvironmentWithJdkAndNullabilityAnnotationsFromIdea(disposable, ConfigurationKind.ALL, TestJdkKind.FULL_JDK); - } - - @NotNull - public static String getTestDataPathBase() { - return getHomeDirectory() + "/compiler/testData"; - } - - private static String homeDir = computeHomeDirectory(); - - @NotNull - public static String getHomeDirectory() { - return homeDir; - } - - @NotNull - private static String computeHomeDirectory() { - String userDir = System.getProperty("user.dir"); - File dir = new File(userDir == null ? "." : userDir); - return FileUtil.toCanonicalPath(dir.getAbsolutePath()); - } - - public static File findMockJdkRtJar() { - return new File(getHomeDirectory(), "compiler/testData/mockJDK/jre/lib/rt.jar"); - } - - // Differs from common mock JDK only by one additional 'nonExistingMethod' in Collection and constructor from Double in Throwable - // It's needed to test the way we load additional built-ins members that neither in black nor white lists - public static File findMockJdkRtModified() { - return new File(getHomeDirectory(), "compiler/testData/mockJDKModified/rt.jar"); - } - - public static File findAndroidApiJar() { - String androidJarProp = System.getProperty("android.jar"); - File androidJarFile = androidJarProp == null ? null : new File(androidJarProp); - if (androidJarFile == null || !androidJarFile.isFile()) { - throw new RuntimeException( - "Unable to get a valid path from 'android.jar' property (" + - androidJarProp + - "), please point it to the 'android.jar' file location"); - } - return androidJarFile; - } - - @NotNull - public static File findAndroidSdk() { - String androidSdkProp = System.getProperty("android.sdk"); - File androidSdkDir = androidSdkProp == null ? null : new File(androidSdkProp); - if (androidSdkDir == null || !androidSdkDir.isDirectory()) { - throw new RuntimeException( - "Unable to get a valid path from 'android.sdk' property (" + - androidSdkProp + - "), please point it to the android SDK location"); - } - return androidSdkDir; - } - - public static String getAndroidSdkSystemIndependentPath() { - return com.intellij.util.PathUtil.toSystemIndependentName(findAndroidSdk().getAbsolutePath()); - } - - public static File getAnnotationsJar() { - return new File(getHomeDirectory(), "compiler/testData/mockJDK/jre/lib/annotations.jar"); - } - - public static void mkdirs(@NotNull File file) { - if (file.isDirectory()) { - return; - } - if (!file.mkdirs()) { - if (file.exists()) { - throw new IllegalStateException("Failed to create " + file + ": file exists and not a directory"); - } - throw new IllegalStateException("Failed to create " + file); - } - } - - @NotNull - public static File tmpDirForTest(@NotNull String testClassName, @NotNull String testName) throws IOException { - File answer = normalizeFile(FileUtil.createTempDirectory(testClassName, testName)); - deleteOnShutdown(answer); - return answer; - } - - @NotNull - public static File tmpDirForTest(TestCase test) throws IOException { - return tmpDirForTest(test.getClass().getSimpleName(), test.getName()); - } - - @NotNull - public static File tmpDir(String name) throws IOException { - // We should use this form. otherwise directory will be deleted on each test. - File answer = normalizeFile(FileUtil.createTempDirectory(new File(System.getProperty("java.io.tmpdir")), name, "")); - deleteOnShutdown(answer); - return answer; - } - - private static File normalizeFile(File file) throws IOException { - // Get canonical file to be sure that it's the same as inside the compiler, - // for example, on Windows, if a canonical path contains any space from FileUtil.createTempDirectory we will get - // a File with short names (8.3) in its path and it will break some normalization passes in tests. - return file.getCanonicalFile(); - } - - private static void deleteOnShutdown(File file) { - if (filesToDelete.isEmpty()) { - ShutDownTracker.getInstance().registerShutdownTask(() -> ShutDownTracker.invokeAndWait(true, true, () -> { - for (File victim : filesToDelete) { - FileUtil.delete(victim); - } - })); - } - - filesToDelete.add(file); - } - - @NotNull - public static KtFile createFile(@NotNull @NonNls String name, @NotNull String text, @NotNull Project project) { - String shortName = name.substring(name.lastIndexOf('/') + 1); - shortName = shortName.substring(shortName.lastIndexOf('\\') + 1); - LightVirtualFile virtualFile = new LightVirtualFile(shortName, KotlinLanguage.INSTANCE, StringUtilRt.convertLineSeparators(text)) { - @NotNull - @Override - public String getPath() { - //TODO: patch LightVirtualFile - return "/" + name; - } - }; - - virtualFile.setCharset(CharsetToolkit.UTF8_CHARSET); - PsiFileFactoryImpl factory = (PsiFileFactoryImpl) PsiFileFactory.getInstance(project); - //noinspection ConstantConditions - return (KtFile) factory.trySetupPsiForFile(virtualFile, KotlinLanguage.INSTANCE, true, false); - } - - public static String doLoadFile(String myFullDataPath, String name) throws IOException { - String fullName = myFullDataPath + File.separatorChar + name; - return doLoadFile(new File(fullName)); - } - - public static String doLoadFile(@NotNull File file) throws IOException { - try { - return FileUtil.loadFile(file, CharsetToolkit.UTF8, true); - } - catch (FileNotFoundException fileNotFoundException) { - /* - * Unfortunately, the FileNotFoundException will only show the relative path in it's exception message. - * This clarifies the exception by showing the full path. - */ - String messageWithFullPath = file.getAbsolutePath() + " (No such file or directory)"; - throw new IOException( - "Ensure you have your 'Working Directory' configured correctly as the root " + - "Kotlin project directory in your test configuration\n\t" + - messageWithFullPath, - fileNotFoundException); - } - } - - public static String getFilePath(File file) { - return FileUtil.toSystemIndependentName(file.getPath()); - } - - @NotNull - public static CompilerConfiguration newConfiguration() { - CompilerConfiguration configuration = new CompilerConfiguration(); - configuration.put(CommonConfigurationKeys.MODULE_NAME, TEST_MODULE_NAME); - - if ("true".equals(System.getProperty("kotlin.ni"))) { - // Enable new inference for tests which do not declare their own language version settings - CommonConfigurationKeysKt.setLanguageVersionSettings(configuration, new CompilerTestLanguageVersionSettings( - Collections.emptyMap(), - LanguageVersionSettingsImpl.DEFAULT.getApiVersion(), - LanguageVersionSettingsImpl.DEFAULT.getLanguageVersion(), - Collections.emptyMap() - )); - } - - configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, new MessageCollector() { - @Override - public void clear() { - } - - @Override - public void report( - @NotNull CompilerMessageSeverity severity, @NotNull String message, @Nullable CompilerMessageLocation location - ) { - if (severity == CompilerMessageSeverity.ERROR) { - String prefix = location == null - ? "" - : "(" + location.getPath() + ":" + location.getLine() + ":" + location.getColumn() + ") "; - throw new AssertionError(prefix + message); - } - } - - @Override - public boolean hasErrors() { - return false; - } - }); - - return configuration; - } - - @NotNull - public static CompilerConfiguration newConfiguration( - @NotNull ConfigurationKind configurationKind, - @NotNull TestJdkKind jdkKind, - @NotNull File... extraClasspath - ) { - return newConfiguration(configurationKind, jdkKind, Arrays.asList(extraClasspath), Collections.emptyList()); - } - - @NotNull - public static CompilerConfiguration newConfiguration( - @NotNull ConfigurationKind configurationKind, - @NotNull TestJdkKind jdkKind, - @NotNull List classpath, - @NotNull List javaSource - ) { - CompilerConfiguration configuration = newConfiguration(); - JvmContentRootsKt.addJavaSourceRoots(configuration, javaSource); - if (jdkKind == TestJdkKind.MOCK_JDK) { - JvmContentRootsKt.addJvmClasspathRoot(configuration, findMockJdkRtJar()); - configuration.put(JVMConfigurationKeys.NO_JDK, true); - } - else if (jdkKind == TestJdkKind.MODIFIED_MOCK_JDK) { - JvmContentRootsKt.addJvmClasspathRoot(configuration, findMockJdkRtModified()); - configuration.put(JVMConfigurationKeys.NO_JDK, true); - } - else if (jdkKind == TestJdkKind.ANDROID_API) { - JvmContentRootsKt.addJvmClasspathRoot(configuration, findAndroidApiJar()); - configuration.put(JVMConfigurationKeys.NO_JDK, true); - } - else if (jdkKind == TestJdkKind.FULL_JDK_6) { - String jdk6 = System.getenv("JDK_16"); - assert jdk6 != null : "Environment variable JDK_16 is not set"; - configuration.put(JVMConfigurationKeys.JDK_HOME, new File(jdk6)); - } - else if (jdkKind == TestJdkKind.FULL_JDK_9) { - configuration.put(JVMConfigurationKeys.JDK_HOME, getJdk9Home()); - } - else { - JvmContentRootsKt.addJvmClasspathRoots(configuration, PathUtil.getJdkClassesRootsFromCurrentJre()); - } - - if (configurationKind.getWithRuntime()) { - JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.runtimeJarForTests()); - JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.scriptRuntimeJarForTests()); - JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.kotlinTestJarForTests()); - } - else if (configurationKind.getWithMockRuntime()) { - JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.minimalRuntimeJarForTests()); - JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.scriptRuntimeJarForTests()); - } - if (configurationKind.getWithReflection()) { - JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.reflectJarForTests()); - } - - JvmContentRootsKt.addJvmClasspathRoots(configuration, classpath); - - return configuration; - } - - @NotNull - public static File getJdk9Home() { - String jdk9 = System.getenv("JDK_9"); - if (jdk9 == null) { - jdk9 = System.getenv("JDK_19"); - if (jdk9 == null) { - throw new AssertionError("Environment variable JDK_9 is not set!"); - } - } - return new File(jdk9); - } - - public static void resolveAllKotlinFiles(KotlinCoreEnvironment environment) throws IOException { - List roots = ContentRootsKt.getKotlinSourceRoots(environment.getConfiguration()); - if (roots.isEmpty()) return; - List ktFiles = new ArrayList<>(); - for (KotlinSourceRoot root : roots) { - File file = new File(root.getPath()); - if (file.isFile()) { - ktFiles.add(loadJetFile(environment.getProject(), file)); - } - else { - //noinspection ConstantConditions - for (File childFile : file.listFiles()) { - if (childFile.getName().endsWith(".kt") || childFile.getName().endsWith(".kts")) { - ktFiles.add(loadJetFile(environment.getProject(), childFile)); - } - } - } - } - JvmResolveUtil.analyze(ktFiles, environment); - } - - public static void assertEqualsToFile(@NotNull File expectedFile, @NotNull Editor editor) { - assertEqualsToFile(expectedFile, editor, true); - } - - public static void assertEqualsToFile(@NotNull File expectedFile, @NotNull Editor editor, Boolean enableSelectionTags) { - Caret caret = editor.getCaretModel().getCurrentCaret(); - List tags = Lists.newArrayList( - new TagsTestDataUtil.TagInfo<>(caret.getOffset(), true, "caret") - ); - - if (enableSelectionTags) { - int selectionStart = caret.getSelectionStart(); - int selectionEnd = caret.getSelectionEnd(); - - tags.add(new TagsTestDataUtil.TagInfo<>(selectionStart, true, "selection")); - tags.add(new TagsTestDataUtil.TagInfo<>(selectionEnd, false, "selection")); - } - - String afterText = TagsTestDataUtil.insertTagsInText(tags, editor.getDocument().getText()); - - assertEqualsToFile(expectedFile, afterText); - } - - public static void assertEqualsToFile(@NotNull File expectedFile, @NotNull String actual) { - assertEqualsToFile(expectedFile, actual, s -> s); - } - - public static void assertEqualsToFile(@NotNull String message, @NotNull File expectedFile, @NotNull String actual) { - assertEqualsToFile(message, expectedFile, actual, s -> s); - } - - public static void assertEqualsToFile(@NotNull File expectedFile, @NotNull String actual, @NotNull Function1 sanitizer) { - assertEqualsToFile("Actual data differs from file content", expectedFile, actual, sanitizer); - } - - public static void assertEqualsToFile(@NotNull String message, @NotNull File expectedFile, @NotNull String actual, @NotNull Function1 sanitizer) { - try { - String actualText = JetTestUtilsKt.trimTrailingWhitespacesAndAddNewlineAtEOF(StringUtil.convertLineSeparators(actual.trim())); - - if (!expectedFile.exists()) { - FileUtil.writeToFile(expectedFile, actualText); - Assert.fail("Expected data file did not exist. Generating: " + expectedFile); - } - String expected = FileUtil.loadFile(expectedFile, CharsetToolkit.UTF8, true); - - String expectedText = JetTestUtilsKt.trimTrailingWhitespacesAndAddNewlineAtEOF(StringUtil.convertLineSeparators(expected.trim())); - - if (!Comparing.equal(sanitizer.invoke(expectedText), sanitizer.invoke(actualText))) { - throw new FileComparisonFailure(message + ": " + expectedFile.getName(), - expected, actual, expectedFile.getAbsolutePath()); - } - } - catch (IOException e) { - throw ExceptionUtilsKt.rethrow(e); - } - } - - public static boolean compileKotlinWithJava( - @NotNull List javaFiles, - @NotNull List ktFiles, - @NotNull File outDir, - @NotNull Disposable disposable, - @Nullable File javaErrorFile - ) throws IOException { - if (!ktFiles.isEmpty()) { - KotlinCoreEnvironment environment = createEnvironmentWithFullJdkAndIdeaAnnotations(disposable); - CompilerTestLanguageVersionSettingsKt.setupLanguageVersionSettingsForMultifileCompilerTests(ktFiles, environment); - LoadDescriptorUtil.compileKotlinToDirAndGetModule(ktFiles, outDir, environment); - } - else { - boolean mkdirs = outDir.mkdirs(); - assert mkdirs : "Not created: " + outDir; - } - if (javaFiles.isEmpty()) return true; - - return compileJavaFiles(javaFiles, Arrays.asList( - "-classpath", outDir.getPath() + File.pathSeparator + ForTestCompileRuntime.runtimeJarForTests(), - "-d", outDir.getPath() - ), javaErrorFile); - } - - public interface TestFileFactory { - F createFile(@Nullable M module, @NotNull String fileName, @NotNull String text, @NotNull Map directives); - M createModule(@NotNull String name, @NotNull List dependencies, @NotNull List friends); - } - - public static abstract class TestFileFactoryNoModules implements TestFileFactory { - @Override - public final F createFile( - @Nullable Void module, - @NotNull String fileName, - @NotNull String text, - @NotNull Map directives - ) { - return create(fileName, text, directives); - } - - @NotNull - public abstract F create(@NotNull String fileName, @NotNull String text, @NotNull Map directives); - - @Override - public Void createModule(@NotNull String name, @NotNull List dependencies, @NotNull List friends) { - return null; - } - } - - @NotNull - public static List createTestFiles(@Nullable String testFileName, String expectedText, TestFileFactory factory) { - return createTestFiles(testFileName, expectedText, factory, false, ""); - } - - @NotNull - public static List createTestFiles(@Nullable String testFileName, String expectedText, TestFileFactory factory, String coroutinesPackage) { - return createTestFiles(testFileName, expectedText, factory, false, coroutinesPackage); - } - - @NotNull - public static List createTestFiles(String testFileName, String expectedText, TestFileFactory factory, - boolean preserveLocations, String coroutinesPackage) { - Map directives = parseDirectives(expectedText); - - List testFiles = Lists.newArrayList(); - Matcher matcher = FILE_OR_MODULE_PATTERN.matcher(expectedText); - boolean hasModules = false; - if (!matcher.find()) { - assert testFileName != null : "testFileName should not be null if no FILE directive defined"; - // One file - testFiles.add(factory.createFile(null, testFileName, expectedText, directives)); - } - else { - int processedChars = 0; - M module = null; - // Many files - while (true) { - String moduleName = matcher.group(1); - String moduleDependencies = matcher.group(2); - String moduleFriends = matcher.group(3); - if (moduleName != null) { - moduleName = moduleName.trim(); - hasModules = true; - module = factory.createModule(moduleName, parseModuleList(moduleDependencies), parseModuleList(moduleFriends)); - } - - String fileName = matcher.group(4); - int start = processedChars; - - boolean nextFileExists = matcher.find(); - int end; - if (nextFileExists) { - end = matcher.start(); - } - else { - end = expectedText.length(); - } - String fileText = preserveLocations ? - substringKeepingLocations(expectedText, start, end) : - expectedText.substring(start,end); - processedChars = end; - - testFiles.add(factory.createFile(module, fileName, fileText, directives)); - - if (!nextFileExists) break; - } - assert processedChars == expectedText.length() : "Characters skipped from " + - processedChars + - " to " + - (expectedText.length() - 1); - } - - if (isDirectiveDefined(expectedText, "WITH_COROUTINES")) { - M supportModule = hasModules ? factory.createModule("support", Collections.emptyList(), Collections.emptyList()) : null; - - boolean isReleaseCoroutines = - !coroutinesPackage.contains("experimental") && - !isDirectiveDefined(expectedText, "!LANGUAGE: -ReleaseCoroutines"); - - testFiles.add(factory.createFile(supportModule, - "CoroutineUtil.kt", - CoroutineTestUtilKt.createTextForHelpers(isReleaseCoroutines), - directives - )); - } - - return testFiles; - } - - private static String substringKeepingLocations(String string, int start, int end) { - Matcher matcher = LINE_SEPARATOR_PATTERN.matcher(string); - StringBuilder prefix = new StringBuilder(); - int lastLineOffset = 0; - while (matcher.find()) { - if (matcher.end() > start) { - break; - } - - lastLineOffset = matcher.end(); - prefix.append('\n'); - } - - while (lastLineOffset++ < start) { - prefix.append(' '); - } - - return prefix + string.substring(start, end); - } - - private static List parseModuleList(@Nullable String dependencies) { - if (dependencies == null) return Collections.emptyList(); - return StringsKt.split(dependencies, Pattern.compile(MODULE_DELIMITER), 0); - } - - @NotNull - public static Map parseDirectives(String expectedText) { - Map directives = new HashMap<>(); - Matcher directiveMatcher = DIRECTIVE_PATTERN.matcher(expectedText); - while (directiveMatcher.find()) { - String name = directiveMatcher.group(1); - String value = directiveMatcher.group(3); - String oldValue = directives.put(name, value); - Assert.assertNull("Directive overwritten: " + name + " old value: " + oldValue + " new value: " + value, oldValue); - } - return directives; - } - - public static List loadBeforeAfterText(String filePath) { - String content; - - try { - content = FileUtil.loadFile(new File(filePath), true); - } - catch (IOException e) { - throw new RuntimeException(e); - } - - List files = createTestFiles("", content, new TestFileFactoryNoModules() { - @NotNull - @Override - public String create(@NotNull String fileName, @NotNull String text, @NotNull Map directives) { - int firstLineEnd = text.indexOf('\n'); - return StringUtil.trimTrailing(text.substring(firstLineEnd + 1)); - } - }, ""); - - Assert.assertTrue("Exactly two files expected: ", files.size() == 2); - - return files; - } - - public static String getLastCommentedLines(@NotNull Document document) { - List resultLines = new ArrayList<>(); - for (int i = document.getLineCount() - 1; i >= 0; i--) { - int lineStart = document.getLineStartOffset(i); - int lineEnd = document.getLineEndOffset(i); - if (document.getCharsSequence().subSequence(lineStart, lineEnd).toString().trim().isEmpty()) { - continue; - } - - if ("//".equals(document.getCharsSequence().subSequence(lineStart, lineStart + 2).toString())) { - resultLines.add(document.getCharsSequence().subSequence(lineStart + 2, lineEnd)); - } - else { - break; - } - } - Collections.reverse(resultLines); - StringBuilder result = new StringBuilder(); - for (CharSequence line : resultLines) { - result.append(line).append("\n"); - } - result.delete(result.length() - 1, result.length()); - return result.toString(); - } - - public enum CommentType { - ALL, - LINE_COMMENT, - BLOCK_COMMENT - } - - @NotNull - public static String getLastCommentInFile(@NotNull KtFile file) { - return CollectionsKt.first(getLastCommentsInFile(file, CommentType.ALL, true)); - } - - @NotNull - public static List getLastCommentsInFile(@NotNull KtFile file, CommentType commentType, boolean assertMustExist) { - PsiElement lastChild = file.getLastChild(); - if (lastChild != null && lastChild.getNode().getElementType().equals(KtTokens.WHITE_SPACE)) { - lastChild = lastChild.getPrevSibling(); - } - assert lastChild != null; - - List comments = ContainerUtil.newArrayList(); - - while (true) { - if (lastChild.getNode().getElementType().equals(KtTokens.BLOCK_COMMENT)) { - if (commentType == CommentType.ALL || commentType == CommentType.BLOCK_COMMENT) { - String lastChildText = lastChild.getText(); - comments.add(lastChildText.substring(2, lastChildText.length() - 2).trim()); - } - } - else if (lastChild.getNode().getElementType().equals(KtTokens.EOL_COMMENT)) { - if (commentType == CommentType.ALL || commentType == CommentType.LINE_COMMENT) { - comments.add(lastChild.getText().substring(2).trim()); - } - } - else { - break; - } - - lastChild = lastChild.getPrevSibling(); - } - - if (comments.isEmpty() && assertMustExist) { - throw new AssertionError(String.format( - "Test file '%s' should end in a comment of type %s; last node was: %s", file.getName(), commentType, lastChild)); - } - - return comments; - } - - public static boolean compileJavaFiles(@NotNull Collection files, List options) throws IOException { - return compileJavaFiles(files, options, null); - } - - private static boolean compileJavaFiles(@NotNull Collection files, List options, @Nullable File javaErrorFile) throws IOException { - JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler(); - DiagnosticCollector diagnosticCollector = new DiagnosticCollector<>(); - try (StandardJavaFileManager fileManager = - javaCompiler.getStandardFileManager(diagnosticCollector, Locale.ENGLISH, Charset.forName("utf-8"))) { - Iterable javaFileObjectsFromFiles = fileManager.getJavaFileObjectsFromFiles(files); - - JavaCompiler.CompilationTask task = javaCompiler.getTask( - new StringWriter(), // do not write to System.err - fileManager, - diagnosticCollector, - options, - null, - javaFileObjectsFromFiles); - - Boolean success = task.call(); // do NOT inline this variable, call() should complete before errorsToString() - if (javaErrorFile == null || !javaErrorFile.exists()) { - Assert.assertTrue(errorsToString(diagnosticCollector, true), success); - } - else { - assertEqualsToFile(javaErrorFile, errorsToString(diagnosticCollector, false)); - } - return success; - } - } - - public static boolean compileJavaFilesExternallyWithJava9(@NotNull Collection files, @NotNull List options) { - List command = new ArrayList<>(); - command.add(new File(getJdk9Home(), "bin/javac").getPath()); - command.addAll(options); - for (File file : files) { - command.add(file.getPath()); - } - - try { - Process process = new ProcessBuilder().command(command).inheritIO().start(); - process.waitFor(); - return process.exitValue() == 0; - } - catch (Exception e) { - throw ExceptionUtilsKt.rethrow(e); - } - } - - @NotNull - private static String errorsToString(@NotNull DiagnosticCollector diagnosticCollector, boolean humanReadable) { - StringBuilder builder = new StringBuilder(); - for (javax.tools.Diagnostic diagnostic : diagnosticCollector.getDiagnostics()) { - if (diagnostic.getKind() != javax.tools.Diagnostic.Kind.ERROR) continue; - - if (humanReadable) { - builder.append(diagnostic).append("\n"); - } - else { - builder.append(new File(diagnostic.getSource().toUri()).getName()).append(":") - .append(diagnostic.getLineNumber()).append(":") - .append(diagnostic.getColumnNumber()).append(":") - .append(diagnostic.getCode()).append("\n"); - } - } - return builder.toString(); - } - - public static String navigationMetadata(@TestDataFile String testFile) { - return testFile; - } - - public interface DoTest { - void invoke(String filePath) throws Exception; - } - - // In this test runner version the `testDataFile` parameter is annotated by `TestDataFile`. - // So only file paths passed to this parameter will be used in navigation actions, like "Navigate to testdata" and "Related Symbol..." - public static void runTest(DoTest test, TargetBackend targetBackend, @TestDataFile String testDataFile) throws Exception { - runTest0(test, targetBackend, testDataFile); - } - - // In this test runner version, NONE of the parameters are annotated by `TestDataFile`. - // So DevKit will use test name to determine related files in navigation actions, like "Navigate to testdata" and "Related Symbol..." - // - // Pro: - // * in most cases, it shows all related files including generated js files, for example. - // Cons: - // * sometimes, for too common/general names, it shows many variants to navigate - // * it adds an additional step for navigation -- you must choose an exact file to navigate - public static void runTest0(DoTest test, TargetBackend targetBackend, String testDataFilePath) throws Exception { - File testDataFile = new File(testDataFilePath); - - boolean isIgnored = isIgnoredTarget(targetBackend, testDataFile); - - try { - test.invoke(testDataFilePath); - } - catch (Throwable e) { - - if (!isIgnored && AUTOMATICALLY_MUTE_FAILED_TESTS) { - String text = doLoadFile(testDataFile); - String directive = InTextDirectivesUtils.IGNORE_BACKEND_DIRECTIVE_PREFIX + targetBackend.name() + "\n"; - - String newText; - if (text.startsWith("// !")) { - StringBuilder prefixBuilder = new StringBuilder(); - int l = 0; - while (text.startsWith("// !", l)) { - int r = text.indexOf("\n", l) + 1; - if (r <= 0) r = text.length(); - prefixBuilder.append(text.substring(l, r)); - l = r; - } - prefixBuilder.append(directive); - prefixBuilder.append(text.substring(l)); - - newText = prefixBuilder.toString(); - } else { - newText = directive + text; - } - - if (!newText.equals(text)) { - System.err.println("\"" + directive + "\" was added to \"" + testDataFile + "\""); - FileUtil.writeToFile(testDataFile, newText); - } - } - - if (RUN_IGNORED_TESTS_AS_REGULAR || !isIgnored) { - throw e; - } - - if (PRINT_STACKTRACE_FOR_IGNORED_TESTS) { - e.printStackTrace(); - } - return; - } - - if (isIgnored) { - if (AUTOMATICALLY_UNMUTE_PASSED_TESTS) { - String text = doLoadFile(testDataFile); - String directive = InTextDirectivesUtils.IGNORE_BACKEND_DIRECTIVE_PREFIX + targetBackend.name(); - String newText = Pattern.compile("^" + directive + "\n", Pattern.MULTILINE).matcher(text).replaceAll(""); - - if (!newText.equals(text)) { - System.err.println("\"" + directive + "\" was removed from \"" + testDataFile + "\""); - FileUtil.writeToFile(testDataFile, newText); - } - } - - throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive."); - } - } - - public static String getTestsRoot(@NotNull Class testCaseClass) { - TestMetadata testClassMetadata = testCaseClass.getAnnotation(TestMetadata.class); - Assert.assertNotNull("No metadata for class: " + testCaseClass, testClassMetadata); - return testClassMetadata.value(); - } - - /** - * @return test data file name specified in the metadata of test method - */ - @Nullable - public static String getTestDataFileName(@NotNull Class testCaseClass, @NotNull String testName) { - try { - Method method = testCaseClass.getDeclaredMethod(testName); - return getMethodMetadata(method); - } - catch (NoSuchMethodException e) { - throw new RuntimeException(e); - } - } - - public static void assertAllTestsPresentByMetadata( - @NotNull Class testCaseClass, - @NotNull File testDataDir, - @NotNull Pattern filenamePattern, - @NotNull TargetBackend targetBackend, - boolean recursive, - @NotNull String... excludeDirs - ) { - File rootFile = new File(getTestsRoot(testCaseClass)); - - Set filePaths = collectPathsMetadata(testCaseClass); - Set exclude = SetsKt.setOf(excludeDirs); - - File[] files = testDataDir.listFiles(); - if (files != null) { - for (File file : files) { - if (file.isDirectory()) { - if (recursive && containsTestData(file, filenamePattern) && !exclude.contains(file.getName())) { - assertTestClassPresentByMetadata(testCaseClass, file); - } - } - else if (filenamePattern.matcher(file.getName()).matches() && isCompatibleTarget(targetBackend, file)) { - assertFilePathPresent(file, rootFile, filePaths); - } - } - } - } - - public static void assertAllTestsPresentInSingleGeneratedClass( - @NotNull Class testCaseClass, - @NotNull File testDataDir, - @NotNull Pattern filenamePattern, - @NotNull TargetBackend targetBackend - ) { - File rootFile = new File(getTestsRoot(testCaseClass)); - - Set filePaths = collectPathsMetadata(testCaseClass); - - FileUtil.processFilesRecursively(testDataDir, file -> { - if (file.isFile() && filenamePattern.matcher(file.getName()).matches() && isCompatibleTarget(targetBackend, file)) { - assertFilePathPresent(file, rootFile, filePaths); - } - - return true; - }); - } - - private static void assertFilePathPresent(File file, File rootFile, Set filePaths) { - String path = FileUtil.getRelativePath(rootFile, file); - if (path != null) { - String relativePath = nameToCompare(path); - if (!filePaths.contains(relativePath)) { - Assert.fail("Test data file missing from the generated test class: " + file + "\n" + PLEASE_REGENERATE_TESTS); - } - } - } - - private static Set collectPathsMetadata(Class testCaseClass) { - return ContainerUtil.newHashSet(ContainerUtil.map(collectMethodsMetadata(testCaseClass), KotlinTestUtils::nameToCompare)); - } - - @Nullable - private static String getMethodMetadata(Method method) { - TestMetadata testMetadata = method.getAnnotation(TestMetadata.class); - return (testMetadata != null) ? testMetadata.value() : null; - } - - private static Set collectMethodsMetadata(Class testCaseClass) { - Set filePaths = new HashSet<>(); - for (Method method : testCaseClass.getDeclaredMethods()) { - String path = getMethodMetadata(method); - if (path != null) { - filePaths.add(path); - } - } - return filePaths; - } - - private static boolean containsTestData(File dir, Pattern filenamePattern) { - File[] files = dir.listFiles(); - assert files != null; - for (File file : files) { - if (file.isDirectory()) { - if (containsTestData(file, filenamePattern)) { - return true; - } - } - else { - if (filenamePattern.matcher(file.getName()).matches()) { - return true; - } - } - } - return false; - } - - private static void assertTestClassPresentByMetadata(@NotNull Class outerClass, @NotNull File testDataDir) { - for (Class nestedClass : outerClass.getDeclaredClasses()) { - TestMetadata testMetadata = nestedClass.getAnnotation(TestMetadata.class); - if (testMetadata != null && testMetadata.value().equals(getFilePath(testDataDir))) { - return; - } - } - Assert.fail("Test data directory missing from the generated test class: " + testDataDir + "\n" + PLEASE_REGENERATE_TESTS); - } - - @NotNull - public static KtFile loadJetFile(@NotNull Project project, @NotNull File ioFile) throws IOException { - String text = FileUtil.loadFile(ioFile, true); - return KtPsiFactoryKt.KtPsiFactory(project).createPhysicalFile(ioFile.getName(), text); - } - - @NotNull - public static List loadToJetFiles(@NotNull KotlinCoreEnvironment environment, @NotNull List files) throws IOException { - List jetFiles = Lists.newArrayList(); - for (File file : files) { - jetFiles.add(loadJetFile(environment.getProject(), file)); - } - return jetFiles; - } - - @NotNull - public static ModuleDescriptorImpl createEmptyModule() { - return createEmptyModule(""); - } - - @NotNull - public static ModuleDescriptorImpl createEmptyModule(@NotNull String name) { - return createEmptyModule(name, DefaultBuiltIns.getInstance()); - } - - @NotNull - public static ModuleDescriptorImpl createEmptyModule(@NotNull String name, @NotNull KotlinBuiltIns builtIns) { - return new ModuleDescriptorImpl(Name.special(name), LockBasedStorageManager.NO_LOCKS, builtIns); - } - - @NotNull - public static File replaceExtension(@NotNull File file, @Nullable String newExtension) { - return new File(file.getParentFile(), FileUtil.getNameWithoutExtension(file) + (newExtension == null ? "" : "." + newExtension)); - } - - @NotNull - public static String replaceHashWithStar(@NotNull String string) { - return replaceHash(string, "*"); - } - - public static String replaceHash(@NotNull String string, @NotNull String replacement) { - //TODO: hashes are still used in SamWrapperCodegen - Matcher matcher = STRIP_PACKAGE_PART_HASH_PATTERN.matcher(string); - if (matcher.find()) { - return matcher.replaceAll("\\$" + replacement); - } - return string; - } - - public static boolean isAllFilesPresentTest(String testName) { - //noinspection SpellCheckingInspection - return testName.toLowerCase().startsWith("allfilespresentin"); - } - - public static String nameToCompare(@NotNull String name) { - return (SystemInfo.isFileSystemCaseSensitive ? name : name.toLowerCase()).replace('\\', '/'); - } - - public static boolean isMultiExtensionName(@NotNull String name) { - int firstDotIndex = name.indexOf('.'); - if (firstDotIndex == -1) { - return false; - } - // Several extension if name contains another dot - return name.indexOf('.', firstDotIndex + 1) != -1; - } -} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtParsingTestCase.java.as31 b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtParsingTestCase.java.as31 deleted file mode 100644 index 657557f6f37..00000000000 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtParsingTestCase.java.as31 +++ /dev/null @@ -1,337 +0,0 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.test.testFramework; - -import com.intellij.core.CoreASTFactory; -import com.intellij.lang.*; -import com.intellij.lang.impl.PsiBuilderFactoryImpl; -import com.intellij.mock.*; -import com.intellij.openapi.Disposable; -import com.intellij.openapi.application.PathManager; -import com.intellij.openapi.editor.Document; -import com.intellij.openapi.editor.EditorFactory; -import com.intellij.openapi.extensions.ExtensionPointName; -import com.intellij.openapi.extensions.Extensions; -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.progress.EmptyProgressIndicator; -import com.intellij.openapi.progress.ProgressManager; -import com.intellij.openapi.progress.impl.CoreProgressManager; -import com.intellij.openapi.util.Disposer; -import com.intellij.openapi.util.Key; -import com.intellij.openapi.util.TextRange; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.vfs.CharsetToolkit; -import com.intellij.pom.PomModel; -import com.intellij.pom.core.impl.PomModelImpl; -import com.intellij.pom.tree.TreeAspect; -import com.intellij.psi.*; -import com.intellij.psi.impl.*; -import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry; -import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl; -import com.intellij.psi.impl.source.text.BlockSupportImpl; -import com.intellij.psi.impl.source.text.DiffLog; -import com.intellij.psi.util.CachedValuesManager; -import com.intellij.testFramework.LightVirtualFile; -import com.intellij.testFramework.TestDataFile; -import com.intellij.util.CachedValuesManagerImpl; -import com.intellij.util.Function; -import com.intellij.util.messages.MessageBus; -import com.intellij.util.messages.MessageBusFactory; -import junit.framework.TestCase; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; -import org.picocontainer.ComponentAdapter; -import org.picocontainer.MutablePicoContainer; - -import java.io.File; -import java.io.IOException; -import java.util.Set; - -@SuppressWarnings("ALL") -public abstract class KtParsingTestCase extends KtPlatformLiteFixture { - public static final Key HARD_REF_TO_DOCUMENT_KEY = Key.create("HARD_REF_TO_DOCUMENT_KEY"); - protected String myFilePrefix = ""; - protected String myFileExt; - protected final String myFullDataPath; - protected PsiFile myFile; - private MockPsiManager myPsiManager; - private PsiFileFactoryImpl myFileFactory; - protected Language myLanguage; - private final ParserDefinition[] myDefinitions; - private final boolean myLowercaseFirstLetter; - - protected KtParsingTestCase(@NonNls @NotNull String dataPath, @NotNull String fileExt, @NotNull ParserDefinition... definitions) { - this(dataPath, fileExt, false, definitions); - } - - protected KtParsingTestCase(@NonNls @NotNull String dataPath, @NotNull String fileExt, boolean lowercaseFirstLetter, @NotNull ParserDefinition... definitions) { - myDefinitions = definitions; - myFullDataPath = getTestDataPath() + "/" + dataPath; - myFileExt = fileExt; - myLowercaseFirstLetter = lowercaseFirstLetter; - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - initApplication(); - ComponentAdapter component = getApplication().getPicoContainer().getComponentAdapter(ProgressManager.class.getName()); - - Extensions.registerAreaClass("IDEA_PROJECT", null); - myProject = new MockProjectEx(getTestRootDisposable()); - myPsiManager = new MockPsiManager(myProject); - myFileFactory = new PsiFileFactoryImpl(myPsiManager); - MutablePicoContainer appContainer = getApplication().getPicoContainer(); - registerComponentInstance(appContainer, MessageBus.class, MessageBusFactory.newMessageBus(getApplication())); - final MockEditorFactory editorFactory = new MockEditorFactory(); - registerComponentInstance(appContainer, EditorFactory.class, editorFactory); - registerComponentInstance(appContainer, FileDocumentManager.class, new MockFileDocumentManagerImpl(new Function() { - @Override - public Document fun(CharSequence charSequence) { - return editorFactory.createDocument(charSequence); - } - }, HARD_REF_TO_DOCUMENT_KEY)); - registerComponentInstance(appContainer, PsiDocumentManager.class, new MockPsiDocumentManager()); - registerApplicationService(PsiBuilderFactory.class, new PsiBuilderFactoryImpl()); - registerApplicationService(DefaultASTFactory.class, new CoreASTFactory()); - registerApplicationService(ReferenceProvidersRegistry.class, new ReferenceProvidersRegistryImpl()); - - registerApplicationService(ProgressManager.class, new CoreProgressManager()); - - myProject.registerService(CachedValuesManager.class, new CachedValuesManagerImpl(myProject, new PsiCachedValuesFactory(myPsiManager))); - 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); - } - if (myDefinitions.length > 0) { - configureFromParserDefinition(myDefinitions[0], myFileExt); - } - - // That's for reparse routines - final PomModelImpl pomModel = new PomModelImpl(myProject); - myProject.registerService(PomModel.class, pomModel); - new TreeAspect(pomModel); - } - - public void configureFromParserDefinition(ParserDefinition definition, String extension) { - myLanguage = definition.getFileNodeType().getLanguage(); - myFileExt = extension; - addExplicitExtension(LanguageParserDefinitions.INSTANCE, this.myLanguage, definition); - registerComponentInstance( - getApplication().getPicoContainer(), FileTypeManager.class, - new MockFileTypeManager(new MockLanguageFileType(myLanguage, myFileExt))); - } - - protected void addExplicitExtension(final LanguageExtension instance, final Language language, final T object) { - instance.addExplicitExtension(language, object); - Disposer.register(myProject, new Disposable() { - @Override - public void dispose() { - instance.removeExplicitExtension(language, object); - } - }); - } - - @Override - protected void registerExtensionPoint(final ExtensionPointName extensionPointName, Class aClass) { - super.registerExtensionPoint(extensionPointName, aClass); - Disposer.register(myProject, new Disposable() { - @Override - public void dispose() { - Extensions.getRootArea().unregisterExtensionPoint(extensionPointName.getName()); - } - }); - } - - protected void registerApplicationService(final Class aClass, T object) { - getApplication().registerService(aClass, object); - Disposer.register(myProject, new Disposable() { - @Override - public void dispose() { - getApplication().getPicoContainer().unregisterComponent(aClass.getName()); - } - }); - } - - public MockProjectEx getProject() { - return myProject; - } - - public MockPsiManager getPsiManager() { - return myPsiManager; - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - myFile = null; - myProject = null; - myPsiManager = null; - } - - protected String getTestDataPath() { - return PathManager.getHomePath(); - } - - @NotNull - public final String getTestName() { - return getTestName(myLowercaseFirstLetter); - } - - protected boolean includeRanges() { - return false; - } - - protected boolean skipSpaces() { - return false; - } - - protected boolean checkAllPsiRoots() { - return true; - } - - protected void doTest(boolean checkResult) { - String name = getTestName(); - try { - String text = loadFile(name + "." + myFileExt); - myFile = createPsiFile(name, text); - ensureParsed(myFile); - assertEquals("light virtual file text mismatch", text, ((LightVirtualFile)myFile.getVirtualFile()).getContent().toString()); - assertEquals("virtual file text mismatch", text, LoadTextUtil.loadText(myFile.getVirtualFile())); - assertEquals("doc text mismatch", text, myFile.getViewProvider().getDocument().getText()); - assertEquals("psi text mismatch", text, myFile.getText()); - ensureCorrectReparse(myFile); - if (checkResult){ - checkResult(name, myFile); - } - else{ - toParseTreeText(myFile, skipSpaces(), includeRanges()); - } - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - - protected void doTest(String suffix) throws IOException { - String name = getTestName(); - String text = loadFile(name + "." + myFileExt); - myFile = createPsiFile(name, text); - ensureParsed(myFile); - assertEquals(text, myFile.getText()); - checkResult(name + suffix, myFile); - } - - protected void doCodeTest(String code) throws IOException { - String name = getTestName(); - myFile = createPsiFile("a", code); - ensureParsed(myFile); - assertEquals(code, myFile.getText()); - checkResult(myFilePrefix + name, myFile); - } - - protected PsiFile createPsiFile(String name, String text) { - return createFile(name + "." + myFileExt, text); - } - - protected PsiFile createFile(@NonNls String name, String text) { - LightVirtualFile virtualFile = new LightVirtualFile(name, myLanguage, text); - virtualFile.setCharset(CharsetToolkit.UTF8_CHARSET); - return createFile(virtualFile); - } - - protected PsiFile createFile(LightVirtualFile virtualFile) { - return myFileFactory.trySetupPsiForFile(virtualFile, myLanguage, true, false); - } - - protected void checkResult(@NonNls @TestDataFile String targetDataName, final PsiFile file) throws IOException { - doCheckResult(myFullDataPath, file, checkAllPsiRoots(), targetDataName, skipSpaces(), includeRanges()); - } - - public static void doCheckResult(String testDataDir, - PsiFile file, - boolean checkAllPsiRoots, - String targetDataName, - boolean skipSpaces, - boolean printRanges) throws IOException { - FileViewProvider provider = file.getViewProvider(); - Set languages = provider.getLanguages(); - - if (!checkAllPsiRoots || languages.size() == 1) { - doCheckResult(testDataDir, targetDataName + ".txt", toParseTreeText(file, skipSpaces, printRanges).trim()); - return; - } - - for (Language language : languages) { - PsiFile root = provider.getPsi(language); - String expectedName = targetDataName + "." + language.getID() + ".txt"; - doCheckResult(testDataDir, expectedName, toParseTreeText(root, skipSpaces, printRanges).trim()); - } - } - - protected void checkResult(String actual) throws IOException { - String name = getTestName(); - doCheckResult(myFullDataPath, myFilePrefix + name + ".txt", actual); - } - - protected void checkResult(@TestDataFile @NonNls String targetDataName, String actual) throws IOException { - doCheckResult(myFullDataPath, targetDataName, actual); - } - - public static void doCheckResult(String fullPath, String targetDataName, String actual) throws IOException { - String expectedFileName = fullPath + File.separatorChar + targetDataName; - KtUsefulTestCase.assertSameLinesWithFile(expectedFileName, actual); - } - - protected static String toParseTreeText(PsiElement file, boolean skipSpaces, boolean printRanges) { - return DebugUtil.psiToString(file, skipSpaces, printRanges); - } - - protected String loadFile(@NonNls @TestDataFile String name) throws IOException { - return loadFileDefault(myFullDataPath, name); - } - - public static String loadFileDefault(String dir, String name) throws IOException { - return FileUtil.loadFile(new File(dir, name), CharsetToolkit.UTF8, true).trim(); - } - - public static void ensureParsed(PsiFile file) { - file.accept(new PsiElementVisitor() { - @Override - public void visitElement(PsiElement element) { - element.acceptChildren(this); - } - }); - } - - 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.performActualPsiChange(file); - - TestCase.assertEquals(psiToStringDefault, DebugUtil.psiToString(file, false, false)); - } -} \ No newline at end of file diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as31 b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as31 deleted file mode 100644 index 5a2b0960ff3..00000000000 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as31 +++ /dev/null @@ -1,1109 +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.generators.tests - -import org.jetbrains.kotlin.AbstractDataFlowValueRenderingTest -import org.jetbrains.kotlin.addImport.AbstractAddImportTest -import org.jetbrains.kotlin.allopen.AbstractBytecodeListingTestForAllOpen -import org.jetbrains.kotlin.android.* -import org.jetbrains.kotlin.android.annotator.AbstractAndroidGutterIconTest -import org.jetbrains.kotlin.android.configure.AbstractConfigureProjectTest -import org.jetbrains.kotlin.android.folding.AbstractAndroidResourceFoldingTest -import org.jetbrains.kotlin.android.intention.AbstractAndroidIntentionTest -import org.jetbrains.kotlin.android.intention.AbstractAndroidResourceIntentionTest -import org.jetbrains.kotlin.android.parcel.AbstractParcelBytecodeListingTest -import org.jetbrains.kotlin.android.quickfix.AbstractAndroidLintQuickfixTest -import org.jetbrains.kotlin.android.quickfix.AbstractAndroidQuickFixMultiFileTest -import org.jetbrains.kotlin.android.synthetic.test.AbstractAndroidBoxTest -import org.jetbrains.kotlin.android.synthetic.test.AbstractAndroidBytecodeShapeTest -import org.jetbrains.kotlin.android.synthetic.test.AbstractAndroidSyntheticPropertyDescriptorTest -import org.jetbrains.kotlin.checkers.AbstractJavaAgainstKotlinBinariesCheckerTest -import org.jetbrains.kotlin.checkers.AbstractJavaAgainstKotlinSourceCheckerTest -import org.jetbrains.kotlin.checkers.AbstractJsCheckerTest -import org.jetbrains.kotlin.checkers.AbstractPsiCheckerTest -import org.jetbrains.kotlin.findUsages.AbstractFindUsagesTest -import org.jetbrains.kotlin.findUsages.AbstractKotlinFindUsagesWithLibraryTest -import org.jetbrains.kotlin.formatter.AbstractFormatterTest -import org.jetbrains.kotlin.formatter.AbstractTypingIndentationTestBase -import org.jetbrains.kotlin.generators.tests.generator.TestGroup -import org.jetbrains.kotlin.generators.tests.generator.testGroup -import org.jetbrains.kotlin.generators.util.KT_OR_KTS -import org.jetbrains.kotlin.generators.util.KT_OR_KTS_WITHOUT_DOTS_IN_NAME -import org.jetbrains.kotlin.generators.util.KT_WITHOUT_DOTS_IN_NAME -import org.jetbrains.kotlin.idea.AbstractExpressionSelectionTest -import org.jetbrains.kotlin.idea.AbstractKotlinTypeAliasByExpansionShortNameIndexTest -import org.jetbrains.kotlin.idea.AbstractSmartSelectionTest -import org.jetbrains.kotlin.idea.actions.AbstractGotoTestOrCodeActionTest -import org.jetbrains.kotlin.idea.caches.resolve.AbstractIdeCompiledLightClassTest -import org.jetbrains.kotlin.idea.caches.resolve.AbstractIdeLightClassTest -import org.jetbrains.kotlin.idea.caches.resolve.AbstractMultiModuleLineMarkerTest -import org.jetbrains.kotlin.idea.caches.resolve.AbstractMultiPlatformHighlightingTest -import org.jetbrains.kotlin.idea.codeInsight.* -import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractCodeInsightActionTest -import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateHashCodeAndEqualsActionTest -import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateTestSupportMethodActionTest -import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateToStringActionTest -import org.jetbrains.kotlin.idea.codeInsight.moveUpDown.AbstractMoveLeftRightTest -import org.jetbrains.kotlin.idea.codeInsight.moveUpDown.AbstractMoveStatementTest -import org.jetbrains.kotlin.idea.codeInsight.postfix.AbstractPostfixTemplateProviderTest -import org.jetbrains.kotlin.idea.codeInsight.surroundWith.AbstractSurroundWithTest -import org.jetbrains.kotlin.idea.codeInsight.unwrap.AbstractUnwrapRemoveTest -import org.jetbrains.kotlin.idea.completion.test.* -import org.jetbrains.kotlin.idea.completion.test.handlers.AbstractBasicCompletionHandlerTest -import org.jetbrains.kotlin.idea.completion.test.handlers.AbstractCompletionCharFilterTest -import org.jetbrains.kotlin.idea.completion.test.handlers.AbstractKeywordCompletionHandlerTest -import org.jetbrains.kotlin.idea.completion.test.handlers.AbstractSmartCompletionHandlerTest -import org.jetbrains.kotlin.idea.completion.test.weighers.AbstractBasicCompletionWeigherTest -import org.jetbrains.kotlin.idea.completion.test.weighers.AbstractSmartCompletionWeigherTest -import org.jetbrains.kotlin.idea.configuration.AbstractGradleConfigureProjectByChangingFileTest -import org.jetbrains.kotlin.idea.conversion.copy.AbstractJavaToKotlinCopyPasteConversionTest -import org.jetbrains.kotlin.idea.conversion.copy.AbstractLiteralKotlinToKotlinCopyPasteTest -import org.jetbrains.kotlin.idea.conversion.copy.AbstractLiteralTextToKotlinCopyPasteTest -import org.jetbrains.kotlin.idea.conversion.copy.AbstractTextJavaToKotlinCopyPasteConversionTest -import org.jetbrains.kotlin.idea.coverage.AbstractKotlinCoverageOutputFilesTest -import org.jetbrains.kotlin.idea.debugger.AbstractBeforeExtractFunctionInsertionTest -import org.jetbrains.kotlin.idea.debugger.AbstractKotlinSteppingTest -import org.jetbrains.kotlin.idea.debugger.AbstractPositionManagerTest -import org.jetbrains.kotlin.idea.debugger.AbstractSmartStepIntoTest -import org.jetbrains.kotlin.idea.debugger.evaluate.* -import org.jetbrains.kotlin.idea.decompiler.navigation.AbstractNavigateToDecompiledLibraryTest -import org.jetbrains.kotlin.idea.decompiler.navigation.AbstractNavigateToLibrarySourceTest -import org.jetbrains.kotlin.idea.decompiler.navigation.AbstractNavigateToLibrarySourceTestWithJS -import org.jetbrains.kotlin.idea.decompiler.stubBuilder.AbstractClsStubBuilderTest -import org.jetbrains.kotlin.idea.decompiler.stubBuilder.AbstractLoadJavaClsStubTest -import org.jetbrains.kotlin.idea.decompiler.textBuilder.AbstractCommonDecompiledTextFromJsMetadataTest -import org.jetbrains.kotlin.idea.decompiler.textBuilder.AbstractCommonDecompiledTextTest -import org.jetbrains.kotlin.idea.decompiler.textBuilder.AbstractJsDecompiledTextFromJsMetadataTest -import org.jetbrains.kotlin.idea.decompiler.textBuilder.AbstractJvmDecompiledTextTest -import org.jetbrains.kotlin.idea.editor.AbstractMultiLineStringIndentTest -import org.jetbrains.kotlin.idea.editor.backspaceHandler.AbstractBackspaceHandlerTest -import org.jetbrains.kotlin.idea.editor.quickDoc.AbstractQuickDocProviderTest -import org.jetbrains.kotlin.idea.filters.AbstractKotlinExceptionFilterTest -import org.jetbrains.kotlin.idea.fir.AbstractFirMultiModuleResolveTest -import org.jetbrains.kotlin.idea.folding.AbstractKotlinFoldingTest -import org.jetbrains.kotlin.idea.hierarchy.AbstractHierarchyTest -import org.jetbrains.kotlin.idea.hierarchy.AbstractHierarchyWithLibTest -import org.jetbrains.kotlin.idea.highlighter.* -import org.jetbrains.kotlin.idea.imports.AbstractJsOptimizeImportsTest -import org.jetbrains.kotlin.idea.imports.AbstractJvmOptimizeImportsTest -import org.jetbrains.kotlin.idea.inspections.AbstractLocalInspectionTest -import org.jetbrains.kotlin.idea.inspections.AbstractMultiFileLocalInspectionTest -import org.jetbrains.kotlin.idea.intentions.AbstractConcatenatedStringGeneratorTest -import org.jetbrains.kotlin.idea.intentions.AbstractIntentionTest -import org.jetbrains.kotlin.idea.intentions.AbstractIntentionTest2 -import org.jetbrains.kotlin.idea.intentions.AbstractMultiFileIntentionTest -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.navigation.* -import org.jetbrains.kotlin.idea.parameterInfo.AbstractParameterInfoTest -import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixMultiFileTest -import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixMultiModuleTest -import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest -import org.jetbrains.kotlin.idea.refactoring.AbstractNameSuggestionProviderTest -import org.jetbrains.kotlin.idea.refactoring.copy.AbstractCopyTest -import org.jetbrains.kotlin.idea.refactoring.copy.AbstractMultiModuleCopyTest -import org.jetbrains.kotlin.idea.refactoring.inline.AbstractInlineTest -import org.jetbrains.kotlin.idea.refactoring.introduce.AbstractExtractionTest -import org.jetbrains.kotlin.idea.refactoring.move.AbstractMoveTest -import org.jetbrains.kotlin.idea.refactoring.move.AbstractMultiModuleMoveTest -import org.jetbrains.kotlin.idea.refactoring.pullUp.AbstractPullUpTest -import org.jetbrains.kotlin.idea.refactoring.pushDown.AbstractPushDownTest -import org.jetbrains.kotlin.idea.refactoring.rename.AbstractMultiModuleRenameTest -import org.jetbrains.kotlin.idea.refactoring.rename.AbstractRenameTest -import org.jetbrains.kotlin.idea.refactoring.safeDelete.AbstractMultiModuleSafeDeleteTest -import org.jetbrains.kotlin.idea.refactoring.safeDelete.AbstractSafeDeleteTest -import org.jetbrains.kotlin.idea.repl.AbstractIdeReplCompletionTest -import org.jetbrains.kotlin.idea.resolve.* -import org.jetbrains.kotlin.idea.scratch.AbstractScratchRunActionTest -import org.jetbrains.kotlin.idea.script.AbstractScriptConfigurationCompletionTest -import org.jetbrains.kotlin.idea.script.AbstractScriptConfigurationHighlightingTest -import org.jetbrains.kotlin.idea.script.AbstractScriptConfigurationNavigationTest -import org.jetbrains.kotlin.idea.script.AbstractScriptDefinitionsOrderTest -import org.jetbrains.kotlin.idea.slicer.AbstractSlicerLeafGroupingTest -import org.jetbrains.kotlin.idea.slicer.AbstractSlicerNullnessGroupingTest -import org.jetbrains.kotlin.idea.slicer.AbstractSlicerTreeTest -import org.jetbrains.kotlin.idea.structureView.AbstractKotlinFileStructureTest -import org.jetbrains.kotlin.idea.stubs.AbstractMultiFileHighlightingTest -import org.jetbrains.kotlin.idea.stubs.AbstractResolveByStubTest -import org.jetbrains.kotlin.idea.stubs.AbstractStubBuilderTest -import org.jetbrains.kotlin.incremental.* -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.incremental.AbstractJsProtoComparisonTest -//import org.jetbrains.kotlin.jps.incremental.AbstractJvmProtoComparisonTest -import org.jetbrains.kotlin.kapt.cli.test.AbstractArgumentParsingTest -import org.jetbrains.kotlin.kapt.cli.test.AbstractKaptToolIntegrationTest -import org.jetbrains.kotlin.kapt3.test.AbstractClassFileToSourceStubConverterTest -import org.jetbrains.kotlin.kapt3.test.AbstractKotlinKaptContextTest -import org.jetbrains.kotlin.noarg.AbstractBlackBoxCodegenTestForNoArg -import org.jetbrains.kotlin.noarg.AbstractBytecodeListingTestForNoArg -import org.jetbrains.kotlin.psi.patternMatching.AbstractPsiUnifierTest -import org.jetbrains.kotlin.samWithReceiver.AbstractSamWithReceiverScriptTest -import org.jetbrains.kotlin.samWithReceiver.AbstractSamWithReceiverTest -import org.jetbrains.kotlin.search.AbstractAnnotatedMembersSearchTest -import org.jetbrains.kotlin.search.AbstractInheritorsSearchTest -import org.jetbrains.kotlin.shortenRefs.AbstractShortenRefsTest -import org.jetbrains.kotlin.test.TargetBackend - -fun main(args: Array) { - System.setProperty("java.awt.headless", "true") - - testGroup("idea/tests", "idea/testData") { - testClass { - model("resolve/additionalLazyResolve") - } - - testClass { - model("resolve/partialBodyResolve") - } - - testClass { - model("checker", recursive = false) - model("checker/regression") - model("checker/recovery") - model("checker/rendering") - model("checker/scripts", extension = "kts") - model("checker/duplicateJvmSignature") - model("checker/infos", testMethod = "doTestWithInfos") - model("checker/diagnosticsMessage") - } - - testClass { - model("kotlinAndJavaChecker/javaAgainstKotlin") - model("kotlinAndJavaChecker/javaWithKotlin") - } - - testClass { - model("kotlinAndJavaChecker/javaAgainstKotlin") - } - - testClass { - model("unifier") - } - - testClass { - model("checker/codeFragments", extension = "kt", recursive = false) - model("checker/codeFragments/imports", testMethod = "doTestWithImport", extension = "kt") - } - - testClass { - model("quickfix.special/codeFragmentAutoImport", extension = "kt", recursive = false) - } - - testClass { - model("checker/js") - } - - testClass { - model("quickfix", pattern = "^([\\w\\-_]+)\\.kt$", filenameStartsLowerCase = true) - } - - testClass { - model("navigation/gotoSuper", extension = "test", recursive = false) - } - - testClass { - model("navigation/gotoTypeDeclaration", extension = "test") - } - - testClass { - model("navigation/gotoDeclaration", extension = "test") - } - - testClass { - model( - "parameterInfo", - pattern = "^([\\w\\-_]+)\\.kt$", recursive = true, - excludeDirs = listOf("withLib1/sharedLib", "withLib2/sharedLib", "withLib3/sharedLib") - ) - } - - testClass { - model("navigation/gotoClass", testMethod = "doClassTest") - model("navigation/gotoSymbol", testMethod = "doSymbolTest") - } - - testClass { - model("decompiler/navigation/usercode") - } - - testClass { - model("decompiler/navigation/usercode", testClassName ="UsercodeWithJSModule") - } - - testClass { - model("decompiler/navigation/usercode") - } - - testClass { - model("navigation/implementations", recursive = false) - } - - testClass { - model("navigation/gotoTestOrCode", pattern = "^(.+)\\.main\\..+\$") - } - - testClass { - model("search/inheritance") - } - - testClass { - model("search/annotations") - } - - testClass { - model("quickfix", pattern = """^(\w+)\.((before\.Main\.\w+)|(test))$""", testMethod = "doTestWithExtraFile") - } - - testClass { - model("typealiasExpansionIndex") - } - - testClass { - model("highlighter") - } - - testClass { - model("dslHighlighter") - } - - testClass { - model("usageHighlighter") - } - - testClass { - model("folding/noCollapse") - model("folding/checkCollapse", testMethod = "doSettingsFoldingTest") - } - - testClass { - model("codeInsight/surroundWith/if", testMethod = "doTestWithIfSurrounder") - model("codeInsight/surroundWith/ifElse", testMethod = "doTestWithIfElseSurrounder") - model("codeInsight/surroundWith/ifElseExpression", testMethod = "doTestWithIfElseExpressionSurrounder") - model("codeInsight/surroundWith/ifElseExpressionBraces", testMethod = "doTestWithIfElseExpressionBracesSurrounder") - model("codeInsight/surroundWith/not", testMethod = "doTestWithNotSurrounder") - model("codeInsight/surroundWith/parentheses", testMethod = "doTestWithParenthesesSurrounder") - model("codeInsight/surroundWith/stringTemplate", testMethod = "doTestWithStringTemplateSurrounder") - model("codeInsight/surroundWith/when", testMethod = "doTestWithWhenSurrounder") - model("codeInsight/surroundWith/tryCatch", testMethod = "doTestWithTryCatchSurrounder") - model("codeInsight/surroundWith/tryCatchExpression", testMethod = "doTestWithTryCatchExpressionSurrounder") - model("codeInsight/surroundWith/tryCatchFinally", testMethod = "doTestWithTryCatchFinallySurrounder") - model("codeInsight/surroundWith/tryCatchFinallyExpression", testMethod = "doTestWithTryCatchFinallyExpressionSurrounder") - model("codeInsight/surroundWith/tryFinally", testMethod = "doTestWithTryFinallySurrounder") - model("codeInsight/surroundWith/functionLiteral", testMethod = "doTestWithFunctionLiteralSurrounder") - model("codeInsight/surroundWith/withIfExpression", testMethod = "doTestWithSurroundWithIfExpression") - model("codeInsight/surroundWith/withIfElseExpression", testMethod = "doTestWithSurroundWithIfElseExpression") - } - - testClass { - model("joinLines") - } - - testClass { - model("codeInsight/breadcrumbs") - } - - testClass { - model("intentions", pattern = "^([\\w\\-_]+)\\.(kt|kts)$") - } - - testClass { - model("intentions/loopToCallChain", pattern = "^([\\w\\-_]+)\\.kt$") - } - - testClass { - model("concatenatedStringGenerator", pattern = "^([\\w\\-_]+)\\.kt$") - } - - testClass { - model("intentions", pattern = "^(inspections\\.test)$", singleClass = true) - model("inspections", pattern = "^(inspections\\.test)$", singleClass = true) - model("inspectionsLocal", pattern = "^(inspections\\.test)$", singleClass = true) - } - - testClass { - model("inspectionsLocal", pattern = "^([\\w\\-_]+)\\.(kt|kts)$") - } - - testClass { - model("hierarchy/class/type", extension = null, recursive = false, testMethod = "doTypeClassHierarchyTest") - model("hierarchy/class/super", extension = null, recursive = false, testMethod = "doSuperClassHierarchyTest") - model("hierarchy/class/sub", extension = null, recursive = false, testMethod = "doSubClassHierarchyTest") - model("hierarchy/calls/callers", extension = null, recursive = false, testMethod = "doCallerHierarchyTest") - model("hierarchy/calls/callersJava", extension = null, recursive = false, testMethod = "doCallerJavaHierarchyTest") - model("hierarchy/calls/callees", extension = null, recursive = false, testMethod = "doCalleeHierarchyTest") - model("hierarchy/overrides", extension = null, recursive = false, testMethod = "doOverrideHierarchyTest") - } - - testClass { - model("hierarchy/withLib", extension = null, recursive = false) - } - - testClass { - model("codeInsight/moveUpDown/classBodyDeclarations", pattern = KT_OR_KTS, testMethod = "doTestClassBodyDeclaration") - model("codeInsight/moveUpDown/closingBraces", testMethod = "doTestExpression") - model("codeInsight/moveUpDown/expressions", pattern = KT_OR_KTS, testMethod = "doTestExpression") - model("codeInsight/moveUpDown/parametersAndArguments", testMethod = "doTestExpression") - } - - testClass { - model("codeInsight/moveLeftRight") - } - - testClass { - model("refactoring/inline", pattern = "^(\\w+)\\.kt$") - } - - testClass { - model("codeInsight/unwrapAndRemove/removeExpression", testMethod = "doTestExpressionRemover") - model("codeInsight/unwrapAndRemove/unwrapThen", testMethod = "doTestThenUnwrapper") - model("codeInsight/unwrapAndRemove/unwrapElse", testMethod = "doTestElseUnwrapper") - model("codeInsight/unwrapAndRemove/removeElse", testMethod = "doTestElseRemover") - model("codeInsight/unwrapAndRemove/unwrapLoop", testMethod = "doTestLoopUnwrapper") - model("codeInsight/unwrapAndRemove/unwrapTry", testMethod = "doTestTryUnwrapper") - model("codeInsight/unwrapAndRemove/unwrapCatch", testMethod = "doTestCatchUnwrapper") - model("codeInsight/unwrapAndRemove/removeCatch", testMethod = "doTestCatchRemover") - model("codeInsight/unwrapAndRemove/unwrapFinally", testMethod = "doTestFinallyUnwrapper") - model("codeInsight/unwrapAndRemove/removeFinally", testMethod = "doTestFinallyRemover") - model("codeInsight/unwrapAndRemove/unwrapLambda", testMethod = "doTestLambdaUnwrapper") - model("codeInsight/unwrapAndRemove/unwrapFunctionParameter", testMethod = "doTestFunctionParameterUnwrapper") - } - - testClass { - model("codeInsight/expressionType") - } - - testClass { - model("editor/backspaceHandler") - } - - testClass { - model("editor/enterHandler/multilineString") - } - - testClass { - model("editor/quickDoc", pattern = """^([^_]+)\.(kt|java)$""") - } - - testClass { - model("refactoring/safeDelete/deleteClass/kotlinClass", testMethod = "doClassTest") - model("refactoring/safeDelete/deleteClass/kotlinClassWithJava", testMethod = "doClassTestWithJava") - model("refactoring/safeDelete/deleteClass/javaClassWithKotlin", extension = "java", testMethod = "doJavaClassTest") - model("refactoring/safeDelete/deleteObject/kotlinObject", testMethod = "doObjectTest") - model("refactoring/safeDelete/deleteFunction/kotlinFunction", testMethod = "doFunctionTest") - model("refactoring/safeDelete/deleteFunction/kotlinFunctionWithJava", testMethod = "doFunctionTestWithJava") - model("refactoring/safeDelete/deleteFunction/javaFunctionWithKotlin", testMethod = "doJavaMethodTest") - model("refactoring/safeDelete/deleteProperty/kotlinProperty", testMethod = "doPropertyTest") - model("refactoring/safeDelete/deleteProperty/kotlinPropertyWithJava", testMethod = "doPropertyTestWithJava") - model("refactoring/safeDelete/deleteProperty/javaPropertyWithKotlin", testMethod = "doJavaPropertyTest") - model("refactoring/safeDelete/deleteTypeAlias/kotlinTypeAlias", testMethod = "doTypeAliasTest") - model("refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter", testMethod = "doTypeParameterTest") - model("refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava", testMethod = "doTypeParameterTestWithJava") - model("refactoring/safeDelete/deleteValueParameter/kotlinValueParameter", testMethod = "doValueParameterTest") - model("refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava", testMethod = "doValueParameterTestWithJava") - } - - testClass { - model("resolve/references", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("resolve/referenceInJava/binaryAndSource", extension = "java") - model("resolve/referenceInJava/sourceOnly", extension = "java") - } - - testClass { - model("resolve/referenceInJava/binaryAndSource", extension = "java") - } - - testClass { - model("resolve/referenceWithLib", recursive = false) - } - - testClass { - model("resolve/referenceInLib", recursive = false) - } - - testClass { - model("resolve/referenceToJavaWithWrongFileStructure", recursive = false) - } - - testClass { - model("findUsages/kotlin", pattern = """^(.+)\.0\.(kt|kts)$""") - model("findUsages/java", pattern = """^(.+)\.0\.java$""") - model("findUsages/propertyFiles", pattern = """^(.+)\.0\.properties$""") - } - - testClass { - model("findUsages/libraryUsages", pattern = """^(.+)\.0\.kt$""") - } - - testClass { - model("refactoring/move", extension = "test", singleClass = true) - } - - testClass { - model("refactoring/copy", extension = "test", singleClass = true) - } - - testClass { - model("refactoring/moveMultiModule", extension = "test", singleClass = true) - } - - testClass { - model("refactoring/copyMultiModule", extension = "test", singleClass = true) - } - - testClass { - model("refactoring/safeDeleteMultiModule", extension = "test", singleClass = true) - } - - testClass { - model("multiFileIntentions", extension = "test", singleClass = true, filenameStartsLowerCase = true) - } - - testClass { - model("multiFileLocalInspections", extension = "test", singleClass = true, filenameStartsLowerCase = true) - } - - testClass { - model("multiFileInspections", extension = "test", singleClass = true) - } - - testClass { - model("formatter", pattern = """^([^\.]+)\.after\.kt.*$""") - model("formatter", pattern = """^([^\.]+)\.after\.inv\.kt.*$""", - testMethod = "doTestInverted", testClassName = "FormatterInverted") - } - - testClass { - model("indentationOnNewline", pattern = """^([^\.]+)\.after\.kt.*$""", testMethod = "doNewlineTest", - testClassName = "DirectSettings") - model("indentationOnNewline", pattern = """^([^\.]+)\.after\.inv\.kt.*$""", testMethod = "doNewlineTestWithInvert", - testClassName = "InvertedSettings") - } - - testClass { - model("diagnosticMessage", recursive = false) - } - - testClass { - model("diagnosticMessage/js", recursive = false, targetBackend = TargetBackend.JS) - } - - testClass { - model("refactoring/rename", extension = "test", singleClass = true) - } - - testClass { - model("refactoring/renameMultiModule", extension = "test", singleClass = true) - } - - testClass { - model("codeInsight/outOfBlock") - } - - testClass { - model("dataFlowValueRendering") - } - - testClass { - model("copyPaste/conversion", pattern = """^([^\.]+)\.java$""") - } - - testClass { - model("copyPaste/plainTextConversion", pattern = """^([^\.]+)\.txt$""") - } - - testClass { - model("copyPaste/plainTextLiteral", pattern = """^([^\.]+)\.txt$""") - } - - testClass { - model("copyPaste/literal", pattern = """^([^\.]+)\.kt$""") - } - - testClass { - model("copyPaste/imports", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doTestCopy", testClassName = "Copy", recursive = false) - model("copyPaste/imports", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doTestCut", testClassName = "Cut", recursive = false) - } - - testClass { - model("copyPaste/moveDeclarations", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doTest") - } - - testClass { - model("exitPoints") - } - - testClass { - model("codeInsight/lineMarker") - } - - testClass { - model("codeInsightInLibrary/lineMarker", testMethod = "doTestWithLibrary") - } - - testClass { - model("multiModuleLineMarker", extension = null, recursive = false) - } - - testClass { - model("shortenRefs", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - testClass { - model("addImport", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("smartSelection", testMethod = "doTestSmartSelection", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("structureView/fileStructure", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("expressionSelection", testMethod = "doTestExpressionSelection", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("decompiler/decompiledText", pattern = """^([^\.]+)$""") - } - - testClass { - model("decompiler/decompiledTextJvm", pattern = """^([^\.]+)$""") - } - - testClass { - model("decompiler/decompiledText", pattern = """^([^\.]+)$""", targetBackend = TargetBackend.JS) - } - - testClass { - model("decompiler/decompiledTextJs", pattern = """^([^\.]+)$""", targetBackend = TargetBackend.JS) - } - - testClass { - model("decompiler/stubBuilder", extension = null, recursive = false) - } - - testClass { - model("editor/optimizeImports/jvm", pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME) - model("editor/optimizeImports/common", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - testClass { - model("editor/optimizeImports/js", pattern = KT_WITHOUT_DOTS_IN_NAME) - model("editor/optimizeImports/common", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("debugger/positionManager", recursive = false, extension = "kt", testClassName = "SingleFile") - model("debugger/positionManager", recursive = false, extension = null, testClassName = "MultiFile") - } - - testClass { - model("debugger/exceptionFilter", pattern = """^([^\.]+)$""", recursive = false) - } - - testClass { - model("debugger/smartStepInto") - } - - testClass { - model("debugger/insertBeforeExtractFunction", extension = "kt") - } - - testClass { - model("debugger/tinyApp/src/stepping/stepIntoAndSmartStepInto", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepIntoTest", testClassName = "StepInto") - model("debugger/tinyApp/src/stepping/stepIntoAndSmartStepInto", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doSmartStepIntoTest", testClassName = "SmartStepInto") - model("debugger/tinyApp/src/stepping/stepInto", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepIntoTest", testClassName = "StepIntoOnly") - model("debugger/tinyApp/src/stepping/stepOut", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepOutTest") - model("debugger/tinyApp/src/stepping/stepOver", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepOverTest") - model("debugger/tinyApp/src/stepping/stepOverForce", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepOverForceTest") - model("debugger/tinyApp/src/stepping/filters", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepIntoTest") - model("debugger/tinyApp/src/stepping/custom", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doCustomTest") - } - - testClass { - model("debugger/tinyApp/src/evaluate/singleBreakpoint", testMethod = "doSingleBreakpointTest") - model("debugger/tinyApp/src/evaluate/multipleBreakpoints", testMethod = "doMultipleBreakpointsTest") - } - - testClass { - model("stubs", extension = "kt") - } - - testClass { - model("multiFileHighlighting", recursive = false) - } - - testClass { - model("multiModuleHighlighting/multiplatform/", recursive = false, extension = null) - } - - testClass { - model("multiModuleQuickFix", recursive = false, extension = null) - } - - testClass { - model("navigation/implementations/multiModule", recursive = false, extension = null) - } - - testClass { - model("navigation/relatedSymbols/multiModule", recursive = false, extension = null) - } - - testClass { - model("navigation/gotoSuper/multiModule", recursive = false, extension = null) - } - - testClass { - model("refactoring/introduceVariable", pattern = KT_OR_KTS, testMethod = "doIntroduceVariableTest") - model("refactoring/extractFunction", pattern = KT_OR_KTS, testMethod = "doExtractFunctionTest") - model("refactoring/introduceProperty", pattern = KT_OR_KTS, testMethod = "doIntroducePropertyTest") - model("refactoring/introduceParameter", pattern = KT_OR_KTS, testMethod = "doIntroduceSimpleParameterTest") - model("refactoring/introduceLambdaParameter", pattern = KT_OR_KTS, testMethod = "doIntroduceLambdaParameterTest") - model("refactoring/introduceJavaParameter", extension = "java", testMethod = "doIntroduceJavaParameterTest") - model("refactoring/introduceTypeParameter", pattern = KT_OR_KTS, testMethod = "doIntroduceTypeParameterTest") - model("refactoring/introduceTypeAlias", pattern = KT_OR_KTS, testMethod = "doIntroduceTypeAliasTest") - model("refactoring/extractSuperclass", pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME, testMethod = "doExtractSuperclassTest") - model("refactoring/extractInterface", pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME, testMethod = "doExtractInterfaceTest") - } - - testClass { - model("refactoring/pullUp/k2k", extension = "kt", singleClass = true, testClassName = "K2K", testMethod = "doKotlinTest") - model("refactoring/pullUp/k2j", extension = "kt", singleClass = true, testClassName = "K2J", testMethod = "doKotlinTest") - model("refactoring/pullUp/j2k", extension = "java", singleClass = true, testClassName = "J2K", testMethod = "doJavaTest") - } - - testClass { - 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 { - model("debugger/selectExpression", recursive = false) - model("debugger/selectExpression/disallowMethodCalls", testMethod = "doTestWoMethodCalls") - } - - testClass { - model("coverage/outputFiles") - } - - testClass { - model("internal/toolWindow", recursive = false, extension = null) - } - - testClass("org.jetbrains.kotlin.idea.kdoc.KdocResolveTestGenerated") { - model("kdoc/resolve") - } - - testClass { - model("kdoc/highlighting") - } - - testClass { - model("kdoc/typing") - } - - testClass { - model("codeInsight/generate/testFrameworkSupport") - } - - testClass { - model("codeInsight/generate/equalsWithHashCode") - } - - testClass { - model("codeInsight/generate/secondaryConstructors") - } - - testClass { - model("codeInsight/generate/toString") - } - - testClass { - model("repl/completion") - } - - testClass { - model("codeInsight/postfix") - } - - testClass { - model("script/definition/highlighting", extension = null, recursive = false) - model("script/definition/complex", extension = null, recursive = false, testMethod = "doComplexTest") - } - - testClass { - model("script/definition/navigation", extension = null, recursive = false) - } - - testClass { - model("script/definition/completion", extension = null, recursive = false) - } - - testClass { - model("script/definition/order", extension = null, recursive = false) - } - - testClass { - model("refactoring/nameSuggestionProvider") - } - - testClass { - model("slicer", singleClass = true) - } - - testClass { - model("slicer/inflow", singleClass = true) - } - - testClass { - model("slicer/inflow", singleClass = true) - } - - testClass { - model("scratch", extension = "kts", testMethod = "doCompilingTest", testClassName = "Compiling", recursive = false) - model("scratch", extension = "kts", testMethod = "doReplTest", testClassName = "Repl", recursive = false) - model("scratch/multiFile", extension = null, testMethod = "doMultiFileTest", recursive = false) - } - - testClass { - model("fir/multiModule", recursive = false, extension = null) - } - } - - /* - // Maven and Gradle are not relevant for AS branch - - testGroup("idea/idea-maven/test", "idea/idea-maven/testData") { - testClass { - model("configurator/jvm", extension = null, recursive = false, testMethod = "doTestWithMaven") - model("configurator/js", extension = null, recursive = false, testMethod = "doTestWithJSMaven") - } - - testClass { - model("maven-inspections", pattern = "^([\\w\\-]+).xml$", singleClass = true) - } - } - - testGroup("idea/idea-gradle/tests", "idea/testData") { - testClass { - model("configuration/gradle", extension = null, recursive = false, testMethod = "doTestGradle") - model("configuration/gsk", extension = null, recursive = false, testMethod = "doTestGradle") - } - } - - */ - - testGroup("idea/tests", "compiler/testData") { - testClass { - model("loadJava/compiledKotlin") - } - - testClass { - model("loadJava/compiledKotlin", testMethod = "doTestCompiledKotlin") - } - - testClass { - model("asJava/lightClasses", excludeDirs = listOf("delegation"), pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("asJava/lightClasses", excludeDirs = listOf("local", "compilationErrors", "ideRegression"), pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME) - } - } - - testGroup("idea/idea-completion/tests", "idea/idea-completion/testData") { - testClass { - model("injava", extension = "java", recursive = false) - } - - testClass { - model("injava", extension = "java", recursive = false) - } - - testClass { - model("injava/stdlib", extension = "java", recursive = false) - } - - testClass { - model("weighers/basic", pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("weighers/smart", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("basic/common") - model("basic/js") - } - - testClass { - model("basic/common") - model("basic/java") - } - - testClass { - model("smart") - } - - testClass { - model("keywords", recursive = false) - } - - testClass { - model("basic/withLib", recursive = false) - } - - testClass { - model("handlers/basic", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("handlers/smart") - } - - testClass { - model("handlers/keywords") - } - - testClass { - model("handlers/charFilter") - } - - testClass { - model("basic/multifile", extension = null, recursive = false) - } - - testClass { - model("smartMultiFile", extension = null, recursive = false) - } - - testClass("KDocCompletionTestGenerated") { - model("kdoc") - } - - testClass { - model("basic/java8") - } - - testClass { - model("incrementalResolve") - } - - testClass { - model("multiPlatform", recursive = false, extension = null) - } - } - - //TODO: move these tests into idea-completion module - testGroup("idea/tests", "idea/idea-completion/testData") { - testClass { - model("handlers/runtimeCast") - } - - testClass { - model("basic/codeFragments", extension = "kt") - } - } - - testGroup("j2k/tests", "j2k/testData") { - testClass { - model("fileOrElement", extension = "java") - } - } - testGroup("j2k/tests", "j2k/testData") { - testClass { - model("multiFile", extension = null, recursive = false) - } - } - testGroup("j2k/tests", "j2k/testData") { - testClass { - model("fileOrElement", extension = "java") - } - } -/* There is no jps in AS - .... -*/ - testGroup("compiler/incremental-compilation-impl/test", "jps-plugin/testData") { - testClass { - model("incremental/pureKotlin", extension = null, recursive = false) - model("incremental/classHierarchyAffected", extension = null, recursive = false) - model("incremental/inlineFunCallSite", extension = null, excludeParentDirs = true) - model("incremental/withJava", extension = null, excludeParentDirs = true) - model("incremental/incrementalJvmCompilerOnly", extension = null, excludeParentDirs = true) - } - - testClass { - model("incremental/pureKotlin", extension = null, recursive = false) - model("incremental/classHierarchyAffected", extension = null, recursive = false) - model("incremental/js", extension = null, excludeParentDirs = true) - } - - testClass { - model("incremental/js/friendsModuleDisabled", extension = null, recursive = false) - } - - testClass { - model("incremental/multiplatform", extension = null, excludeParentDirs = true) - } - testClass { - model("incremental/multiplatform", extension = null, excludeParentDirs = true) - } - } - - testGroup("plugins/android-extensions/android-extensions-compiler/test", "plugins/android-extensions/android-extensions-compiler/testData") { - testClass { - model("descriptors", recursive = false, extension = null) - } - - testClass { - model("codegen/android", recursive = false, extension = null, testMethod = "doCompileAgainstAndroidSdkTest") - model("codegen/android", recursive = false, extension = null, testMethod = "doFakeInvocationTest", testClassName = "Invoke") - } - - testClass { - model("codegen/bytecodeShape", recursive = false, extension = null) - } - - testClass { - model("parcel/codegen") - } - } - - testGroup("plugins/kapt3/kapt3-compiler/test", "plugins/kapt3/kapt3-compiler/testData") { - testClass { - model("converter") - } - - testClass { - model("kotlinRunner") - } - } - - testGroup("plugins/kapt3/kapt3-cli/test", "plugins/kapt3/kapt3-cli/testData") { - testClass { - model("argumentParsing", extension = "txt") - } - - testClass { - model("integration", recursive = false, extension = null) - } - } - - testGroup("plugins/allopen/allopen-cli/test", "plugins/allopen/allopen-cli/testData") { - testClass { - model("bytecodeListing", extension = "kt") - } - } - - testGroup("plugins/noarg/noarg-cli/test", "plugins/noarg/noarg-cli/testData") { - testClass { - model("bytecodeListing", extension = "kt") - } - - testClass { - model("box", targetBackend = TargetBackend.JVM) - } - } - - testGroup("plugins/sam-with-receiver/sam-with-receiver-cli/test", "plugins/sam-with-receiver/sam-with-receiver-cli/testData") { - testClass { - model("diagnostics") - } - testClass { - model("script", extension = "kts") - } - } - - testGroup("plugins/android-extensions/android-extensions-idea/tests", "plugins/android-extensions/android-extensions-idea/testData") { - testClass { - model("android/completion", recursive = false, extension = null) - } - - testClass { - model("android/goto", recursive = false, extension = null) - } - - testClass { - model("android/rename", recursive = false, extension = null) - } - - testClass { - model("android/renameLayout", recursive = false, extension = null) - } - - testClass { - model("android/findUsages", recursive = false, extension = null) - } - - testClass { - model("android/usageHighlighting", recursive = false, extension = null) - } - - testClass { - model("android/extraction", recursive = false, extension = null) - } - - testClass { - model("android/parcel/checker", excludeParentDirs = true) - } - - testClass { - model("android/parcel/quickfix", pattern = """^(\w+)\.((before\.Main\.\w+)|(test))$""", testMethod = "doTestWithExtraFile") - } - } - - testGroup("idea/idea-android/tests", "idea/testData") { - testClass { - model("configuration/android-gradle", pattern = """(\w+)_before\.gradle$""", testMethod = "doTestAndroidGradle") - model("configuration/android-gsk", pattern = """(\w+)_before\.gradle.kts$""", testMethod = "doTestAndroidGradle") - } - - testClass { - model("android/intention", pattern = "^([\\w\\-_]+)\\.kt$") - } - - testClass { - model("android/resourceIntention", extension = "test", singleClass = true) - } - - testClass { - model("android/quickfix", pattern = """^(\w+)\.((before\.Main\.\w+)|(test))$""", testMethod = "doTestWithExtraFile") - } - - testClass { - model("android/lintQuickfix", pattern = "^([\\w\\-_]+)\\.kt$") - } - - testClass { - model("android/folding") - } - - testClass { - model("android/gutterIcon") - } - } -} diff --git a/gradle.properties.as31 b/gradle.properties.as31 deleted file mode 100644 index a7534161eea..00000000000 --- a/gradle.properties.as31 +++ /dev/null @@ -1,13 +0,0 @@ -org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx1600m -Dfile.encoding=UTF-8 - -cacheRedirectorEnabled=true - -kotlin.compiler.effectSystemEnabled=true -kotlin.compiler.newInferenceEnabled=true -#maven.repository.mirror=http://repository.jetbrains.com/remote-repos/ -#bootstrap.kotlin.repo=https://dl.bintray.com/kotlin/kotlin-dev -#bootstrap.kotlin.version=1.1.50-dev-1451 -#signingRequired=true - -intellijUltimateEnabled=false -intellijEnforceCommunitySdk=true diff --git a/gradle/versions.properties.as31 b/gradle/versions.properties.as31 deleted file mode 100644 index 883812aa2f2..00000000000 --- a/gradle/versions.properties.as31 +++ /dev/null @@ -1,15 +0,0 @@ -versions.intellijSdk=173.3727.127 -versions.androidBuildTools=r23.0.1 -versions.idea.NodeJS=172.3757.32 -versions.androidStudioRelease=3.1.3.0 -versions.androidStudioBuild=173.4819257 -versions.jar.guava=21.0 -versions.jar.groovy-all=2.4.12 -versions.jar.swingx-core=1.6.2 -versions.jar.kxml2=2.3.0 -versions.jar.streamex=0.6.5 -versions.jar.gson=2.8.2 -versions.jar.snappy-in-java=0.5.1 -ignore.jar.common=true -ignore.jar.lombok-ast=true -versions.gradle-api=4.0 diff --git a/idea/idea-android/src/org/jetbrains/kotlin/android/ConvertJavaToKotlinProviderImpl.kt.as31 b/idea/idea-android/src/org/jetbrains/kotlin/android/ConvertJavaToKotlinProviderImpl.kt.as31 deleted file mode 100644 index d3549c18501..00000000000 --- a/idea/idea-android/src/org/jetbrains/kotlin/android/ConvertJavaToKotlinProviderImpl.kt.as31 +++ /dev/null @@ -1,43 +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.android - -import com.android.tools.idea.npw.template.ConvertJavaToKotlinProvider -import com.intellij.openapi.project.Project -import com.intellij.psi.PsiFile -import com.intellij.psi.PsiJavaFile -import org.jetbrains.kotlin.android.configure.KotlinAndroidGradleModuleConfigurator -import org.jetbrains.kotlin.idea.actions.JavaToKotlinAction -import org.jetbrains.kotlin.idea.configuration.KotlinProjectConfigurator -import org.jetbrains.kotlin.idea.configuration.getCanBeConfiguredModules -import org.jetbrains.kotlin.idea.versions.bundledRuntimeVersion - -class ConvertJavaToKotlinProviderImpl : ConvertJavaToKotlinProvider { - override fun configureKotlin(project: Project) { - val configurator = KotlinProjectConfigurator.EP_NAME.findExtension(KotlinAndroidGradleModuleConfigurator::class.java) - val nonConfiguredModules = getCanBeConfiguredModules(project, configurator) - configurator.configureSilently(project, nonConfiguredModules, bundledRuntimeVersion()) - } - - override fun getKotlinVersion(): String { - return bundledRuntimeVersion() - } - - override fun convertToKotlin(project: Project, files: List): List { - return JavaToKotlinAction.convertFiles(files, project, askExternalCodeProcessing = false) - } -} diff --git a/idea/idea-android/src/org/jetbrains/kotlin/android/KotlinAndroidLineMarkerProvider.kt.as31 b/idea/idea-android/src/org/jetbrains/kotlin/android/KotlinAndroidLineMarkerProvider.kt.as31 deleted file mode 100644 index 09d7d37e255..00000000000 --- a/idea/idea-android/src/org/jetbrains/kotlin/android/KotlinAndroidLineMarkerProvider.kt.as31 +++ /dev/null @@ -1,137 +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.android - -import com.android.SdkConstants -import com.android.resources.ResourceType -import com.intellij.codeHighlighting.Pass -import com.intellij.codeInsight.daemon.GutterIconNavigationHandler -import com.intellij.codeInsight.daemon.LineMarkerInfo -import com.intellij.codeInsight.daemon.LineMarkerProvider -import com.intellij.codeInsight.navigation.NavigationUtil -import com.intellij.icons.AllIcons -import com.intellij.ide.highlighter.XmlFileType -import com.intellij.navigation.GotoRelatedItem -import com.intellij.openapi.editor.markup.GutterIconRenderer -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiFile -import com.intellij.psi.xml.XmlAttributeValue -import com.intellij.ui.awt.RelativePoint -import com.intellij.util.Function -import org.jetbrains.android.dom.manifest.Manifest -import org.jetbrains.android.facet.AndroidFacet -import org.jetbrains.android.resourceManagers.ModuleResourceManagers -import org.jetbrains.kotlin.descriptors.ClassDescriptor -import org.jetbrains.kotlin.idea.caches.resolve.unsafeResolveToDescriptor -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode -import java.awt.event.MouseEvent -import javax.swing.Icon - - -class KotlinAndroidLineMarkerProvider : LineMarkerProvider { - override fun getLineMarkerInfo(element: PsiElement): LineMarkerInfo<*>? = null - - override fun collectSlowLineMarkers(elements: List, result: MutableCollection>) { - elements.forEach { - (it as? KtClass)?.getLineMarkerInfo()?.let { marker -> result.add(marker) } - } - } - - private fun KtClass.getLineMarkerInfo(): LineMarkerInfo? { - val nameIdentifier = nameIdentifier ?: return null - val androidFacet = AndroidFacet.getInstance(this) ?: return null - val manifest = androidFacet.manifest ?: return null - val manifestItems = collectGoToRelatedManifestItems(manifest) - if (manifestItems.isEmpty() && !isClassWithLayoutXml()) { - return null - } - - return LineMarkerInfo( - nameIdentifier, - nameIdentifier.textRange, - AllIcons.FileTypes.Xml, - Pass.LINE_MARKERS, - Function { "Related XML file" }, - GutterIconNavigationHandler { e: MouseEvent, _: PsiElement -> - NavigationUtil - .getRelatedItemsPopup( - manifestItems + collectGoToRelatedLayoutItems(androidFacet), - "Go to Related Files") - .show(RelativePoint(e)) - }, - GutterIconRenderer.Alignment.RIGHT) - } - - private fun KtClass.collectGoToRelatedLayoutItems(androidFacet: AndroidFacet): List { - val resources = mutableSetOf() - accept(object: KtVisitorVoid() { - override fun visitKtElement(element: KtElement) { - element.acceptChildren(this) - } - - override fun visitReferenceExpression(expression: KtReferenceExpression) { - super.visitReferenceExpression(expression) - - val resClassName = ResourceType.LAYOUT.getName() - val info = (expression as? KtSimpleNameExpression)?.let { - getReferredResourceOrManifestField(androidFacet, it, resClassName, true) - } - - if (info == null || info.isFromManifest) { - return - } - - val files = ModuleResourceManagers - .getInstance(androidFacet) - .localResourceManager - .findResourcesByFieldName(resClassName, info.fieldName) - .filterIsInstance() - - resources.addAll(files) - } - }) - - return resources.map { GotoRelatedLayoutItem(it) } - } - - private fun KtClass.collectGoToRelatedManifestItems(manifest: Manifest): List = - findComponentDeclarationInManifest(manifest)?.xmlAttributeValue?.let { listOf(GotoManifestItem(it)) } ?: emptyList() - - private class GotoManifestItem(attributeValue: XmlAttributeValue) : GotoRelatedItem(attributeValue) { - override fun getCustomName(): String? = "AndroidManifest.xml" - override fun getCustomContainerName(): String? = "" - override fun getCustomIcon(): Icon? = XmlFileType.INSTANCE.icon - } - - private class GotoRelatedLayoutItem(private val file: PsiFile) : GotoRelatedItem(file, "Layout Files") { - override fun getCustomContainerName(): String? = "(${file.containingDirectory.name})" - } - - companion object { - private val CLASSES_WITH_LAYOUT_XML = arrayOf( - SdkConstants.CLASS_ACTIVITY, - SdkConstants.CLASS_FRAGMENT, - SdkConstants.CLASS_V4_FRAGMENT, - "android.widget.Adapter") - - private fun KtClass.isClassWithLayoutXml(): Boolean { - val type = (unsafeResolveToDescriptor(BodyResolveMode.PARTIAL) as? ClassDescriptor)?.defaultType ?: return false - return CLASSES_WITH_LAYOUT_XML.any { type.isSubclassOf(it, true) } - } - } -} \ No newline at end of file diff --git a/idea/idea-android/src/org/jetbrains/kotlin/android/ResourceReferenceAnnotatorUtil.java.as31 b/idea/idea-android/src/org/jetbrains/kotlin/android/ResourceReferenceAnnotatorUtil.java.as31 deleted file mode 100644 index 70ae2b417e2..00000000000 --- a/idea/idea-android/src/org/jetbrains/kotlin/android/ResourceReferenceAnnotatorUtil.java.as31 +++ /dev/null @@ -1,270 +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.android; - - -import com.android.ide.common.rendering.api.ResourceValue; -import com.android.ide.common.resources.ResourceItem; -import com.android.ide.common.resources.ResourceRepository; -import com.android.ide.common.resources.ResourceResolver; -import com.android.resources.ResourceType; -import com.android.tools.idea.configurations.Configuration; -import com.android.tools.idea.configurations.ConfigurationManager; -import com.android.tools.idea.res.AppResourceRepository; -import com.android.tools.idea.res.ResourceHelper; -import com.android.tools.idea.ui.resourcechooser.ColorPicker; -import com.android.utils.XmlUtils; -import com.google.common.base.Charsets; -import com.google.common.io.Files; -import com.intellij.openapi.actionSystem.AnAction; -import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.CommonDataKeys; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.editor.Editor; -import com.intellij.openapi.editor.markup.GutterIconRenderer; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiFile; -import com.intellij.psi.util.PsiTreeUtil; -import com.intellij.psi.xml.XmlAttribute; -import com.intellij.psi.xml.XmlAttributeValue; -import com.intellij.psi.xml.XmlTag; -import com.intellij.util.ui.ColorIcon; -import com.intellij.util.ui.EmptyIcon; -import com.intellij.util.ui.JBUI; -import org.jetbrains.android.facet.AndroidFacet; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import javax.swing.*; -import java.awt.*; -import java.io.File; - -import static com.android.SdkConstants.*; - -/** - * Contains copied privates from AndroidColorAnnotator, so we could use them for Kotlin AndroidResourceReferenceAnnotator - */ -public class ResourceReferenceAnnotatorUtil { - - private static final int ICON_SIZE = 8; - - @Nullable - public static File pickBitmapFromXml(@NotNull File file, @NotNull ResourceResolver resourceResolver, @NotNull Project project) { - try { - String xml = Files.toString(file, Charsets.UTF_8); - Document document = XmlUtils.parseDocumentSilently(xml, true); - if (document != null && document.getDocumentElement() != null) { - Element root = document.getDocumentElement(); - String tag = root.getTagName(); - Element target = null; - String attribute = null; - if ("vector".equals(tag)) { - // Vectors are handled in the icon cache - return file; - } - else if ("bitmap".equals(tag) || "nine-patch".equals(tag)) { - target = root; - attribute = ATTR_SRC; - } - else if ("selector".equals(tag) || - "level-list".equals(tag) || - "layer-list".equals(tag) || - "transition".equals(tag)) { - NodeList children = root.getChildNodes(); - for (int i = children.getLength() - 1; i >= 0; i--) { - Node item = children.item(i); - if (item.getNodeType() == Node.ELEMENT_NODE && TAG_ITEM.equals(item.getNodeName())) { - target = (Element)item; - if (target.hasAttributeNS(ANDROID_URI, ATTR_DRAWABLE)) { - attribute = ATTR_DRAWABLE; - break; - } - } - } - } - else if ("clip".equals(tag) || "inset".equals(tag) || "scale".equals(tag)) { - target = root; - attribute = ATTR_DRAWABLE; - } else { - // etc - no bitmap to be found - return null; - } - if (attribute != null && target.hasAttributeNS(ANDROID_URI, attribute)) { - String src = target.getAttributeNS(ANDROID_URI, attribute); - ResourceValue value = resourceResolver.findResValue(src, false); - if (value != null) { - return ResourceHelper.resolveDrawable(resourceResolver, value, project); - - } - } - } - } catch (Throwable ignore) { - // Not logging for now; afraid to risk unexpected crashes in upcoming preview. TODO: Re-enable. - //Logger.getInstance(AndroidColorAnnotator.class).warn(String.format("Could not read/render icon image %1$s", file), e); - } - - return null; - } - - /** Looks up the resource item of the given type and name for the given configuration, if any */ - @Nullable - public static ResourceValue findResourceValue(ResourceType type, - String name, - boolean isFramework, - Module module, - Configuration configuration) { - if (isFramework) { - ResourceRepository frameworkResources = configuration.getFrameworkResources(); - if (frameworkResources == null) { - return null; - } - if (!frameworkResources.hasResourceItem(type, name)) { - return null; - } - ResourceItem item = frameworkResources.getResourceItem(type, name); - return item.getResourceValue(type, configuration.getFullConfig(), false); - } else { - AppResourceRepository appResources = AppResourceRepository.getOrCreateInstance(module); - if (appResources == null) { - return null; - } - if (!appResources.hasResourceItem(type, name)) { - return null; - } - return appResources.getConfiguredValue(type, name, configuration.getFullConfig()); - } - } - - /** Picks a suitable configuration to use for resource resolution */ - @Nullable - public static Configuration pickConfiguration(AndroidFacet facet, Module module, PsiFile file) { - VirtualFile virtualFile = file.getVirtualFile(); - if(virtualFile == null) { - return null; - } else { - VirtualFile parent = virtualFile.getParent(); - if(parent == null) { - return null; - } else { - String parentName = parent.getName(); - VirtualFile layout; - if(!parentName.startsWith("layout")) { - layout = ResourceHelper.pickAnyLayoutFile(module, facet); - if(layout == null) { - return null; - } - } else { - layout = virtualFile; - } - - return ConfigurationManager.getOrCreateInstance(module).getConfiguration(layout); - } - } - } - - public static class ColorRenderer extends GutterIconRenderer { - private final PsiElement myElement; - private final Color myColor; - - ColorRenderer(@NotNull PsiElement element, @Nullable Color color) { - myElement = element; - myColor = color; - } - - @NotNull - @Override - public Icon getIcon() { - Color color = getCurrentColor(); - return JBUI.scale(color == null ? EmptyIcon.create(ICON_SIZE) : new ColorIcon(ICON_SIZE, color)); - } - - @Nullable - private Color getCurrentColor() { - if (myColor != null) { - return myColor; - } else if (myElement instanceof XmlTag) { - return ResourceHelper.parseColor(((XmlTag)myElement).getValue().getText()); - } else if (myElement instanceof XmlAttributeValue) { - return ResourceHelper.parseColor(((XmlAttributeValue)myElement).getValue()); - } else { - return null; - } - } - - @Override - public AnAction getClickAction() { - if (myColor != null) { // Cannot set colors that were derived - return null; - } - return new AnAction() { - @Override - public void actionPerformed(AnActionEvent e) { - final Editor editor = CommonDataKeys.EDITOR.getData(e.getDataContext()); - if (editor != null) { - // Need ARGB support in platform color chooser; see - // https://youtrack.jetbrains.com/issue/IDEA-123498 - //final Color color = - // ColorChooser.chooseColor(editor.getComponent(), AndroidBundle.message("android.choose.color"), getCurrentColor()); - final Color color = ColorPicker.showDialog(editor.getComponent(), "Choose Color", getCurrentColor(), true, null, false); - if (color != null) { - ApplicationManager.getApplication().runWriteAction(new Runnable() { - @Override - public void run() { - if (myElement instanceof XmlTag) { - ((XmlTag)myElement).getValue().setText(ResourceHelper.colorToString(color)); - } else if (myElement instanceof XmlAttributeValue) { - XmlAttribute attribute = PsiTreeUtil.getParentOfType(myElement, XmlAttribute.class); - if (attribute != null) { - attribute.setValue(ResourceHelper.colorToString(color)); - } - } - } - }); - } - } - } - }; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ColorRenderer that = (ColorRenderer)o; - // TODO: Compare with modification count in app resources (if not framework) - if (myColor != null ? !myColor.equals(that.myColor) : that.myColor != null) return false; - if (!myElement.equals(that.myElement)) return false; - - return true; - } - - @Override - public int hashCode() { - int result = myElement.hashCode(); - result = 31 * result + (myColor != null ? myColor.hashCode() : 0); - return result; - } - } -} diff --git a/idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinAndroidGradleLibraryDataService.kt.as31 b/idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinAndroidGradleLibraryDataService.kt.as31 deleted file mode 100644 index 4988b342bd8..00000000000 --- a/idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinAndroidGradleLibraryDataService.kt.as31 +++ /dev/null @@ -1,65 +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.android.configure - -import com.android.tools.idea.gradle.project.model.JavaModuleModel -import com.android.tools.idea.gradle.project.sync.idea.data.service.AndroidProjectKeys -import com.android.tools.idea.io.FilePaths -import com.intellij.openapi.externalSystem.model.DataNode -import com.intellij.openapi.externalSystem.model.project.ModuleData -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.project.Project -import com.intellij.openapi.roots.OrderRootType -import com.intellij.openapi.roots.impl.libraries.LibraryEx -import com.intellij.openapi.roots.libraries.Library -import org.jetbrains.kotlin.idea.configuration.detectPlatformKindByPlugin -import org.jetbrains.kotlin.idea.framework.detectLibraryKind -import org.jetbrains.kotlin.idea.platform.tooling -import java.io.File - -class KotlinAndroidGradleLibraryDataService : AbstractProjectDataService() { - override fun getTargetDataKey() = AndroidProjectKeys.JAVA_MODULE_MODEL - - override fun postProcess( - toImport: MutableCollection>, - projectData: ProjectData?, - project: Project, - modelsProvider: IdeModifiableModelsProvider - ) { - for (dataNode in toImport) { - @Suppress("UNCHECKED_CAST") - val targetLibraryKind = detectPlatformKindByPlugin(dataNode.parent as DataNode)?.tooling?.libraryKind - if (targetLibraryKind != null) { - for (dep in dataNode.data.jarLibraryDependencies) { - val library = modelsProvider.findLibraryByBinaryPath(dep.binaryPath) as LibraryEx? ?: continue - if (library.kind == null) { - val model = modelsProvider.getModifiableLibraryModel(library) as LibraryEx.ModifiableModelEx - detectLibraryKind(model.getFiles(OrderRootType.CLASSES))?.let { model.kind = it } - } - } - } - } - } - - private fun IdeModifiableModelsProvider.findLibraryByBinaryPath(path: File?): Library? { - if (path == null) return null - val url = FilePaths.pathToIdeaUrl(path) - return allLibraries.firstOrNull { url in getModifiableLibraryModel(it).getUrls(OrderRootType.CLASSES) } - } -} diff --git a/idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinAndroidGradleMPPModuleDataService.kt.as31 b/idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinAndroidGradleMPPModuleDataService.kt.as31 deleted file mode 100644 index d4ffc1a1185..00000000000 --- a/idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinAndroidGradleMPPModuleDataService.kt.as31 +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.android.configure - -import com.android.tools.idea.gradle.project.sync.idea.data.service.AndroidProjectKeys -import com.android.tools.idea.gradle.util.ContentEntries.findParentContentEntry -import com.android.tools.idea.io.FilePaths -import com.intellij.openapi.diagnostic.Logger -import com.intellij.openapi.externalSystem.ExternalSystemModulePropertyManager -import com.intellij.openapi.externalSystem.model.DataNode -import com.intellij.openapi.externalSystem.model.ProjectKeys -import com.intellij.openapi.externalSystem.model.project.ContentRootData -import com.intellij.openapi.externalSystem.model.project.ModuleData -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.service.project.manage.ContentRootDataService -import com.intellij.openapi.externalSystem.service.project.manage.ContentRootDataService.CREATE_EMPTY_DIRECTORIES -import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil -import com.intellij.openapi.module.Module -import com.intellij.openapi.project.Project -import com.intellij.openapi.roots.DependencyScope -import com.intellij.openapi.roots.ModifiableRootModel -import com.intellij.openapi.vfs.VfsUtil -import com.intellij.util.SmartList -import com.intellij.util.containers.stream -import org.jetbrains.jps.model.java.JavaResourceRootType -import org.jetbrains.jps.model.java.JavaSourceRootType -import org.jetbrains.jps.model.module.JpsModuleSourceRootType -import org.jetbrains.kotlin.gradle.KotlinCompilation -import org.jetbrains.kotlin.gradle.KotlinPlatform -import org.jetbrains.kotlin.gradle.KotlinSourceSet -import org.jetbrains.kotlin.idea.addModuleDependencyIfNeeded -import org.jetbrains.kotlin.idea.configuration.* -import org.jetbrains.kotlin.idea.facet.KotlinFacet -import org.jetbrains.kotlin.utils.addIfNotNull -import org.jetbrains.plugins.gradle.model.data.GradleSourceSetData -import java.io.File -import java.io.IOException - -class KotlinAndroidGradleMPPModuleDataService : AbstractProjectDataService() { - override fun getTargetDataKey() = ProjectKeys.MODULE - - private fun shouldCreateEmptySourceRoots( - moduleDataNode: DataNode, - module: Module - ): Boolean { - val projectDataNode = ExternalSystemApiUtil.findParent(moduleDataNode, ProjectKeys.PROJECT) ?: return false - if (projectDataNode.getUserData(CREATE_EMPTY_DIRECTORIES) == true) return true - - val projectSystemId = projectDataNode.data.owner - val externalSystemSettings = ExternalSystemApiUtil.getSettings(module.project, projectSystemId) - - val path = ExternalSystemModulePropertyManager.getInstance(module).getRootProjectPath() ?: return false - return externalSystemSettings.getLinkedProjectSettings(path)?.isCreateEmptyContentRootDirectories ?: false - } - - override fun postProcess( - toImport: MutableCollection>, - projectData: ProjectData?, - project: Project, - modelsProvider: IdeModifiableModelsProvider - ) { - val contentRootsToImport = ArrayList>() - - for (nodeToImport in toImport) { - val projectNode = ExternalSystemApiUtil.findParent(nodeToImport, ProjectKeys.PROJECT) ?: continue - - for (childNode in ExternalSystemApiUtil.getChildren(nodeToImport, GradleSourceSetData.KEY)) { - val sourceSet = childNode.kotlinSourceSet?.kotlinModule ?: continue - if (sourceSet.platform == KotlinPlatform.ANDROID) continue - contentRootsToImport += ExternalSystemApiUtil.getChildren(childNode, ProjectKeys.CONTENT_ROOT) - } - - val moduleData = nodeToImport.data - val module = modelsProvider.findIdeModule(moduleData) ?: continue - val shouldCreateEmptySourceRoots = shouldCreateEmptySourceRoots(nodeToImport, module) - val rootModel = modelsProvider.getModifiableRootModel(module) - val kotlinAndroidSourceSets = nodeToImport.kotlinAndroidSourceSets ?: emptyList() - for (sourceSetInfo in kotlinAndroidSourceSets) { - val compilation = sourceSetInfo.kotlinModule as? KotlinCompilation ?: continue - for (sourceSet in compilation.sourceSets) { - if (sourceSet.platform == KotlinPlatform.ANDROID) { - val sourceType = if (sourceSet.isTestModule) JavaSourceRootType.TEST_SOURCE else JavaSourceRootType.SOURCE - val resourceType = if (sourceSet.isTestModule) JavaResourceRootType.TEST_RESOURCE else JavaResourceRootType.RESOURCE - sourceSet.sourceDirs.forEach { addSourceRoot(it, sourceType, rootModel, shouldCreateEmptySourceRoots) } - sourceSet.resourceDirs.forEach { addSourceRoot(it, resourceType, rootModel, shouldCreateEmptySourceRoots) } - } - } - } - addExtraDependeeModules(nodeToImport, projectNode, modelsProvider, rootModel, false) - addExtraDependeeModules(nodeToImport, projectNode, modelsProvider, rootModel, true) - - if (nodeToImport.kotlinAndroidSourceSets == null) { - continue - } - - val androidModel = getAndroidModuleModel(nodeToImport) ?: continue - val variantName = androidModel.selectedVariant.name - val activeSourceSetInfos = nodeToImport.kotlinAndroidSourceSets?.filter { it.kotlinModule.name.startsWith(variantName) } ?: emptyList() - for (activeSourceSetInfo in activeSourceSetInfos) { - val activeCompilation = activeSourceSetInfo.kotlinModule as? KotlinCompilation ?: continue - for (sourceSet in activeCompilation.sourceSets) { - if (sourceSet.platform != KotlinPlatform.ANDROID) { - val sourceSetId = activeSourceSetInfo.sourceSetIdsByName[sourceSet.name] ?: continue - val sourceSetData = ExternalSystemApiUtil.findFirstRecursively(projectNode) { - (it.data as? ModuleData)?.id == sourceSetId - }?.data as? ModuleData ?: continue - val sourceSetModule = modelsProvider.findIdeModule(sourceSetData) ?: continue - addModuleDependencyIfNeeded(rootModel, sourceSetModule, activeSourceSetInfo.isTestModule) - } - } - } - - val mainSourceSetInfo = activeSourceSetInfos.firstOrNull { it.kotlinModule.name == variantName } - if (mainSourceSetInfo != null) { - KotlinSourceSetDataService.configureFacet(moduleData, mainSourceSetInfo, nodeToImport, module, modelsProvider) - } - - val kotlinFacet = KotlinFacet.get(module) - if (kotlinFacet != null) { - GradleProjectImportHandler.getInstances(project).forEach { it.importByModule(kotlinFacet, nodeToImport) } - } - } - - ContentRootDataService().importData(contentRootsToImport, projectData, project, modelsProvider) - } - - private fun getDependeeModuleNodes( - moduleNode: DataNode, - projectNode: DataNode, - modelsProvider: IdeModifiableModelsProvider, - testScope: Boolean - ): List> { - val androidModel = getAndroidModuleModel(moduleNode) - if (androidModel != null) { - val dependencies = if (testScope) { - androidModel.selectedAndroidTestCompileDependencies - } else { - androidModel.selectedMainCompileLevel2Dependencies - } ?: return emptyList() - return dependencies - .moduleDependencies - .mapNotNull { projectNode.findChildModuleById(it.projectPath) } - } - - val javaModel = getJavaModuleModel(moduleNode) - if (javaModel != null) { - val scope = if (testScope) DependencyScope.TEST.name else DependencyScope.COMPILE.name - val moduleNames = javaModel - .javaModuleDependencies - .filter { scope == it.scope ?: DependencyScope.COMPILE.name } - .mapTo(HashSet()) { it.moduleName } - return ExternalSystemApiUtil - .getChildren(projectNode, ProjectKeys.MODULE) - .filter { modelsProvider.findIdeModule(it.data)?.name in moduleNames } - } - - return emptyList() - } - - private fun List>.firstByPlatformOrNull(platform: KotlinPlatform) = firstOrNull { - it.kotlinSourceSet?.platform == platform - } - - private fun addExtraDependeeModules( - moduleNode: DataNode, - projectNode: DataNode, - modelsProvider: IdeModifiableModelsProvider, - rootModel: ModifiableRootModel, - testScope: Boolean - ) { - val dependeeModuleNodes = getDependeeModuleNodes(moduleNode, projectNode, modelsProvider, testScope) - val relevantNodes = dependeeModuleNodes - .flatMap { ExternalSystemApiUtil.getChildren(it, GradleSourceSetData.KEY) } - .filter { - val ktModule = it.kotlinSourceSet?.kotlinModule - ktModule != null && ktModule.isTestModule == testScope - } - val commonSourceSetName = KotlinSourceSet.commonName(testScope) - val isAndroidModule = getAndroidModuleModel(moduleNode) != null - SmartList>() - .apply { - addIfNotNull( - (if (isAndroidModule) relevantNodes.firstByPlatformOrNull(KotlinPlatform.ANDROID) else null) - ?: relevantNodes.firstByPlatformOrNull(KotlinPlatform.JVM) - ) - addIfNotNull( - relevantNodes.firstOrNull { - it.kotlinSourceSet?.platform == KotlinPlatform.COMMON && it.kotlinSourceSet?.kotlinModule?.name == commonSourceSetName - } - ) - } - .mapNotNull { modelsProvider.findIdeModule(it.data) } - .forEach { - addModuleDependencyIfNeeded(rootModel, it, testScope) - val dependeeRootModel = modelsProvider.getModifiableRootModel(it) - dependeeRootModel.getModuleDependencies(testScope).forEach { transitiveDependee -> - addModuleDependencyIfNeeded(rootModel, transitiveDependee, testScope) - } - } - } - - private fun getAndroidModuleModel(moduleNode: DataNode) = - ExternalSystemApiUtil.getChildren(moduleNode, AndroidProjectKeys.ANDROID_MODEL).firstOrNull()?.data - - private fun getJavaModuleModel(moduleNode: DataNode) = - ExternalSystemApiUtil.getChildren(moduleNode, AndroidProjectKeys.JAVA_MODULE_MODEL).firstOrNull()?.data - - private fun addSourceRoot( - sourceRoot: File, - type: JpsModuleSourceRootType<*>, - rootModel: ModifiableRootModel, - shouldCreateEmptySourceRoots: Boolean - ) { - val parent = findParentContentEntry(sourceRoot, rootModel.contentEntries.stream()) ?: return - val url = FilePaths.pathToIdeaUrl(sourceRoot) - parent.addSourceFolder(url, type) - if (shouldCreateEmptySourceRoots) { - ExternalSystemApiUtil.doWriteAction { - try { - VfsUtil.createDirectoryIfMissing(sourceRoot.path) - } catch (e: IOException) { - LOG.warn(String.format("Unable to create directory for the path: %s", sourceRoot.path), e) - } - } - } - } - - companion object { - private val LOG = Logger.getInstance(KotlinAndroidGradleMPPModuleDataService::class.java) - } -} \ No newline at end of file diff --git a/idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinAndroidMPPGradleProjectResolver.kt.as31 b/idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinAndroidMPPGradleProjectResolver.kt.as31 deleted file mode 100644 index 7d61ed79a9d..00000000000 --- a/idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinAndroidMPPGradleProjectResolver.kt.as31 +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.android.configure - -import com.android.builder.model.AndroidProject -import com.android.builder.model.NativeAndroidProject -import com.android.tools.idea.IdeInfo -import com.android.tools.idea.gradle.project.sync.idea.data.model.ImportedModule -import com.android.tools.idea.gradle.project.sync.idea.data.service.AndroidProjectKeys.IMPORTED_MODULE -import com.intellij.openapi.externalSystem.model.DataNode -import com.intellij.openapi.externalSystem.model.project.ModuleData -import com.intellij.openapi.externalSystem.model.project.ProjectData -import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil -import com.intellij.openapi.externalSystem.util.ExternalSystemConstants -import com.intellij.openapi.externalSystem.util.Order -import org.gradle.tooling.model.idea.IdeaModule -import org.jetbrains.kotlin.gradle.KotlinMPPGradleModel -import org.jetbrains.kotlin.gradle.KotlinMPPGradleModelBuilder -import org.jetbrains.kotlin.gradle.KotlinPlatform -import org.jetbrains.kotlin.idea.configuration.KotlinAndroidSourceSetData -import org.jetbrains.kotlin.idea.configuration.KotlinMPPGradleProjectResolver -import org.jetbrains.kotlin.idea.configuration.kotlinSourceSet -import org.jetbrains.plugins.gradle.model.data.GradleSourceSetData -import org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension - -@Order(ExternalSystemConstants.UNORDERED - 1) -class KotlinAndroidMPPGradleProjectResolver : AbstractProjectResolverExtension() { - private val isAndroidProject by lazy { - resolverCtx.hasModulesWithModel(AndroidProject::class.java) - || resolverCtx.hasModulesWithModel(NativeAndroidProject::class.java) - } - - override fun getToolingExtensionsClasses(): Set> { - return setOf(KotlinMPPGradleModelBuilder::class.java, Unit::class.java) - } - - override fun getExtraProjectModelClasses(): Set> { - return setOf(KotlinMPPGradleModel::class.java) - } - - override fun createModule(gradleModule: IdeaModule, projectDataNode: DataNode): DataNode { - return super.createModule(gradleModule, projectDataNode).also { - initializeModuleData(gradleModule, it, projectDataNode) - } - } - - override fun populateModuleContentRoots(gradleModule: IdeaModule, ideModule: DataNode) { - super.populateModuleContentRoots(gradleModule, ideModule) - if (IdeInfo.getInstance().isAndroidStudio || isAndroidProject) { - KotlinMPPGradleProjectResolver.populateContentRoots(gradleModule, ideModule, resolverCtx) - // Work around module disposal service which discards modules without accompanying ImportedModule instance - for (childNode in ExternalSystemApiUtil.getChildren(ideModule, GradleSourceSetData.KEY)) { - if (childNode.kotlinSourceSet == null) continue - val moduleName = childNode.data.internalName - val importedModule = ImportedModule(gradleModule) - importedModuleNameField.set(importedModule, moduleName) - ideModule.createChild(IMPORTED_MODULE, importedModule) - } - } - } - - override fun populateModuleDependencies(gradleModule: IdeaModule, ideModule: DataNode, ideProject: DataNode) { - super.populateModuleDependencies(gradleModule, ideModule, ideProject) - if (isAndroidProject) { - KotlinMPPGradleProjectResolver.populateModuleDependencies(gradleModule, ideProject, ideModule, resolverCtx) - } - } - - private fun initializeModuleData( - gradleModule: IdeaModule, - mainModuleData: DataNode, - projectDataNode: DataNode - ) { - if (!isAndroidProject) return - - KotlinMPPGradleProjectResolver.initializeModuleData(gradleModule, mainModuleData, projectDataNode, resolverCtx) - - val mppModel = resolverCtx.getExtraProject(gradleModule, KotlinMPPGradleModel::class.java) ?: return - - val androidSourceSets = mppModel - .targets - .asSequence() - .flatMap { it.compilations.asSequence() } - .filter { it.platform == KotlinPlatform.ANDROID } - .mapNotNull { KotlinMPPGradleProjectResolver.createSourceSetInfo(it, gradleModule, resolverCtx) } - .toList() - mainModuleData.createChild(KotlinAndroidSourceSetData.KEY, KotlinAndroidSourceSetData(androidSourceSets)) - } - - companion object { - val importedModuleNameField by lazy { - ImportedModule::class.java.getDeclaredField("myName").apply { isAccessible = true } - } - } -} \ No newline at end of file diff --git a/idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinAndroidModuleSetupStep.kt.as31 b/idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinAndroidModuleSetupStep.kt.as31 deleted file mode 100644 index b7b2f5caf11..00000000000 --- a/idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinAndroidModuleSetupStep.kt.as31 +++ /dev/null @@ -1,40 +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.android.configure - -import com.android.tools.idea.gradle.project.model.AndroidModuleModel -import com.android.tools.idea.gradle.project.sync.setup.post.ModuleSetupStep -import com.intellij.openapi.module.Module -import com.intellij.openapi.progress.ProgressIndicator -import org.jetbrains.android.facet.AndroidFacet -import org.jetbrains.kotlin.idea.configuration.compilerArgumentsBySourceSet -import org.jetbrains.kotlin.idea.configuration.configureFacetByCompilerArguments -import org.jetbrains.kotlin.idea.configuration.sourceSetName -import org.jetbrains.kotlin.idea.facet.KotlinFacet - -class KotlinAndroidModuleSetupStep : ModuleSetupStep() { - override fun setUpModule(module: Module, progressIndicator: ProgressIndicator?) { - val facet = AndroidFacet.getInstance(module) ?: return - val androidModel = AndroidModuleModel.get(facet) ?: return - val sourceSetName = androidModel.selectedVariant.name - if (module.sourceSetName == sourceSetName) return - val argsInfo = module.compilerArgumentsBySourceSet?.get(sourceSetName) ?: return - val kotlinFacet = KotlinFacet.get(module) ?: return - module.sourceSetName = sourceSetName - configureFacetByCompilerArguments(kotlinFacet, argsInfo, null) - } -} \ No newline at end of file diff --git a/idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinGradleAndroidModuleModelProjectDataService.kt.as31 b/idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinGradleAndroidModuleModelProjectDataService.kt.as31 deleted file mode 100644 index b060507a2eb..00000000000 --- a/idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinGradleAndroidModuleModelProjectDataService.kt.as31 +++ /dev/null @@ -1,54 +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.android.configure - -import com.android.tools.idea.gradle.project.model.AndroidModuleModel -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() { - companion object { - val KEY = Key(AndroidModuleModel::class.qualifiedName!!, 0) - } - - override fun getTargetDataKey() = KEY - - override fun postProcess( - toImport: MutableCollection>, - 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 sourceSetName = moduleModelNode.data.selectedVariant.name - val kotlinFacet = configureFacetByGradleModule(moduleNode, sourceSetName, ideModule, modelsProvider) ?: continue - GradleProjectImportHandler.getInstances(project).forEach { it.importByModule(kotlinFacet, moduleNode) } - } - } -} \ No newline at end of file diff --git a/idea/idea-android/src/org/jetbrains/kotlin/android/debugger/AndroidDexerImpl.kt.as31 b/idea/idea-android/src/org/jetbrains/kotlin/android/debugger/AndroidDexerImpl.kt.as31 deleted file mode 100644 index 40c99f83900..00000000000 --- a/idea/idea-android/src/org/jetbrains/kotlin/android/debugger/AndroidDexerImpl.kt.as31 +++ /dev/null @@ -1,73 +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.android.debugger - -import com.intellij.openapi.module.ModuleManager -import com.intellij.openapi.project.Project -import com.intellij.openapi.roots.ProjectRootModificationTracker -import com.intellij.psi.util.CachedValueProvider -import com.intellij.psi.util.CachedValuesManager -import org.jetbrains.android.facet.AndroidFacet -import org.jetbrains.android.sdk.AndroidSdkData -import org.jetbrains.kotlin.idea.debugger.evaluate.classLoading.AndroidDexer -import org.jetbrains.kotlin.idea.debugger.evaluate.classLoading.ClassToLoad -import java.io.File -import java.net.URLClassLoader -import java.security.ProtectionDomain - -class AndroidDexerImpl(val project: Project) : AndroidDexer { - private val cachedDexWrapper = CachedValuesManager.getManager(project).createCachedValue({ - val dexWrapper = doGetAndroidDexFile()?.let { dexJarFile -> - val androidDexWrapperName = AndroidDexWrapper::class.java.canonicalName - val classBytes = this.javaClass.classLoader.getResource( - androidDexWrapperName.replace('.', '/') + ".class").readBytes() - - val dexClassLoader = object : URLClassLoader(arrayOf(dexJarFile.toURI().toURL()), this::class.java.classLoader) { - init { - defineClass(androidDexWrapperName, classBytes, 0, classBytes.size, null as ProtectionDomain?) - } - } - - Class.forName(androidDexWrapperName, true, dexClassLoader).newInstance() - } - - CachedValueProvider.Result.createSingleDependency(dexWrapper, ProjectRootModificationTracker.getInstance(project)) - }, /* trackValue = */ false) - - override fun dex(classes: Collection): ByteArray? { - val dexWrapper = cachedDexWrapper.value - val dexMethod = dexWrapper::class.java.methods.firstOrNull { it.name == "dex" } ?: return null - return dexMethod.invoke(dexWrapper, classes) as? ByteArray ?: return null - } - - private fun doGetAndroidDexFile(): File? { - for (module in ModuleManager.getInstance(project).modules) { - val androidFacet = AndroidFacet.getInstance(module) ?: continue - val sdkData = AndroidSdkData.getSdkData(androidFacet) ?: continue - val latestBuildTool = sdkData.getLatestBuildTool(/* allowPreview = */ false) - ?: sdkData.getLatestBuildTool(/* allowPreview = */ true) - ?: continue - - val dxJar = File(latestBuildTool.location, "lib/dx.jar") - if (dxJar.exists()) { - return dxJar - } - } - - return null - } -} \ No newline at end of file diff --git a/idea/idea-android/src/org/jetbrains/kotlin/android/folding/ResourceFoldingBuilder.kt.as31 b/idea/idea-android/src/org/jetbrains/kotlin/android/folding/ResourceFoldingBuilder.kt.as31 deleted file mode 100644 index 30255ec65f7..00000000000 --- a/idea/idea-android/src/org/jetbrains/kotlin/android/folding/ResourceFoldingBuilder.kt.as31 +++ /dev/null @@ -1,258 +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.android.folding - -import com.android.SdkConstants.* -import com.android.ide.common.resources.configuration.FolderConfiguration -import com.android.ide.common.resources.configuration.LocaleQualifier -import com.android.resources.ResourceType -import com.android.tools.idea.folding.AndroidFoldingSettings -import com.android.tools.idea.res.AppResourceRepository -import com.android.tools.idea.res.LocalResourceRepository -import com.intellij.lang.ASTNode -import com.intellij.lang.folding.FoldingBuilderEx -import com.intellij.lang.folding.FoldingDescriptor -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.components.ServiceManager -import com.intellij.openapi.editor.Document -import com.intellij.openapi.module.ModuleUtilCore -import com.intellij.openapi.util.text.StringUtil -import com.intellij.psi.PsiClass -import com.intellij.psi.PsiElement -import com.intellij.psi.impl.source.SourceTreeToPsiMap -import org.jetbrains.android.facet.AndroidFacet -import org.jetbrains.kotlin.psi.KtFile -import org.jetbrains.uast.* -import org.jetbrains.uast.visitor.AbstractUastVisitor -import java.util.regex.Pattern - - -class ResourceFoldingBuilder : FoldingBuilderEx() { - - companion object { - // See lint's StringFormatDetector - private val FORMAT = Pattern.compile("%(\\d+\\$)?([-+#, 0(<]*)?(\\d+)?(\\.\\d+)?([tT])?([a-zA-Z%])") - private val FOLD_MAX_LENGTH = 60 - private val UNIT_TEST_MODE: Boolean = ApplicationManager.getApplication().isUnitTestMode - private val RESOURCE_TYPES = listOf(ResourceType.STRING, - ResourceType.DIMEN, - ResourceType.INTEGER, - ResourceType.PLURALS) - } - - private val isFoldingEnabled = AndroidFoldingSettings.getInstance().isCollapseAndroidStrings - - override fun getPlaceholderText(node: ASTNode): String? { - - tailrec fun UElement.unwrapReferenceAndGetValue(resources: LocalResourceRepository): String? = when (this) { - is UQualifiedReferenceExpression -> selector.unwrapReferenceAndGetValue(resources) - is UCallExpression -> (valueArguments.firstOrNull() as? UReferenceExpression)?.getAndroidResourceValue(resources, this) - else -> (this as? UReferenceExpression)?.getAndroidResourceValue(resources) - } - - val element = SourceTreeToPsiMap.treeElementToPsi(node) ?: return null - val appResources = getAppResources(element) ?: return null - val uastContext = ServiceManager.getService(element.project, UastContext::class.java) ?: return null - return uastContext.convertElement(element, null, null)?.unwrapReferenceAndGetValue(appResources) - } - - override fun buildFoldRegions(root: PsiElement, document: Document, quick: Boolean): Array { - if (root !is KtFile || quick && !UNIT_TEST_MODE || !isFoldingEnabled || AndroidFacet.getInstance(root) == null) { - return emptyArray() - } - - val file = root.toUElement() - val result = arrayListOf() - file?.accept(object : AbstractUastVisitor() { - override fun visitSimpleNameReferenceExpression(node: USimpleNameReferenceExpression): Boolean { - node.getFoldingDescriptor()?.let { result.add(it) } - return super.visitSimpleNameReferenceExpression(node) - } - }) - - return result.toTypedArray() - } - - override fun isCollapsedByDefault(node: ASTNode): Boolean = isFoldingEnabled - - private fun UReferenceExpression.getFoldingDescriptor(): FoldingDescriptor? { - val resolved = resolve() ?: return null - val resourceType = resolved.getAndroidResourceType() ?: return null - if (resourceType !in RESOURCE_TYPES) return null - - fun UElement.createFoldingDescriptor() = psi?.let { psi -> - val dependencies: Set = setOf(psi) - FoldingDescriptor(psi.node, psi.textRange, null, dependencies) - } - - val element = uastParent as? UQualifiedReferenceExpression ?: this - val getResourceValueCall = (element.uastParent as? UCallExpression)?.takeIf { it.isFoldableGetResourceValueCall() } - if (getResourceValueCall != null) { - val qualifiedCall = getResourceValueCall.uastParent as? UQualifiedReferenceExpression - if (qualifiedCall?.selector == getResourceValueCall) { - return qualifiedCall.createFoldingDescriptor() - } - - return getResourceValueCall.createFoldingDescriptor() - } - - return element.createFoldingDescriptor() - } - - private fun UCallExpression.isFoldableGetResourceValueCall(): Boolean { - return methodName == "getString" || - methodName == "getText" || - methodName == "getInteger" || - methodName?.startsWith("getDimension") ?: false || - methodName?.startsWith("getQuantityString") ?: false - } - - private fun PsiElement.getAndroidResourceType(): ResourceType? { - val elementType = parent as? PsiClass ?: return null - val elementPackage = elementType.parent as? PsiClass ?: return null - if (R_CLASS != elementPackage.name) return null - if (elementPackage.qualifiedName != "$ANDROID_PKG.$R_CLASS") { - return ResourceType.getEnum(elementType.name) - } - - return null - } - - private fun UReferenceExpression.getAndroidResourceValue(resources: LocalResourceRepository, call: UCallExpression? = null): String? { - val resourceType = resolve()?.getAndroidResourceType() ?: return null - val referenceConfig = FolderConfiguration().apply { localeQualifier = LocaleQualifier("xx") } - val key = resolvedName ?: return null - val resourceValue = resources.getResourceValue(resourceType, key, referenceConfig) ?: return null - val text = if (call != null) formatArguments(call, resourceValue) else resourceValue - - if (resourceType == ResourceType.STRING || resourceType == ResourceType.PLURALS) { - return '"' + StringUtil.shortenTextWithEllipsis(text, FOLD_MAX_LENGTH - 2, 0) + '"' - } - else if (text.length <= 1) { - // Don't just inline empty or one-character replacements: they can't be expanded by a mouse click - // so are hard to use without knowing about the folding keyboard shortcut to toggle folding. - // This is similar to how IntelliJ 14 handles call parameters - return key + ": " + text - } - - return StringUtil.shortenTextWithEllipsis(text, FOLD_MAX_LENGTH, 0) - } - - private tailrec fun LocalResourceRepository.getResourceValue( - type: ResourceType, - name: String, - referenceConfig: FolderConfiguration): String? { - val value = getConfiguredValue(type, name, referenceConfig)?.value ?: return null - if (!value.startsWith('@')) { - return value - } - - val (referencedTypeName, referencedName) = value.substring(1).split('/').takeIf { it.size == 2 } ?: return value - val referencedType = ResourceType.getEnum(referencedTypeName) ?: return value - return getResourceValue(referencedType, referencedName, referenceConfig) - } - - // Converted from com.android.tools.idea.folding.InlinedResource#insertArguments - private fun formatArguments(callExpression: UCallExpression, formatString: String): String { - if (!formatString.contains('%')) { - return formatString - } - - val args = callExpression.valueArguments - if (args.isEmpty() || !args.first().isPsiValid) { - return formatString - } - - val matcher = FORMAT.matcher(formatString) - var index = 0 - var prevIndex = 0 - var nextNumber = 1 - var start = 0 - val sb = StringBuilder(2 * formatString.length) - while (true) { - if (matcher.find(index)) { - if ("%" == matcher.group(6)) { - index = matcher.end() - continue - } - val matchStart = matcher.start() - // Make sure this is not an escaped '%' - while (prevIndex < matchStart) { - val c = formatString[prevIndex] - if (c == '\\') { - prevIndex++ - } - prevIndex++ - } - if (prevIndex > matchStart) { - // We're in an escape, ignore this result - index = prevIndex - continue - } - - index = matcher.end() - - // Shouldn't throw a number format exception since we've already - // matched the pattern in the regexp - val number: Int - var numberString: String? = matcher.group(1) - if (numberString != null) { - // Strip off trailing $ - numberString = numberString.substring(0, numberString.length - 1) - number = Integer.parseInt(numberString) - nextNumber = number + 1 - } - else { - number = nextNumber++ - } - - if (number > 0 && number < args.size) { - val argExpression = args[number] - var value: Any? = argExpression.evaluate() - - if (value == null) { - value = args[number].asSourceString() - } - - for (i in start..matchStart - 1) { - sb.append(formatString[i]) - } - - sb.append("{") - sb.append(value) - sb.append('}') - start = index - } - } - else { - var i = start - val n = formatString.length - while (i < n) { - sb.append(formatString[i]) - i++ - } - break - } - } - - return sb.toString() - } - - private fun getAppResources(element: PsiElement): LocalResourceRepository? = ModuleUtilCore.findModuleForPsiElement(element)?.let { - AppResourceRepository.findExistingInstance(it) - } -} diff --git a/idea/idea-android/src/org/jetbrains/kotlin/android/inspection/TypeParameterFindViewByIdInspection.kt.as31 b/idea/idea-android/src/org/jetbrains/kotlin/android/inspection/TypeParameterFindViewByIdInspection.kt.as31 deleted file mode 100644 index a71ac0416b7..00000000000 --- a/idea/idea-android/src/org/jetbrains/kotlin/android/inspection/TypeParameterFindViewByIdInspection.kt.as31 +++ /dev/null @@ -1,83 +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.android.inspection - -import com.android.tools.idea.model.AndroidModuleInfo -import com.intellij.codeInspection.* -import com.intellij.openapi.project.Project -import com.intellij.psi.PsiElementVisitor -import org.jetbrains.android.facet.AndroidFacet -import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall -import org.jetbrains.kotlin.idea.inspections.AbstractKotlinInspection -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.KtPsiUtil.isUnsafeCast -import org.jetbrains.kotlin.psi.psiUtil.addTypeArgument - -class TypeParameterFindViewByIdInspection : AbstractKotlinInspection(), CleanupLocalInspectionTool { - override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean, session: LocalInspectionToolSession): PsiElementVisitor { - val compileSdk = AndroidFacet.getInstance(session.file) - ?.let { facet -> AndroidModuleInfo.getInstance(facet) } - ?.buildSdkVersion - ?.apiLevel - - if (compileSdk == null || compileSdk < 26) { - return KtVisitorVoid() - } - - return object : KtVisitorVoid() { - override fun visitCallExpression(expression: KtCallExpression) { - super.visitCallExpression(expression) - if (expression.calleeExpression?.text != "findViewById" || expression.typeArguments.isNotEmpty()) { - return - } - - val parentCast = (expression.parent as? KtBinaryExpressionWithTypeRHS)?.takeIf { isUnsafeCast(it) } ?: return - val typeText = parentCast.right?.getTypeTextWithoutQuestionMark() ?: return - val callableDescriptor = expression.resolveToCall()?.resultingDescriptor ?: return - if (callableDescriptor.name.asString() != "findViewById" || callableDescriptor.typeParameters.size != 1) { - return - } - - holder.registerProblem( - parentCast, - "Can be converted to findViewById<$typeText>(...)", - ConvertCastToFindViewByIdWithTypeParameter()) - } - } - } - - class ConvertCastToFindViewByIdWithTypeParameter : LocalQuickFix { - override fun getFamilyName(): String = "Convert cast to findViewById with type parameter" - - override fun applyFix(project: Project, descriptor: ProblemDescriptor) { - val cast = descriptor.psiElement as? KtBinaryExpressionWithTypeRHS ?: return - val typeText = cast.right?.getTypeTextWithoutQuestionMark() ?: return - val call = cast.left as? KtCallExpression ?: return - - val newCall = call.copy() as KtCallExpression - val typeArgument = KtPsiFactory(call).createTypeArgument(typeText) - newCall.addTypeArgument(typeArgument) - - cast.replace(newCall) - } - } - - companion object { - fun KtTypeReference.getTypeTextWithoutQuestionMark(): String? = - (typeElement as? KtNullableType)?.innerType?.text ?: typeElement?.text - } -} \ No newline at end of file diff --git a/idea/idea-android/src/org/jetbrains/kotlin/android/navigation/KotlinAndroidGotoDeclarationHandler.java.as31 b/idea/idea-android/src/org/jetbrains/kotlin/android/navigation/KotlinAndroidGotoDeclarationHandler.java.as31 deleted file mode 100644 index 89243e861e2..00000000000 --- a/idea/idea-android/src/org/jetbrains/kotlin/android/navigation/KotlinAndroidGotoDeclarationHandler.java.as31 +++ /dev/null @@ -1,149 +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.navigation; - -import com.android.resources.ResourceType; -import com.intellij.codeInsight.navigation.actions.GotoDeclarationHandler; -import com.intellij.openapi.actionSystem.DataContext; -import com.intellij.openapi.editor.Editor; -import com.intellij.psi.PsiElement; -import com.intellij.psi.xml.XmlElement; -import org.jetbrains.android.dom.AndroidAttributeValue; -import org.jetbrains.android.dom.manifest.Manifest; -import org.jetbrains.android.dom.manifest.ManifestElementWithRequiredName; -import org.jetbrains.android.dom.resources.Attr; -import org.jetbrains.android.dom.resources.DeclareStyleable; -import org.jetbrains.android.facet.AndroidFacet; -import org.jetbrains.android.resourceManagers.LocalResourceManager; -import org.jetbrains.android.resourceManagers.ModuleResourceManagers; -import org.jetbrains.android.resourceManagers.ResourceManager; -import org.jetbrains.android.util.AndroidResourceUtil; -import org.jetbrains.android.util.AndroidUtils; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.android.AndroidUtilKt; -import org.jetbrains.kotlin.psi.KtSimpleNameExpression; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -// TODO: ask for extension point -// this class is mostly copied from org.jetbrains.android.AndroidGotoDeclarationHandler -public class KotlinAndroidGotoDeclarationHandler implements GotoDeclarationHandler { - @Override - public PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement sourceElement, int offset, Editor editor) { - KtSimpleNameExpression referenceExpression = GotoResourceHelperKt.getReferenceExpression(sourceElement); - if (referenceExpression == null) { - return null; - } - - AndroidFacet facet = AndroidUtilKt.getAndroidFacetForFile(referenceExpression); - if (facet == null) { - return null; - } - - AndroidResourceUtil.MyReferredResourceFieldInfo info = GotoResourceHelperKt.getInfo(referenceExpression, facet); - - if (info == null) return null; - - String nestedClassName = info.getClassName(); - String fieldName = info.getFieldName(); - List resourceList = new ArrayList(); - - if (info.isFromManifest()) { - collectManifestElements(nestedClassName, fieldName, facet, resourceList); - } - else { - ModuleResourceManagers managers = ModuleResourceManagers.getInstance(facet); - ResourceManager manager = info.isSystem() - ? managers.getSystemResourceManager(false) - : managers.getLocalResourceManager(); - if (manager == null) { - return null; - } - manager.collectLazyResourceElements(nestedClassName, fieldName, false, referenceExpression, resourceList); - - if (manager instanceof LocalResourceManager) { - LocalResourceManager lrm = (LocalResourceManager) manager; - - if (nestedClassName.equals(ResourceType.ATTR.getName())) { - for (Attr attr : lrm.findAttrs(fieldName)) { - resourceList.add(attr.getName().getXmlAttributeValue()); - } - } - else if (nestedClassName.equals(ResourceType.STYLEABLE.getName())) { - for (DeclareStyleable styleable : lrm.findStyleables(fieldName)) { - resourceList.add(styleable.getName().getXmlAttributeValue()); - } - - for (Attr styleable : lrm.findStyleableAttributesByFieldName(fieldName)) { - resourceList.add(styleable.getName().getXmlAttributeValue()); - } - } - } - } - - if (resourceList.size() > 1) { - // Sort to ensure the output is stable, and to prefer the base folders - Collections.sort(resourceList, AndroidResourceUtil.RESOURCE_ELEMENT_COMPARATOR); - } - - return resourceList.toArray(new PsiElement[resourceList.size()]); - } - - private static void collectManifestElements( - @NotNull String nestedClassName, - @NotNull String fieldName, - @NotNull AndroidFacet facet, - @NotNull List result - ) { - Manifest manifest = facet.getManifest(); - - if (manifest == null) { - return; - } - List list; - - if ("permission".equals(nestedClassName)) { - list = manifest.getPermissions(); - } - else if ("permission_group".equals(nestedClassName)) { - list = manifest.getPermissionGroups(); - } - else { - return; - } - for (ManifestElementWithRequiredName domElement : list) { - AndroidAttributeValue nameAttribute = domElement.getName(); - String name = nameAttribute.getValue(); - - if (AndroidUtils.equal(name, fieldName, false)) { - XmlElement psiElement = nameAttribute.getXmlAttributeValue(); - - if (psiElement != null) { - result.add(psiElement); - } - } - } - } - - @Override - public String getActionText(DataContext context) { - return null; - } -} diff --git a/idea/idea-android/src/org/jetbrains/kotlin/android/navigation/gotoResourceHelper.kt.as31 b/idea/idea-android/src/org/jetbrains/kotlin/android/navigation/gotoResourceHelper.kt.as31 deleted file mode 100644 index 3f92b2ebbb1..00000000000 --- a/idea/idea-android/src/org/jetbrains/kotlin/android/navigation/gotoResourceHelper.kt.as31 +++ /dev/null @@ -1,111 +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.navigation - -import org.jetbrains.android.util.AndroidResourceUtil -import com.intellij.psi.PsiElement -import org.jetbrains.android.facet.AndroidFacet -import org.jetbrains.kotlin.psi.KtSimpleNameExpression -import com.intellij.psi.util.PsiTreeUtil -import com.intellij.psi.PsiClass -import org.jetbrains.android.util.AndroidUtils -import com.android.SdkConstants -import org.jetbrains.android.augment.AndroidPsiElementFinder -import org.jetbrains.kotlin.idea.references.mainReference -import org.jetbrains.kotlin.psi.KtDotQualifiedExpression -import org.jetbrains.kotlin.psi.psiUtil.getReceiverExpression -import org.jetbrains.kotlin.psi.KtExpression - -fun getReferenceExpression(element: PsiElement?): KtSimpleNameExpression? { - return PsiTreeUtil.getParentOfType(element, KtSimpleNameExpression::class.java) -} - -// given 'R.a.b' returns info for all three parts of the expression 'a', 'b', 'R' -fun getInfo( - referenceExpression: KtSimpleNameExpression, - facet: AndroidFacet -): AndroidResourceUtil.MyReferredResourceFieldInfo? { - val info = getReferredInfo(referenceExpression, facet) - if (info != null) return info - - val topMostQualified = referenceExpression.getParentQualified().getParentQualified() ?: return null - val selectorCandidate = topMostQualified.selectorExpression as? KtSimpleNameExpression ?: return null - return getReferredInfo(selectorCandidate, facet) -} - -private fun KtExpression?.getParentQualified(): KtDotQualifiedExpression? { - return this?.parent as? KtDotQualifiedExpression -} - -// returns info if passed expression is 'b' in 'R.a.b' -private fun getReferredInfo( - lastPart: KtSimpleNameExpression, - facet: AndroidFacet -): AndroidResourceUtil.MyReferredResourceFieldInfo? { - val resFieldName = lastPart.getReferencedName() - if (resFieldName.isEmpty()) return null - - val middlePart = getReceiverAsSimpleNameExpression(lastPart) ?: return null - - val resClassName = middlePart.getReferencedName() - if (resClassName.isEmpty()) return null - - val firstPart = getReceiverAsSimpleNameExpression(middlePart) ?: return null - - val resolvedClass = firstPart.mainReference.resolve() as? PsiClass ?: return null - - //the following code is copied from - // org.jetbrains.android.util.AndroidResourceUtil.getReferredResourceOrManifestField - // (org.jetbrains.android.facet.AndroidFacet, com.intellij.psi.PsiReferenceExpression, java.lang.String, boolean) - val classShortName = resolvedClass.name - - val fromManifest = AndroidUtils.MANIFEST_CLASS_NAME == classShortName - - if (!fromManifest && AndroidUtils.R_CLASS_NAME != classShortName) { - return null - } - val qName = resolvedClass.qualifiedName - - if (SdkConstants.CLASS_R == qName || AndroidPsiElementFinder.INTERNAL_R_CLASS_QNAME == qName) { - return AndroidResourceUtil.MyReferredResourceFieldInfo(resClassName, resFieldName, facet.module, true, false) - } - val containingFile = resolvedClass.containingFile ?: return null - - val isFromCorrectFile = - if (fromManifest) AndroidResourceUtil.isManifestJavaFile(facet, containingFile) - else AndroidResourceUtil.isRJavaFile(facet, containingFile) - - if (!isFromCorrectFile) { - return null - } - - return AndroidResourceUtil.MyReferredResourceFieldInfo(resClassName, resFieldName, facet.module, false, fromManifest) -} - -private fun getReceiverAsSimpleNameExpression(exp: KtSimpleNameExpression): KtSimpleNameExpression? { - val receiver = exp.getReceiverExpression() - return when (receiver) { - is KtSimpleNameExpression -> { - receiver - } - is KtDotQualifiedExpression -> { - receiver.selectorExpression as? KtSimpleNameExpression - } - else -> null - } - -} diff --git a/idea/idea-android/src/org/jetbrains/kotlin/android/quickfix/AddTargetApiQuickFix.kt.as31 b/idea/idea-android/src/org/jetbrains/kotlin/android/quickfix/AddTargetApiQuickFix.kt.as31 deleted file mode 100644 index a05fc15de40..00000000000 --- a/idea/idea-android/src/org/jetbrains/kotlin/android/quickfix/AddTargetApiQuickFix.kt.as31 +++ /dev/null @@ -1,95 +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.android.quickfix - -import com.android.SdkConstants -import com.android.tools.lint.checks.ApiDetector.REQUIRES_API_ANNOTATION -import com.intellij.codeInsight.FileModificationService -import com.intellij.psi.PsiElement -import com.intellij.psi.util.PsiTreeUtil -import org.jetbrains.android.inspections.lint.AndroidLintQuickFix -import org.jetbrains.android.inspections.lint.AndroidQuickfixContexts -import org.jetbrains.android.util.AndroidBundle -import org.jetbrains.kotlin.android.hasBackingField -import org.jetbrains.kotlin.idea.util.addAnnotation -import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.psi.* - - -class AddTargetApiQuickFix( - val api: Int, - val useRequiresApi: Boolean -) : AndroidLintQuickFix { - - private companion object { - val FQNAME_TARGET_API = FqName(SdkConstants.FQCN_TARGET_API) - val FQNAME_REQUIRES_API = FqName(REQUIRES_API_ANNOTATION) - } - - override fun isApplicable(startElement: PsiElement, endElement: PsiElement, contextType: AndroidQuickfixContexts.ContextType): Boolean = - getAnnotationContainer(startElement, useRequiresApi) != null - - override fun getName(): String = getAnnotationValue(false).let { - if (useRequiresApi) { - // Not Available in Android plugin 2.0 - // AndroidBundle.message("android.lint.fix.add.requires.api", it) - "Add @RequiresApi($it) Annotation" - } else { - AndroidBundle.message("android.lint.fix.add.target.api", it) - } - } - - override fun apply(startElement: PsiElement, endElement: PsiElement, context: AndroidQuickfixContexts.Context) { - val annotationContainer = getAnnotationContainer(startElement, useRequiresApi) ?: return - if (!FileModificationService.getInstance().preparePsiElementForWrite(annotationContainer)) { - return - } - - if (annotationContainer is KtModifierListOwner) { - annotationContainer.addAnnotation( - if (useRequiresApi) FQNAME_REQUIRES_API else FQNAME_TARGET_API, - getAnnotationValue(true), - whiteSpaceText = if (annotationContainer.isNewLineNeededForAnnotation()) "\n" else " ") - } - } - - private fun KtElement.isNewLineNeededForAnnotation() = !(this is KtParameter || this is KtTypeParameter || this is KtPropertyAccessor) - - private fun getAnnotationValue(fullyQualified: Boolean) = getVersionField(api, fullyQualified) - - private fun getAnnotationContainer(element: PsiElement, useRequiresApi: Boolean): PsiElement? { - return PsiTreeUtil.findFirstParent(element) { - if (useRequiresApi) - it.isRequiresApiAnnotationValidTarget() - else - it.isTargetApiAnnotationValidTarget() - } - } - - private fun PsiElement.isRequiresApiAnnotationValidTarget(): Boolean { - return this is KtClassOrObject || - (this is KtFunction && this !is KtFunctionLiteral) || - (this is KtProperty && !isLocal && hasBackingField()) || - this is KtPropertyAccessor - } - - private fun PsiElement.isTargetApiAnnotationValidTarget(): Boolean { - return this is KtClassOrObject || - (this is KtFunction && this !is KtFunctionLiteral) || - this is KtPropertyAccessor - } -} \ No newline at end of file diff --git a/idea/idea-android/src/org/jetbrains/kotlin/android/quickfix/AddTargetVersionCheckQuickFix.kt.as31 b/idea/idea-android/src/org/jetbrains/kotlin/android/quickfix/AddTargetVersionCheckQuickFix.kt.as31 deleted file mode 100644 index fbc5b6d4289..00000000000 --- a/idea/idea-android/src/org/jetbrains/kotlin/android/quickfix/AddTargetVersionCheckQuickFix.kt.as31 +++ /dev/null @@ -1,94 +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.android.quickfix - -import com.intellij.codeInsight.FileModificationService -import com.intellij.psi.PsiDocumentManager -import com.intellij.psi.PsiElement -import com.intellij.psi.util.PsiTreeUtil -import org.jetbrains.android.inspections.lint.AndroidLintQuickFix -import org.jetbrains.android.inspections.lint.AndroidQuickfixContexts -import org.jetbrains.kotlin.idea.caches.resolve.analyze -import org.jetbrains.kotlin.idea.codeInsight.surroundWith.statement.KotlinIfSurrounder -import org.jetbrains.kotlin.idea.core.ShortenReferences -import org.jetbrains.kotlin.idea.inspections.findExistingEditor -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.resolve.BindingContext -import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode - - -class AddTargetVersionCheckQuickFix(val api: Int) : AndroidLintQuickFix { - - override fun apply(startElement: PsiElement, endElement: PsiElement, context: AndroidQuickfixContexts.Context) { - val targetExpression = getTargetExpression(startElement) - val project = targetExpression?.project ?: return - val editor = targetExpression.findExistingEditor() ?: return - - val file = targetExpression.containingFile - val documentManager = PsiDocumentManager.getInstance(project) - val document = documentManager.getDocument(file) ?: return - - if (!FileModificationService.getInstance().prepareFileForWrite(file)) { - return - } - - val surrounder = getSurrounder(targetExpression, "\"VERSION.SDK_INT < ${getVersionField(api, false)}\"") - val conditionRange = surrounder.surroundElements(project, editor, arrayOf(targetExpression)) ?: return - val conditionText = "android.os.Build.VERSION.SDK_INT >= ${getVersionField(api, true)}" - document.replaceString(conditionRange.startOffset, conditionRange.endOffset, conditionText) - documentManager.commitDocument(document) - - ShortenReferences.DEFAULT.process(documentManager.getPsiFile(document) as KtFile, - conditionRange.startOffset, - conditionRange.startOffset + conditionText.length) - } - - override fun isApplicable(startElement: PsiElement, endElement: PsiElement, contextType: AndroidQuickfixContexts.ContextType): Boolean = - getTargetExpression(startElement) != null - - override fun getName(): String = "Surround with if (VERSION.SDK_INT >= VERSION_CODES.${getVersionField(api, false)}) { ... }" - - private fun getTargetExpression(element: PsiElement): KtElement? { - var current = PsiTreeUtil.getParentOfType(element, KtExpression::class.java) - while (current != null) { - if (current.parent is KtBlockExpression || - current.parent is KtContainerNode || - current.parent is KtWhenEntry || - current.parent is KtFunction || - current.parent is KtPropertyAccessor || - current.parent is KtProperty || - current.parent is KtReturnExpression || - current.parent is KtDestructuringDeclaration) { - break - } - current = PsiTreeUtil.getParentOfType(current, KtExpression::class.java, true) - } - - return current - } - - private fun getSurrounder(element: KtElement, todoText: String?): KotlinIfSurrounder { - val used = element.analyze(BodyResolveMode.PARTIAL_WITH_CFA)[BindingContext.USED_AS_EXPRESSION, element] ?: false - return if (used) { - object : KotlinIfSurrounder() { - override fun getCodeTemplate(): String = "if (a) { \n} else {\nTODO(${todoText ?: ""})\n}" - } - } else { - KotlinIfSurrounder() - } - } -} \ No newline at end of file diff --git a/idea/idea-android/src/org/jetbrains/kotlin/android/quickfix/ApiUtils.kt.as31 b/idea/idea-android/src/org/jetbrains/kotlin/android/quickfix/ApiUtils.kt.as31 deleted file mode 100644 index 3a52671ba84..00000000000 --- a/idea/idea-android/src/org/jetbrains/kotlin/android/quickfix/ApiUtils.kt.as31 +++ /dev/null @@ -1,24 +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.android.quickfix - -import com.android.sdklib.SdkVersionInfo.* - - -fun getVersionField(api: Int, fullyQualified: Boolean): String = getBuildCode(api)?.let { - if (fullyQualified) "android.os.Build.VERSION_CODES.$it" else it -} ?: api.toString() \ No newline at end of file diff --git a/idea/idea-android/src/org/jetbrains/kotlin/android/quickfix/KotlinAndroidQuickFixProvider.kt.as31 b/idea/idea-android/src/org/jetbrains/kotlin/android/quickfix/KotlinAndroidQuickFixProvider.kt.as31 deleted file mode 100644 index 68feed44bda..00000000000 --- a/idea/idea-android/src/org/jetbrains/kotlin/android/quickfix/KotlinAndroidQuickFixProvider.kt.as31 +++ /dev/null @@ -1,80 +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.android.quickfix - -import com.android.SdkConstants.SUPPORT_ANNOTATIONS_PREFIX -import com.android.tools.lint.checks.ApiDetector -import com.android.tools.lint.checks.CommentDetector -import com.android.tools.lint.checks.ParcelDetector -import com.android.tools.lint.detector.api.Issue -import com.intellij.psi.JavaPsiFacade -import com.intellij.psi.PsiElement -import com.intellij.psi.search.GlobalSearchScope -import org.jetbrains.android.inspections.lint.AndroidLintQuickFix -import org.jetbrains.android.inspections.lint.AndroidLintQuickFixProvider -import java.util.regex.Pattern - - -class KotlinAndroidQuickFixProvider : AndroidLintQuickFixProvider { - override fun getQuickFixes( - issue: Issue, - startElement: PsiElement, - endElement: PsiElement, - message: String, - data: Any? - ): Array { - val fixes: Array = when (issue) { - ApiDetector.UNSUPPORTED, ApiDetector.INLINED -> getApiQuickFixes(issue, startElement, message) - ParcelDetector.ISSUE -> arrayOf(ParcelableQuickFix()) - else -> emptyArray() - } - - if (issue != CommentDetector.STOP_SHIP) { - return fixes + SuppressLintQuickFix(issue.id) - } - - return fixes - } - - fun getApiQuickFixes(issue: Issue, element: PsiElement, message: String): Array { - val api = getRequiredVersion(message) - if (api == -1) { - return AndroidLintQuickFix.EMPTY_ARRAY - } - - val project = element.project - if (JavaPsiFacade.getInstance(project).findClass(REQUIRES_API_ANNOTATION, GlobalSearchScope.allScope(project)) != null) { - return arrayOf(AddTargetApiQuickFix(api, true), AddTargetApiQuickFix(api, false), AddTargetVersionCheckQuickFix(api)) - } - - return arrayOf(AddTargetApiQuickFix(api, false), AddTargetVersionCheckQuickFix(api)) - } - - private fun getRequiredVersion(errorMessage: String): Int { - val pattern = Pattern.compile("\\s(\\d+)\\s") - val matcher = pattern.matcher(errorMessage) - if (matcher.find()) { - return Integer.parseInt(matcher.group(1)) - } - - return -1 - } - - companion object { - val REQUIRES_API_ANNOTATION = SUPPORT_ANNOTATIONS_PREFIX + "RequiresApi" - } -} \ No newline at end of file diff --git a/idea/idea-android/src/org/jetbrains/kotlin/android/quickfix/ParcelableQuickFix.kt.as31 b/idea/idea-android/src/org/jetbrains/kotlin/android/quickfix/ParcelableQuickFix.kt.as31 deleted file mode 100644 index d3442300f5e..00000000000 --- a/idea/idea-android/src/org/jetbrains/kotlin/android/quickfix/ParcelableQuickFix.kt.as31 +++ /dev/null @@ -1,43 +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.android.quickfix - -import com.intellij.psi.PsiElement -import com.intellij.psi.util.PsiTreeUtil -import org.jetbrains.android.inspections.lint.AndroidLintQuickFix -import org.jetbrains.android.inspections.lint.AndroidQuickfixContexts -import org.jetbrains.android.util.AndroidBundle -import org.jetbrains.kotlin.android.canAddParcelable -import org.jetbrains.kotlin.android.implementParcelable -import org.jetbrains.kotlin.android.isParcelize -import org.jetbrains.kotlin.psi.KtClass - - -class ParcelableQuickFix : AndroidLintQuickFix { - override fun apply(startElement: PsiElement, endElement: PsiElement, context: AndroidQuickfixContexts.Context) { - startElement.getTargetClass()?.implementParcelable() - } - - override fun isApplicable(startElement: PsiElement, endElement: PsiElement, contextType: AndroidQuickfixContexts.ContextType): Boolean { - val targetClass = startElement.getTargetClass() ?: return false - return targetClass.canAddParcelable() && !targetClass.isParcelize() - } - - override fun getName(): String = AndroidBundle.message("implement.parcelable.intention.text") - - private fun PsiElement.getTargetClass(): KtClass? = PsiTreeUtil.getParentOfType(this, KtClass::class.java, false) -} \ No newline at end of file diff --git a/idea/idea-android/src/org/jetbrains/kotlin/android/quickfix/SuppressLintQuickFix.kt.as31 b/idea/idea-android/src/org/jetbrains/kotlin/android/quickfix/SuppressLintQuickFix.kt.as31 deleted file mode 100644 index 724f718c257..00000000000 --- a/idea/idea-android/src/org/jetbrains/kotlin/android/quickfix/SuppressLintQuickFix.kt.as31 +++ /dev/null @@ -1,99 +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.android.quickfix - -import com.android.SdkConstants -import com.intellij.codeInsight.FileModificationService -import com.intellij.psi.PsiElement -import com.intellij.psi.util.PsiTreeUtil -import org.jetbrains.android.inspections.lint.AndroidLintQuickFix -import org.jetbrains.android.inspections.lint.AndroidQuickfixContexts -import org.jetbrains.android.util.AndroidBundle -import org.jetbrains.kotlin.android.hasBackingField -import org.jetbrains.kotlin.idea.util.addAnnotation -import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.psi.* - - -class SuppressLintQuickFix(id: String) : AndroidLintQuickFix { - private val lintId = getLintId(id) - - override fun apply(startElement: PsiElement, endElement: PsiElement, context: AndroidQuickfixContexts.Context) { - val annotationContainer = PsiTreeUtil.findFirstParent(startElement, true) { it.isSuppressLintTarget() } ?: return - if (!FileModificationService.getInstance().preparePsiElementForWrite(annotationContainer)) { - return - } - - val argument = "\"$lintId\"" - - when (annotationContainer) { - is KtModifierListOwner -> { - annotationContainer.addAnnotation( - FQNAME_SUPPRESS_LINT, - argument, - whiteSpaceText = if (annotationContainer.isNewLineNeededForAnnotation()) "\n" else " ", - addToExistingAnnotation = { entry -> addArgumentToAnnotation(entry, argument) }) - } - } - } - - override fun getName(): String = AndroidBundle.message(SUPPRESS_LINT_MESSAGE, lintId) - - override fun isApplicable( - startElement: PsiElement, - endElement: PsiElement, - contextType: AndroidQuickfixContexts.ContextType - ): Boolean = true - - private fun addArgumentToAnnotation(entry: KtAnnotationEntry, argument: String): Boolean { - // add new arguments to an existing entry - val args = entry.valueArgumentList - val psiFactory = KtPsiFactory(entry) - val newArgList = psiFactory.createCallArguments("($argument)") - when { - args == null -> // new argument list - entry.addAfter(newArgList, entry.lastChild) - args.arguments.isEmpty() -> // replace '()' with a new argument list - args.replace(newArgList) - args.arguments.none { it.textMatches(argument) } -> - args.addArgument(newArgList.arguments[0]) - } - - return true - } - - private fun getLintId(intentionId: String) = - if (intentionId.startsWith(INTENTION_NAME_PREFIX)) intentionId.substring(INTENTION_NAME_PREFIX.length) else intentionId - - private fun KtElement.isNewLineNeededForAnnotation(): Boolean { - return !(this is KtParameter || - this is KtTypeParameter || - this is KtPropertyAccessor) - } - - private fun PsiElement.isSuppressLintTarget(): Boolean { - return this is KtDeclaration && - (this as? KtProperty)?.hasBackingField() ?: true && - this !is KtFunctionLiteral && - this !is KtDestructuringDeclaration - } - private companion object { - val INTENTION_NAME_PREFIX = "AndroidLint" - val SUPPRESS_LINT_MESSAGE = "android.lint.fix.suppress.lint.api.annotation" - val FQNAME_SUPPRESS_LINT = FqName(SdkConstants.FQCN_SUPPRESS_LINT) - } -} \ No newline at end of file diff --git a/idea/idea-android/tests/org/jetbrains/kotlin/android/lint/AbstractKotlinLintTest.kt.as31 b/idea/idea-android/tests/org/jetbrains/kotlin/android/lint/AbstractKotlinLintTest.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-android/tests/org/jetbrains/kotlin/android/lint/KotlinLintTestGenerated.java.as31 b/idea/idea-android/tests/org/jetbrains/kotlin/android/lint/KotlinLintTestGenerated.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-android/tests/org/jetbrains/kotlin/android/quickfix/AbstractAndroidLintQuickfixTest.kt.as31 b/idea/idea-android/tests/org/jetbrains/kotlin/android/quickfix/AbstractAndroidLintQuickfixTest.kt.as31 deleted file mode 100644 index c2f6989d0bc..00000000000 --- a/idea/idea-android/tests/org/jetbrains/kotlin/android/quickfix/AbstractAndroidLintQuickfixTest.kt.as31 +++ /dev/null @@ -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.android.quickfix - -import com.intellij.codeInspection.InspectionProfileEntry -import com.intellij.openapi.util.io.FileUtil -import com.intellij.util.PathUtil -import org.jetbrains.android.inspections.lint.AndroidLintInspectionBase -import org.jetbrains.kotlin.android.KotlinAndroidTestCase -import org.jetbrains.kotlin.test.InTextDirectivesUtils -import java.io.File - - -abstract class AbstractAndroidLintQuickfixTest : KotlinAndroidTestCase() { - - override fun setUp() { - AndroidLintInspectionBase.invalidateInspectionShortName2IssueMap() - super.setUp() - } - - fun doTest(path: String) { - val fileText = FileUtil.loadFile(File(path), true) - val intentionText = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// INTENTION_TEXT: ") ?: error("Empty intention text") - val mainInspectionClassName = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// INSPECTION_CLASS: ") ?: error("Empty inspection class name") - val dependency = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// DEPENDENCY: ") - val intentionAvailable = !InTextDirectivesUtils.isDirectiveDefined(fileText, "// INTENTION_NOT_AVAILABLE") - - val inspection = Class.forName(mainInspectionClassName).newInstance() as InspectionProfileEntry - myFixture.enableInspections(inspection) - - val sourceFile = myFixture.copyFileToProject(path, "src/${PathUtil.getFileName(path)}") - myFixture.configureFromExistingVirtualFile(sourceFile) - - if (dependency != null) { - val (dependencyFile, dependencyTargetPath) = dependency.split(" -> ").map(String::trim) - myFixture.copyFileToProject("${PathUtil.getParentPath(path)}/$dependencyFile", "src/$dependencyTargetPath") - } - - if (intentionAvailable) { - val intention = myFixture.getAvailableIntention(intentionText) ?: error("Failed to find intention") - myFixture.launchAction(intention) - myFixture.checkResultByFile(path + ".expected") - } - else { - assertNull("Intention should not be available", myFixture.availableIntentions.find { it.text == intentionText }) - } - } -} \ No newline at end of file diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.as31 b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.as31 deleted file mode 100644 index af78ad740f6..00000000000 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.as31 +++ /dev/null @@ -1,2254 +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.idea.codeInsight.gradle - -import com.intellij.openapi.application.Result -import com.intellij.openapi.application.WriteAction -import com.intellij.openapi.application.runReadAction -import com.intellij.openapi.projectRoots.JavaSdk -import com.intellij.openapi.projectRoots.ProjectJdkTable -import com.intellij.openapi.roots.LibraryOrderEntry -import com.intellij.openapi.roots.ModuleRootManager -import com.intellij.openapi.roots.OrderRootType -import com.intellij.openapi.roots.impl.libraries.LibraryEx -import junit.framework.TestCase -import org.jetbrains.kotlin.caches.resolve.KotlinCacheService -import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments -import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments -import org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments -import org.jetbrains.kotlin.config.* -import org.jetbrains.kotlin.idea.caches.project.productionSourceInfo -import org.jetbrains.kotlin.idea.caches.project.testSourceInfo -import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCommonCompilerArgumentsHolder -import org.jetbrains.kotlin.idea.configuration.ConfigureKotlinStatus -import org.jetbrains.kotlin.idea.configuration.ModuleSourceRootMap -import org.jetbrains.kotlin.idea.configuration.allConfigurators -import org.jetbrains.kotlin.idea.facet.KotlinFacet -import org.jetbrains.kotlin.idea.framework.CommonLibraryKind -import org.jetbrains.kotlin.idea.framework.JSLibraryKind -import org.jetbrains.kotlin.idea.framework.KotlinSdkType -import org.jetbrains.kotlin.idea.framework.effectiveKind -import org.jetbrains.kotlin.idea.util.projectStructure.allModules -import org.jetbrains.kotlin.js.resolve.JsPlatform -import org.jetbrains.kotlin.platform.impl.JvmIdePlatformKind -import org.jetbrains.kotlin.platform.impl.isCommon -import org.jetbrains.kotlin.platform.impl.isJavaScript -import org.jetbrains.kotlin.resolve.TargetPlatform -import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform -import org.jetbrains.kotlin.test.KotlinTestUtils -import org.junit.Assert -import org.junit.Test -import java.util.* - -internal fun GradleImportingTestCase.facetSettings(moduleName: String) = KotlinFacet.get(getModule(moduleName))!!.configuration.settings - -internal val GradleImportingTestCase.facetSettings: KotlinFacetSettings - get() = facetSettings("project") - -internal val GradleImportingTestCase.testFacetSettings: KotlinFacetSettings - get() = facetSettings("project_test") - -class GradleFacetImportTest : GradleImportingTestCase() { - @Test - fun testJvmImport() { - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin' - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - } - - compileKotlin { - kotlinOptions.jvmTarget = "1.7" - kotlinOptions.freeCompilerArgs = ["-Xsingle-module", "-Xdump-declarations-to", "tmp"] - } - - compileTestKotlin { - kotlinOptions.jvmTarget = "1.6" - kotlinOptions.apiVersion = "1.0" - kotlinOptions.freeCompilerArgs = ["-Xdump-declarations-to", "tmpTest"] - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion) - Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion) - Assert.assertEquals(JvmIdePlatformKind.Platform(JvmTarget.JVM_1_8), platform) - Assert.assertEquals("1.7", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xdump-declarations-to=tmp -Xsingle-module", - compilerSettings!!.additionalArguments - ) - } -/* - with (testFacetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.0", apiLevel!!.versionString) - Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion) - Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion) - Assert.assertEquals(JvmIdePlatformKind.Platform(JvmTarget.JVM_1_6), platform) - Assert.assertEquals("1.6", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xdump-declarations-to=tmpTest", - compilerSettings!!.additionalArguments - ) - } -*/ - assertAllModulesConfigured() - } - - @Test - fun testJvmImportWithPlugin() { - createProjectSubFile( - "build.gradle", """ -buildscript { - repositories { - mavenCentral() - } -} - -plugins { - id "org.jetbrains.kotlin.jvm" version "1.1.3" -} - -version '1.0-SNAPSHOT' - -apply plugin: 'java' - -sourceCompatibility = 1.8 - -repositories { - mavenCentral() -} - -dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.3" - testCompile group: 'junit', name: 'junit', version: '4.12' -} - -compileKotlin { - kotlinOptions.jvmTarget = "1.8" -} -compileTestKotlin { - kotlinOptions.jvmTarget = "1.8" -} - """ - ) - importProject() - - assertAllModulesConfigured() - } - - @Test - fun testJvmImport_1_1_2() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-dev' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-5") - } - } - - apply plugin: 'kotlin' - - repositories { - mavenCentral() - maven { url 'http://dl.bintray.com/kotlin/kotlin-dev' } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.2-5" - } - - compileKotlin { - kotlinOptions.jvmTarget = "1.7" - kotlinOptions.freeCompilerArgs = ["-Xsingle-module", "-Xdump-declarations-to", "tmp"] - } - - compileTestKotlin { - kotlinOptions.jvmTarget = "1.6" - kotlinOptions.apiVersion = "1.0" - kotlinOptions.freeCompilerArgs = ["-Xdump-declarations-to", "tmpTest"] - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertEquals(JvmIdePlatformKind.Platform(JvmTarget.JVM_1_8), platform) - Assert.assertEquals("1.7", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xdump-declarations-to=tmp -Xsingle-module", - compilerSettings!!.additionalArguments - ) - } -/* - with (testFacetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.0", apiLevel!!.versionString) - Assert.assertEquals(JvmIdePlatformKind.Platform(JvmTarget.JVM_1_6), platform) - Assert.assertEquals("1.6", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xdump-declarations-to=tmpTest", - compilerSettings!!.additionalArguments - ) - } -*/ - } - - @Test - fun testJvmImportWithCustomSourceSets() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin' - - sourceSets { - myMain { - kotlin { - srcDir 'src' - } - } - myTest { - kotlin { - srcDir 'test' - } - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - } - - compileMyMainKotlin { - kotlinOptions.jvmTarget = "1.7" - kotlinOptions.freeCompilerArgs = ["-Xsingle-module", "-Xdump-declarations-to", "tmp"] - } - - compileMyTestKotlin { - kotlinOptions.jvmTarget = "1.6" - kotlinOptions.apiVersion = "1.0" - kotlinOptions.freeCompilerArgs = ["-Xdump-declarations-to", "tmpTest"] - } - """ - ) - importProject() - -/* - with (facetSettings("project_myMain")) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertEquals(JvmIdePlatformKind.Platform(JvmTarget.JVM_1_8), platform) - Assert.assertEquals("1.7", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xdump-declarations-to=tmp -Xsingle-module", - compilerSettings!!.additionalArguments - ) - } - with(facetSettings("project_myTest")) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.0", apiLevel!!.versionString) - Assert.assertEquals(JvmIdePlatformKind.Platform(JvmTarget.JVM_1_6), platform) - Assert.assertEquals("1.6", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xdump-declarations-to=tmpTest", - compilerSettings!!.additionalArguments - ) - } -*/ - assertAllModulesConfigured() - } - - @Test - fun testJvmImportWithCustomSourceSets_1_1_2() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { url 'http://dl.bintray.com/kotlin/kotlin-dev' } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-5") - } - } - - apply plugin: 'kotlin' - - repositories { - mavenCentral() - maven { url 'http://dl.bintray.com/kotlin/kotlin-dev' } - } - - sourceSets { - myMain { - kotlin { - srcDir 'src' - } - } - myTest { - kotlin { - srcDir 'test' - } - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.2-5" - } - - compileMyMainKotlin { - kotlinOptions.jvmTarget = "1.7" - kotlinOptions.freeCompilerArgs = ["-Xsingle-module", "-Xdump-declarations-to", "tmp"] - } - - compileMyTestKotlin { - kotlinOptions.jvmTarget = "1.6" - kotlinOptions.apiVersion = "1.0" - kotlinOptions.freeCompilerArgs = ["-Xdump-declarations-to", "tmpTest"] - } - """ - ) - importProject() -/* - with (facetSettings("project_myMain")) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertEquals(JvmIdePlatformKind.Platform(JvmTarget.JVM_1_8), platform) - Assert.assertEquals("1.7", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xdump-declarations-to=tmp -Xsingle-module", - compilerSettings!!.additionalArguments - ) - } - with(facetSettings("project_myTest")) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.0", apiLevel!!.versionString) - Assert.assertEquals(JvmIdePlatformKind.Platform(JvmTarget.JVM_1_6), platform) - Assert.assertEquals("1.6", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xdump-declarations-to=tmpTest", - compilerSettings!!.additionalArguments - ) - } -*/ - } - - @Test - fun testCoroutineImportByOptions() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin' - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - } - - kotlin { - experimental { - coroutines 'enable' - } - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals(LanguageFeature.State.ENABLED, coroutineSupport) - } - } - - @Test - fun testCoroutineImportByProperties() { - createProjectSubFile("gradle.properties", "kotlin.coroutines=enable") - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin' - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals(LanguageFeature.State.ENABLED, coroutineSupport) - } - } - - @Test - fun testJsImport() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin2js' - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:1.1.0" - } - - compileKotlin2Js { - kotlinOptions.sourceMap = true - kotlinOptions.freeCompilerArgs = ["-module-kind", "plain", "-main", "callMain"] - } - - compileTestKotlin2Js { - kotlinOptions.apiVersion = "1.0" - kotlinOptions.freeCompilerArgs = ["-module-kind", "umd", "-main", "callTest"] - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion) - Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion) - Assert.assertTrue(platform.isJavaScript) - with(compilerArguments as K2JSCompilerArguments) { - Assert.assertEquals(true, sourceMap) - Assert.assertEquals("plain", moduleKind) - } - Assert.assertEquals( - "-main callMain", - compilerSettings!!.additionalArguments - ) - } -/* - with (testFacetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.0", apiLevel!!.versionString) - Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion) - Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion) - Assert.assertTrue(platform.isJavaScript) - with(compilerArguments as K2JSCompilerArguments) { - Assert.assertEquals(false, sourceMap) - Assert.assertEquals("umd", moduleKind) - } - Assert.assertEquals( - "-main callTest", - compilerSettings!!.additionalArguments - ) - } -*/ - val rootManager = ModuleRootManager.getInstance(getModule("project")) - val stdlib = rootManager.orderEntries.filterIsInstance().first().library - assertEquals(JSLibraryKind, (stdlib as LibraryEx).kind) - assertTrue(stdlib.getFiles(OrderRootType.CLASSES).isNotEmpty()) - - Assert.assertTrue(ModuleRootManager.getInstance(getModule("project")).sdk!!.sdkType is KotlinSdkType) - - assertAllModulesConfigured() - } - - @Test - fun testJsImportTransitive() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin2js' - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-test-js:1.1.0" - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertTrue(platform.isJavaScript) - } - - val rootManager = ModuleRootManager.getInstance(getModule("project")) - val stdlib = rootManager.orderEntries - .filterIsInstance() - .map { it.library as LibraryEx } - .first { "kotlin-stdlib-js" in it.name!! } - assertEquals(JSLibraryKind, stdlib.kind) - - assertAllModulesConfigured() - } - - @Test - fun testJsImportWithCustomSourceSets() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin2js' - - sourceSets { - myMain { - kotlin { - srcDir 'src' - } - } - myTest { - kotlin { - srcDir 'test' - } - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:1.1.0" - } - - compileMyMainKotlin2Js { - kotlinOptions.sourceMap = true - kotlinOptions.freeCompilerArgs = ["-module-kind", "plain", "-main", "callMain"] - } - - compileMyTestKotlin2Js { - kotlinOptions.apiVersion = "1.0" - kotlinOptions.freeCompilerArgs = ["-module-kind", "umd", "-main", "callTest"] - } - """ - ) - importProject() -/* - with (facetSettings("project_myMain")) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertTrue(platform.isJavaScript) - with(compilerArguments as K2JSCompilerArguments) { - Assert.assertEquals(true, sourceMap) - Assert.assertEquals("plain", moduleKind) - } - Assert.assertEquals( - "-main callMain", - compilerSettings!!.additionalArguments - ) - } - - with(facetSettings("project_myTest")) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.0", apiLevel!!.versionString) - Assert.assertTrue(platform.isJavaScript) - with(compilerArguments as K2JSCompilerArguments) { - Assert.assertEquals(false, sourceMap) - Assert.assertEquals("umd", moduleKind) - } - Assert.assertEquals( - "-main callTest", - compilerSettings!!.additionalArguments - ) - } -*/ - assertAllModulesConfigured() - } - - @Test - fun testDetectOldJsStdlib() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.6") - } - } - - apply plugin: 'kotlin2js' - - dependencies { - compile "org.jetbrains.kotlin:kotlin-js-library:1.0.6" - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertTrue(platform.isJavaScript) - } - } - - @Test - fun testJvmImportByPlatformPlugin() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-jvm' - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertEquals(JvmIdePlatformKind.Platform(JvmTarget.JVM_1_6), platform) - } - } - - @Test - fun testJsImportByPlatformPlugin() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-js' - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-common:1.1.0" - compile "org.jetbrains.kotlin:kotlin-stdlib-js:1.1.0" - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertTrue(platform.isJavaScript) - } - - val rootManager = ModuleRootManager.getInstance(getModule("project")) - val libraries = rootManager.orderEntries.filterIsInstance().mapNotNull { it.library as LibraryEx } - assertEquals(JSLibraryKind, libraries.first { it.name?.contains("kotlin-stdlib-js") == true }.kind) - assertEquals(CommonLibraryKind, libraries.first { it.name?.contains("kotlin-stdlib-common") == true }.kind) - } - - @Test - fun testCommonImportByPlatformPlugin() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-common' - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-common:1.1.0" - } - - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertTrue(platform.isCommon) - } - - val rootManager = ModuleRootManager.getInstance(getModule("project")) - val stdlib = rootManager.orderEntries.filterIsInstance().first().library - assertEquals(CommonLibraryKind, (stdlib as LibraryEx).kind) - } - - @Test - fun testCommonImportByPlatformPlugin_SingleModule() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - jcenter() - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-common' - - repositories { - mavenCentral() - jcenter() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-common:1.1.0" - } - - """ - ) - importProjectUsingSingeModulePerGradleProject() - - with(facetSettings("project")) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertTrue(platform.isCommon) - } - - val rootManager = ModuleRootManager.getInstance(getModule("project")) - rootManager.orderEntries.filterIsInstance().mapTo(HashSet()) { it.library }.first { - (it as LibraryEx).kind == CommonLibraryKind - } - } - - @Test - fun testJvmImportByKotlinPlugin() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin' - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertEquals(JvmIdePlatformKind.Platform(JvmTarget.JVM_1_6), platform) - } - } - - @Test - fun testJsImportByKotlin2JsPlugin() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin2js' - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertTrue(platform.isJavaScript) - } - } - - @Test - fun testArgumentEscaping() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-jvm' - - compileKotlin { - kotlinOptions.freeCompilerArgs = ["-module", "module with spaces"] - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals( - listOf("-Xbuild-file=module with spaces"), - compilerSettings!!.additionalArgumentsAsList - ) - } - } - - @Test - fun testNoPluginsInAdditionalArgs() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.10") - classpath("org.jetbrains.kotlin:kotlin-allopen:1.2.10") - } - } - - apply plugin: 'kotlin' - apply plugin: "kotlin-spring" - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals( - "-version", - compilerSettings!!.additionalArguments - ) - Assert.assertEquals( - listOf( - "plugin:org.jetbrains.kotlin.allopen:annotation=org.springframework.stereotype.Component", - "plugin:org.jetbrains.kotlin.allopen:annotation=org.springframework.transaction.annotation.Transactional", - "plugin:org.jetbrains.kotlin.allopen:annotation=org.springframework.scheduling.annotation.Async", - "plugin:org.jetbrains.kotlin.allopen:annotation=org.springframework.cache.annotation.Cacheable", - "plugin:org.jetbrains.kotlin.allopen:annotation=org.springframework.boot.test.context.SpringBootTest", - "plugin:org.jetbrains.kotlin.allopen:annotation=org.springframework.validation.annotation.Validated" - ), - compilerArguments!!.pluginOptions!!.toList() - ) - } - } - - @Test - fun testNoArgInvokeInitializers() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.10") - classpath("org.jetbrains.kotlin:kotlin-noarg:1.2.10") - } - } - - apply plugin: 'kotlin' - apply plugin: "kotlin-noarg" - - noArg { - invokeInitializers = true - annotation("NoArg") - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals( - "-version", - compilerSettings!!.additionalArguments - ) - Assert.assertEquals( - listOf( - "plugin:org.jetbrains.kotlin.noarg:annotation=NoArg", - "plugin:org.jetbrains.kotlin.noarg:invokeInitializers=true" - ), - compilerArguments!!.pluginOptions!!.toList() - ) - } - } - - @Test - fun testAndroidGradleJsDetection() { - createProjectSubFile( - "android-module/build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - jcenter() - } - dependencies { - classpath "com.android.tools.build:gradle:2.3.0" - } - } - - apply plugin: 'com.android.application' - - android { - compileSdkVersion 26 - buildToolsVersion "23.0.1" - - defaultConfig { - minSdkVersion 11 - targetSdkVersion 23 - versionCode 1002003 - versionName version - } - - dataBinding { - enabled = true - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - } - - buildTypes { - debug { - applicationIdSuffix ".debug" - versionNameSuffix "-debug" - } - release { - minifyEnabled true - shrinkResources true - } - } - } - """ - ) - createProjectSubFile( - "android-module/src/main/AndroidManifest.xml", """ - - - """ - ) - createProjectSubFile( - "js-module/build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-dev' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-eap-44") - } - } - - apply plugin: 'kotlin2js' - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:1.1.0" - } - """ - ) - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenLocal() - maven { - url='https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - jcenter() - } - dependencies { - classpath "com.android.tools.build:gradle:2.3.0" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0" - } - } - - ext { - androidBuildToolsVersion = '23.0.1' - } - - allprojects { - repositories { - mavenLocal() - maven { - url='https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - jcenter() - } - } - """ - ) - createProjectSubFile( - "settings.gradle", """ - rootProject.name = "android-js-test" - include ':android-module' - include ':js-module' - """ - ) - createProjectSubFile( - "local.properties", """ - sdk.dir=/${KotlinTestUtils.getAndroidSdkSystemIndependentPath()} - """ - ) - importProject() - - with(facetSettings("js-module")) { - Assert.assertTrue(platform.isJavaScript) - } - - val rootManager = ModuleRootManager.getInstance(getModule("js-module")) - val stdlib = rootManager - .orderEntries - .filterIsInstance() - .first { it.libraryName?.startsWith("kotlin-stdlib-js-") ?: false } - .library!! - assertTrue(stdlib.getFiles(OrderRootType.CLASSES).isNotEmpty()) - assertEquals(JSLibraryKind, (stdlib as LibraryEx).kind) - } - - @Test - fun testKotlinAndroidPluginDetection() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - jcenter() - maven { - url='https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - dependencies { - classpath "com.android.tools.build:gradle:2.3.0" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0" - } - } - - apply plugin: 'com.android.application' - apply plugin: 'kotlin-android' - - android { - compileSdkVersion 26 - buildToolsVersion "23.0.1" - - defaultConfig { - minSdkVersion 11 - targetSdkVersion 23 - versionCode 1002003 - versionName version - } - - dataBinding { - enabled = true - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - } - - buildTypes { - debug { - applicationIdSuffix ".debug" - versionNameSuffix "-debug" - } - release { - minifyEnabled true - shrinkResources true - } - } - } - """ - ) - createProjectSubFile( - "local.properties", """ - sdk.dir=/${KotlinTestUtils.getAndroidSdkSystemIndependentPath()} - """ - ) - createProjectSubFile( - "src/main/AndroidManifest.xml", """ - - - """ - ) - importProject() - - Assert.assertNotNull(KotlinFacet.get(getModule("project"))) - } - - @Test - fun testNoFacetInModuleWithoutKotlinPlugin() { - createProjectSubFile( - "build.gradle", """ - group 'gr01' - version '1.0-SNAPSHOT' - - apply plugin: 'java' - apply plugin: 'kotlin' - - sourceCompatibility = 1.8 - - repositories { - mavenCentral() - } - - buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.1" - } - } - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.1" - } - """ - ) - createProjectSubFile( - "settings.gradle", """ - rootProject.name = 'gr01' - include 'm1' - """ - ) - createProjectSubFile( - "m1/build.gradle", """ - group 'gr01' - version '1.0-SNAPSHOT' - - apply plugin: 'java' - - sourceCompatibility = 1.8 - - repositories { - mavenCentral() - } - - buildscript { - repositories { - mavenCentral() - } - } - dependencies { - testCompile group: 'junit', name: 'junit', version: '4.11' - } - """ - ) - importProject() - - Assert.assertNotNull(KotlinFacet.get(getModule("gr01"))) -// Assert.assertNotNull(KotlinFacet.get(getModule("gr01_test"))) - Assert.assertNull(KotlinFacet.get(getModule("m1"))) -// Assert.assertNull(KotlinFacet.get(getModule("m1_test"))) - } - - @Test - fun testClasspathWithDependenciesImport() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin' - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - compile "org.apache.logging.log4j:log4j-core:2.7" - } - - compileKotlin { - kotlinOptions.freeCompilerArgs += ["-cp", "tmp.jar"] - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("tmp.jar", (compilerArguments as K2JVMCompilerArguments).classpath) - } - } - - @Test - fun testDependenciesClasspathImport() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin' - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - compile "org.apache.logging.log4j:log4j-core:2.7" - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals(null, (compilerArguments as K2JVMCompilerArguments).classpath) - } - } - - @Test - fun testJDKImport() { - object : WriteAction() { - override fun run(result: Result) { - val jdk = JavaSdk.getInstance().createJdk("myJDK", "my/path/to/jdk") - ProjectJdkTable.getInstance().addJdk(jdk) - } - }.execute() - - try { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin' - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - compile "org.apache.logging.log4j:log4j-core:2.7" - } - - compileKotlin { - kotlinOptions.jdkHome = "my/path/to/jdk" - } - """ - ) - importProject() - - val moduleSDK = ModuleRootManager.getInstance(getModule("project")).sdk!! - Assert.assertTrue(moduleSDK.sdkType is JavaSdk) - Assert.assertEquals("myJDK", moduleSDK.name) - Assert.assertEquals("my/path/to/jdk", moduleSDK.homePath) - } finally { - object : WriteAction() { - override fun run(result: Result) { - val jdkTable = ProjectJdkTable.getInstance() - jdkTable.removeJdk(jdkTable.findJdk("myJDK")!!) - } - }.execute() - } - } - - @Test - fun testImplementsDependency() { - createProjectSubFile( - "build.gradle", - """ - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-common' - - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-common:1.1.0" - } - - """.trimIndent() - ) - createProjectSubFile( - "settings.gradle", - """ - rootProject.name = 'MultiTest' - include 'MultiTest-jvm', 'MultiTest-js' - """.trimIndent() - ) - createProjectSubFile( - "MultiTest-js/build.gradle", - """ - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-js' - - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:1.1.0" - implement project(":") - } - - """.trimIndent() - ) - createProjectSubFile( - "MultiTest-jvm/build.gradle", - """ - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-jvm' - - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - implement project(":") - } - - """.trimIndent() - ) - - importProject() -/* - Assert.assertEquals(listOf("MultiTest_main"), facetSettings("MultiTest-jvm_main").implementedModuleNames) - Assert.assertEquals(listOf("MultiTest_test"), facetSettings("MultiTest-jvm_test").implementedModuleNames) - Assert.assertEquals(listOf("MultiTest_main"), facetSettings("MultiTest-js_main").implementedModuleNames) - Assert.assertEquals(listOf("MultiTest_test"), facetSettings("MultiTest-js_test").implementedModuleNames) -*/ - } - - @Test - fun testImplementsDependencyWithCustomSourceSets() { - createProjectSubFile( - "build.gradle", - """ - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-common' - - sourceSets { - myMain { - kotlin { - srcDir 'src' - } - } - myTest { - kotlin { - srcDir 'test' - } - } - } - - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-common:1.1.0" - } - - """.trimIndent() - ) - createProjectSubFile( - "settings.gradle", - """ - rootProject.name = 'MultiTest' - include 'MultiTest-jvm', 'MultiTest-js' - """.trimIndent() - ) - createProjectSubFile( - "MultiTest-js/build.gradle", - """ - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-js' - - sourceSets { - myMain { - kotlin { - srcDir 'src' - } - } - myTest { - kotlin { - srcDir 'test' - } - } - } - - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:1.1.0" - implement project(":") - } - - """.trimIndent() - ) - createProjectSubFile( - "MultiTest-jvm/build.gradle", - """ - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-jvm' - - sourceSets { - myMain { - kotlin { - srcDir 'src' - } - } - myTest { - kotlin { - srcDir 'test' - } - } - } - - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - implement project(":") - } - - """.trimIndent() - ) - - importProject() -/* - Assert.assertEquals(listOf("MultiTest_myMain"), facetSettings("MultiTest-jvm_myMain").implementedModuleNames) - Assert.assertEquals(listOf("MultiTest_myTest"), facetSettings("MultiTest-jvm_myTest").implementedModuleNames) - Assert.assertEquals(listOf("MultiTest_myMain"), facetSettings("MultiTest-js_myMain").implementedModuleNames) - Assert.assertEquals(listOf("MultiTest_myTest"), facetSettings("MultiTest-js_myTest").implementedModuleNames) -*/ - } - - @Test - fun testAPIVersionExceedingLanguageVersion() { - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin' - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - } - - compileKotlin { - kotlinOptions.languageVersion = "1.1" - kotlinOptions.apiVersion = "1.2" - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - } - - assertAllModulesConfigured() - } - - @Test - fun testIgnoreProjectLanguageAndAPIVersion() { - KotlinCommonCompilerArgumentsHolder.getInstance(myProject).update { - languageVersion = "1.0" - apiVersion = "1.0" - } - - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin' - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - } - - assertAllModulesConfigured() - } - - @Test - fun testCommonArgumentsImport() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.2' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.0-rc-39") - } - } - - apply plugin: 'kotlin-platform-common' - - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-eap-1.2' - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-common:1.2.0-rc-39" - } - - compileKotlinCommon{ - kotlinOptions { - languageVersion = 1.1 - apiVersion = 1.0 - freeCompilerArgs += ["-cp", "my/classpath"] - freeCompilerArgs += ["-d", "my/destination"] - } - } - - compileTestKotlinCommon{ - kotlinOptions { - languageVersion = 1.1 - apiVersion = 1.0 - freeCompilerArgs += ["-cp", "my/test/classpath"] - freeCompilerArgs += ["-d", "my/test/destination"] - } - } - - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.0", apiLevel!!.versionString) - Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion) - Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion) - Assert.assertTrue(platform.isCommon) - Assert.assertEquals("my/classpath", (compilerArguments as K2MetadataCompilerArguments).classpath) - Assert.assertEquals("my/destination", (compilerArguments as K2MetadataCompilerArguments).destination) - } - - val rootManager = ModuleRootManager.getInstance(getModule("project")) - val libraries = rootManager.orderEntries.filterIsInstance() - assertTrue(libraries.all { (it.library as LibraryEx).effectiveKind(myProject) == CommonLibraryKind }) - - Assert.assertTrue(ModuleRootManager.getInstance(getModule("project")).sdk!!.sdkType is KotlinSdkType) - } - - @Test - fun testStableModuleNameWhileUsingGradle_JS() { - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.50") - } - } - - apply plugin: 'kotlin2js' - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.2.50" - } - - """ - ) - importProject() - - checkStableModuleName("project", "project", JsPlatform, isProduction = true) - checkStableModuleName("project", "project", JsPlatform, isProduction = false) - - assertAllModulesConfigured() - } - - @Test - fun testStableModuleNameWhileUsingGradle_JVM() { - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.50") - } - } - - apply plugin: 'kotlin' - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.2.50" - } - - compileKotlin { - kotlinOptions.languageVersion = "1.2" - } - """ - ) - importProject() - - checkStableModuleName("project", "project", JvmPlatform, isProduction = true) - checkStableModuleName("project", "project", JvmPlatform, isProduction = false) - - assertAllModulesConfigured() - } - - @Test - fun testNoFriendPathsAreShown() { - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-dev' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.70-eap-4") - } - } - - apply plugin: 'kotlin' - - repositories { - mavenCentral() - maven { - url 'http://dl.bintray.com/kotlin/kotlin-dev' - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.2.70-eap-4" - } - """ - ) - importProject() - - Assert.assertEquals( - "-version", - facetSettings.compilerSettings!!.additionalArguments - ) - - assertAllModulesConfigured() - } - - @Test - fun testSharedLanguageVersion() { - createProjectSubFile( - "build.gradle", - """ - buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.60") - } - } - - apply plugin: 'kotlin-platform-common' - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-common:1.2.60" - } - - """.trimIndent() - ) - createProjectSubFile( - "settings.gradle", - """ - rootProject.name = 'MultiTest' - include 'MultiTest-jvm', 'MultiTest-js' - """.trimIndent() - ) - createProjectSubFile( - "MultiTest-js/build.gradle", - """ - buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.60") - } - } - - apply plugin: 'kotlin-platform-js' - - sourceSets { - myMain { - kotlin { - srcDir 'src' - } - } - myTest { - kotlin { - srcDir 'test' - } - } - } - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:1.2.60" - implement project(":") - } - - """.trimIndent() - ) - createProjectSubFile( - "MultiTest-jvm/build.gradle", - """ - buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.60") - } - } - - apply plugin: 'kotlin-platform-jvm' - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.2.60" - implement project(":") - } - - """.trimIndent() - ) - - val holder = KotlinCommonCompilerArgumentsHolder.getInstance(myProject) - - holder.update { languageVersion = "1.1" } - - importProject() - - TestCase.assertEquals("1.2", holder.settings.languageVersion) - } - - @Test - fun testNonSharedLanguageVersion() { - createProjectSubFile( - "build.gradle", - """ - buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.60") - } - } - - apply plugin: 'kotlin-platform-common' - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-common:1.2.60" - } - - compileKotlinCommon { - kotlinOptions.languageVersion = "1.1" - } - - """.trimIndent() - ) - createProjectSubFile( - "settings.gradle", - """ - rootProject.name = 'MultiTest' - include 'MultiTest-jvm', 'MultiTest-js' - """.trimIndent() - ) - createProjectSubFile( - "MultiTest-js/build.gradle", - """ - buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.60") - } - } - - apply plugin: 'kotlin-platform-js' - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:1.2.60" - implement project(":") - } - - """.trimIndent() - ) - createProjectSubFile( - "MultiTest-jvm/build.gradle", - """ - buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.60") - } - } - - apply plugin: 'kotlin-platform-jvm' - - sourceSets { - myMain { - kotlin { - srcDir 'src' - } - } - myTest { - kotlin { - srcDir 'test' - } - } - } - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.2.60" - implement project(":") - } - - """.trimIndent() - ) - - val holder = KotlinCommonCompilerArgumentsHolder.getInstance(myProject) - - holder.update { languageVersion = "1.1" } - - importProject() - - TestCase.assertEquals("1.1", holder.settings.languageVersion) - } - - private fun checkStableModuleName(projectName: String, expectedName: String, platform: TargetPlatform, isProduction: Boolean) { - val module = getModule(projectName) - val moduleInfo = if (isProduction) module.productionSourceInfo() else module.testSourceInfo() - - val resolutionFacade = KotlinCacheService.getInstance(myProject).getResolutionFacadeByModuleInfo(moduleInfo!!, platform)!! - val moduleDescriptor = resolutionFacade.moduleDescriptor - - Assert.assertEquals("<$expectedName>", moduleDescriptor.stableName?.asString()) - } - - private fun assertAllModulesConfigured() { - runReadAction { - for (moduleGroup in ModuleSourceRootMap(myProject).groupByBaseModules(myProject.allModules())) { - val configurator = allConfigurators().find { - it.getStatus(moduleGroup) == ConfigureKotlinStatus.CAN_BE_CONFIGURED - } - Assert.assertNull("Configurator $configurator tells that ${moduleGroup.baseModule} can be configured", configurator) - } - } - } -} diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/framework/JavaRuntimePresentationProvider.java.as31 b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/framework/JavaRuntimePresentationProvider.java.as31 deleted file mode 100644 index dbd8b62a618..00000000000 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/framework/JavaRuntimePresentationProvider.java.as31 +++ /dev/null @@ -1,51 +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.idea.framework; - -import com.intellij.framework.library.LibraryVersionProperties; -import com.intellij.openapi.roots.libraries.LibraryPresentationProvider; -import com.intellij.openapi.roots.libraries.LibraryProperties; -import com.intellij.openapi.vfs.VirtualFile; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.idea.KotlinIcons; - -import javax.swing.*; -import java.util.List; - -public class JavaRuntimePresentationProvider extends LibraryPresentationProvider { - public static JavaRuntimePresentationProvider getInstance() { - return LibraryPresentationProvider.EP_NAME.findExtension(JavaRuntimePresentationProvider.class); - } - - protected JavaRuntimePresentationProvider() { - super(JavaRuntimeLibraryDescription.Companion.getKOTLIN_JAVA_RUNTIME_KIND()); - } - - @Nullable - @Override - public Icon getIcon(@Nullable LibraryVersionProperties properties) { - return KotlinIcons.SMALL_LOGO; - } - - @Nullable - @Override - public LibraryVersionProperties detect(@NotNull List classesRoots) { - String version = JavaRuntimeDetectionUtil.getJavaRuntimeVersion(classesRoots); - return version == null ? null : new LibraryVersionProperties(version); - } -} diff --git a/idea/idea-maven/build.gradle.kts.as31 b/idea/idea-maven/build.gradle.kts.as31 deleted file mode 100644 index 7d78a259b88..00000000000 --- a/idea/idea-maven/build.gradle.kts.as31 +++ /dev/null @@ -1,68 +0,0 @@ - -plugins { - kotlin("jvm") - id("jps-compatible") -} - -dependencies { - compile(project(":core:util.runtime")) - compile(project(":compiler:frontend")) - compile(project(":compiler:frontend.java")) - compile(project(":compiler:util")) - compile(project(":compiler:cli-common")) - compile(project(":kotlin-build-common")) - - compile(project(":js:js.frontend")) - - compile(project(":idea")) - compile(project(":idea:idea-jvm")) - compile(project(":idea:idea-jps-common")) - - compileOnly(intellijDep()) - excludeInAndroidStudio(rootProject) { compileOnly(intellijPluginDep("maven")) } - - testCompile(projectTests(":idea")) - testCompile(projectTests(":compiler:tests-common")) - testCompile(projectTests(":idea:idea-test-framework")) - - testCompileOnly(intellijDep()) - //testCompileOnly(intellijPluginDep("maven")) - - testCompile(project(":idea:idea-native")) { isTransitive = false } - testRuntime(project(":kotlin-native:kotlin-native-library-reader")) { isTransitive = false } - testRuntime(project(":kotlin-native:kotlin-native-utils")) { isTransitive = false } - - testRuntime(project(":kotlin-reflect")) - testRuntime(project(":idea:idea-jvm")) - testRuntime(project(":idea:idea-android")) - testRuntime(project(":plugins:android-extensions-ide")) - testRuntime(project(":plugins:lint")) - testRuntime(project(":sam-with-receiver-ide-plugin")) - testRuntime(project(":allopen-ide-plugin")) - testRuntime(project(":noarg-ide-plugin")) - testRuntime(project(":kotlin-scripting-idea")) - testRuntime(project(":kotlinx-serialization-ide-plugin")) - - testRuntime(intellijDep()) - // TODO: the order of the plugins matters here, consider avoiding order-dependency - testRuntime(intellijPluginDep("junit")) - testRuntime(intellijPluginDep("testng")) - testRuntime(intellijPluginDep("properties")) - testRuntime(intellijPluginDep("gradle")) - testRuntime(intellijPluginDep("Groovy")) - testRuntime(intellijPluginDep("coverage")) - //testRuntime(intellijPluginDep("maven")) - testRuntime(intellijPluginDep("android")) - testRuntime(intellijPluginDep("smali")) -} - -sourceSets { - "main" { /*projectDefault()*/ } - "test" { /*projectDefault()*/ } -} - -testsJar() - -projectTest { - workingDir = rootDir -} diff --git a/idea/idea-maven/testData/languageFeature/enableCoroutines/pom.xml.after.as31 b/idea/idea-maven/testData/languageFeature/enableCoroutines/pom.xml.after.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-maven/testData/languageFeature/enableCoroutines/pom.xml.as31 b/idea/idea-maven/testData/languageFeature/enableCoroutines/pom.xml.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-maven/testData/languageFeature/enableCoroutines/src.kt.as31 b/idea/idea-maven/testData/languageFeature/enableCoroutines/src.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-maven/testData/languageFeature/updateApiVersion/pom.xml.after.as31 b/idea/idea-maven/testData/languageFeature/updateApiVersion/pom.xml.after.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-maven/testData/languageFeature/updateApiVersion/pom.xml.as31 b/idea/idea-maven/testData/languageFeature/updateApiVersion/pom.xml.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-maven/testData/languageFeature/updateApiVersion/src.kt.as31 b/idea/idea-maven/testData/languageFeature/updateApiVersion/src.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-maven/testData/languageFeature/updateLanguageAndApiVersion/pom.xml.after.as31 b/idea/idea-maven/testData/languageFeature/updateLanguageAndApiVersion/pom.xml.after.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-maven/testData/languageFeature/updateLanguageAndApiVersion/pom.xml.as31 b/idea/idea-maven/testData/languageFeature/updateLanguageAndApiVersion/pom.xml.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-maven/testData/languageFeature/updateLanguageAndApiVersion/src.kt.as31 b/idea/idea-maven/testData/languageFeature/updateLanguageAndApiVersion/src.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-maven/testData/languageFeature/updateLanguageVersion/pom.xml.after.as31 b/idea/idea-maven/testData/languageFeature/updateLanguageVersion/pom.xml.after.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-maven/testData/languageFeature/updateLanguageVersion/pom.xml.as31 b/idea/idea-maven/testData/languageFeature/updateLanguageVersion/pom.xml.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-maven/testData/languageFeature/updateLanguageVersion/src.kt.as31 b/idea/idea-maven/testData/languageFeature/updateLanguageVersion/src.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-maven/testData/languageFeature/updateLanguageVersionProperty/pom.xml.after.as31 b/idea/idea-maven/testData/languageFeature/updateLanguageVersionProperty/pom.xml.after.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-maven/testData/languageFeature/updateLanguageVersionProperty/pom.xml.as31 b/idea/idea-maven/testData/languageFeature/updateLanguageVersionProperty/pom.xml.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-maven/testData/languageFeature/updateLanguageVersionProperty/src.kt.as31 b/idea/idea-maven/testData/languageFeature/updateLanguageVersionProperty/src.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/kotlin-gradle-tooling/build.gradle.kts.as31 b/idea/kotlin-gradle-tooling/build.gradle.kts.as31 deleted file mode 100644 index 1b609295537..00000000000 --- a/idea/kotlin-gradle-tooling/build.gradle.kts.as31 +++ /dev/null @@ -1,25 +0,0 @@ - -description = "Kotlin Gradle Tooling support" - -plugins { - kotlin("jvm") - id("jps-compatible") -} - -jvmTarget = "1.6" - -dependencies { - compile(project(":kotlin-stdlib")) - compile(project(":compiler:cli-common")) - compile(intellijPluginDep("gradle")) - compileOnly(intellijDep()) { includeJars("slf4j-api-1.7.10") } -} - -sourceSets { - "main" { projectDefault() } - "test" {} -} - -runtimeJar() - -ideaPlugin() diff --git a/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt.as31 b/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt.as31 deleted file mode 100644 index 39db8ee8983..00000000000 --- a/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt.as31 +++ /dev/null @@ -1,434 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.gradle - -import org.gradle.api.Named -import org.gradle.api.NamedDomainObjectContainer -import org.gradle.api.Project -import org.gradle.api.Task -import org.gradle.api.artifacts.Configuration -import org.gradle.api.artifacts.Dependency -import org.gradle.api.artifacts.component.ProjectComponentIdentifier -import org.gradle.api.file.FileCollection -import org.gradle.api.file.SourceDirectorySet -import org.gradle.api.logging.Logging -import org.jetbrains.plugins.gradle.model.* -import org.jetbrains.plugins.gradle.tooling.ErrorMessageBuilder -import org.jetbrains.plugins.gradle.tooling.ModelBuilderService -import org.jetbrains.plugins.gradle.tooling.util.DependencyResolver -import org.jetbrains.plugins.gradle.tooling.util.DependencyResolverImpl -import org.jetbrains.plugins.gradle.tooling.util.SourceSetCachedFinder -import java.io.File -import java.lang.reflect.Method - -class KotlinMPPGradleModelBuilder : ModelBuilderService { - override fun getErrorMessageBuilder(project: Project, e: Exception): ErrorMessageBuilder { - return ErrorMessageBuilder - .create(project, e, "Gradle import errors") - .withDescription("Unable to build Kotlin project configuration") - } - - override fun canBuild(modelName: String?): Boolean { - return modelName == KotlinMPPGradleModel::class.java.name - } - - override fun buildAll(modelName: String, project: Project): Any? { - val dependencyResolver = DependencyResolverImpl( - project, - false, - false, - true, - SourceSetCachedFinder(project) - ) - val sourceSets = buildSourceSets(dependencyResolver, project) ?: return null - val sourceSetMap = sourceSets.map { it.name to it }.toMap() - val targets = buildTargets(sourceSetMap, dependencyResolver, project) ?: return null - computeSourceSetsDeferredInfo(sourceSets, targets) - val coroutinesState = getCoroutinesState(project) - reportUnresolvedDependencies(targets) - return KotlinMPPGradleModelImpl(sourceSetMap, targets, ExtraFeaturesImpl(coroutinesState)) - } - - private fun reportUnresolvedDependencies(targets: Collection) { - targets - .asSequence() - .flatMap { it.compilations.asSequence() } - .flatMap { it.dependencies.asSequence() } - .mapNotNull { (it as? UnresolvedExternalDependency)?.failureMessage } - .toSet() - .forEach { logger.warn(it) } - } - - private fun getCoroutinesState(project: Project): String? { - val kotlinExt = project.extensions.findByName("kotlin") ?: return null - val getExperimental = kotlinExt.javaClass.getMethodOrNull("getExperimental") ?: return null - val experimentalExt = getExperimental(kotlinExt) ?: return null - val getCoroutines = experimentalExt.javaClass.getMethodOrNull("getCoroutines") ?: return null - return getCoroutines(experimentalExt) as? String - } - - private fun buildSourceSets(dependencyResolver: DependencyResolver, project: Project): Collection? { - val kotlinExt = project.extensions.findByName("kotlin") ?: return null - val getSourceSets = kotlinExt.javaClass.getMethodOrNull("getSourceSets") ?: return null - @Suppress("UNCHECKED_CAST") - val sourceSets = - (getSourceSets(kotlinExt) as? NamedDomainObjectContainer)?.asMap?.values ?: emptyList() - return sourceSets.mapNotNull { buildSourceSet(it, dependencyResolver, project) } - } - - private fun buildSourceSet( - gradleSourceSet: Named, - dependencyResolver: DependencyResolver, - project: Project - ): KotlinSourceSetImpl? { - val sourceSetClass = gradleSourceSet.javaClass - val getLanguageSettings = sourceSetClass.getMethodOrNull("getLanguageSettings") ?: return null - val getSourceDirSet = sourceSetClass.getMethodOrNull("getKotlin") ?: return null - val getResourceDirSet = sourceSetClass.getMethodOrNull("getResources") ?: return null - val getDependsOn = sourceSetClass.getMethodOrNull("getDependsOn") ?: return null - val languageSettings = getLanguageSettings(gradleSourceSet)?.let { buildLanguageSettings(it) } ?: return null - val sourceDirs = (getSourceDirSet(gradleSourceSet) as? SourceDirectorySet)?.srcDirs ?: emptySet() - val resourceDirs = (getResourceDirSet(gradleSourceSet) as? SourceDirectorySet)?.srcDirs ?: emptySet() - val dependencies = buildSourceSetDependencies(gradleSourceSet, dependencyResolver, project) - @Suppress("UNCHECKED_CAST") - val dependsOnSourceSets = (getDependsOn(gradleSourceSet) as? Set)?.mapTo(LinkedHashSet()) { it.name } ?: emptySet() - return KotlinSourceSetImpl(gradleSourceSet.name, languageSettings, sourceDirs, resourceDirs, dependencies, dependsOnSourceSets) - } - - private fun buildLanguageSettings(gradleLanguageSettings: Any): KotlinLanguageSettings? { - val languageSettingsClass = gradleLanguageSettings.javaClass - val getLanguageVersion = languageSettingsClass.getMethodOrNull("getLanguageVersion") ?: return null - val getApiVersion = languageSettingsClass.getMethodOrNull("getApiVersion") ?: return null - val getProgressiveMode = languageSettingsClass.getMethodOrNull("getProgressiveMode") ?: return null - val getEnabledLanguageFeatures = languageSettingsClass.getMethodOrNull("getEnabledLanguageFeatures") ?: return null - val getExperimentalAnnotationsInUse = languageSettingsClass.getMethodOrNull("getExperimentalAnnotationsInUse") - val getCompilerPluginArguments = languageSettingsClass.getMethodOrNull("getCompilerPluginArguments") - val getCompilerPluginClasspath = languageSettingsClass.getMethodOrNull("getCompilerPluginClasspath") - @Suppress("UNCHECKED_CAST") - return KotlinLanguageSettingsImpl( - getLanguageVersion(gradleLanguageSettings) as? String, - getApiVersion(gradleLanguageSettings) as? String, - getProgressiveMode(gradleLanguageSettings) as? Boolean ?: false, - getEnabledLanguageFeatures(gradleLanguageSettings) as? Set ?: emptySet(), - getExperimentalAnnotationsInUse?.invoke(gradleLanguageSettings) as? Set ?: emptySet(), - getCompilerPluginArguments?.invoke(gradleLanguageSettings) as? List ?: emptyList(), - (getCompilerPluginClasspath?.invoke(gradleLanguageSettings) as? FileCollection)?.files ?: emptySet() - ) - } - - private fun buildDependencies( - dependencyHolder: Any, - dependencyResolver: DependencyResolver, - configurationNameAccessor: String, - scope: String, - project: Project - ): Collection { - val dependencyHolderClass = dependencyHolder.javaClass - val getConfigurationName = dependencyHolderClass.getMethodOrNull(configurationNameAccessor) ?: return emptyList() - val configurationName = getConfigurationName(dependencyHolder) as? String ?: return emptyList() - val configuration = project.configurations.findByName(configurationName) ?: return emptyList() - if (!configuration.isCanBeResolved) return emptyList() - - val dependencyAdjuster = DependencyAdjuster(configuration, scope, project) - - val resolvedDependencies = dependencyResolver - .resolveDependencies(configuration) - .apply { - forEach { (it as? AbstractExternalDependency)?.scope = scope } - } - .flatMap(dependencyAdjuster::adjustDependency) - val singleDependencyFiles = resolvedDependencies.mapNotNullTo(LinkedHashSet()) { - (it as? FileCollectionDependency)?.files?.singleOrNull() - } - // Workaround for duplicated dependencies specified as a file collection (KT-26675) - // Drop this code when the issue is fixed in the platform - return resolvedDependencies.filter { dependency -> - if (dependency !is FileCollectionDependency) return@filter true - val files = dependency.files - if (files.size <= 1) return@filter true - (files.any { it !in singleDependencyFiles }) - } - } - - private fun buildTargets( - sourceSetMap: Map, - dependencyResolver: DependencyResolver, - project: Project - ): Collection? { - return project.getTargets()?.mapNotNull { buildTarget(it, sourceSetMap, dependencyResolver, project) } - } - - private fun buildTarget( - gradleTarget: Named, - sourceSetMap: Map, - dependencyResolver: DependencyResolver, - project: Project - ): KotlinTarget? { - val targetClass = gradleTarget.javaClass - val getPlatformType = targetClass.getMethodOrNull("getPlatformType") ?: return null - val getCompilations = targetClass.getMethodOrNull("getCompilations") ?: return null - val getDisambiguationClassifier = targetClass.getMethodOrNull("getDisambiguationClassifier") ?: return null - val platformId = (getPlatformType.invoke(gradleTarget) as? Named)?.name ?: return null - val platform = KotlinPlatform.byId(platformId) ?: return null - val disambiguationClassifier = getDisambiguationClassifier(gradleTarget) as? String - @Suppress("UNCHECKED_CAST") - val gradleCompilations = - (getCompilations.invoke(gradleTarget) as? NamedDomainObjectContainer)?.asMap?.values ?: emptyList() - val compilations = gradleCompilations.mapNotNull { - buildCompilation(it, disambiguationClassifier, sourceSetMap, dependencyResolver, project) - } - val jar = buildTargetJar(gradleTarget, project) - val target = KotlinTargetImpl(gradleTarget.name, null, disambiguationClassifier, platform, compilations, jar) - compilations.forEach { it.target = target } - return target - } - - private fun buildTargetJar(gradleTarget: Named, project: Project): KotlinTargetJar? { - val targetClass = gradleTarget.javaClass - val getArtifactsTaskName = targetClass.getMethodOrNull("getArtifactsTaskName") ?: return null - val artifactsTaskName = getArtifactsTaskName(gradleTarget) as? String ?: return null - val jarTask = project.tasks.findByName(artifactsTaskName) ?: return null - val jarTaskClass = jarTask.javaClass - val getArchivePath = jarTaskClass.getMethodOrNull("getArchivePath") - val archiveFile = getArchivePath?.invoke(jarTask) as? File? - return KotlinTargetJarImpl(archiveFile) - } - - private fun buildCompilation( - gradleCompilation: Named, - classifier: String?, - sourceSetMap: Map, - dependencyResolver: DependencyResolver, - project: Project - ): KotlinCompilationImpl? { - val compilationClass = gradleCompilation.javaClass - val getKotlinSourceSets = compilationClass.getMethodOrNull("getKotlinSourceSets") ?: return null - @Suppress("UNCHECKED_CAST") - val kotlinGradleSourceSets = (getKotlinSourceSets(gradleCompilation) as? Collection) ?: return null - val kotlinSourceSets = kotlinGradleSourceSets.mapNotNull { sourceSetMap[it.name] } - val getCompileKotlinTaskName = compilationClass.getMethodOrNull("getCompileKotlinTaskName") ?: return null - @Suppress("UNCHECKED_CAST") - val compileKotlinTaskName = (getCompileKotlinTaskName(gradleCompilation) as? String) ?: return null - val compileKotlinTask = project.tasks.findByName(compileKotlinTaskName) ?: return null - val output = buildCompilationOutput(gradleCompilation, compileKotlinTask) ?: return null - val arguments = buildCompilationArguments(compileKotlinTask) ?: return null - val dependencyClasspath = buildDependencyClasspath(compileKotlinTask) - val dependencies = buildCompilationDependencies(gradleCompilation, classifier, sourceSetMap, dependencyResolver, project) - return KotlinCompilationImpl(gradleCompilation.name, kotlinSourceSets, dependencies, output, arguments, dependencyClasspath) - } - - private fun buildCompilationDependencies( - gradleCompilation: Named, - classifier: String?, - sourceSetMap: Map, - dependencyResolver: DependencyResolver, - project: Project - ): Set { - return LinkedHashSet().apply { - this += buildDependencies( - gradleCompilation, dependencyResolver, "getCompileDependencyConfigurationName", "COMPILE", project - ) - this += buildDependencies( - gradleCompilation, dependencyResolver, "getRuntimeDependencyConfigurationName", "RUNTIME", project - ) - this += sourceSetMap[compilationFullName(gradleCompilation.name, classifier)]?.dependencies ?: emptySet() - } - } - - private fun buildSourceSetDependencies( - gradleSourceSet: Named, - dependencyResolver: DependencyResolver, - project: Project - ): Set { - return LinkedHashSet().apply { - this += buildDependencies( - gradleSourceSet, dependencyResolver, "getApiMetadataConfigurationName", "COMPILE", project - ) - this += buildDependencies( - gradleSourceSet, dependencyResolver, "getImplementationMetadataConfigurationName", "COMPILE", project - ) - this += buildDependencies( - gradleSourceSet, dependencyResolver, "getCompileOnlyMetadataConfigurationName", "COMPILE", project - ) - this += buildDependencies( - gradleSourceSet, dependencyResolver, "getRuntimeOnlyMetadataConfigurationName", "RUNTIME", project - ) - } - } - - @Suppress("UNCHECKED_CAST") - private fun safelyGetArguments(compileKotlinTask: Task, accessor: Method?) = try { - accessor?.invoke(compileKotlinTask) as? List - } catch (e: Exception) { - logger.info(e.message, e) - null - } ?: emptyList() - - private fun buildCompilationArguments(compileKotlinTask: Task): KotlinCompilationArguments? { - val compileTaskClass = compileKotlinTask.javaClass - val getCurrentArguments = compileTaskClass.getMethodOrNull("getSerializedCompilerArguments") - val getDefaultArguments = compileTaskClass.getMethodOrNull("getDefaultSerializedCompilerArguments") - val currentArguments = safelyGetArguments(compileKotlinTask, getCurrentArguments) - val defaultArguments = safelyGetArguments(compileKotlinTask, getDefaultArguments) - return KotlinCompilationArgumentsImpl(defaultArguments, currentArguments) - } - - private fun buildDependencyClasspath(compileKotlinTask: Task): List { - val abstractKotlinCompileClass = - compileKotlinTask.javaClass.classLoader.loadClass(AbstractKotlinGradleModelBuilder.ABSTRACT_KOTLIN_COMPILE_CLASS) - val getCompileClasspath = - abstractKotlinCompileClass.getDeclaredMethodOrNull("getCompileClasspath") ?: return emptyList() - @Suppress("UNCHECKED_CAST") - return (getCompileClasspath(compileKotlinTask) as? Collection)?.map { it.path } ?: emptyList() - } - - private fun buildCompilationOutput( - gradleCompilation: Named, - compileKotlinTask: Task - ): KotlinCompilationOutput? { - val compilationClass = gradleCompilation.javaClass - val getOutput = compilationClass.getMethodOrNull("getOutput") ?: return null - val gradleOutput = getOutput(gradleCompilation) ?: return null - val gradleOutputClass = gradleOutput.javaClass - val getClassesDirs = gradleOutputClass.getMethodOrNull("getClassesDirs") ?: return null - val getResourcesDir = gradleOutputClass.getMethodOrNull("getResourcesDir") ?: return null - val compileKotlinTaskClass = compileKotlinTask.javaClass - val getDestinationDir = compileKotlinTaskClass.getMethodOrNull("getDestinationDir") ?: return null - val classesDirs = getClassesDirs(gradleOutput) as? FileCollection ?: return null - val resourcesDir = getResourcesDir(gradleOutput) as? File ?: return null - val destinationDir = getDestinationDir(compileKotlinTask) as? File - return KotlinCompilationOutputImpl(classesDirs.files, destinationDir, resourcesDir) - } - - private fun computeSourceSetsDeferredInfo( - sourceSets: Collection, - targets: Collection - ) { - val sourceSetToCompilations = LinkedHashMap>() - for (target in targets) { - for (compilation in target.compilations) { - for (sourceSet in compilation.sourceSets) { - sourceSetToCompilations.getOrPut(sourceSet) { LinkedHashSet() } += compilation - } - } - } - for (sourceSet in sourceSets) { - val name = sourceSet.name - if (name == KotlinSourceSet.COMMON_MAIN_SOURCE_SET_NAME) { - sourceSet.platform = KotlinPlatform.COMMON - sourceSet.isTestModule = false - continue - } - if (name == KotlinSourceSet.COMMON_TEST_SOURCE_SET_NAME) { - sourceSet.platform = KotlinPlatform.COMMON - sourceSet.isTestModule = true - continue - } - - val compilations = sourceSetToCompilations[sourceSet] - if (compilations != null) { - sourceSet.platform = compilations.map { it.platform }.distinct().singleOrNull() ?: KotlinPlatform.COMMON - sourceSet.isTestModule = compilations.all { it.isTestModule } - } else { - // TODO: change me after design about it - sourceSet.isTestModule = "Test" in sourceSet.name - } - } - } - - private class DependencyAdjuster( - private val configuration: Configuration, - private val scope: String, - private val project: Project - ) { - private val adjustmentMap = HashMap>() - - val dependenciesByProjectPath by lazy { - configuration - .resolvedConfiguration - .lenientConfiguration - .allModuleDependencies - .mapNotNull { dependency -> - val artifact = dependency.moduleArtifacts.firstOrNull { - it.id.componentIdentifier is ProjectComponentIdentifier - } ?: return@mapNotNull null - dependency to artifact - } - .groupBy { (it.second.id.componentIdentifier as ProjectComponentIdentifier).projectPath } - } - - private fun wrapDependency(dependency: ExternalProjectDependency, newConfigurationName: String): ExternalProjectDependency { - return DefaultExternalProjectDependency(dependency).apply { - this.configurationName = newConfigurationName - - val nestedDependencies = this.dependencies.flatMap(::adjustDependency) - this.dependencies.clear() - this.dependencies.addAll(nestedDependencies) - } - } - - fun adjustDependency(dependency: ExternalDependency): List { - return adjustmentMap.getOrPut(dependency) { - if (dependency !is ExternalProjectDependency - || dependency.configurationName != Dependency.DEFAULT_CONFIGURATION - ) return@getOrPut listOf(dependency) - val artifacts = dependenciesByProjectPath[dependency.projectPath] ?: return@getOrPut listOf(dependency) - val artifactConfiguration = artifacts.mapTo(LinkedHashSet()) { - it.first.configuration - }.singleOrNull() ?: return@getOrPut listOf(dependency) - val taskGetterName = when (scope) { - "COMPILE" -> "getApiElementsConfigurationName" - "RUNTIME" -> "getRuntimeElementsConfigurationName" - else -> return@getOrPut listOf(dependency) - } - val dependencyProject = - if (project.rootProject.path == dependency.projectPath) - project.rootProject - else - project.rootProject.getChildProjectByPath(dependency.projectPath) - - val targets = dependencyProject?.getTargets() ?: return@getOrPut listOf(dependency) - val gradleTarget = targets.firstOrNull { - val getter = it.javaClass.getMethodOrNull(taskGetterName) ?: return@firstOrNull false - getter(it) == artifactConfiguration - } ?: return@getOrPut listOf(dependency) - val classifier = gradleTarget.javaClass.getMethodOrNull("getDisambiguationClassifier")?.invoke(gradleTarget) as? String - ?: return@getOrPut listOf(dependency) - val platformDependency = if (classifier != KotlinTarget.METADATA_TARGET_NAME) { - wrapDependency(dependency, compilationFullName(KotlinCompilation.MAIN_COMPILATION_NAME, classifier)) - } else null - val commonDependency = wrapDependency(dependency, KotlinSourceSet.COMMON_MAIN_SOURCE_SET_NAME) - return if (platformDependency != null) listOf(platformDependency, commonDependency) else listOf(commonDependency) - } - } - } - - companion object { - private val logger = Logging.getLogger(KotlinMPPGradleModelBuilder::class.java) - - fun Project.getTargets(): Collection? { - val kotlinExt = project.extensions.findByName("kotlin") ?: return null - val getTargets = kotlinExt.javaClass.getMethodOrNull("getTargets") ?: return null - @Suppress("UNCHECKED_CAST") - return (getTargets.invoke(kotlinExt) as? NamedDomainObjectContainer)?.asMap?.values ?: emptyList() - } - } -} - -private fun Project.getChildProjectByPath(path: String): Project? { - var project = this - for (name in path.split(":").asSequence().drop(1)) { - project = project.childProjects[name] ?: return null - } - return project -} - -private fun Project.getTargets(): Collection? { - val kotlinExt = project.extensions.findByName("kotlin") ?: return null - val getTargets = kotlinExt.javaClass.getMethodOrNull("getTargets") ?: return null - @Suppress("UNCHECKED_CAST") - return (getTargets.invoke(kotlinExt) as? NamedDomainObjectContainer)?.asMap?.values ?: emptyList() -} \ No newline at end of file diff --git a/idea/resources/META-INF/android-lint.xml.as31 b/idea/resources/META-INF/android-lint.xml.as31 deleted file mode 100644 index 5a029687008..00000000000 --- a/idea/resources/META-INF/android-lint.xml.as31 +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/idea/resources/META-INF/android.xml.as31 b/idea/resources/META-INF/android.xml.as31 deleted file mode 100644 index db057088f3e..00000000000 --- a/idea/resources/META-INF/android.xml.as31 +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - - - - - - - - - - org.jetbrains.kotlin.android.intention.KotlinAndroidAddStringResource - Kotlin Android - - - - - - org.jetbrains.kotlin.android.intention.AddActivityToManifest - Kotlin Android - - - - org.jetbrains.kotlin.android.intention.AddServiceToManifest - Kotlin Android - - - - org.jetbrains.kotlin.android.intention.AddBroadcastReceiverToManifest - Kotlin Android - - - org.jetbrains.kotlin.android.intention.ImplementParcelableAction - Kotlin Android - - - - org.jetbrains.kotlin.android.intention.RemoveParcelableAction - Kotlin Android - - - - org.jetbrains.kotlin.android.intention.RedoParcelableAction - Kotlin Android - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/idea/resources/META-INF/plugin.xml.as31 b/idea/resources/META-INF/plugin.xml.as31 deleted file mode 100644 index 8b48d742c15..00000000000 --- a/idea/resources/META-INF/plugin.xml.as31 +++ /dev/null @@ -1,73 +0,0 @@ - - org.jetbrains.kotlin - - Kotlin - -Getting Started in IntelliJ IDEA
-Getting Started in Android Studio
-Public Slack
-Issue tracker
-]]>
- @snapshot@ - JetBrains - - - - com.intellij.modules.platform - com.intellij.modules.androidstudio - - - org.jetbrains.kotlin.native.platform.deps - - JUnit - org.jetbrains.plugins.gradle - org.jetbrains.idea.maven - TestNG-J - com.intellij.copyright - org.jetbrains.android - Coverage - com.intellij.java-i18n - org.intellij.intelliLang - org.jetbrains.java.decompiler - Git4Idea - - - - - com.intellij.modules.java - JavaScriptDebugger - - - - - - - - - - - - - - - - org.jetbrains.kotlin.idea.caches.ProjectRootModificationTrackerFixer - - - - - - - - - - - - - - -
diff --git a/idea/src/org/jetbrains/kotlin/idea/actions/JavaToKotlinAction.kt.as31 b/idea/src/org/jetbrains/kotlin/idea/actions/JavaToKotlinAction.kt.as31 deleted file mode 100644 index d8b581545c8..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/actions/JavaToKotlinAction.kt.as31 +++ /dev/null @@ -1,237 +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.idea.actions - -import com.intellij.codeInsight.navigation.NavigationUtil -import com.intellij.ide.highlighter.JavaFileType -import com.intellij.ide.scratch.ScratchFileService -import com.intellij.ide.scratch.ScratchRootType -import com.intellij.openapi.actionSystem.AnAction -import com.intellij.openapi.actionSystem.AnActionEvent -import com.intellij.openapi.actionSystem.CommonDataKeys -import com.intellij.openapi.command.CommandProcessor -import com.intellij.openapi.fileEditor.FileDocumentManager -import com.intellij.openapi.fileEditor.FileEditorManager -import com.intellij.openapi.progress.ProgressManager -import com.intellij.openapi.project.Project -import com.intellij.openapi.ui.MessageType -import com.intellij.openapi.ui.Messages -import com.intellij.openapi.ui.ex.MessagesEx -import com.intellij.openapi.ui.popup.JBPopupFactory -import com.intellij.openapi.vfs.VfsUtilCore -import com.intellij.openapi.vfs.VirtualFile -import com.intellij.openapi.vfs.VirtualFileVisitor -import com.intellij.openapi.wm.WindowManager -import com.intellij.psi.PsiDocumentManager -import com.intellij.psi.PsiErrorElement -import com.intellij.psi.PsiJavaFile -import com.intellij.psi.PsiManager -import com.intellij.psi.util.PsiTreeUtil -import org.jetbrains.kotlin.idea.KotlinFileType -import org.jetbrains.kotlin.idea.j2k.IdeaJavaToKotlinServices -import org.jetbrains.kotlin.idea.j2k.J2kPostProcessor -import org.jetbrains.kotlin.idea.refactoring.toPsiFile -import org.jetbrains.kotlin.idea.util.application.executeWriteCommand -import org.jetbrains.kotlin.idea.util.application.progressIndicatorNullable -import org.jetbrains.kotlin.idea.util.application.runReadAction -import org.jetbrains.kotlin.j2k.ConverterSettings -import org.jetbrains.kotlin.j2k.JavaToKotlinConverter -import org.jetbrains.kotlin.psi.KtFile -import java.io.File -import java.io.IOException -import java.util.* - -class JavaToKotlinAction : AnAction() { - companion object { - private fun uniqueKotlinFileName(javaFile: VirtualFile): String { - val ioFile = File(javaFile.path.replace('/', File.separatorChar)) - - var i = 0 - while (true) { - val fileName = javaFile.nameWithoutExtension + (if (i > 0) i else "") + ".kt" - if (!ioFile.resolveSibling(fileName).exists()) return fileName - i++ - } - } - - val title = "Convert Java to Kotlin" - - private fun saveResults(javaFiles: List, convertedTexts: List): List { - val result = ArrayList() - for ((psiFile, text) in javaFiles.zip(convertedTexts)) { - try { - val document = PsiDocumentManager.getInstance(psiFile.project).getDocument(psiFile) - if (document == null) { - MessagesEx.error(psiFile.project, "Failed to save conversion result: couldn't find document for " + psiFile.name).showLater() - continue - } - document.replaceString(0, document.textLength, text) - FileDocumentManager.getInstance().saveDocument(document) - - val virtualFile = psiFile.virtualFile - if (ScratchRootType.getInstance().containsFile(virtualFile)) { - val mapping = ScratchFileService.getInstance().scratchesMapping - mapping.setMapping(virtualFile, KotlinFileType.INSTANCE.language) - } - else { - val fileName = uniqueKotlinFileName(virtualFile) - virtualFile.rename(this, fileName) - } - } - catch (e: IOException) { - MessagesEx.error(psiFile.project, e.message ?: "").showLater() - } - } - return result - } - - fun convertFiles( - javaFiles: List, project: Project, - enableExternalCodeProcessing: Boolean = true, - askExternalCodeProcessing: Boolean = true - ): List { - var converterResult: JavaToKotlinConverter.FilesResult? = null - fun convert() { - val converter = JavaToKotlinConverter(project, ConverterSettings.defaultSettings, IdeaJavaToKotlinServices) - converterResult = converter.filesToKotlin( - javaFiles, J2kPostProcessor(formatCode = true), - ProgressManager.getInstance().progressIndicatorNullable!! - ) - } - - - if (!ProgressManager.getInstance().runProcessWithProgressSynchronously( - ::convert, - title, - true, - project)) return emptyList() - - - var externalCodeUpdate: (() -> Unit)? = null - - if (enableExternalCodeProcessing && converterResult!!.externalCodeProcessing != null) { - val question = "Some code in the rest of your project may require corrections after performing this conversion. Do you want to find such code and correct it too?" - if (!askExternalCodeProcessing || (Messages.showOkCancelDialog(project, question, title, Messages.getQuestionIcon()) == Messages.OK)) { - ProgressManager.getInstance().runProcessWithProgressSynchronously( - { - runReadAction { - externalCodeUpdate = converterResult!!.externalCodeProcessing!!.prepareWriteOperation( - ProgressManager.getInstance().progressIndicatorNullable!! - ) - } - }, - title, - true, - project) - } - } - - return project.executeWriteCommand("Convert files from Java to Kotlin", null) { - CommandProcessor.getInstance().markCurrentCommandAsGlobal(project) - - val newFiles = saveResults(javaFiles, converterResult!!.results) - - externalCodeUpdate?.invoke() - - PsiDocumentManager.getInstance(project).commitAllDocuments() - - newFiles.singleOrNull()?.let { - FileEditorManager.getInstance(project).openFile(it, true) - } - - newFiles.map { it.toPsiFile(project) as KtFile } - } - } - } - - override fun actionPerformed(e: AnActionEvent) { - val javaFiles = selectedJavaFiles(e).filter { it.isWritable }.toList() - val project = CommonDataKeys.PROJECT.getData(e.dataContext)!! - - if (javaFiles.isEmpty()) { - val statusBar = WindowManager.getInstance().getStatusBar(project) - JBPopupFactory.getInstance() - .createHtmlTextBalloonBuilder("Nothing to convert:
No writable Java files found", MessageType.ERROR, null) - .createBalloon() - .showInCenterOf(statusBar.component) - } - - val firstSyntaxError = javaFiles.asSequence().map { PsiTreeUtil.findChildOfType(it, PsiErrorElement::class.java) }.firstOrNull() - - if (firstSyntaxError != null) { - val count = javaFiles.filter { PsiTreeUtil.hasErrorElements(it) }.count() - val question = firstSyntaxError.containingFile.name + - (if (count > 1) " and ${count - 1} more Java files" else " file") + - " contain syntax errors, the conversion result may be incorrect" - - val okText = "Investigate Errors" - val cancelText = "Proceed with Conversion" - if (Messages.showOkCancelDialog( - project, - question, - title, - okText, - cancelText, - Messages.getWarningIcon() - ) == Messages.OK) { - NavigationUtil.activateFileWithPsiElement(firstSyntaxError.navigationElement) - return - } - } - - convertFiles(javaFiles, project) - } - - override fun update(e: AnActionEvent) { - val virtualFiles = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY) ?: return - val project = e.project ?: return - - e.presentation.isEnabled = isAnyJavaFileSelected(project, virtualFiles) - } - - private fun isAnyJavaFileSelected(project: Project, files: Array): Boolean { - if (files.any { it.isDirectory }) return true // Giving up on directories - val manager = PsiManager.getInstance(project) - return files.any { it.extension == JavaFileType.DEFAULT_EXTENSION && manager.findFile(it) is PsiJavaFile && it.isWritable } - } - - private fun selectedJavaFiles(e: AnActionEvent): Sequence { - val virtualFiles = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY) ?: return sequenceOf() - val project = e.project ?: return sequenceOf() - return allJavaFiles(virtualFiles, project) - } - - private fun allJavaFiles(filesOrDirs: Array, project: Project): Sequence { - val manager = PsiManager.getInstance(project) - return allFiles(filesOrDirs) - .asSequence() - .mapNotNull { manager.findFile(it) as? PsiJavaFile } - } - - private fun allFiles(filesOrDirs: Array): Collection { - val result = ArrayList() - for (file in filesOrDirs) { - VfsUtilCore.visitChildrenRecursively(file, object : VirtualFileVisitor() { - override fun visitFile(file: VirtualFile): Boolean { - result.add(file) - return true - } - }) - } - return result - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/reporter/KotlinReportSubmitter.kt.as31 b/idea/src/org/jetbrains/kotlin/idea/reporter/KotlinReportSubmitter.kt.as31 deleted file mode 100644 index 9572b8bca94..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/reporter/KotlinReportSubmitter.kt.as31 +++ /dev/null @@ -1,82 +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.idea.reporter - -import com.intellij.diagnostic.ITNReporter -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.diagnostic.IdeaLoggingEvent -import com.intellij.openapi.diagnostic.SubmittedReportInfo -import com.intellij.openapi.ui.Messages -import com.intellij.util.Consumer -import org.jetbrains.kotlin.idea.KotlinPluginUpdater -import org.jetbrains.kotlin.idea.KotlinPluginUtil -import org.jetbrains.kotlin.idea.PluginUpdateStatus -import java.awt.Component - -/** - * We need to wrap ITNReporter for force showing or errors from kotlin plugin even from released version of IDEA. - */ -class KotlinReportSubmitter : ITNReporter() { - private var hasUpdate = false - private var hasLatestVersion = false - - override fun showErrorInRelease(event: IdeaLoggingEvent): Boolean { - val notificationEnabled = "disabled" != System.getProperty("kotlin.fatal.error.notification", "enabled") - return notificationEnabled && (!hasUpdate || ApplicationManager.getApplication().isInternal) - } - - override fun submit(events: Array, additionalInfo: String?, parentComponent: Component?, consumer: Consumer): Boolean { - if (hasUpdate) { - if (ApplicationManager.getApplication().isInternal) { - return super.submit(events, additionalInfo, parentComponent, consumer) - } - return true - } - - if (hasLatestVersion) { - return super.submit(events, additionalInfo, parentComponent, consumer) - } - - KotlinPluginUpdater.getInstance().runUpdateCheck { status -> - if (status is PluginUpdateStatus.Update) { - hasUpdate = true - if (parentComponent != null) { - - if (ApplicationManager.getApplication().isInternal) { - super.submit(events, additionalInfo, parentComponent, consumer) - } - - val rc = Messages.showDialog(parentComponent, - "You're running Kotlin plugin version ${KotlinPluginUtil.getPluginVersion()}, " + - "while the latest version is ${status.pluginDescriptor.version}", - "Update Kotlin Plugin", - arrayOf("Update", "Ignore"), - 0, Messages.getInformationIcon()) - if (rc == 0) { - KotlinPluginUpdater.getInstance().installPluginUpdate(status) - } - } - } - else { - hasLatestVersion = true - super.submit(events, additionalInfo, parentComponent, consumer) - } - false - } - return true - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as31 b/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as31 deleted file mode 100644 index d48f9598c24..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as31 +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -@file:Suppress("DEPRECATION") - -package org.jetbrains.kotlin.idea - -import com.intellij.featureStatistics.FeatureStatisticsBundleProvider -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.extensions.Extensions -import java.lang.IllegalStateException - -private const val CIDR_FEATURE_STATISTICS_PROVIDER_FQNAME = "com.jetbrains.cidr.lang.OCFeatureStatisticsBundleProvider" - -fun registerAdditionalResourceBundleInTests() { - if (!ApplicationManager.getApplication().isUnitTestMode) { - return - } - - val isAlreadyRegistered = FeatureStatisticsBundleProvider.EP_NAME.extensions.any { provider -> - provider.javaClass.name == CIDR_FEATURE_STATISTICS_PROVIDER_FQNAME - } - if (isAlreadyRegistered) { - throw IllegalStateException("Remove this registration for the current platform: bundle is already registered.") - } - - val cidrFSBundleProviderClass = try { - Class.forName(CIDR_FEATURE_STATISTICS_PROVIDER_FQNAME) - } catch (_: ClassNotFoundException) { - throw IllegalStateException("Remove this registration for the current platform: class wasn't found.") - } - - val cidrFSBundleProvider = cidrFSBundleProviderClass.newInstance() as FeatureStatisticsBundleProvider - - Extensions.getRootArea().getExtensionPoint(FeatureStatisticsBundleProvider.EP_NAME).registerExtension(cidrFSBundleProvider) -} \ No newline at end of file diff --git a/idea/testData/android/lint/alarm.kt.as31 b/idea/testData/android/lint/alarm.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/apiCheck.kt.as31 b/idea/testData/android/lint/apiCheck.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/callSuper.kt.as31 b/idea/testData/android/lint/callSuper.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/closeCursor.kt.as31 b/idea/testData/android/lint/closeCursor.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/commitFragment.kt.as31 b/idea/testData/android/lint/commitFragment.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/javaPerformance.kt.as31 b/idea/testData/android/lint/javaPerformance.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/javaScriptInterface.kt.as31 b/idea/testData/android/lint/javaScriptInterface.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/layoutInflation.kt.as31 b/idea/testData/android/lint/layoutInflation.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/log.kt.as31 b/idea/testData/android/lint/log.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/noInternationalSms.kt.as31 b/idea/testData/android/lint/noInternationalSms.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/overrideConcrete.kt.as31 b/idea/testData/android/lint/overrideConcrete.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/parcel.kt.as31 b/idea/testData/android/lint/parcel.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/sdCardTest.kt.as31 b/idea/testData/android/lint/sdCardTest.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/setJavaScriptEnabled.kt.as31 b/idea/testData/android/lint/setJavaScriptEnabled.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/sharedPrefs.kt.as31 b/idea/testData/android/lint/sharedPrefs.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/showDiagnosticsWhenFileIsRed.kt.as31 b/idea/testData/android/lint/showDiagnosticsWhenFileIsRed.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/sqlite.kt.as31 b/idea/testData/android/lint/sqlite.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/supportAnnotation.kt.as31 b/idea/testData/android/lint/supportAnnotation.kt.as31 deleted file mode 100644 index 67eeeb3e98b..00000000000 --- a/idea/testData/android/lint/supportAnnotation.kt.as31 +++ /dev/null @@ -1,36 +0,0 @@ -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSupportAnnotationUsageInspection -// DEPENDENCY: IntRange.java -> android/support/annotation/IntRange.java -// DEPENDENCY: RequiresPermission.java -> android/support/annotation/RequiresPermission.java - - -import android.support.annotation.IntRange -import android.support.annotation.RequiresPermission -import android.Manifest -import android.view.View - -const val constantVal = 0L - -@IntRange(from = 10, to = 0) -fun invalidRange1a(): Int = 5 - -@IntRange(from = constantVal, to = 10) // ok -fun invalidRange0b(): Int = 5 - -@IntRange(from = 10, to = constantVal) -fun invalidRange1b(): Int = 5 - - -// should be ok, KT-16600 -@RequiresPermission(anyOf = arrayOf(Manifest.permission.ACCESS_CHECKIN_PROPERTIES, - Manifest.permission.ACCESS_FINE_LOCATION)) -fun needsPermissions1() { } - -// should be ok, KT-16600 -@RequiresPermission(Manifest.permission.ACCESS_CHECKIN_PROPERTIES) -fun needsPermissions2() { } - -// error -@RequiresPermission( - value = Manifest.permission.ACCESS_CHECKIN_PROPERTIES, - anyOf = arrayOf(Manifest.permission.ACCESS_CHECKIN_PROPERTIES, Manifest.permission.ACCESS_FINE_LOCATION)) -fun needsPermissions3() { } \ No newline at end of file diff --git a/idea/testData/android/lint/systemServices.kt.as31 b/idea/testData/android/lint/systemServices.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/toast.kt.as31 b/idea/testData/android/lint/toast.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/valueOf.kt.as31 b/idea/testData/android/lint/valueOf.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/velocityTrackerRecycle.kt.as31 b/idea/testData/android/lint/velocityTrackerRecycle.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/viewConstructor.kt.as31 b/idea/testData/android/lint/viewConstructor.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/viewHolder.kt.as31 b/idea/testData/android/lint/viewHolder.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/wrongAnnotation.kt.as31 b/idea/testData/android/lint/wrongAnnotation.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/wrongImport.kt.as31 b/idea/testData/android/lint/wrongImport.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lint/wrongViewCall.kt.as31 b/idea/testData/android/lint/wrongViewCall.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/android/lintQuickfix/parcelable/missingCreator.kt.as31 b/idea/testData/android/lintQuickfix/parcelable/missingCreator.kt.as31 deleted file mode 100644 index cdfb473d8a6..00000000000 --- a/idea/testData/android/lintQuickfix/parcelable/missingCreator.kt.as31 +++ /dev/null @@ -1,14 +0,0 @@ -// INTENTION_TEXT: Add Parcelable Implementation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintParcelCreatorInspection -import android.os.Parcel -import android.os.Parcelable - -class MissingCreator : Parcelable { - override fun writeToParcel(dest: Parcel?, flags: Int) { - TODO("not implemented") - } - - override fun describeContents(): Int { - TODO("not implemented") - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/parcelable/missingCreator.kt.expected.as31 b/idea/testData/android/lintQuickfix/parcelable/missingCreator.kt.expected.as31 deleted file mode 100644 index 29ea448d7ae..00000000000 --- a/idea/testData/android/lintQuickfix/parcelable/missingCreator.kt.expected.as31 +++ /dev/null @@ -1,27 +0,0 @@ -// INTENTION_TEXT: Add Parcelable Implementation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintParcelCreatorInspection -import android.os.Parcel -import android.os.Parcelable - -class MissingCreator() : Parcelable { - constructor(parcel: Parcel) : this() { - } - - override fun writeToParcel(dest: Parcel?, flags: Int) { - TODO("not implemented") - } - - override fun describeContents(): Int { - TODO("not implemented") - } - - companion object CREATOR : Parcelable.Creator { - override fun createFromParcel(parcel: Parcel): MissingCreator { - return MissingCreator(parcel) - } - - override fun newArray(size: Int): Array { - return arrayOfNulls(size) - } - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/parcelable/noImplementation.kt.as31 b/idea/testData/android/lintQuickfix/parcelable/noImplementation.kt.as31 deleted file mode 100644 index 09eafd5b62e..00000000000 --- a/idea/testData/android/lintQuickfix/parcelable/noImplementation.kt.as31 +++ /dev/null @@ -1,5 +0,0 @@ -// INTENTION_TEXT: Add Parcelable Implementation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintParcelCreatorInspection -import android.os.Parcelable - -class NoImplementation : Parcelable \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/parcelable/noImplementation.kt.expected.as31 b/idea/testData/android/lintQuickfix/parcelable/noImplementation.kt.expected.as31 deleted file mode 100644 index f364327f3d2..00000000000 --- a/idea/testData/android/lintQuickfix/parcelable/noImplementation.kt.expected.as31 +++ /dev/null @@ -1,27 +0,0 @@ -// INTENTION_TEXT: Add Parcelable Implementation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintParcelCreatorInspection -import android.os.Parcel -import android.os.Parcelable - -class NoImplementation() : Parcelable { - constructor(parcel: Parcel) : this() { - } - - override fun writeToParcel(parcel: Parcel, flags: Int) { - - } - - override fun describeContents(): Int { - return 0 - } - - companion object CREATOR : Parcelable.Creator { - override fun createFromParcel(parcel: Parcel): NoImplementation { - return NoImplementation(parcel) - } - - override fun newArray(size: Int): Array { - return arrayOfNulls(size) - } - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/companion.kt.as31 b/idea/testData/android/lintQuickfix/requiresApi/companion.kt.as31 deleted file mode 100644 index be0bb206f63..00000000000 --- a/idea/testData/android/lintQuickfix/requiresApi/companion.kt.as31 +++ /dev/null @@ -1,11 +0,0 @@ -// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection -// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java - -import android.graphics.drawable.VectorDrawable - -class VectorDrawableProvider { - companion object { - val VECTOR_DRAWABLE = VectorDrawable() - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/companion.kt.expected.as31 b/idea/testData/android/lintQuickfix/requiresApi/companion.kt.expected.as31 deleted file mode 100644 index d2fc869db12..00000000000 --- a/idea/testData/android/lintQuickfix/requiresApi/companion.kt.expected.as31 +++ /dev/null @@ -1,14 +0,0 @@ -// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection -// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java - -import android.graphics.drawable.VectorDrawable -import android.os.Build -import android.support.annotation.RequiresApi - -class VectorDrawableProvider { - companion object { - @RequiresApi(Build.VERSION_CODES.LOLLIPOP) - val VECTOR_DRAWABLE = VectorDrawable() - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/defaultParameter.kt.as31 b/idea/testData/android/lintQuickfix/requiresApi/defaultParameter.kt.as31 deleted file mode 100644 index c8a4583498e..00000000000 --- a/idea/testData/android/lintQuickfix/requiresApi/defaultParameter.kt.as31 +++ /dev/null @@ -1,10 +0,0 @@ -// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection -// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java - -import android.graphics.drawable.VectorDrawable - - -fun withDefaultParameter(vector: VectorDrawable = VectorDrawable()) { - -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/defaultParameter.kt.expected.as31 b/idea/testData/android/lintQuickfix/requiresApi/defaultParameter.kt.expected.as31 deleted file mode 100644 index 8d3fcc4c207..00000000000 --- a/idea/testData/android/lintQuickfix/requiresApi/defaultParameter.kt.expected.as31 +++ /dev/null @@ -1,13 +0,0 @@ -// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection -// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java - -import android.graphics.drawable.VectorDrawable -import android.os.Build -import android.support.annotation.RequiresApi - - -@RequiresApi(Build.VERSION_CODES.LOLLIPOP) -fun withDefaultParameter(vector: VectorDrawable = VectorDrawable()) { - -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/extend.kt.as31 b/idea/testData/android/lintQuickfix/requiresApi/extend.kt.as31 deleted file mode 100644 index 6e53535aa1d..00000000000 --- a/idea/testData/android/lintQuickfix/requiresApi/extend.kt.as31 +++ /dev/null @@ -1,9 +0,0 @@ -// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection -// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java - -import android.graphics.drawable.VectorDrawable - -class MyVectorDrawable : VectorDrawable() { - -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/extend.kt.expected.as31 b/idea/testData/android/lintQuickfix/requiresApi/extend.kt.expected.as31 deleted file mode 100644 index 3307f07e34e..00000000000 --- a/idea/testData/android/lintQuickfix/requiresApi/extend.kt.expected.as31 +++ /dev/null @@ -1,12 +0,0 @@ -// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection -// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java - -import android.graphics.drawable.VectorDrawable -import android.os.Build -import android.support.annotation.RequiresApi - -@RequiresApi(Build.VERSION_CODES.LOLLIPOP) -class MyVectorDrawable : VectorDrawable() { - -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/functionLiteral.kt.as31 b/idea/testData/android/lintQuickfix/requiresApi/functionLiteral.kt.as31 deleted file mode 100644 index c6016fd4012..00000000000 --- a/idea/testData/android/lintQuickfix/requiresApi/functionLiteral.kt.as31 +++ /dev/null @@ -1,13 +0,0 @@ -// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection -// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java - -import android.graphics.drawable.VectorDrawable - -class VectorDrawableProvider { - fun getVectorDrawable(): VectorDrawable { - with(this) { - return VectorDrawable() - } - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/functionLiteral.kt.expected.as31 b/idea/testData/android/lintQuickfix/requiresApi/functionLiteral.kt.expected.as31 deleted file mode 100644 index ff231d64d5a..00000000000 --- a/idea/testData/android/lintQuickfix/requiresApi/functionLiteral.kt.expected.as31 +++ /dev/null @@ -1,16 +0,0 @@ -// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection -// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java - -import android.graphics.drawable.VectorDrawable -import android.os.Build -import android.support.annotation.RequiresApi - -class VectorDrawableProvider { - @RequiresApi(Build.VERSION_CODES.LOLLIPOP) - fun getVectorDrawable(): VectorDrawable { - with(this) { - return VectorDrawable() - } - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/inlinedConstant.kt.as31 b/idea/testData/android/lintQuickfix/requiresApi/inlinedConstant.kt.as31 deleted file mode 100644 index 025b3d3d130..00000000000 --- a/idea/testData/android/lintQuickfix/requiresApi/inlinedConstant.kt.as31 +++ /dev/null @@ -1,9 +0,0 @@ -// INTENTION_TEXT: Add @RequiresApi(KITKAT) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintInlinedApiInspection -// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java - -class Test { - fun foo(): Int { - return android.R.attr.windowTranslucentStatus - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/inlinedConstant.kt.expected.as31 b/idea/testData/android/lintQuickfix/requiresApi/inlinedConstant.kt.expected.as31 deleted file mode 100644 index 8151e13fa3d..00000000000 --- a/idea/testData/android/lintQuickfix/requiresApi/inlinedConstant.kt.expected.as31 +++ /dev/null @@ -1,13 +0,0 @@ -import android.os.Build -import android.support.annotation.RequiresApi - -// INTENTION_TEXT: Add @RequiresApi(KITKAT) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintInlinedApiInspection -// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java - -class Test { - @RequiresApi(Build.VERSION_CODES.KITKAT) - fun foo(): Int { - return android.R.attr.windowTranslucentStatus - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/method.kt.as31 b/idea/testData/android/lintQuickfix/requiresApi/method.kt.as31 deleted file mode 100644 index efbd6dcc173..00000000000 --- a/idea/testData/android/lintQuickfix/requiresApi/method.kt.as31 +++ /dev/null @@ -1,11 +0,0 @@ -// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection -// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java - -import android.graphics.drawable.VectorDrawable - -class VectorDrawableProvider { - fun getVectorDrawable(): VectorDrawable { - return VectorDrawable() - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/method.kt.expected.as31 b/idea/testData/android/lintQuickfix/requiresApi/method.kt.expected.as31 deleted file mode 100644 index 3183461bf58..00000000000 --- a/idea/testData/android/lintQuickfix/requiresApi/method.kt.expected.as31 +++ /dev/null @@ -1,14 +0,0 @@ -// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection -// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java - -import android.graphics.drawable.VectorDrawable -import android.os.Build -import android.support.annotation.RequiresApi - -class VectorDrawableProvider { - @RequiresApi(Build.VERSION_CODES.LOLLIPOP) - fun getVectorDrawable(): VectorDrawable { - return VectorDrawable() - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/property.kt.as31 b/idea/testData/android/lintQuickfix/requiresApi/property.kt.as31 deleted file mode 100644 index d73223f8c0d..00000000000 --- a/idea/testData/android/lintQuickfix/requiresApi/property.kt.as31 +++ /dev/null @@ -1,9 +0,0 @@ -// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection -// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java - -import android.graphics.drawable.VectorDrawable - -class VectorDrawableProvider { - val VECTOR_DRAWABLE = VectorDrawable() -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/property.kt.expected.as31 b/idea/testData/android/lintQuickfix/requiresApi/property.kt.expected.as31 deleted file mode 100644 index 2da5890a952..00000000000 --- a/idea/testData/android/lintQuickfix/requiresApi/property.kt.expected.as31 +++ /dev/null @@ -1,12 +0,0 @@ -// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection -// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java - -import android.graphics.drawable.VectorDrawable -import android.os.Build -import android.support.annotation.RequiresApi - -class VectorDrawableProvider { - @RequiresApi(Build.VERSION_CODES.LOLLIPOP) - val VECTOR_DRAWABLE = VectorDrawable() -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/topLevelProperty.kt.as31 b/idea/testData/android/lintQuickfix/requiresApi/topLevelProperty.kt.as31 deleted file mode 100644 index 7e7564b542c..00000000000 --- a/idea/testData/android/lintQuickfix/requiresApi/topLevelProperty.kt.as31 +++ /dev/null @@ -1,7 +0,0 @@ -// INTENTION_TEXT: Add @RequiresApi(M) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection -// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java -import android.app.Activity - -val top: Int - get() = Activity().checkSelfPermission(READ_CONTACTS) \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/topLevelProperty.kt.expected.as31 b/idea/testData/android/lintQuickfix/requiresApi/topLevelProperty.kt.expected.as31 deleted file mode 100644 index 01d63d7c860..00000000000 --- a/idea/testData/android/lintQuickfix/requiresApi/topLevelProperty.kt.expected.as31 +++ /dev/null @@ -1,10 +0,0 @@ -// INTENTION_TEXT: Add @RequiresApi(M) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection -// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java -import android.app.Activity -import android.os.Build -import android.support.annotation.RequiresApi - -val top: Int - @RequiresApi(Build.VERSION_CODES.M) - get() = Activity().checkSelfPermission(READ_CONTACTS) \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/when.kt.as31 b/idea/testData/android/lintQuickfix/requiresApi/when.kt.as31 deleted file mode 100644 index 0ff7c0cc893..00000000000 --- a/idea/testData/android/lintQuickfix/requiresApi/when.kt.as31 +++ /dev/null @@ -1,15 +0,0 @@ -// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection -// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java - -import android.graphics.drawable.VectorDrawable - -class VectorDrawableProvider { - val flag = false - fun getVectorDrawable(): VectorDrawable { - return when (flag) { - true -> VectorDrawable() - else -> VectorDrawable() - } - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/requiresApi/when.kt.expected.as31 b/idea/testData/android/lintQuickfix/requiresApi/when.kt.expected.as31 deleted file mode 100644 index ce78fc0c8fe..00000000000 --- a/idea/testData/android/lintQuickfix/requiresApi/when.kt.expected.as31 +++ /dev/null @@ -1,18 +0,0 @@ -// INTENTION_TEXT: Add @RequiresApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection -// DEPENDENCY: RequiresApi.java -> android/support/annotation/RequiresApi.java - -import android.graphics.drawable.VectorDrawable -import android.os.Build -import android.support.annotation.RequiresApi - -class VectorDrawableProvider { - val flag = false - @RequiresApi(Build.VERSION_CODES.LOLLIPOP) - fun getVectorDrawable(): VectorDrawable { - return when (flag) { - true -> VectorDrawable() - else -> VectorDrawable() - } - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/activityMethod.kt.as31 b/idea/testData/android/lintQuickfix/suppressLint/activityMethod.kt.as31 deleted file mode 100644 index 02d9669b194..00000000000 --- a/idea/testData/android/lintQuickfix/suppressLint/activityMethod.kt.as31 +++ /dev/null @@ -1,10 +0,0 @@ -// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection - -import android.app.Activity -import android.os.Environment - - -class MainActivity : Activity() { - fun getSdCard(fromEnvironment: Boolean) = if (fromEnvironment) Environment.getExternalStorageDirectory().path else "/sdcard" -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/activityMethod.kt.expected.as31 b/idea/testData/android/lintQuickfix/suppressLint/activityMethod.kt.expected.as31 deleted file mode 100644 index e95b0a1980b..00000000000 --- a/idea/testData/android/lintQuickfix/suppressLint/activityMethod.kt.expected.as31 +++ /dev/null @@ -1,12 +0,0 @@ -// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection - -import android.annotation.SuppressLint -import android.app.Activity -import android.os.Environment - - -class MainActivity : Activity() { - @SuppressLint("SdCardPath") - fun getSdCard(fromEnvironment: Boolean) = if (fromEnvironment) Environment.getExternalStorageDirectory().path else "/sdcard" -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/addToExistingAnnotation.kt.as31 b/idea/testData/android/lintQuickfix/suppressLint/addToExistingAnnotation.kt.as31 deleted file mode 100644 index 26adf3d65c7..00000000000 --- a/idea/testData/android/lintQuickfix/suppressLint/addToExistingAnnotation.kt.as31 +++ /dev/null @@ -1,12 +0,0 @@ -// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection - -import android.annotation.SuppressLint -import android.app.Activity -import android.os.Environment - - -class MainActivity : Activity() { - @SuppressLint("Something") - fun getSdCard(fromEnvironment: Boolean) = if (fromEnvironment) Environment.getExternalStorageDirectory().path else "/sdcard" -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/addToExistingAnnotation.kt.expected.as31 b/idea/testData/android/lintQuickfix/suppressLint/addToExistingAnnotation.kt.expected.as31 deleted file mode 100644 index 45d7bb0130b..00000000000 --- a/idea/testData/android/lintQuickfix/suppressLint/addToExistingAnnotation.kt.expected.as31 +++ /dev/null @@ -1,12 +0,0 @@ -// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection - -import android.annotation.SuppressLint -import android.app.Activity -import android.os.Environment - - -class MainActivity : Activity() { - @SuppressLint("Something", "SdCardPath") - fun getSdCard(fromEnvironment: Boolean) = if (fromEnvironment) Environment.getExternalStorageDirectory().path else "/sdcard" -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/constructorParameter.kt.as31 b/idea/testData/android/lintQuickfix/suppressLint/constructorParameter.kt.as31 deleted file mode 100644 index 1d325d1db70..00000000000 --- a/idea/testData/android/lintQuickfix/suppressLint/constructorParameter.kt.as31 +++ /dev/null @@ -1,4 +0,0 @@ -// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection - -class SdCard(val path: String = "/sdcard") \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/constructorParameter.kt.expected.as31 b/idea/testData/android/lintQuickfix/suppressLint/constructorParameter.kt.expected.as31 deleted file mode 100644 index 8b730ed0777..00000000000 --- a/idea/testData/android/lintQuickfix/suppressLint/constructorParameter.kt.expected.as31 +++ /dev/null @@ -1,6 +0,0 @@ -import android.annotation.SuppressLint - -// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection - -class SdCard(@SuppressLint("SdCardPath") val path: String = "/sdcard") \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/destructuringDeclaration.kt.as31 b/idea/testData/android/lintQuickfix/suppressLint/destructuringDeclaration.kt.as31 deleted file mode 100644 index 6d8e858b66b..00000000000 --- a/idea/testData/android/lintQuickfix/suppressLint/destructuringDeclaration.kt.as31 +++ /dev/null @@ -1,9 +0,0 @@ -// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection - -fun foo() { - val (a: String, b: String) = "/sdcard" -} - -operator fun CharSequence.component1(): String = "component1" -operator fun CharSequence.component2(): String = "component2" diff --git a/idea/testData/android/lintQuickfix/suppressLint/destructuringDeclaration.kt.expected.as31 b/idea/testData/android/lintQuickfix/suppressLint/destructuringDeclaration.kt.expected.as31 deleted file mode 100644 index 7022cdfb459..00000000000 --- a/idea/testData/android/lintQuickfix/suppressLint/destructuringDeclaration.kt.expected.as31 +++ /dev/null @@ -1,12 +0,0 @@ -import android.annotation.SuppressLint - -// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection - -@SuppressLint("SdCardPath") -fun foo() { - val (a: String, b: String) = "/sdcard" -} - -operator fun CharSequence.component1(): String = "component1" -operator fun CharSequence.component2(): String = "component2" diff --git a/idea/testData/android/lintQuickfix/suppressLint/lambdaArgument.kt.as31 b/idea/testData/android/lintQuickfix/suppressLint/lambdaArgument.kt.as31 deleted file mode 100644 index 9da3c3d1779..00000000000 --- a/idea/testData/android/lintQuickfix/suppressLint/lambdaArgument.kt.as31 +++ /dev/null @@ -1,10 +0,0 @@ -// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection - -fun foo(l: Any) = l - -fun bar() { - foo() { - "/sdcard" - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/lambdaArgument.kt.expected.as31 b/idea/testData/android/lintQuickfix/suppressLint/lambdaArgument.kt.expected.as31 deleted file mode 100644 index db344edeea7..00000000000 --- a/idea/testData/android/lintQuickfix/suppressLint/lambdaArgument.kt.expected.as31 +++ /dev/null @@ -1,13 +0,0 @@ -import android.annotation.SuppressLint - -// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection - -fun foo(l: Any) = l - -@SuppressLint("SdCardPath") -fun bar() { - foo() { - "/sdcard" - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/lambdaArgumentProperty.kt.as31 b/idea/testData/android/lintQuickfix/suppressLint/lambdaArgumentProperty.kt.as31 deleted file mode 100644 index 25de06b3bb6..00000000000 --- a/idea/testData/android/lintQuickfix/suppressLint/lambdaArgumentProperty.kt.as31 +++ /dev/null @@ -1,6 +0,0 @@ -// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection - -fun foo(l: Any) = l - -val bar = foo() { "/sdcard" } \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/lambdaArgumentProperty.kt.expected.as31 b/idea/testData/android/lintQuickfix/suppressLint/lambdaArgumentProperty.kt.expected.as31 deleted file mode 100644 index 617e6b33731..00000000000 --- a/idea/testData/android/lintQuickfix/suppressLint/lambdaArgumentProperty.kt.expected.as31 +++ /dev/null @@ -1,9 +0,0 @@ -import android.annotation.SuppressLint - -// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection - -fun foo(l: Any) = l - -@SuppressLint("SdCardPath") -val bar = foo() { "/sdcard" } \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/methodParameter.kt.as31 b/idea/testData/android/lintQuickfix/suppressLint/methodParameter.kt.as31 deleted file mode 100644 index 9abdb51fd35..00000000000 --- a/idea/testData/android/lintQuickfix/suppressLint/methodParameter.kt.as31 +++ /dev/null @@ -1,4 +0,0 @@ -// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection - -fun foo(path: String = "/sdcard") = path \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/methodParameter.kt.expected.as31 b/idea/testData/android/lintQuickfix/suppressLint/methodParameter.kt.expected.as31 deleted file mode 100644 index 99c23d0552e..00000000000 --- a/idea/testData/android/lintQuickfix/suppressLint/methodParameter.kt.expected.as31 +++ /dev/null @@ -1,6 +0,0 @@ -import android.annotation.SuppressLint - -// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection - -fun foo(@SuppressLint("SdCardPath") path: String = "/sdcard") = path \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/propertyWithLambda.kt.as31 b/idea/testData/android/lintQuickfix/suppressLint/propertyWithLambda.kt.as31 deleted file mode 100644 index b8f5cdf95e0..00000000000 --- a/idea/testData/android/lintQuickfix/suppressLint/propertyWithLambda.kt.as31 +++ /dev/null @@ -1,4 +0,0 @@ -// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection - -val getPath = { "/sdcard" } \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/propertyWithLambda.kt.expected.as31 b/idea/testData/android/lintQuickfix/suppressLint/propertyWithLambda.kt.expected.as31 deleted file mode 100644 index 8f4ef7d5ea3..00000000000 --- a/idea/testData/android/lintQuickfix/suppressLint/propertyWithLambda.kt.expected.as31 +++ /dev/null @@ -1,7 +0,0 @@ -import android.annotation.SuppressLint - -// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection - -@SuppressLint("SdCardPath") -val getPath = { "/sdcard" } \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/simpleProperty.kt.as31 b/idea/testData/android/lintQuickfix/suppressLint/simpleProperty.kt.as31 deleted file mode 100644 index 335913d069c..00000000000 --- a/idea/testData/android/lintQuickfix/suppressLint/simpleProperty.kt.as31 +++ /dev/null @@ -1,4 +0,0 @@ -// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection - -val path = "/sdcard" \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/suppressLint/simpleProperty.kt.expected.as31 b/idea/testData/android/lintQuickfix/suppressLint/simpleProperty.kt.expected.as31 deleted file mode 100644 index 9fc27e6b7dc..00000000000 --- a/idea/testData/android/lintQuickfix/suppressLint/simpleProperty.kt.expected.as31 +++ /dev/null @@ -1,7 +0,0 @@ -import android.annotation.SuppressLint - -// INTENTION_TEXT: Suppress: Add @SuppressLint("SdCardPath") annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintSdCardPathInspection - -@SuppressLint("SdCardPath") -val path = "/sdcard" \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/companion.kt.as31 b/idea/testData/android/lintQuickfix/targetApi/companion.kt.as31 deleted file mode 100644 index d0dd43774c8..00000000000 --- a/idea/testData/android/lintQuickfix/targetApi/companion.kt.as31 +++ /dev/null @@ -1,10 +0,0 @@ -// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable - -class VectorDrawableProvider { - companion object { - val VECTOR_DRAWABLE = VectorDrawable() - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/companion.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetApi/companion.kt.expected.as31 deleted file mode 100644 index ae413f19a2a..00000000000 --- a/idea/testData/android/lintQuickfix/targetApi/companion.kt.expected.as31 +++ /dev/null @@ -1,13 +0,0 @@ -// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.annotation.TargetApi -import android.graphics.drawable.VectorDrawable -import android.os.Build - -class VectorDrawableProvider { - @TargetApi(Build.VERSION_CODES.LOLLIPOP) - companion object { - val VECTOR_DRAWABLE = VectorDrawable() - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/defaultParameter.kt.as31 b/idea/testData/android/lintQuickfix/targetApi/defaultParameter.kt.as31 deleted file mode 100644 index 441ac662838..00000000000 --- a/idea/testData/android/lintQuickfix/targetApi/defaultParameter.kt.as31 +++ /dev/null @@ -1,9 +0,0 @@ -// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable - - -fun withDefaultParameter(vector: VectorDrawable = VectorDrawable()) { - -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/defaultParameter.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetApi/defaultParameter.kt.expected.as31 deleted file mode 100644 index 4a7ffec0d23..00000000000 --- a/idea/testData/android/lintQuickfix/targetApi/defaultParameter.kt.expected.as31 +++ /dev/null @@ -1,12 +0,0 @@ -// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.annotation.TargetApi -import android.graphics.drawable.VectorDrawable -import android.os.Build - - -@TargetApi(Build.VERSION_CODES.LOLLIPOP) -fun withDefaultParameter(vector: VectorDrawable = VectorDrawable()) { - -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/extend.kt.as31 b/idea/testData/android/lintQuickfix/targetApi/extend.kt.as31 deleted file mode 100644 index 8e49ae1bd73..00000000000 --- a/idea/testData/android/lintQuickfix/targetApi/extend.kt.as31 +++ /dev/null @@ -1,8 +0,0 @@ -// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable - -class MyVectorDrawable : VectorDrawable() { - -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/extend.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetApi/extend.kt.expected.as31 deleted file mode 100644 index 7a1cd362baa..00000000000 --- a/idea/testData/android/lintQuickfix/targetApi/extend.kt.expected.as31 +++ /dev/null @@ -1,11 +0,0 @@ -// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.annotation.TargetApi -import android.graphics.drawable.VectorDrawable -import android.os.Build - -@TargetApi(Build.VERSION_CODES.LOLLIPOP) -class MyVectorDrawable : VectorDrawable() { - -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/functionLiteral.kt.as31 b/idea/testData/android/lintQuickfix/targetApi/functionLiteral.kt.as31 deleted file mode 100644 index 321913b70a9..00000000000 --- a/idea/testData/android/lintQuickfix/targetApi/functionLiteral.kt.as31 +++ /dev/null @@ -1,12 +0,0 @@ -// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable - -class VectorDrawableProvider { - fun getVectorDrawable(): VectorDrawable { - with(this) { - return VectorDrawable() - } - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/functionLiteral.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetApi/functionLiteral.kt.expected.as31 deleted file mode 100644 index b99ca947fb6..00000000000 --- a/idea/testData/android/lintQuickfix/targetApi/functionLiteral.kt.expected.as31 +++ /dev/null @@ -1,15 +0,0 @@ -// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.annotation.TargetApi -import android.graphics.drawable.VectorDrawable -import android.os.Build - -class VectorDrawableProvider { - @TargetApi(Build.VERSION_CODES.LOLLIPOP) - fun getVectorDrawable(): VectorDrawable { - with(this) { - return VectorDrawable() - } - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/inlinedConstant.kt.as31 b/idea/testData/android/lintQuickfix/targetApi/inlinedConstant.kt.as31 deleted file mode 100644 index 8b233964e07..00000000000 --- a/idea/testData/android/lintQuickfix/targetApi/inlinedConstant.kt.as31 +++ /dev/null @@ -1,8 +0,0 @@ -// INTENTION_TEXT: Add @TargetApi(KITKAT) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintInlinedApiInspection - -class Test { - fun foo(): Int { - return android.R.attr.windowTranslucentStatus - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/inlinedConstant.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetApi/inlinedConstant.kt.expected.as31 deleted file mode 100644 index 84d86bc3776..00000000000 --- a/idea/testData/android/lintQuickfix/targetApi/inlinedConstant.kt.expected.as31 +++ /dev/null @@ -1,12 +0,0 @@ -import android.annotation.TargetApi -import android.os.Build - -// INTENTION_TEXT: Add @TargetApi(KITKAT) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintInlinedApiInspection - -class Test { - @TargetApi(Build.VERSION_CODES.KITKAT) - fun foo(): Int { - return android.R.attr.windowTranslucentStatus - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/method.kt.as31 b/idea/testData/android/lintQuickfix/targetApi/method.kt.as31 deleted file mode 100644 index 89acdda7b32..00000000000 --- a/idea/testData/android/lintQuickfix/targetApi/method.kt.as31 +++ /dev/null @@ -1,10 +0,0 @@ -// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable - -class VectorDrawableProvider { - fun getVectorDrawable(): VectorDrawable { - return VectorDrawable() - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/method.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetApi/method.kt.expected.as31 deleted file mode 100644 index 7f10d4b9893..00000000000 --- a/idea/testData/android/lintQuickfix/targetApi/method.kt.expected.as31 +++ /dev/null @@ -1,13 +0,0 @@ -// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.annotation.TargetApi -import android.graphics.drawable.VectorDrawable -import android.os.Build - -class VectorDrawableProvider { - @TargetApi(Build.VERSION_CODES.LOLLIPOP) - fun getVectorDrawable(): VectorDrawable { - return VectorDrawable() - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/property.kt.as31 b/idea/testData/android/lintQuickfix/targetApi/property.kt.as31 deleted file mode 100644 index 2b2077c72bf..00000000000 --- a/idea/testData/android/lintQuickfix/targetApi/property.kt.as31 +++ /dev/null @@ -1,8 +0,0 @@ -// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable - -class VectorDrawableProvider { - val VECTOR_DRAWABLE = VectorDrawable() -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/property.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetApi/property.kt.expected.as31 deleted file mode 100644 index 2103b804754..00000000000 --- a/idea/testData/android/lintQuickfix/targetApi/property.kt.expected.as31 +++ /dev/null @@ -1,11 +0,0 @@ -// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.annotation.TargetApi -import android.graphics.drawable.VectorDrawable -import android.os.Build - -@TargetApi(Build.VERSION_CODES.LOLLIPOP) -class VectorDrawableProvider { - val VECTOR_DRAWABLE = VectorDrawable() -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/topLevelProperty.kt.as31 b/idea/testData/android/lintQuickfix/targetApi/topLevelProperty.kt.as31 deleted file mode 100644 index 1997b7fc223..00000000000 --- a/idea/testData/android/lintQuickfix/targetApi/topLevelProperty.kt.as31 +++ /dev/null @@ -1,6 +0,0 @@ -// INTENTION_TEXT: Add @TargetApi(M) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection -import android.app.Activity - -val top: Int - get() = Activity().checkSelfPermission(READ_CONTACTS) \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/topLevelProperty.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetApi/topLevelProperty.kt.expected.as31 deleted file mode 100644 index ce8347f83f9..00000000000 --- a/idea/testData/android/lintQuickfix/targetApi/topLevelProperty.kt.expected.as31 +++ /dev/null @@ -1,9 +0,0 @@ -// INTENTION_TEXT: Add @TargetApi(M) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection -import android.annotation.TargetApi -import android.app.Activity -import android.os.Build - -val top: Int - @TargetApi(Build.VERSION_CODES.M) - get() = Activity().checkSelfPermission(READ_CONTACTS) \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/when.kt.as31 b/idea/testData/android/lintQuickfix/targetApi/when.kt.as31 deleted file mode 100644 index b5a33d8e356..00000000000 --- a/idea/testData/android/lintQuickfix/targetApi/when.kt.as31 +++ /dev/null @@ -1,14 +0,0 @@ -// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable - -class VectorDrawableProvider { - val flag = false - fun getVectorDrawable(): VectorDrawable { - return when (flag) { - true -> VectorDrawable() - else -> VectorDrawable() - } - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetApi/when.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetApi/when.kt.expected.as31 deleted file mode 100644 index 275e59c2bbe..00000000000 --- a/idea/testData/android/lintQuickfix/targetApi/when.kt.expected.as31 +++ /dev/null @@ -1,17 +0,0 @@ -// INTENTION_TEXT: Add @TargetApi(LOLLIPOP) Annotation -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.annotation.TargetApi -import android.graphics.drawable.VectorDrawable -import android.os.Build - -class VectorDrawableProvider { - val flag = false - @TargetApi(Build.VERSION_CODES.LOLLIPOP) - fun getVectorDrawable(): VectorDrawable { - return when (flag) { - true -> VectorDrawable() - else -> VectorDrawable() - } - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/annotation.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/annotation.kt.as31 deleted file mode 100644 index ff3f7cbec75..00000000000 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/annotation.kt.as31 +++ /dev/null @@ -1,12 +0,0 @@ -// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INTENTION_NOT_AVAILABLE -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable -import kotlin.reflect.KClass - -annotation class SomeAnnotationWithClass(val cls: KClass<*>) - -@SomeAnnotationWithClass(VectorDrawable::class) -class VectorDrawableProvider { -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/defaultParameter.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/defaultParameter.kt.as31 deleted file mode 100644 index 6169b9947a8..00000000000 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/defaultParameter.kt.as31 +++ /dev/null @@ -1,10 +0,0 @@ -// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INTENTION_NOT_AVAILABLE -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable - - -fun withDefaultParameter(vector: VectorDrawable = VectorDrawable()) { - -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/destructuringDeclaration.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/destructuringDeclaration.kt.as31 deleted file mode 100644 index ec9f278cf18..00000000000 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/destructuringDeclaration.kt.as31 +++ /dev/null @@ -1,12 +0,0 @@ -// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.app.Activity -import android.graphics.drawable.VectorDrawable - -data class ValueProvider(var p1: VectorDrawable, val p2: Int) - -val activity = Activity() -fun foo() { - val (v1, v2) = ValueProvider(VectorDrawable(), 0) -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/destructuringDeclaration.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/destructuringDeclaration.kt.expected.as31 deleted file mode 100644 index 23ea52ab746..00000000000 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/destructuringDeclaration.kt.expected.as31 +++ /dev/null @@ -1,17 +0,0 @@ -// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.app.Activity -import android.graphics.drawable.VectorDrawable -import android.os.Build - -data class ValueProvider(var p1: VectorDrawable, val p2: Int) - -val activity = Activity() -fun foo() { - val (v1, v2) = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - ValueProvider(VectorDrawable(), 0) - } else { - TODO("VERSION.SDK_INT < LOLLIPOP") - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/expressionBody.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/expressionBody.kt.as31 deleted file mode 100644 index e3b7139ae3c..00000000000 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/expressionBody.kt.as31 +++ /dev/null @@ -1,8 +0,0 @@ -// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable - -class VectorDrawableProvider { - fun getVectorDrawable(): VectorDrawable = VectorDrawable() -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/expressionBody.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/expressionBody.kt.expected.as31 deleted file mode 100644 index 4dfc08cfb66..00000000000 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/expressionBody.kt.expected.as31 +++ /dev/null @@ -1,13 +0,0 @@ -// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable -import android.os.Build - -class VectorDrawableProvider { - fun getVectorDrawable(): VectorDrawable = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - VectorDrawable() - } else { - TODO("VERSION.SDK_INT < LOLLIPOP") - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/functionLiteral.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/functionLiteral.kt.as31 deleted file mode 100644 index 403f79dd79a..00000000000 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/functionLiteral.kt.as31 +++ /dev/null @@ -1,12 +0,0 @@ -// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable - -class VectorDrawableProvider { - fun getVectorDrawable(): VectorDrawable { - with(this) { - return VectorDrawable() - } - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/functionLiteral.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/functionLiteral.kt.expected.as31 deleted file mode 100644 index 09a525dbc6b..00000000000 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/functionLiteral.kt.expected.as31 +++ /dev/null @@ -1,17 +0,0 @@ -// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable -import android.os.Build - -class VectorDrawableProvider { - fun getVectorDrawable(): VectorDrawable { - with(this) { - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - VectorDrawable() - } else { - TODO("VERSION.SDK_INT < LOLLIPOP") - } - } - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/getterWIthExpressionBody.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/getterWIthExpressionBody.kt.as31 deleted file mode 100644 index 7ba6b98af31..00000000000 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/getterWIthExpressionBody.kt.as31 +++ /dev/null @@ -1,7 +0,0 @@ -// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable - -val v: VectorDrawable - get() = VectorDrawable() \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/getterWIthExpressionBody.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/getterWIthExpressionBody.kt.expected.as31 deleted file mode 100644 index ed06e869036..00000000000 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/getterWIthExpressionBody.kt.expected.as31 +++ /dev/null @@ -1,12 +0,0 @@ -// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable -import android.os.Build - -val v: VectorDrawable - get() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - VectorDrawable() - } else { - TODO("VERSION.SDK_INT < LOLLIPOP") - } \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/if.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/if.kt.as31 deleted file mode 100644 index e0224b675e4..00000000000 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/if.kt.as31 +++ /dev/null @@ -1,12 +0,0 @@ -// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable - -class VectorDrawableProvider { - val flag = false - fun getVectorDrawable(): VectorDrawable { - if (flag) - return VectorDrawable() - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/if.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/if.kt.expected.as31 deleted file mode 100644 index be38a41256b..00000000000 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/if.kt.expected.as31 +++ /dev/null @@ -1,17 +0,0 @@ -// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable -import android.os.Build - -class VectorDrawableProvider { - val flag = false - fun getVectorDrawable(): VectorDrawable { - if (flag) - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - VectorDrawable() - } else { - TODO("VERSION.SDK_INT < LOLLIPOP") - } - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/ifWithBlock.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/ifWithBlock.kt.as31 deleted file mode 100644 index e2f2a4f0ac1..00000000000 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/ifWithBlock.kt.as31 +++ /dev/null @@ -1,13 +0,0 @@ -// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable - -class VectorDrawableProvider { - val flag = false - fun getVectorDrawable(): VectorDrawable { - if (flag) { - return VectorDrawable() - } - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/ifWithBlock.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/ifWithBlock.kt.expected.as31 deleted file mode 100644 index bda925fbbf2..00000000000 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/ifWithBlock.kt.expected.as31 +++ /dev/null @@ -1,18 +0,0 @@ -// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable -import android.os.Build - -class VectorDrawableProvider { - val flag = false - fun getVectorDrawable(): VectorDrawable { - if (flag) { - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - VectorDrawable() - } else { - TODO("VERSION.SDK_INT < LOLLIPOP") - } - } - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/inlinedConstant.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/inlinedConstant.kt.as31 deleted file mode 100644 index 9c9bf6d37a7..00000000000 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/inlinedConstant.kt.as31 +++ /dev/null @@ -1,8 +0,0 @@ -// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) { ... } -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintInlinedApiInspection - -class Test { - fun foo(): Int { - return android.R.attr.windowTranslucentStatus - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/inlinedConstant.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/inlinedConstant.kt.expected.as31 deleted file mode 100644 index b4d5931c5c8..00000000000 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/inlinedConstant.kt.expected.as31 +++ /dev/null @@ -1,14 +0,0 @@ -import android.os.Build - -// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) { ... } -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintInlinedApiInspection - -class Test { - fun foo(): Int { - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { - android.R.attr.windowTranslucentStatus - } else { - TODO("VERSION.SDK_INT < KITKAT") - } - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/method.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/method.kt.as31 deleted file mode 100644 index 49ac9188e6b..00000000000 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/method.kt.as31 +++ /dev/null @@ -1,10 +0,0 @@ -// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable - -class VectorDrawableProvider { - fun getVectorDrawable(): VectorDrawable { - return VectorDrawable() - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/method.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/method.kt.expected.as31 deleted file mode 100644 index 531645ed71c..00000000000 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/method.kt.expected.as31 +++ /dev/null @@ -1,15 +0,0 @@ -// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable -import android.os.Build - -class VectorDrawableProvider { - fun getVectorDrawable(): VectorDrawable { - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - VectorDrawable() - } else { - TODO("VERSION.SDK_INT < LOLLIPOP") - } - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/when.kt.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/when.kt.as31 deleted file mode 100644 index b12f04272fc..00000000000 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/when.kt.as31 +++ /dev/null @@ -1,14 +0,0 @@ -// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable - -class VectorDrawableProvider { - val flag = false - fun getVectorDrawable(): VectorDrawable { - return when (flag) { - true -> VectorDrawable() - else -> VectorDrawable() - } - } -} \ No newline at end of file diff --git a/idea/testData/android/lintQuickfix/targetVersionCheck/when.kt.expected.as31 b/idea/testData/android/lintQuickfix/targetVersionCheck/when.kt.expected.as31 deleted file mode 100644 index e52140da298..00000000000 --- a/idea/testData/android/lintQuickfix/targetVersionCheck/when.kt.expected.as31 +++ /dev/null @@ -1,19 +0,0 @@ -// INTENTION_TEXT: Surround with if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { ... } -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintNewApiInspection - -import android.graphics.drawable.VectorDrawable -import android.os.Build - -class VectorDrawableProvider { - val flag = false - fun getVectorDrawable(): VectorDrawable { - return when (flag) { - true -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - VectorDrawable() - } else { - TODO("VERSION.SDK_INT < LOLLIPOP") - } - else -> VectorDrawable() - } - } -} \ No newline at end of file diff --git a/idea/testData/multiFileInspections/kotlinInternalInJava/before/B/B.iml.as31 b/idea/testData/multiFileInspections/kotlinInternalInJava/before/B/B.iml.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/testData/quickfix/abstract/abstractFunctionWithBodyWithComments2.kt.after.as31 b/idea/testData/quickfix/abstract/abstractFunctionWithBodyWithComments2.kt.after.as31 deleted file mode 100644 index cb337570a03..00000000000 --- a/idea/testData/quickfix/abstract/abstractFunctionWithBodyWithComments2.kt.after.as31 +++ /dev/null @@ -1,5 +0,0 @@ -// "Remove function body" "true" -abstract class A() { - /*1*/ - abstract fun foo() // 3 -} diff --git a/idea/testData/quickfix/typeMismatch/addArrayOfTypeForJavaAnnotation.before.Main.kt.as31 b/idea/testData/quickfix/typeMismatch/addArrayOfTypeForJavaAnnotation.before.Main.kt.as31 deleted file mode 100644 index ce96f740e40..00000000000 --- a/idea/testData/quickfix/typeMismatch/addArrayOfTypeForJavaAnnotation.before.Main.kt.as31 +++ /dev/null @@ -1,9 +0,0 @@ -// "class org.jetbrains.kotlin.idea.quickfix.AddArrayOfTypeFix" "false" -// ACTION: Create test -// ACTION: Do not show hints for current method -// ACTION: Make internal -// ACTION: Make private -// ACTION: To raw string literal -// ACTION: Do not show hints for current method - -@ArrAnn("123") class My \ No newline at end of file diff --git a/idea/testData/quickfix/unusedSuppressAnnotation/simple.kt.after.as31 b/idea/testData/quickfix/unusedSuppressAnnotation/simple.kt.after.as31 deleted file mode 100644 index 70b02417c61..00000000000 --- a/idea/testData/quickfix/unusedSuppressAnnotation/simple.kt.after.as31 +++ /dev/null @@ -1,7 +0,0 @@ -// "Suppress for declarations annotated by 'xxx.XXX'" "true" -package xxx - -annotation class XXX - -@XXX -class UnusedClass diff --git a/idea/testData/quickfix/unusedSuppressAnnotation/simple.kt.as31 b/idea/testData/quickfix/unusedSuppressAnnotation/simple.kt.as31 deleted file mode 100644 index 70b02417c61..00000000000 --- a/idea/testData/quickfix/unusedSuppressAnnotation/simple.kt.as31 +++ /dev/null @@ -1,7 +0,0 @@ -// "Suppress for declarations annotated by 'xxx.XXX'" "true" -package xxx - -annotation class XXX - -@XXX -class UnusedClass diff --git a/jps-plugin/src/org/jetbrains/kotlin/jps/build/ideaPlatform.kt.as31 b/jps-plugin/src/org/jetbrains/kotlin/jps/build/ideaPlatform.kt.as31 deleted file mode 100644 index c014f4b30fa..00000000000 --- a/jps-plugin/src/org/jetbrains/kotlin/jps/build/ideaPlatform.kt.as31 +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.jps.build - -import org.jetbrains.jps.incremental.CompileContext -import org.jetbrains.jps.incremental.messages.CompilerMessage - -fun jpsReportInternalBuilderError(context: CompileContext, error: Throwable) { - KotlinBuilder.LOG.info(error) -} \ No newline at end of file diff --git a/plugins/allopen/allopen-ide/src/AllOpenMavenProjectImportHandler.kt.as31 b/plugins/allopen/allopen-ide/src/AllOpenMavenProjectImportHandler.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/android-extensions/android-extensions-idea/src/org/jetbrains/kotlin/android/model/impl/AndroidModuleInfoProviderImpl.kt.as31 b/plugins/android-extensions/android-extensions-idea/src/org/jetbrains/kotlin/android/model/impl/AndroidModuleInfoProviderImpl.kt.as31 deleted file mode 100644 index d099fa2d4f8..00000000000 --- a/plugins/android-extensions/android-extensions-idea/src/org/jetbrains/kotlin/android/model/impl/AndroidModuleInfoProviderImpl.kt.as31 +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.android.model.impl - -import com.android.builder.model.SourceProvider -import com.android.tools.idea.gradle.project.GradleProjectInfo -import com.android.tools.idea.gradle.project.model.AndroidModuleModel -import com.android.tools.idea.res.AppResourceRepository -import com.intellij.openapi.module.Module -import com.intellij.openapi.vfs.VirtualFile -import org.jetbrains.android.facet.AndroidFacet -import org.jetbrains.kotlin.android.model.AndroidModuleInfoProvider -import java.io.File - -class AndroidModuleInfoProviderImpl(override val module: Module) : AndroidModuleInfoProvider { - private val androidFacet: AndroidFacet? - get() = AndroidFacet.getInstance(module) - - private val androidModuleModel: AndroidModuleModel? - get() = AndroidModuleModel.get(module) - - override fun isAndroidModule() = androidFacet != null - override fun isGradleModule() = GradleProjectInfo.getInstance(module.project).isBuildWithGradle - - override fun getAllResourceDirectories(): List { - return androidFacet?.allResourceDirectories ?: emptyList() - } - - override fun getApplicationPackage() = androidFacet?.manifest?.`package`?.toString() - - override fun getMainSourceProvider(): AndroidModuleInfoProvider.SourceProviderMirror? { - return androidFacet?.mainSourceProvider?.let(::SourceProviderMirrorImpl) - } - - override fun getApplicationResourceDirectories(createIfNecessary: Boolean): Collection { - return AppResourceRepository.getOrCreateInstance(module)?.resourceDirs ?: emptyList() - } - - override fun getAllSourceProviders(): List { - val androidModuleModel = this.androidModuleModel ?: return emptyList() - return androidModuleModel.allSourceProviders.map(::SourceProviderMirrorImpl) - } - - override fun getActiveSourceProviders(): List { - val androidModuleModel = this.androidModuleModel ?: return emptyList() - return androidModuleModel.activeSourceProviders.map(::SourceProviderMirrorImpl) - } - - override fun getFlavorSourceProviders(): List { - val androidModuleModel = this.androidModuleModel ?: return emptyList() - - val getFlavorSourceProvidersMethod = try { - AndroidFacet::class.java.getMethod("getFlavorSourceProviders") - } catch (e: NoSuchMethodException) { - null - } - - return if (getFlavorSourceProvidersMethod != null) { - @Suppress("UNCHECKED_CAST") - val sourceProviders = getFlavorSourceProvidersMethod.invoke(androidFacet) as? List - sourceProviders?.map(::SourceProviderMirrorImpl) ?: emptyList() - } else { - androidModuleModel.flavorSourceProviders.map(::SourceProviderMirrorImpl) - } - } - - private class SourceProviderMirrorImpl(val sourceProvider: SourceProvider) : - AndroidModuleInfoProvider.SourceProviderMirror { - override val name: String - get() = sourceProvider.name - - override val resDirectories: Collection - get() = sourceProvider.resDirectories - } -} \ No newline at end of file diff --git a/plugins/annotation-based-compiler-plugins-ide-support/src/AbstractMavenImportHandler.kt.as31 b/plugins/annotation-based-compiler-plugins-ide-support/src/AbstractMavenImportHandler.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/kapt3/kapt3-idea/src/org/jetbrains/kotlin/kapt/idea/KaptProjectResolverExtension.kt.as31 b/plugins/kapt3/kapt3-idea/src/org/jetbrains/kotlin/kapt/idea/KaptProjectResolverExtension.kt.as31 deleted file mode 100644 index c27a38c1523..00000000000 --- a/plugins/kapt3/kapt3-idea/src/org/jetbrains/kotlin/kapt/idea/KaptProjectResolverExtension.kt.as31 +++ /dev/null @@ -1,202 +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.kapt.idea - -import com.android.tools.idea.gradle.project.model.AndroidModuleModel -import com.intellij.openapi.diagnostic.Logger -import com.intellij.openapi.externalSystem.model.DataNode -import com.intellij.openapi.externalSystem.model.ProjectKeys -import com.intellij.openapi.externalSystem.model.project.* -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.tooling.model.idea.IdeaModule -import org.jetbrains.kotlin.gradle.AbstractKotlinGradleModelBuilder -import org.jetbrains.kotlin.idea.framework.GRADLE_SYSTEM_ID -import org.jetbrains.plugins.gradle.model.data.GradleSourceSetData -import org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension -import org.jetbrains.plugins.gradle.tooling.ErrorMessageBuilder -import java.io.File -import java.io.Serializable -import java.lang.Exception -import java.lang.reflect.Modifier - -interface KaptSourceSetModel : Serializable { - val sourceSetName: String - val isTest: Boolean - val generatedSourcesDir: String - val generatedClassesDir: String - val generatedKotlinSourcesDir: String - - val generatedSourcesDirFile get() = generatedSourcesDir.takeIf { it.isNotEmpty() }?.let(::File) - val generatedClassesDirFile get() = generatedClassesDir.takeIf { it.isNotEmpty() }?.let(::File) - val generatedKotlinSourcesDirFile get() = generatedKotlinSourcesDir.takeIf { it.isNotEmpty() }?.let(::File) -} - -class KaptSourceSetModelImpl( - override val sourceSetName: String, - override val isTest: Boolean, - override val generatedSourcesDir: String, - override val generatedClassesDir: String, - override val generatedKotlinSourcesDir: String -) : KaptSourceSetModel - -interface KaptGradleModel : Serializable { - val isEnabled: Boolean - val buildDirectory: File - val sourceSets: List -} - -class KaptGradleModelImpl( - override val isEnabled: Boolean, - override val buildDirectory: File, - override val sourceSets: List -) : KaptGradleModel - -internal typealias AndroidGradleModel = AndroidModuleModel - -@Suppress("unused") -class KaptProjectResolverExtension : AbstractProjectResolverExtension() { - private companion object { - private val LOG = Logger.getInstance(KaptProjectResolverExtension::class.java) - } - - override fun getExtraProjectModelClasses() = setOf(KaptGradleModel::class.java) - override fun getToolingExtensionsClasses() = setOf(KaptModelBuilderService::class.java, Unit::class.java) - - override fun populateModuleExtraModels(gradleModule: IdeaModule, ideModule: DataNode) { - val kaptModel = resolverCtx.getExtraProject(gradleModule, KaptGradleModel::class.java) ?: return - - if (kaptModel.isEnabled) { - for (sourceSet in kaptModel.sourceSets) { - populateAndroidModuleModelIfNeeded(ideModule, sourceSet) - - val sourceSetDataNode = ideModule.findGradleSourceSet(sourceSet.sourceSetName) ?: continue - - fun addSourceSet(path: String, type: ExternalSystemSourceType) { - val contentRootData = ContentRootData(GRADLE_SYSTEM_ID, path) - contentRootData.storePath(type, path) - sourceSetDataNode.createChild(ProjectKeys.CONTENT_ROOT, contentRootData) - } - - val sourceType = if (sourceSet.isTest) ExternalSystemSourceType.TEST_GENERATED else ExternalSystemSourceType.SOURCE_GENERATED - sourceSet.generatedSourcesDirFile?.let { addSourceSet(it.absolutePath, sourceType) } - sourceSet.generatedKotlinSourcesDirFile?.let { addSourceSet(it.absolutePath, sourceType) } - - sourceSet.generatedClassesDirFile?.let { generatedClassesDir -> - val libraryData = LibraryData(GRADLE_SYSTEM_ID, "kaptGeneratedClasses") - libraryData.addPath(LibraryPathType.BINARY, generatedClassesDir.absolutePath) - val libraryDependencyData = LibraryDependencyData(sourceSetDataNode.data, libraryData, LibraryLevel.MODULE) - sourceSetDataNode.createChild(ProjectKeys.LIBRARY_DEPENDENCY, libraryDependencyData) - } - } - } - - super.populateModuleExtraModels(gradleModule, ideModule) - } - - private fun populateAndroidModuleModelIfNeeded(ideModule: DataNode, sourceSet: KaptSourceSetModel) { - ideModule.findAndroidModuleModel()?.let { androidModelAny -> - // We can cast to AndroidModuleModel cause we already checked in findAndroidModuleModel() that the class exists - - val generatedKotlinSources = sourceSet.generatedKotlinSourcesDirFile ?: return - - val androidModel = androidModelAny.data as? AndroidModuleModel ?: return - val variant = androidModel.findVariantByName(sourceSet.sourceSetName) ?: return - - androidModel.registerExtraGeneratedSourceFolder(generatedKotlinSources) - - // TODO remove this when IDEA eventually migrate to the newer Android plugin - try { - variant.mainArtifact.generatedSourceFolders += generatedKotlinSources - } catch (e: Throwable) { - // There was an error being thrown here, but the code above doesn't work for the newer versions of Android Studio 3 - // (generatedSourceFolders returns a wrapped unmodifiable list), and the thrown exception breaks the import. - // The error will be moved back when I find a work-around for AS3. - } - } - } - - private fun DataNode.findAndroidModuleModel(): DataNode<*>? { - val modelClassName = "com.android.tools.idea.gradle.project.model.AndroidModuleModel" - val node = children.firstOrNull { it.key.dataType == modelClassName } ?: return null - return if (!hasClassInClasspath(modelClassName)) null else node - } - - private fun hasClassInClasspath(name: String): Boolean { - return try { - Class.forName(name) != null - } catch (thr: Throwable) { - false - } - } - - private fun DataNode.findGradleSourceSet(sourceSetName: String): DataNode? { - val moduleName = data.id - for (child in children) { - val gradleSourceSetData = child.data as? GradleSourceSetData ?: continue - if (gradleSourceSetData.id == "$moduleName:$sourceSetName") { - @Suppress("UNCHECKED_CAST") - return child as DataNode? - } - } - - return null - } -} - -class KaptModelBuilderService : AbstractKotlinGradleModelBuilder() { - override fun getErrorMessageBuilder(project: Project, e: Exception): ErrorMessageBuilder { - return ErrorMessageBuilder.create(project, e, "Gradle import errors") - .withDescription("Unable to build kotlin-kapt plugin configuration") - } - - override fun canBuild(modelName: String?): Boolean = modelName == KaptGradleModel::class.java.name - - override fun buildAll(modelName: String?, project: Project): Any { - val kaptPlugin: Plugin<*>? = project.plugins.findPlugin("kotlin-kapt") - val kaptIsEnabled = kaptPlugin != null - - val sourceSets = mutableListOf() - - if (kaptIsEnabled) { - project.getAllTasks(false)[project]?.forEach { compileTask -> - if (compileTask.javaClass.name !in kotlinCompileTaskClasses) return@forEach - - val sourceSetName = compileTask.getSourceSetName() - val isTest = sourceSetName.toLowerCase().endsWith("test") - - val kaptGeneratedSourcesDir = getKaptDirectory("getKaptGeneratedSourcesDir", project, sourceSetName) - val kaptGeneratedClassesDir = getKaptDirectory("getKaptGeneratedClassesDir", project, sourceSetName) - val kaptGeneratedKotlinSourcesDir = getKaptDirectory("getKaptGeneratedKotlinSourcesDir", project, sourceSetName) - sourceSets += KaptSourceSetModelImpl( - sourceSetName, isTest, kaptGeneratedSourcesDir, kaptGeneratedClassesDir, kaptGeneratedKotlinSourcesDir) - } - } - - return KaptGradleModelImpl(kaptIsEnabled, project.buildDir, sourceSets) - } - - private fun getKaptDirectory(funName: String, project: Project, sourceSetName: String): String { - val kotlinKaptPlugin = project.plugins.findPlugin("kotlin-kapt") ?: return "" - - val targetMethod = kotlinKaptPlugin::class.java.methods.firstOrNull { - Modifier.isStatic(it.modifiers) && it.name == funName && it.parameterCount == 2 - } ?: return "" - - return (targetMethod(null, project, sourceSetName) as? File)?.absolutePath ?: "" - } -} \ No newline at end of file diff --git a/plugins/kotlin-serialization/kotlin-serialization-ide/src/org/jetbrains/kotlinx/serialization/idea/KotlinSerializationMavenImportHandler.kt.as31 b/plugins/kotlin-serialization/kotlin-serialization-ide/src/org/jetbrains/kotlinx/serialization/idea/KotlinSerializationMavenImportHandler.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/android-annotations/src/com/android/annotations/NonNull.java.as31 b/plugins/lint/android-annotations/src/com/android/annotations/NonNull.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/android-annotations/src/com/android/annotations/NonNullByDefault.java.as31 b/plugins/lint/android-annotations/src/com/android/annotations/NonNullByDefault.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/android-annotations/src/com/android/annotations/Nullable.java.as31 b/plugins/lint/android-annotations/src/com/android/annotations/Nullable.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/android-annotations/src/com/android/annotations/VisibleForTesting.java.as31 b/plugins/lint/android-annotations/src/com/android/annotations/VisibleForTesting.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/android-annotations/src/com/android/annotations/concurrency/GuardedBy.java.as31 b/plugins/lint/android-annotations/src/com/android/annotations/concurrency/GuardedBy.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/android-annotations/src/com/android/annotations/concurrency/Immutable.java.as31 b/plugins/lint/android-annotations/src/com/android/annotations/concurrency/Immutable.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/AndroidReference.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/AndroidReference.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/AsmVisitor.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/AsmVisitor.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/CircularDependencyException.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/CircularDependencyException.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/ClassEntry.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/ClassEntry.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/CompositeIssueRegistry.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/CompositeIssueRegistry.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/Configuration.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/Configuration.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/DefaultConfiguration.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/DefaultConfiguration.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/DefaultSdkInfo.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/DefaultSdkInfo.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/ExternalReferenceExpression.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/ExternalReferenceExpression.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/IssueRegistry.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/IssueRegistry.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/JarFileIssueRegistry.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/JarFileIssueRegistry.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/JavaEvaluator.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/JavaEvaluator.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/JavaParser.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/JavaParser.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/JavaPsiVisitor.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/JavaPsiVisitor.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/JavaVisitor.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/JavaVisitor.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/LintClient.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/LintClient.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/LintDriver.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/LintDriver.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/LintListener.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/LintListener.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/LintRequest.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/LintRequest.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/OtherFileVisitor.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/OtherFileVisitor.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/ResourceVisitor.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/ResourceVisitor.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/SdkInfo.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/SdkInfo.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/UElementVisitor.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/UElementVisitor.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/UastLintUtils.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/UastLintUtils.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/client/api/XmlParser.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/client/api/XmlParser.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Category.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Category.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/ClassContext.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/ClassContext.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/ConstantEvaluator.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/ConstantEvaluator.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Context.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Context.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/DefaultPosition.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/DefaultPosition.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Detector.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Detector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Implementation.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Implementation.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Issue.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Issue.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/JavaContext.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/JavaContext.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/LayoutDetector.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/LayoutDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/LintUtils.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/LintUtils.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Location.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Location.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Position.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Position.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Project.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Project.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/ResourceContext.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/ResourceContext.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/ResourceEvaluator.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/ResourceEvaluator.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/ResourceXmlDetector.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/ResourceXmlDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Scope.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Scope.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Severity.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Severity.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Speed.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/Speed.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/TextFormat.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/TextFormat.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/TypeEvaluator.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/TypeEvaluator.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/XmlContext.java.as31 b/plugins/lint/lint-api/src/com/android/tools/klint/detector/api/XmlContext.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/AddJavascriptInterfaceDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/AddJavascriptInterfaceDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/AlarmDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/AlarmDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/AllowAllHostnameVerifierDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/AllowAllHostnameVerifierDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/AlwaysShowActionDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/AlwaysShowActionDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/AndroidAutoDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/AndroidAutoDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/AnnotationDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/AnnotationDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/Api.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/Api.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ApiClass.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ApiClass.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ApiDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ApiDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ApiLookup.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ApiLookup.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ApiPackage.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ApiPackage.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ApiParser.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ApiParser.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/AppCompatCallDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/AppCompatCallDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/AppIndexingApiDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/AppIndexingApiDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/BadHostnameVerifierDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/BadHostnameVerifierDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/BatteryDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/BatteryDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/BuiltinIssueRegistry.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/BuiltinIssueRegistry.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/CallSuperDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/CallSuperDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/CipherGetInstanceDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/CipherGetInstanceDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/CleanupDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/CleanupDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/CommentDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/CommentDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ControlFlowGraph.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ControlFlowGraph.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/CustomViewDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/CustomViewDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/CutPasteDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/CutPasteDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/DateFormatDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/DateFormatDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/FragmentDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/FragmentDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/GetSignaturesDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/GetSignaturesDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/HandlerDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/HandlerDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/IconDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/IconDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/JavaPerformanceDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/JavaPerformanceDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/JavaScriptInterfaceDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/JavaScriptInterfaceDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/LayoutConsistencyDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/LayoutConsistencyDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/LayoutInflationDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/LayoutInflationDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/LeakDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/LeakDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/LocaleDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/LocaleDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/LogDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/LogDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/MathDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/MathDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/MergeRootFrameLayoutDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/MergeRootFrameLayoutDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/NonInternationalizedSmsDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/NonInternationalizedSmsDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/OverdrawDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/OverdrawDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/OverrideConcreteDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/OverrideConcreteDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ParcelDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ParcelDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/PermissionFinder.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/PermissionFinder.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/PermissionHolder.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/PermissionHolder.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/PermissionRequirement.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/PermissionRequirement.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/PluralsDatabase.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/PluralsDatabase.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/PreferenceActivityDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/PreferenceActivityDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/PrivateResourceDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/PrivateResourceDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ReadParcelableDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ReadParcelableDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/RecyclerViewDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/RecyclerViewDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/RegistrationDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/RegistrationDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/RequiredAttributeDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/RequiredAttributeDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/RtlDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/RtlDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/SQLiteDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/SQLiteDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/SdCardDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/SdCardDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/SecureRandomDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/SecureRandomDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/SecurityDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/SecurityDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ServiceCastDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ServiceCastDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/SetJavaScriptEnabledDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/SetJavaScriptEnabledDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/SetTextDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/SetTextDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/SslCertificateSocketFactoryDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/SslCertificateSocketFactoryDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/StringAuthLeakDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/StringAuthLeakDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/StringFormatDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/StringFormatDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/SupportAnnotationDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/SupportAnnotationDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ToastDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ToastDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/TrustAllX509TrustManagerDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/TrustAllX509TrustManagerDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/TypoLookup.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/TypoLookup.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/UnsafeBroadcastReceiverDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/UnsafeBroadcastReceiverDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/UnsafeNativeCodeDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/UnsafeNativeCodeDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ViewConstructorDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ViewConstructorDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ViewHolderDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ViewHolderDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ViewTagDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ViewTagDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ViewTypeDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/ViewTypeDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/WrongCallDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/WrongCallDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/WrongImportDetector.java.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/WrongImportDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-checks/src/com/android/tools/klint/checks/api-versions-support-library.xml.as31 b/plugins/lint/lint-checks/src/com/android/tools/klint/checks/api-versions-support-library.xml.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/AddTargetApiQuickFix.kt.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/AddTargetApiQuickFix.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/AddTargetVersionCheckQuickFix.kt.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/AddTargetVersionCheckQuickFix.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/AndroidInspectionExtensionsFactory.java.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/AndroidInspectionExtensionsFactory.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/AndroidLintExternalAnnotator.java.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/AndroidLintExternalAnnotator.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/AndroidLintGlobalInspectionContext.java.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/AndroidLintGlobalInspectionContext.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/AndroidLintInspectionBase.java.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/AndroidLintInspectionBase.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/AndroidLintInspectionToolProvider.java.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/AndroidLintInspectionToolProvider.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/AndroidLintQuickFix.java.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/AndroidLintQuickFix.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/AndroidLintUtil.java.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/AndroidLintUtil.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/AndroidQuickfixContexts.java.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/AndroidQuickfixContexts.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/ApiUtils.kt.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/ApiUtils.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/DomPsiConverter.java.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/DomPsiConverter.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/DomPsiParser.java.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/DomPsiParser.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/IdeaJavaParser.java.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/IdeaJavaParser.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/IntellijLintClient.java.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/IntellijLintClient.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/IntellijLintIssueRegistry.java.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/IntellijLintIssueRegistry.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/IntellijLintProject.java.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/IntellijLintProject.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/IntellijLintRequest.java.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/IntellijLintRequest.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/IntellijLintUtils.java.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/IntellijLintUtils.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/IntellijViewTypeDetector.java.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/IntellijViewTypeDetector.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/LintInspectionDescriptionLinkHandler.java.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/LintInspectionDescriptionLinkHandler.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/ParcelableQuickFix.kt.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/ParcelableQuickFix.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/ProblemData.java.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/ProblemData.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/State.java.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/State.java.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/SuppressLintIntentionAction.kt.as31 b/plugins/lint/lint-idea/src/org/jetbrains/android/inspections/klint/SuppressLintIntentionAction.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt.as31 b/plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt.as31 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverMavenProjectImportHandler.kt.as31 b/plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverMavenProjectImportHandler.kt.as31 deleted file mode 100644 index fdc35926df3..00000000000 --- a/plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverMavenProjectImportHandler.kt.as31 +++ /dev/null @@ -1,56 +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.samWithReceiver.ide - -/* -import org.jetbrains.kotlin.annotation.plugin.ide.AbstractMavenImportHandler -import org.jetbrains.kotlin.annotation.plugin.ide.AnnotationBasedCompilerPluginSetup -import org.jetbrains.kotlin.annotation.plugin.ide.AnnotationBasedCompilerPluginSetup.PluginOption -import org.jetbrains.kotlin.samWithReceiver.SamWithReceiverCommandLineProcessor -import org.jetbrains.kotlin.utils.PathUtil - -class SamWithReceiverMavenProjectImportHandler : AbstractMavenImportHandler() { - private companion object { - val ANNOTATION_PARAMETER_PREFIX = "sam-with-receiver:${SamWithReceiverCommandLineProcessor.ANNOTATION_OPTION.name}=" - } - - override val compilerPluginId = SamWithReceiverCommandLineProcessor.PLUGIN_ID - override val pluginName = "samWithReceiver" - override val mavenPluginArtifactName = "kotlin-maven-sam-with-receiver" - override val pluginJarFileFromIdea = PathUtil.kotlinPathsForIdeaPlugin.allOpenPluginJarPath - - override fun getOptions(enabledCompilerPlugins: List, compilerPluginOptions: List): List? { - if ("sam-with-receiver" !in enabledCompilerPlugins) { - return null - } - - val annotations = mutableListOf() - - for ((presetName, presetAnnotations) in SamWithReceiverCommandLineProcessor.SUPPORTED_PRESETS) { - if (presetName in enabledCompilerPlugins) { - annotations.addAll(presetAnnotations) - } - } - - annotations.addAll(compilerPluginOptions.mapNotNull { text -> - if (!text.startsWith(ANNOTATION_PARAMETER_PREFIX)) return@mapNotNull null - text.substring(ANNOTATION_PARAMETER_PREFIX.length) - }) - - return annotations.map { PluginOption(SamWithReceiverCommandLineProcessor.ANNOTATION_OPTION.name, it) } - } -} -*/ \ No newline at end of file diff --git a/ultimate/build.gradle.kts.as31 b/ultimate/build.gradle.kts.as31 deleted file mode 100644 index 634df86e922..00000000000 --- a/ultimate/build.gradle.kts.as31 +++ /dev/null @@ -1,3 +0,0 @@ -/* -This build should not be invoked in AS -*/ \ No newline at end of file diff --git a/ultimate/ultimate-runner/build.gradle.kts.as31 b/ultimate/ultimate-runner/build.gradle.kts.as31 deleted file mode 100644 index 2c0a74d4ec6..00000000000 --- a/ultimate/ultimate-runner/build.gradle.kts.as31 +++ /dev/null @@ -1,32 +0,0 @@ - -/* - - -plugins { - kotlin("jvm") -} - -dependencies { - compileOnly(project(":idea")) - compileOnly(project(":idea:idea-maven")) - compileOnly(project(":idea:idea-gradle")) - compileOnly(project(":idea:idea-jvm")) - - compile(intellijDep()) - runtimeOnly(files(toolsJar())) -} - -val intellijUltimateEnabled : Boolean by rootProject.extra - -val ideaUltimatePluginDir: File by rootProject.extra -val ideaUltimateSandboxDir: File by rootProject.extra - -if (intellijUltimateEnabled) { - runIdeTask("runUltimate", ideaUltimatePluginDir, ideaUltimateSandboxDir) { - dependsOn(":dist", ":ideaPlugin", ":ultimate:ideaUltimatePlugin") - } -} - - - -*/ \ No newline at end of file