atom/language-java

`new` keyword messes with ternary operator when used in condition

Closed this issue · 2 comments

Description

public class A {
    void f() {
        String sex = new Random().nextInt(2) == 0 ? "female" : "male";
        String sex = new Random().nextInt(2) ? "female" : "male";
        String sex = Random().nextInt(2) ? "female" : "male";
        String sex = new Random() ? "female" : "male";
    }
}

image

Expected behavior: [What you expect to happen]

The first string in "true branch" should be recognized as string.quoted.double.java, like in the third line.

Can you include the language-java version that you are testing against?