JDK-6431473 : javac generics compilation problem
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0u6
  • Priority: P3
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: generic
  • CPU: generic
  • Submitted: 2006-05-29
  • Updated: 2010-07-29
  • Resolved: 2006-06-08
Related Reports
Relates :  
Description
This Code is valid Tiger+ Java:

public class TestCase<B>
{
    interface Base
    {
    }

    interface Interface extends Base
    {
    }

    static class Implementation implements Interface
    {
    }

    <T extends B, E extends T> E returnArg(Class<T> c, E e)
    {
        // do something with c
        return e;
    }

    public static void main(String[] args)
    {
        TestCase<Base> tc = new TestCase<Base>();
        tc.returnArg(Interface.class, new Implementation());
    }
}

but the compiler gives:

TestCase.java:28: <T,E>returnArg(java.lang.Class<T>,E) in TestCase<TestCase.Base> cannot be applied to (java.lang.Class<TestCase.Interface>,TestCase.Implementation)
        tc.returnArg(Interface.class, new Implementation());
          ^
1 error

Comments
EVALUATION This is not reproducible in Mustang. It is likely that it was the fix for 6359106.
08-06-2006