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 262292

Summary: Organize Imports on save can break the code
Product: java Reporter: Maksim Khramov <mkhramov>
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 Maksim Khramov 2016-06-01 09:25:47 UTC
Product Version: NetBeans IDE Dev (Build 201606010002)
Java: 1.8.0_102; Java HotSpot(TM) 64-Bit Server VM 25.102-b08
Runtime: Java(TM) SE Runtime Environment 1.8.0_102-b08
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)

Steps to reproduce:

Take a source code:

package app.test.bulk.format;

import java.awt.*;
import java.util.*;
import java.util.List;

public class STest {

    private ArrayList<String> sarr;
    private List<String> strings;
    private Font font;

}

Enable Organize Imports on save option, made class modified and save it.
The java.util.List import is removed now and this breaks the code because the List class reference is ambiguous now.