Bug 182430 - [compiler] Improve dead code detection of private methods in cyclic call hierarchy
Summary: [compiler] Improve dead code detection of private methods in cyclic call hier...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-14 06:13 EDT by F. H. CLA
Modified: 2008-08-25 06:12 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 F. H. CLA 2007-04-14 06:13:31 EDT
Two methods, whose visibility modifiers are set to "private" and which are only referred to mutually, should be marked as dead code. See the following example:

public class Test {

    private void foo() {
        bar();
    }
    
    private void bar() {
        foo();
    }
    
    private void foobar() { // The method ... is never used locally
        foobar();
    }
}


The methods foo and bar form a cyclic call hierarchy with two elements, but are not marked as unused private members.  The method foobar forms a cyclic call hierarchy with one element and is correctly detected as dead code.  The unused code detection should of course include cyclic call hierarchies with an arbitrary number of elements and for that case provide an appropriate warning message (because the method is used locally but not reachable).