Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Edited by sciSpider Java v3.0

...

This noncompliant example is from the implementation of java.util.ArrayList. When the class is compiled, it emits an unchecked cast warning, as shown. Since the return statement is not a declaration, the Java Language Specification [JLS 05] makes it impossible to suppress the warning trivially. ThereforeConsequently, the @SuppressWarnings has been used over method scope. This is can cause issues when some functionality that performs type-unsafe operations is added to the method at a later date. [Bloch 08]

...