From 9e5d4d48a80417fad899f90bcf54f5e66ae1cf61 Mon Sep 17 00:00:00 2001 From: Edward Klimoshenko Date: Sun, 21 Aug 2022 14:00:58 +0000 Subject: [PATCH] Fix b/243747010 Set `ASTMethod.getImage` to name of type for constructors --- .../java/net/sourceforge/pmd/lang/apex/ast/ASTMethod.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTMethod.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTMethod.java index 933a05b46c..8ca7a367e8 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTMethod.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTMethod.java @@ -50,6 +50,12 @@ public class ASTMethod extends AbstractApexNode.Single implem @Override public String getImage() { + if (node.isConstructor()) { + ApexRootNode rootNode = getFirstParentOfType(ApexRootNode.class); + if (rootNode != null) { + return rootNode.node.getId().getString(); + } + } return getName(); }