Bug 106865

Summary: [1.5][compiler] capture conversion doesn't handle array types
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.2   
Target Milestone: 3.1.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

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.