RFR: 8343467: Remove unnecessary @SuppressWarnings annotations (security) [v3]

Archie Cobbs acobbs at openjdk.org
Tue Nov 5 16:45:33 UTC 2024


On Tue, 5 Nov 2024 15:53:03 GMT, Sean Mullan <mullan at openjdk.org> wrote:

> Can we find this out? It would be really useful to explain why the warnings are no longer an issue.

I haven't checked exhaustively, but all of the ones I've checked appear to be due to either (a) the warning was never needed, or (b) a subsequent refinement of the warning itself which made the code no longer qualify as "warnable".

For an example of (a) see commit 8fb70c710afa which added `@SuppressWarnings("unchecked")` for a cast to type `Key`, even though `Key` is not a generic type and so the cast was never unchecked in the first place.

For an example of (b), see commit b431c6929d12 which added `@SuppressWarnings("serial")` because an anonymous class did not declare `serialVersionUID`, but then later the warning was was changed to no longer trigger in that situation by [JDK-7152104](https://bugs.openjdk.org/browse/JDK-7152104), but the annotation was not removed as part of that commit.

I guess the only other possibility is that the warning stopped working at some point due to a bug, but I haven't seen any examples of that.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/21844#issuecomment-2457672108


More information about the security-dev mailing list