Bug 7165 - erroneous warning of unused variables
Summary: erroneous warning of unused variables
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Linux
: P3 minor (vote)
Target Milestone: 2.0 M2   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-12-21 13:57 EST by Alex Cozzi CLA
Modified: 2002-01-11 08:32 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Cozzi CLA 2001-12-21 13:57:48 EST
U am using eclipse 2.0 build 20011219 on debian linux.


I have enabled the warning about unused variables, and there are some instances
when eclipse flags some variables as unused in inappropriate cases.

Some examples:
    public static void test () {
        int i = 17;
        final int j = 15; 
        
        switch (i) {
        case j: i++;
        }
    }
eclipse flags j as unused variable

  public static void main(String[] args)
  {
    AgathaUI agathaUI = new AgathaUI();
    
  }

Here agathaUI is marked as unused.


  public void ComputeExcitation()
  {
	ranking.setAlgorithm(Ranking.ALGORITHM_EXCITATION);
    double authority;
    Node best;
    ranking.compute(dot);
    ranking.printAuthorities();
    best = ranking.getAuthority(0);
    assertEquals(dot_node, best);
    ranking.compute(arc);
    ranking.printAuthorities();
    best = ranking.getAuthority(0);
    assertEquals(arc_node1, best);
    authority = NodeUtils.getValue(ranking.getAuthority(0), Ranking.AUTHORITY_ATTR);
	ranking.compute(path);
    ranking.printAuthorities();
	best = ranking.getAuthority(0);
	assertEquals(path_node2, best);
  }

Here authority is marked as unused.
Comment 1 Philipe Mulet CLA 2002-01-07 07:02:14 EST
The first scenario is indeed a bug, the last 2 ones are the same pattern: a 
variable is assigned but never read from.
Comment 2 Philipe Mulet CLA 2002-01-07 07:12:27 EST
Fixed only the first scenario as per previous note.