### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: model/org/eclipse/jdt/core/JavaCore.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java,v retrieving revision 1.586 diff -u -r1.586 JavaCore.java --- model/org/eclipse/jdt/core/JavaCore.java 11 Oct 2007 11:32:48 -0000 1.586 +++ model/org/eclipse/jdt/core/JavaCore.java 12 Oct 2007 14:07:08 -0000 @@ -2338,7 +2338,7 @@ * * - option id: "org.eclipse.jdt.core.compiler.problem.potentialNullReference" * - possible values: { "error", "warning", "ignore" } - * - default: "ignore" + * - default: "warning" * * COMPILER / Reporting Redundant Null Check * When enabled, the compiler will issue an error or a warning whenever a Index: compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java,v retrieving revision 1.187 diff -u -r1.187 CompilerOptions.java --- compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 4 Oct 2007 13:01:36 -0000 1.187 +++ compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 12 Oct 2007 14:07:06 -0000 @@ -239,7 +239,7 @@ | UnusedLocalVariable | UnusedPrivateMember | UnusedLabel - /*| NullReference -- keep JavaCore#getDefaultOptions comment in sync */; + | NullReference; // By default only lines and source attributes are generated. public int produceDebugAttributes = ClassFileConstants.ATTR_SOURCE | ClassFileConstants.ATTR_LINES; #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java,v retrieving revision 1.71 diff -u -r1.71 NullReferenceTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java 12 Sep 2007 07:14:28 -0000 1.71 +++ src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java 12 Oct 2007 14:07:14 -0000 @@ -11,6 +11,7 @@ package org.eclipse.jdt.core.tests.compiler.regression; import java.util.Map; + import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import junit.framework.Test; @@ -75,7 +76,7 @@ "Null pointer access: The variable o can only be null at this location\n" + "----------\n"); } - + // null analysis -- simple case for field // the current design leaves fields out of the analysis altogether public void test0002_simple_field() { @@ -8625,10 +8626,12 @@ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=170704 // adding distinct options to control null checks in more detail // default for null options is Ignore +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=192875 +// changed default for null access to warning public void test1050_options_all_default() { try { setNullRelatedOptions = false; - this.runConformTest( + runTest( new String[] { "X.java", "public class X {\n" + @@ -8641,7 +8644,23 @@ " o.toString();\n" + " p.toString();\n" + " }\n" + - "}\n"}); + "}\n" + } /* testFiles */, + false /* expectingCompilerErrors */, + "----------\n" + + "1. WARNING in X.java (at line 8)\n" + + " o.toString();\n" + + " ^\n" + + "Null pointer access: The variable o can only be null at this location\n" + + "----------\n" /* expectedCompilerLog */, + "" /* expectedOutputString */, + false /* forceExecution */, + null /* classLib */, + true /* shouldFlushOutputDirectory */, + null /* vmArguments */, + null /* customOptions */, + null /* clientRequestor */, + false /* skipJavac */); } finally { setNullRelatedOptions = true;