Skip to content

Can't compile when proto definition contains oneOf field type #6306

@donpaul120

Description

@donpaul120

Please answer these questions before submitting a bug report.

What version of gRPC are you using?

  artifact = 'io.grpc:protoc-gen-grpc-java:1.24.0'

What operating system (Linux, Windows,...) and version?

   MacOS Mojave : v10.14.6

What did you expect to see?

  Should compile and generate from proto definitions without errors

What did you see instead?

Task :compileKotlin FAILED e : Supertypes of the following classes cannot be resolved. 
Please make sure you have the required dependencies in the classpath: 
class entity.grpc.User.MyAgeCase, unresolved supertypes: InternalOneOfEnum

Steps to reproduce the bug

message User {
    oneof my_age {
       string age = 26;
    string age_baz = 29;
   }
}

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

Gradle
buildscript {
    ext.kotlin_version = '1.3.50'

    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

plugins {
    id 'idea'
    id 'java'
    id "org.flywaydb.flyway" version "6.0.4"
    id 'org.jetbrains.kotlin.jvm' version '1.3.41'
    id 'com.google.protobuf' version '0.8.8'
}

protobuf {
    protoc {
        artifact = "com.google.protobuf:protoc:3.10.0"
    }
    plugins {
        grpc {
            artifact = 'io.grpc:protoc-gen-grpc-java:1.24.0'
        }
    }
    generateProtoTasks {
        all()*.plugins {
            grpc {}
        }
    }

    generatedFilesBaseDir = "$projectDir/build/generated/"
}

sourceCompatibility = 12

repositories {
    mavenCentral()
    maven { url "https://jitpack.io" }
    jcenter()
}

dependencies {
    //Logging
    implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.7'
    implementation group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.7'
    implementation group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'

    //Postgres Database
    implementation group: 'org.postgresql', name: 'postgresql', version: '42.2.8'

    //Akka
    implementation group: 'com.typesafe.akka', name: 'akka-http_2.12',   version: '10.1.10'
    implementation group: 'com.typesafe.akka', name: 'akka-http2-support_2.12', version: '10.1.10'

    //gRPC - Java
    implementation 'io.grpc:grpc-netty-shaded:1.24.0'
    implementation 'io.grpc:grpc-protobuf:1.24.0'
    implementation 'io.grpc:grpc-stub:1.24.0'
    implementation 'com.google.protobuf:protobuf-java-util:3.9.2'


    //Guice - Google
    implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.10.0'
    implementation group: 'com.google.inject', name: 'guice', version: '4.2.2'
    implementation group: 'com.google.inject.extensions', name: 'guice-assistedinject', version: '4.2.2'

    //Kotlin
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"

    //-------------- Test dependencies----------------------------
    testImplementation group: 'junit', name: 'junit', version: '4.12'
    testImplementation "io.mockk:mockk:1.9.3"
    testImplementation("org.assertj:assertj-core:3.11.1")
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.0'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.0'
    //-------------------------------------------------------------
    implementation 'org.jetbrains.exposed:exposed:0.16.1'
    implementation 'org.hibernate:hibernate-validator:6.0.17.Final'

}


flyway {
    url = 'jdbc:postgresql://localhost:5432/user_management'
    user = 'postgres'
    password = ''
    placeholders = ['keyABC': 'valueXYZ']
}

test{
    useJUnitPlatform()
    testLogging {
        events "passed", "skipped", "failed"
    }
}

compileKotlin {
    kotlinOptions.jvmTarget = "12"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "12"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions