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
|
import java.util.LinkedList;
import java.util.List;
import org.checkerframework.checker.nullness.qual.*;
/**
* This class is based on NullnessExample. This version contains additional tests to ensure that a
* build works correctly.
*/
public class NullnessReleaseTests {
public void example() {
@NonNull String foo = "foo";
@NonNull String bar = "bar";
foo = bar;
bar = foo;
}
public @NonNull String exampleGenerics() {
List<@NonNull String> foo = new LinkedList<@NonNull String>();
List<@NonNull String> bar = foo;
@NonNull String quux = "quux";
foo.add(quux);
foo.add("quux");
@NonNull String baz = foo.get(0);
return baz;
}
// For some reason this class causes an exception if the Checker
// Framework is compiled with JDK 7 and then executed on JDK 6.
class TestException extends Exception {}
}
|