Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 300802

Summary: CodeCompletion deletes characters after insertion position when organizing imports
Product: [Eclipse Project] JDT Reporter: Heiko Böttger <heiko.boettger>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Heiko Böttger CLA 2010-01-26 07:39:29 EST
Build Identifier: 20090920-1017

package test;

import java.util.LinkedList;

/**
 * precondition:
 * 
 * Set "Number of Imports needed for .*" in 
 *    Window/Preferences/Java/Code Style/Organize Imports to "2"
 * 
 * a)
 * 
 * 1. Open ContentAssist behind the 'y' on the line with "new Array"
 *    by pressing Ctrl+Space
 * 2. select "ArrayList" and press "enter"
 * 
 * result:
 * 
 * the curly bracket "}" in the line after "new Array" moved up
 * 
 * b) 
 *  
 * 1. Set caret behind "new Array" and write "List(10)" to it, so that you have
 *    "new ArrayList(10);" (Don't use the ContentAssist)
 * 2. Set the caret behind "new ArrayList" and press Ctrl+Space
 *    to immediately add the imports
 * 
 * result:
 * 
 * the text behind the "new ArrayList()" is overwritten
 * 
 * notes: 
 * 
 * - undo step a) before trying step b), otherwise the imports are already there
 * - add the imports "java.util.AbstractMap" and "java.util.Collection" and
 *   everything seems to be normal
 * - Java Class with less then 32 lines doesn't seem to have this problem
 * 
 * @author Heiko
 */
public class OrganizeImports {
  public static void main(String[] args) {
    new LinkedList<String>();
    new Array
  }
}


Reproducible: Always
Comment 1 Dani Megert CLA 2010-01-26 08:18:14 EST

*** This bug has been marked as a duplicate of bug 285137 ***