Hi, classyshark is very useful for dex related works.
Chao Zhong
1

Synthetic accessors are methods that are created by the compiler. Take for example the following code (sorry about the lack of indenting)

class OuterClass {

private int outerInt = 10;

private class InnerClass {

int innerInt = outerInt + 4;

}

}

outerInt is declared private, during compile, a synthetic accessor or method is created in order to give access to that variable. It would look something like

/*package*/ static int OuterClass.access$100(OuterClass outerclass) {
return outerclass.outerInt;
}

This happens because child classes and anonymous classes all have a reference to the outer class. If you don’t want the synthetic methods being created for you, the solution would be to remove the private modifier from outerInt so that it’s package local. Synthetic accessors aren’t necessarily a bad thing but developers are starting to treat them like bugs since they do add to the total method count.

Like what you read? Give Mark Linton a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.