question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't correctly resolve multiple @Builder methods in same class having partial implementations

See original GitHub issue

It seems that the plugin doesn’t correctly process the @Builder annotation when it’s applied to a second method in the same class and there are already partial implementations of the builders.

Here are two screenshots of the same class with the Builder definitions inverted:

person_builder method declaration reversed: pet_builder Similarly, trying to resolve method declarations from an external class (when `PersonBuilder` is the one correctly generated): Resolving `PersonBuilder`: screen shot 2015-12-12 at 6 06 35 pm Resolving incorrectly for `PetBuilder`: screen shot 2015-12-12 at 6 07 02 pm

Thanks!

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
avpinescommented, Nov 19, 2018

Not sure that it’s still relevant, but I’ve encountered the same issue and resolved this by specifically setting the builderClassName

@Builder(builderMethodName = "relaxedBuilder", builderClassName = "RelaxedBuilder") 
private MyClass( ... )

@Builder(builderMethodName = "builder") 
private MyClass( ... )

and usage:

MyClass.builder()

MyClass.relaxedBuilder()
4reactions
agibsonccccommented, Oct 13, 2017

I’m running in to this as well with 2 different method names.

Read more comments on GitHub >

github_iconTop Results From Across the Web

@Builder - Project Lombok
The @Builder annotation produces complex builder APIs for your classes. @Builder lets you automatically produce the code required to have your class be ......
Read more >
java - Why do we need a Builder class when implementing a ...
Any class not knowing how to build itself is necessarily coupled to the Builder that has further dependencies (such is the purpose and...
Read more >
How to create multiple varieties of a Class using the Builder ...
Effective Java suggests using parallel hierarchy of builders for such cases. Here is how abstract and concrete classes may look like:.
Read more >
Reading 14: Recursion - MIT
Today's class will delve more deeply into recursion than you may have gone before. ... Let's run the recursive implementation of factorial in...
Read more >
Learning the Basics - Gradle User Manual
Gradle can resolve dependencies from one or many repositories based on Maven, ... repository *only* contains artifacts with group "my.company" includeGroup ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found