/*
 * Copyright 2020, TeamDev. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package io.spine.base;

import io.spine.protobuf.Messages;
import io.spine.protobuf.ValidatingBuilder;

/**
 * A message for which {@link ValidatingBuilder} was generated by Spine Model Compiler.
 *
 * <p>Messages that implement this interface are <em>likely</em> produced by
 * {@link ValidatingBuilder#vBuild()} of the corresponding builder type. As such, these messages are
 * <em>likely</em> to conform to the validation constraints defined in the corresponding
 * Protobuf type.
 *
 * <p>Implementing this interface does <em>NOT</em> guarantee such conformity.
 * This is so because an instance of a message can still be built by methods
 * {@link ValidatingBuilder#buildPartial()} or {@link ValidatingBuilder#build()} which do not
 * perform the check of the validation constraints.
 *
 * @param <B>
 *         the type of the builder
 * @param <M>
 *         the type of the message used for binging of the builder type
 */
public interface BuiltMessage<B extends ValidatingBuilder<M>, M extends BuiltMessage<B, M>>
        extends KnownMessage {

    /**
     * Obtains the instance of the builder for the passed message class.
     *
     * @param messageClass
     *          the class of the message to be created by the returned builder
     * @param <B>
     *          the type of the builder
     * @param <M>
     *          the type of the message
     * @return a new empty builder
     */
    static <B extends ValidatingBuilder<M>, M extends BuiltMessage<B, M>>
    B builderOf(Class<? extends M> messageClass) {
        @SuppressWarnings("unchecked") // the case is protected by generic params of the interface
        B builder = (B) Messages.builderFor(messageClass);
        return builder;
    }
}

@@ -1260,16 +1260,68 @@
 .base;%0A%0A
+import com.google.errorprone.annotations.Immutable;%0A
 import i
@@ -2219,16 +2219,27 @@
 ype%0A */%0A
+@Immutable%0A
 public i

Fix missing annotation