Closed VisheshVadhera closed 7 years ago
Thanks! do you know if there's any good annotation that identifies Visible-to-avoid-synthetic-accessors? I can imagine someone refactoring this back to private if they don't pay attention.
@kunalb Maybe u can enable Synthetic accessor call
in inspections settings, even change it's severity to error.
@kunalb AOSP Launcher 3 uses an annotation to signal that the member is package private only to prevent creation of synthetic accessors: https://android.googlesource.com/platform/packages/apps/Launcher3/+/master/src/com/android/launcher3/util/Thunk.java
Do you feel we can use something similar for this project as well?
Yeah, I'd like that a lot – except I'm not a fan of the name "Thunk" – maybe a source annotation called @VisibleToAvoidSynthetics? (Similar to VisibleForTesting)
Yeah, that is certainly better than "Thunk". I'll open a PR tonight.
Also a good thing (not right away but in future) would be to add a lint check to the build process to fail the build if at all new synthetic accessors get into the project either due to refactoring or due to new code.
Closes #8
Summary: Changed the visibility modifier of members from private to package private. This won't lead to synthetic accessor methods getting created for accessing the members (which were earlier private) inside the anonymous classes.