Unfortunately, infinite types are more common in Java than one might expect. So, we have to support it: currently, the compiler will loop. For reasons I don’t understand, the stack doesn’t even overflow, so your computer stays very busy.

Example: The expression “bool : ? Boolean : Long” produces an infinite type:

Serializable & Comparable<? extends Serializable & Comparable<? extends … >>

EJC’s lub chooses Comparable<?>, which is wrong afaik.

Javac’s lub seems to ‘stop’ the infinite type by choosing a wildcard, which is also wrong afaik.
———————————————-
martin@logistico:~/tmp> javac Foo.java
Foo.java:9: incompatible types
found : java.lang.Object&java.io.Serializable&java.lang.Comparable>
required: java.lang.Integer
Integer foo = b ? bref : lref;
———————————————-

I think this is related to:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4993221

If I understand that issue correctly, then javac does not really support infinite type in Tiger (scheduled for Mustang)

Submitted on 21 August 2005 at 22:48

Log in to post comments