View | Details | Raw Unified | Return to bug 297757
Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/util/DOMFinder.java (+4 lines)
Lines 30-35 Link Here
30
import org.eclipse.jdt.core.dom.MethodDeclaration;
30
import org.eclipse.jdt.core.dom.MethodDeclaration;
31
import org.eclipse.jdt.core.dom.NormalAnnotation;
31
import org.eclipse.jdt.core.dom.NormalAnnotation;
32
import org.eclipse.jdt.core.dom.PackageDeclaration;
32
import org.eclipse.jdt.core.dom.PackageDeclaration;
33
import org.eclipse.jdt.core.dom.ParameterizedType;
33
import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
34
import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
34
import org.eclipse.jdt.core.dom.TypeDeclaration;
35
import org.eclipse.jdt.core.dom.TypeDeclaration;
35
import org.eclipse.jdt.core.dom.TypeParameter;
36
import org.eclipse.jdt.core.dom.TypeParameter;
Lines 90-95 Link Here
90
		switch (parent.getNodeType()) {
91
		switch (parent.getNodeType()) {
91
			case ASTNode.CLASS_INSTANCE_CREATION:
92
			case ASTNode.CLASS_INSTANCE_CREATION:
92
				name = ((ClassInstanceCreation) parent).getType();
93
				name = ((ClassInstanceCreation) parent).getType();
94
				if (name.getNodeType() == ASTNode.PARAMETERIZED_TYPE) {
95
					name = ((ParameterizedType) name).getType();
96
				}
93
				break;
97
				break;
94
			case ASTNode.ENUM_CONSTANT_DECLARATION:
98
			case ASTNode.ENUM_CONSTANT_DECLARATION:
95
				name = ((EnumConstantDeclaration) parent).getName();
99
				name = ((EnumConstantDeclaration) parent).getName();
(-)src/org/eclipse/jdt/core/tests/dom/ASTModelBridgeTests.java (-1 / +53 lines)
Lines 44-50 Link Here
44
	// All specified tests which do not belong to the class are skipped...
44
	// All specified tests which do not belong to the class are skipped...
45
	static {
45
	static {
46
//		TESTS_PREFIX =  "testBug86380";
46
//		TESTS_PREFIX =  "testBug86380";
47
//		TESTS_NAMES = new String[] { "testCreateBindings19" };
47
//		TESTS_NAMES = new String[] { "testCreateBindings23" };
48
//		TESTS_NUMBERS = new int[] { 83230 };
48
//		TESTS_NUMBERS = new int[] { 83230 };
49
//		TESTS_RANGE = new int[] { 83304, -1 };
49
//		TESTS_RANGE = new int[] { 83304, -1 };
50
		}
50
		}
Lines 664-669 Link Here
664
	}
664
	}
665
665
666
	/*
666
	/*
667
	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=297757
668
	 */
669
	public void testCreateBindings23() throws JavaModelException {
670
		ASTParser parser = ASTParser.newParser(AST.JLS3);
671
		parser.setProject(getJavaProject("P"));
672
		WorkingCopyOwner owner = new WorkingCopyOwner() {};
673
		this.workingCopies = new ICompilationUnit[3];
674
		this.workingCopies[0] = getWorkingCopy(
675
			"/P/src/p/IScriptRunnable.java",
676
			"package p;\n" +
677
			"public interface IScriptRunnable<V, E extends Exception> {\n" + 
678
			"	public V run(Object cx, Object scope) throws E;\n" + 
679
			"}",
680
			owner
681
		);
682
		this.workingCopies[1] = getWorkingCopy(
683
			"/P/src/p/Environment.java",
684
			"package p;\n" +
685
			"public interface Environment {\n" +
686
			"	public <V, E extends Exception> V execute(IScriptRunnable<V, E> code) throws E;\n" + 
687
			"}",
688
			owner
689
		);
690
		this.workingCopies[2] = getWorkingCopy(
691
			"/P/src/X.java",
692
			"import p.*;\n" +
693
			"public class X {\n" +
694
			"	p.Environment env;\n" +
695
			"	private void test() {\n" + 
696
			"		env.execute(new IScriptRunnable<Object, RuntimeException>() {\n" + 
697
			"			public Object run(Object cx, Object scope) throws RuntimeException {\n" + 
698
			"				return null;\n" + 
699
			"			}\n" + 
700
			"		});\n" + 
701
			"	}\n" + 
702
			"}",
703
			owner
704
		);
705
		IJavaElement[] elements = new IJavaElement[] {
706
			this.workingCopies[0].getType("IScriptRunnable"),
707
			this.workingCopies[1].getType("Environment"),
708
			this.workingCopies[2].getType("X").getMethod("test", new String[0]).getType("", 1)
709
		};
710
		IBinding[] bindings = parser.createBindings(elements, null);
711
		assertBindingsEqual(
712
			"Lp/IScriptRunnable<TV;TE;>;\n" + 
713
			"Lp/Environment;\n" + 
714
			"LX$90;",
715
			bindings);
716
	}
717
718
	/*
667
	 * Ensures that the correct IBindings are created for a given set of IJavaElement
719
	 * Ensures that the correct IBindings are created for a given set of IJavaElement
668
	 * (top level type)
720
	 * (top level type)
669
	 */
721
	 */

Return to bug 297757