Skip to content

Commit

Permalink
int x,y format fields inside anonymous class was incorrect
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Stryker <stryker@redhat.com>
  • Loading branch information
Rob Stryker committed Apr 11, 2024
1 parent 6410e65 commit b706657
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,11 @@ private FieldDeclaration convertFieldDeclaration(JCVariableDecl javac, ASTNode p
.filter(x -> ((FieldDeclaration)x).getType().getStartPosition() == javac.vartype.getStartPosition())
.forEach(x -> sameStartPosition.add((ASTNode)x));
}
if( parent instanceof AnonymousClassDeclaration decl) {
decl.bodyDeclarations().stream().filter(x -> x instanceof FieldDeclaration)
.filter(x -> ((FieldDeclaration)x).getType().getStartPosition() == javac.vartype.getStartPosition())
.forEach(x -> sameStartPosition.add((ASTNode)x));
}
if( sameStartPosition.size() >= 1 ) {
FieldDeclaration fd = (FieldDeclaration)sameStartPosition.get(0);
if( fd != null ) {
Expand Down Expand Up @@ -1132,7 +1137,7 @@ private AnonymousClassDeclaration createAnonymousClassDeclaration(JCClassDecl ja
if (javacAnon.getMembers() != null) {
List<JCTree> members = javacAnon.getMembers();
for( int i = 0; i < members.size(); i++ ) {
ASTNode decl = convertBodyDeclaration(members.get(i), parent);
ASTNode decl = convertBodyDeclaration(members.get(i), anon);
if( decl != null ) {
anon.bodyDeclarations().add(decl);
}
Expand Down

0 comments on commit b706657

Please sign in to comment.