Skip to content

Instantly share code, notes, and snippets.

@hjanetzek
Last active December 29, 2015 19:10
Show Gist options
  • Save hjanetzek/7715486 to your computer and use it in GitHub Desktop.
Save hjanetzek/7715486 to your computer and use it in GitHub Desktop.
OpenJDK fail?
package eeek;
public class Test {
abstract class Inlist<T> {
T next;
}
abstract class Pool<T extends Inlist<T>> {
abstract T get();
}
class Wupp extends Inlist<Wupp> {
public String m = "Ho!";
}
Pool<Wupp> pool = new Pool<Test.Wupp>() {
public Wupp get() {
return new Wupp();
}
};
void test() {
Wupp a = pool.get();
Wupp b;
b = a.next = pool.get();
System.out.println(b.m);
}
public static void main(String[] args) {
new Test().test();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment