Bug 201987 - [quick fix] method belongs to raw type -> add type parameters locks up when inferred type is "Object"
Summary: [quick fix] method belongs to raw type -> add type parameters locks up when i...
Status: VERIFIED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M2   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-01 18:02 EDT by Jules H CLA
Modified: 2007-09-17 08:55 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jules H CLA 2007-09-01 18:02:44 EDT
Build ID: M20070212-1330

Steps To Reproduce:
1. Create a class with the following code:

public class Test
{
	Object object;
	
	public void testMethod () throws Exception
	{
		Class obClass = object.getClass ();
		obClass.getMethod ("methodname", new Class[] { });
	}		
}

2. There should be a "method belongs to raw type" warning on the line beginning "obClass.getMethod".  Right click the warning in problems and choose quick fix.
3. One of the quick fix options should be "Add type parameters to 'Class'".  Choose this and click OK.
4. The progress area says "Fixing" and the progress bar progresses half way across the dialog, but no further progress occurs.
5. The dialog cannot be cancelled, but may be closed via the window manager.

More information:
Note that the declaration of the field 'object' must be of type 'Object'.  Any other type and the fix works fine.
Comment 1 Frederic Fusier CLA 2007-09-02 04:53:15 EDT
Back to JDT/Core as in fact I do not really understand whether you want a new warning or does not like the current quick-fix behavior of the current warning on 'Class' telling that it should be parameterized...
Comment 2 Jules H CLA 2007-09-02 07:56:25 EDT
As I see it, the "quick fix" option in question should change the line:

Class obClass = object.getClass ();

to read:

Class<? extends Object> obClass = object.getClass ();

But at present it does not, rather it appears to crash (leaving the progress bar halfway, etc.)
Comment 3 Frederic Fusier CLA 2007-09-02 13:13:42 EDT
I cannot reproduce this problem neither in 3.3 version and 3.4M1...

The warning is now correctly on Class and quick-fix works properly => close as WORKSFORME as I didn't find the original bug which fixed this issue
Comment 4 Maxime Daniel CLA 2007-09-17 08:55:07 EDT
Verified for 3.4 M2 using build I20070917-0010.