Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 332008 - [quick fix] Quick fix can be improved in 1.4/1.5 mixed projects
Summary: [quick fix] Quick fix can be improved in 1.4/1.5 mixed projects
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M5   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-07 07:20 EST by Ayushman Jain CLA
Modified: 2010-12-14 09:31 EST (History)
2 users (show)

See Also:


Attachments
attached projects (4.60 KB, application/zip)
2010-12-07 07:20 EST, Ayushman Jain CLA
no flags Details
Fix (13.80 KB, patch)
2010-12-14 09:30 EST, Markus Keller CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ayushman Jain CLA 2010-12-07 07:20:45 EST
Created attachment 184711 [details]
attached projects

In the attached projects, there's an error in OSGIConsole.java about incorrect return type. "client" uses 1.4 compliance and "api", 1.5 compliance. The quick fix suggested is "change return type to T". Exercising this quick fix immediately causes an error because the current project is in 1.4 compliance. Perhaps, quick fix should not offer suggestions not relevant to a 1.4 project. The suggestion can be changed to "change return type to T and change compliance to 1.5" or removed altogether.
Comment 1 Ayushman Jain CLA 2010-12-13 06:20:30 EST
Ping.
Comment 2 Markus Keller CLA 2010-12-13 07:05:23 EST
Unfortunately,
Comment 3 Markus Keller CLA 2010-12-14 09:30:10 EST
Created attachment 185132 [details]
Fix

> Unfortunately,

I first wanted to say that we don't have the infrastructure to fix this correctly, but then I found we actually do have it. With this patch, the quick fix offers to change the return type to Object.


BTW: I also tried to reproduce the problem with
		new ArrayList() {
			public void toArray(Object[] a) {
			}
		};
, but there it already worked. The reason for that is an inconsistency in the DOM bindings:
- In the ArrayList case, the raw type ArrayList has a declared method "Object[] toArray(Object[])" whose getMethodDeclaration() returns the version with a type parameter.
- In the ConsoleSession case, the superclass ConsoleSession is not parameterized and its declared methods only exist in one version, and that version contains the type parameter.

But I wouldn't touch that area right now, unless we need to straighten this for other reasons.
Comment 4 Markus Keller CLA 2010-12-14 09:31:16 EST
Fixed in HEAD (the patch also fixes a few other related problems in the quick fix and in the override/implement methods logic).