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

Duplicate final field assignment with latest SNAPSHOT #744

Closed
Stephan202 opened this issue Jan 3, 2018 · 0 comments
Closed

Duplicate final field assignment with latest SNAPSHOT #744

Stephan202 opened this issue Jan 3, 2018 · 0 comments
Milestone

Comments

@Stephan202
Copy link
Contributor

Consider the following code:

import org.immutables.value.Value;

@Value.Immutable
@Value.Style(allParameters = true)
interface Dummy {
    @Value.Default
    default String getFoo() {
        return "";
    }

    @Value.Default
    default boolean isBar() {
        return true;
    }
}

When built against master (7c42bef), the following code is generated:

...
  private ImmutableDummy(String foo, boolean isBar) {
    this.foo = Objects.requireNonNull(foo, "foo");
    this.isBar = isBar;
    this.foo = initShim.getFoo();
    this.isBar = initShim.isBar();
    this.initShim = null;
  }
...

This yields the following compilation error:

[ERROR] /path/to/ImmutableDummy.java:[41,9] variable foo might already have been assigned
[ERROR] /path/to/ImmutableDummy.java:[42,9] variable isBar might already have been assigned

The issue does not affect version 2.5.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants