Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: code formatting

...

Code Block
bgColor#FFCCCC
@SuppressWarnings("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")
  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#ccccff
// ...
@SuppressWarnings("unchecked") 
T[] result =
 (T[]) Arrays.copyOf(elements, size, a.getClass());
return result;
// ...

...