Bug 6977 organize imports imports unnecessary classes
I'm talking about integration build of December 11: Here is a code (for jdk1.4): ------------ import java.io.IOException; public class test1 { static Thread thr = new Thread() { public void run() { System.out.println("Shutting down"); try { int c = System.in.read(); System.out.println(c); } catch (IOException e) { } } }; int o = 5; /** * Method main. * * @param args */ public static void main(String[] args) { Runtime r = Runtime.getRuntime(); r.traceInstructions(true); r.traceMethodCalls(true); r.addShutdownHook(thr); System.out.println("Available procs: " + r.availableProcessors ()); System.out.println("Free Memory: " + r.freeMemory()/1024 + "Kb"); System.out.println("Total Memory: " + r.totalMemory()/1024 + "Kb"); System.out.println("Max Memory: " + r.maxMemory()/1024 + "Kb"); System.getProperties().list(System.out); try { System.in.read(); } catch (Exception e) { } } } ---------- end of example code ------ Pressing CTRL+SHIFT+O to organize imports adds the following two imports: import sun.security.krb5.internal.r; import sun.security.krb5.internal.crypto.c; for the "c" and "r" VARIABLES!. This is a bad bad thing...... Surprisingly it skips the "o" field....
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/ImportOrganizePreferencePage.java
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.help.DialogPageContextComputer;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.jdt.core.JavaConventions;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.JavaPluginImages;
import org.eclipse.jdt.internal.ui.JavaUIMessages;
import org.eclipse.jdt.internal.ui.dialogs.StatusInfo;
import org.eclipse.jdt.internal.ui.dialogs.StatusUtil;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.IListAdapter;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.LayoutUtil;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringDialogField;
import org.eclipse.jdt.internal.ui.wizards.swt.MGridData;
import org.eclipse.jdt.internal.ui.wizards.swt.MGridLayout;
/*
 * The page for setting the organize import settings
 */
public class ImportOrganizePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {