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

[BUG] Builder on a nested class inside an generic interface in Eclipse #2369

Closed
juriad opened this issue Feb 14, 2020 · 1 comment
Closed
Milestone

Comments

@juriad
Copy link

juriad commented Feb 14, 2020

Describe the bug

Nested class annotated @Builder in an interface which has a generic parameter compiles in Eclipse only if the class is explicitly declared static.

To Reproduce

This minimal example does not work in Eclipse:

import lombok.Builder;
public interface TestBuilder<S> {
	@Builder
	class Nested {
	}
}

The error is:

Cannot make a static reference to the non-static type S

It works if the class is marked as static (which is the default modifier for classes within an interfaces).

There is no error when building the class with Gradle, so I assume it is ECJ specific.

Version info (please complete the following information):

  • Lombok: 1.18.12; also tried 1.18.0 and 1.16.0; the error is present in all of them
  • Platform: Freshly downloaded Eclipse (Version: 2019-12 (4.14.0); Build id: 20191212-1212)
@rzwitserloot
Copy link
Collaborator

It's a bug in lombok. What's more surprising to me is that it seems to work fine in javac, though. Perhaps the java parser already marks that one as static.

The fully qualified type generator needs to be updated to know that inner classes are inherently static if the enclosing type is an enum or interface (or record, I guess?)

rzwitserloot added a commit that referenced this issue Feb 14, 2020
@rzwitserloot rzwitserloot added this to the next-version milestone Feb 14, 2020
Febell pushed a commit to Febell/lombok that referenced this issue Mar 1, 2020
Febell pushed a commit to Febell/lombok that referenced this issue Mar 1, 2020
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