This commit fixes tests in 173 branch, avoid exception:
com.intellij.openapi.util.TraceableDisposable$DisposalException:
Virtual pointer 'jar:///mnt/agent/work/bd0f559856a14a82/dist/kotlinc/lib/kotlin-stdlib-js.jar!/'
hasn't been disposed: --------------Creation trace:
java.lang.Throwable
at com.intellij.openapi.util.TraceableDisposable.<init>(TraceableDisposable.java:45)
at com.intellij.openapi.vfs.impl.VirtualFilePointerImpl.<init>(VirtualFilePointerImpl.java:41)
at com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl.getOrCreate(VirtualFilePointerManagerImpl.java:266)
at com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl.create(VirtualFilePointerManagerImpl.java:205)
at com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl.create(VirtualFilePointerManagerImpl.java:136)
at com.intellij.openapi.vfs.impl.VirtualFilePointerContainerImpl.create(VirtualFilePointerContainerImpl.java:359)
at com.intellij.openapi.vfs.impl.VirtualFilePointerContainerImpl.add(VirtualFilePointerContainerImpl.java:169)
at com.intellij.openapi.roots.impl.libraries.LibraryImpl.addRoot(LibraryImpl.java:505)
at com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor.exportRoots(NewLibraryEditor.java:247)
at com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor.applyTo(NewLibraryEditor.java:218)
at org.jetbrains.kotlin.idea.test.ConfigLibraryUtil.addLibrary(ConfigLibraryUtil.kt:113)
at org.jetbrains.kotlin.idea.test.KotlinStdJSProjectDescriptor.configureModule(KotlinStdJSProjectDescriptor.kt:38)
at org.jetbrains.kotlin.idea.test.KotlinLightProjectDescriptor.configureModule(KotlinLightProjectDescriptor.java:46)
at org.jetbrains.kotlin.idea.test.TestUtilsKt$configureAs$1.consume(testUtils.kt:59)
at org.jetbrains.kotlin.idea.test.TestUtilsKt$configureAs$1.consume(testUtils.kt)
at com.intellij.openapi.roots.ModuleRootModificationUtil.updateModel(ModuleRootModificationUtil.java:143)
at org.jetbrains.kotlin.idea.test.TestUtilsKt.configureAs(testUtils.kt:50)
at org.jetbrains.kotlin.idea.test.TestUtilsKt.configureAs(testUtils.kt:69)
at org.jetbrains.kotlin.idea.decompiler.textBuilder.AbstractDecompiledTextFromJsMetadataTest.setUp(AbstractDecompiledTextFromJsMetadataTest.kt:38)
...
See the previous commit for information on the kotlin-reflect vs
kotlin-reflect-api distinction.
Add kotlin-reflect as an explicit runtime dependency of most of the test
configurations because even though they all depend on tests-common, the
runtime dependency on kotlin-reflect is not exported from tests-common
to other modules because the projectTests dependency is not transitive.
The important changes are in ideaTestUtils.kt:
`configureByFiles` must be called on the relative to testData dir path,
otherwise java files in the project belong to src/idea/testData/.../A.java
instead of src/A.java and can't be found in the root package
New updates in resolution when resolving A() call is now asking whether
<root>.A exists in PsiPackage::getClasses instead of
PsiPackage::findClassByShortName that can find a class even if it's located
in the wrong directory
In this commit, only IDE tests are added, because we look for module
declarations in the IDE across the whole project, whereas in the
compiler we should do this on the module path only and that requires
separate work (KT-18599) which is done in the following commits.
(The change in Cache.kt is needed so that
JvmModuleAccessibilityChecker.ClassifierUsage, which is an inner class,
would be injected properly.)
#KT-18598 In Progress
#KT-18599 In Progress
- separate compileLibraryToJar into two public functions, for JVM and JS
- allow to pass any extra options instead of just -Xallow-kotlin-package
- add a bunch of default arguments for the most common cases
Also, remove kotlin-reflect form container module.
Main goal is get rid of kotlin-reflect.jar from modules what required for minimal compiler.jar which can compile Kotlin only to JS to make it smaller.
In tests, ImportFix imports the first available candidate. This can
lead to non-deterministic tests when multiple candidates are available.
With this fix, unwanted candidates can be excluded.
Don't reconfigure runtime before every test. For consistency,
mark tests that require the runtime with directives instead of relying
on test file names.