JetBrains-Research / reflekt

A plugin for Kotlin compiler for compile-time reflection
Apache License 2.0
363 stars 11 forks source link

chore: support for kotlin `2.x` #147

Open sgammon opened 9 months ago

sgammon commented 9 months ago

Summary

Initial changes to support Kotlin 2.x.x beta.

Changelog

sgammon commented 9 months ago

@CommanderTvis thank you for the quick review, sorry for the mess 😅 we are trying this downstream to see if it works as expected.

sgammon commented 9 months ago

With regard to the NoSuchMethodError, here is the exception silenced by that code:

java.lang.NoSuchMethodError: 'void com.intellij.openapi.util.io.NioFiles.deleteRecursively(java.nio.file.Path)'
    at org.jetbrains.kotlin.test.services.impl.TemporaryDirectoryManagerImpl.cleanupTemporaryDirectories(TemporaryDirectoryManagerImpl.kt:45)
    at org.jetbrains.kotlin.test.TestRunner.runTest(TestRunner.kt:32)

I remember now. This deleteRecursively function on com.intellij.openapi.util.io.NioFiles is called by AbstractKotlinCompilerTest.runTest. It seems the Open API dependency for IntelliJ may need to be upgraded, but I don't see where it is being pulled in. Do you have any ideas? Full stacktrace below.

Stacktrace
java.lang.NoSuchMethodError: 'void com.intellij.openapi.util.io.NioFiles.deleteRecursively(java.nio.file.Path)'
    at org.jetbrains.kotlin.test.services.impl.TemporaryDirectoryManagerImpl.cleanupTemporaryDirectories(TemporaryDirectoryManagerImpl.kt:45)
    at org.jetbrains.kotlin.test.TestRunner.runTest(TestRunner.kt:32)
    at org.jetbrains.kotlin.test.TestRunner.runTest$default(TestRunner.kt:27)
    at org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerTest.runTest(AbstractKotlinCompilerTest.kt:88)
    at org.jetbrains.reflekt.plugin.compiler.runners.general.ReflektWithLibraryTestGenerated$Classes$Classes_1.testClasses_1(ReflektWithLibraryTestGenerated.java:46)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.tryRemoveAndExec(ForkJoinPool.java:1351)
    at java.base/java.util.concurrent.ForkJoinTask.awaitDone(ForkJoinTask.java:422)
    at java.base/java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:651)
    at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.tryRemoveAndExec(ForkJoinPool.java:1351)
    at java.base/java.util.concurrent.ForkJoinTask.awaitDone(ForkJoinTask.java:422)
    at java.base/java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:651)
    at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.tryRemoveAndExec(ForkJoinPool.java:1351)
    at java.base/java.util.concurrent.ForkJoinTask.awaitDone(ForkJoinTask.java:422)
    at java.base/java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:651)
    at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)

It was being suppressed because it's deleting temporary files, otherwise the tests seem to pass.