You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No compilation issues are produced when compiling classes generated by the Kotlin codegen using Kotlin 2.0+
Actual behavior
This warning:
w: file:///Users/david.moidl/Productboard/pb-universe/board-module/board/build/generated/sources/dgs-codegen/com/productboard/board/graphql/generated/types/User.kt:20:13 This code uses error suppression for 'INAPPLICABLE_JVM_NAME'. While it might compile and work, the compiler behavior is UNSPECIFIED and WON'T BE PRESERVED. Please report your use case to the Kotlin issue tracker instead: https://kotl.in/issue
is issued for some of the classes generated via the DGS's Kotlin codegen.
Normally, I wouldn't worry too much about warnings being issued during compilation of a generated code. However, this warning seems to be intentionally scary as it communicates a possible compilation errors in the future.
Steps to reproduce
Generate any class representing a GQL type that implements a GQL interface via the Kotlin codegen. Any fields of the interface implemented by the class will get annotated with @Suppress("INAPPLICABLE_JVM_NAME"), triggering this error.
@JsonTypeInfo(
use =JsonTypeInfo.Id.NAME,
include =JsonTypeInfo.As.PROPERTY,
property ="__typename",
)
@JsonSubTypes(value = [
// removed for brevity
])
publicsealedinterfaceNode {
@Suppress("INAPPLICABLE_JVM_NAME") // <-- this is the problem
@get:JvmName("getId")
publicval id:String
}
Team.kt
@JsonTypeInfo(use =JsonTypeInfo.Id.NONE)
@JsonDeserialize(builder =Team.Builder::class)
publicclassTeam(
id: () ->String = idDefault,
) : Node,
RoadmapGroupingValue {
privateval__id: () ->String= id
@Suppress("INAPPLICABLE_JVM_NAME") // <-- this is the problem
@get:JvmName("getId")
overrideval id:String
get() =__id.invoke()
publiccompanionobject {
privateval idDefault: () ->String=
{ throwIllegalStateException("Field `id` was not requested") }
}
@JsonPOJOBuilder
@JsonIgnoreProperties("__typename")
publicclassBuilder {
privatevar id: () ->String= idDefault
@JsonProperty("id")
publicfunwithId(id:String): Builder=this.apply {
this.id = { id }
}
publicfunbuild(): Team=Team(
id = id,
)
}
}
Error.kt
@JsonTypeInfo(
use =JsonTypeInfo.Id.NAME,
include =JsonTypeInfo.As.PROPERTY,
property ="__typename",
)
@JsonSubTypes(value = [
// removed for brevity
])
publicsealedinterfaceError {
@Suppress("INAPPLICABLE_JVM_NAME") // <-- this is the problem
@get:JvmName("getMessage")
publicval message:String
}
Please note that I understand the Kotlin codegen is still marked as experimental. However, with the recent release of Kotlin 2.0, this looks like a possible incompatibility that I believe should be addressed to keep the project up-to-date with the latest language version.
The text was updated successfully, but these errors were encountered:
Expected behavior
No compilation issues are produced when compiling classes generated by the Kotlin codegen using Kotlin 2.0+
Actual behavior
This warning:
is issued for some of the classes generated via the DGS's Kotlin codegen.
Normally, I wouldn't worry too much about warnings being issued during compilation of a generated code. However, this warning seems to be intentionally scary as it communicates a possible compilation errors in the future.
Steps to reproduce
Generate any class representing a GQL type that
implements
a GQL interface via the Kotlin codegen. Any fields of the interface implemented by the class will get annotated with@Suppress("INAPPLICABLE_JVM_NAME")
, triggering this error.An excerpt from our GQL schema:
And the corresponding generated classes:
Node.kt
Team.kt
Error.kt
LocatedEntityNotFoundError
Notes
Please note that I understand the Kotlin codegen is still marked as experimental. However, with the recent release of Kotlin 2.0, this looks like a possible incompatibility that I believe should be addressed to keep the project up-to-date with the latest language version.
The text was updated successfully, but these errors were encountered: