Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 247564 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java (-1 / +39 lines)
Lines 49-55 public NullReferenceTest(String name) { Link Here
49
// Only the highest compliance level is run; add the VM argument
49
// Only the highest compliance level is run; add the VM argument
50
// -Dcompliance=1.4 (for example) to lower it if needed
50
// -Dcompliance=1.4 (for example) to lower it if needed
51
static {
51
static {
52
//		TESTS_NAMES = new String[] { "testBug247564i" };
52
//		TESTS_NAMES = new String[] { "testBug247564j" };
53
//		TESTS_NUMBERS = new int[] { 561 };
53
//		TESTS_NUMBERS = new int[] { 561 };
54
//		TESTS_RANGE = new int[] { 1, 2049 };
54
//		TESTS_RANGE = new int[] { 1, 2049 };
55
}
55
}
Lines 16373-16376 public void testBug247564i_5() { Link Here
16373
		JavacTestOptions.Excuse.EclipseWarningConfiguredAsError
16373
		JavacTestOptions.Excuse.EclipseWarningConfiguredAsError
16374
	);
16374
	);
16375
}
16375
}
16376
// null analysis -- simple case for field for inner class
16377
// regression?
16378
public void testBug247564j() {
16379
	this.runNegativeTest(
16380
		new String[] {
16381
			"Z.java",
16382
			"public class Z {\n" +
16383
			"    final int field1 = 0;\n" +
16384
			"    {\n" +
16385
			"        class ZInner {\n" +
16386
			"            final int fieldz1;\n" +
16387
			"            final int fieldz2 = 0;\n" +
16388
			"        }\n" +
16389
			"    }\n" +
16390
			"}\n"},
16391
			"----------\n" +
16392
			"1. WARNING in Z.java (at line 4)\n" +
16393
			"	class ZInner {\n" +
16394
			"	      ^^^^^^\n" +
16395
			"The type ZInner is never used locally\n" +
16396
			"----------\n" +
16397
			"2. ERROR in Z.java (at line 4)\n" +
16398
			"	class ZInner {\n" +
16399
			"	      ^^^^^^\n" +
16400
			"The blank final field fieldz1 may not have been initialized\n" +
16401
			"----------\n" +
16402
			"3. WARNING in Z.java (at line 5)\n" +
16403
			"	final int fieldz1;\n" +
16404
			"	          ^^^^^^^\n" +
16405
			"The value of the field ZInner.fieldz1 is not used\n" +
16406
			"----------\n" +
16407
			"4. WARNING in Z.java (at line 6)\n" +
16408
			"	final int fieldz2 = 0;\n" +
16409
			"	          ^^^^^^^\n" +
16410
			"The value of the field ZInner.fieldz2 is not used\n" +
16411
			"----------\n"
16412
	);
16413
}
16376
}
16414
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java (-2 / +2 lines)
Lines 1085-1090 public void resolve() { Link Here
1085
		superFieldsCount += findFieldCountFromSuperInterfaces(superInterfacesBinding);
1085
		superFieldsCount += findFieldCountFromSuperInterfaces(superInterfacesBinding);
1086
		this.binding.cumulativeFieldCount += superFieldsCount;
1086
		this.binding.cumulativeFieldCount += superFieldsCount;
1087
1087
1088
		this.maxFieldCount = sourceType.cumulativeFieldCount;
1088
		if (this.fields != null) {
1089
		if (this.fields != null) {
1089
			for (int i = 0, count = this.fields.length; i < count; i++) {
1090
			for (int i = 0, count = this.fields.length; i < count; i++) {
1090
				FieldDeclaration field = this.fields[i];
1091
				FieldDeclaration field = this.fields[i];
Lines 1120-1127 public void resolve() { Link Here
1120
				}
1121
				}
1121
				field.resolve(field.isStatic() ? this.staticInitializerScope : this.initializerScope);
1122
				field.resolve(field.isStatic() ? this.staticInitializerScope : this.initializerScope);
1122
			}
1123
			}
1123
		}		
1124
		}
1124
		this.maxFieldCount = sourceType.cumulativeFieldCount;
1125
		if (this.memberTypes != null) {
1125
		if (this.memberTypes != null) {
1126
			for (int i = 0, count = this.memberTypes.length; i < count; i++) {
1126
			for (int i = 0, count = this.memberTypes.length; i < count; i++) {
1127
				this.memberTypes[i].resolve(this.scope);
1127
				this.memberTypes[i].resolve(this.scope);

Return to bug 247564