Bug 76786

Summary: [1.5] Generics processing broken for simple test case.
Product: [Eclipse Project] JDT Reporter: R Lenard <rlenard>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M3   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description R Lenard CLA 2004-10-22 00:34:12 EDT
/*
 * Created on Oct 22, 2004
 */

import java.lang.Comparable;

/**
 * This shows some bad template resolution.
 * It gives this error, but javac compiles it succesfully and it looks like it 
should be valid.
 * The method doSomethingElse(BadTemplateResolution.Z<V1,V2>, 
BadTemplateResolution.Z<V1,V2>) in the type BadTemplateResolution is not 
applicable for the arguments 
(BadTemplateResolution.Z<BadTemplateResolution.X<BadTemplateResolution.W,BadTemp
lateResolution.W>,String>, 
BadTemplateResolution.Z<BadTemplateResolution.X<BadTemplateResolution.W,BadTempl
ateResolution.W>,String>)
 */
public class BadTemplateResolution
{
    private static final class X<T1, T2> implements Comparable<X<T1, T2>> {
        public int compareTo(X<T1, T2> arg0)
        {
            return 0;
        }
        
    };
    
    private static class Y<T1, T2> {
        
    };
    
    private static final class Z<T1, T2> extends Y<T1, T2> implements 
Comparable<Z<T1, T2>> {
        public int compareTo(Z<T1, T2> arg0)
        {
            return 0;
        }
        
    };
    
    public static <T> void doSomething(Comparable<? super T> a, Comparable<? 
super T> b) {
    }
    
    public static <V1, V2> void doSomethingElse(Z<V1, V2> a, Z<V1, V2> b) {
        doSomething(a, b);
    }
    
    private static final class W { };
    
    public static void main(String[] args) {
        doSomething(new X<Integer, String>(), new X<Integer, String>());
        doSomething(new Z<Integer, String>(), new Z<Integer, String>());
        doSomethingElse(new Z<Integer, String>(), new Z<Integer, String>());
        doSomethingElse(new Z<W, String>(), new Z<W, String>());
        // The next line won't compile.  It's the generic<generic which seems
        // to be the problem
        doSomethingElse(new Z<X<W, W>, String>(), new Z<X<W, W>, String>());
    }
}
Comment 1 Frederic Fusier CLA 2004-10-27 07:39:15 EDT
It works with last integration build: I200410260800.
Comment 2 Frederic Fusier CLA 2004-10-29 13:06:14 EDT
Test case test0360 added in GenericTypeTest.