Bug 112666 - [1.5][compiler] Compiler rejects valid assignment to complex capture
Summary: [1.5][compiler] Compiler rejects valid assignment to complex capture
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.2   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-14 13:22 EDT by Markus Keller CLA
Modified: 2006-01-10 10:34 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 Markus Keller CLA 2005-10-14 13:22:48 EDT
v_616

import java.util.Collection;

public class Try {
    void m() {
        Collection<? super Collection<? super Number>>
coll_lower_coll_lower_number= null;
        java.util.List<java.lang.Number> n= null;
        coll_lower_coll_lower_number.add(n);
    }
}

Eclipse 3.1.1 and java 1.5.0_05 accept this, but with the current build, I get:
"The method add(capture-of ? super Collection<? super Number>) in the type
Collection<capture-of ? super Collection<? super Number>> is not applicable for
the arguments (List<Number>)"

There are a bunch of similar cases of nested wildcards, which also fail. You can
 extract them from the stdout of our TypeEnvironmentTests in
org.eclipse.jdt.ui.tests.refactoring
Comment 1 Philipe Mulet CLA 2005-10-17 03:46:11 EDT
Related to fix for bug 111208.
Comment 2 Philipe Mulet CLA 2005-10-17 04:28:40 EDT
Changed CaptureBinding to only recapture the wildcard bound if the wildcard is
extending its bound.

Added GenericTypeTest#test846-847.
Fix released both in HEAD/3.2 and 3.1.2 streams.
Comment 3 Olivier Thomann CLA 2006-01-09 11:05:24 EST
Verified for 3.1.2 in M20060109-0800.
Comment 4 Olivier Thomann CLA 2006-01-10 10:34:42 EST
Verified for 3.2M4 in I20051215-1506