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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java (-1 / +34 lines)
Lines 91-97 Link Here
91
	// All specified tests which do not belong to the class are skipped...
91
	// All specified tests which do not belong to the class are skipped...
92
	static {
92
	static {
93
//		TESTS_PREFIX =  "testBug86380";
93
//		TESTS_PREFIX =  "testBug86380";
94
//		TESTS_NAMES = new String[] { "test070" };
94
		TESTS_NAMES = new String[] { "test071" };
95
//		TESTS_NUMBERS = new int[] { 83230 };
95
//		TESTS_NUMBERS = new int[] { 83230 };
96
//		TESTS_RANGE = new int[] { 83304, -1 };
96
//		TESTS_RANGE = new int[] { 83304, -1 };
97
		}
97
		}
Lines 1595-1598 Link Here
1595
		// ensure that the fields for Y are not resolved
1595
		// ensure that the fields for Y are not resolved
1596
		assertBindingsEqual("", yBinding.getDeclaredFields());
1596
		assertBindingsEqual("", yBinding.getDeclaredFields());
1597
	}
1597
	}
1598
1599
	/*
1600
	 * Ensures that unrequested compilation units are not resolved
1601
	 * (regression test for bug 117018 IVariableBinding#getConstantValue() could be lazy resolved)
1602
	 */
1603
	public void test071() throws CoreException {
1604
		final MarkerInfo[] markerInfos = createMarkerInfos(new String[] {
1605
			"/P/p1/X.java",
1606
			"package p1;\n" +
1607
			"public class X extends /*start*/Y/*end*/ {\n" +
1608
			"}",
1609
			"/P/p1/Y.java",
1610
			"package p1;\n" +
1611
			"public class Y {\n" +
1612
			"  static final int CONST = 2 + 3;\n" +
1613
			"}",
1614
		});
1615
		this.workingCopies = createWorkingCopies(markerInfos, this.owner);
1616
		class Requestor extends TestASTRequestor {
1617
			Object constantValue = null;
1618
			public void acceptAST(ICompilationUnit source, CompilationUnit ast) {
1619
				super.acceptAST(source, ast);
1620
				Type y = (Type) findNode(ast, markerInfos[0]);
1621
				ITypeBinding typeBinding = y.resolveBinding();
1622
				IVariableBinding fieldBinding = typeBinding.getDeclaredFields()[0];
1623
				this.constantValue = fieldBinding.getConstantValue();
1624
			}
1625
		}
1626
		Requestor requestor = new Requestor();
1627
		resolveASTs(new ICompilationUnit[] {this.workingCopies[0]}, requestor);
1628
		
1629
		assertEquals("Unexpected constant value", new Integer(5), requestor.constantValue);
1630
	}
1598
}
1631
}

Return to bug 117018