Community
Participate
Working Groups
When working with for loop for primitive arrays, java code editor always throws (in error log): java.lang.ClassCastException: org.eclipse.jdt.core.dom.PrimitiveType at org.eclipse.jdt.core.dom.ASTConverter.setTypeForSingleVariableDeclaration (ASTConverter.java:4920) at org.eclipse.jdt.core.dom.ASTConverter.convertToSingleVariableDeclaration (ASTConverter.java:2774) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1629) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2201) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:502) at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations (ASTConverter.java:178) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2486) at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1162) at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert (CompilationUnitResolver.java:251) at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST (ASTParser.java:800) at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:588) at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider$1.run (ASTProvider.java:566) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:1044) at org.eclipse.core.runtime.Platform.run(Platform.java:783) at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST (ASTProvider.java:563) at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST (ASTProvider.java:493) at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartList enerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:165) at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run (SelectionListenerWithASTManager.java:142) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76) With this error JDT cannot check breakpoint too.
Created attachment 25040 [details] Sample code which brokes java code editor
Test case: - open file in Eclipse with PDE installed; - move mouse to any variable/type to try to hover it. - look for errors on PDE error log.
Reproduced. I have a fix for it. Philippe, candidate for 3.1.1.
Created attachment 25067 [details] Proposed fix
Created attachment 25068 [details] Regression test
Fixed and released in HEAD. Might be backported to 3.1.1.
Backported to 31 maintenance stream. Regression test in ASTConverter15Test.test0193/0194
*** Bug 106907 has been marked as a duplicate of this bug. ***
*** Bug 106908 has been marked as a duplicate of this bug. ***
Verified in M20050923-1430 for 3.1.1. Opened bug 110657 for problem with the position of the single variable declaration within the enhanced for statement.