Bug 92982 - [1.5][compiler] Bounds and erasure of capture and type variable bindings
Summary: [1.5][compiler] Bounds and erasure of capture and type variable bindings
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 M7   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 88202
Blocks:
  Show dependency tree
 
Reported: 2005-04-27 14:58 EDT by Markus Keller CLA
Modified: 2005-05-11 13:26 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2005-04-27 14:58:24 EDT
I20050426-1700

I'm a bit confused about bounds and erasure of capture, type variable and
wildcard bindings. Consider this example:

public class Try<T extends Collection> {
	void m() {
		List<? extends Collection> wild= null;
		Collection c= wild.get(0);
		
		List<T> var= null;
		Collection c2= var.get(0);
	}

Calling ITypeBinding#getBounds() on the type bindings of expressions wild.get(0)
and var.get(0) currently returns java.lang.Object as first bound of the capture
/ type variable bindings.
=> Why is the first bound not Collection (as in JLS3 / java.lang.reflect)?

ITypeBinding#getErasure() says it "returns the binding for the erasure of the
leftmost bound ...", but for the bindings from above, it returns Collection.
=> Javadoc and implementation not in sync.
Comment 1 Philipe Mulet CLA 2005-04-28 10:51:45 EDT
Added GenericTypeTest#test632-633.
Tuned compatibility check against array bounded captures.
Comment 2 Philipe Mulet CLA 2005-04-28 10:52:00 EDT
Fixed
Comment 3 Markus Keller CLA 2005-04-29 05:36:04 EDT
Philippe, your comment 1 seems to be targeted at bug 93082 rather than this one,
right?
Comment 4 Philipe Mulet CLA 2005-04-29 07:20:01 EDT
Oops. Thanks for noticing.
Comment 5 Philipe Mulet CLA 2005-04-29 07:49:35 EDT
Added ASTConverter15Test#test174&176.
Fixed, expected values are now answered.
Comment 6 Olivier Thomann CLA 2005-05-11 13:26:43 EDT
Verified in I20050510-0010