mixing method ref syntax and assignment

Vicente Romero vicente.romero at oracle.com
Sat Sep 29 17:44:01 UTC 2018


Hi Remi,

Thanks for the report. I will take a look at it,
Vicente

On 09/29/2018 01:08 PM, Remi Forax wrote:
> Hi Vicente,
> obviously the code below shoud be rejected because it mixes the method ref syntax with a kind of assignment, but currently javac doesn't like it at all !
>
> public class Main {
>    /*private static void all() {
>      
>    }*/
>    
>    public static void main(String[] args) = Main.all();
> }
>
> An exception has occurred in the compiler (12-amber). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
> java.lang.AssertionError
> 	at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
> 	at jdk.compiler/com.sun.tools.javac.util.Assert.check(Assert.java:46)
> 	at jdk.compiler/com.sun.tools.javac.parser.JavacParser.methodDeclaratorRest(JavacParser.java:3957)
> 	at jdk.compiler/com.sun.tools.javac.parser.JavacParser.classOrInterfaceBodyDeclaration(JavacParser.java:3872)
> 	at jdk.compiler/com.sun.tools.javac.parser.JavacParser.classOrInterfaceBody(JavacParser.java:3773)
> 	at jdk.compiler/com.sun.tools.javac.parser.JavacParser.classDeclaration(JavacParser.java:3612)
> 	at jdk.compiler/com.sun.tools.javac.parser.JavacParser.classOrInterfaceOrEnumDeclaration(JavacParser.java:3566)
> 	at jdk.compiler/com.sun.tools.javac.parser.JavacParser.typeDeclaration(JavacParser.java:3555)
> 	at jdk.compiler/com.sun.tools.javac.parser.JavacParser.parseCompilationUnit(JavacParser.java:3399)
> 	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:639)
> 	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:676)
> 	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:1026)
> 	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:939)
> 	at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:311)
> 	at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:170)
> 	at jdk.compiler/com.sun.tools.javac.main.JavacToolProvider.run(JavacToolProvider.java:46)
> 	at java.base/java.util.spi.ToolProvider.run(ToolProvider.java:137)



More information about the amber-dev mailing list