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

Empty object generation when using maps and multiple files. #51

Merged
merged 2 commits into from
Jun 14, 2019

Conversation

sauldhernandez
Copy link
Contributor

Hi! I started to use this library not too long ago, great work!

So, I ran into a strange duplicate class error when using the protobuf builders generator, and having option java_multiple_files = true, compilation would fail whenever I have a message with a mapped field:

Task :myapp:kaptKotlin FAILED
e: <path to app>/build/generated/source/proto/main/java/com/myapp/Mapped.java:9: error: duplicate class: com.myapp.Mapped
public  final class Mapped extends

I tracked down the error to a generated object Mapped with no elements. Looking into the code I realized that it was generated there, but the filter didn't take into account map definitions (as is in other places in the generator)

I tested it and seems to solve the issue, test pass, but I don't know if there's anything else I should change.

@codecov-io
Copy link

codecov-io commented Jun 10, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@f8032c4). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #51   +/-   ##
=========================================
  Coverage          ?   88.12%           
  Complexity        ?       19           
=========================================
  Files             ?       15           
  Lines             ?      278           
  Branches          ?       37           
=========================================
  Hits              ?      245           
  Misses            ?       14           
  Partials          ?       19

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f8032c4...44bee9e. Read the comment docs.

@marcoferrer
Copy link
Owner

Thanks for the contribution, this was a great catch. Would you mind adding a test sample for the previously failing proto to the test api module? And a very basic unit test in generator tests module. Something as simple as calling the fixed builder. This way the compiler can catch any regressions

@marcoferrer marcoferrer merged commit b433131 into marcoferrer:master Jun 14, 2019
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.

3 participants