diff --git a/kotlin-bundled-compiler/build.gradle.kts b/kotlin-bundled-compiler/build.gradle.kts index 8adc5a9df..0ef16b4b8 100644 --- a/kotlin-bundled-compiler/build.gradle.kts +++ b/kotlin-bundled-compiler/build.gradle.kts @@ -13,13 +13,13 @@ val ideaSdkUrl = "https://www.jetbrains.com/intellij-repository/releases/com/jet // properties that might/should be modifiable //val kotlinCompilerTcBuildId: String = project.findProperty("kotlinCompilerTcBuildId") as String? ?: "3546752" -val kotlinPluginUpdateId = project.findProperty("kotlinPluginUpdateId") as String? ?: "169248" // Kotlin Plugin 1.6.21 for Idea 2021.3 +val kotlinPluginUpdateId = project.findProperty("kotlinPluginUpdateId") as String? ?: "286278" // Kotlin Plugin 1.8.10 for Idea 2022.2 -val kotlinCompilerVersion: String = project.findProperty("kotlinCompilerVersion") as String? ?: "1.6.21" -val kotlinxVersion: String = project.findProperty("kolinxVersion") as String? ?: "1.5.2" +val kotlinCompilerVersion: String = project.findProperty("kotlinCompilerVersion") as String? ?: "1.8.10" +val kotlinxVersion: String = project.findProperty("kolinxVersion") as String? ?: "1.6.3" val tcArtifactsPath: String = project.findProperty("tcArtifactsPath") as String? ?: "" -val ideaVersion: String = project.findProperty("ideaVersion") as String? ?: "213.5744.223" //Idea 2021.3 -val kotlinIdeaCompatibleVersionMinor: String = project.findProperty("kotlinIdeaCompatibleVersionMinor") as String? ?: "2021.3" +val ideaVersion: String = project.findProperty("ideaVersion") as String? ?: "222.4459.24" //Idea 2022.2 +val kotlinIdeaCompatibleVersionMinor: String = project.findProperty("kotlinIdeaCompatibleVersionMinor") as String? ?: "2022.2" val ignoreSources: Boolean = true//project.hasProperty("ignoreSources") //directories @@ -195,38 +195,17 @@ val extractPackagesFromKTCompiler by tasks.registering(Jar::class) { } } -val downloadIntellijCoreAndExtractSelectedJars by tasks.registering { - dependsOn(deleteLibrariesFromLibFolder) - val ideaDownloadDir = file("$downloadDir/idea-$ideaVersion") - val locallyDownloadedIntellijCoreFile by extra { file("$ideaDownloadDir/intellij-core.zip") } - - doLast { - if(!locallyDownloadedIntellijCoreFile.exists()) { - ideaArtifactsResolver.downloadTo(ideaArtifactsResolver.INTELLIJ_CORE_ZIP, locallyDownloadedIntellijCoreFile) - } - copy { - from(zipTree(locallyDownloadedIntellijCoreFile)) - - setIncludes(setOf("intellij-core.jar")) - - includeEmptyDirs = false - - into(libDir) - } - } -} - val downloadIdeaDistributionZipAndExtractSelectedJars by tasks.registering { dependsOn(deleteLibrariesFromLibFolder) val ideaDownloadDir = file("$downloadDir/idea-$ideaVersion") val locallyDownloadedIdeaZipFile by extra { file("$ideaDownloadDir/ideaIC.zip") } - val chosenJars by extra { setOf(//"openapi", - //"platform-util-ui", + val chosenJars by extra { setOf( "util", - "idea", - //"trove4j", - "platform-api", - "platform-impl") } + "util_rt", + "idea_rt", + "app" + ) + } doLast { if(!locallyDownloadedIdeaZipFile.exists()) { @@ -328,17 +307,14 @@ val repackageIdeaAndKotlinCompilerSources by tasks.registering(Zip::class) { } val downloadBundled by tasks.registering { - libDir.listFiles()?.filter { it.isFile }?.forEach { it.deleteRecursively() } if (localTCArtifacts) { dependsOn(extractPackagesFromPlugin, extractPackagesFromKTCompiler, - downloadIntellijCoreAndExtractSelectedJars, createIdeDependenciesJar, downloadKotlinxLibraries) } else { dependsOn(extractPackagesFromPlugin, extractPackagesFromKTCompiler, - downloadIntellijCoreAndExtractSelectedJars, createIdeDependenciesJar, downloadKotlinxLibraries) } diff --git a/kotlin-bundled-compiler/src/com/intellij/util/containers/ObjectIntHashMap.java b/kotlin-bundled-compiler/src/com/intellij/util/containers/ObjectIntHashMap.java index c0d47b902..5bed47b52 100644 --- a/kotlin-bundled-compiler/src/com/intellij/util/containers/ObjectIntHashMap.java +++ b/kotlin-bundled-compiler/src/com/intellij/util/containers/ObjectIntHashMap.java @@ -29,6 +29,15 @@ public final int get(@NotNull K key) { return this.get(key, -1); } + @Override + public int getOrDefault(@NotNull K k, int i) { + if(contains(k)) { + return get(k); + } else { + return i; + } + } + @Override public @NotNull Set keySet() { diff --git a/kotlin-eclipse-core/preferences.ini b/kotlin-eclipse-core/preferences.ini index 027eee32f..83aa51126 100644 --- a/kotlin-eclipse-core/preferences.ini +++ b/kotlin-eclipse-core/preferences.ini @@ -1,4 +1,4 @@ -jvmTarget=JVM_1_6 +jvmTarget=JVM_1_8 compilerPlugins/all-open/active=false compilerPlugins/all-open/jarPath=$KOTLIN_HOME/lib/allopen-compiler-plugin.jar compilerPlugins/spring/active=false diff --git a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/imports/importServices.kt b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/imports/importServices.kt index 2ecfa50e5..a43ec7eed 100644 --- a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/imports/importServices.kt +++ b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/imports/importServices.kt @@ -106,7 +106,8 @@ private fun findApplicableCallables( return searchCallableByName(element) .let { module.accept(visitor, it) } - .map { FunctionCandidate(it) } + ?.map { FunctionCandidate(it) } + ?: emptyList() } private fun CallableDescriptor.isReceiverTypeMatching(type: KotlinType): Boolean = diff --git a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/model/KotlinCommonEnvironment.kt b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/model/KotlinCommonEnvironment.kt index b56837e99..2a5f2da73 100644 --- a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/model/KotlinCommonEnvironment.kt +++ b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/model/KotlinCommonEnvironment.kt @@ -43,10 +43,7 @@ import com.intellij.psi.JavaModuleSystem import com.intellij.psi.PsiElementFinder import com.intellij.psi.PsiManager import com.intellij.psi.augment.PsiAugmentProvider -import com.intellij.psi.codeStyle.CodeStyleManager -import com.intellij.psi.codeStyle.CodeStyleSettingsProvider -import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider -import com.intellij.psi.compiled.ClassFileDecompilers +import com.intellij.psi.codeStyle.* import com.intellij.psi.impl.PsiElementFinderImpl import com.intellij.psi.impl.PsiTreeChangePreprocessor import com.intellij.psi.impl.compiled.ClsCustomNavigationPolicy @@ -93,8 +90,6 @@ import org.jetbrains.kotlin.scripting.definitions.ScriptDefinitionProvider import org.jetbrains.kotlin.scripting.extensions.ScriptingResolveExtension import java.io.File import kotlin.reflect.KClass -import com.intellij.psi.codeStyle.CodeStyleSettingsService -import com.intellij.psi.codeStyle.CodeStyleSettingsServiceImpl private fun setIdeaIoUseFallback() { if (SystemInfo.isWindows) { diff --git a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/model/KotlinEnvironment.kt b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/model/KotlinEnvironment.kt index 04d85ce01..51bd74dee 100644 --- a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/model/KotlinEnvironment.kt +++ b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/model/KotlinEnvironment.kt @@ -14,11 +14,12 @@ * limitations under the License. * *******************************************************************************/ +@file:OptIn(ExperimentalCompilerApi::class) + package org.jetbrains.kotlin.core.model import com.intellij.core.CoreJavaFileManager import com.intellij.openapi.Disposable -import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.components.ServiceManager import com.intellij.openapi.project.Project import com.intellij.openapi.util.Disposer @@ -35,15 +36,11 @@ import org.eclipse.jdt.core.IJavaProject import org.eclipse.jdt.core.JavaCore import org.eclipse.jdt.internal.core.JavaProject import org.eclipse.osgi.internal.loader.EquinoxClassLoader -import org.jetbrains.kotlin.asJava.classes.FacadeCache import org.jetbrains.kotlin.cli.jvm.compiler.CliVirtualFileFinderFactory import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCliJavaFileManagerImpl import org.jetbrains.kotlin.cli.jvm.index.JvmDependenciesIndexImpl import org.jetbrains.kotlin.cli.jvm.index.SingleJavaFileRootsIndex -import org.jetbrains.kotlin.compiler.plugin.CliOptionValue -import org.jetbrains.kotlin.compiler.plugin.CommandLineProcessor -import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar -import org.jetbrains.kotlin.compiler.plugin.parsePluginOption +import org.jetbrains.kotlin.compiler.plugin.* import org.jetbrains.kotlin.config.CompilerConfiguration import org.jetbrains.kotlin.config.JVMConfigurationKeys import org.jetbrains.kotlin.container.ComponentProvider @@ -156,11 +153,10 @@ class KotlinScriptEnvironment private constructor( SingleJavaFileRootsIndex(singleJavaFileRoots), configuration.getBoolean(JVMConfigurationKeys.USE_PSI_CLASS_FILES_READING)) - val finderFactory = CliVirtualFileFinderFactory(index) + val finderFactory = CliVirtualFileFinderFactory(index, false) project.registerService(MetadataFinderFactory::class.java, finderFactory) project.registerService(VirtualFileFinderFactory::class.java, finderFactory) - project.registerService(FacadeCache::class.java, FacadeCache(project)) project.registerService(KotlinLightClassManager::class.java, KotlinLightClassManager(javaProject.project)) // definition?.dependencyResolver?.also { project.registerService(DependenciesResolver::class.java, it) } @@ -343,10 +339,6 @@ class KotlinEnvironment private constructor(val eclipseProject: IProject, dispos registerProjectDependenServices(javaProject) configureClasspath(javaProject) - with(project) { - registerService(FacadeCache::class.java, FacadeCache(project)) - } - registerCompilerPlugins() cachedEnvironment.putEnvironment(eclipseProject, this) @@ -388,7 +380,7 @@ class KotlinEnvironment private constructor(val eclipseProject: IProject, dispos private fun parseOptions(args: List): Map> = args.asSequence() - .map { parsePluginOption("plugin:$it") } + .map { parseLegacyPluginOption("plugin:$it") } .filterNotNull() .groupBy(CliOptionValue::optionName, CliOptionValue::value) diff --git a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/preferences/KotlinBuildingProperties.kt b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/preferences/KotlinBuildingProperties.kt index 8b9528a72..4971bd254 100644 --- a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/preferences/KotlinBuildingProperties.kt +++ b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/preferences/KotlinBuildingProperties.kt @@ -11,6 +11,8 @@ class KotlinBuildingProperties(scope: IScopeContext = InstanceScope.INSTANCE) : var useIncremental by BooleanPreference() + var alwaysRealBuild by BooleanPreference() + companion object { val workspaceInstance by lazy { KotlinBuildingProperties() } } diff --git a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseJavaClass.kt b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseJavaClass.kt index 210303581..4a9c296ff 100644 --- a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseJavaClass.kt +++ b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseJavaClass.kt @@ -35,6 +35,8 @@ public class EclipseJavaClass(javaElement: ITypeBinding) : EclipseJavaClassifier override val isFinal: Boolean = Modifier.isFinal(binding.getModifiers()) + override val isFromSource: Boolean get() = binding.isFromSource + override val visibility: Visibility = EclipseJavaElementUtil.getVisibility(binding) override val typeParameters: List diff --git a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseJavaConstructor.java b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseJavaConstructor.java index bcde1f8b9..72bd7c250 100644 --- a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseJavaConstructor.java +++ b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseJavaConstructor.java @@ -37,4 +37,8 @@ public List getValueParameters() { return EclipseJavaElementUtil.getValueParameters(getBinding()); } + @Override + public boolean isFromSource() { + return getBinding().getDeclaringClass().isFromSource(); + } } diff --git a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseJavaField.kt b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseJavaField.kt index d1acf3aea..fd387302a 100644 --- a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseJavaField.kt +++ b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseJavaField.kt @@ -28,7 +28,10 @@ public class EclipseJavaField(private val javaField: IVariableBinding) : Eclipse override val initializerValue: Any? = binding.constantValue override val isEnumEntry: Boolean = binding.isEnumConstant() - + + override val isFromSource: Boolean + get() = binding.declaringClass.isFromSource + override val type: JavaType get() = EclipseJavaType.create(binding.getType()) diff --git a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseJavaMethod.kt b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseJavaMethod.kt index 176933b20..a09a51179 100644 --- a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseJavaMethod.kt +++ b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseJavaMethod.kt @@ -47,4 +47,7 @@ class EclipseJavaMethod(method: IMethodBinding) : EclipseJavaMember(binding), JavaTypeParameter { + override val isFromSource: Boolean + get() = binding.isFromSource + override val name: Name = SpecialNames.safeIdentifier(binding.getName()) override val upperBounds: Collection diff --git a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseJavaValueParameter.java b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseJavaValueParameter.java index 4270085f9..9d392b968 100644 --- a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseJavaValueParameter.java +++ b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseJavaValueParameter.java @@ -78,4 +78,9 @@ public boolean isVararg() { public boolean isDeprecatedInJavaDoc() { return getBinding().isDeprecated(); } + + @Override + public boolean isFromSource() { + return getBinding().isFromSource(); + } } diff --git a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseOptimizedJavaClass.kt b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseOptimizedJavaClass.kt index 28eef9edb..da947410e 100644 --- a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseOptimizedJavaClass.kt +++ b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/resolve/lang/java/structure/EclipseOptimizedJavaClass.kt @@ -79,7 +79,10 @@ class EclipseOptimizedJavaClass(val eclipseClass: IType) : JavaClass { override val isFinal: Boolean get() = throw UnsupportedOperationException() - + + override val isFromSource: Boolean + get() = !eclipseClass.isBinary + override val isStatic: Boolean get() = throw UnsupportedOperationException() diff --git a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/script/template/ProjectScriptTemplateContribution.kt b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/script/template/ProjectScriptTemplateContribution.kt index ccf9ee850..e43026527 100644 --- a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/script/template/ProjectScriptTemplateContribution.kt +++ b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/script/template/ProjectScriptTemplateContribution.kt @@ -27,7 +27,7 @@ import java.io.File class ProjectScriptTemplateContribution : ScriptTemplateContribution() { - override val priority: Int get() = Int.MAX_VALUE + override val priority: Int get() = Int.MIN_VALUE override fun loadTemplate() = ProjectScriptTemplate::class diff --git a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/utils/importsUtils.kt b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/utils/importsUtils.kt index 4f45b87b5..09d7e217d 100644 --- a/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/utils/importsUtils.kt +++ b/kotlin-eclipse-core/src/org/jetbrains/kotlin/core/utils/importsUtils.kt @@ -22,10 +22,10 @@ import org.jetbrains.kotlin.config.LanguageFeature.DefaultImportOfPackageKotlinC import org.jetbrains.kotlin.config.LanguageVersion import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl import org.jetbrains.kotlin.descriptors.DeclarationDescriptor -import org.jetbrains.kotlin.idea.util.ActionRunningMode import org.jetbrains.kotlin.idea.util.ImportDescriptorResult import org.jetbrains.kotlin.idea.util.ImportInsertHelper import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.resolve.ImportPath @@ -38,20 +38,11 @@ class KotlinImportInserterHelper : ImportInsertHelper() { return importSortComparator } - override fun importDescriptor( - element: KtElement, - descriptor: DeclarationDescriptor, - actionRunningMode: ActionRunningMode, - forceAllUnderImport: Boolean - ): ImportDescriptorResult { + override fun importDescriptor(element: KtElement, descriptor: DeclarationDescriptor, runImmediately: Boolean, forceAllUnderImport: Boolean, aliasName: Name?): ImportDescriptorResult { throw UnsupportedOperationException() } - override fun importPsiClass( - element: KtElement, - psiClass: PsiClass, - actionRunningMode: ActionRunningMode - ): ImportDescriptorResult { + override fun importPsiClass(element: KtElement, psiClass: PsiClass, runImmediately: Boolean): ImportDescriptorResult { throw UnsupportedOperationException() } diff --git a/kotlin-eclipse-feature/feature.xml b/kotlin-eclipse-feature/feature.xml index b35d67e5d..08d061cac 100644 --- a/kotlin-eclipse-feature/feature.xml +++ b/kotlin-eclipse-feature/feature.xml @@ -6,7 +6,7 @@ provider-name="JetBrains"> - Kotlin language support for Kotlin 1.6.21 + Kotlin language support for Kotlin 1.8.10 diff --git a/kotlin-eclipse-ui/src/org/jetbrains/kotlin/preferences/views/BuildingPropertiesView.kt b/kotlin-eclipse-ui/src/org/jetbrains/kotlin/preferences/views/BuildingPropertiesView.kt index 6f252d9c4..7ea9e7aae 100644 --- a/kotlin-eclipse-ui/src/org/jetbrains/kotlin/preferences/views/BuildingPropertiesView.kt +++ b/kotlin-eclipse-ui/src/org/jetbrains/kotlin/preferences/views/BuildingPropertiesView.kt @@ -33,9 +33,14 @@ class BuildingPropertiesView( kotlinBuildingProperties.useIncremental = value } + private var alwaysRealBuild by Delegates.observable(kotlinBuildingProperties.alwaysRealBuild) { _, _, value -> + kotlinBuildingProperties.alwaysRealBuild = value + } + init { control = parent.gridContainer { checkbox(::useIncremental, "Use incremental compiler (experimental)") + checkbox(::alwaysRealBuild, "Always build real class files") }.control } } diff --git a/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/builder/BaseKotlinBuilderElement.kt b/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/builder/BaseKotlinBuilderElement.kt index 7120a562e..b721eebe9 100644 --- a/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/builder/BaseKotlinBuilderElement.kt +++ b/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/builder/BaseKotlinBuilderElement.kt @@ -27,7 +27,7 @@ abstract class BaseKotlinBuilderElement { private val fileFilters = listOf(ScriptFileFilter, FileFromOutputFolderFilter, FileFromKotlinBinFolderFilter) - abstract fun build(project: IProject, delta: IResourceDelta?, kind: Int): Array? + abstract fun build(project: IProject, delta: IResourceDelta?, kind: Int) protected fun isAllFilesApplicableForFilters(files: Set, javaProject: IJavaProject): Boolean { return files.all { file -> diff --git a/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/builder/IncrementalKotlinBuilderElement.kt b/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/builder/IncrementalKotlinBuilderElement.kt index 7bbb58cc1..139fde183 100644 --- a/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/builder/IncrementalKotlinBuilderElement.kt +++ b/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/builder/IncrementalKotlinBuilderElement.kt @@ -3,35 +3,26 @@ package org.jetbrains.kotlin.ui.builder import org.eclipse.core.resources.IProject import org.eclipse.core.resources.IResourceDelta import org.eclipse.core.resources.IncrementalProjectBuilder -import org.eclipse.core.runtime.Status -import org.eclipse.core.runtime.jobs.Job import org.eclipse.jdt.core.IJavaProject import org.eclipse.jdt.core.JavaCore -import org.jetbrains.kotlin.core.asJava.KotlinLightClassGeneration -import org.jetbrains.kotlin.core.builder.KotlinPsiManager import org.jetbrains.kotlin.core.compiler.KotlinCompilerResult import org.jetbrains.kotlin.core.compiler.KotlinCompilerUtils -import org.jetbrains.kotlin.core.model.runJob -import org.jetbrains.kotlin.core.resolve.KotlinAnalyzer -import org.jetbrains.kotlin.ui.KotlinPluginUpdater import org.jetbrains.kotlin.ui.launch.removeKotlinConsoles class IncrementalKotlinBuilderElement : BaseKotlinBuilderElement() { - override fun build(project: IProject, delta: IResourceDelta?, kind: Int): Array? { + override fun build(project: IProject, delta: IResourceDelta?, kind: Int) { val javaProject = JavaCore.create(project) if (kind == IncrementalProjectBuilder.FULL_BUILD) { makeClean(javaProject) - return null + return } removeKotlinConsoles(javaProject) compileKotlinFilesIncrementally(javaProject) postBuild(delta, javaProject) - - return null } private fun compileKotlinFilesIncrementally(javaProject: IJavaProject) { diff --git a/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/builder/KotlinBuilder.kt b/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/builder/KotlinBuilder.kt index 8337c94c9..f1f7b93a9 100644 --- a/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/builder/KotlinBuilder.kt +++ b/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/builder/KotlinBuilder.kt @@ -21,6 +21,8 @@ import org.eclipse.core.resources.IncrementalProjectBuilder import org.eclipse.core.runtime.IProgressMonitor import org.eclipse.jdt.core.JavaCore import org.jetbrains.kotlin.core.model.KotlinEnvironment +import org.jetbrains.kotlin.core.utils.ProjectUtils + class KotlinBuilder : IncrementalProjectBuilder() { @@ -38,11 +40,13 @@ class KotlinBuilder : IncrementalProjectBuilder() { override fun build(kind: Int, args: Map?, monitor: IProgressMonitor?): Array? { val javaProject = JavaCore.create(project) val delta = getDelta(project) - return if (KotlinEnvironment.getEnvironment(javaProject.project).buildingProperties.useIncremental) { + if (KotlinEnvironment.getEnvironment(javaProject.project).buildingProperties.useIncremental) { incrementalBuilder } else { oldBuilderElement }.build(project, delta, kind) + + return ProjectUtils.getDependencyProjects(javaProject).toTypedArray() } override fun startupOnInitialize() { diff --git a/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/builder/KotlinBuilderElement.kt b/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/builder/KotlinBuilderElement.kt index 5b753c947..cdbc3fa62 100644 --- a/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/builder/KotlinBuilderElement.kt +++ b/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/builder/KotlinBuilderElement.kt @@ -3,38 +3,34 @@ package org.jetbrains.kotlin.ui.builder import org.eclipse.core.resources.IProject import org.eclipse.core.resources.IResourceDelta import org.eclipse.core.resources.IncrementalProjectBuilder.FULL_BUILD -import org.eclipse.core.runtime.Status -import org.eclipse.core.runtime.jobs.Job import org.eclipse.debug.core.model.LaunchConfigurationDelegate import org.eclipse.jdt.core.IJavaProject import org.eclipse.jdt.core.JavaCore -import org.jetbrains.kotlin.core.asJava.KotlinLightClassGeneration -import org.jetbrains.kotlin.core.builder.KotlinPsiManager import org.jetbrains.kotlin.core.compiler.KotlinCompilerResult import org.jetbrains.kotlin.core.compiler.KotlinCompilerUtils -import org.jetbrains.kotlin.core.model.runJob -import org.jetbrains.kotlin.core.resolve.KotlinAnalyzer -import org.jetbrains.kotlin.ui.KotlinPluginUpdater +import org.jetbrains.kotlin.core.model.KotlinEnvironment import org.jetbrains.kotlin.ui.launch.removeKotlinConsoles class KotlinBuilderElement : BaseKotlinBuilderElement() { - override fun build(project: IProject, delta: IResourceDelta?, kind: Int): Array? { + override fun build(project: IProject, delta: IResourceDelta?, kind: Int) { val javaProject = JavaCore.create(project) - if (isBuildingForLaunch()) { + val isBuildRealAlways = KotlinEnvironment.getEnvironment(project).buildingProperties.alwaysRealBuild + if (isBuildRealAlways || isBuildingForLaunch()) { removeKotlinConsoles(javaProject) compileKotlinFiles(javaProject) - return null + + if(!isBuildRealAlways) { + return + } } if (kind == FULL_BUILD) { makeClean(javaProject) - return null + return } postBuild(delta, javaProject) - - return null } private fun isBuildingForLaunch(): Boolean { diff --git a/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/editors/hover/KotlinJavadocTextHover.kt b/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/editors/hover/KotlinJavadocTextHover.kt index b3f0f224e..877755958 100644 --- a/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/editors/hover/KotlinJavadocTextHover.kt +++ b/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/editors/hover/KotlinJavadocTextHover.kt @@ -130,8 +130,8 @@ class KotlinJavadocTextHover : KotlinEditorTextHover

$it

") diff --git a/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/editors/quickassist/KotlinSpecifyTypeAssistProposal.kt b/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/editors/quickassist/KotlinSpecifyTypeAssistProposal.kt index 71b873764..5af2593f1 100644 --- a/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/editors/quickassist/KotlinSpecifyTypeAssistProposal.kt +++ b/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/editors/quickassist/KotlinSpecifyTypeAssistProposal.kt @@ -24,27 +24,28 @@ import org.jetbrains.kotlin.descriptors.CallableDescriptor import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.resolve.BindingContext -import org.jetbrains.kotlin.types.ErrorUtils import org.jetbrains.kotlin.types.KotlinType +import org.jetbrains.kotlin.types.error.ErrorTypeKind +import org.jetbrains.kotlin.types.error.ErrorUtils import org.jetbrains.kotlin.types.isError import org.jetbrains.kotlin.ui.editors.KotlinEditor -public class KotlinSpecifyTypeAssistProposal(editor: KotlinEditor) : KotlinQuickAssistProposal(editor) { +class KotlinSpecifyTypeAssistProposal(editor: KotlinEditor) : KotlinQuickAssistProposal(editor) { private var displayString: String? = null override fun isApplicable(psiElement: PsiElement): Boolean { - val element = PsiTreeUtil.getNonStrictParentOfType(psiElement, KtCallableDeclaration::class.java) - if (element == null) return false + val element = + PsiTreeUtil.getNonStrictParentOfType(psiElement, KtCallableDeclaration::class.java) ?: return false - if (element.getContainingFile() is KtCodeFragment) return false + if (element.containingFile is KtCodeFragment) return false if (element is KtFunctionLiteral) return false if (element is KtConstructor<*>) return false - if (element.getTypeReference() != null) return false + if (element.typeReference != null) return false val caretOffset = getCaretOffsetInPSI(editor, editor.document) - val initializer = (element as? KtDeclarationWithInitializer)?.getInitializer() - if (initializer != null && initializer.getTextRange().containsOffset(caretOffset)) return false + val initializer = (element as? KtDeclarationWithInitializer)?.initializer + if (initializer != null && initializer.textRange.containsOffset(caretOffset)) return false if (element is KtNamedFunction && element.hasBlockBody()) return false @@ -64,7 +65,7 @@ public class KotlinSpecifyTypeAssistProposal(editor: KotlinEditor) : KotlinQuick if (anchor != null) { val offset = addTypeAnnotation(editor, document, anchor, type) - editor.javaEditor.getViewer().setSelectedRange(offset, 0) + editor.javaEditor.viewer.setSelectedRange(offset, 0) } } @@ -78,11 +79,10 @@ public class KotlinSpecifyTypeAssistProposal(editor: KotlinEditor) : KotlinQuick private fun getTypeForDeclaration(declaration: KtCallableDeclaration): KotlinType { val bindingContext = declaration.getBindingContext() - if (bindingContext == null) return ErrorUtils.createErrorType("null type") val descriptor = bindingContext[BindingContext.DECLARATION_TO_DESCRIPTOR, declaration] - val type = (descriptor as? CallableDescriptor)?.getReturnType() - return type ?: ErrorUtils.createErrorType("null type") + val type = (descriptor as? CallableDescriptor)?.returnType + return type ?: ErrorUtils.createErrorType(ErrorTypeKind.UNRESOLVED_TYPE) } } diff --git a/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/refactorings/extract/KotlinExtractVariableRefactoring.kt b/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/refactorings/extract/KotlinExtractVariableRefactoring.kt index f5e0fc31b..3b9a6f607 100644 --- a/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/refactorings/extract/KotlinExtractVariableRefactoring.kt +++ b/kotlin-eclipse-ui/src/org/jetbrains/kotlin/ui/refactorings/extract/KotlinExtractVariableRefactoring.kt @@ -35,8 +35,9 @@ import org.jetbrains.kotlin.eclipse.ui.utils.IndenterUtil import org.jetbrains.kotlin.eclipse.ui.utils.LineEndUtil import org.jetbrains.kotlin.eclipse.ui.utils.getOffsetByDocument import org.jetbrains.kotlin.eclipse.ui.utils.getTextDocumentOffset +import org.jetbrains.kotlin.idea.base.psi.unifier.KotlinPsiUnificationResult +import org.jetbrains.kotlin.idea.base.psi.unifier.toRange import org.jetbrains.kotlin.idea.util.psi.patternMatching.KotlinPsiUnifier -import org.jetbrains.kotlin.idea.util.psi.patternMatching.toRange import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.canPlaceAfterSimpleNameEntry @@ -160,7 +161,9 @@ public class KotlinExtractVariableRefactoring(val selection: ITextSelection, val private fun KtExpression.findOccurrences(occurrenceContainer: PsiElement): List { return toRange() - .match(occurrenceContainer, KotlinPsiUnifier.DEFAULT) + .match(occurrenceContainer, { r1, r2 -> + KotlinPsiUnifier.DEFAULT.unify(r1, r2) as? KotlinPsiUnificationResult.Success + }) .map { val candidate = it.range.elements.first() when (candidate) { diff --git a/pom.xml b/pom.xml index 9b4adb7ea..6a59cd475 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ http://download.eclipse.org/tools/ajdt/423/dev/update http://download.eclipse.org/buildship/updates/e423/releases/3.x - 1.6.21 + 1.8.10 1.3.200