aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorcjw <jamie12221@outlook.com>2019-12-05 21:15:55 +0800
committercjw <jamie12221@outlook.com>2019-12-05 21:15:55 +0800
commit4f8e274703e5cf45febb69510df9f86a8846f1f5 (patch)
tree890c0b25183c1ebfc1c2e004862146d42b576a1a /src
parent19a64dd7c2dfc03bbe9f6443341ebf9acd085a9f (diff)
downloadjavassist-4f8e274703e5cf45febb69510df9f86a8846f1f5.tar.gz
javassist-4f8e274703e5cf45febb69510df9f86a8846f1f5.zip
Support parsing 'byte[] a = new byte[]{};'
Diffstat (limited to 'src')
-rw-r--r--src/main/javassist/compiler/Parser.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main/javassist/compiler/Parser.java b/src/main/javassist/compiler/Parser.java
index c67d49ec..5290450c 100644
--- a/src/main/javassist/compiler/Parser.java
+++ b/src/main/javassist/compiler/Parser.java
@@ -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() == ',') {