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