Created
August 13, 2014 18:29
-
-
Save knjname/777891e81dd5a5dd7ba7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A { | |
String u; | |
A(Object s){ | |
System.out.println("A.new() with " + s); | |
} | |
String p(){return "p";} | |
} | |
@FunctionalInterface | |
interface Produce<T> { | |
T produce(); | |
} | |
class B extends A { | |
class C { | |
C(){} | |
} | |
String f; | |
B(){ | |
// Any of these are not legal. | |
// super(super.u); | |
// super(this); | |
// super(this.f); | |
// super(sayHello()); | |
// super(new C()); | |
// super(((Produce<String>)(() -> this.f)).produce()); | |
// super(((Produce<String>)(() -> new C())).produce()); | |
// super(new Produce() { | |
// @Override | |
// public Object produce() { | |
// return B.this; | |
// } | |
// }); | |
// super(new Produce() { | |
// @Override | |
// public Object produce() { | |
// return B.this.new C(); | |
// } | |
// }); | |
// super((Produce<C>)C::new); | |
// super((Produce<C>)super::p); | |
// Also illegal. | |
// if(true) super(""); | |
// This is legal. | |
// super(sayGoodbye()); | |
} | |
static String sayGoodbye(){ | |
return "see you"; | |
} | |
String sayHello(){ | |
return "hello"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment