I am going through some crash logs for my app and the stack trace shows something like :
at MyActivity.formatDouble(MyActivity.java:182)
at MyActivity.access$47(MyActivity.java:196)
at MyActivity$28.onCameraChange(MyActivity.java:167)
"MyActivity" is an activity and hence not an anonymous inner class. I can't be sure of the dollar sign on line#3 (and the one in line#2 also)
I suspect that line 167 is within an anonymous class within MyActivity
, and that access$47
is simply a trampoline method to allow onCameraChange
to call a private method within MyActivity
. (The JVM wouldn't allow that, so the Java compiler creates a method to allow it.)
You can see this easily with a simple Java class not even on Android:
public class Test {
private static void privateMethod() {
throw new RuntimeException();
}
public static void main(String[] args) throws Exception {
Runnable runnable = new Runnable() {
@Override public void run() {
privateMethod();
}
};
runnable.run();
}
}
This gives a stack trace similar to the one you've shown:
Exception in thread "main" java.lang.RuntimeException
at Test.privateMethod(Test.java:4)
at Test.access$000(Test.java:1)
at Test$1.run(Test.java:10)
at Test.main(Test.java:13)
The Test$1.run
is within an anonymous inner class within main
, and the access$000
method is providing access to privateMethod
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With