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

Adding Parsus as a dependency sometimes causes error: "Cannot access 'Language': it is internal in 'org.intellij.lang.annotations'" #32

Open
aSemy opened this issue Jun 25, 2024 · 1 comment

Comments

@aSemy
Copy link
Contributor

aSemy commented Jun 25, 2024

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:

  1. Change the visibility of Parsus' @Language from internal to public.
  2. 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

@aSemy
Copy link
Contributor Author

aSemy commented Sep 25, 2024

java-annotations 25.0.0 has been released, and should have KMP support for @Language!

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

1 participant