Request thoughts on possible inspection


So I was coding along, adding some functionality to an interface, and the thought struck me that an inspection would be handy to show abstract methods for which there are subclasses which contain no implementation of the method. Call it something like "Abstract method not implemented in all subclasses". This would be fairly easy to do technically, and I wouldn't even have to code a quickfix for it, as the existing "Implement method" intention works just fine. The main value would be quick highlighting of places where more work needs to be done, always a good thing. It's also fits nicely with the existing "Interface never implemented" and "Abstract class never implemented" inspections, giving you great insight into places where you've left incomplete work. OTOH, there are some arguments for not doing it.

1) The code has no actual issues at the point of warning, only in the incompletely implemented subclasses.

2) The incompletely implemented already flagged as compile errors. I've stayed scrupulously away from reporting things that would be compile errors.

3)JetBrains presumably could have made this a built-in inspection, rather than a built-in intention, but chose not to. What do they know that I don't?

Thoughts?

--Dave Griffith

4 comments
Comment actions Permalink

+1

I've often found myself missing this.

/Kreiger



Attachment(s):
signature.asc
0
Comment actions Permalink

I've run into the same situation but I didn't think an inspection
would help me there.

Ideally, if I add a new method to an interface I'd like to have
some kind way to quickly know
1. the places where I should implement it,
2. an easy way to keep track of them and navigate
between them.

The inspection would solve 1 somewhat (although it's barely more
than the current intention) but would definitely not address 2. As soon
as I select to implement the method in a specific class and go to that
class, when I'm done I have to remember to go back to the interface
and check what's left to do.

Ideally some kind of toolwindow that would show me the places
left to be implemented and that I could use as a reminder and a
quick navigation tool (Ctrl-Alt-Up/Down maybe) would be great.
Having an intention to bring that toolwindow up would be helpful.
In a way it would be a sort of 'temporary todo' list just for a specific
task.

Note that the compile/go to build errors is a way of dealing with
this situation, but it's painful, ugly, slow and disruptive :)

Vince.



0
Comment actions Permalink

Perhaps something like this could be integrated into the
'Go To Implementation' functionality as well? Now the popup
shown by Go To Implementation shows all available implementations.
This could be modified to also show potential implementations,
i.e. all places where there should be an implementation.
Selecting one of the potential implementations would add an
implementation.

/Mikael

0
Comment actions Permalink

I think the functionality you are describing is already there in the
"Implement method" intention, invoked from the method declaration in the
interface.

N.

Mikael Karlsson wrote:

Perhaps something like this could be integrated into the
'Go To Implementation' functionality as well? Now the popup
shown by Go To Implementation shows all available implementations.
This could be modified to also show potential implementations,
i.e. all places where there should be an implementation.
Selecting one of the potential implementations would add an
implementation.

/Mikael

0

Please sign in to leave a comment.