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

@Language annotation causes compilation error for Kotlin/JS when using other libraries with same workaround #2377

Closed
Kantis opened this issue Jul 25, 2023 · 7 comments
Assignees

Comments

@Kantis
Copy link
Contributor

Kantis commented Jul 25, 2023

Describe the bug
Trying to compile a project for Kotlin/JS when using another library which also performs the multiplatform @Language workaround results in:

e: java.lang.IllegalStateException: IrClassPublicSymbolImpl for org.intellij.lang.annotations/Language|null[0] is already bound: CLASS ANNOTATION_CLASS name:Language modality:OPEN visibility:public superTypes:[kotlin.Annotation]
	at org.jetbrains.kotlin.ir.symbols.impl.IrBindablePublicSymbolBase.bind(IrPublicSymbolBase.kt:58)
	at org.jetbrains.kotlin.ir.declarations.impl.IrClassImpl.<init>(IrClassImpl.kt:37)
	at org.jetbrains.kotlin.ir.declarations.impl.AbstractIrFactoryImpl.createClass(IrFactoryImpl.kt:55)
	at org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImplForJsIC.createClass(IrFactoryImplForJsIC.kt:67)
> Task :ks3-standard:compileTestDevelopmentExecutableKotlinJs FAILED

Also reported at https://youtrack.jetbrains.com/issue/KT-59620

To Reproduce
See Youtrack ticked

Expected behavior
IntelliJ should ship proper multiplatform @Language. Until then it's probably a good idea to remove these workarounds,

Environment

  • Kotlin version: 1.8.20
  • Library version: 1.5.1
  • Kotlin platforms: JS
  • Gradle version: 8.2.1
@sandwwraith
Copy link
Member

sandwwraith commented Jul 26, 2023

Ouch. @shanshin If we remove org.intellij.lang.annotations.Language from JS & Native, I suppose IDE highlighting will still work? (at least for JVM sources?)

@shanshin
Copy link
Contributor

@shanshin If we remove org.intellij.lang.annotations.Language from JS & Native, I suppose IDE highlighting will still work? (at least for JVM sources?)

if we replace the annotation for JS/Native with another one, the syntax highlighting disappears in it

@sandwwraith
Copy link
Member

And for the common source?

@shanshin
Copy link
Contributor

Unfortunately, it does not work for common source even in current version, apparently IntelliJ only looks at the expect annotation, because it does not know for what target the code will be used.

@sandwwraith
Copy link
Member

Then it kinda doesn't make sense (unless we make expect annotation class org.intellij.lang.annotations.Language which we can't do anyway), so let's leave it JVM-only

@shanshin
Copy link
Contributor

Then it kinda doesn't make sense (unless we make expect annotation class org.intellij.lang.annotations.Language which we can't do anyway), so let's leave it JVM-only

OK

It seems to me the best solution in the future will be to add a special annotation to the library, and this annotation should already be supported by IntelliJ.

@sandwwraith
Copy link
Member

Yeah, it is called 'making org.jetbrains.annotations' MPP library)

shanshin added a commit that referenced this issue Jul 26, 2023
The declaration of annotation `org.intellij.lang.annotations.Language` in the JS and native source has been removed, because if this annotation is declared in other dependency, then this leads to compilation errors.

Fixes #2377
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