- simplify script definition interface, convert it to class
- create simple definitions right from base
- refactor (rename and simplify) script definition with annotated template
- simplify usages of script definition in many places
The `@SinceKotlin("X.Y.Z")` annotation now hides a particular declaration from
resolution when the API version specified by the `-api-version` option is
_less_ than X.Y.Z. The comparison is performed as for versions in Maven:
MavenComparableVersion is in fact a copy of
org.apache.maven.artifact.versioning.ComparableVersion.
Also support "!API_VERSION" directive in diagnostic tests
#KT-14298 Fixed
Since its scope is now empty, no descriptor now has a container that is an
instance of IncrementalPackageFragment -> a lot of code is not needed anymore
Unless the compatibility option "-Xsingle-module" is passed, the compiler will
create two modules instead of one now (see TopDownAnalyzerFacadeForJVM): the
main module contains Kotlin and Java sources and binaries from the previous
compilation of the given module chunk, the dependency module contains all other
Kotlin and Java binaries. This fixes some issues where the compiler couldn't
detect that the used symbol was from another module, and did not forbid some
usages which are only possible inside the module (see KT-10001).
The ideal way to deal with modules here would be to exactly recreate the
project structure, for example as it's done in JvmAnalyzerFacade and usages.
This is postponed until later
#KT-10001 Fixed
#KT-11840 In Progress
Currently behavior is unchanged because the "all project" scope is passed,
however in the future this will allow to implement separate modules in the
compiler properly
The only place where the logic has changed is in AbstractDiagnosticsTest, where
modules are already created and sealed before the analysis. Copy-paste the
container creation logic there (it's almost fine because it's also present in a
bunch of other tests), and simplify it: get rid of incremental compilation and
other stuff irrelevant for diagnostic tests.
This is needed to make analyzeFilesWithJavaIntegration configure the module
properly before sealing it
It was added for Android extensions, but now another mechanism is used there
(PackageFragmentProviderExtension), and there were no other implementations of
ExternalDeclarationsProvider in the project
Without such shutdown console program that gets PSI file will hang forever.
Introduced in https://github.com/JetBrains/intellij-community/commit/446b80077aed71e2384301ae993cf44416bf9a83
Stack example:
java.lang.Thread.State: RUNNABLE
at com.intellij.util.concurrency.AppDelayQueue.<init>(AppDelayQueue.java:37)
at com.intellij.util.concurrency.AppScheduledExecutorService.<init>(AppScheduledExecutorService.java:50)
at com.intellij.util.concurrency.AppScheduledExecutorService$Holder.<clinit>(AppScheduledExecutorService.java:41)
at com.intellij.util.concurrency.AppScheduledExecutorService.getInstance(AppScheduledExecutorService.java:46)
at com.intellij.util.concurrency.AppExecutorUtil.getAppScheduledExecutorService(AppExecutorUtil.java:39)
at com.intellij.concurrency.JobScheduler.getScheduler(JobScheduler.java:43)
at com.intellij.psi.impl.source.AstPathPsiMap.<clinit>(AstPathPsiMap.java:45)
at com.intellij.psi.impl.source.PsiFileImpl.<init>(PsiFileImpl.java:76)
at com.intellij.extapi.psi.PsiFileBase.<init>(PsiFileBase.java:39)
at org.jetbrains.kotlin.psi.KtFile.<init>(KtFile.java:48)
at org.jetbrains.kotlin.parsing.KotlinParserDefinition.createFile(KotlinParserDefinition.kt:73)
at com.intellij.psi.SingleRootFileViewProvider.createFile(SingleRootFileViewProvider.java:407)
at com.intellij.psi.SingleRootFileViewProvider.createFile(SingleRootFileViewProvider.java:348)
at com.intellij.psi.SingleRootFileViewProvider.createFile(SingleRootFileViewProvider.java:326)
at com.intellij.psi.SingleRootFileViewProvider.getPsiInner(SingleRootFileViewProvider.java:171)
at com.intellij.psi.SingleRootFileViewProvider.getPsi(SingleRootFileViewProvider.java:155)
at com.intellij.psi.impl.PsiFileFactoryImpl.trySetupPsiForFile(PsiFileFactoryImpl.java:121)
at com.intellij.psi.impl.PsiFileFactoryImpl.createFileFromText(PsiFileFactoryImpl.java:100)
at com.intellij.psi.impl.PsiFileFactoryImpl.createFileFromText(PsiFileFactoryImpl.java:56)
at org.jetbrains.kotlin.psi.KtPsiFactory.doCreateFile(KtPsiFactory.kt:174)
at org.jetbrains.kotlin.psi.KtPsiFactory.createFile(KtPsiFactory.kt:178)
at org.jetbrains.kotlin.preprocessor.Preprocessor.processFileSingleEvaluator(Preprocessor.kt:82)
at org.jetbrains.kotlin.preprocessor.Preprocessor.processDirectorySingleEvaluator(Preprocessor.kt:105)
at org.jetbrains.kotlin.preprocessor.Preprocessor.processDirectorySingleEvaluator(Preprocessor.kt:135)
at org.jetbrains.kotlin.preprocessor.Preprocessor.processSources(Preprocessor.kt:74)
at org.jetbrains.kotlin.preprocessor.PreprocessorCLI.main(PreprocessorCLI.kt:35)
Writing source annotations enables incremental compilation for kapt2.
However they are not needed in bytecode, so we remove them when
copying classes.
# Conflicts:
# compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt
# compiler/frontend.java/src/org/jetbrains/kotlin/config/JVMConfigurationKeys.java