atom / language-java

Java package for Atom
Other
62 stars 59 forks source link

Error in scopes for java when calling methods in array literal with TextMate #199

Closed alexr00 closed 4 years ago

alexr00 commented 5 years ago

Copied from https://github.com/microsoft/vscode/issues/75121

(I've tested in the last version of VSCode insiders and the bug is present as well)

Steps to Reproduce:

  1. write a java file and set the language mode to java
  2. in any method write a array literal and call a method in the value list (e.g. Object.clone())
  3. observe the syntax coloring now gone wild

In this example if you uncomment the bug-causing line public from SomeConstructor gets scoped as meta.class.body.java, meta.class.java, source.java

public class TestBug {

    static Object[] someTest;

    static {
        // Uncomment this to see the bug
        // someTest = new Object[] {someArgs[0].clone(), someArgs[1].clone()};
    }
    public SomeConstructor(Object[] someArgs) {

    }
}

Here are some exemple of the wrong coloring with the line commented (no bug) and not commented (bug active). Notice public:

testBug_inactive testBug_active

NB:

[EDIT: better description and better image]magic cancel : we can see that the static initialization block alter the coloring of the visibility of the next field however the next methods are not altered

testBug_weird_2

Does this issue occur when all extensions are disabled?: Yes

sadikovi commented 5 years ago

Thanks for reporting, I root caused the issue, will try fixing it in the next few days.

Vigilans commented 4 years ago

This is a variant of #172.