### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java,v retrieving revision 1.170 diff -u -r1.170 DefaultBindingResolver.java --- dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java 31 Aug 2010 20:09:04 -0000 1.170 +++ dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java 6 Jan 2011 16:18:11 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -1518,6 +1518,20 @@ if (node instanceof ParameterizedQualifiedTypeReference) { ParameterizedQualifiedTypeReference typeReference = (ParameterizedQualifiedTypeReference) node; org.eclipse.jdt.internal.compiler.lookup.TypeBinding typeBinding = typeReference.resolvedType; + if (type.isArrayType()) { + if (this.scope == null) { + return null; + } + ArrayType arrayType = (ArrayType) type; + if (typeBinding.isArrayType()) { + ArrayBinding arrayBinding = (ArrayBinding) typeBinding; + return getTypeBinding(this.scope.createArrayType(arrayBinding.leafComponentType, arrayType.getDimensions())); + } + return getTypeBinding(this.scope.createArrayType(binding, arrayType.getDimensions())); + } + if (typeBinding.isArrayType()) { + typeBinding = ((ArrayBinding) typeBinding).leafComponentType; + } int index; if (type.isQualifiedType()) { index = ((QualifiedType) type).index; @@ -1550,21 +1564,19 @@ if (binding != null) { if (type.isArrayType()) { ArrayType arrayType = (ArrayType) type; - if (this.scope == null) return null; - if (binding.isArrayType()) { - ArrayBinding arrayBinding = (ArrayBinding) binding; - return getTypeBinding(this.scope.createArrayType(arrayBinding.leafComponentType, arrayType.getDimensions())); - } else { - return getTypeBinding(this.scope.createArrayType(binding, arrayType.getDimensions())); + if (this.scope == null) { + return null; } - } else { if (binding.isArrayType()) { ArrayBinding arrayBinding = (ArrayBinding) binding; - return getTypeBinding(arrayBinding.leafComponentType); - } else { - return getTypeBinding(binding); + return getTypeBinding(this.scope.createArrayType(arrayBinding.leafComponentType, arrayType.getDimensions())); } + return getTypeBinding(this.scope.createArrayType(binding, arrayType.getDimensions())); + } else if (binding.isArrayType()) { + ArrayBinding arrayBinding = (ArrayBinding) binding; + return getTypeBinding(arrayBinding.leafComponentType); } + return getTypeBinding(binding); } } else if (type.isPrimitiveType()) { /* Handle the void primitive type returned by getReturnType for a method declaration #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java,v retrieving revision 1.299 diff -u -r1.299 ASTConverter15Test.java --- src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 13 Dec 2010 14:44:21 -0000 1.299 +++ src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 6 Jan 2011 16:18:12 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -47,7 +47,7 @@ } static { -// TESTS_NUMBERS = new int[] { 345, 346 }; +// TESTS_NUMBERS = new int[] { 347 }; // TESTS_RANGE = new int[] { 325, -1 }; // TESTS_NAMES = new String[] {"test0204"}; } @@ -11156,4 +11156,48 @@ assertEquals("Wrong constant value", "a", constantValue); } + /* + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=333360 + */ + public void test0347() throws JavaModelException { + this.workingCopy = getWorkingCopy("/Converter15/src/test0347/X.java", true/*resolve*/); + String contents = + "package test0347;\n" + + "public class X implements One.Inner[]/*end*/> {\n" + + "}\n" + + "interface One {}\n" + + "class Outer {\n" + + " public class Inner {}\n" + + "}"; + ArrayType type = (ArrayType) buildAST( + contents, + this.workingCopy); + assertNotNull("No annotation", type); + ITypeBinding binding = type.resolveBinding(); + assertNotNull("No binding", binding); + assertEquals("Wrong qualified name", "test0347.Outer.Inner[]", binding.getQualifiedName()); + Type componentType = type.getComponentType(); + binding = componentType.resolveBinding(); + assertNotNull("No binding", binding); + assertEquals("Wrong qualified name", "test0347.Outer.Inner", binding.getQualifiedName()); + assertTrue("Not parameterized", componentType.isParameterizedType()); + ParameterizedType parameterizedType = (ParameterizedType) componentType; + Type type2 = parameterizedType.getType(); + assertTrue("Not qualified", type2.isQualifiedType()); + QualifiedType qualifiedType = (QualifiedType) type2; + binding = qualifiedType.resolveBinding(); + assertNotNull("No binding", binding); + assertEquals("Wrong qualified name", "test0347.Outer.Inner", binding.getQualifiedName()); + Type qualifier = qualifiedType.getQualifier(); + assertTrue("Not parameterized", qualifier.isParameterizedType()); + binding = qualifier.resolveBinding(); + assertNotNull("No binding", binding); + assertEquals("Wrong qualified name", "test0347.Outer", binding.getQualifiedName()); + parameterizedType = (ParameterizedType) qualifier; + type2 = parameterizedType.getType(); + assertTrue("Not simple type", type2.isSimpleType()); + binding = type2.resolveBinding(); + assertNotNull("No binding", binding); + assertEquals("Wrong qualified name", "test0347.Outer", binding.getQualifiedName()); + } } \ No newline at end of file