Summary: | [compiler][1.5] ClassCastException when parsing a CastExpression between an array type and a type variable | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Markus Keller <markus.kell.r> | ||||
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> | ||||
Status: | VERIFIED FIXED | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P3 | ||||||
Version: | 3.1 | ||||||
Target Milestone: | 3.1 M5 | ||||||
Hardware: | PC | ||||||
OS: | Windows XP | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Markus Keller
2005-01-10 15:28:49 EST
Created attachment 17058 [details]
Apply on Expression class in HEAD
Cool, that patch does the job. But in the meantime, I found that the other direction suffers from the same / a similar problem class F<T> { void foo(T o) { int[] x= (int[]) o; } } Stacktrace with patch applied: java.lang.ClassCastException at org.eclipse.jdt.internal.compiler.ast.Expression.checkCastTypesCompatibility(Expression.java:331) at org.eclipse.jdt.internal.compiler.ast.CastExpression.resolveType(CastExpression.java:376) at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:201) ... Olivier - I don't think the patch works. Using the leaf type doesn't provide the right semantics. I have another version in progress, but must still adjust warnings (unsafe cast, unnecessary cast). New behavior implemented. Added regression test: GenericTypeTest#test454. Fixed (will released post today's 2pm integration since too late). Verified in I20050214 |