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 193158 Details for
Bug 342671
ClassCastException: org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding cannot be cast to org.eclipse.jdt.internal.compiler.lookup.ArrayBinding
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix + regression tests
patch_342671.txt (text/plain), 7.82 KB, created by
Olivier Thomann
on 2011-04-13 09:10:52 EDT
(
hide
)
Description:
Proposed fix + regression tests
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2011-04-13 09:10:52 EDT
Size:
7.82 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.172 >diff -u -r1.172 DefaultBindingResolver.java >--- dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java 24 Feb 2011 19:31:37 -0000 1.172 >+++ dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java 13 Apr 2011 13:09:19 -0000 >@@ -1523,8 +1523,11 @@ > return null; > } > ArrayType arrayType = (ArrayType) type; >- ArrayBinding arrayBinding = (ArrayBinding) typeBinding; >- return getTypeBinding(this.scope.createArrayType(arrayBinding.leafComponentType, arrayType.getDimensions())); >+ if (typeBinding.isArrayType()) { >+ ArrayBinding arrayBinding = (ArrayBinding) typeBinding; >+ return getTypeBinding(this.scope.createArrayType(arrayBinding.leafComponentType, arrayType.getDimensions())); >+ } >+ return getTypeBinding(this.scope.createArrayType(typeBinding, arrayType.getDimensions())); > } > if (typeBinding.isArrayType()) { > typeBinding = ((ArrayBinding) typeBinding).leafComponentType; >@@ -1564,8 +1567,11 @@ > if (this.scope == null) { > return null; > } >- ArrayBinding arrayBinding = (ArrayBinding) binding; >- return getTypeBinding(this.scope.createArrayType(arrayBinding.leafComponentType, arrayType.getDimensions())); >+ if (binding.isArrayType()) { >+ ArrayBinding arrayBinding = (ArrayBinding) 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); >#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.305 >diff -u -r1.305 ASTConverter15Test.java >--- src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 7 Apr 2011 17:25:52 -0000 1.305 >+++ src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java 13 Apr 2011 13:09:20 -0000 >@@ -47,7 +47,7 @@ > } > > static { >-// TESTS_NUMBERS = new int[] { 350 }; >+// TESTS_NUMBERS = new int[] { 351, 352 }; > // TESTS_RANGE = new int[] { 325, -1 }; > // TESTS_NAMES = new String[] {"test0204"}; > } >@@ -11284,4 +11284,24 @@ > assertTrue("Should be seen as a wildcard (really an intersection type)", binding.isWildcardType()); > assertNull("should be null", binding.getGenericTypeOfWildcardType()); > } >+ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=342671 >+ public void test0351() throws JavaModelException { >+ ICompilationUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0351", "X.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ >+ ASTNode result = runJLS3Conversion(sourceUnit, true, true); >+ assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); >+ CompilationUnit unit = (CompilationUnit) result; >+ MethodDeclaration methodDeclaration = (MethodDeclaration) getASTNode(unit, 0, 0); >+ ITypeBinding typeBinding = methodDeclaration.getReturnType2().resolveBinding(); >+ assertEquals("Wrong fully qualified name", "test0351.I1[]", typeBinding.getQualifiedName()); >+ } >+ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=342671 >+ public void test0352() throws JavaModelException { >+ ICompilationUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0352", "X.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ >+ ASTNode result = runJLS3Conversion(sourceUnit, true, true); >+ assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); >+ CompilationUnit unit = (CompilationUnit) result; >+ MethodDeclaration methodDeclaration = (MethodDeclaration) getASTNode(unit, 0, 0); >+ ITypeBinding typeBinding = methodDeclaration.getReturnType2().resolveBinding(); >+ assertEquals("Wrong fully qualified name", "test0352.I1[]", typeBinding.getQualifiedName()); >+ } > } >Index: workspace/Converter15/src/test0351/I0.java >=================================================================== >RCS file: workspace/Converter15/src/test0351/I0.java >diff -N workspace/Converter15/src/test0351/I0.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Converter15/src/test0351/I0.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,4 @@ >+package test0351; >+ >+public interface I0<T> { >+} >Index: workspace/Converter15/src/test0351/I1.java >=================================================================== >RCS file: workspace/Converter15/src/test0351/I1.java >diff -N workspace/Converter15/src/test0351/I1.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Converter15/src/test0351/I1.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,4 @@ >+package test0351; >+ >+public interface I1 extends I0<X<?>> { >+} >Index: workspace/Converter15/src/test0351/I2.java >=================================================================== >RCS file: workspace/Converter15/src/test0351/I2.java >diff -N workspace/Converter15/src/test0351/I2.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Converter15/src/test0351/I2.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,5 @@ >+package test0351; >+ >+public interface I2<T extends I0<?>> { >+ public T[] getIndications(); >+} >Index: workspace/Converter15/src/test0351/X.java >=================================================================== >RCS file: workspace/Converter15/src/test0351/X.java >diff -N workspace/Converter15/src/test0351/X.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Converter15/src/test0351/X.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,7 @@ >+package test0351; >+ >+public class X<T> { >+ public I1<T>[] f() { >+ return null; >+ } >+} >Index: workspace/Converter15/src/test0352/I0.java >=================================================================== >RCS file: workspace/Converter15/src/test0352/I0.java >diff -N workspace/Converter15/src/test0352/I0.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Converter15/src/test0352/I0.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,4 @@ >+package test0352; >+ >+public interface I0<T> { >+} >Index: workspace/Converter15/src/test0352/I1.java >=================================================================== >RCS file: workspace/Converter15/src/test0352/I1.java >diff -N workspace/Converter15/src/test0352/I1.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Converter15/src/test0352/I1.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,4 @@ >+package test0352; >+ >+public interface I1 extends I0<X<?>> { >+} >Index: workspace/Converter15/src/test0352/I2.java >=================================================================== >RCS file: workspace/Converter15/src/test0352/I2.java >diff -N workspace/Converter15/src/test0352/I2.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Converter15/src/test0352/I2.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,5 @@ >+package test0352; >+ >+public interface I2<T extends I0<?>> { >+ public T[] getIndications(); >+} >Index: workspace/Converter15/src/test0352/X.java >=================================================================== >RCS file: workspace/Converter15/src/test0352/X.java >diff -N workspace/Converter15/src/test0352/X.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Converter15/src/test0352/X.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,7 @@ >+package test0352; >+ >+public class X<T> { >+ public test0352.I1<T>[] f() { >+ return null; >+ } >+}
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 342671
:
193126
|
193148
|
193157
| 193158 |
193271
|
193272
|
193439