Bug 32250 - Reporting unused private methods could be improved
Summary: Reporting unused private methods could be improved
Status: RESOLVED DUPLICATE of bug 31765
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 RC2   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-19 11:08 EST by Olivier Thomann CLA
Modified: 2003-03-17 11:15 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2003-02-19 11:08:59 EST
Using 0218, I found a case where I would still expect the private method to be
unused.
1) Create a class A with the following code:
public class A {
	
	private void foo() {
	}
}
2) Set the compiler to report an error for unused private methods.
3) You get an error for foo().
4) Now replace it with this code:
public class A {
	
	private void foo() {
		foo();
	}
}
5) You don't get an error anymore, but clearly the method foo could be removed,
because it is used only in foo.
I am not sure if this is a bug or an enhancement.
Comment 1 Philipe Mulet CLA 2003-02-19 12:04:49 EST
Yes, we don't deal with direct recursions (would be harder to detect indirect 
recursions).
Comment 2 Adam Kiezun CLA 2003-02-19 12:12:22 EST
see bug 31765 

i understand that indirect is a problem
but even detecting direct recursion would be an improvement
Comment 3 Philipe Mulet CLA 2003-02-19 12:21:22 EST
Maybe we should only consider direct recursions.

*** This bug has been marked as a duplicate of 31765 ***