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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java (-1 / +4 lines)
Lines 1258-1264 Link Here
1258
				}
1258
				}
1259
			} 
1259
			} 
1260
			: null;
1260
			: null;
1261
		ICompilationUnit workingCopy = getCompilationUnit(path).getWorkingCopy(new WorkingCopyOwner() {}, problemRequestor, null/*no progress monitor*/);
1261
		return getWorkingCopy(path, source, new WorkingCopyOwner() {}, problemRequestor);
1262
	}
1263
	public ICompilationUnit getWorkingCopy(String path, String source, WorkingCopyOwner owner, IProblemRequestor problemRequestor) throws JavaModelException {
1264
		ICompilationUnit workingCopy = getCompilationUnit(path).getWorkingCopy(owner, problemRequestor, null/*no progress monitor*/);
1262
		workingCopy.getBuffer().setContents(source);
1265
		workingCopy.getBuffer().setContents(source);
1263
		workingCopy.makeConsistent(null/*no progress monitor*/);
1266
		workingCopy.makeConsistent(null/*no progress monitor*/);
1264
		return workingCopy;
1267
		return workingCopy;
(-)src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java (-7 / +48 lines)
Lines 1521-1526 Link Here
1521
	assertEquals("We should have one comment!", 1, testCU.getCommentList().size());
1521
	assertEquals("We should have one comment!", 1, testCU.getCommentList().size());
1522
}
1522
}
1523
/*
1523
/*
1524
 * Ensures that a method that has a type parameter with bound can be overriden in another working copy.
1525
 * (regression test for bug 76780 [model] return type not recognized correctly on some generic methods)
1526
 */
1527
public void testTypeParameterWithBound() throws CoreException {
1528
	this.workingCopy.discardWorkingCopy(); // don't use the one created in setUp()
1529
	this.workingCopy = null;
1530
	WorkingCopyOwner owner = new WorkingCopyOwner() {};
1531
	ICompilationUnit workingCopy1 = null;
1532
	try {
1533
		workingCopy1 = getWorkingCopy(
1534
			"/Reconciler15/src/test/I.java",
1535
			"package test;\n"+
1536
			"public interface I {\n"+
1537
			"	<T extends I> void foo(T t);\n"+
1538
			"}\n",
1539
			owner,
1540
			null /*no problem requestor*/
1541
		);
1542
		
1543
		this.problemRequestor =  new ProblemRequestor();
1544
		this.workingCopy = getWorkingCopy("Reconciler15/src/test/X.java", "", owner, this.problemRequestor);
1545
		setWorkingCopyContents(
1546
			"package test;\n"+
1547
			"public class X implements I {\n"+
1548
			"	public <T extends I> void foo(T t) {\n"+
1549
			"	}\n"+
1550
			"}\n"
1551
		);
1552
		this.workingCopy.reconcile(ICompilationUnit.NO_AST, false, owner, null);
1553
1554
		assertProblems(
1555
			"Unexpected problems",
1556
			"----------\n" + 
1557
			"----------\n"
1558
		);
1559
	} finally {
1560
		if (workingCopy1 != null) {
1561
			workingCopy1.discardWorkingCopy();
1562
		}
1563
	}
1564
}
1565
/*
1524
 * Ensures that a varargs method can be referenced from another working copy.
1566
 * Ensures that a varargs method can be referenced from another working copy.
1525
 */
1567
 */
1526
public void testVarargs() throws CoreException {
1568
public void testVarargs() throws CoreException {
Lines 1529-1546 Link Here
1529
	WorkingCopyOwner owner = new WorkingCopyOwner() {};
1571
	WorkingCopyOwner owner = new WorkingCopyOwner() {};
1530
	ICompilationUnit workingCopy1 = null;
1572
	ICompilationUnit workingCopy1 = null;
1531
	try {
1573
	try {
1532
		workingCopy1 = getCompilationUnit("/Reconciler15/src/test/X.java").getWorkingCopy(owner, null, null);
1574
		workingCopy1 = getWorkingCopy(
1533
		createFolder("/Reconciler15/src/test");
1575
			"/Reconciler15/src/test/X.java",
1534
		workingCopy1.getBuffer().setContents(
1535
			"package test;\n"+
1576
			"package test;\n"+
1536
			"public class X {\n"+
1577
			"public class X {\n"+
1537
			"	void bar(String ... args) {}\n"+
1578
			"	void bar(String ... args) {}\n"+
1538
			"}\n"
1579
			"}\n",
1580
			owner,
1581
			null /*no problem requestor*/
1539
		);
1582
		);
1540
		workingCopy1.makeConsistent(null);
1541
		
1583
		
1542
		this.problemRequestor =  new ProblemRequestor();
1584
		this.problemRequestor =  new ProblemRequestor();
1543
		this.workingCopy = getCompilationUnit("Reconciler15/src/test/Y.java").getWorkingCopy(owner, this.problemRequestor, null);
1585
		this.workingCopy = getWorkingCopy("Reconciler15/src/test/Y.java", "", owner, this.problemRequestor);
1544
		setWorkingCopyContents(
1586
		setWorkingCopyContents(
1545
			"package test;\n"+
1587
			"package test;\n"+
1546
			"public class Y {\n"+
1588
			"public class Y {\n"+
Lines 1561-1567 Link Here
1561
		if (workingCopy1 != null) {
1603
		if (workingCopy1 != null) {
1562
			workingCopy1.discardWorkingCopy();
1604
			workingCopy1.discardWorkingCopy();
1563
		}
1605
		}
1564
		deleteFolder("/Reconciler15/src/test");
1565
	}
1606
	}
1566
}
1607
}
1567
1608

Return to bug 76780