Skip to content

Commit

Permalink
Partial fix for ASTConverter15JLS8Test.test0059 - body declarations f…
Browse files Browse the repository at this point in the history
…or enum type mishandled

Signed-off-by: Rob Stryker <stryker@redhat.com>
  • Loading branch information
Rob Stryker committed May 3, 2024
1 parent 080cdd2 commit d792f74
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -478,19 +478,16 @@ private AbstractTypeDeclaration convertClassDecl(JCClassDecl javacClassDecl, AST
List enumStatements= enumDecl.enumConstants();
if (javacClassDecl.getMembers() != null) {
for( Iterator<JCTree> i = javacClassDecl.getMembers().iterator(); i.hasNext(); ) {
EnumConstantDeclaration dec1 = convertEnumConstantDeclaration(i.next(), parent, enumDecl);
JCTree iNext = i.next();
EnumConstantDeclaration dec1 = convertEnumConstantDeclaration(iNext, parent, enumDecl);
if( dec1 != null ) {
enumStatements.add(dec1);
}
}
}

List bodyDecl = enumDecl.bodyDeclarations();
if (javacClassDecl.getMembers() != null) {
for( Iterator<JCTree> i = javacClassDecl.getMembers().iterator(); i.hasNext(); ) {
BodyDeclaration bd = convertEnumFieldOrMethodDeclaration(i.next(), res, enumDecl);
if( bd != null ) {
bodyDecl.add(bd);
} else {
// body declaration
ASTNode bodyDecl = convertBodyDeclaration(iNext, res);
if( bodyDecl != null ) {
res.bodyDeclarations().add(bodyDecl);
}
}
}
}
Expand Down

0 comments on commit d792f74

Please sign in to comment.