Bug 98561 - [1.5][compiler] Erroneous build error using inner class of a parameterized type
Summary: [1.5][compiler] Erroneous build error using inner class of a parameterized type
Status: RESOLVED WORKSFORME
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 RC2   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-06 14:16 EDT by Tom Stamm CLA
Modified: 2005-06-09 06:02 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Stamm CLA 2005-06-06 14:16:03 EDT
The JDT gives a bogus build error if you have a parameterized class, which
contains an abstract inner class and a method that takes an object of that type
as a parameter; and a subclass creates an instance of that inner class and calls
the method on the base class. It says that the inner class instance of not
appropriate for the parameters of the method.

The same code compiles without a problem using Sun's javac. It also built on
eclipse 3.1m6, but is failing on 3.1RC1.

Here is a simple rero case - the second class, Bar, does not compile in the JDT:

public class Foo<T>
{
	protected abstract class InnerFoo
	{
		protected abstract void doSomething();
	}
	
	protected void run( InnerFoo innerFoo )
	{
		innerFoo.doSomething();
	}
}


public class Bar extends Foo<Integer>
{
	public void go()
	{
		InnerFoo inner = new InnerFoo()
		{
			protected void doSomething()
			{
				System.out.println( "hello" );
			}
		};
		run( inner );
	}
}

The error is on the call to run():

The method run(Foo.InnerFoo) in the type Foo<Integer> is not applicable for the
arguments (Foo<Integer>.InnerFoo)
Comment 1 Olivier Thomann CLA 2005-06-07 10:23:43 EDT
Could not reproduce in latest.
Comment 2 Philipe Mulet CLA 2005-06-09 06:02:56 EDT
Got fixed along with other changes.
Added GenericTypeTest#test721.