Merge branch 'java-grammar' into typeres-jtypes

This commit is contained in:
Clément Fournier
2020-08-23 21:33:32 +02:00
4 changed files with 30 additions and 3 deletions

View File

@ -2224,9 +2224,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"

View File

@ -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}";

View File

@ -0,0 +1,9 @@
class Sync {
public static void getInstance() {
synchronized (0) { // note that synchronized is also a modifier
return;
}
}
}

View File

@ -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[]