atom/language-java

Array initializer recognized as inner class

Closed this issue · 4 comments

Prerequisites

Description

class A {
    public void getParamToIntArray(String key) {
        Integer.valueOf(string.trim());
        new Integer[] { Integer.valueOf(string.trim()) };
    }
}

image

Screenshot taken in VSCode using java.cson from version d48e713.

Steps to Reproduce

  1. Open new tab and select Java language.
  2. Paste code into the editor.

Expected behavior: [What you expect to happen]

The two Integers should have the same color and same scopes.

Actual behavior: [What actually happens]

Everything inside the array initializer is recognized in meta.inner-class.java scope.

Reproduces how often: [What percentage of the time does it reproduce?]

Always.

Versions

You can get this information from copy and pasting the output of atom --version and apm --version from the command line. Also, please include the OS and what version of the OS you're running.

Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.

Good catch! It looks like begin of meta.inner-class.java is not exactly correct, only works when there are no spaces between square bracket and curly one. Anyway, will try fixing.

Not quite sure if this is a good fix: felixhao28@46aaaac. FYI.

@sadikovi any updates?