RFR: 8261006: 'super' qualified method references cannot occur in a static context

Vicente Romero vromero at openjdk.java.net
Fri Jun 25 15:35:05 UTC 2021


On Thu, 24 Jun 2021 05:19:58 GMT, Srikanth Adayapalam <sadayapalam at openjdk.org> wrote:

> Also this test case:
> 
> ```
> import java.util.function.Supplier;
> 
> public class X {
> 
>     interface Feature {
>         default String getString() {
>             return "Hello World";
>         }
>     }
> 
>     private static class Broken implements Feature {
>         private final String sString;
> 
>         public Broken() {
>             this(Feature.super.getString());
>         }
> 
>         public Broken(String sString) {
>             this.sString = sString;
>         }
>     }
> }
> ```
> 
> compiles both with JDK16 and your patch.
> 
> Should we actually compile it ???

my patch is focusing on `super` qualified method references this example won't stress my code, and it is correct to be accepted anyway as the method being invoked is `static`

-------------

PR: https://git.openjdk.java.net/jdk/pull/4376


More information about the compiler-dev mailing list