Skip to content

Kotlin compiler error: inherited platform declaration clashes #1690

Closed

Description

@jmfayard

Describe the bug

As a Kotlin programmer, I would like to create an Exception that extends both GraphQLError and RuntimeException

data class KotlinGraphqlException(val msg: String, val e: Throwable? = null) : 
    RuntimeException(msg, e), 
    GraphQLError 
{
    override fun getErrorType() = ErrorType.ValidationError
}

This is possible in Java, but not in Kotlin because both GraphQLError and RuntimeException have an inherited message property

image

Work-around: we currently have to define this class in Java. It's the only Java class in our project :/

Request: add a base class for Kotlin users that extends both GraphQLError and RuntimeException

I could hack my way by extending graphql.schema.CoercingParseLiteralException that does it, but it's not semantically correct.

Activity

  1. bbakerman commented on Dec 14, 2019

    @bbakerman
    Member

    I don"t see how we can fix this. We wont fix it specifically for Kotlin per se.

  2. jmfayard commented on Dec 14, 2019

    @jmfayard
    Author

    The fix would be to add to the library a class that implements both:

    public class SomeException extends GraphQLException implements GraphQLError {}

  3. andimarek commented on Jan 19, 2020

    @andimarek
    Member

    we merged and released a GraphQLErrorException .. see #1743

  4. added a commit that references this issue on Mar 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions