Bug 571678 - Content assist should offer interfaces as well, in a class's extends clause
Summary: Content assist should offer interfaces as well, in a class's extends clause
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.18   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-04 05:01 EST by Lukas Eder CLA
Modified: 2023-03-26 11:39 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Eder CLA 2021-03-04 05:01:08 EST
Assuming this setup:

// ---------------------------------------------------------------
interface Interface {}
class C {}
class D extends C {}
// ---------------------------------------------------------------

Having worked with other languages, I sometimes forget whether some type is an interface or a class, I just want to extend/implement it as a trait. I would then like to go to the D class's "extends" section, and start typing:

// ---------------------------------------------------------------
class D extends C, Inte {}
// ---------------------------------------------------------------

The rationale here being that at this point, I might not even be sure about whether D is a class or interface. These syntactic differences are mostly ceremony, not useful. If C and D were interfaces, then this would work:

// ---------------------------------------------------------------
interface D extends C, Inte {}
// ---------------------------------------------------------------

I wish that content assist would offer me to choose Interface and make me aware of the fact that it's not a class and that my hypothetical syntax is incorrect, and fix it for me to become this:

// ---------------------------------------------------------------
class D extends C implements Interface {}
// ---------------------------------------------------------------

I know that this may appear a bit unusual to someone who is very well aware and deeply cares about Java syntax. But to me, a user who just wants the language and IDE to Do The Right Thing™, this arbitrary syntactic distinction is often a cause of cognitive friction kicking me out of the flow, rather than anything useful.

Hence, if Eclipse could "Do The Right Thing™" here, I would be delighted :)

Alternative suggestion: IntelliJ includes "Interface" in the content assist, and then offers a quick fix to turn the invalid syntax "extends C, Interface" into "extends C implements Interface"
Comment 1 Eclipse Genie CLA 2023-03-26 11:39:05 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.