diff options
author | mdaniel | 2007-02-26 08:49:00 +0000 |
---|---|---|
committer | mdaniel | 2007-02-26 08:49:00 +0000 |
commit | e702e6a53e23b4f475e9578e987e56b628fcf8d7 (patch) | |
tree | 56597ff2138dab4c543df8faa8994e4aec401438 /org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java | |
parent | 5d2e6e466ee272d62f273fff98dd2423f77bd2f3 (diff) | |
download | eclipse.jdt.core-e702e6a53e23b4f475e9578e987e56b628fcf8d7.tar.gz eclipse.jdt.core-e702e6a53e23b4f475e9578e987e56b628fcf8d7.tar.xz eclipse.jdt.core-e702e6a53e23b4f475e9578e987e56b628fcf8d7.zip |
HEAD - 170704
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java')
-rw-r--r-- | org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java | 88 |
1 files changed, 86 insertions, 2 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java index 92e715e7c3..8f9907a04f 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java @@ -1116,7 +1116,8 @@ public void test012b(){ " maskedCatchBlock + hidden catch block\n" + " nls string literal lacking non-nls tag //$NON-NLS-<n>$\n" + " noEffectAssign + assignment without effect\n" + - " null missing or redundant null check\n" + + " null potential missing or redundant null check\n" + + " nullDereference missing null check\n" + " over-ann missing @Override annotation\n" + " paramAssign assignment to a parameter\n" + " pkgDefaultMethod + attempt to override package-default method\n" + @@ -1262,7 +1263,9 @@ public void test012b(){ " <option key=\"org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod\" value=\"warning\"/>\n" + " <option key=\"org.eclipse.jdt.core.compiler.problem.parameterAssignment\" value=\"ignore\"/>\n" + " <option key=\"org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment\" value=\"ignore\"/>\n" + - " <option key=\"org.eclipse.jdt.core.compiler.problem.rawTypeReference\" value=\"warning\"/>\n" + + " <option key=\"org.eclipse.jdt.core.compiler.problem.potentialNullReference\" value=\"ignore\"/>\n" + + " <option key=\"org.eclipse.jdt.core.compiler.problem.rawTypeReference\" value=\"warning\"/>\n" + + " <option key=\"org.eclipse.jdt.core.compiler.problem.redundantNullCheck\" value=\"ignore\"/>\n" + " <option key=\"org.eclipse.jdt.core.compiler.problem.specialParameterHidingField\" value=\"disabled\"/>\n" + " <option key=\"org.eclipse.jdt.core.compiler.problem.staticAccessReceiver\" value=\"warning\"/>\n" + " <option key=\"org.eclipse.jdt.core.compiler.problem.suppressWarnings\" value=\"enabled\"/>\n" + @@ -5186,6 +5189,87 @@ public void test140_classpath() { }, null); } +// null ref option +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=170704 +// adding distinct options to control null checks in more detail +public void test141_null_ref_option(){ + this.runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " void foo() {\n" + + " Object o = null;\n" + + " o.toString();\n" + + " }\n" + + "}"}, + "\"" + OUTPUT_DIR + File.separator + "X.java\"" + + " -1.5 -g -preserveAllLocals" + + " -bootclasspath " + getLibraryClasses() + + " -cp " + getJCEJar() + + " -warn:+nullDereference" + + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"", + "", + "----------\n" + + "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" + + " o.toString();\n" + + " ^\n" + + "The variable o can only be null; it was either set to null or checked for null when last used\n" + + "----------\n" + + "1 problem (1 warning)", + true); +} +// null ref option +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=170704 +// adding distinct options to control null checks in more detail +public void test142_null_ref_option(){ + this.runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " void foo() {\n" + + " Object o = null;\n" + + " if (o == null) {}\n" + + " }\n" + + "}"}, + "\"" + OUTPUT_DIR + File.separator + "X.java\"" + + " -1.5 -g -preserveAllLocals" + + " -bootclasspath " + getLibraryClasses() + + " -cp " + getJCEJar() + + " -warn:+null" + + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"", + "", + "----------\n" + + "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" + + " if (o == null) {}\n" + + " ^\n" + + "The variable o can only be null; it was either set to null or checked for null when last used\n" + + "----------\n" + + "1 problem (1 warning)", + true); +} +// null ref option +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=170704 +// adding distinct options to control null checks in more detail +public void test143_null_ref_option(){ + this.runConformTest( + new String[] { + "X.java", + "public class X {\n" + + " void foo() {\n" + + " Object o = null;\n" + + " if (o == null) {}\n" + + " }\n" + + "}"}, +"\"" + OUTPUT_DIR + File.separator + "X.java\"" ++ " -1.5 -g -preserveAllLocals" ++ " -bootclasspath " + getLibraryClasses() ++ " -cp " + getJCEJar() ++ " -warn:+nullDereference" ++ " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"", +"", +"", +true); +} public static Class testClass() { return BatchCompilerTest.class; } |