Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't run the example #40

Open
alitarfa opened this issue Jan 26, 2021 · 2 comments
Open

I can't run the example #40

alitarfa opened this issue Jan 26, 2021 · 2 comments

Comments

@alitarfa
Copy link

Hi everyone, is there anyone who can tell me why I have this error message when I try to run the simple example

Exception in thread "main" java.lang.IllegalStateException: LOGGING: Loading modules: [java.se, jdk.accessibility, jdk.attach, jdk.compiler, jdk.dynalink, jdk.httpserver, jdk.jartool, jdk.javadoc, jdk.jconsole, jdk.jdi, jdk.jfr, jdk.jshell, jdk.jsobject, jdk.management, jdk.management.jfr, jdk.naming.ldap, jdk.net, jdk.scripting.nashorn, jdk.sctp, jdk.security.auth, jdk.security.jgss, jdk.unsupported, jdk.unsupported.desktop, jdk.xml.dom, java.base, java.compiler, java.datatransfer, java.desktop, java.xml, java.instrument, java.logging, java.management, java.management.rmi, java.rmi, java.naming, java.net.http, java.prefs, java.scripting, java.security.jgss, java.security.sasl, java.sql, java.transaction.xa, java.sql.rowset, java.xml.crypto, jdk.internal.jvmstat, jdk.management.agent, jdk.jdwp.agent, jdk.internal.ed, jdk.internal.le, jdk.internal.opt] (no MessageCollector configured)
	at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.report(ClasspathRootsResolver.kt:312)
	at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.report$default(ClasspathRootsResolver.kt:310)
	at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.addModularRoots(ClasspathRootsResolver.kt:253)
	at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.computeRoots(ClasspathRootsResolver.kt:123)
	at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.convertClasspathRoots(ClasspathRootsResolver.kt:79)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:213)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:109)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:421)
	at kastree.ast.psi.Parser$proj$2.invoke(Parser.kt:16)
	at kastree.ast.psi.Parser$proj$2.invoke(Parser.kt:14)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at kastree.ast.psi.Parser.getProj(Parser.kt)
	at kastree.ast.psi.Parser.parsePsiFile(Parser.kt:30)
	at kastree.ast.psi.Parser.parseFile(Parser.kt:23)
	at kastree.ast.psi.Parser.parseFile$default(Parser.kt:23)
	at com.example.demo.MainKt.main(main.kt:13)
	at com.example.demo.MainKt.main(main.kt)

@cretz
Copy link
Owner

cretz commented Jan 26, 2021

This is probably due to this old project referencing a really old Kotlin compiler lib. This library is no longer maintained. Maybe https://github.com/kotlinx/ast would work better.

@BladesOfTime
Copy link

BladesOfTime commented Jul 14, 2022

I have solved this issue on kotlin-1.5.31, you should make some change in Parser.kt as following code:

KotlinCoreEnvironment.createForProduction(
Disposer.newDisposable(),
CompilerConfiguration().also { configuration->
configuration.put(
CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY,
PrintingMessageCollector(System.err, MessageRenderer.PLAIN_FULL_PATHS, false)
)
configuration.put(CommonConfigurationKeys.MODULE_NAME, "detekt")
},
EnvironmentConfigFiles.JVM_CONFIG_FILES
).project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants