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(); }