[Java Spec Report] Java 1.5 subtyping rules undecidable?

"Neal Gafter" <[email protected]> Wed, 22 Dec 2004 19:14:38 -0000
Newsgroups gmane.comp.java.spec-report
Message-ID <[email protected]>

Martin Odersky found that the Java 1.5 subtyping rules are undecidable
as written.  These examples are unlikely to occur "in the wild", and
it is likely some unburdensome restrictions on F-bounds can be added
to the spec to avoid these situations.  Here's a simplified
example of the problem:

class F<T> {}
class C<X extends F<F<? super X>>> {
   C(X x) {
       F<? super X> f = x;
   }
}

To verify that

 X <: F<? super X>

we need to unfold X to its upper bound, yielding:

 F<F<? super X>>> <: F<? super X>

This leads back to the original problem:

 X <: F<? super X>

The correct answer, incidentally, is that the subtype relation does
not hold. JDK5 javac goes into an infinite recursion on this example.





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/5cFolB/TM
--------------------------------------------------------------------~-> 

To unsubscribe from this mailing list, send an email to:
[email protected]
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/java-spec-report/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/