Skip to content

Commit

Permalink
GROOVY-10148: Groovy should support sealed classes (additional edge c…
Browse files Browse the repository at this point in the history
…ases)
  • Loading branch information
paulk-asert committed Aug 9, 2021
1 parent 4248678 commit 53c5681
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ public void visit(ASTNode[] nodes, SourceUnit source) {

if (parent instanceof ClassNode) {
ClassNode cNode = (ClassNode) parent;
if (cNode.isEnum()) {
addError("@" + NON_SEALED_CLASS.getSimpleName() + " not allowed for enum", cNode);
return;
}
if (cNode.isAnnotationDefinition()) {
addError("@" + NON_SEALED_CLASS.getSimpleName() + " not allowed for annotation definition", cNode);
return;
}
cNode.putNodeMetaData(NON_SEALED_CLASS, Boolean.TRUE);
}
}
Expand Down

0 comments on commit 53c5681

Please sign in to comment.