Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
An example of a non-terminating compilation with javac
/** from http://www.reddit.com/r/programming/comments/mlbna/scala_feels_like_ejb_2/c31z0co */
interface Pong<T> {}
class Ping<T> implements Pong<Pong<? super Ping<Ping<T>>>> {
static void Ping() {
Pong<? super Ping<Long>> Ping = new Ping<Long>();
}
}
> javac Ping.java
The system is out of resources.
Consult the following stack trace for details.
java.lang.StackOverflowError
at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:568)
at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3294)
at com.sun.tools.javac.code.Types$23.visitClassType(Types.java:2618)
at com.sun.tools.javac.code.Types$23.visitClassType(Types.java:2605)
at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:568)
at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3294)
at com.sun.tools.javac.code.Types$23.visitClassType(Types.java:2618)
at com.sun.tools.javac.code.Types$23.visitClassType(Types.java:2605)
at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:568)
at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3294)
at com.sun.tools.javac.code.Types$23.visitClassType(Types.java:2618)
at com.sun.tools.javac.code.Types$23.visitClassType(Types.java:2605)
at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:568)
at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:3294)
at com.sun.tools.javac.code.Types$23.visitClassType(Types.java:2618)
at com.sun.tools.javac.code.Types$23.visitClassType(Types.java:2605)
@mozillanerd

This comment has been minimized.

Copy link

mozillanerd commented Nov 23, 2011

Fun with Generics

@agentgt

This comment has been minimized.

Copy link

agentgt commented Nov 23, 2011

I have done this before for my little pet project JATL.

@pathikrit

This comment has been minimized.

Copy link

pathikrit commented Nov 24, 2011

class <___>{}class <>extends <<?super **<<___>>>>{void (){<? super _<>>=new ___<**>();}}

@pathikrit

This comment has been minimized.

Copy link

pathikrit commented Nov 24, 2011

class $<__>{}class €<£>extends $<$<?super €<€<£>>>>{void $(){$<? super €<$>>$=new €<$>();}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.