Bug 79775 - [dom]ClassCastException inside ASTConverter when opening a java file
Summary: [dom]ClassCastException inside ASTConverter when opening a java file
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-30 10:21 EST by David Audel CLA
Modified: 2004-12-15 12:40 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Audel CLA 2004-11-30 10:21:56 EST
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)
Comment 1 David Audel CLA 2004-11-30 10:25:04 EST
The problem seems to be inside
convert(org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression
allocation) at line 2102. convert() is called instead of convertType().
Comment 2 Olivier Thomann CLA 2004-11-30 13:24:32 EST
I will investigate. Thanks, David for your investigation.
Comment 3 Olivier Thomann CLA 2004-11-30 15:19:53 EST
Yes, that was it.
Fixed and released in HEAD.
Regression test added in ASTConverter15Test.test0087
Comment 4 Jerome Lanneluc CLA 2004-12-15 12:40:13 EST
Verified (in I20041214-2000) that the test ensures that buiding an ast on the
given cu doesn't throw a ClassCastException.