Skip to content

The latest version of the library generates corrupted code when applied in web repository #31

Description

@yevhenii-nadtochii

Using of the latest version of spine-mc-java in web repository fails the build with a compilation error. The generated code contains validate() method that has an unexpected return type.

The problematic versions are 2.0.0-SNAPSHOT.90 / 2.0.0-SNAPSHOT.91.

web/firebase-web/generated/main/java/io/spine/web/firebase/subscription/FirebaseSubscription.java:880: error: incompatible types: ImmutableList<ConstraintViolation> cannot be converted to Optional<ValidationError>
            java.util.Optional<io.spine.validate.ValidationError> generated_validationError_subscription = this.getSubscription().validate();
                                                                                                                                          ^

Additional remark for those who will reproduce the issue. When bumping the version of mc-java, the version of mc-js is usually also bumped. Bumping of mc-jc requires the code below to be dropped out from config. The protoJs extension has been transformed. Take a look on this PR for details.

In buildSrc/src/main/kotlin/io/spine/internal/gradle/javascript/plugin/McJs.kt:

    project.withGroovyBuilder {
        "protoJs" {
            setProperty("generatedMainDir", genProtoMain)
            setProperty("generatedTestDir", genProtoTest)
        }
    }

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

Status
✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions