Link Details

Link 90895 thumbnail
User 214988 avatar

By puredanger
via tech.puredanger.com
Published: Jun 28 2008 / 19:15

One of the built-in annotations in Java 5 is SuppressWarnings. You can use this annotation on all the available annotation levels (class, field, method, constructor, local variable, etc) to suppress warnings that might be generated by a compiler.
  • 8
  • 0
  • 2393
  • 334

Comments

Add your comment
User 281050 avatar

cbang replied ago:

0 votes Vote down Vote up Reply

Was confused a while ago, going from compiler to compiler, so did some digging on my own as well:
http://coffeecokeandcode.blogspot.com/2008/05/suppresswarnings-annotations.html

When do we get SuppressError? Would be very handy when not catching a checked exception or when you comment out a line of code which throws an exception, and now you also have to comment out all the catch code in order to satisfy the compiler. Stupid javac, should've been an unreachable code warning instead.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (8)



Voters Against This Link (0)