This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 268675 - Wrong imports order
Summary: Wrong imports order
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-25 12:24 UTC by linelect
Modified: 2016-10-25 12:24 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description linelect 2016-10-25 12:24:11 UTC
If we try organize imports - we get wrong order.
For example:

NetBeans before organize imports:
import com.company.data.Byte;
import com.company.data.Class;
import com.company.zata.Long;
import com.company.zata.Short;
import com.company.data.*;
import com.company.zata.*;

NetBeans after organize imports:
import com.company.data.Byte;
import com.company.data.Class;
import com.company.data.*;
import com.company.zata.*;
import com.company.zata.Long;
import com.company.zata.Short;

This is wrong order, the correct result will be:
import com.company.data.Byte;
import com.company.data.Class;
import com.company.data.*;
import com.company.zata.Long;
import com.company.zata.Short;
import com.company.zata.*;

This rule order should work also with static imports.

P.S.: Why the hell we should import com.company.data.Class when we already imported com.company.data.*?
It's because java.lang.* (and java.lang.Class) imported implicitly.
If we don't import com.company.data.Class then compiler assumes that we refer to java.lang.Class.
And we cannot rename the class "Class" because it's in external library


My NetBeans version:
Product Version: NetBeans IDE 8.2 (Build 201609300101)
Java: 1.8.0_65; Java HotSpot(TM) 64-Bit Server VM 25.65-b01
Runtime: Java(TM) SE Runtime Environment 1.8.0_65-b17
System: Windows 7 version 6.1 running on amd64; Cp1251; ru_RU (nb)