Remove anonymous class body ConstructorDeclaration from being parsed.

This commit is contained in:
Cody 2024-09-27 23:34:38 -06:00
parent d76644ee05
commit 9ce2b22f2a

AI 샘플 코드 생성 중입니다

Loading...

View File

@ -2,6 +2,7 @@ package the.bytecode.club.bytecodeviewer.resources.classcontainer.parser;
import com.github.javaparser.Range;
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.NodeList;
import com.github.javaparser.ast.body.*;
import com.github.javaparser.ast.expr.*;
import com.github.javaparser.ast.stmt.*;
@ -205,6 +206,16 @@ public class MyVoidVisitor extends VoidVisitorAdapter<Object>
this.classFileContainer.putParameter(parameterName, new ClassParameterLocation(getOwner(), n.getDeclarationAsString(false, false), "declaration", line, columnStart, columnEnd + 1));
});
if (n.getParentNode().get() instanceof ObjectCreationExpr)
{
ObjectCreationExpr objectCreationExpr = (ObjectCreationExpr) n.getParentNode().get();
NodeList<BodyDeclaration<?>> bodyDeclarations = objectCreationExpr.getAnonymousClassBody().get();
if (bodyDeclarations.getFirst().get().equals(n))
{
return;
}
}
ResolvedConstructorDeclaration resolve = n.resolve();
String signature = resolve.getQualifiedSignature();
String parameters = "";