error-prone
error-prone copied to clipboard
False positive for `InterfaceWithOnlyStatics` with sealed interface / nested record subclasses
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.)