Skip to content

Instantly share code, notes, and snippets.

@raphw
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raphw/972137a8f5cdcb294c29 to your computer and use it in GitHub Desktop.
Save raphw/972137a8f5cdcb294c29 to your computer and use it in GitHub Desktop.
Example for VerifierError when using method reference within a lambda before constructor is completed.
class Example {
Example(Function<Function<Function<Consumer<Void>, Void>, Void>, Void> innerClass) {
new InnerClass(innerClass);
}
void foo(Void v) { }
class InnerClass {
InnerClass(Function<Function<Function<Consumer<Void>, Void>, Void>, Void> factory) {
this(factory.apply(o -> o.apply(Example.this::foo)));
}
InnerClass(Void unused) { }
}
public static void main(String[] args) {
new Example(o -> null);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment