Bug 104492 - [AST]java.lang.ClassCastException: org.eclipse.jdt.core.dom.PrimitiveType
Summary: [AST]java.lang.ClassCastException: org.eclipse.jdt.core.dom.PrimitiveType
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 2000
: P3 major (vote)
Target Milestone: 3.1.1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 106907 106908 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-07-20 10:07 EDT by Sergey Vladimirov CLA
Modified: 2005-09-26 14:29 EDT (History)
2 users (show)

See Also:


Attachments
Sample code which brokes java code editor (247 bytes, text/plain)
2005-07-20 10:08 EDT, Sergey Vladimirov CLA
no flags Details
Proposed fix (1.23 KB, patch)
2005-07-20 14:03 EDT, Olivier Thomann CLA
no flags Details | Diff
Regression test (3.57 KB, patch)
2005-07-20 14:03 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Vladimirov CLA 2005-07-20 10:07:31 EDT
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.
Comment 1 Sergey Vladimirov CLA 2005-07-20 10:08:26 EDT
Created attachment 25040 [details]
Sample code which brokes java code editor
Comment 2 Sergey Vladimirov CLA 2005-07-20 10:09:56 EDT
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.
Comment 3 Olivier Thomann CLA 2005-07-20 13:50:55 EDT
Reproduced. I have a fix for it.
Philippe, candidate for 3.1.1.
Comment 4 Olivier Thomann CLA 2005-07-20 14:03:19 EDT
Created attachment 25067 [details]
Proposed fix
Comment 5 Olivier Thomann CLA 2005-07-20 14:03:50 EDT
Created attachment 25068 [details]
Regression test
Comment 6 Olivier Thomann CLA 2005-07-20 14:29:16 EDT
Fixed and released in HEAD.
Might be backported to 3.1.1.
Comment 7 Olivier Thomann CLA 2005-07-20 15:57:15 EDT
Backported to 31 maintenance stream.
Regression test in ASTConverter15Test.test0193/0194
Comment 8 Olivier Thomann CLA 2005-08-12 21:48:12 EDT
*** Bug 106907 has been marked as a duplicate of this bug. ***
Comment 9 Olivier Thomann CLA 2005-08-12 21:48:36 EDT
*** Bug 106908 has been marked as a duplicate of this bug. ***
Comment 10 Olivier Thomann CLA 2005-09-26 14:01:36 EDT
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.