There are lots of unnecessary @SuppressWarnings
such as @SuppressWarnings("unchecked")
.
We need to cleanup the codebase before adding rule, I will try If the team think it's worthy.
Comment From: Shubham-Xperi
Hi Team, I am a beginner and I would like to work on this.
Comment From: snicoll
@Shubham-Xperi thanks very much for the offer but the team hasn't triaged this issue yet. @quaff created it to get more feedback from the team and work on it if it is accepted.
Comment From: sbrannen
Thanks for the suggestion, @quaff.
Unfortunately, it's not feasible to prevent unnecessary usage of @SuppressWarnings
, since it's basically impossible to reliably know what is necessary in all possible contexts.
For example, some usage is necessary for one version of the JDK but not the previous or next, and we compile against multiple versions of the JDK.
Similarly, some usage is necessary with a particular compiler/IDE but not with a different compiler/IDE.
In other words, although we could probably reliably achieve the proposed goal using a specific JDK 17 implementation (for example, Liberica) within the Gradle build, the same code may no longer compile without warnings (which might result in build errors) against a different version of the JDK, a different JDK distribution, or within an IDE.
The best we can do is allow the use of @SuppressWarnings
with any kind of value (for example, some only supported in IDEA) and then ignore "unknown suppressed warnings values" in our IDEs. And that's actually what we already do.
In light of that, I am closing this issue.