diff --git a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/security/ApexCRUDViolationRule.java b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/security/ApexCRUDViolationRule.java index dc8e8ee04a..d4185600a6 100644 --- a/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/security/ApexCRUDViolationRule.java +++ b/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/security/ApexCRUDViolationRule.java @@ -100,6 +100,8 @@ public class ApexCRUDViolationRule extends AbstractApexRule { @Override public void start(RuleContext ctx) { + // At the start of each rule execution, these member variables need to be fresh. So they're initialized in the + // .start() method instead of the constructor, since .start() is called before every execution. varToTypeMapping = new HashMap<>(); typeToDMLOperationMapping = ArrayListMultimap.create(); checkedTypeToDMLOperationViaESAPI = new HashMap<>();