Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Edited by NavBot

...

Code Block
bgColor#FFCCCC
@SuppressWarnings("unchecked""unchecked") class Legacy {
  Set s = new HashSet();
  public final void doLogic(int a,char c) {
    s.add(a);
    s.add(c); // Type unsafe operation, ignored
  }
}

...

Code Block
bgColor#ccccff
class Legacy {
  @SuppressWarnings("unchecked""unchecked")  Set s = new HashSet();
  public final void doLogic(int a,char c) {
    s.add(a); // Produces unchecked warning
    s.add(c); // Produces unchecked warning
  }
}

...

Code Block
bgColor#FFCCCC
@SuppressWarnings("unchecked""unchecked")
public &lt;T&gt;<T> T[] toArray(T[] a) {
  if (a.length &lt;< size)
    return (T[]) Arrays.copyOf(elements, size, a.getClass()); // Produces unchecked warning
 // ...
}

...

Code Block
bgColor#ccccff
// ...
@SuppressWarnings(&quot;unchecked&quot;"unchecked") T[] result =
(T[]) Arrays.copyOf(elements, size, a.getClass());
return result;
// ...

...

SCP03-J. Do not reuse names&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      05. Scope (SCP)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      06. Integers (INT)