marcoferrer / kroto-plus

gRPC Kotlin Coroutines, Protobuf DSL, Scripting for Protoc
Apache License 2.0
493 stars 28 forks source link

Prevent class name collisions in proto builders #88

Closed marcoferrer closed 4 years ago

marcoferrer commented 4 years ago

This PR resolves #84

Unfortunately when the proto builder generator is configured with the option unwrap_builders = true, and java_multiple_files = true and any message within the file has a nested message, a class name collisions occurs.

There isnt much that can be done to fix it without breaking existing user generated code. The best option to resolve the issue is to not use the unwrap builders option and fallback to a static import of the generated builder wrapper object.

The changes introduced in this PR are meant to catch these specific conditions and prevent the generation of invalid code.

Configuration docs have been updated. Warnings are also outputted in the comments of the generated code to let users know when unwrap_builders has been deliberately ignored.

codecov-io commented 4 years ago

Codecov Report

Merging #88 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #88   +/-   ##
=========================================
  Coverage     85.29%   85.29%           
  Complexity       19       19           
=========================================
  Files            15       15           
  Lines           306      306           
  Branches         49       49           
=========================================
  Hits            261      261           
  Misses           16       16           
  Partials         29       29

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 7fef300...335c2e3. Read the comment docs.