Bug 81718 - [1.5] "Static import never used" warning disappears when variable of same name is declared
Summary: [1.5] "Static import never used" warning disappears when variable of same nam...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux
: P3 minor (vote)
Target Milestone: 3.1 M5   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-21 04:43 EST by Ingo Maier CLA
Modified: 2005-02-15 05:23 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 Ingo Maier CLA 2004-12-21 04:43:13 EST
import static java.lang.Math.PI;

public class Foo {}

gives a warning, that the static import is never used (OK). If you declare a PI,
the warning disappears (not OK):

import static java.lang.Math.PI;

public class Foo {
  boolean PI;
}

It seems that it does not matter where such a variable is declared in the
compilation unit the warning always disappears.

Note: you can use PI from Math in a different scope (OK):

import static java.lang.Math.PI;

public class Foo {
  double d = PI; // from Math

  void f() {
    boolean PI;
  }
}

class Bla {
  double d = PI; // from Math
}
Comment 1 Philipe Mulet CLA 2005-01-04 05:19:09 EST
The field hiding detection support is causing the unused import to be used.
Comment 2 Philipe Mulet CLA 2005-01-04 05:23:07 EST
Fixed along with bug 81724.
Comment 3 Philipe Mulet CLA 2005-01-04 05:23:44 EST
Added regression test: StaticImportTest#test019.
Fixed
Comment 4 Jerome Lanneluc CLA 2005-02-15 05:23:42 EST
Verified in I20050214