InaccessibleAuraEnabledGetter - lpohl-Reply/pmd-github-action GitHub Wiki
Rule: InaccessibleAuraEnabledGetter
Message
AuraEnabled getter must be public or global if is referenced in Lightning components
Description
In the Summer '21 release, a mandatory security update enforces access modifiers on Apex properties in Lightning component markup. The update prevents access to private or protected Apex getters from Aura and Lightning Web Components.
Priority
3
Example
public class Foo {
@AuraEnabled
public Integer counter { private get; set; } // Violating - Private getter is inaccessible to Lightning components
@AuraEnabled
public static Foo bar()
{
Foo foo = new Foo();
foo.counter = 2;
return foo;
}
}