Bug 151967 - [1.5][assist] Code completion with enumerations implementing an interface
Summary: [1.5][assist] Code completion with enumerations implementing an interface
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.4 M1   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-27 04:41 EDT by Mauro Molinari CLA
Modified: 2007-08-03 07:27 EDT (History)
0 users

See Also:


Attachments
Proposed fix (6.04 KB, patch)
2007-06-27 09:29 EDT, David Audel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mauro Molinari CLA 2006-07-27 04:41:28 EDT
Hello!
Suppose you have an enumeration that is implementing an interface:

public interface InterfaceA
{
  void a();
  void b();
}

public enum EnumB implements InterfaceA
{
  B1
  {
    public void b()
    {
      // do something for B1
    }
  }, 
  B2{
    public void b()
    {
      // do something for B2
    }
  };

  public void a()
  {
    // do something in common
  }
}

Now suppose you are using EnumB enumeration values from within a class:

public class ClassC
{
  public ClassC()
  {
    EnumB.B1.a();
    EnumB.B1.b();
  }
}

Code completion for the first line (EnumB.B1.a()) works, while it does not for the second one (EnumB.B1.b()). Anyway, the compiler works well, because neither errors nor warnings are given for the second line.

I hope to have been of help.
Mauro.
Comment 1 David Audel CLA 2007-06-27 09:29:30 EDT
Created attachment 72597 [details]
Proposed fix
Comment 2 David Audel CLA 2007-06-27 09:34:31 EDT
Released for 3.4M1.

Test added:
  CompletionTests_1_5#test0334() -> test0335().

Proposal inference must search in superinterfaces when the receiver type is an enum.
Comment 3 Frederic Fusier CLA 2007-08-03 07:27:36 EDT
Verified for 3.4M1 using build I20070802-0800.