Bug 28824 - Quick Fix: Type Mismatch -> Cast bug [quick fix]
Summary: Quick Fix: Type Mismatch -> Cast bug [quick fix]
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: 2.1 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-23 06:03 EST by Paul Raby CLA
Modified: 2003-02-06 05:33 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 Paul Raby CLA 2002-12-23 06:03:38 EST
When using code assist to apply a cast to the following statement:

DefaultMutableTreeNode root = getParentContainer().treeMapperTree.getModel
().getRoot();

You get:

DefaultMutableTreeNode root = getParentContainer().(DefaultMutableTreeNode) 
treeMapperTree.getModel().getRoot();

When you should get:

DefaultMutableTreeNode root = (DefaultMutableTreeNode) getParentContainer
().treeMapperTree.getModel().getRoot();

Seems to be getting confused about where the cast statement should go because 
the treeMapperTree isn't using getters (i.e. getTreeMapperTree()).  When using 
getters then the cast works fine...

Should also work without getters, hence bug.
Comment 1 Paul Raby CLA 2002-12-23 06:04:31 EST
Affected version: M4 and previous of 2.1
Comment 2 David Audel CLA 2003-01-08 10:00:36 EST
This is not a code assist bug but a quick fix bug

Move to JDTUI
Comment 3 Martin Aeschlimann CLA 2003-01-09 11:45:51 EST
The bug comes from wrong offsets in the AST.
Created test case ASTRewritingExpressionsTest.testCastExpression_bug28824.

Moving to Olivier.
Comment 4 Olivier Thomann CLA 2003-01-09 12:48:58 EST
I am investigating.
Comment 5 Olivier Thomann CLA 2003-01-09 13:33:18 EST
Reproduced. I am working on a fix.
Comment 6 Olivier Thomann CLA 2003-01-09 14:12:01 EST
Fixed and released in 2.1 stream.
Regression test added.
Comment 7 Olivier Thomann CLA 2003-01-09 14:15:43 EST
Fixed.
Comment 8 David Audel CLA 2003-02-06 05:33:21 EST
Verified.