### 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.174 diff -u -r1.174 DefaultBindingResolver.java --- dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java 19 Apr 2011 19:35:51 -0000 1.174 +++ dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java 19 Apr 2011 20:14:33 -0000 @@ -117,7 +117,10 @@ /** * This map is used to retrieve an old ast node using the new ast node. This is not an - * identity map. + * identity map, as several nested DOM nodes may be associated with the same "larger" + * compiler AST node. + * E.g., an ArrayAllocationExpression "new MyType[1]" will appear as the right-hand value + * for the SimpleType "MyType", the ArrayType "MyType[1]", and the ArrayCreation "new MyType[1]". */ Map newAstToOldAst; @@ -1528,6 +1531,7 @@ return getTypeBinding(this.scope.createArrayType(arrayBinding.leafComponentType, arrayType.getDimensions())); } if (typeBinding.isArrayType()) { + // 'binding' can still be an array type because 'node' may be "larger" than 'type' (see comment of newAstToOldAst). typeBinding = ((ArrayBinding) typeBinding).leafComponentType; } int index; @@ -1568,6 +1572,7 @@ ArrayBinding arrayBinding = (ArrayBinding) binding; return getTypeBinding(this.scope.createArrayType(arrayBinding.leafComponentType, arrayType.getDimensions())); } else if (binding.isArrayType()) { + // 'binding' can still be an array type because 'node' may be "larger" than 'type' (see comment of newAstToOldAst). ArrayBinding arrayBinding = (ArrayBinding) binding; return getTypeBinding(arrayBinding.leafComponentType); }