[patterns] __matches __matches __matches
Tagir Valeev
amaembo at gmail.com
Thu Oct 12 03:18:18 UTC 2017
Hello!
Thank you for fixing this!
public class Name {
static final boolean __matches = false;
public static void main(String[] args) {
if(__matches __matches __matches) {
System.out.println("Matches!");
}
}
}
Compiles fine, prints "Matches!" as expected, cool. Now let's go deeper!
public class Name {
static final boolean __matches = false;
public static void main(String[] args) {
if((__matches __matches __matches) __matches __matches) {
System.out.println("Matches!");
}
}
}
Name.java:5: error: ',', ')', or '[' expected
if((__matches __matches __matches) __matches __matches) {
^
Name.java:5: error: illegal start of expression
if((__matches __matches __matches) __matches __matches) {
^
Name.java:5: error: not a statement
if((__matches __matches __matches) __matches __matches) {
^
3 errors
Why so?
With best regards,
Tagir Valeev.
On Wed, Oct 11, 2017 at 10:44 PM, Gavin Bierman
<gavin.bierman at oracle.com> wrote:
> Thanks Tagir. Of course, this is a somewhat “transient” problem, but we’ve
> pushed a patch to address it.
>
> http://hg.openjdk.java.net/amber/amber/rev/fad77d011e0c
>
> Many thanks,
> Gavin
>
> On 11 Oct 2017, at 11:04, Tagir Valeev <amaembo at gmail.com> wrote:
>
> Hello!
>
> Tried the following source code:
>
> public class Name {
> static final int __matches = 1;
>
> public static void main(String[] args) {
> if(__matches __matches __matches) {
> System.out.println("Matches!");
> }
> }
> }
>
> I assumed that __matches is a restricted keyword which is recognized
> as a keyword only at specific syntactic position, thus this program
> should be correct. Well, this could be debated, but the actual result
> is somewhat unpleasant:
>
>
> The system is out of resources.
> Consult the following stack trace for details.
> java.lang.StackOverflowError
> at
> jdk.compiler/com.sun.tools.javac.parser.JavacParser.lambda$new$0(JavacParser.java:1038)
> at
> jdk.compiler/com.sun.tools.javac.parser.JavacParser.peekToken(JavacParser.java:321)
> at
> jdk.compiler/com.sun.tools.javac.parser.JavacParser.peekToken(JavacParser.java:317)
> at
> jdk.compiler/com.sun.tools.javac.parser.JavacParser.optag(JavacParser.java:4250)
> at
> jdk.compiler/com.sun.tools.javac.parser.JavacParser.lambda$new$0(JavacParser.java:1043)
> at
> jdk.compiler/com.sun.tools.javac.parser.JavacParser.peekToken(JavacParser.java:321)
> at
> jdk.compiler/com.sun.tools.javac.parser.JavacParser.peekToken(JavacParser.java:317)
> at
> jdk.compiler/com.sun.tools.javac.parser.JavacParser.optag(JavacParser.java:4250)
> at
> jdk.compiler/com.sun.tools.javac.parser.JavacParser.lambda$new$0(JavacParser.java:1043)
> at
> jdk.compiler/com.sun.tools.javac.parser.JavacParser.peekToken(JavacParser.java:321)
> at
> jdk.compiler/com.sun.tools.javac.parser.JavacParser.peekToken(JavacParser.java:317)
> at
> jdk.compiler/com.sun.tools.javac.parser.JavacParser.optag(JavacParser.java:4250)
> at
> jdk.compiler/com.sun.tools.javac.parser.JavacParser.lambda$new$0(JavacParser.java:1043)
> at
> jdk.compiler/com.sun.tools.javac.parser.JavacParser.peekToken(JavacParser.java:321)
> at
> jdk.compiler/com.sun.tools.javac.parser.JavacParser.peekToken(JavacParser.java:317)
> at
> jdk.compiler/com.sun.tools.javac.parser.JavacParser.optag(JavacParser.java:4250)
> at
> jdk.compiler/com.sun.tools.javac.parser.JavacParser.lambda$new$0(JavacParser.java:1043)
> ...
>
> With best regards,
> Tagir Valeev
>
>
More information about the amber-dev
mailing list