From 98867e22292dc24c94b92e7c574f0a2c5d19d026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ferreira?= Date: Tue, 8 Feb 2022 20:52:30 +0000 Subject: [PATCH 1/2] minimal reproducer error reproduced minimal reproducer --- .../src/test/resources/no-package-type.proto | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 protoc-gen-java-optional-test/src/test/resources/no-package-type.proto diff --git a/protoc-gen-java-optional-test/src/test/resources/no-package-type.proto b/protoc-gen-java-optional-test/src/test/resources/no-package-type.proto new file mode 100644 index 0000000..1e1959d --- /dev/null +++ b/protoc-gen-java-optional-test/src/test/resources/no-package-type.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +option java_multiple_files = true; +option java_package = "org.test.datatypes"; + +message NoPackageTestMessage { + message NestedTestMessage { + string string = 1; + optional string optional_string = 2; + } +} + From 80eeb68fc33952f2884befacea14b9bd36e178ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ferreira?= Date: Wed, 9 Feb 2022 00:58:44 +0000 Subject: [PATCH 2/2] fix error --- .../main/java/org/grpcmock/protoc/plugin/OptionalGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protoc-gen-java-optional/src/main/java/org/grpcmock/protoc/plugin/OptionalGenerator.java b/protoc-gen-java-optional/src/main/java/org/grpcmock/protoc/plugin/OptionalGenerator.java index 3446c23..664123f 100644 --- a/protoc-gen-java-optional/src/main/java/org/grpcmock/protoc/plugin/OptionalGenerator.java +++ b/protoc-gen-java-optional/src/main/java/org/grpcmock/protoc/plugin/OptionalGenerator.java @@ -104,7 +104,7 @@ private Stream handleMessage( String javaPackage ) { String filePath = javaPackage.replace(".", DIR_SEPARATOR) + DIR_SEPARATOR + fileName + JAVA_EXTENSION; - String fullMethodName = protoPackage + "." + messageDescriptor.getName(); + String fullMethodName = (protoPackage.isEmpty() ? "" : (protoPackage + ".")) + messageDescriptor.getName(); return Stream.concat( handleSingleMessage(messageDescriptor, filePath, fullMethodName),