Merge branch 'master' into 7.0.x
This commit is contained in:
@ -935,7 +935,6 @@ void RecordConstructorDeclaration():
|
||||
modifiers = Modifiers() { jjtThis.setModifiers(modifiers); }
|
||||
[TypeParameters()]
|
||||
<IDENTIFIER> { jjtThis.setImage(token.image); }
|
||||
[ "throws" NameList() ]
|
||||
"{" ( BlockStatement() )* "}"
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ public class Java14PreviewTest {
|
||||
Assert.assertEquals("Point", recordDecl.getImage());
|
||||
Assert.assertFalse(recordDecl.isNested());
|
||||
List<ASTRecordComponent> components = recordDecl.getFirstChildOfType(ASTRecordComponentList.class)
|
||||
.findChildrenOfType(ASTRecordComponent.class);
|
||||
.findChildrenOfType(ASTRecordComponent.class);
|
||||
Assert.assertEquals(2, components.size());
|
||||
Assert.assertEquals("x", components.get(0).getVariableDeclaratorId().getImage());
|
||||
Assert.assertEquals("y", components.get(1).getVariableDeclaratorId().getImage());
|
||||
@ -109,6 +109,13 @@ public class Java14PreviewTest {
|
||||
java14.parseResource("Point.java");
|
||||
}
|
||||
|
||||
@Test(expected = ParseException.class)
|
||||
public void recordCtorWithThrowsShouldFail() {
|
||||
java14p.parse(" record R {"
|
||||
+ " R throws IOException {}"
|
||||
+ " }");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void innerRecords() {
|
||||
ASTCompilationUnit compilationUnit = java14p.parseResource("Records.java");
|
||||
|
@ -57,8 +57,5 @@ public class Records {
|
||||
public record PersonRecord(String firstName, String lastName)
|
||||
implements Person, java.io.Serializable {
|
||||
|
||||
PersonRecord throws IOException { // compact ctor with throws list
|
||||
throw new IOException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user