### Eclipse Workspace Patch 1.0 #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.81 diff -u -r1.81 NullReferenceTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java 27 Aug 2009 15:26:58 -0000 1.81 +++ src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java 30 Oct 2009 09:44:52 -0000 @@ -10130,4 +10130,38 @@ "Potential null pointer access: The variable o1 may be null at this location\n" + "----------\n"); } +public void testBug291418() { + if (this.complianceLevel >= ClassFileConstants.JDK1_5) { + this.runConformTest( + new String[] { + "X.java", + "class X {\n" + + " void foo(int[] argArray) {\n" + + " int[] array = {2};\n" + + " int[] collectionVar = {1,2};\n" + + " if(argArray == null) return;" + + " for(int x:collectionVar) {\n" + + " if (collectionVar == null);\n" + // collectionVar cannot be null here + " if (array == null);\n" + //array is not null here + " if (argArray == null);\n" + //argArray cannot be null here + " }\n" + + " int count = 0;\n" + + " do {\n" + + " count++;\n" + + " if (array == null);\n" + //array is not null here + " if (argArray == null);\n" + //argArray cannot be null here + " } while (count<10);\n" + + " for (int i=0; i<2; i++) {\n" + + " if (array == null);\n" + //array is not null here + " if (argArray == null);\n" + //argArray cannot be null here + " }\n" + + " while (true) {\n" + + " if (array == null);\n" + //array is not null here + " if (argArray == null);\n" + //argArray cannot be null here + " }\n" + + " }\n" + + "}"}, + ""); + } +} } \ No newline at end of file