What I know about Synthetic Members in JAVA is that "synthetic members are only meant to be accessed by trusted code generated by the compiler, not haphazardly by reflection. "
Compiler synthesizes certain hidden fields and methods in order to implement the scoping of names. These fields are private unless noted otherwise, or they are at most of package scope.
A synthetic field pointing to the outermost enclosing instance is named this$0. The next-outermost enclosing instance is this$1, and so forth. (At most one such field is necessary in any given inner class.) A synthetic field containing a copy of a constant v is named val$v. These fields are final.
All these synthetic fields are initialized by constructor parameters, which have the same names as the fields they initialize. If one of the parameters is the innermost enclosing instance, it is the first. All such constructor parameters are deemed to be synthetic. If the compiler determines that the synthetic field's value is used only in the code of the constructor, it may omit the field itself, and use only the parameter to implement variable references.
A non-private final synthetic method which grants access to a private member or constructor has a name of the form access$N, where N is a decimal numeral. The organization of such access protocols is unspecified.
Hope it Helps..
posted 13 years ago
Thanks Ankur Sharma for your reply, but it is not clear to me. Could you please give any example to illustrate that.It would help me a lots.
It would help *us* a lot if you told us more about what exactly is and what is not yet clear to you...
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Won't you be my neighbor? - Fred Rogers. tiny ad:
Try Free Java/.NET Libraries for Word Excel PowerPoint and PDF