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

Handle protos without a package #3

Merged
merged 2 commits into from
Feb 9, 2022

Conversation

jtjeferreira
Copy link
Contributor

Fixes the following error when a proto has no package

org/test/datatypes/NoPackageTestMessage.java: insertion point "class_scope:.NoPackageTestMessage.NestedTestMessage" not found.

error reproduced

minimal reproducer
@@ -104,7 +104,7 @@ public static void main(String[] args) {
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();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if this is the best way, but it works.

I saw a DOT_JOINER here, but it is not used with the protoPackage (i.e protoPackage + "." + e.getName() is what is used there)

@Fadelis
Copy link
Owner

Fadelis commented Feb 9, 2022

Thanks for spotting this, though I'd really encourage defining package, since it's the recommended approach

@Fadelis Fadelis merged commit 02162e8 into Fadelis:master Feb 9, 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

Successfully merging this pull request may close these issues.

2 participants