error-prone icon indicating copy to clipboard operation
error-prone copied to clipboard

False positive for `InterfaceWithOnlyStatics` with sealed interface / nested record subclasses

Open kdblocher opened this issue 3 years ago • 0 comments

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.)

kdblocher avatar Aug 12 '22 17:08 kdblocher