John said:
I would be surprised. The _name_ assigned to an "anonymous" class is
pseudo-synthetic, but the class itself is fully defined by the source code.
If you happen to test your hypothesis then I, at least, would be
interested in the result.
Well, I have now found a synthetic class, sort of. And it is indeed
anonymous. But this is something new in java 1.5. The InnerClasses
attribute for an anonymous class now has the synthetic flag set (it did
not exist prior to java 1.5. Instead 'synthetic' was marked by an
attribute, and the InnerClasses attribute could not have any extra
attributes.).
But the class itself is not marked synthetic, which is slightly strange,
and I will almost bet that the isSynthetic() method will return false if
the class itself is not marked synthetic. To illustrate what I mean
(this is a decompilation of some java 1.5 code, presumably compiled with
javac):
/* synthetic is missing here */
class javax.swing.plaf.basic.BasicIconFactory$1 extends java.lang.Object
{
@sourcefile = BasicIconFactory.java
@inner classes:
{
inner: javax.swing.plaf.basic.BasicIconFactory$1
outer: javax.swing.plaf.basic.BasicIconFactory
inner name: 0 (anonymous)
inner type: synthetic class /* but synthetic is present here */
}
}
Anyhow, the synthetic attribute/flag is completely optional, so I would
not rely on any information given by isSynthetic().