View | Details | Raw Unified | Return to bug 291418 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java (+34 lines)
Lines 10130-10133 Link Here
10130
		"Potential null pointer access: The variable o1 may be null at this location\n" +
10130
		"Potential null pointer access: The variable o1 may be null at this location\n" +
10131
		"----------\n");
10131
		"----------\n");
10132
}
10132
}
10133
public void testBug291418() {
10134
	if (this.complianceLevel >= ClassFileConstants.JDK1_5) {
10135
		this.runConformTest(
10136
				new String[] {
10137
						"X.java",
10138
						"class X {\n" +
10139
						"  void foo(int[] argArray) {\n" +
10140
						"    int[] array = {2};\n" +
10141
						"    int[] collectionVar = {1,2};\n" +
10142
						"	 if(argArray == null) return;" +
10143
						"    for(int x:collectionVar) {\n" +
10144
						"        if (collectionVar == null);\n" +	// collectionVar cannot be null here
10145
						"        if (array == null);\n" +				//array is not null here
10146
						"		 if (argArray == null);\n" +		//argArray cannot be null here
10147
						"    }\n" +
10148
						"	 int count = 0;\n" +
10149
						"    do {\n" +
10150
						"		 count++;\n" +
10151
						"        if (array == null);\n" +				//array is not null here
10152
						"		 if (argArray == null);\n" +		//argArray cannot be null here
10153
						"    } while (count<10);\n" +
10154
						"    for (int i=0; i<2; i++) {\n" +
10155
						"        if (array == null);\n" +				//array is not null here
10156
						"		 if (argArray == null);\n" +		//argArray cannot be null here
10157
						"    }\n" +
10158
						"    while (true) {\n" +
10159
						"        if (array == null);\n" +				//array is not null here
10160
						"		 if (argArray == null);\n" +		//argArray cannot be null here
10161
						"    }\n" +
10162
						"  }\n" +
10163
				"}"},
10164
			"");
10165
	}
10166
}
10133
}
10167
}

Return to bug 291418