Reputation: 11113
Java Annotation Processors can be used to issue info, warnings, or errors in Java code triggered by a variety of cases. Is there a way to suppress the info/warnings generically without directly implementing them in the Annotation Processor? Directly, what comes to mind is the @SupressWarnings
annotation, but that doesn't seem to map to annotation processors as they require a name of what to suppress.
As a follow on question, would it be inappropriate to use the @SuppressWarnings
annotation within an annotation processor to turn off info/warnings?
Upvotes: 1
Views: 1503
Reputation: 29959
The -Xlint compiler option can be used to disable warnings. You should be able to suppress annotation processor warnings with the option -Xlint:-processing
.
There are many other types of warning that you can enable or disable separately this way without annotations.
The best way of course would be to avoid warnings at all, by fixing the code. Only add @SuppressWarnings
when it is appropriate, like for example you know that an unchecked cast can't fail.
Upvotes: 2