Bug 106865 - [1.5][compiler] capture conversion doesn't handle array types
Summary: [1.5][compiler] capture conversion doesn't handle array types
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1.1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-12 11:49 EDT by Olivier Thomann CLA
Modified: 2005-09-26 11:36 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 Olivier Thomann CLA 2005-08-12 11:49:41 EDT
The following code doesn't compile:

class Y<E> {
	void foo(E e) {
	}
}
class X {
    void method(Y<? super Object[]> y) {
        y.foo(new Object[]{});
    }
}

We report:
----------
1. ERROR in d:\tests_sources\X.java
 (at line 7)
	y.foo(new Object[]{});
	  ^^^
The method foo(capture-of ? super Object[]) in the type Y<capture-of ? super
Object[]> is not applicable for the arguments (Object[])
----------
1 problem (1 error)
Comment 1 Philipe Mulet CLA 2005-08-12 16:12:45 EDT
Indeed this should be allowed. Note that javac also rejects it, likely the same
bug we do have.

Tuned ArrayBinding compatibility check against captures to check lower bounds.
Added GenericTypeTest#test803.

Comment 2 Philipe Mulet CLA 2005-08-12 16:25:45 EDT
Test is actually #test804
Comment 3 Philipe Mulet CLA 2005-08-12 16:31:06 EDT
Matching bug for javac is http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6268476
Comment 4 Philipe Mulet CLA 2005-08-15 19:09:57 EDT
fixed
Comment 5 David Audel CLA 2005-09-21 10:27:19 EDT
Verified in I20050921-0010 for 3.2M2
Comment 6 Olivier Thomann CLA 2005-09-26 11:36:53 EDT
Verified for 3.1.1 using M20050923-1430.