Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The compiler issues unchecked warnings when it detects potential type safety issues arising from mixing raw types with generic code. This includes unchecked cast warnings, unchecked method invocation warnings, unchecked generic array creation warnings, and unchecked conversion warnings [java:Bloch 2008]. It is permissible to use the @SuppressWarnings("unchecked") annotation to suppress unchecked warnings when, and only when, the warning emitting code is guaranteed to be typesafe. A common usecase is mixing legacy code with new client code. The perils of ignoring unchecked warnings are discussed extensively in rule OBJ03-J. Do not mix generic with non-generic nongeneric raw types in new code.

According to the Java API [java:API 2006], Annotation Type SuppressWarnings documentation

...