Community
Participate
Working Groups
build I200411240800 + jdtcore head 1) create X.java public class X<T1> { public <M1> X() { } class Y<T2> { public <M2> Y() { } } void foo() { new <Object>X<Object>().new <Object>Y<Object>(); } } 2) close and reopen the editor a ClassCastException occurs java.lang.ClassCastException at org.eclipse.jdt.core.dom.ASTNode.checkNewChild(ASTNode.java:1865) at org.eclipse.jdt.core.dom.ASTNode$NodeList.add(ASTNode.java:1242) at java.util.AbstractList.add(AbstractList.java:89) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2102) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1484) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2299) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:570) at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:175) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2478) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1226) at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:220) at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:729) at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:574) at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:565) at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:494)
The problem seems to be inside convert(org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression allocation) at line 2102. convert() is called instead of convertType().
I will investigate. Thanks, David for your investigation.
Yes, that was it. Fixed and released in HEAD. Regression test added in ASTConverter15Test.test0087
Verified (in I20041214-2000) that the test ensures that buiding an ast on the given cu doesn't throw a ClassCastException.