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

Staged and strict builders do not work with deepImmutablesDetection #793

Open
Diagoras opened this issue Jun 15, 2018 · 3 comments
Open

Comments

@Diagoras
Copy link

Diagoras commented Jun 15, 2018

Hey,

Using version 2.6.1, I've noticed that staged builder being set to true seems to break deep immutables detection. Modifying the example from the documentation:

@Value.Immutable
@Value.Style(deepImmutablesDetection = true, stagedBuilder = true)
public interface PointHolder {
  Point point();
}

@Value.Immutable
@Value.Style(allParameters = true)
public interface Point {
  int x();
  int y();
}

ImmutablePointHolder line = ImmutablePointHolder.builder()
  .point(1, 2) // Compile time error, expects Point
  .build();
}

Setting stagedBuilder = false seems to resolve the issue.

@elucash
Copy link
Member

elucash commented Jun 15, 2018

Thank you for reporting this! I would say that it just skips (doesn't support) those shortcut initializers that deepImmutableDetection provides. I'll see how hard it would be to support those on stage interfaces: this might be an easy-to-fix, low-hanging fruit. But in general, we can expect staged builders to be more restrictive and having fewer features than regular builders.

@Diagoras
Copy link
Author

Yeah, that makes sense. I hope it's workable, but we'll see.

Diagoras added a commit to Diagoras/immutables that referenced this issue Jun 17, 2018
Diagoras added a commit to Diagoras/immutables that referenced this issue Jun 17, 2018
@Diagoras
Copy link
Author

@elucash Started looking into this by creating test cases that demonstrate the problem (turns out deepImmutablesDetection isn't working for strictBuilder too). Ran into a weird issue with generating a staged builder on the test class, have you seen anything like this before?

@Diagoras Diagoras changed the title Staged builder = true does not work with deepImmutablesDetection Staged and strict builders do not work with deepImmutablesDetection Jun 17, 2018
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

No branches or pull requests

2 participants