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

Summary: Wrong imports order
Product: java Reporter: linelect
Component: EditorAssignee: Dusan Balek <dbalek>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.2   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

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)