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

Added FormatLanguage annotation to JSON #2234

Merged
merged 3 commits into from May 10, 2023
Merged

Added FormatLanguage annotation to JSON #2234

merged 3 commits into from May 10, 2023

Conversation

shanshin
Copy link
Contributor

Resolves #2166

@qwwdfsad qwwdfsad removed their request for review March 16, 2023 11:08
AnnotationTarget.LOCAL_VARIABLE,
AnnotationTarget.ANNOTATION_CLASS
)
public expect annotation class FormatLanguage(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @OptionalExpectation may help here with avoiding re-declaring annotation on JS and Native

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would work if the class had a name org.intellij.lang.annotations.Language.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? I think it's available for any annotation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because in this case, I'm not sure that JSON syntax highlighting will work correctly for non-JVM projects, because it works specifically for annotations with the name org.intellij.lang.annotations.Language but this is kotlinx.serialization.json.internal.FormatLanguage.

@shanshin shanshin requested a review from sandwwraith May 2, 2023 10:34
/**
* Multiplatform analogue of `org.intellij.lang.annotations.Language` annotation.
*
* An alias is used instead of classes, because the actual class in the JVM will overload the classes from the stdlib -
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean 'classes' or a single 'class'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

single class in this case

@sandwwraith sandwwraith merged commit 5a8795a into dev May 10, 2023
2 of 3 checks passed
@Kantis
Copy link
Contributor

Kantis commented May 11, 2023

Did this go out with 1.5.1?

I'm seeing the following failure on gradle task compileTestDevelopmentExecutableKotlinJs when trying to build Ks3 with KotlinX Serialization 1.5.1: (log, see line 110)

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)
        at org.jetbrains.kotlin.ir.declarations.IrFactory$DefaultImpls.createClass$default(IrFactory.kt:30)
        at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer$deserializeIrClass$1$2.invoke(IrDeclarationDeserializer.kt:350)
        at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer$deserializeIrClass$1$2.invoke(IrDeclarationDeserializer.kt:349)
        at org.jetbrains.kotlin.ir.util.SymbolTable.declareClass(SymbolTable.kt:1304)
        at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer.deserializeIrClass(IrDeclarationDeserializer.kt:349)
        at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer.deserializeDeclaration(IrDeclarationDeserializer.kt:787)
        at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer.deserializeDeclaration$default(IrDeclarationDeserializer.kt:782)
        at org.jetbrains.kotlin.backend.common.serialization.IrFileDeserializer.deserializeDeclaration(IrFileDeserializer.kt:40)
        at org.jetbrains.kotlin.backend.common.serialization.FileDeserializationState.deserializeAllFileReachableTopLevel(IrFileDeserializer.kt:125)
        at org.jetbrains.kotlin.backend.common.serialization.BasicIrModuleDeserializer$ModuleDeserializationState.deserializeReachableDeclarations(BasicIrModuleDeserializer.kt:190)
        at org.jetbrains.kotlin.backend.common.serialization.BasicIrModuleDeserializer.deserializeReachableDeclarations(BasicIrModuleDeserializer.kt:158)
        at org.jetbrains.kotlin.backend.common.serialization.KotlinIrLinker.deserializeAllReachableTopLevels(KotlinIrLinker.kt:111)
        at org.jetbrains.kotlin.backend.common.serialization.KotlinIrLinker.findDeserializedDeclarationForSymbol(KotlinIrLinker.kt:122)
        at org.jetbrains.kotlin.backend.common.serialization.KotlinIrLinker.deserializeOrResolveDeclaration(KotlinIrLinker.kt:159)
        at org.jetbrains.kotlin.backend.common.serialization.KotlinIrLinker.getDeclaration(KotlinIrLinker.kt:148)
        at org.jetbrains.kotlin.ir.util.ExternalDependenciesGeneratorKt.getDeclaration(ExternalDependenciesGenerator.kt:57)
        at org.jetbrains.kotlin.ir.util.ExternalDependenciesGenerator.generateUnboundSymbolsAsDependencies(ExternalDependenciesGenerator.kt:44)
        at org.jetbrains.kotlin.ir.backend.js.ic.LoadedJsIr.loadUnboundSymbols(JsIrLinkerLoader.kt:70)
        at org.jetbrains.kotlin.ir.backend.js.ic.JsIrLinkerLoader.loadIr(JsIrLinkerLoader.kt:201)
        at org.jetbrains.kotlin.ir.backend.js.ic.JsIrLinkerLoader.loadIr$default(JsIrLinkerLoader.kt:151)
        at org.jetbrains.kotlin.ir.backend.js.ic.CacheUpdater.loadIrForDirtyFilesAndInitCompiler(CacheUpdater.kt:636)
        at org.jetbrains.kotlin.ir.backend.js.ic.CacheUpdater.loadIrAndMakeIrFragmentGenerators(CacheUpdater.kt:694)
        at org.jetbrains.kotlin.ir.backend.js.ic.CacheUpdater.actualizeCaches(CacheUpdater.kt:718)
        at org.jetbrains.kotlin.cli.js.K2JsIrCompiler.prepareIcCaches(K2JsIrCompiler.kt:704)
        at org.jetbrains.kotlin.cli.js.K2JsIrCompiler.doExecute(K2JsIrCompiler.kt:275)
        at org.jetbrains.kotlin.cli.js.K2JSCompiler.doExecute(K2JSCompiler.java:181)
        at org.jetbrains.kotlin.cli.js.K2JSCompiler.doExecute(K2JSCompiler.java:72)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:100)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:46)
        at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
        at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1486)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
        at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
        at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
        at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)

@sandwwraith
Copy link
Member

@Kantis Yes, it did. Make sure that all serialization dependencies use the same 1.5.1 version. If that doesn't help, please create separate issue.

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

Successfully merging this pull request may close these issues.

None yet

3 participants