File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes what is synthetic field is java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "what is synthetic field is java" Watch "what is synthetic field is java" New topic

what is synthetic field is java

narasimharao konjeti
Ranch Hand

Joined: Apr 26, 2003
Posts: 130
Here In java, I have one new variable type, i.e. synthetic field, which is declared like this
static int class$int$boolean$float /*synthetic variable*/
can i know exactly, what is this.
nr konjeti

"Unwise to sweat petty stuff, wise to pet sweaty stuff."
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

I'm not at all sure about the declaration you're showing (maybe somebody else recognizes this crazy notation) but a variable with a "synthetic" attribute means a variable introduced by the compiler that doesn't appear in the actual code. Examples include a static variable to hold a Class object if you've used the "Integer.class" notation, and the member variable in a non-static inner class that holds a reference to the enclosing class. Besides the fact that they are inserted by the compiler, synthetic variables aren't special in any way. Debuggers are supposed to take the synthetic attribute as a hint that they shouldn't display the variable.

[Jess in Action][AskingGoodQuestions]
a young

Joined: Aug 05, 2003
Posts: 11
I had the same question earlier today when looking at some decompiled code. This URL helped me out:
I agree. Here's the link:
subject: what is synthetic field is java
It's not a secret anymore!