atom / language-java

Java package for Atom
Other
62 stars 58 forks source link

A space between class name and "[]" breaks the array declaration. #196

Closed felixhao28 closed 5 years ago

felixhao28 commented 5 years ago

Description

Putting a space between class name and "[]" breaks the array declaration.

image

package com.sell.controller; 
import java.util.*;

public class testbug{

    public static void main(String [] args){
        String str = "";
        String [] arr = str.split("s");
//            ^ space
        for (int i = 0 ; i < arr.

Expected:

image

I fixed it by replacing

https://github.com/atom/language-java/blob/27fa88a4fc76649fa6dc4ea049708bb10fa0f1e7/grammars/java.cson#L1432

to

(\\s*\\[\\])* # int[][]

sadikovi commented 5 years ago

Thanks, I will try patching it tonight.

sadikovi commented 5 years ago

Fixed in #197.