|
Lines 21-26
Link Here
|
| 21 |
import org.eclipse.jdt.core.search.IJavaSearchConstants; |
21 |
import org.eclipse.jdt.core.search.IJavaSearchConstants; |
| 22 |
import org.eclipse.jdt.core.search.IJavaSearchScope; |
22 |
import org.eclipse.jdt.core.search.IJavaSearchScope; |
| 23 |
import org.eclipse.jdt.core.search.SearchEngine; |
23 |
import org.eclipse.jdt.core.search.SearchEngine; |
|
|
24 |
import org.eclipse.jdt.internal.core.ClasspathEntry; |
| 24 |
|
25 |
|
| 25 |
import junit.framework.Test; |
26 |
import junit.framework.Test; |
| 26 |
|
27 |
|
|
Lines 1543-1547
Link Here
|
| 1543 |
assertStringsEqual("Type parameter bounds signatures", |
1544 |
assertStringsEqual("Type parameter bounds signatures", |
| 1544 |
"TT;\n", typeParam.getBoundsSignatures()); |
1545 |
"TT;\n", typeParam.getBoundsSignatures()); |
| 1545 |
} |
1546 |
} |
| 1546 |
|
1547 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=316937 |
|
|
1548 |
public void testBug316937() throws Exception { |
| 1549 |
try { |
| 1550 |
IJavaProject project = getJavaProject("P"); |
| 1551 |
String[] pathAndContents = new String[] { |
| 1552 |
"bug316937/Foo.java", |
| 1553 |
"package bug316937;\n" + "public class Foo {\n" |
| 1554 |
+ " class Bar {\n" |
| 1555 |
+ " public Bar(int a, int b) {}\n" + " }\n" |
| 1556 |
+ "}\n" }; |
| 1557 |
addLibrary(project, "lib316937.jar", "src316937.zip", |
| 1558 |
pathAndContents, JavaCore.VERSION_1_5); |
| 1559 |
IPackageFragmentRoot packageFragRoot = project |
| 1560 |
.getPackageFragmentRoot(getFile("/P/lib316937.jar")); |
| 1561 |
|
| 1562 |
IType type = packageFragRoot.getPackageFragment("bug316937") |
| 1563 |
.getClassFile("Foo.class").getType(); |
| 1564 |
IType subType = type.getType("Bar"); |
| 1565 |
IMethod[] methods = subType.getMethods(); |
| 1566 |
assertEquals("Constructros", 1, methods.length); |
| 1567 |
IMethod method = methods[0]; |
| 1568 |
String[] paramNames = method.getParameterNames(); |
| 1569 |
assertStringsEqual("Type parameter names", "a\n" + "b\n", |
| 1570 |
paramNames); |
| 1571 |
|
| 1572 |
// Remove the source attachment |
| 1573 |
IClasspathEntry[] rawClasspath = project.getRawClasspath(); |
| 1574 |
for (int index = 0; index < rawClasspath.length; index++) { |
| 1575 |
IClasspathEntry entry = rawClasspath[index]; |
| 1576 |
if (entry.getPath().toString().endsWith("lib316937.jar")) { |
| 1577 |
((ClasspathEntry) entry).sourceAttachmentPath = null; |
| 1578 |
} |
| 1579 |
} |
| 1580 |
project.setRawClasspath(rawClasspath, null); |
| 1581 |
|
| 1582 |
packageFragRoot = project |
| 1583 |
.getPackageFragmentRoot(getFile("/P/lib316937.jar")); |
| 1584 |
type = packageFragRoot.getPackageFragment("bug316937") |
| 1585 |
.getClassFile("Foo.class").getType(); |
| 1586 |
subType = type.getType("Bar"); |
| 1587 |
methods = subType.getMethods(); |
| 1588 |
assertEquals("Constructros", 1, methods.length); |
| 1589 |
method = methods[0]; |
| 1590 |
paramNames = method.getParameterNames(); |
| 1591 |
assertStringsEqual("Type parameter names", "a\n" + "b\n", |
| 1592 |
paramNames); |
| 1593 |
} finally { |
| 1594 |
removeLibrary(getJavaProject("P"), "lib316937.jar", "src316937.zip"); |
| 1595 |
} |
| 1596 |
} |
| 1597 |
|
| 1547 |
} |
1598 |
} |