]> source.dussan.org Git - javassist.git/commitdiff
Support parsing 'byte[] a = new byte[]{};' 294/head
authorcjw <jamie12221@outlook.com>
Thu, 5 Dec 2019 13:15:55 +0000 (21:15 +0800)
committercjw <jamie12221@outlook.com>
Thu, 5 Dec 2019 13:15:55 +0000 (21:15 +0800)
src/main/javassist/compiler/Parser.java

index c67d49ecff63dc220d28cce12f5b1563fa51c1a6..5290450c7b11edd639698528fd439de49b6d9829 100644 (file)
@@ -681,6 +681,10 @@ public final class Parser implements TokenId {
         throws CompileError
     {
         lex.get();      // '{'
+        if(lex.lookAhead() == '}'){
+            lex.get();
+            return new ArrayInit(new IntConst(0,TokenId.IntConstant));
+        }
         ASTree expr = parseExpression(tbl);
         ArrayInit init = new ArrayInit(expr);
         while (lex.lookAhead() == ',') {