Bug 187435 - [quick fix] replace 'implements' with 'extends'
Summary: [quick fix] replace 'implements' with 'extends'
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-16 21:50 EDT by Robert Konigsberg CLA
Modified: 2018-01-20 17:38 EST (History)
3 users (show)

See Also:


Attachments
Quick Fix Screenshot (8.18 KB, image/png)
2018-01-17 05:34 EST, Noopur Gupta CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Konigsberg CLA 2007-05-16 21:50:59 EDT
If I have a class Foo and write code:

class Bar implements Foo {...}

I get this error: "The type Foo cannot be a superinterface of Bar; a superinterface must be an interface"

There's no quick fix. Two possible quick fixes are:
1. Replace 'implements' with 'extends'.
2. Suggest replacing Foo with one of Foo's interfaces.

There's probably a similar version of this for using extends with interfaces, I'll leave that out for now.
Comment 1 Olivier Thomann CLA 2007-05-16 22:24:38 EDT
Move to JDT/UI
Comment 2 Benjamin Muskalla CLA 2008-07-09 08:12:23 EDT
I20080702-0939

At least the first suggestion is already implemented. But only in one direction. "Class implements Class" still has no quick fix. 
Not sure if the second options makes much sense in that case.
Comment 3 Lukas Eder CLA 2018-01-16 04:14:45 EST
I was just going to add this issue myself. I design a lot of API and keep confusing "extends" and "implements" in Java (other languages don't make the distinction)

For instance:

------------------------------------------------
class X extends Serializable {
}
------------------------------------------------

This can happen easily to me, because just before creating X, I might have been creating a bunch of interfaces, where funkily we do not use "implements" but "extends" for interfaces.

I would love to see a quick fix here that produces this:

------------------------------------------------
class X implements Serializable {
}
------------------------------------------------
Comment 4 Noopur Gupta CLA 2018-01-17 05:34:35 EST
Created attachment 272296 [details]
Quick Fix Screenshot

(In reply to Lukas Eder from comment #3)
This one already exists. See attached screenshot.
Comment 5 Lukas Eder CLA 2018-01-17 07:16:15 EST
(In reply to Noopur Gupta from comment #4)
> This one already exists. See attached screenshot.

Oh interesting. In what release was it added, then? Perhaps this has become duplicate, then?
Comment 6 Noopur Gupta CLA 2018-01-17 08:49:38 EST
(In reply to Lukas Eder from comment #5)
> (In reply to Noopur Gupta from comment #4)
> > This one already exists. See attached screenshot.
> 
> Oh interesting. In what release was it added, then? 
Added via bug 71754.

> Perhaps this has become duplicate, then?
This bug is to change 'implements' to 'extends'.