Bug 82053 - generic semantics have some problems
Summary: generic semantics have some problems
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: All Linux
: P3 critical (vote)
Target Milestone: 3.1 M5   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-31 15:43 EST by Eric Goff CLA
Modified: 2005-02-15 05:21 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Goff CLA 2004-12-31 15:43:44 EST
I have the following classes:
public class Foo {
	public interface Model {
	}
	public interface View<M extends Model> {
		M getTarget() ;
	}
}
public class Bar {
	public interface Model extends Foo.Model {
	}
	public interface View<M extends Model> extends Foo.View<M> {
	}
}
public class usettestclass {
	public static void main(String[] args) {
		Bar.View<?> bv = null ;
		Bar.Model m = bv.getTarget() ;
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                Type mistmatch
	}
}

This should not be a type mismatch, and it works just fine with sun compiler.
Comment 1 Philipe Mulet CLA 2005-01-03 07:34:02 EST
Reproduced in latest.
Comment 2 Philipe Mulet CLA 2005-01-03 12:59:12 EST
Added regression test: GenericTypeTest#test442.

Problem is located in wildcard relocation when creating parameterized type
bindings, this should not occur, and was introduced to address bug 76434, which
got revised.

Removing relocation addresses the problem, the wildcard is properly remembering
its origin and is thus compatbile as expected with variable type.

Fixed
Comment 3 Jerome Lanneluc CLA 2005-02-15 05:21:49 EST
Verified in I20050214