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

BuiltMessage and Kotlin extensions #604

Merged
merged 174 commits into from
Mar 11, 2021
Merged

Conversation

alexander-yevsyukov
Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov commented Dec 27, 2020

This PR introduces BuiltMessage interface which binds a builder type with the message type.

The binding is used in Kotlin extension declared (in the io/spine/base/extensions.kt file) as shown below:

inline fun <M: BuiltMessage<B, M>, B: ValidatingBuilder<M>>
        M.copy(block: B.() -> Unit): M {
    @Suppress("UNCHECKED_CAST") // ensured by the generated code
    val builder = this.toBuilder() as B
    block.invoke(builder)
    return builder.vBuild()
}

This binding is going to be used in other generated Kotlin extensions in the following PRs.

Changes to the existing types and hierarchies

  • ValidatingBuilder interface moved to the io.spine.base package.
  • RejectionType moved to the io.spine.base package (from io.spine.type).
  • KnownMessage moved to the io.spine.type package (from io.spine.base).
  • SerializableMessage moved to io.spine.type (from io.spine.base).
  • Signal interfaces and EntityState are now are based on BuiltMessage and the code generation was adjusted accordingly.
  • ThrowableMessage was renamed to RejectionThrowable to avoid the confusion. Now it's clear that a rejection has two incarnations: RejectionMessage and RejectionThrowable.
  • UuidValue interface lost the unused generic parameter <I>.

Other notable changes introduced by this PR:

  • smoke-tests were renamed to tests and pushed to the root project directory.
  • MessageType.isSignal() method was introduced.
  • Environment-related types moved to the package io.spine.environment.
  • Interim artifacts named xxx-api were merged into corresponding xxx-base modules (e.g. spine-tools-api became a part of spine-tool-base).
  • Some of the classes lost the Generated prefix (e.g. GeneratedNestedClass became NestedClass).
  • Classes named XxxGenerator were renamed to be XxxGen.
  • Data types that had incorrect validation options were removed. Please see this issue for details.

@alexander-yevsyukov alexander-yevsyukov self-assigned this Dec 27, 2020
@alexander-yevsyukov alexander-yevsyukov changed the base branch from master to 2.x-jdk8-master December 27, 2020 18:25
@alexander-yevsyukov alexander-yevsyukov marked this pull request as draft March 5, 2021 12:08
@alexander-yevsyukov
Copy link
Contributor Author

I see the integration tests failing, I'm on the fix.

Copy link
Collaborator

@armiol armiol left a comment

Choose a reason for hiding this comment

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

@alexander-yevsyukov LGTM in general. Please see my comments.

Copy link
Contributor

@dmdashenkov dmdashenkov left a comment

Choose a reason for hiding this comment

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

Please see my comments.

@alexander-yevsyukov alexander-yevsyukov marked this pull request as ready for review March 10, 2021 17:32
Copy link
Collaborator

@armiol armiol left a comment

Choose a reason for hiding this comment

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

@alexander-yevsyukov LGTM with a single comment to address.

@alexander-yevsyukov alexander-yevsyukov merged commit 5380172 into master Mar 11, 2021
@alexander-yevsyukov alexander-yevsyukov deleted the buildable-message branch March 11, 2021 16:54
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.

3 participants