mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 18:14:38 +02:00
8261006: 'super' qualified method references cannot occur in a static context
Reviewed-by: sadayapalam
This commit is contained in:
parent
99d7f9a772
commit
c962e6ec0b
3 changed files with 36 additions and 3 deletions
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8261006
|
||||
* @summary 'super' qualified method references cannot occur in a static context
|
||||
* @compile/fail/ref=MethodReferenceInConstructorInvocation.out -XDrawDiagnostics MethodReferenceInConstructorInvocation.java
|
||||
*/
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class MethodReferenceInConstructorInvocation {
|
||||
interface Bar {
|
||||
default String getString() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
static class Foo implements Bar {
|
||||
|
||||
Foo() {
|
||||
this(Bar.super::getString);
|
||||
}
|
||||
Foo(Supplier<String> sString) {}
|
||||
|
||||
Foo(int i) { this(Bar.super.getString()); }
|
||||
Foo(String s) {}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue