Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2011-06-18 17:18:08 +0000
committerStephan Herrmann2011-06-18 17:18:08 +0000
commitb8f5cfe6ee66c98e8c12661de8874e0c35b56b20 (patch)
tree09f99bd6c5c35f655131480d925b95f044698c8d /contrib/org.eclipse.objectteams.jdt.nullity.tests
parentf32820b5a778232cdb888217e8fa4cd2adf4fcfc (diff)
downloadorg.eclipse.objectteams-b8f5cfe6ee66c98e8c12661de8874e0c35b56b20.tar.gz
org.eclipse.objectteams-b8f5cfe6ee66c98e8c12661de8874e0c35b56b20.tar.xz
org.eclipse.objectteams-b8f5cfe6ee66c98e8c12661de8874e0c35b56b20.zip
Bugfix: arguments of a message send must be analyzed before checking against null contracts
Diffstat (limited to 'contrib/org.eclipse.objectteams.jdt.nullity.tests')
-rw-r--r--contrib/org.eclipse.objectteams.jdt.nullity.tests/src/org/eclipse/objectteams/jdt/nullity/tests/NullAnnotationTest.java24
1 files changed, 23 insertions, 1 deletions
diff --git a/contrib/org.eclipse.objectteams.jdt.nullity.tests/src/org/eclipse/objectteams/jdt/nullity/tests/NullAnnotationTest.java b/contrib/org.eclipse.objectteams.jdt.nullity.tests/src/org/eclipse/objectteams/jdt/nullity/tests/NullAnnotationTest.java
index 20f683718..0bbdce4e7 100644
--- a/contrib/org.eclipse.objectteams.jdt.nullity.tests/src/org/eclipse/objectteams/jdt/nullity/tests/NullAnnotationTest.java
+++ b/contrib/org.eclipse.objectteams.jdt.nullity.tests/src/org/eclipse/objectteams/jdt/nullity/tests/NullAnnotationTest.java
@@ -29,7 +29,7 @@ public NullAnnotationTest(String name) {
// Static initializer to specify tests subset using TESTS_* static variables
// All specified tests which do not belong to the class are skipped...
static {
-// TESTS_NAMES = new String[] { "test_default_nullness_003a" };
+// TESTS_NAMES = new String[] { "test_nonnull_parameter_006" };
// TESTS_NUMBERS = new int[] { 561 };
// TESTS_RANGE = new int[] { 1, 2049 };
}
@@ -234,6 +234,28 @@ public void test_nonnull_parameter_005() {
"",/* expected error */
JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
}
+// a ternary non-null expression is passed to a nonnull parameter
+public void test_nonnull_parameter_006() {
+ Map customOptions = getCompilerOptions();
+ customOptions.put(NullCompilerOptions.OPTION_ReportNullContractInsufficientInfo, CompilerOptions.ERROR);
+ runConformTest(
+ false /* flush output directory */,
+ new String[] {
+ "X.java",
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "public class X {\n" +
+ " void m1(@NonNull String a) {}\n" +
+ " void m2(@Nullable String b) {\n" +
+ " m1(b == null ? \"\" : b);\n" +
+ " }\n" +
+ "}\n"},
+ null /* no class libraries */,
+ customOptions,
+ "", /* compiler output */
+ "",/* expected output */
+ "",/* expected error */
+ JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
+}
// assigning potential null to a nonnull local variable
public void test_nonnull_local_001() {

Back to the top