filtering JAVAC.SYNTHMETH
Evgeny Mandrikov edited this page Mar 11, 2017
·
4 revisions
This page discusses a not yet available feature!
Some synthetic methods have no direct correspondence in source code and are created by the compiler for technical reasons. For example synthetic bridge methods are required to give inner classes access to private members of the containing class. Also synthetic methods are required for lambda expressions and their code corresponds to body of lambda expression.
Synthetic methods whose name doesn't start from lambda$
are completely removed.
class Outer {
private int counter;
private class Inner {
private void inc() {
counter++;
}
}
}
There are two ways to mark synthetic methods:
-
ACC_SYNTHETIC
bit in theaccess_flags
field of the method -
Synthetic
method attribute