Advice on UnnecessaryAbstractClass when used to prevent instantiation #5382
-
Consider this hierarchy: classDiagram
BaseNode <|-- Historical
BaseNode <|-- User
Historical <|-- Film
Historical <|-- Cinema
BaseNode: +Long graphId
User: +String email
Historical: OffsetDateTime created
Historical: OffsetDateTime modified
Historical: OffsetDateTime deleted
class Cinema {
+String name
}
class Film {
+String name
+LocalDate released
}
In this case I would make Now, Detekt flags this:
What is the recommended course of action in this case? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I would vote for a sealed class or an interface in this case. But this could be a good case for a |
Beta Was this translation helpful? Give feedback.
I would vote for a sealed class or an interface in this case. But this could be a good case for a
Suppress
. That class could be a concrete one but you prefer it to be abstract.