Suppressing compiler warnings

Gosu provides limited support for the Java annotation, @SuppressWarnings. As its namesake indicates, the @SuppressWarnings annotation informs a compiler to suppress warnings.

You can use the @SuppressWarnings annotation in several kinds of declarations. Such declarations exclude declarations of local variables. Instead, the @SuppressWarnings annotation can apply to declarations of the following categories:
  • Type
  • Function
  • Property
  • Constructor
  • Field
  • Parameter

The @SuppressWarnings annotation requires one parameter. This parameter is a String value that indicates the warnings you wish to suppress.

For example, suppose you pass in the argument "all" into the @SuppressWarnings annotation. The annotation invocation in this case would be @SuppressWarnings("all"). The effect of the annotation would be to suppress all warnings.

For another example, suppose instead that you pass in the argument "deprecation" into the @SuppressWarnings annotation. Suppose further that you invoke the annotation on the line prior to a Gosu class declaration. The invocation in this case would be @SuppressWarnings("deprecation"). The effect of this annotation is to suppress all deprecation warnings for the Gosu class you have declared.