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

Bug 155562

Summary: [extract interface] does not correctly update "for" loops if they are used with a "foreach" semantic
Product: [Eclipse Project] JDT Reporter: Arnaud Payement <arnaud.payement>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, milos.gligoric
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Arnaud Payement CLA 2006-08-29 12:00:30 EDT
Using M20060629-1905

If we use the Extract Interface refactoring on the following class "List" without selecting any member,

class List
{
  public void RemoveTail() {
  }
}

then, in the following class Test, the "for" construct is incorrectly updated.

class Test
{
  public static void main(String[] args)
  {
    List[] array = new List[10];
    for(List l : array)
    {
      l.RemoveTail();
    }
  }
}

After the refactoring we have:

class Test
{
  public static void main(String[] args)
  {
    IBag[] array = new IBag[10];
    for(IBag l : array)
    {
      l.RemoveTail();
    }
  }
}

But "l" does not contain a member RemoveTail.
Comment 1 Milos Gligoric CLA 2012-11-27 21:28:17 EST
The refactoring CANNOT be reproduced with:

Eclipse Java EE IDE for Web Developers.
Version: Juno Service Release 1
Build id: 20120920-080
Comment 2 Dani Megert CLA 2012-11-28 08:18:22 EST

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