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

Incorrect type in equals when using @EqualsAndHashCode #1274

Closed
orange-buffalo opened this issue Jan 3, 2017 · 2 comments
Closed

Incorrect type in equals when using @EqualsAndHashCode #1274

orange-buffalo opened this issue Jan 3, 2017 · 2 comments

Comments

@orange-buffalo
Copy link

Consider the following code:

import lombok.EqualsAndHashCode;

public interface DynamicType {

    interface Unloaded extends DynamicType {

    }

    class Default implements DynamicType {

        @EqualsAndHashCode(callSuper = false)
        public static class Unloaded extends Default implements DynamicType.Unloaded {

        }
    }
}

Compilation fails with error:

DynamicType.java:[11,9] reference to Unloaded is ambiguous
[ERROR] both class DynamicType.Default.Unloaded in DynamicType.Default and interface DynamicType.Unloaded in DynamicType match

If we check the generated code

...
public boolean equals(final java.lang.Object o) {
       if (o == this) return true;
       if (!(o instanceof DynamicType.Default.Unloaded)) return false;
       final Unloaded other = (Unloaded) o;
...

we can see that type name is not fully specified in cast operation. All other places of generated code use canonical class name.

@rzwitserloot
Copy link
Collaborator

Fixed in release 1.16.14. It's the 'you never encountered this bug' reference in the changelog :)

@orange-buffalo
Copy link
Author

Cool, thank you!

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