parsus
parsus copied to clipboard
Adding Parsus as a dependency sometimes causes error: "Cannot access 'Language': it is internal in 'org.intellij.lang.annotations'"
Unfortunately the @Language injection workaround doesn't play well in regular projects. The org.intellij.lang.annotations.Language defined by Parsus 'overrides' the official one provided by java-annotations, and because Parsus' is marked as internal, it causes compilation errors in the project whenever Parsus is present.
The quickest way to reproduce this is in a Gradle build script, although I also encounter the same problem in src/main/kotlin in regular projects:
// build.gradle.kts
import org.intellij.lang.annotations.Language
buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath("me.alllex.parsus:parsus:0.6.1")
}
}
@Language("text")
val foo = "..."
The result is that whenever I have Parsus as a dependency, my project cannot use @Language at all. And I can't think of a workaround.
Suggestions
I have two suggestions:
- Change the visibility of Parsus'
@Languagefrominternaltopublic. - java-annotations has been converted to KMP in v25.0.0, although it is yet to be released. This will provide a valid multiplatform
@Language. So, for now, remove Parsus'@Language, and then when java-annotations v25.0.0 is released, switch to use that.
Related
- #11