Open mches opened 1 week ago
Many of these are covered in https://github.com/solven-eu/cleanthat/pull/848
static and final could be removed from a nested record
Done in #848. These are applied even if the record is not nested.
static could be removed from a nested enum
It is already covered. (right?)
static and abstract could be removed from a nested interface or annotation
I do not understand the case.
public enum Person {
public static class SomeClass {
}
}
does not compile.
static and abstract could be removed from a nested interface or annotation
I'm adding:
public record SomeRecord() {
public static abstract interface SomeClass {
}
public static abstract @interface SomeAnnotation {
}
}
I do not understand the case.
public enum Person { public static class SomeClass { } }
does not compile.
Try
public enum Person {
;
public static class SomeClass {}
}
static could be removed from a nested enum
It is already covered. (right?)
I don't think it was covered for a parent other than interface or annotation
I updated the description to cover class as a parent, in addition to enum and record.
Put another way
static
can be removed from an interface, annotation, enum, or record, regardless of parentabstract
can be removed from an interface or annotation, regardless of parentfinal
can be removed from a record, regardless of parentI don't think it was covered for a parent other than interface or annotation
I indeed reworked UnnecessaryModifier
to handle various cases where the grandParentNode is irrelevant (e.g. an enum
is always static
).
static can be removed from an interface, annotation, enum, or record, regardless of parent
The reworked implementation indeed follows this wording.
static can be removed from an interface, annotation, enum, or record, regardless of parent
Done
abstract can be removed from an interface or annotation, regardless of parent
Done
final can be removed from a record, regardless of parent
Done
I had a chance to review. Looks both thorough and simplified. I expanded your new test case in PR #850, and identified one more opportunity to remove the redundant final
keyword from private methods.
To my knowledge, these cases are not covered
public
,static
, andfinal
could be removed from a nested recordstatic
andabstract
could be removed from a nested interface or annotationstatic
could be removed from a nested enumstatic
andfinal
could be removed from a nested recordfinal
could be removed from a private method