Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jdt-core-dev] Fw: Adding wildcards to 1.5 branch



The previous code is now supported with latest changes released in JDK1_5
branch.

----- Forwarded by Philippe P Mulet/France/IBM on 03/29/2004 05:25 PM -----
                                                                           
             Philippe P                                                    
             Mulet/France/IBM                                              
                                                                        To 
             03/26/2004 02:01          jdt-core-dev@xxxxxxxxxxx            
             PM                                                         cc 
                                                                           
                                                                   Subject 
                                       Adding wildcards to 1.5 branch      
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           



Still not done with wildcards, though making progress...
We still reject the following program, which we shouldn't...

public class X <T> {
    T t;
    X(T t){
        this.t = t;
    }
    public static void main(String[] args) {
            X<? extends AX> x = new X<AX<String>>(new AX<String>());
            x.t.foo();
            System.out.println("SUCCESS");
      }
}

class AX<P> {
    P foo() { return null; }
}




----------
1. ERROR in d:\eclipse\workspaces\dev3.0-1.5\plugins\Crap\src\X.java (at
line 7)
      X<? extends AX> x = new X<AX<String>>(new AX<String>());
                      ^
Type mismatch: cannot convert from X<AX<String>> to X<? extends AX>
----------
2. ERROR in d:\eclipse\workspaces\dev3.0-1.5\plugins\Crap\src\X.java (at
line 8)
      x.t.foo();
          ^^^
The method foo() is undefined for the type ? extends AX
----------
2 problems (2 errors)



Back to the top