Switch to 182 platform
@@ -1,7 +1,6 @@
|
||||
181
|
||||
173
|
||||
172_173
|
||||
as31_173
|
||||
as32
|
||||
182
|
||||
as33_as32
|
||||
181
|
||||
173_181
|
||||
172_173_181
|
||||
as31_173_181
|
||||
as32_181
|
||||
|
||||
@@ -54,7 +54,7 @@ fun Project.configureInstrumentation() {
|
||||
val instrumentationClasspathCfg = configurations.create("instrumentationClasspath")
|
||||
|
||||
dependencies {
|
||||
instrumentationClasspathCfg(intellijDep()) { includeJars("javac2", "jdom", "asm-all", "jgoodies-forms") }
|
||||
instrumentationClasspathCfg(intellijDep()) { includeJars("javac2", "jdom", "asm-all") }
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
|
||||
@@ -54,7 +54,7 @@ fun Project.configureInstrumentation() {
|
||||
val instrumentationClasspathCfg = configurations.create("instrumentationClasspath")
|
||||
|
||||
dependencies {
|
||||
instrumentationClasspathCfg(intellijDep()) { includeJars("javac2", "jdom", "asm-all") }
|
||||
instrumentationClasspathCfg(intellijDep()) { includeJars("javac2", "jdom", "asm-all", "jgoodies-forms") }
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.codegen.inline
|
||||
|
||||
import jdk.internal.org.objectweb.asm.Opcodes
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.load.kotlin.getContainingKotlinJvmBinaryClass
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.codegen.inline
|
||||
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
import jdk.internal.org.objectweb.asm.Opcodes
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.load.kotlin.getContainingKotlinJvmBinaryClass
|
||||
@@ -51,9 +51,19 @@ messages/**)
|
||||
-dontwarn org.jetbrains.annotations.Mutable
|
||||
-dontwarn com.intellij.util.io.TarUtil
|
||||
|
||||
# Depends on apache batik which has lots of dependencies
|
||||
# Nullability annotations used in Guava
|
||||
-dontwarn org.checkerframework.checker.nullness.compatqual.NullableDecl
|
||||
-dontwarn org.checkerframework.checker.nullness.compatqual.MonotonicNonNullDecl
|
||||
|
||||
# Depends on apache batick which has lots of dependencies
|
||||
-dontwarn com.intellij.util.SVGLoader*
|
||||
|
||||
-dontwarn org.jdom.xpath.jaxen.*
|
||||
-dontwarn com.intellij.util.io.Decompressor*
|
||||
-dontwarn org.w3c.dom.Location
|
||||
-dontwarn org.w3c.dom.Window
|
||||
|
||||
|
||||
#-libraryjars '<rtjar>'
|
||||
#-libraryjars '<jssejar>'
|
||||
#-libraryjars '<bootstrap.runtime>'
|
||||
|
||||
@@ -51,19 +51,9 @@ messages/**)
|
||||
-dontwarn org.jetbrains.annotations.Mutable
|
||||
-dontwarn com.intellij.util.io.TarUtil
|
||||
|
||||
# Nullability annotations used in Guava
|
||||
-dontwarn org.checkerframework.checker.nullness.compatqual.NullableDecl
|
||||
-dontwarn org.checkerframework.checker.nullness.compatqual.MonotonicNonNullDecl
|
||||
|
||||
# Depends on apache batick which has lots of dependencies
|
||||
# Depends on apache batik which has lots of dependencies
|
||||
-dontwarn com.intellij.util.SVGLoader*
|
||||
|
||||
-dontwarn org.jdom.xpath.jaxen.*
|
||||
-dontwarn com.intellij.util.io.Decompressor*
|
||||
-dontwarn org.w3c.dom.Location
|
||||
-dontwarn org.w3c.dom.Window
|
||||
|
||||
|
||||
#-libraryjars '<rtjar>'
|
||||
#-libraryjars '<jssejar>'
|
||||
#-libraryjars '<bootstrap.runtime>'
|
||||
@@ -10,6 +10,7 @@ dependencies {
|
||||
compile(project(":core:descriptors"))
|
||||
compile(project(":core:descriptors.jvm"))
|
||||
compile(project(":compiler:util"))
|
||||
compile("javax.annotation:jsr250-api:1.0")
|
||||
compile(project(":compiler:frontend"))
|
||||
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
|
||||
compileOnly(intellijDep()) { includeJars("annotations", "asm-all", "trove4j", "guava", rootProject = rootProject) }
|
||||
|
||||
@@ -10,7 +10,6 @@ dependencies {
|
||||
compile(project(":core:descriptors"))
|
||||
compile(project(":core:descriptors.jvm"))
|
||||
compile(project(":compiler:util"))
|
||||
compile("javax.annotation:jsr250-api:1.0")
|
||||
compile(project(":compiler:frontend"))
|
||||
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
|
||||
compileOnly(intellijDep()) { includeJars("annotations", "asm-all", "trove4j", "guava", rootProject = rootProject) }
|
||||
@@ -166,7 +166,7 @@ abstract class KtCodeFragment(
|
||||
|
||||
override fun getExceptionHandler() = exceptionHandler
|
||||
|
||||
override fun importClass(aClass: PsiClass?): Boolean {
|
||||
override fun importClass(aClass: PsiClass): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ abstract class KtCodeFragment(
|
||||
|
||||
override fun getExceptionHandler() = exceptionHandler
|
||||
|
||||
override fun importClass(aClass: PsiClass): Boolean {
|
||||
override fun importClass(aClass: PsiClass?): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -75,6 +75,8 @@ abstract class KtConstructor<T : KtConstructor<T>> : KtDeclarationStub<KotlinPla
|
||||
|
||||
override fun getNameIdentifier() = null
|
||||
|
||||
override fun getIdentifyingElement(): PsiElement? = getConstructorKeyword()
|
||||
|
||||
@Throws(IncorrectOperationException::class)
|
||||
override fun setName(name: String): PsiElement = throw IncorrectOperationException("setName to constructor")
|
||||
|
||||
|
||||
@@ -75,8 +75,6 @@ abstract class KtConstructor<T : KtConstructor<T>> : KtDeclarationStub<KotlinPla
|
||||
|
||||
override fun getNameIdentifier() = null
|
||||
|
||||
override fun getIdentifyingElement(): PsiElement? = getConstructorKeyword()
|
||||
|
||||
@Throws(IncorrectOperationException::class)
|
||||
override fun setName(name: String): PsiElement = throw IncorrectOperationException("setName to constructor")
|
||||
|
||||
@@ -67,5 +67,7 @@ class KtObjectDeclaration : KtClassOrObject {
|
||||
|
||||
fun getObjectKeyword(): PsiElement? = findChildByType(KtTokens.OBJECT_KEYWORD)
|
||||
|
||||
override fun getIdentifyingElement(): PsiElement? = getObjectKeyword()
|
||||
|
||||
override fun getCompanionObjects(): List<KtObjectDeclaration> = emptyList()
|
||||
}
|
||||
|
||||
@@ -67,7 +67,5 @@ class KtObjectDeclaration : KtClassOrObject {
|
||||
|
||||
fun getObjectKeyword(): PsiElement? = findChildByType(KtTokens.OBJECT_KEYWORD)
|
||||
|
||||
override fun getIdentifyingElement(): PsiElement? = getObjectKeyword()
|
||||
|
||||
override fun getCompanionObjects(): List<KtObjectDeclaration> = emptyList()
|
||||
}
|
||||
@@ -31,7 +31,7 @@ dependencies {
|
||||
testCompile(androidDxJar()) { isTransitive = false }
|
||||
testCompile(intellijCoreDep()) { includeJars("intellij-core"); isTransitive = false }
|
||||
testCompile(intellijDep()) {
|
||||
includeJars("openapi", "platform-api", "platform-impl", "idea", "idea_rt", "guava", "trove4j", "picocontainer", "asm-all", "log4j", "jdom", "bootstrap", "annotations", rootProject = rootProject)
|
||||
includeJars("openapi", "platform-api", "platform-impl", "idea", "idea_rt", "guava", "trove4j", "picocontainer-1.2", "asm-all", "log4j", "jdom", "bootstrap", "annotations", rootProject = rootProject)
|
||||
isTransitive = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ dependencies {
|
||||
testCompile(androidDxJar()) { isTransitive = false }
|
||||
testCompile(intellijCoreDep()) { includeJars("intellij-core"); isTransitive = false }
|
||||
testCompile(intellijDep()) {
|
||||
includeJars("openapi", "platform-api", "platform-impl", "idea", "idea_rt", "guava", "trove4j", "picocontainer-1.2", "asm-all", "log4j", "jdom", "bootstrap", "annotations", rootProject = rootProject)
|
||||
includeJars("openapi", "platform-api", "platform-impl", "idea", "idea_rt", "guava", "trove4j", "picocontainer", "asm-all", "log4j", "jdom", "bootstrap", "annotations", rootProject = rootProject)
|
||||
isTransitive = false
|
||||
}
|
||||
}
|
||||
@@ -11,4 +11,4 @@ import com.intellij.util.Processor
|
||||
* Processor<T> till IDEA 181 and Processor<in T> since 182.
|
||||
* BUNCH: 182
|
||||
*/
|
||||
typealias ExecutorProcessor<T> = Processor<T>
|
||||
typealias ExecutorProcessor<T> = Processor<in T>
|
||||
@@ -11,4 +11,4 @@ import com.intellij.util.Processor
|
||||
* Processor<T> till IDEA 181 and Processor<in T> since 182.
|
||||
* BUNCH: 182
|
||||
*/
|
||||
typealias ExecutorProcessor<T> = Processor<in T>
|
||||
typealias ExecutorProcessor<T> = Processor<T>
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.kotlin.idea.compiler.configuration
|
||||
|
||||
import com.intellij.openapi.components.PersistentStateComponent
|
||||
import com.intellij.openapi.components.StoragePathMacros.PROJECT_CONFIG_DIR
|
||||
import com.intellij.openapi.progress.util.BackgroundTaskUtil
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.util.ReflectionUtil
|
||||
@@ -26,7 +25,6 @@ import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters
|
||||
import com.intellij.util.xmlb.XmlSerializer
|
||||
import org.jdom.Element
|
||||
import org.jetbrains.kotlin.cli.common.arguments.*
|
||||
import org.jetbrains.kotlin.config.SettingConstants
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
abstract class BaseKotlinCompilerSettings<T : Freezable> protected constructor(private val project: Project) : PersistentStateComponent<Element>, Cloneable {
|
||||
@@ -82,8 +80,6 @@ abstract class BaseKotlinCompilerSettings<T : Freezable> protected constructor(p
|
||||
public override fun clone(): Any = super.clone()
|
||||
|
||||
companion object {
|
||||
const val KOTLIN_COMPILER_SETTINGS_PATH = PROJECT_CONFIG_DIR + "/" + SettingConstants.KOTLIN_COMPILER_SETTINGS_FILE
|
||||
|
||||
private val SKIP_DEFAULT_VALUES = SkipDefaultValuesSerializationFilters(
|
||||
CommonCompilerArguments.DummyImpl(),
|
||||
K2JVMCompilerArguments(),
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.kotlin.idea.compiler.configuration
|
||||
|
||||
import com.intellij.openapi.components.PersistentStateComponent
|
||||
import com.intellij.openapi.components.StoragePathMacros.PROJECT_CONFIG_DIR
|
||||
import com.intellij.openapi.progress.util.BackgroundTaskUtil
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.util.ReflectionUtil
|
||||
@@ -25,6 +26,7 @@ import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters
|
||||
import com.intellij.util.xmlb.XmlSerializer
|
||||
import org.jdom.Element
|
||||
import org.jetbrains.kotlin.cli.common.arguments.*
|
||||
import org.jetbrains.kotlin.config.SettingConstants
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
abstract class BaseKotlinCompilerSettings<T : Freezable> protected constructor(private val project: Project) : PersistentStateComponent<Element>, Cloneable {
|
||||
@@ -80,6 +82,8 @@ abstract class BaseKotlinCompilerSettings<T : Freezable> protected constructor(p
|
||||
public override fun clone(): Any = super.clone()
|
||||
|
||||
companion object {
|
||||
const val KOTLIN_COMPILER_SETTINGS_PATH = PROJECT_CONFIG_DIR + "/" + SettingConstants.KOTLIN_COMPILER_SETTINGS_FILE
|
||||
|
||||
private val SKIP_DEFAULT_VALUES = SkipDefaultValuesSerializationFilters(
|
||||
CommonCompilerArguments.DummyImpl(),
|
||||
K2JVMCompilerArguments(),
|
||||
@@ -19,12 +19,10 @@ package org.jetbrains.kotlin.idea.compiler.configuration
|
||||
import com.intellij.openapi.components.*
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
|
||||
import org.jetbrains.kotlin.config.SettingConstants
|
||||
import org.jetbrains.kotlin.config.SettingConstants.KOTLIN_TO_JS_COMPILER_ARGUMENTS_SECTION
|
||||
import org.jetbrains.kotlin.idea.compiler.configuration.BaseKotlinCompilerSettings.Companion.KOTLIN_COMPILER_SETTINGS_PATH
|
||||
|
||||
@State(name = KOTLIN_TO_JS_COMPILER_ARGUMENTS_SECTION,
|
||||
storages = arrayOf(Storage(file = StoragePathMacros.PROJECT_FILE),
|
||||
Storage(file = KOTLIN_COMPILER_SETTINGS_PATH, scheme = StorageScheme.DIRECTORY_BASED)))
|
||||
@State(name = KOTLIN_TO_JS_COMPILER_ARGUMENTS_SECTION, storages = [(Storage(SettingConstants.KOTLIN_COMPILER_SETTINGS_FILE))])
|
||||
class Kotlin2JsCompilerArgumentsHolder(project: Project) : BaseKotlinCompilerSettings<K2JSCompilerArguments>(project) {
|
||||
override fun createSettings() = K2JSCompilerArguments()
|
||||
|
||||
|
||||
@@ -19,10 +19,12 @@ package org.jetbrains.kotlin.idea.compiler.configuration
|
||||
import com.intellij.openapi.components.*
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
|
||||
import org.jetbrains.kotlin.config.SettingConstants
|
||||
import org.jetbrains.kotlin.config.SettingConstants.KOTLIN_TO_JS_COMPILER_ARGUMENTS_SECTION
|
||||
import org.jetbrains.kotlin.idea.compiler.configuration.BaseKotlinCompilerSettings.Companion.KOTLIN_COMPILER_SETTINGS_PATH
|
||||
|
||||
@State(name = KOTLIN_TO_JS_COMPILER_ARGUMENTS_SECTION, storages = [(Storage(SettingConstants.KOTLIN_COMPILER_SETTINGS_FILE))])
|
||||
@State(name = KOTLIN_TO_JS_COMPILER_ARGUMENTS_SECTION,
|
||||
storages = arrayOf(Storage(file = StoragePathMacros.PROJECT_FILE),
|
||||
Storage(file = KOTLIN_COMPILER_SETTINGS_PATH, scheme = StorageScheme.DIRECTORY_BASED)))
|
||||
class Kotlin2JsCompilerArgumentsHolder(project: Project) : BaseKotlinCompilerSettings<K2JSCompilerArguments>(project) {
|
||||
override fun createSettings() = K2JSCompilerArguments()
|
||||
|
||||
@@ -19,12 +19,10 @@ package org.jetbrains.kotlin.idea.compiler.configuration
|
||||
import com.intellij.openapi.components.*
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||
import org.jetbrains.kotlin.config.SettingConstants
|
||||
import org.jetbrains.kotlin.config.SettingConstants.KOTLIN_TO_JVM_COMPILER_ARGUMENTS_SECTION
|
||||
import org.jetbrains.kotlin.idea.compiler.configuration.BaseKotlinCompilerSettings.Companion.KOTLIN_COMPILER_SETTINGS_PATH
|
||||
|
||||
@State(name = KOTLIN_TO_JVM_COMPILER_ARGUMENTS_SECTION,
|
||||
storages = arrayOf(Storage(file = StoragePathMacros.PROJECT_FILE),
|
||||
Storage(file = KOTLIN_COMPILER_SETTINGS_PATH, scheme = StorageScheme.DIRECTORY_BASED)))
|
||||
@State(name = KOTLIN_TO_JVM_COMPILER_ARGUMENTS_SECTION, storages = [(Storage(SettingConstants.KOTLIN_COMPILER_SETTINGS_FILE))])
|
||||
class Kotlin2JvmCompilerArgumentsHolder(project: Project) : BaseKotlinCompilerSettings<K2JVMCompilerArguments>(project) {
|
||||
override fun createSettings() = K2JVMCompilerArguments()
|
||||
|
||||
|
||||
@@ -19,10 +19,12 @@ package org.jetbrains.kotlin.idea.compiler.configuration
|
||||
import com.intellij.openapi.components.*
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||
import org.jetbrains.kotlin.config.SettingConstants
|
||||
import org.jetbrains.kotlin.config.SettingConstants.KOTLIN_TO_JVM_COMPILER_ARGUMENTS_SECTION
|
||||
import org.jetbrains.kotlin.idea.compiler.configuration.BaseKotlinCompilerSettings.Companion.KOTLIN_COMPILER_SETTINGS_PATH
|
||||
|
||||
@State(name = KOTLIN_TO_JVM_COMPILER_ARGUMENTS_SECTION, storages = [(Storage(SettingConstants.KOTLIN_COMPILER_SETTINGS_FILE))])
|
||||
@State(name = KOTLIN_TO_JVM_COMPILER_ARGUMENTS_SECTION,
|
||||
storages = arrayOf(Storage(file = StoragePathMacros.PROJECT_FILE),
|
||||
Storage(file = KOTLIN_COMPILER_SETTINGS_PATH, scheme = StorageScheme.DIRECTORY_BASED)))
|
||||
class Kotlin2JvmCompilerArgumentsHolder(project: Project) : BaseKotlinCompilerSettings<K2JVMCompilerArguments>(project) {
|
||||
override fun createSettings() = K2JVMCompilerArguments()
|
||||
|
||||
@@ -22,14 +22,12 @@ import com.intellij.util.text.VersionComparatorUtil
|
||||
import org.jdom.Element
|
||||
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.arguments.setApiVersionToLanguageVersionIfNeeded
|
||||
import org.jetbrains.kotlin.config.SettingConstants
|
||||
import org.jetbrains.kotlin.config.SettingConstants.KOTLIN_COMMON_COMPILER_ARGUMENTS_SECTION
|
||||
import org.jetbrains.kotlin.config.detectVersionAutoAdvance
|
||||
import org.jetbrains.kotlin.config.dropVersionsIfNecessary
|
||||
|
||||
@State(name = KOTLIN_COMMON_COMPILER_ARGUMENTS_SECTION,
|
||||
storages = arrayOf(Storage(file = StoragePathMacros.PROJECT_FILE),
|
||||
Storage(file = BaseKotlinCompilerSettings.KOTLIN_COMPILER_SETTINGS_PATH,
|
||||
scheme = StorageScheme.DIRECTORY_BASED)))
|
||||
@State(name = KOTLIN_COMMON_COMPILER_ARGUMENTS_SECTION, storages = [(Storage(SettingConstants.KOTLIN_COMPILER_SETTINGS_FILE))])
|
||||
class KotlinCommonCompilerArgumentsHolder(project: Project) : BaseKotlinCompilerSettings<CommonCompilerArguments>(project) {
|
||||
override fun getState(): Element {
|
||||
return super.getState().apply {
|
||||
|
||||
@@ -22,12 +22,14 @@ import com.intellij.util.text.VersionComparatorUtil
|
||||
import org.jdom.Element
|
||||
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.arguments.setApiVersionToLanguageVersionIfNeeded
|
||||
import org.jetbrains.kotlin.config.SettingConstants
|
||||
import org.jetbrains.kotlin.config.SettingConstants.KOTLIN_COMMON_COMPILER_ARGUMENTS_SECTION
|
||||
import org.jetbrains.kotlin.config.detectVersionAutoAdvance
|
||||
import org.jetbrains.kotlin.config.dropVersionsIfNecessary
|
||||
|
||||
@State(name = KOTLIN_COMMON_COMPILER_ARGUMENTS_SECTION, storages = [(Storage(SettingConstants.KOTLIN_COMPILER_SETTINGS_FILE))])
|
||||
@State(name = KOTLIN_COMMON_COMPILER_ARGUMENTS_SECTION,
|
||||
storages = arrayOf(Storage(file = StoragePathMacros.PROJECT_FILE),
|
||||
Storage(file = BaseKotlinCompilerSettings.KOTLIN_COMPILER_SETTINGS_PATH,
|
||||
scheme = StorageScheme.DIRECTORY_BASED)))
|
||||
class KotlinCommonCompilerArgumentsHolder(project: Project) : BaseKotlinCompilerSettings<CommonCompilerArguments>(project) {
|
||||
override fun getState(): Element {
|
||||
return super.getState().apply {
|
||||
@@ -19,11 +19,10 @@ package org.jetbrains.kotlin.idea.compiler.configuration
|
||||
import com.intellij.openapi.components.*
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.config.CompilerSettings
|
||||
import org.jetbrains.kotlin.config.SettingConstants
|
||||
import org.jetbrains.kotlin.config.SettingConstants.KOTLIN_COMPILER_SETTINGS_SECTION
|
||||
|
||||
@State(name = KOTLIN_COMPILER_SETTINGS_SECTION,
|
||||
storages = arrayOf(Storage(file = StoragePathMacros.PROJECT_FILE),
|
||||
Storage(file = BaseKotlinCompilerSettings.KOTLIN_COMPILER_SETTINGS_PATH, scheme = StorageScheme.DIRECTORY_BASED)))
|
||||
@State(name = KOTLIN_COMPILER_SETTINGS_SECTION, storages = [(Storage(SettingConstants.KOTLIN_COMPILER_SETTINGS_FILE))])
|
||||
class KotlinCompilerSettings(project: Project) : BaseKotlinCompilerSettings<CompilerSettings>(project) {
|
||||
override fun createSettings() = CompilerSettings()
|
||||
|
||||
|
||||
@@ -19,10 +19,11 @@ package org.jetbrains.kotlin.idea.compiler.configuration
|
||||
import com.intellij.openapi.components.*
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.config.CompilerSettings
|
||||
import org.jetbrains.kotlin.config.SettingConstants
|
||||
import org.jetbrains.kotlin.config.SettingConstants.KOTLIN_COMPILER_SETTINGS_SECTION
|
||||
|
||||
@State(name = KOTLIN_COMPILER_SETTINGS_SECTION, storages = [(Storage(SettingConstants.KOTLIN_COMPILER_SETTINGS_FILE))])
|
||||
@State(name = KOTLIN_COMPILER_SETTINGS_SECTION,
|
||||
storages = arrayOf(Storage(file = StoragePathMacros.PROJECT_FILE),
|
||||
Storage(file = BaseKotlinCompilerSettings.KOTLIN_COMPILER_SETTINGS_PATH, scheme = StorageScheme.DIRECTORY_BASED)))
|
||||
class KotlinCompilerSettings(project: Project) : BaseKotlinCompilerSettings<CompilerSettings>(project) {
|
||||
override fun createSettings() = CompilerSettings()
|
||||
|
||||
@@ -7,6 +7,6 @@ package org.jetbrains.kotlin.idea.highlighter;
|
||||
|
||||
public class ErrorIconUtil {
|
||||
public static String getErrorIconUrl() {
|
||||
return "/general/error.png";
|
||||
return "/general/error.svg";
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,6 @@ package org.jetbrains.kotlin.idea.highlighter;
|
||||
|
||||
public class ErrorIconUtil {
|
||||
public static String getErrorIconUrl() {
|
||||
return "/general/error.svg";
|
||||
return "/general/error.png";
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ 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.gradle.util.FilePaths
|
||||
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
|
||||
|
||||
@@ -18,7 +18,7 @@ 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.android.tools.idea.gradle.util.FilePaths
|
||||
import com.intellij.openapi.externalSystem.model.DataNode
|
||||
import com.intellij.openapi.externalSystem.model.project.ModuleData
|
||||
import com.intellij.openapi.externalSystem.model.project.ProjectData
|
||||
@@ -121,7 +121,7 @@ public abstract class AndroidTestCase extends AndroidTestBase {
|
||||
Module additionalModule = data.myModuleFixtureBuilder.getFixture().getModule();
|
||||
myAdditionalModules.add(additionalModule);
|
||||
AndroidFacet facet = addAndroidFacet(additionalModule);
|
||||
facet.setProjectType(data.myProjectType);
|
||||
facet.getProperties().PROJECT_TYPE = data.myProjectType;
|
||||
String rootPath = getAdditionalModulePath(data.myDirName);
|
||||
myFixture.copyDirectoryToProject(getResDir(), rootPath + "/res");
|
||||
myFixture.copyFileToProject(SdkConstants.FN_ANDROID_MANIFEST_XML, rootPath + '/' + SdkConstants.FN_ANDROID_MANIFEST_XML);
|
||||
|
||||
@@ -121,7 +121,7 @@ public abstract class AndroidTestCase extends AndroidTestBase {
|
||||
Module additionalModule = data.myModuleFixtureBuilder.getFixture().getModule();
|
||||
myAdditionalModules.add(additionalModule);
|
||||
AndroidFacet facet = addAndroidFacet(additionalModule);
|
||||
facet.getProperties().PROJECT_TYPE = data.myProjectType;
|
||||
facet.setProjectType(data.myProjectType);
|
||||
String rootPath = getAdditionalModulePath(data.myDirName);
|
||||
myFixture.copyDirectoryToProject(getResDir(), rootPath + "/res");
|
||||
myFixture.copyFileToProject(SdkConstants.FN_ANDROID_MANIFEST_XML, rootPath + '/' + SdkConstants.FN_ANDROID_MANIFEST_XML);
|
||||
@@ -17,8 +17,7 @@
|
||||
package org.jetbrains.kotlin.android;
|
||||
|
||||
|
||||
import com.android.annotations.NonNull;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
|
||||
import java.io.File;
|
||||
@@ -28,12 +27,12 @@ import java.io.File;
|
||||
* stabbed to minimize changes in AndroidTestBase
|
||||
*/
|
||||
public class TestUtils {
|
||||
@NonNull
|
||||
@NotNull
|
||||
public static File getSdk() {
|
||||
return KotlinTestUtils.findAndroidSdk();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@NotNull
|
||||
public static String getLatestAndroidPlatform() {
|
||||
return "android-26";
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
package org.jetbrains.kotlin.android;
|
||||
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import com.android.annotations.NonNull;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
|
||||
import java.io.File;
|
||||
@@ -27,12 +28,12 @@ import java.io.File;
|
||||
* stabbed to minimize changes in AndroidTestBase
|
||||
*/
|
||||
public class TestUtils {
|
||||
@NotNull
|
||||
@NonNull
|
||||
public static File getSdk() {
|
||||
return KotlinTestUtils.findAndroidSdk();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNull
|
||||
public static String getLatestAndroidPlatform() {
|
||||
return "android-26";
|
||||
}
|
||||
@@ -14,5 +14,9 @@ import java.io.File
|
||||
*/
|
||||
@Suppress("IncompatibleAPI")
|
||||
fun BaseDecompiler.addSpaceEx(file: File, isOwn: Boolean) {
|
||||
addSpace(file, isOwn)
|
||||
if (isOwn) {
|
||||
addSource(file)
|
||||
} else {
|
||||
addLibrary(file)
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,5 @@ import java.io.File
|
||||
*/
|
||||
@Suppress("IncompatibleAPI")
|
||||
fun BaseDecompiler.addSpaceEx(file: File, isOwn: Boolean) {
|
||||
if (isOwn) {
|
||||
addSource(file)
|
||||
} else {
|
||||
addLibrary(file)
|
||||
}
|
||||
addSpace(file, isOwn)
|
||||
}
|
||||
@@ -18,9 +18,23 @@ package org.jetbrains.kotlin.idea.test;
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.testFramework.TempFiles;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Collection;
|
||||
|
||||
public abstract class KotlinLightCodeInsightFixtureTestCaseBase extends LightCodeInsightFixtureTestCase {
|
||||
@NotNull
|
||||
@@ -39,4 +53,45 @@ public abstract class KotlinLightCodeInsightFixtureTestCaseBase extends LightCod
|
||||
public PsiFile getFile() {
|
||||
return super.getFile();
|
||||
}
|
||||
|
||||
protected final Collection<File> myFilesToDelete = new THashSet<>();
|
||||
private final TempFiles myTempFiles = new TempFiles(myFilesToDelete);
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
myTempFiles.deleteAll();
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public VirtualFile createTempFile(
|
||||
@NonNls @NotNull String ext,
|
||||
@Nullable byte[] bom,
|
||||
@NonNls @NotNull String content,
|
||||
@NotNull Charset charset
|
||||
) throws IOException {
|
||||
File temp = FileUtil.createTempFile("copy", "." + ext);
|
||||
setContentOnDisk(temp, bom, content, charset);
|
||||
|
||||
myFilesToDelete.add(temp);
|
||||
final VirtualFile file = getVirtualFile(temp);
|
||||
assert file != null : temp;
|
||||
return file;
|
||||
}
|
||||
|
||||
public static void setContentOnDisk(@NotNull File file, @Nullable byte[] bom, @NotNull String content, @NotNull Charset charset)
|
||||
throws IOException {
|
||||
FileOutputStream stream = new FileOutputStream(file);
|
||||
if (bom != null) {
|
||||
stream.write(bom);
|
||||
}
|
||||
try (OutputStreamWriter writer = new OutputStreamWriter(stream, charset)) {
|
||||
writer.write(content);
|
||||
}
|
||||
}
|
||||
|
||||
protected static VirtualFile getVirtualFile(@NotNull File file) {
|
||||
return LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.test;
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class KotlinLightCodeInsightFixtureTestCaseBase extends LightCodeInsightFixtureTestCase {
|
||||
@NotNull
|
||||
@Override
|
||||
public Project getProject() {
|
||||
return super.getProject();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Editor getEditor() {
|
||||
return super.getEditor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiFile getFile() {
|
||||
return super.getFile();
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.test;
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.testFramework.TempFiles;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Collection;
|
||||
|
||||
public abstract class KotlinLightCodeInsightFixtureTestCaseBase extends LightCodeInsightFixtureTestCase {
|
||||
@NotNull
|
||||
@Override
|
||||
public Project getProject() {
|
||||
return super.getProject();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Editor getEditor() {
|
||||
return super.getEditor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiFile getFile() {
|
||||
return super.getFile();
|
||||
}
|
||||
|
||||
protected final Collection<File> myFilesToDelete = new THashSet<>();
|
||||
private final TempFiles myTempFiles = new TempFiles(myFilesToDelete);
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
myTempFiles.deleteAll();
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public VirtualFile createTempFile(
|
||||
@NonNls @NotNull String ext,
|
||||
@Nullable byte[] bom,
|
||||
@NonNls @NotNull String content,
|
||||
@NotNull Charset charset
|
||||
) throws IOException {
|
||||
File temp = FileUtil.createTempFile("copy", "." + ext);
|
||||
setContentOnDisk(temp, bom, content, charset);
|
||||
|
||||
myFilesToDelete.add(temp);
|
||||
final VirtualFile file = getVirtualFile(temp);
|
||||
assert file != null : temp;
|
||||
return file;
|
||||
}
|
||||
|
||||
public static void setContentOnDisk(@NotNull File file, @Nullable byte[] bom, @NotNull String content, @NotNull Charset charset)
|
||||
throws IOException {
|
||||
FileOutputStream stream = new FileOutputStream(file);
|
||||
if (bom != null) {
|
||||
stream.write(bom);
|
||||
}
|
||||
try (OutputStreamWriter writer = new OutputStreamWriter(stream, charset)) {
|
||||
writer.write(content);
|
||||
}
|
||||
}
|
||||
|
||||
protected static VirtualFile getVirtualFile(@NotNull File file) {
|
||||
return LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);
|
||||
}
|
||||
|
||||
}
|
||||
|
Before Width: | Height: | Size: 460 B After Width: | Height: | Size: 374 B |
|
After Width: | Height: | Size: 460 B |
|
Before Width: | Height: | Size: 374 B |
|
Before Width: | Height: | Size: 714 B After Width: | Height: | Size: 576 B |
|
After Width: | Height: | Size: 714 B |
|
Before Width: | Height: | Size: 576 B |
@@ -1,4 +1,5 @@
|
||||
<idea-plugin>
|
||||
<extensions defaultExtensionNs="Git4Idea">
|
||||
<GitCheckinExplicitMovementProvider implementation="org.jetbrains.kotlin.git.KotlinExplicitMovementProvider"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -0,0 +1,4 @@
|
||||
<idea-plugin>
|
||||
<extensions defaultExtensionNs="Git4Idea">
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -1,5 +0,0 @@
|
||||
<idea-plugin>
|
||||
<extensions defaultExtensionNs="Git4Idea">
|
||||
<GitCheckinExplicitMovementProvider implementation="org.jetbrains.kotlin.git.KotlinExplicitMovementProvider"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -1,20 +1,4 @@
|
||||
<idea-plugin>
|
||||
<extensions defaultExtensionNs="org.jetbrains.plugins.gradle">
|
||||
<frameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.GradleKotlinJavaFrameworkSupportProvider"/>
|
||||
<frameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.GradleKotlinJSFrameworkSupportProvider"/>
|
||||
<kotlinDslFrameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.KotlinDslGradleKotlinJavaFrameworkSupportProvider"/>
|
||||
<kotlinDslFrameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.KotlinDslGradleKotlinJSFrameworkSupportProvider"/>
|
||||
<frameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.GradleKotlinMPPCommonFrameworkSupportProvider"/>
|
||||
<frameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.GradleKotlinMPPJavaFrameworkSupportProvider"/>
|
||||
<frameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.GradleKotlinMPPJSFrameworkSupportProvider"/>
|
||||
<pluginDescriptions implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradlePluginDescription"/>
|
||||
<projectResolve implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleProjectResolverExtension" order="first"/>
|
||||
<projectResolve implementation="org.jetbrains.kotlin.kapt.idea.KaptProjectResolverExtension" order="last"/>
|
||||
<projectResolve implementation="org.jetbrains.kotlin.allopen.ide.AllOpenProjectResolverExtension" order="last"/>
|
||||
<projectResolve implementation="org.jetbrains.kotlin.noarg.ide.NoArgProjectResolverExtension" order="last"/>
|
||||
<projectResolve implementation="org.jetbrains.kotlin.samWithReceiver.ide.SamWithReceiverProjectResolverExtension" order="last"/>
|
||||
</extensions>
|
||||
|
||||
<extensionPoints>
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.gradleProjectImportHandler" area="IDEA_PROJECT"
|
||||
interface="org.jetbrains.kotlin.idea.configuration.GradleProjectImportHandler"/>
|
||||
@@ -23,69 +7,7 @@
|
||||
interface="org.jetbrains.kotlin.idea.inspections.gradle.KotlinGradleModelFacade"/>
|
||||
</extensionPoints>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<externalProjectDataService implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleSourceSetDataService"/>
|
||||
<externalProjectDataService implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleProjectDataService"/>
|
||||
<externalProjectDataService implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleLibraryDataService"/>
|
||||
<externalSystemTaskNotificationListener implementation="org.jetbrains.kotlin.idea.core.script.ReloadGradleTemplatesOnSync"/>
|
||||
|
||||
<localInspection
|
||||
implementationClass="org.jetbrains.kotlin.idea.inspections.gradle.DifferentKotlinGradleVersionInspection"
|
||||
displayName="Kotlin Gradle and IDE plugins versions are different"
|
||||
groupName="Kotlin"
|
||||
enabledByDefault="true"
|
||||
language="Groovy"
|
||||
hasStaticDescription="true"
|
||||
level="WARNING"/>
|
||||
|
||||
<localInspection
|
||||
implementationClass="org.jetbrains.kotlin.idea.inspections.gradle.DifferentStdlibGradleVersionInspection"
|
||||
displayName="Kotlin library and Gradle plugin versions are different"
|
||||
groupName="Kotlin"
|
||||
enabledByDefault="true"
|
||||
language="Groovy"
|
||||
hasStaticDescription="true"
|
||||
level="WARNING"/>
|
||||
|
||||
<localInspection
|
||||
implementationClass="org.jetbrains.kotlin.idea.inspections.gradle.DeprecatedGradleDependencyInspection"
|
||||
displayName="Deprecated library is used in Gradle"
|
||||
groupName="Kotlin"
|
||||
enabledByDefault="true"
|
||||
language="Groovy"
|
||||
hasStaticDescription="true"
|
||||
level="WARNING"/>
|
||||
|
||||
<localInspection
|
||||
implementationClass="org.jetbrains.kotlin.idea.inspections.gradle.GradleKotlinxCoroutinesDeprecationInspection"
|
||||
displayName="kotlinx.coroutines dependencies should be updated in Gradle for using with Kotlin 1.3+"
|
||||
groupPath="Kotlin,Migration"
|
||||
groupName="Gradle"
|
||||
enabledByDefault="true"
|
||||
language="Groovy"
|
||||
hasStaticDescription="true"
|
||||
level="ERROR"/>
|
||||
|
||||
<runConfigurationProducer implementation="org.jetbrains.kotlin.idea.run.KotlinTestClassGradleConfigurationProducer"/>
|
||||
<runConfigurationProducer implementation="org.jetbrains.kotlin.idea.run.KotlinTestMethodGradleConfigurationProducer"/>
|
||||
|
||||
<orderEnumerationHandlerFactory implementation="org.jetbrains.kotlin.android.AndroidGradleOrderEnumerationHandler$FactoryImpl" order="first"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="org.jetbrains.kotlin">
|
||||
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.allopen.ide.AllOpenGradleProjectImportHandler"/>
|
||||
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.scripting.idea.plugin.ScriptingGradleProjectImportHandler"/>
|
||||
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.noarg.ide.NoArgGradleProjectImportHandler"/>
|
||||
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.samWithReceiver.ide.SamWithReceiverGradleProjectImportHandler"/>
|
||||
|
||||
<projectConfigurator implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleModuleConfigurator"/>
|
||||
<projectConfigurator implementation="org.jetbrains.kotlin.idea.configuration.KotlinJsGradleModuleConfigurator"/>
|
||||
<gradleModelFacade implementation="org.jetbrains.kotlin.idea.inspections.gradle.DefaultGradleModelFacade"/>
|
||||
|
||||
<scriptDefinitionContributor implementation="org.jetbrains.kotlin.idea.core.script.GradleScriptDefinitionsContributor" order="first"/>
|
||||
|
||||
<moduleBuilder implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleMultiplatformModuleBuilder"/>
|
||||
|
||||
<buildSystemTypeDetector implementation="org.jetbrains.kotlin.idea.configuration.GradleDetector"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
<idea-plugin>
|
||||
<extensions defaultExtensionNs="org.jetbrains.plugins.gradle">
|
||||
<frameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.GradleKotlinJavaFrameworkSupportProvider"/>
|
||||
<frameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.GradleKotlinJSFrameworkSupportProvider"/>
|
||||
<kotlinDslFrameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.KotlinDslGradleKotlinJavaFrameworkSupportProvider"/>
|
||||
<kotlinDslFrameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.KotlinDslGradleKotlinJSFrameworkSupportProvider"/>
|
||||
<frameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.GradleKotlinMPPCommonFrameworkSupportProvider"/>
|
||||
<frameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.GradleKotlinMPPJavaFrameworkSupportProvider"/>
|
||||
<frameworkSupport implementation="org.jetbrains.kotlin.idea.configuration.GradleKotlinMPPJSFrameworkSupportProvider"/>
|
||||
<pluginDescriptions implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradlePluginDescription"/>
|
||||
<projectResolve implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleProjectResolverExtension" order="first"/>
|
||||
<projectResolve implementation="org.jetbrains.kotlin.kapt.idea.KaptProjectResolverExtension" order="last"/>
|
||||
<projectResolve implementation="org.jetbrains.kotlin.allopen.ide.AllOpenProjectResolverExtension" order="last"/>
|
||||
<projectResolve implementation="org.jetbrains.kotlin.noarg.ide.NoArgProjectResolverExtension" order="last"/>
|
||||
<projectResolve implementation="org.jetbrains.kotlin.samWithReceiver.ide.SamWithReceiverProjectResolverExtension" order="last"/>
|
||||
</extensions>
|
||||
|
||||
<extensionPoints>
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.gradleProjectImportHandler" area="IDEA_PROJECT"
|
||||
interface="org.jetbrains.kotlin.idea.configuration.GradleProjectImportHandler"/>
|
||||
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.gradleModelFacade"
|
||||
interface="org.jetbrains.kotlin.idea.inspections.gradle.KotlinGradleModelFacade"/>
|
||||
</extensionPoints>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<externalProjectDataService implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleSourceSetDataService"/>
|
||||
<externalProjectDataService implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleProjectDataService"/>
|
||||
<externalProjectDataService implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleLibraryDataService"/>
|
||||
<externalSystemTaskNotificationListener implementation="org.jetbrains.kotlin.idea.core.script.ReloadGradleTemplatesOnSync"/>
|
||||
|
||||
<localInspection
|
||||
implementationClass="org.jetbrains.kotlin.idea.inspections.gradle.DifferentKotlinGradleVersionInspection"
|
||||
displayName="Kotlin Gradle and IDE plugins versions are different"
|
||||
groupName="Kotlin"
|
||||
enabledByDefault="true"
|
||||
language="Groovy"
|
||||
hasStaticDescription="true"
|
||||
level="WARNING"/>
|
||||
|
||||
<localInspection
|
||||
implementationClass="org.jetbrains.kotlin.idea.inspections.gradle.DifferentStdlibGradleVersionInspection"
|
||||
displayName="Kotlin library and Gradle plugin versions are different"
|
||||
groupName="Kotlin"
|
||||
enabledByDefault="true"
|
||||
language="Groovy"
|
||||
hasStaticDescription="true"
|
||||
level="WARNING"/>
|
||||
|
||||
<localInspection
|
||||
implementationClass="org.jetbrains.kotlin.idea.inspections.gradle.DeprecatedGradleDependencyInspection"
|
||||
displayName="Deprecated library is used in Gradle"
|
||||
groupName="Kotlin"
|
||||
enabledByDefault="true"
|
||||
language="Groovy"
|
||||
hasStaticDescription="true"
|
||||
level="WARNING"/>
|
||||
|
||||
<localInspection
|
||||
implementationClass="org.jetbrains.kotlin.idea.inspections.gradle.GradleKotlinxCoroutinesDeprecationInspection"
|
||||
displayName="kotlinx.coroutines dependencies should be updated in Gradle for using with Kotlin 1.3+"
|
||||
groupPath="Kotlin,Migration"
|
||||
groupName="Gradle"
|
||||
enabledByDefault="true"
|
||||
language="Groovy"
|
||||
hasStaticDescription="true"
|
||||
level="ERROR"/>
|
||||
|
||||
<runConfigurationProducer implementation="org.jetbrains.kotlin.idea.run.KotlinTestClassGradleConfigurationProducer"/>
|
||||
<runConfigurationProducer implementation="org.jetbrains.kotlin.idea.run.KotlinTestMethodGradleConfigurationProducer"/>
|
||||
|
||||
<orderEnumerationHandlerFactory implementation="org.jetbrains.kotlin.android.AndroidGradleOrderEnumerationHandler$FactoryImpl" order="first"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="org.jetbrains.kotlin">
|
||||
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.allopen.ide.AllOpenGradleProjectImportHandler"/>
|
||||
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.scripting.idea.plugin.ScriptingGradleProjectImportHandler"/>
|
||||
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.noarg.ide.NoArgGradleProjectImportHandler"/>
|
||||
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.samWithReceiver.ide.SamWithReceiverGradleProjectImportHandler"/>
|
||||
|
||||
<projectConfigurator implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleModuleConfigurator"/>
|
||||
<projectConfigurator implementation="org.jetbrains.kotlin.idea.configuration.KotlinJsGradleModuleConfigurator"/>
|
||||
<gradleModelFacade implementation="org.jetbrains.kotlin.idea.inspections.gradle.DefaultGradleModelFacade"/>
|
||||
|
||||
<scriptDefinitionContributor implementation="org.jetbrains.kotlin.idea.core.script.GradleScriptDefinitionsContributor" order="first"/>
|
||||
|
||||
<moduleBuilder implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleMultiplatformModuleBuilder"/>
|
||||
|
||||
<buildSystemTypeDetector implementation="org.jetbrains.kotlin.idea.configuration.GradleDetector"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -1,13 +0,0 @@
|
||||
<idea-plugin>
|
||||
<extensionPoints>
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.gradleProjectImportHandler" area="IDEA_PROJECT"
|
||||
interface="org.jetbrains.kotlin.idea.configuration.GradleProjectImportHandler"/>
|
||||
|
||||
<extensionPoint qualifiedName="org.jetbrains.kotlin.gradleModelFacade"
|
||||
interface="org.jetbrains.kotlin.idea.inspections.gradle.KotlinGradleModelFacade"/>
|
||||
</extensionPoints>
|
||||
|
||||
<extensions defaultExtensionNs="org.jetbrains.kotlin">
|
||||
<buildSystemTypeDetector implementation="org.jetbrains.kotlin.idea.configuration.GradleDetector"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -13,16 +13,16 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
<version>@snapshot@</version>
|
||||
<vendor url="http://www.jetbrains.com">JetBrains</vendor>
|
||||
|
||||
<idea-version since-build="181.3" until-build="181.*"/>
|
||||
<idea-version since-build="182.3040" until-build="183.*"/>
|
||||
|
||||
<depends>com.intellij.modules.platform</depends>
|
||||
<depends>com.intellij.modules.remoteServers</depends>
|
||||
|
||||
<!-- required for Kotlin/Native plugin -->
|
||||
<depends optional="true">org.jetbrains.kotlin.native.platform.deps</depends>
|
||||
|
||||
<depends optional="true" config-file="junit.xml">JUnit</depends>
|
||||
<depends optional="true" config-file="gradle.xml">org.jetbrains.plugins.gradle</depends>
|
||||
<depends optional="true" config-file="gradle-java.xml">org.jetbrains.plugins.gradle.java</depends>
|
||||
<depends optional="true" config-file="maven.xml">org.jetbrains.idea.maven</depends>
|
||||
<depends optional="true" config-file="testng-j.xml">TestNG-J</depends>
|
||||
<depends optional="true" config-file="android.xml">org.jetbrains.android</depends>
|
||||
@@ -34,6 +34,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
<!-- ULTIMATE-PLUGIN-PLACEHOLDER -->
|
||||
|
||||
<!-- CIDR-PLUGIN-PLACEHOLDER-START -->
|
||||
<depends>com.intellij.modules.idea</depends>
|
||||
<depends>com.intellij.modules.java</depends>
|
||||
<depends optional="true" config-file="javaScriptDebug.xml">JavaScriptDebugger</depends>
|
||||
<depends optional="true" config-file="kotlin-copyright.xml">com.intellij.copyright</depends>
|
||||
@@ -3035,4 +3036,8 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
<highlighterExtension implementation="org.jetbrains.kotlin.idea.highlighter.dsl.DslHighlighterExtension"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij.jvm">
|
||||
<declarationSearcher language="kotlin" implementationClass="org.jetbrains.kotlin.idea.jvm.KotlinDeclarationSearcher"/>
|
||||
</extensions>
|
||||
|
||||
</idea-plugin>
|
||||
|
||||
@@ -13,16 +13,16 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
<version>@snapshot@</version>
|
||||
<vendor url="http://www.jetbrains.com">JetBrains</vendor>
|
||||
|
||||
<idea-version since-build="182.3040" until-build="183.*"/>
|
||||
<idea-version since-build="181.3" until-build="181.*"/>
|
||||
|
||||
<depends>com.intellij.modules.platform</depends>
|
||||
<depends>com.intellij.modules.remoteServers</depends>
|
||||
|
||||
<!-- required for Kotlin/Native plugin -->
|
||||
<depends optional="true">org.jetbrains.kotlin.native.platform.deps</depends>
|
||||
|
||||
<depends optional="true" config-file="junit.xml">JUnit</depends>
|
||||
<depends optional="true" config-file="gradle.xml">org.jetbrains.plugins.gradle</depends>
|
||||
<depends optional="true" config-file="gradle-java.xml">org.jetbrains.plugins.gradle.java</depends>
|
||||
<depends optional="true" config-file="maven.xml">org.jetbrains.idea.maven</depends>
|
||||
<depends optional="true" config-file="testng-j.xml">TestNG-J</depends>
|
||||
<depends optional="true" config-file="android.xml">org.jetbrains.android</depends>
|
||||
@@ -34,7 +34,6 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
<!-- ULTIMATE-PLUGIN-PLACEHOLDER -->
|
||||
|
||||
<!-- CIDR-PLUGIN-PLACEHOLDER-START -->
|
||||
<depends>com.intellij.modules.idea</depends>
|
||||
<depends>com.intellij.modules.java</depends>
|
||||
<depends optional="true" config-file="javaScriptDebug.xml">JavaScriptDebugger</depends>
|
||||
<depends optional="true" config-file="kotlin-copyright.xml">com.intellij.copyright</depends>
|
||||
@@ -3036,8 +3035,4 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
<highlighterExtension implementation="org.jetbrains.kotlin.idea.highlighter.dsl.DslHighlighterExtension"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij.jvm">
|
||||
<declarationSearcher language="kotlin" implementationClass="org.jetbrains.kotlin.idea.jvm.KotlinDeclarationSearcher"/>
|
||||
</extensions>
|
||||
|
||||
</idea-plugin>
|
||||
@@ -30,6 +30,7 @@ import com.intellij.openapi.progress.ProgressManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.ui.Messages
|
||||
import com.intellij.openapi.ui.ex.MessagesEx
|
||||
import com.intellij.openapi.util.Key
|
||||
import com.intellij.openapi.vfs.VfsUtilCore
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.openapi.vfs.VirtualFileVisitor
|
||||
@@ -50,10 +51,13 @@ 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 org.jetbrains.kotlin.psi.UserDataProperty
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.util.*
|
||||
|
||||
var VirtualFile.pathBeforeJ2K: String? by UserDataProperty(Key.create<String>("PATH_BEFORE_J2K_CONVERSION"))
|
||||
|
||||
class JavaToKotlinAction : AnAction() {
|
||||
companion object {
|
||||
private fun uniqueKotlinFileName(javaFile: VirtualFile): String {
|
||||
@@ -88,6 +92,7 @@ class JavaToKotlinAction : AnAction() {
|
||||
}
|
||||
else {
|
||||
val fileName = uniqueKotlinFileName(virtualFile)
|
||||
virtualFile.pathBeforeJ2K = virtualFile.path
|
||||
virtualFile.rename(this, fileName)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ import com.intellij.openapi.progress.ProgressManager
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.ui.Messages
|
||||
import com.intellij.openapi.ui.ex.MessagesEx
|
||||
import com.intellij.openapi.util.Key
|
||||
import com.intellij.openapi.vfs.VfsUtilCore
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.openapi.vfs.VirtualFileVisitor
|
||||
@@ -51,13 +50,10 @@ 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 org.jetbrains.kotlin.psi.UserDataProperty
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.util.*
|
||||
|
||||
var VirtualFile.pathBeforeJ2K: String? by UserDataProperty(Key.create<String>("PATH_BEFORE_J2K_CONVERSION"))
|
||||
|
||||
class JavaToKotlinAction : AnAction() {
|
||||
companion object {
|
||||
private fun uniqueKotlinFileName(javaFile: VirtualFile): String {
|
||||
@@ -92,7 +88,6 @@ class JavaToKotlinAction : AnAction() {
|
||||
}
|
||||
else {
|
||||
val fileName = uniqueKotlinFileName(virtualFile)
|
||||
virtualFile.pathBeforeJ2K = virtualFile.path
|
||||
virtualFile.rename(this, fileName)
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ abstract class KotlinGenerateTestSupportActionBase(
|
||||
val list = JBList<TestFramework>(*frameworks.toTypedArray())
|
||||
list.cellRenderer = TestFrameworkListCellRenderer()
|
||||
|
||||
PopupChooserBuilder(list)
|
||||
PopupChooserBuilder<TestFramework>(list)
|
||||
.setFilteringEnabled { (it as TestFramework).name }
|
||||
.setTitle("Choose Framework")
|
||||
.setItemChoosenCallback { consumer(list.selectedValue as TestFramework) }
|
||||
|
||||
@@ -74,7 +74,7 @@ abstract class KotlinGenerateTestSupportActionBase(
|
||||
val list = JBList<TestFramework>(*frameworks.toTypedArray())
|
||||
list.cellRenderer = TestFrameworkListCellRenderer()
|
||||
|
||||
PopupChooserBuilder<TestFramework>(list)
|
||||
PopupChooserBuilder(list)
|
||||
.setFilteringEnabled { (it as TestFramework).name }
|
||||
.setTitle("Choose Framework")
|
||||
.setItemChoosenCallback { consumer(list.selectedValue as TestFramework) }
|
||||
@@ -213,7 +213,7 @@ abstract class ImplementAbstractMemberIntentionBase :
|
||||
selectionMode = ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
|
||||
cellRenderer = renderer
|
||||
}
|
||||
val builder = PopupChooserBuilder(list)
|
||||
val builder = PopupChooserBuilder<PsiElement>(list)
|
||||
renderer.installSpeedSearch(builder)
|
||||
builder
|
||||
.setTitle(CodeInsightBundle.message("intention.implement.abstract.method.class.chooser.title"))
|
||||
|
||||
@@ -213,7 +213,7 @@ abstract class ImplementAbstractMemberIntentionBase :
|
||||
selectionMode = ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
|
||||
cellRenderer = renderer
|
||||
}
|
||||
val builder = PopupChooserBuilder<PsiElement>(list)
|
||||
val builder = PopupChooserBuilder(list)
|
||||
renderer.installSpeedSearch(builder)
|
||||
builder
|
||||
.setTitle(CodeInsightBundle.message("intention.implement.abstract.method.class.chooser.title"))
|
||||
@@ -43,7 +43,7 @@ object KotlinAddOrderEntryActionFactory : KotlinIntentionActionsFactory() {
|
||||
|
||||
override fun getVariants() = PsiReference.EMPTY_ARRAY
|
||||
|
||||
override fun getRangeInElement(): TextRange? {
|
||||
override fun getRangeInElement(): TextRange {
|
||||
val offset = simpleExpression.startOffset - refElement.startOffset
|
||||
return TextRange(offset, offset + simpleExpression.textLength)
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ object KotlinAddOrderEntryActionFactory : KotlinIntentionActionsFactory() {
|
||||
|
||||
override fun getVariants() = PsiReference.EMPTY_ARRAY
|
||||
|
||||
override fun getRangeInElement(): TextRange {
|
||||
override fun getRangeInElement(): TextRange? {
|
||||
val offset = simpleExpression.startOffset - refElement.startOffset
|
||||
return TextRange(offset, offset + simpleExpression.textLength)
|
||||
}
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.quickfix.crossLanguage
|
||||
|
||||
import com.intellij.codeInsight.daemon.QuickFixBundle
|
||||
import com.intellij.codeInsight.intention.IntentionAction
|
||||
import com.intellij.codeInsight.intention.QuickFixFactory
|
||||
import com.intellij.lang.jvm.JvmClass
|
||||
@@ -23,12 +24,15 @@ import com.intellij.lang.jvm.JvmElement
|
||||
import com.intellij.lang.jvm.JvmModifier
|
||||
import com.intellij.lang.jvm.JvmModifiersOwner
|
||||
import com.intellij.lang.jvm.actions.*
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.text.StringUtilRt
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.psi.codeStyle.SuggestedNameInfo
|
||||
import com.intellij.psi.impl.source.tree.java.PsiReferenceExpressionImpl
|
||||
import org.jetbrains.kotlin.asJava.classes.KtLightClassForFacade
|
||||
import org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightElement
|
||||
import org.jetbrains.kotlin.asJava.toLightMethods
|
||||
import org.jetbrains.kotlin.asJava.unwrapped
|
||||
import org.jetbrains.kotlin.caches.resolve.KotlinCacheService
|
||||
@@ -38,7 +42,9 @@ import org.jetbrains.kotlin.descriptors.SourceElement
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.impl.ClassDescriptorImpl
|
||||
import org.jetbrains.kotlin.descriptors.impl.MutablePackageFragmentDescriptor
|
||||
import org.jetbrains.kotlin.idea.KotlinLanguage
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
|
||||
import org.jetbrains.kotlin.idea.core.ShortenReferences
|
||||
import org.jetbrains.kotlin.idea.core.appendModifier
|
||||
import org.jetbrains.kotlin.idea.quickfix.AddModifierFix
|
||||
import org.jetbrains.kotlin.idea.quickfix.RemoveModifierFix
|
||||
@@ -61,6 +67,7 @@ import org.jetbrains.kotlin.load.java.structure.impl.JavaTypeParameterImpl
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.createSmartPointer
|
||||
import org.jetbrains.kotlin.psi.psiUtil.visibilityModifierType
|
||||
import org.jetbrains.kotlin.resolve.annotations.JVM_FIELD_ANNOTATION_FQ_NAME
|
||||
import org.jetbrains.kotlin.resolve.annotations.JVM_STATIC_ANNOTATION_FQ_NAME
|
||||
@@ -146,7 +153,7 @@ class KotlinElementActionsFactory : JvmElementActionsFactory() {
|
||||
val info = callableInfos.first() as PropertyInfo
|
||||
return buildString {
|
||||
append("Add '")
|
||||
if (info.isLateinitPreferred) {
|
||||
if (info.isLateinitPreferred || info.modifierList?.hasModifier(KtTokens.LATEINIT_KEYWORD) == true) {
|
||||
append("lateinit ")
|
||||
}
|
||||
append(if (info.writable) "var" else "val")
|
||||
@@ -345,30 +352,35 @@ class KotlinElementActionsFactory : JvmElementActionsFactory() {
|
||||
override fun createAddFieldActions(targetClass: JvmClass, request: CreateFieldRequest): List<IntentionAction> {
|
||||
val targetContainer = targetClass.toKtClassOrFile() ?: return emptyList()
|
||||
|
||||
val modifierBuilder = ModifierBuilder(targetContainer, allowJvmStatic = false).apply {
|
||||
addJvmModifiers(request.modifiers)
|
||||
addAnnotation(JVM_FIELD_ANNOTATION_FQ_NAME)
|
||||
}
|
||||
if (!modifierBuilder.isValid) return emptyList()
|
||||
|
||||
val resolutionFacade = targetContainer.getResolutionFacade()
|
||||
val typeInfo = request.fieldType.toKotlinTypeInfo(resolutionFacade)
|
||||
val writable = JvmModifier.FINAL !in request.modifiers
|
||||
val propertyInfo = PropertyInfo(
|
||||
request.fieldName,
|
||||
TypeInfo.Empty,
|
||||
typeInfo,
|
||||
writable,
|
||||
listOf(targetContainer),
|
||||
isForCompanion = JvmModifier.STATIC in request.modifiers,
|
||||
modifierList = modifierBuilder.modifierList,
|
||||
withInitializer = true
|
||||
|
||||
fun propertyInfo(lateinit: Boolean) = PropertyInfo(
|
||||
request.fieldName,
|
||||
TypeInfo.Empty,
|
||||
typeInfo,
|
||||
writable,
|
||||
listOf(targetContainer),
|
||||
isLateinitPreferred = false, // Dont set it to `lateinit` because it works via templates that brings issues in batch field adding
|
||||
isForCompanion = JvmModifier.STATIC in request.modifiers,
|
||||
modifierList = ModifierBuilder(targetContainer, allowJvmStatic = false).apply {
|
||||
addJvmModifiers(request.modifiers)
|
||||
if (modifierList.children.none { it.node.elementType in KtTokens.VISIBILITY_MODIFIERS })
|
||||
addJvmModifier(JvmModifier.PUBLIC)
|
||||
if (lateinit)
|
||||
modifierList.appendModifier(KtTokens.LATEINIT_KEYWORD)
|
||||
if (!request.modifiers.contains(JvmModifier.PRIVATE) && !lateinit)
|
||||
addAnnotation(JVM_FIELD_ANNOTATION_FQ_NAME)
|
||||
}.modifierList,
|
||||
withInitializer = !lateinit
|
||||
)
|
||||
|
||||
val propertyInfos = if (writable) {
|
||||
listOf(propertyInfo, propertyInfo.copyProperty(isLateinitPreferred = true))
|
||||
listOf(propertyInfo(false), propertyInfo(true))
|
||||
}
|
||||
else {
|
||||
listOf(propertyInfo)
|
||||
listOf(propertyInfo(false))
|
||||
}
|
||||
return propertyInfos.map { CreatePropertyFix(targetClass, targetContainer, it) }
|
||||
}
|
||||
@@ -404,6 +416,61 @@ class KotlinElementActionsFactory : JvmElementActionsFactory() {
|
||||
}
|
||||
return listOf(action)
|
||||
}
|
||||
|
||||
override fun createAddAnnotationActions(target: JvmModifiersOwner, request: AnnotationRequest): List<IntentionAction> {
|
||||
val declaration = (target as? KtLightElement<*, *>)?.kotlinOrigin as? KtModifierListOwner ?: return emptyList()
|
||||
if (declaration.language != KotlinLanguage.INSTANCE) return emptyList()
|
||||
return listOf(CreateAnnotationAction(declaration, request))
|
||||
}
|
||||
|
||||
private class CreateAnnotationAction(
|
||||
target: KtModifierListOwner,
|
||||
val request: AnnotationRequest
|
||||
) : IntentionAction {
|
||||
|
||||
private val pointer = target.createSmartPointer()
|
||||
|
||||
override fun startInWriteAction(): Boolean = true
|
||||
|
||||
override fun getText(): String =
|
||||
QuickFixBundle.message("create.annotation.text", StringUtilRt.getShortName(request.qualifiedName))
|
||||
|
||||
override fun getFamilyName(): String = QuickFixBundle.message("create.annotation.family")
|
||||
|
||||
override fun isAvailable(project: Project, editor: Editor?, file: PsiFile?): Boolean = pointer.element != null
|
||||
|
||||
|
||||
override fun invoke(project: Project, editor: Editor?, file: PsiFile?) {
|
||||
val target = pointer.element ?: return
|
||||
val kotlinAnnotation = JavaPsiFacade.getInstance(project).findClass(
|
||||
request.qualifiedName,
|
||||
target.resolveScope
|
||||
)?.language == KotlinLanguage.INSTANCE
|
||||
val entry = target.addAnnotationEntry(
|
||||
KtPsiFactory(target)
|
||||
.createAnnotationEntry(
|
||||
"@${request.qualifiedName}${
|
||||
request.attributes.mapIndexed { i, p ->
|
||||
if (!kotlinAnnotation && i == 0 && p.name == "value")
|
||||
renderAttributeValue(p.value).toString()
|
||||
else
|
||||
"${p.name} = ${renderAttributeValue(p.value)}"
|
||||
}.joinToString(", ", "(", ")")
|
||||
}"
|
||||
)
|
||||
)
|
||||
|
||||
ShortenReferences.DEFAULT.process(entry)
|
||||
}
|
||||
|
||||
private fun renderAttributeValue(annotationAttributeRequest: AnnotationAttributeValueRequest) =
|
||||
when (annotationAttributeRequest) {
|
||||
is AnnotationAttributeValueRequest.PrimitiveValue -> annotationAttributeRequest.value
|
||||
is AnnotationAttributeValueRequest.StringValue -> "\"" + annotationAttributeRequest.value + "\""
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun JvmPsiConversionHelper.asPsiType(param: Pair<SuggestedNameInfo, List<ExpectedType>>): PsiType? =
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.quickfix.crossLanguage
|
||||
|
||||
import com.intellij.codeInsight.daemon.QuickFixBundle
|
||||
import com.intellij.codeInsight.intention.IntentionAction
|
||||
import com.intellij.codeInsight.intention.QuickFixFactory
|
||||
import com.intellij.lang.jvm.JvmClass
|
||||
@@ -24,15 +23,12 @@ import com.intellij.lang.jvm.JvmElement
|
||||
import com.intellij.lang.jvm.JvmModifier
|
||||
import com.intellij.lang.jvm.JvmModifiersOwner
|
||||
import com.intellij.lang.jvm.actions.*
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.text.StringUtilRt
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.psi.codeStyle.SuggestedNameInfo
|
||||
import com.intellij.psi.impl.source.tree.java.PsiReferenceExpressionImpl
|
||||
import org.jetbrains.kotlin.asJava.classes.KtLightClassForFacade
|
||||
import org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightElement
|
||||
import org.jetbrains.kotlin.asJava.toLightMethods
|
||||
import org.jetbrains.kotlin.asJava.unwrapped
|
||||
import org.jetbrains.kotlin.caches.resolve.KotlinCacheService
|
||||
@@ -42,9 +38,7 @@ import org.jetbrains.kotlin.descriptors.SourceElement
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.impl.ClassDescriptorImpl
|
||||
import org.jetbrains.kotlin.descriptors.impl.MutablePackageFragmentDescriptor
|
||||
import org.jetbrains.kotlin.idea.KotlinLanguage
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
|
||||
import org.jetbrains.kotlin.idea.core.ShortenReferences
|
||||
import org.jetbrains.kotlin.idea.core.appendModifier
|
||||
import org.jetbrains.kotlin.idea.quickfix.AddModifierFix
|
||||
import org.jetbrains.kotlin.idea.quickfix.RemoveModifierFix
|
||||
@@ -67,7 +61,6 @@ import org.jetbrains.kotlin.load.java.structure.impl.JavaTypeParameterImpl
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.createSmartPointer
|
||||
import org.jetbrains.kotlin.psi.psiUtil.visibilityModifierType
|
||||
import org.jetbrains.kotlin.resolve.annotations.JVM_FIELD_ANNOTATION_FQ_NAME
|
||||
import org.jetbrains.kotlin.resolve.annotations.JVM_STATIC_ANNOTATION_FQ_NAME
|
||||
@@ -153,7 +146,7 @@ class KotlinElementActionsFactory : JvmElementActionsFactory() {
|
||||
val info = callableInfos.first() as PropertyInfo
|
||||
return buildString {
|
||||
append("Add '")
|
||||
if (info.isLateinitPreferred || info.modifierList?.hasModifier(KtTokens.LATEINIT_KEYWORD) == true) {
|
||||
if (info.isLateinitPreferred) {
|
||||
append("lateinit ")
|
||||
}
|
||||
append(if (info.writable) "var" else "val")
|
||||
@@ -352,35 +345,30 @@ class KotlinElementActionsFactory : JvmElementActionsFactory() {
|
||||
override fun createAddFieldActions(targetClass: JvmClass, request: CreateFieldRequest): List<IntentionAction> {
|
||||
val targetContainer = targetClass.toKtClassOrFile() ?: return emptyList()
|
||||
|
||||
val modifierBuilder = ModifierBuilder(targetContainer, allowJvmStatic = false).apply {
|
||||
addJvmModifiers(request.modifiers)
|
||||
addAnnotation(JVM_FIELD_ANNOTATION_FQ_NAME)
|
||||
}
|
||||
if (!modifierBuilder.isValid) return emptyList()
|
||||
|
||||
val resolutionFacade = targetContainer.getResolutionFacade()
|
||||
val typeInfo = request.fieldType.toKotlinTypeInfo(resolutionFacade)
|
||||
val writable = JvmModifier.FINAL !in request.modifiers
|
||||
|
||||
fun propertyInfo(lateinit: Boolean) = PropertyInfo(
|
||||
request.fieldName,
|
||||
TypeInfo.Empty,
|
||||
typeInfo,
|
||||
writable,
|
||||
listOf(targetContainer),
|
||||
isLateinitPreferred = false, // Dont set it to `lateinit` because it works via templates that brings issues in batch field adding
|
||||
isForCompanion = JvmModifier.STATIC in request.modifiers,
|
||||
modifierList = ModifierBuilder(targetContainer, allowJvmStatic = false).apply {
|
||||
addJvmModifiers(request.modifiers)
|
||||
if (modifierList.children.none { it.node.elementType in KtTokens.VISIBILITY_MODIFIERS })
|
||||
addJvmModifier(JvmModifier.PUBLIC)
|
||||
if (lateinit)
|
||||
modifierList.appendModifier(KtTokens.LATEINIT_KEYWORD)
|
||||
if (!request.modifiers.contains(JvmModifier.PRIVATE) && !lateinit)
|
||||
addAnnotation(JVM_FIELD_ANNOTATION_FQ_NAME)
|
||||
}.modifierList,
|
||||
withInitializer = !lateinit
|
||||
val propertyInfo = PropertyInfo(
|
||||
request.fieldName,
|
||||
TypeInfo.Empty,
|
||||
typeInfo,
|
||||
writable,
|
||||
listOf(targetContainer),
|
||||
isForCompanion = JvmModifier.STATIC in request.modifiers,
|
||||
modifierList = modifierBuilder.modifierList,
|
||||
withInitializer = true
|
||||
)
|
||||
|
||||
val propertyInfos = if (writable) {
|
||||
listOf(propertyInfo(false), propertyInfo(true))
|
||||
listOf(propertyInfo, propertyInfo.copyProperty(isLateinitPreferred = true))
|
||||
}
|
||||
else {
|
||||
listOf(propertyInfo(false))
|
||||
listOf(propertyInfo)
|
||||
}
|
||||
return propertyInfos.map { CreatePropertyFix(targetClass, targetContainer, it) }
|
||||
}
|
||||
@@ -416,61 +404,6 @@ class KotlinElementActionsFactory : JvmElementActionsFactory() {
|
||||
}
|
||||
return listOf(action)
|
||||
}
|
||||
|
||||
override fun createAddAnnotationActions(target: JvmModifiersOwner, request: AnnotationRequest): List<IntentionAction> {
|
||||
val declaration = (target as? KtLightElement<*, *>)?.kotlinOrigin as? KtModifierListOwner ?: return emptyList()
|
||||
if (declaration.language != KotlinLanguage.INSTANCE) return emptyList()
|
||||
return listOf(CreateAnnotationAction(declaration, request))
|
||||
}
|
||||
|
||||
private class CreateAnnotationAction(
|
||||
target: KtModifierListOwner,
|
||||
val request: AnnotationRequest
|
||||
) : IntentionAction {
|
||||
|
||||
private val pointer = target.createSmartPointer()
|
||||
|
||||
override fun startInWriteAction(): Boolean = true
|
||||
|
||||
override fun getText(): String =
|
||||
QuickFixBundle.message("create.annotation.text", StringUtilRt.getShortName(request.qualifiedName))
|
||||
|
||||
override fun getFamilyName(): String = QuickFixBundle.message("create.annotation.family")
|
||||
|
||||
override fun isAvailable(project: Project, editor: Editor?, file: PsiFile?): Boolean = pointer.element != null
|
||||
|
||||
|
||||
override fun invoke(project: Project, editor: Editor?, file: PsiFile?) {
|
||||
val target = pointer.element ?: return
|
||||
val kotlinAnnotation = JavaPsiFacade.getInstance(project).findClass(
|
||||
request.qualifiedName,
|
||||
target.resolveScope
|
||||
)?.language == KotlinLanguage.INSTANCE
|
||||
val entry = target.addAnnotationEntry(
|
||||
KtPsiFactory(target)
|
||||
.createAnnotationEntry(
|
||||
"@${request.qualifiedName}${
|
||||
request.attributes.mapIndexed { i, p ->
|
||||
if (!kotlinAnnotation && i == 0 && p.name == "value")
|
||||
renderAttributeValue(p.value).toString()
|
||||
else
|
||||
"${p.name} = ${renderAttributeValue(p.value)}"
|
||||
}.joinToString(", ", "(", ")")
|
||||
}"
|
||||
)
|
||||
)
|
||||
|
||||
ShortenReferences.DEFAULT.process(entry)
|
||||
}
|
||||
|
||||
private fun renderAttributeValue(annotationAttributeRequest: AnnotationAttributeValueRequest) =
|
||||
when (annotationAttributeRequest) {
|
||||
is AnnotationAttributeValueRequest.PrimitiveValue -> annotationAttributeRequest.value
|
||||
is AnnotationAttributeValueRequest.StringValue -> "\"" + annotationAttributeRequest.value + "\""
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun JvmPsiConversionHelper.asPsiType(param: Pair<SuggestedNameInfo, List<ExpectedType>>): PsiType? =
|
||||
@@ -263,7 +263,7 @@ fun <T, E : PsiElement> getPsiElementPopup(
|
||||
}
|
||||
}
|
||||
|
||||
return with(PopupChooserBuilder(list)) {
|
||||
return with(PopupChooserBuilder<E>(list)) {
|
||||
title?.let { setTitle(it) }
|
||||
renderer.installSpeedSearch(this, true)
|
||||
setItemChoosenCallback {
|
||||
|
||||
@@ -263,7 +263,7 @@ fun <T, E : PsiElement> getPsiElementPopup(
|
||||
}
|
||||
}
|
||||
|
||||
return with(PopupChooserBuilder<E>(list)) {
|
||||
return with(PopupChooserBuilder(list)) {
|
||||
title?.let { setTitle(it) }
|
||||
renderer.installSpeedSearch(this, true)
|
||||
setItemChoosenCallback {
|
||||
@@ -34,22 +34,22 @@ class KotlinRenameDispatcherHandler : RenameHandler {
|
||||
private val handlers: Array<out RenameHandler> get() = Extensions.getExtensions(EP_NAME)
|
||||
}
|
||||
|
||||
internal fun getRenameHandler(dataContext: DataContext?): RenameHandler? {
|
||||
internal fun getRenameHandler(dataContext: DataContext): RenameHandler? {
|
||||
val availableHandlers = handlers.filterTo(LinkedHashSet()) { it.isRenaming(dataContext) }
|
||||
availableHandlers.singleOrNull()?.let { return it }
|
||||
availableHandlers.firstIsInstanceOrNull<KotlinMemberInplaceRenameHandler>()?.let { availableHandlers -= it }
|
||||
return availableHandlers.firstOrNull()
|
||||
}
|
||||
|
||||
override fun isAvailableOnDataContext(dataContext: DataContext?) = handlers.any { it.isAvailableOnDataContext(dataContext) }
|
||||
override fun isAvailableOnDataContext(dataContext: DataContext) = handlers.any { it.isAvailableOnDataContext(dataContext) }
|
||||
|
||||
override fun isRenaming(dataContext: DataContext?) = isAvailableOnDataContext(dataContext)
|
||||
override fun isRenaming(dataContext: DataContext) = isAvailableOnDataContext(dataContext)
|
||||
|
||||
override fun invoke(project: Project, editor: Editor?, file: PsiFile?, dataContext: DataContext?) {
|
||||
override fun invoke(project: Project, editor: Editor?, file: PsiFile?, dataContext: DataContext) {
|
||||
getRenameHandler(dataContext)?.invoke(project, editor, file, dataContext)
|
||||
}
|
||||
|
||||
override fun invoke(project: Project, elements: Array<out PsiElement>, dataContext: DataContext?) {
|
||||
override fun invoke(project: Project, elements: Array<out PsiElement>, dataContext: DataContext) {
|
||||
getRenameHandler(dataContext)?.invoke(project, elements, dataContext)
|
||||
}
|
||||
}
|
||||
@@ -34,22 +34,22 @@ class KotlinRenameDispatcherHandler : RenameHandler {
|
||||
private val handlers: Array<out RenameHandler> get() = Extensions.getExtensions(EP_NAME)
|
||||
}
|
||||
|
||||
internal fun getRenameHandler(dataContext: DataContext): RenameHandler? {
|
||||
internal fun getRenameHandler(dataContext: DataContext?): RenameHandler? {
|
||||
val availableHandlers = handlers.filterTo(LinkedHashSet()) { it.isRenaming(dataContext) }
|
||||
availableHandlers.singleOrNull()?.let { return it }
|
||||
availableHandlers.firstIsInstanceOrNull<KotlinMemberInplaceRenameHandler>()?.let { availableHandlers -= it }
|
||||
return availableHandlers.firstOrNull()
|
||||
}
|
||||
|
||||
override fun isAvailableOnDataContext(dataContext: DataContext) = handlers.any { it.isAvailableOnDataContext(dataContext) }
|
||||
override fun isAvailableOnDataContext(dataContext: DataContext?) = handlers.any { it.isAvailableOnDataContext(dataContext) }
|
||||
|
||||
override fun isRenaming(dataContext: DataContext) = isAvailableOnDataContext(dataContext)
|
||||
override fun isRenaming(dataContext: DataContext?) = isAvailableOnDataContext(dataContext)
|
||||
|
||||
override fun invoke(project: Project, editor: Editor?, file: PsiFile?, dataContext: DataContext) {
|
||||
override fun invoke(project: Project, editor: Editor?, file: PsiFile?, dataContext: DataContext?) {
|
||||
getRenameHandler(dataContext)?.invoke(project, editor, file, dataContext)
|
||||
}
|
||||
|
||||
override fun invoke(project: Project, elements: Array<out PsiElement>, dataContext: DataContext) {
|
||||
override fun invoke(project: Project, elements: Array<out PsiElement>, dataContext: DataContext?) {
|
||||
getRenameHandler(dataContext)?.invoke(project, elements, dataContext)
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ open class KotlinVariableInplaceRenameHandler : VariableInplaceRenameHandler() {
|
||||
editor: Editor,
|
||||
currentName: String,
|
||||
oldName: String
|
||||
) : super(elementToRename, editor, editor.project, currentName, oldName)
|
||||
) : super(elementToRename, editor, editor.project!!, currentName, oldName)
|
||||
|
||||
override fun acceptReference(reference: PsiReference): Boolean {
|
||||
val refElement = reference.element
|
||||
|
||||
@@ -42,7 +42,7 @@ open class KotlinVariableInplaceRenameHandler : VariableInplaceRenameHandler() {
|
||||
editor: Editor,
|
||||
currentName: String,
|
||||
oldName: String
|
||||
) : super(elementToRename, editor, editor.project!!, currentName, oldName)
|
||||
) : super(elementToRename, editor, editor.project, currentName, oldName)
|
||||
|
||||
override fun acceptReference(reference: PsiReference): Boolean {
|
||||
val refElement = reference.element
|
||||
@@ -37,7 +37,7 @@ class RenameBackingFieldReferenceHandler: KotlinVariableInplaceRenameHandler() {
|
||||
CodeInsightUtils.showErrorHint(project, editor, "Rename is not applicable to backing field reference", "Rename", null)
|
||||
}
|
||||
|
||||
override fun invoke(project: Project, elements: Array<out PsiElement>, dataContext: DataContext?) {
|
||||
override fun invoke(project: Project, elements: Array<out PsiElement>, dataContext: DataContext) {
|
||||
// Do nothing: this method is called not from editor
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class RenameBackingFieldReferenceHandler: KotlinVariableInplaceRenameHandler() {
|
||||
CodeInsightUtils.showErrorHint(project, editor, "Rename is not applicable to backing field reference", "Rename", null)
|
||||
}
|
||||
|
||||
override fun invoke(project: Project, elements: Array<out PsiElement>, dataContext: DataContext) {
|
||||
override fun invoke(project: Project, elements: Array<out PsiElement>, dataContext: DataContext?) {
|
||||
// Do nothing: this method is called not from editor
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ class RenameDynamicMemberHandler: KotlinVariableInplaceRenameHandler() {
|
||||
CodeInsightUtils.showErrorHint(project, editor, "Rename is not applicable to dynamically invoked members", "Rename", null)
|
||||
}
|
||||
|
||||
override fun invoke(project: Project, elements: Array<out PsiElement>, dataContext: DataContext?) {
|
||||
override fun invoke(project: Project, elements: Array<out PsiElement>, dataContext: DataContext) {
|
||||
// Do nothing: this method is called not from editor
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class RenameDynamicMemberHandler: KotlinVariableInplaceRenameHandler() {
|
||||
CodeInsightUtils.showErrorHint(project, editor, "Rename is not applicable to dynamically invoked members", "Rename", null)
|
||||
}
|
||||
|
||||
override fun invoke(project: Project, elements: Array<out PsiElement>, dataContext: DataContext) {
|
||||
override fun invoke(project: Project, elements: Array<out PsiElement>, dataContext: DataContext?) {
|
||||
// Do nothing: this method is called not from editor
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ class RenameKotlinImplicitLambdaParameter : KotlinVariableInplaceRenameHandler()
|
||||
}
|
||||
}
|
||||
|
||||
override fun invoke(project: Project, elements: Array<out PsiElement>, dataContext: DataContext?) {
|
||||
override fun invoke(project: Project, elements: Array<out PsiElement>, dataContext: DataContext) {
|
||||
// Do nothing: this method is called not from editor
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class RenameKotlinImplicitLambdaParameter : KotlinVariableInplaceRenameHandler()
|
||||
}
|
||||
}
|
||||
|
||||
override fun invoke(project: Project, elements: Array<out PsiElement>, dataContext: DataContext) {
|
||||
override fun invoke(project: Project, elements: Array<out PsiElement>, dataContext: DataContext?) {
|
||||
// Do nothing: this method is called not from editor
|
||||
}
|
||||
}
|
||||
@@ -29,9 +29,7 @@ import org.jetbrains.kotlin.psi.*
|
||||
|
||||
|
||||
class RenameOnSecondaryConstructorHandler : RenameHandler {
|
||||
override fun isAvailableOnDataContext(dataContext: DataContext?): Boolean {
|
||||
if (dataContext == null) return false
|
||||
|
||||
override fun isAvailableOnDataContext(dataContext: DataContext): Boolean {
|
||||
val editor = CommonDataKeys.EDITOR.getData(dataContext) ?: return false
|
||||
val file = CommonDataKeys.PSI_FILE.getData(dataContext) ?: return false
|
||||
|
||||
@@ -42,7 +40,7 @@ class RenameOnSecondaryConstructorHandler : RenameHandler {
|
||||
return element != null
|
||||
}
|
||||
|
||||
override fun isRenaming(dataContext: DataContext?): Boolean = isAvailableOnDataContext(dataContext)
|
||||
override fun isRenaming(dataContext: DataContext): Boolean = isAvailableOnDataContext(dataContext)
|
||||
|
||||
override fun invoke(project: Project, editor: Editor, file: PsiFile, dataContext: DataContext?) {
|
||||
CodeInsightUtils.showErrorHint(project, editor, "Rename is not applicable to secondary constructors", "Rename", null)
|
||||
|
||||
@@ -29,7 +29,9 @@ import org.jetbrains.kotlin.psi.*
|
||||
|
||||
|
||||
class RenameOnSecondaryConstructorHandler : RenameHandler {
|
||||
override fun isAvailableOnDataContext(dataContext: DataContext): Boolean {
|
||||
override fun isAvailableOnDataContext(dataContext: DataContext?): Boolean {
|
||||
if (dataContext == null) return false
|
||||
|
||||
val editor = CommonDataKeys.EDITOR.getData(dataContext) ?: return false
|
||||
val file = CommonDataKeys.PSI_FILE.getData(dataContext) ?: return false
|
||||
|
||||
@@ -40,7 +42,7 @@ class RenameOnSecondaryConstructorHandler : RenameHandler {
|
||||
return element != null
|
||||
}
|
||||
|
||||
override fun isRenaming(dataContext: DataContext): Boolean = isAvailableOnDataContext(dataContext)
|
||||
override fun isRenaming(dataContext: DataContext?): Boolean = isAvailableOnDataContext(dataContext)
|
||||
|
||||
override fun invoke(project: Project, editor: Editor, file: PsiFile, dataContext: DataContext?) {
|
||||
CodeInsightUtils.showErrorHint(project, editor, "Rename is not applicable to secondary constructors", "Rename", null)
|
||||
@@ -18,15 +18,14 @@ import org.jetbrains.kotlin.psi.KtSimpleNameExpression
|
||||
import org.jetbrains.kotlin.resolve.calls.tower.isSynthesized
|
||||
|
||||
class RenameSyntheticDeclarationByReferenceHandler : RenameHandler {
|
||||
override fun isAvailableOnDataContext(dataContext: DataContext?): Boolean {
|
||||
if (dataContext == null) return false
|
||||
override fun isAvailableOnDataContext(dataContext: DataContext): Boolean {
|
||||
val file = CommonDataKeys.PSI_FILE.getData(dataContext) ?: return false
|
||||
val editor = CommonDataKeys.EDITOR.getData(dataContext) ?: return false
|
||||
val refExpression = file.findElementForRename<KtSimpleNameExpression>(editor.caretModel.offset) ?: return false
|
||||
return (refExpression.resolveToCall()?.resultingDescriptor)?.isSynthesized ?: false
|
||||
}
|
||||
|
||||
override fun isRenaming(dataContext: DataContext?) = isAvailableOnDataContext(dataContext)
|
||||
override fun isRenaming(dataContext: DataContext) = isAvailableOnDataContext(dataContext)
|
||||
|
||||
override fun invoke(project: Project, editor: Editor, file: PsiFile, dataContext: DataContext?) {
|
||||
CodeInsightUtils.showErrorHint(project, editor, "Rename is not applicable to synthetic declaration", "Rename", null)
|
||||
|
||||
@@ -18,14 +18,15 @@ import org.jetbrains.kotlin.psi.KtSimpleNameExpression
|
||||
import org.jetbrains.kotlin.resolve.calls.tower.isSynthesized
|
||||
|
||||
class RenameSyntheticDeclarationByReferenceHandler : RenameHandler {
|
||||
override fun isAvailableOnDataContext(dataContext: DataContext): Boolean {
|
||||
override fun isAvailableOnDataContext(dataContext: DataContext?): Boolean {
|
||||
if (dataContext == null) return false
|
||||
val file = CommonDataKeys.PSI_FILE.getData(dataContext) ?: return false
|
||||
val editor = CommonDataKeys.EDITOR.getData(dataContext) ?: return false
|
||||
val refExpression = file.findElementForRename<KtSimpleNameExpression>(editor.caretModel.offset) ?: return false
|
||||
return (refExpression.resolveToCall()?.resultingDescriptor)?.isSynthesized ?: false
|
||||
}
|
||||
|
||||
override fun isRenaming(dataContext: DataContext) = isAvailableOnDataContext(dataContext)
|
||||
override fun isRenaming(dataContext: DataContext?) = isAvailableOnDataContext(dataContext)
|
||||
|
||||
override fun invoke(project: Project, editor: Editor, file: PsiFile, dataContext: DataContext?) {
|
||||
CodeInsightUtils.showErrorHint(project, editor, "Rename is not applicable to synthetic declaration", "Rename", null)
|
||||
@@ -75,8 +75,6 @@ sealed class KotlinUsageContextDataFlowPanelBase(
|
||||
|
||||
override fun isToShowPreviewButton() = false
|
||||
|
||||
override fun isToShowCloseButton() = false
|
||||
|
||||
override fun isAutoScroll() = false
|
||||
|
||||
override fun setAutoScroll(autoScroll: Boolean) {}
|
||||
|
||||
@@ -75,6 +75,8 @@ sealed class KotlinUsageContextDataFlowPanelBase(
|
||||
|
||||
override fun isToShowPreviewButton() = false
|
||||
|
||||
override fun isToShowCloseButton() = false
|
||||
|
||||
override fun isAutoScroll() = false
|
||||
|
||||
override fun setAutoScroll(autoScroll: Boolean) {}
|
||||
@@ -193,32 +193,6 @@ abstract class AbstractConfigureKotlinTest : PlatformTestCase() {
|
||||
KotlinWithLibraryConfigurator.FileState.DO_NOT_COPY -> jarFromDist
|
||||
}
|
||||
|
||||
protected fun configure(module: Module, jarState: FileState, configurator: KotlinProjectConfigurator) {
|
||||
if (configurator is KotlinJavaModuleConfigurator) {
|
||||
configure(listOf(module), jarState,
|
||||
configurator as KotlinWithLibraryConfigurator,
|
||||
pathToExistentRuntimeJar, pathToNonexistentRuntimeJar)
|
||||
}
|
||||
if (configurator is KotlinJsModuleConfigurator) {
|
||||
configure(listOf(module), jarState,
|
||||
configurator as KotlinWithLibraryConfigurator,
|
||||
pathToExistentJsJar, pathToNonexistentJsJar)
|
||||
}
|
||||
}
|
||||
|
||||
private val pathToNonexistentRuntimeJar: String
|
||||
get() {
|
||||
val pathToTempKotlinRuntimeJar = FileUtil.getTempDirectory() + "/kotlin-runtime.jar"
|
||||
PlatformTestCase.myFilesToDelete.add(File(pathToTempKotlinRuntimeJar))
|
||||
return pathToTempKotlinRuntimeJar
|
||||
}
|
||||
|
||||
private val pathToNonexistentJsJar: String
|
||||
get() {
|
||||
val pathToTempKotlinRuntimeJar = FileUtil.getTempDirectory() + "/" + PathUtil.JS_LIB_JAR_NAME
|
||||
PlatformTestCase.myFilesToDelete.add(File(pathToTempKotlinRuntimeJar))
|
||||
return pathToTempKotlinRuntimeJar
|
||||
}
|
||||
|
||||
private val pathToExistentRuntimeJar: String
|
||||
get() = PathUtil.kotlinPathsForDistDirectory.stdlibPath.parent
|
||||
@@ -256,6 +230,37 @@ abstract class AbstractConfigureKotlinTest : PlatformTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
protected fun configure(module: Module, jarState: FileState, configurator: KotlinProjectConfigurator) {
|
||||
if (configurator is KotlinJavaModuleConfigurator) {
|
||||
configure(
|
||||
listOf(module), jarState,
|
||||
configurator as KotlinWithLibraryConfigurator,
|
||||
pathToExistentRuntimeJar, pathToNonexistentRuntimeJar
|
||||
)
|
||||
}
|
||||
if (configurator is KotlinJsModuleConfigurator) {
|
||||
configure(
|
||||
listOf(module), jarState,
|
||||
configurator as KotlinWithLibraryConfigurator,
|
||||
pathToExistentJsJar, pathToNonexistentJsJar
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private val pathToNonexistentRuntimeJar: String
|
||||
get() {
|
||||
val pathToTempKotlinRuntimeJar = FileUtil.getTempDirectory() + "/kotlin-runtime.jar"
|
||||
myFilesToDelete.add(File(pathToTempKotlinRuntimeJar))
|
||||
return pathToTempKotlinRuntimeJar
|
||||
}
|
||||
|
||||
private val pathToNonexistentJsJar: String
|
||||
get() {
|
||||
val pathToTempKotlinRuntimeJar = FileUtil.getTempDirectory() + "/" + PathUtil.JS_LIB_JAR_NAME
|
||||
myFilesToDelete.add(File(pathToTempKotlinRuntimeJar))
|
||||
return pathToTempKotlinRuntimeJar
|
||||
}
|
||||
|
||||
override fun getTestProjectJdk(): Sdk {
|
||||
val projectRootManager = ProjectRootManager.getInstance(project)
|
||||
return projectRootManager.projectSdk ?: throw IllegalStateException("SDK ${projectRootManager.projectSdkName} was not found")
|
||||
|
||||
@@ -193,6 +193,32 @@ abstract class AbstractConfigureKotlinTest : PlatformTestCase() {
|
||||
KotlinWithLibraryConfigurator.FileState.DO_NOT_COPY -> jarFromDist
|
||||
}
|
||||
|
||||
protected fun configure(module: Module, jarState: FileState, configurator: KotlinProjectConfigurator) {
|
||||
if (configurator is KotlinJavaModuleConfigurator) {
|
||||
configure(listOf(module), jarState,
|
||||
configurator as KotlinWithLibraryConfigurator,
|
||||
pathToExistentRuntimeJar, pathToNonexistentRuntimeJar)
|
||||
}
|
||||
if (configurator is KotlinJsModuleConfigurator) {
|
||||
configure(listOf(module), jarState,
|
||||
configurator as KotlinWithLibraryConfigurator,
|
||||
pathToExistentJsJar, pathToNonexistentJsJar)
|
||||
}
|
||||
}
|
||||
|
||||
private val pathToNonexistentRuntimeJar: String
|
||||
get() {
|
||||
val pathToTempKotlinRuntimeJar = FileUtil.getTempDirectory() + "/kotlin-runtime.jar"
|
||||
PlatformTestCase.myFilesToDelete.add(File(pathToTempKotlinRuntimeJar))
|
||||
return pathToTempKotlinRuntimeJar
|
||||
}
|
||||
|
||||
private val pathToNonexistentJsJar: String
|
||||
get() {
|
||||
val pathToTempKotlinRuntimeJar = FileUtil.getTempDirectory() + "/" + PathUtil.JS_LIB_JAR_NAME
|
||||
PlatformTestCase.myFilesToDelete.add(File(pathToTempKotlinRuntimeJar))
|
||||
return pathToTempKotlinRuntimeJar
|
||||
}
|
||||
|
||||
private val pathToExistentRuntimeJar: String
|
||||
get() = PathUtil.kotlinPathsForDistDirectory.stdlibPath.parent
|
||||
@@ -230,37 +256,6 @@ abstract class AbstractConfigureKotlinTest : PlatformTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
protected fun configure(module: Module, jarState: FileState, configurator: KotlinProjectConfigurator) {
|
||||
if (configurator is KotlinJavaModuleConfigurator) {
|
||||
configure(
|
||||
listOf(module), jarState,
|
||||
configurator as KotlinWithLibraryConfigurator,
|
||||
pathToExistentRuntimeJar, pathToNonexistentRuntimeJar
|
||||
)
|
||||
}
|
||||
if (configurator is KotlinJsModuleConfigurator) {
|
||||
configure(
|
||||
listOf(module), jarState,
|
||||
configurator as KotlinWithLibraryConfigurator,
|
||||
pathToExistentJsJar, pathToNonexistentJsJar
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private val pathToNonexistentRuntimeJar: String
|
||||
get() {
|
||||
val pathToTempKotlinRuntimeJar = FileUtil.getTempDirectory() + "/kotlin-runtime.jar"
|
||||
myFilesToDelete.add(File(pathToTempKotlinRuntimeJar))
|
||||
return pathToTempKotlinRuntimeJar
|
||||
}
|
||||
|
||||
private val pathToNonexistentJsJar: String
|
||||
get() {
|
||||
val pathToTempKotlinRuntimeJar = FileUtil.getTempDirectory() + "/" + PathUtil.JS_LIB_JAR_NAME
|
||||
myFilesToDelete.add(File(pathToTempKotlinRuntimeJar))
|
||||
return pathToTempKotlinRuntimeJar
|
||||
}
|
||||
|
||||
override fun getTestProjectJdk(): Sdk {
|
||||
val projectRootManager = ProjectRootManager.getInstance(project)
|
||||
return projectRootManager.projectSdk ?: throw IllegalStateException("SDK ${projectRootManager.projectSdkName} was not found")
|
||||
@@ -98,12 +98,12 @@ public class ConfigureKotlinTest extends AbstractConfigureKotlinTest {
|
||||
Module[] modules = getModules();
|
||||
for (Module module : modules) {
|
||||
if (module.getName().equals("module1")) {
|
||||
Companion.configure(module, KotlinWithLibraryConfigurator.FileState.DO_NOT_COPY, Companion.getJAVA_CONFIGURATOR());
|
||||
configure(module, KotlinWithLibraryConfigurator.FileState.DO_NOT_COPY, Companion.getJAVA_CONFIGURATOR());
|
||||
Companion.assertConfigured(module, Companion.getJAVA_CONFIGURATOR());
|
||||
}
|
||||
else if (module.getName().equals("module2")) {
|
||||
Companion.assertNotConfigured(module, Companion.getJAVA_CONFIGURATOR());
|
||||
Companion.configure(module, KotlinWithLibraryConfigurator.FileState.EXISTS, Companion.getJAVA_CONFIGURATOR());
|
||||
configure(module, KotlinWithLibraryConfigurator.FileState.EXISTS, Companion.getJAVA_CONFIGURATOR());
|
||||
Companion.assertConfigured(module, Companion.getJAVA_CONFIGURATOR());
|
||||
}
|
||||
}
|
||||
@@ -157,7 +157,7 @@ public class ConfigureKotlinTest extends AbstractConfigureKotlinTest {
|
||||
}
|
||||
|
||||
public void testJsLibraryWrongKind() {
|
||||
AbstractConfigureKotlinTest.Companion.assertProperlyConfigured(getModule(), AbstractConfigureKotlinTest.Companion.getJS_CONFIGURATOR());
|
||||
doTestOneJsModule(KotlinWithLibraryConfigurator.FileState.EXISTS);
|
||||
assertEquals(1, ModuleRootManager.getInstance(getModule()).orderEntries().process(new LibraryCountingRootPolicy(), 0).intValue());
|
||||
}
|
||||
|
||||
|
||||
@@ -98,12 +98,12 @@ public class ConfigureKotlinTest extends AbstractConfigureKotlinTest {
|
||||
Module[] modules = getModules();
|
||||
for (Module module : modules) {
|
||||
if (module.getName().equals("module1")) {
|
||||
configure(module, KotlinWithLibraryConfigurator.FileState.DO_NOT_COPY, Companion.getJAVA_CONFIGURATOR());
|
||||
Companion.configure(module, KotlinWithLibraryConfigurator.FileState.DO_NOT_COPY, Companion.getJAVA_CONFIGURATOR());
|
||||
Companion.assertConfigured(module, Companion.getJAVA_CONFIGURATOR());
|
||||
}
|
||||
else if (module.getName().equals("module2")) {
|
||||
Companion.assertNotConfigured(module, Companion.getJAVA_CONFIGURATOR());
|
||||
configure(module, KotlinWithLibraryConfigurator.FileState.EXISTS, Companion.getJAVA_CONFIGURATOR());
|
||||
Companion.configure(module, KotlinWithLibraryConfigurator.FileState.EXISTS, Companion.getJAVA_CONFIGURATOR());
|
||||
Companion.assertConfigured(module, Companion.getJAVA_CONFIGURATOR());
|
||||
}
|
||||
}
|
||||
@@ -157,7 +157,7 @@ public class ConfigureKotlinTest extends AbstractConfigureKotlinTest {
|
||||
}
|
||||
|
||||
public void testJsLibraryWrongKind() {
|
||||
doTestOneJsModule(KotlinWithLibraryConfigurator.FileState.EXISTS);
|
||||
AbstractConfigureKotlinTest.Companion.assertProperlyConfigured(getModule(), AbstractConfigureKotlinTest.Companion.getJS_CONFIGURATOR());
|
||||
assertEquals(1, ModuleRootManager.getInstance(getModule()).orderEntries().process(new LibraryCountingRootPolicy(), 0).intValue());
|
||||
}
|
||||
|
||||
@@ -45,6 +45,13 @@ internal class KotlinOutputChecker(
|
||||
private val JDI_BUG_OUTPUT_PATTERN_2 = Regex("JDWP\\s+exit\\s+error\\s+AGENT_ERROR_NO_JNI_ENV.*]")
|
||||
}
|
||||
|
||||
private lateinit var myTestName: String
|
||||
|
||||
override fun init(testName: String) {
|
||||
super.init(testName)
|
||||
this.myTestName = Character.toLowerCase(testName[0]) + testName.substring(1)
|
||||
}
|
||||
|
||||
// Copied from the base OutputChecker.checkValid(). Need to intercept call to base preprocessBuffer() method
|
||||
override fun checkValid(jdk: Sdk, sortClassPath: Boolean) {
|
||||
if (IdeaLogger.ourErrorsOccurred != null) {
|
||||
|
||||