Bug 344569

Summary: [quick assist] Join variable declaration quick fix should be proposed for initialized variables of primitive type
Product: [Eclipse Project] JDT Reporter: Dani Megert <daniel_megert>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: ankur_sharma, deepakazad, markus.kell.r, Olivier_Thomann, wmitsuda
Version: 3.5   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 287123    
Bug Blocks:    

Description Dani Megert CLA 2011-05-03 09:44:14 EDT
+++ This bug was initially created as a clone of Bug #287123 +++

Support is missing for primitives.
Comment 1 Deepak Azad CLA 2011-05-03 13:20:31 EDT
The fix for Bug 287123 was to offer 'Join variable declaration' quick assist when the initializer is *null*. If the initializer is not null then the quick assist is not offered, because the initializer may be important to the user and we do not want to delete it silently/without warning.

So what needs to be done for primitive types ? Offer the quick assist when the variable is initialized to the default value of the primitive type ? e.g. int i= 0; or boolean b= false;

In my opinion we should not do this, as this would be confusing.
Comment 2 Dani Megert CLA 2011-05-04 03:24:19 EDT
> So what needs to be done for primitive types ? Offer the quick assist when the
> variable is initialized to the default value of the primitive type ? e.g. int
> i= 0; or boolean b= false;
Yes.

> In my opinion we should not do this, as this would be confusing.
Why should we treat the default value for objects different from the primitive ones?
Comment 3 Deepak Azad CLA 2011-05-04 04:21:14 EDT
Double d= 0d;
Double d= 0.0d;
Double d= 0.00d;

- In which case is the quick assist offered? (rhetorical question)
- And from a user perspective there is no scope of confusion here?
Comment 4 Dani Megert CLA 2011-05-04 04:28:33 EDT
(In reply to comment #3)
> Double d= 0d;
> Double d= 0.0d;
> Double d= 0.00d;
> - In which case is the quick assist offered? (rhetorical question)
In none, as those assign real objects which are different from the object default ('null').

> - And from a user perspective there is no scope of confusion here?
Why?
Comment 5 Deepak Azad CLA 2011-05-04 04:45:53 EDT
oops.. the D is double was supposed to be lower case

double d= 0d;
double d= 0.0d;
double d= 0.00d;
Comment 6 Dani Megert CLA 2011-05-04 04:59:14 EDT
> double d= 0d;
> double d= 0.0d;
> double d= 0.00d;

Those are all identical to the default (0.0d) and hence the quick assist should be there.