Bug 480620 - Provide "find unused methods" action
Summary: Provide "find unused methods" action
Status: CLOSED DUPLICATE of bug 172595
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.5   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.6   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-26 05:16 EDT by Lars Vogel CLA
Modified: 2015-10-29 22:53 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2015-10-26 05:16:10 EDT
Finding unused public methods (in the current workspace) is relatively hard to do in JDT. In platform.runtime we have the org.eclipse.core.tools plug-in which provides such an action. 

I would like to contribute that to JDT to make it general available. JDT committers please let me know if you would accept such a contribution. If yes, I prepare a Gerrit review.
Comment 1 Dani Megert CLA 2015-10-26 06:42:20 EDT
(In reply to Lars Vogel from comment #0)
> Finding unused public methods

How would you know it is unused?
Comment 2 Lars Vogel CLA 2015-10-26 06:47:37 EDT
(In reply to Dani Megert from comment #1)
> (In reply to Lars Vogel from comment #0)
> > Finding unused public methods
> 
> How would you know it is unused?

In the current workspace you mean? The plug-in searches iterative for all callers, via JDT API. See org.eclipse.core.tools.search.FindUnusedMembers in platform.runtime
Comment 3 Dani Megert CLA 2015-10-26 06:53:30 EDT
(In reply to Lars Vogel from comment #2)
> (In reply to Dani Megert from comment #1)
> > (In reply to Lars Vogel from comment #0)
> > > Finding unused public methods
> > 
> > How would you know it is unused?
> 
> In the current workspace you mean?

No, in general. You will never have a complete workspace, and even if, the search would also have to deal with how the package is exported.
Comment 4 Lars Vogel CLA 2015-10-26 06:58:02 EDT
(In reply to Dani Megert from comment #3)
> No, in general. You will never have a complete workspace, and even if, the
> search would also have to deal with how the package is exported.

That is true, but the same applies for all other actions, like search, type hierarchy, etc. Also "exported packages" is something OSGi specific, and not yet available for Java.
Comment 5 Dani Megert CLA 2015-10-26 07:07:00 EDT
(In reply to Lars Vogel from comment #4)
> (In reply to Dani Megert from comment #3)
> > No, in general. You will never have a complete workspace, and even if, the
> > search would also have to deal with how the package is exported.
> 
> That is true, but the same applies for all other actions, like search, type
> hierarchy, etc. Also "exported packages" is something OSGi specific, and not
> yet available for Java.

We don't want to provide such an action. See also bug 172595 comment 1.

*** This bug has been marked as a duplicate of bug 172595 ***
Comment 6 Timo Kinnunen CLA 2015-10-29 22:53:43 EDT
(In reply to comment #5)
> We don't want to provide such an action. See also bug 172595 comment 1.

Yeah, it should really be a Quick Fix instead.