Skip to content

Conversation

@sandwwraith
Copy link
Member

because they are unstable for inheritance only, and experimentality is now leaking in function signatures

Fixes #1668

because they are unstable for inheritance only, and experimentality is now leaking in function signatures

Fixes #1668
@sandwwraith
Copy link
Member Author

We also may need to revisit experimental annotation on SerialDescriptor members (AFAIR, it was for inheritance too).

Also, JsonConfiguration looks like it may be stable already.

Copy link
Member

@qwwdfsad qwwdfsad left a comment

Choose a reason for hiding this comment

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

Please add a comment that these interfaces are experimental for implementation

@sandwwraith
Copy link
Member Author

It's been there all along:

@BenWoodworth
Copy link
Contributor

I don't think it's necessary (documenting that 3rd-party formats aren't stable seems like enough), just something I've been pondering the past week. But conceivably something like this could be used if you still want the implementing classes to explicitly opt in, bringing the instability front-and-center to the format dev:

interface SerialFormat {
    @ExperimentalSerializationApi
    @Suppress("PropertyName")
    @Deprecated(
        "SerialFormat interface is not stable for inheritance in 3rd party libraries, " +
                "as new methods might be added to this interface or contracts of the existing methods can be changed.",
        level = DeprecationLevel.HIDDEN,
    )
    val SerialFormat_interface_is_not_stable_for_inheritance: Unit // or maybe Nothing

    // ...
}

class ThirdPartySerialFormat : SerialFormat {
    @ExperimentalSerializationApi
    override val SerialFormat_interface_is_not_stable_for_inheritance: Unit = Unit
}

I don't think this would be a breaking change with existing 3rd party formats at runtime (e.g. no NoSuchMethodError since the property can never be accessed), but you would of course need to add the override in when compiling against kxs 1.3.0.

@qwwdfsad qwwdfsad self-requested a review September 22, 2021 15:27
@sandwwraith
Copy link
Member Author

@BenWoodworth Idea is good, and I think it was used in other parts somewhere (or in kotlinx.coroutines), but It looks like an overkill for this task. Interfaces are small, and usually inherited by format authors who read the documentation and know what's what

@sandwwraith sandwwraith merged commit 0d1dc0e into dev Sep 22, 2021
@sandwwraith sandwwraith deleted the remove-experimental-formats branch September 22, 2021 15:56
@BenWoodworth
Copy link
Contributor

Hah I figured. Cool to know it's been used elsewhere, and glad to see this merged! :)

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.

4 participants