Community
Participate
Working Groups
If you call getJavaElement() on a VariableDeclarationFragment which is part of a VariableDeclarationExpression you'll get a ClassCastException. In org.eclipse.jdt.core.dom.VariableBinding.getUnresolvedJavaElement "VariableDeclarationStatement statement = (VariableDeclarationStatement) localVar.getParent();" is a useless and a bad cast because localVar.getParent() could be a VariableDeclarationExpression. For example in "For(int i=0;..." "int i=0" is a VariableDeclarationExpression "i=0" is a VariableDeclarationFragment If you do "i=0".resolveBinding().getJavaElement(), you'll get a ClassCastException.
Fixed and released in HEAD. Regression tests added in org.eclipse.jdt.core.tests.dom.ASTConverterTestAST3_2.test0608/609
Verified for 3.1 RC1 with build I20050527-0010.