Redundant exemptions
| Diagnostic | REDUNDANT_EXEMPTION |
| Default severity | Warning (not configurable) |
| Gradle property | none |
| Exemption | none |
What it reports
An @Intentionally* exemption that doesn't exempt anything on the element.
@IntentionallyDataClass(reason = ExemptionReason.API_DESIGN)public class Connection
Notes
-
The report tags the annotation as Redundant.
-
A check set to
NONEdoesn't report anything, so its exemptions are redundant.exemptExistingApiremoves them. To keep them, turn the check on before you run the task. -
In a multiplatform project, an exemption on an
expectdeclaration is redundant when neither theexpectdeclaration nor anactualdeclaration needs it. The compilation that reports it depends on the check:- A check that reports
expectdeclarations, such as Undocumented public API or Boolean parameters in public API, decides from theexpectdeclaration. Every compilation and the IDE report the exemption. - A check that reports
actualdeclarations, such as Data classes in public API or Mangled JVM names in public API, needs them. A platform compilation reports the exemption when its ownactualdeclaration doesn't need it. The common compilation and the IDE don't seeactualdeclarations, so they don't report it.
The copy of the exemption on an
actualdeclaration isn't reported while theexpectdeclaration has the exemption. After you remove the exemption from theexpectdeclaration, the copy is an exemption of theactualdeclaration alone and gets its own verdict.exemptExistingApiremoves the copies with the exemption on theexpectdeclaration. See Exemptions in a multiplatform project for more details about the copies. - A check that reports
-
An annotation ignore rule doesn't make an exemption redundant.
-
exemptExistingApiremoves a redundant exemption, and the import of the annotation when the file doesn't have another use of it.