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

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/util/Util.java (-1 / +6 lines)
Lines 1365-1375 Link Here
1365
			if (isInnerBinaryTypeConstructor)
1365
			if (isInnerBinaryTypeConstructor)
1366
				parameterSignatures[0] = new String(enclosingType.genericTypeSignature()).replace('/', '.');
1366
				parameterSignatures[0] = new String(enclosingType.genericTypeSignature()).replace('/', '.');
1367
			for (int i = 0;  i < length; i++) {
1367
			for (int i = 0;  i < length; i++) {
1368
				parameterSignatures[declaringIndex + i] = new String(parameters[i].genericTypeSignature()).replace('/', '.');
1368
				String signature = new String(parameters[i].genericTypeSignature()).replace('/', '.');
1369
				if (!isBinary && signature.length() > 1 && signature.charAt(0) == Signature.C_RESOLVED) 
1370
					signature = Signature.C_UNRESOLVED + signature.substring(1);
1371
				parameterSignatures[declaringIndex + i] = signature;
1369
			}
1372
			}
1370
			IMethod result = declaringType.getMethod(selector, parameterSignatures);
1373
			IMethod result = declaringType.getMethod(selector, parameterSignatures);
1371
			if (isBinary)
1374
			if (isBinary)
1372
				return (JavaElement) result;
1375
				return (JavaElement) result;
1376
			if (result.exists()) // if perfect match (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=249567 )
1377
				return (JavaElement) result;
1373
			IMethod[] methods = null;
1378
			IMethod[] methods = null;
1374
			try {
1379
			try {
1375
				methods = declaringType.getMethods();
1380
				methods = declaringType.getMethods();
(-)src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java (+40 lines)
Lines 1728-1733 Link Here
1728
			element
1728
			element
1729
		);
1729
		);
1730
	}
1730
	}
1731
1732
	/*
1733
	 * Ensures that the IJavaElement of an IBinding representing a method is correct.
1734
	 * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=249567 )
1735
	 */
1736
	public void testMethod12() throws Exception {
1737
		try {
1738
			createFolder("/P/src/p1");
1739
			createFile(
1740
				"/P/src/p1/X249567.java",
1741
				"package p1;\n" +
1742
				"public class X249567 {}"
1743
			);
1744
			createFolder("/P/src/p2");
1745
			createFile(
1746
				"/P/src/p2/X249567.java",
1747
				"package p2;\n" +
1748
				"public class X249567 {}"
1749
			);
1750
			ASTNode node = buildAST(
1751
				"public class X {\n" +
1752
				"  void foo(p1.X249567 x) {\n" +
1753
				"  }\n" +
1754
				"  /*start*/void foo(p2.X249567 x) {\n" +
1755
				"  }/*end*/\n" +
1756
				"}"
1757
			);
1758
			IBinding binding = ((MethodDeclaration) node).resolveBinding();
1759
			IJavaElement element = binding.getJavaElement();
1760
			assertElementEquals(
1761
				"Unexpected Java element",
1762
				"foo(p2.X249567) [in X [in [Working copy] X.java [in <default> [in src [in P]]]]]",
1763
				element
1764
			);
1765
		} finally {
1766
			deleteFolder("/P/src/p1");
1767
			deleteFolder("/P/src/p2");
1768
		}
1769
	}
1770
1731
	/*
1771
	/*
1732
	 * Ensures that the IJavaElement of an IBinding representing a package is correct.
1772
	 * Ensures that the IJavaElement of an IBinding representing a package is correct.
1733
	 */
1773
	 */

Return to bug 249567