Effects of Java’s Synthetic Accessor Methods in Android

Bob
Bob
Nov 5, 2016 · 3 min read
Image for post
Image for post
Image Credit: MemeMaker
// Outer.java 
public class Outer {
private static void doSomething() {
}

private class Nested {
private void execute() {
Outer.doSomething();
}
}
}
$ javac Outer.java$ ls 
Outer$Nested.class
Outer.class
Outer.java
$ javap -p -c Outer public class Outer { 
public Outer();
Code: <removed>
private static void doSomething();
Code: <removed>
static void access$000();
Code:
0: invokestatic #1 // Method doSomething:
3: return
}
private String a; 
private String b;
private String c;
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
// click action
a = “a”;
b = “b”
c = “c”;
}
}
private int count = 0; button.setOnClickListener(new OnClickListener() { 
@Override
public void onClick(View view) {
// click action
count++;
count — ;
++count;
— count;
}
}

Thoughts Overflow

My thoughts on Coding, Android, UI/UX, Life, Love

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store