1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
// Test case for Issue 1522
// https://github.com/typetools/checker-framework/issues/1522
import java.util.Vector;
import org.checkerframework.checker.nullness.qual.Nullable;
class Issue1522 {
void copyInto(String p) {}
void bar() {
copyInto("Hi");
}
void copyVector(Vector<String> v, Integer[] intArray, String[] stringArray) {
// Java types aren't compatible
// :: error: (vector.copyinto.type.incompatible)
v.copyInto(intArray);
v.copyInto(stringArray);
}
void copyStack(SubClassVector<String> v, Integer[] intArray, String[] stringArray) {
// Java types aren't compatible
// :: error: (vector.copyinto.type.incompatible)
v.copyInto(intArray);
v.copyInto(stringArray);
}
void copyVectorErrors(Vector<@Nullable String> v, String[] stringArray) {
// :: error: (vector.copyinto.type.incompatible)
v.copyInto(stringArray);
}
void copyStackErrors(SubClassVector<@Nullable String> v, String[] stringArray) {
// :: error: (vector.copyinto.type.incompatible)
v.copyInto(stringArray);
}
void copyVectorNullable(Vector<@Nullable String> v, @Nullable String[] stringArray) {
v.copyInto(stringArray);
}
void copyStackNullable(SubClassVector<@Nullable String> v, @Nullable String[] stringArray) {
v.copyInto(stringArray);
}
static class SubClassVector<T> extends Vector<T> {
@Override
public synchronized void copyInto(@Nullable Object[] anArray) {
super.copyInto(anArray);
}
}
}
|