groovy / groovy/groovy-eclipse
Add warning for property assignment using private setter in non-final class
Open
@eric-milles is already working on this.
Since Jan 10, 2022.
enhancement
- Dominant language
- Java
- Stars
- 681
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
Consider the following:
class C {
def m() { x = null }
private void setX(x) {}
}
class D extends C /*implements Map*/ {
/*
@Delegate Map m
void setX(x) { }
void set(String name, value) { }
*/
}
new D().m()
The expression "x = null" will not make use of the private setter of C if one of the items in D is uncommented. "setX(null)" is safe or changing the visibility of setX to at least package-private or enabling static compilation for the call site prevents the interception as well. A warning could help bring awareness to this possibility.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.