Bug 32250

Summary: Reporting unused private methods could be improved
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: akiezun
Version: 2.1   
Target Milestone: 2.1 RC2   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

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 ***