Fix parse error with synchronized stmt
This commit is contained in:
@ -2225,9 +2225,9 @@ void BlockStatement() #void:
|
||||
|
||||
private void LocalTypeStartNoIdent() #void: // A lookahead
|
||||
{}
|
||||
{ // notice: not default
|
||||
"public" | "static" | "protected" | "private" | "final"
|
||||
| "abstract" | "synchronized" | "native" | "transient"
|
||||
{ // notice: not default, not synchronized, not final
|
||||
"public" | "static" | "protected" | "private"
|
||||
| "abstract" | "native" | "transient"
|
||||
| "volatile" | "strictfp"
|
||||
|
||||
| "class" | "interface"
|
||||
|
@ -222,6 +222,11 @@ public class ParserCornersTest extends BaseJavaTreeDumpTest {
|
||||
doTest("SwitchStatements");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSynchronizedStatements() {
|
||||
doTest("SynchronizedStmts");
|
||||
}
|
||||
|
||||
|
||||
private static final String GENERICS_PROBLEM =
|
||||
"public class Test {\n public void test() {\n String o = super.<String> doStuff(\"\");\n }\n}";
|
||||
|
@ -0,0 +1,9 @@
|
||||
|
||||
class Sync {
|
||||
public static void getInstance() {
|
||||
synchronized (0) { // note that synchronized is also a modifier
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
+- CompilationUnit[@PackageName = ""]
|
||||
+- ClassOrInterfaceDeclaration[@Abstract = "false", @Annotation = "false", @Anonymous = "false", @BinaryName = "Sync", @CanonicalName = "Sync", @Enum = "false", @Interface = "false", @Local = "false", @Nested = "false", @PackageName = "", @PackagePrivate = "true", @Record = "false", @RegularClass = "true", @SimpleName = "Sync", @TopLevel = "true", @Visibility = "package"]
|
||||
+- ModifierList[@EffectiveModifiers = "{}", @ExplicitModifiers = "{}"]
|
||||
+- ClassOrInterfaceBody[@Size = "1"]
|
||||
+- MethodDeclaration[@Abstract = "false", @Arity = "0", @Image = "getInstance", @Name = "getInstance", @Varargs = "false", @Visibility = "public", @Void = "true"]
|
||||
+- ModifierList[@EffectiveModifiers = "{public, static}", @ExplicitModifiers = "{public, static}"]
|
||||
+- VoidType[]
|
||||
+- FormalParameters[@Size = "0"]
|
||||
+- Block[@Size = "1", @containsComment = "false"]
|
||||
+- SynchronizedStatement[]
|
||||
+- NumericLiteral[@Base = "10", @CompileTimeConstant = "true", @DoubleLiteral = "false", @FloatLiteral = "false", @Image = "0", @IntLiteral = "true", @Integral = "true", @LongLiteral = "false", @ParenthesisDepth = "0", @Parenthesized = "false", @PrimitiveType = "int", @ValueAsDouble = "0.0", @ValueAsFloat = "0.0", @ValueAsInt = "0", @ValueAsLong = "0"]
|
||||
+- Block[@Size = "1", @containsComment = "false"]
|
||||
+- ReturnStatement[]
|
Reference in New Issue
Block a user