Skip to content

Commit

Permalink
Unused import - warning fix
Browse files Browse the repository at this point in the history
Compiling generated code issues warning about unused import
WARNING: Unused import
- import com.google.protobuf.ExtensionRegistryLite.{getEmptyRegistry =>
_emptyRegistry}
- import com.google.protobuf.CodedOutputStream._
  • Loading branch information
VlachJosef authored and SandroGrzicic committed Aug 18, 2017
1 parent 93cf25f commit ad4019f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,10 @@ class Generator protected (sourceName: String, importedSymbols: Map[String, Impo
val definition = if (lazyGetSerializedSize) "lazy val" else "def"

out.append("\n").append(indent1).append(definition).append(" getSerializedSize = {\n")
.append(indent2).append("import com.google.protobuf.CodedOutputStream._\n")
.append(indent2).append("var __size = 0\n")
if(fields.nonEmpty) { // prevent Unused import compilation warning when there are no fields for size computing
out.append(indent2).append("import com.google.protobuf.CodedOutputStream._\n")
}
out.append(indent2).append("var __size = 0\n")
for (field <- fields) {
field.label match {
case REQUIRED => out.append(indent2)
Expand Down Expand Up @@ -314,7 +316,7 @@ class Generator protected (sourceName: String, importedSymbols: Map[String, Impo
out.append("\n").append(indent1)
.append("def mergeFrom(in: com.google.protobuf.CodedInputStream, extensionRegistry: com.google.protobuf.ExtensionRegistryLite): ")
.append(name).append(" = {\n")
.append(indent2).append("import com.google.protobuf.ExtensionRegistryLite.{getEmptyRegistry => _emptyRegistry}\n")
.append(indent2).append("val _emptyRegistry = com.google.protobuf.ExtensionRegistryLite.getEmptyRegistry\n")

for (field <- fields) {
field.label match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final case class UseFullImportedName (
}

def mergeFrom(in: com.google.protobuf.CodedInputStream, extensionRegistry: com.google.protobuf.ExtensionRegistryLite): UseFullImportedName = {
import com.google.protobuf.ExtensionRegistryLite.{getEmptyRegistry => _emptyRegistry}
val _emptyRegistry = com.google.protobuf.ExtensionRegistryLite.getEmptyRegistry
var __fullnameTest: resources.generated.nested.PackageTest = resources.generated.nested.PackageTest.defaultInstance

def __newMerged = UseFullImportedName(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ final case class MutiMessageOne (
}

def getSerializedSize = {
import com.google.protobuf.CodedOutputStream._
var __size = 0

__size
}

def mergeFrom(in: com.google.protobuf.CodedInputStream, extensionRegistry: com.google.protobuf.ExtensionRegistryLite): MutiMessageOne = {
import com.google.protobuf.ExtensionRegistryLite.{getEmptyRegistry => _emptyRegistry}
val _emptyRegistry = com.google.protobuf.ExtensionRegistryLite.getEmptyRegistry

def __newMerged = MutiMessageOne(

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ final case class MultiMessageTwo (
}

def mergeFrom(in: com.google.protobuf.CodedInputStream, extensionRegistry: com.google.protobuf.ExtensionRegistryLite): MultiMessageTwo = {
import com.google.protobuf.ExtensionRegistryLite.{getEmptyRegistry => _emptyRegistry}
val _emptyRegistry = com.google.protobuf.ExtensionRegistryLite.getEmptyRegistry
var __requiredField: Int = 0
var __optionalField: Option[Float] = optionalField
val __repeatedField: scala.collection.mutable.Buffer[String] = repeatedField.toBuffer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ final case class SimpleTest (
}

def mergeFrom(in: com.google.protobuf.CodedInputStream, extensionRegistry: com.google.protobuf.ExtensionRegistryLite): SimpleTest = {
import com.google.protobuf.ExtensionRegistryLite.{getEmptyRegistry => _emptyRegistry}
val _emptyRegistry = com.google.protobuf.ExtensionRegistryLite.getEmptyRegistry
var __requiredField: Int = 0
var __optionalField: Option[Float] = optionalField
val __repeatedField: scala.collection.mutable.Buffer[String] = repeatedField.toBuffer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final case class PackageTest (
}

def mergeFrom(in: com.google.protobuf.CodedInputStream, extensionRegistry: com.google.protobuf.ExtensionRegistryLite): PackageTest = {
import com.google.protobuf.ExtensionRegistryLite.{getEmptyRegistry => _emptyRegistry}
val _emptyRegistry = com.google.protobuf.ExtensionRegistryLite.getEmptyRegistry
var __requiredField: Int = 0

def __newMerged = PackageTest(
Expand Down

0 comments on commit ad4019f

Please sign in to comment.