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

Comments

Projects
None yet
2 participants
@orange-buffalo

orange-buffalo commented Jan 3, 2017

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.

@orange-buffalo orange-buffalo referenced this issue Jan 6, 2017

Merged

Issue 245 #248

@rzwitserloot

This comment has been minimized.

Show comment
Hide comment
@rzwitserloot

rzwitserloot Feb 14, 2017

Owner

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

Owner

rzwitserloot commented Feb 14, 2017

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

@orange-buffalo

This comment has been minimized.

Show comment
Hide comment
@orange-buffalo

orange-buffalo Feb 19, 2017

Cool, thank you!

orange-buffalo commented Feb 19, 2017

Cool, thank you!

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