Bug 13231 - Quick Fix: wrong proposal
Summary: Quick Fix: wrong proposal
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P2 normal (vote)
Target Milestone: 2.0 M6   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-10 08:36 EDT by Dirk Baeumer CLA
Modified: 2002-04-18 18:13 EDT (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 Dirk Baeumer CLA 2002-04-10 08:36:21 EDT
Build 20020409

public class QuickFixTest {
	public void foo() {
		fField= null;
	}
}

Try to quick fix fField. All proposals try to create something like "null 
fField"
Comment 1 Martin Aeschlimann CLA 2002-04-11 03:55:09 EDT
The type binding I get in this case is a primitive type with the name 'null'.

Is this a bug or just undocumented?
Comment 2 Philipe Mulet CLA 2002-04-11 04:11:54 EDT
null objects are of type NullBinding. If this is a well-known one, you could 
propose in place Object.

Olivier - can you comment on this one ?
Comment 3 Olivier Thomann CLA 2002-04-11 06:57:31 EDT
I will try to see which binding is returned in this case.
Comment 4 Olivier Thomann CLA 2002-04-11 10:48:23 EDT
Ok, I checked. Indeed it is the NullTypeBinding. I can return java.lang.Object in this case if you 
want to. I think it makes more sense.
Will be fixed today.
Comment 5 Olivier Thomann CLA 2002-04-11 10:58:10 EDT
In case you have a array like:
tab = null; and you want tab to be an int[], then java.lang.Object is 
not exactly appropriate here.
I am not sure that I should change anything. Let me know what you 
think.
Comment 6 Olivier Thomann CLA 2002-04-12 14:43:06 EDT
Let me know what do you want to do in the array case. If no answer, I consider this PR as invalid and it 
will be closed.
Comment 7 Martin Aeschlimann CLA 2002-04-18 12:11:18 EDT
but Object o= new int[0] is valid.

if you don't want to change this, documentation in ITypeBinding is ok.
Comment 8 Olivier Thomann CLA 2002-04-18 13:35:29 EDT
I will update the documentation of the getName() method on ITypeBinding to add the "null" case for 
a NullTypeBinding.
Comment 9 Jim des Rivieres CLA 2002-04-18 18:03:33 EDT
We should introduce a new kind of ITypeBinding for the null type.
Comment 10 Olivier Thomann CLA 2002-04-18 18:13:35 EDT
The null type is now specified in the ITypeBinding documentation. A new method has been added on 
ITypeBinding isNullType().
Regression test added.
Fixed and released in HEAD.