Synthetic accessor method generation check.
- Dominant language
- Java
- Stars
- 7.2k
- Forks
- 820
- Avg merge
- 5h 9m
- Merged PRs (30d)
- 50
Description
Method count is an ever-touchy subject for Android libraries and applications. The synthetic accessor methods produced by javac when accessing a private resource across a nested class boundary is a almost always needless and can be avoided by promoting something to package scoped.
The main cases where this happens:
* Accessing a private method/ctor across a nested class boundary. Fix: Change method/ctor to package scoped.
* Accessing a private field across a nested class boundary. Fix: Change field to package scoped.
* Accessing an _implicit_ private constructor on a private, nested class. Fix: Add an explicit package-scoped empty constructor to the nested class (the type can remain private) or make the type package-scoped.
This check should probably be off by default since it happens A TON when you're not paying attention to it and when targeting the JVM it's usually not a concern. Furthermore, future versions of Java will allegedly offer "nest mates" which altogether remove the need for synthetic accessor method generation so removing it only really makes sense for Android apps and libraries.
Contributor guide
Assessment
This issue has not been assessed yet.