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

Getting unused import of "scala.conversion.JavaConverters._" in generated .scala files #358

Open
skvithalani opened this issue Oct 17, 2017 · 2 comments

Comments

@skvithalani
Copy link

skvithalani commented Oct 17, 2017

I am having a proto file as follows

syntax = "proto3";

package csw_messages_params;

import "scalapb/scalapb.proto";

option (scalapb.options) = {
    single_file: true
};

message PbRaDec {
    double ra = 1;
    double dec = 2;
} 

Added following in plugins.sbt

addSbtPlugin("com.thesamet"                      % "sbt-protoc"             % "0.99.12-rc6")
libraryDependencies += "com.trueaccord.scalapb" %% "compilerplugin" % "0.6.4"

Added following settings to project in build.sbt

.settings(
    Common.detectCycles := false,
    PB.targets in Compile := Seq(
      PB.gens.java                        -> (sourceManaged in Compile).value,
      scalapb.gen(javaConversions = true) -> (sourceManaged in Compile).value
    )
  )

Problem: When the proto file is compiled and equivalent .scala file is generated via sbt, then there is a warning of

Warning:(8, 40) Unused import
import scala.collection.JavaConverters._

appearing.

There are two other proto files for which I am receiving the same warning on compilation

@skvithalani
Copy link
Author

skvithalani commented Nov 28, 2017

Thanks for the release of 0.6.7. The warning I reported above

Warning:(8, 40) Unused import
import scala.collection.JavaConverters._

is fixed for messages but not for enum types. Here is a sample of enum proto file that we are using in our project

syntax = "proto3";

package csw_protobuf;

enum PbUnits {
    //default unit
    NoUnits = 0;

    // SI units
    angstrom    = 1;
    arcmin      = 2;
    arcsec      = 3;
 }

@vishalovercome
Copy link

This issue still persists with repeated fields. Strangely enough, I only get this warning when the repeated field is part of a gRPC response.

@thesamet thesamet reopened this Sep 6, 2022
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

No branches or pull requests

3 participants