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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
// This uses all the aliases listed in section "Other tools for nullness
// checking" of the Checker Framework manual.
public class AliasedAnnotations {
void useNonNullAnnotations() {
// :: error: (assignment.type.incompatible)
@org.checkerframework.checker.nullness.qual.NonNull Object nn1 = null;
// :: error: (assignment.type.incompatible)
@com.sun.istack.internal.NotNull Object nn2 = null;
// :: error: (assignment.type.incompatible)
@edu.umd.cs.findbugs.annotations.NonNull Object nn3 = null;
// :: error: (assignment.type.incompatible)
@javax.annotation.Nonnull Object nn4 = null;
// Invalid location for NonNull :: error: (assignment.type.incompatible)
// @javax.validation.constraints.NotNull Object nn5 = null;
// :: error: (assignment.type.incompatible)
@org.eclipse.jdt.annotation.NonNull Object nn6 = null;
// :: error: (assignment.type.incompatible)
@org.jetbrains.annotations.NotNull Object nn7 = null;
// :: error: (assignment.type.incompatible)
@org.netbeans.api.annotations.common.NonNull Object nn8 = null;
// :: error: (assignment.type.incompatible)
@org.jmlspecs.annotation.NonNull Object nn9 = null;
}
void useNullableAnnotations1(@org.checkerframework.checker.nullness.qual.Nullable Object nble) {
// :: error: (dereference.of.nullable)
nble.toString();
}
void useNullableAnnotations2(@com.sun.istack.internal.Nullable Object nble) {
// :: error: (dereference.of.nullable)
nble.toString();
}
void useNullableAnnotations3(@edu.umd.cs.findbugs.annotations.Nullable Object nble) {
// :: error: (dereference.of.nullable)
nble.toString();
}
void useNullableAnnotations4(@edu.umd.cs.findbugs.annotations.CheckForNull Object nble) {
// :: error: (dereference.of.nullable)
nble.toString();
}
void useNullableAnnotations5(@edu.umd.cs.findbugs.annotations.UnknownNullness Object nble) {
// :: error: (dereference.of.nullable)
nble.toString();
}
void useNullableAnnotations6(@javax.annotation.Nullable Object nble) {
// :: error: (dereference.of.nullable)
nble.toString();
}
void useNullableAnnotations7(@javax.annotation.CheckForNull Object nble) {
// :: error: (dereference.of.nullable)
nble.toString();
}
void useNullableAnnotations9(@org.eclipse.jdt.annotation.Nullable Object nble) {
// :: error: (dereference.of.nullable)
nble.toString();
}
void useNullableAnnotations10(@org.jetbrains.annotations.Nullable Object nble) {
// :: error: (dereference.of.nullable)
nble.toString();
}
void useNullableAnnotations12(@org.netbeans.api.annotations.common.NullAllowed Object nble) {
// :: error: (dereference.of.nullable)
nble.toString();
}
void useNullableAnnotations13(@org.netbeans.api.annotations.common.NullUnknown Object nble) {
// :: error: (dereference.of.nullable)
nble.toString();
}
void useNullableAnnotations14(@org.jmlspecs.annotation.Nullable Object nble) {
// :: error: (dereference.of.nullable)
nble.toString();
}
}
|