Bug 78075 - normal and static import of the same class doesn't work correctly
Summary: normal and static import of the same class doesn't work correctly
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-08 10:32 EST by Boris Kolar CLA
Modified: 2004-12-14 11:05 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 Boris Kolar CLA 2004-11-08 10:32:19 EST
Let's have 2 imports of the same class:

import com.somecompany.SomeClass.*;
import static com.somecompany.SomeClass.*;

public class Test {
  public void test() {
    staticMethodFromSomeClass(); // eclipse reports error, javac doesn't
  }
}

If you reorder imports (or remove nonstatic one) it will work ok:
import static com.somecompany.SomeClass.*;
import com.somecompany.SomeClass.*; // obsolete import
Comment 1 Olivier Thomann CLA 2004-11-16 21:55:43 EST
The first import is incorrect.
It should be:
import com.somecompany.*;

It should not be possible to use such an import if the import is not static.
Comment 2 Kent Johnson CLA 2004-11-17 14:42:10 EST
Added StaticImport test 15
Comment 3 Olivier Thomann CLA 2004-12-14 11:05:44 EST
Verified in 200412140800