Bug 101380 - [1.5][compiler] Problem when implementing generic interface with method that has enum parameter
Summary: [1.5][compiler] Problem when implementing generic interface with method that ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1.1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 101473 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-06-22 19:48 EDT by Emerson Murphy-Hill CLA
Modified: 2005-09-26 10:00 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Emerson Murphy-Hill CLA 2005-06-22 19:48:45 EDT
Problem with code similar to:

public class MyClass implements MyInterface{

	public void myMethod(myEnum value) {
		System.out.println("value is "+value);
	}

	public static void main(String[] args){
		new MyClass().myMethod(myEnum.one);		
	}
}

interface MyInterface<T> {

	enum myEnum {one,two};
	
	public void myMethod(myEnum value); 
}

Says "The type MyClass must implement the inherited abstract method
MyInterface.myMethod (MyInterface.myEnum)"

3.1/RC3
Comment 1 Dirk Baeumer CLA 2005-06-23 04:51:10 EDT
Looks like a compiler problem.
Comment 2 Markus Keller CLA 2005-06-23 05:00:07 EDT
May be related to bug 100546, since enums are implicitly static.
Comment 3 Jerome Lanneluc CLA 2005-06-23 05:03:55 EDT
javac accepts this code
Comment 4 Emerson Murphy-Hill CLA 2005-06-23 11:31:01 EDT
*** Bug 101473 has been marked as a duplicate of this bug. ***
Comment 5 Kent Johnson CLA 2005-07-06 13:07:56 EDT
Philippe: we are getting thrown off because the 2 methods appear to have 
different parameters.

The method myMethod from MyClass has a ParameterizedType myEnum, but the 
method myMethod from MyInterface#RAW has myEnum#RAW as its parameter.

Should MyClass.myMethod pick up myEnum as a Parameterized type? It looks like 
it should be a raw type...
Comment 6 Kent Johnson CLA 2005-07-06 13:17:44 EDT
We have the same problem with raw member types.

class Y implements I {
  // is not I.M#RAW but is Parameterized M inside I#RAW
  public void x(M value) {}
}
interface I<T> {
  class M {}
  void x(M value); 
}
Comment 7 Kent Johnson CLA 2005-07-06 13:35:01 EDT
Philippe: Please look at ParamaterizedTypeBinding.memberTypes()

It is not overridden in RawTypeBinding.

Why should a RawTypeBinding's member types not be raw types also?
Comment 8 Philipe Mulet CLA 2005-09-08 05:06:46 EDT
Actually, the bug comes from the other side. The reference to non-generic member
of raw type should be a ParameterizedTypeBinding with raw enclosing type, and
null arguments (denoting these special constructs). 
Problem comes from Scope.substitute(...) of a generic type.
Comment 9 Philipe Mulet CLA 2005-09-08 06:43:28 EDT
Added GenericTypeTest#test819-820.
Fixed in 3.1.x and 3.2.0 streams.
Comment 10 David Audel CLA 2005-09-21 09:53:19 EDT
Verified in I20050920-0010 for 3.2M2
Comment 11 David Audel CLA 2005-09-26 10:00:41 EDT
Verified using M20050923-1430 for 3.1.1