Bug 73014 - [quick fix] fix type missmatch with toString() or valueOf()
Summary: [quick fix] fix type missmatch with toString() or valueOf()
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-31 17:55 EDT by Sandip Chitale CLA
Modified: 2009-01-23 11:32 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sandip Chitale CLA 2004-08-31 17:55:40 EDT
For the following declarations:
class Bar {
}
class Foo extends Bar {
}
Foo foo = ...;
Bar bar = ...;

foo = bar;

will trigger a quick fix with possibilities of

Add cast to Integer
Change type of foo to ...
Change type of bar to ...

This is all fine. I think a special case of String type variables should also 
be handled e.g. in the following case:

String barString = bar;

an additional possibility of:

Get the string value of 'bar' using bar.toString()

If the user selects this the code changes to:

String barString = bar.toString();

Another possibility is:

Get the string value of 'bar' using String.valueOf(bar)

If the user selects this the code changes to:

String barString = String.valueOf(bar);

This will work even when bar is not a Class or Interface.

These f course could be lower priority quick fixes.
Comment 1 Sandip Chitale CLA 2004-08-31 17:58:40 EDT
Additional coersive Quick Fixes could be supported between Striung type, basic 
types and their Object counterparts using the valueOf(), parse<blah>() methods.
Comment 2 Jerome Lanneluc CLA 2004-09-01 04:36:35 EDT
Moving to JDT UI for comments