Skip to content

Instantly share code, notes, and snippets.

@DeepSpawn
Last active September 28, 2016 23:48
Show Gist options
  • Save DeepSpawn/d88033adac54ccb1fcefa61376af4dc3 to your computer and use it in GitHub Desktop.
Save DeepSpawn/d88033adac54ccb1fcefa61376af4dc3 to your computer and use it in GitHub Desktop.
public abstract class Parent<T> {
public abstract Parent<T> goodMethod(Function<Integer, Parent<T>> f);
public abstract <TT extends T> Parent<TT> badMethod(Function<Integer, Parent<TT>> f);
private static final class Child<T> extends Parent<T> {
T value;
@Override
public Parent<T> goodMethod(final Function<Integer, Parent<T>> f) {
return this; //compile
}
@Override
public <TT extends T> Parent<TT> badMethod(final Function<Integer, Parent<TT>> f) {
return this; //does not compile
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment