Skip to content

Instantly share code, notes, and snippets.

@lucamolteni
Created October 7, 2014 10:14
Show Gist options
  • Save lucamolteni/956e9e4ce1432a30b979 to your computer and use it in GitHub Desktop.
Save lucamolteni/956e9e4ce1432a30b979 to your computer and use it in GitHub Desktop.
Fun with generics
package it.lm;
public class Main {
public static void main(String[] args) {
B b = new B();
A<B> a = new A<B>(b);
C<A<B>> c = new C<A<B>>(a);
}
}
class B {
}
class A<S extends B> {
B s;
A(B s) {
this.s = s;
}
}
class C<S2 extends A<B>> {
A<B> a;
C(A<B> a) {
this.a = a;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment