atom/language-java

construction of generic class conflicts with "less than" operator in if condition

Closed this issue · 4 comments

Description

image

class A {
    void f() {
        int X = 5;
        if (X < 100)
            isTokenPerNode = false;
        for (int A : list) {
            // ...
        }
        if (new HashSet<String>().size() < 100)
            isTokenPerNode = false;
        for (int A : list) {
            // ...
        }
    }
}

If the condition contains a generic type, the comparator "<" won't be parsed correctly. And it also breaks the rest of the file.

Version:
7c3d0d3

Relates to #132

OK. Feel free to close it if it's duplicate.

This issue has been solved in #214:
image

It is actually a variant of #213: The dot punctuation '.' didn't stop the new expression.

Effect of removing the dot operator from end regex:
image

I double checked that this issue has been fixed in master.