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

False positive for InterfaceWithOnlyStatics with sealed interface / nested record subclasses #3389

Open
kdblocher opened this issue Aug 12, 2022 · 0 comments

Comments

@kdblocher
Copy link

The following code leveraging the sealed interface + record pattern (to make sum types) should not violate the InterfaceWithOnlyStatics rule as the interface is sealed:

public sealed interface Sum {
  record A() implements Sum { }
  record B() implements Sum { }
  // ...anything else
}

Note that permits is not needed if all implementers are nested types. (The second record is not necessary, but illustrates the point.)

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

1 participant