Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 186187 Details for
Bug 333360
[DOM] eclipse fails to create array binding in this situation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix + regression test
patch_333360.txt (text/plain), 6.78 KB, created by
Olivier Thomann
on 2011-01-06 11:18:26 EST
(
hide
)
Description:
Proposed fix + regression test
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2011-01-06 11:18:26 EST
Size:
6.78 KB
patch
obsolete
>### 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</*start*/Outer<Integer>.Inner<Double>[]/*end*/> {\n" + >+ "}\n" + >+ "interface One<T> {}\n" + >+ "class Outer<T> {\n" + >+ " public class Inner<S> {}\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<java.lang.Integer>.Inner<java.lang.Double>[]", binding.getQualifiedName()); >+ Type componentType = type.getComponentType(); >+ binding = componentType.resolveBinding(); >+ assertNotNull("No binding", binding); >+ assertEquals("Wrong qualified name", "test0347.Outer<java.lang.Integer>.Inner<java.lang.Double>", 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<java.lang.Integer>.Inner<java.lang.Double>", binding.getQualifiedName()); >+ Type qualifier = qualifiedType.getQualifier(); >+ assertTrue("Not parameterized", qualifier.isParameterizedType()); >+ binding = qualifier.resolveBinding(); >+ assertNotNull("No binding", binding); >+ assertEquals("Wrong qualified name", "test0347.Outer<java.lang.Integer>", 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<java.lang.Integer>", binding.getQualifiedName()); >+ } > } >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 333360
: 186187