[Soot-list] Detecting Synthetic Class Members

Devin Mahoney devin.mahoney at kyrus-tech.com
Mon Nov 12 09:29:03 EST 2012


On 11/9/2012 1:57 AM, Eric Bodden wrote:
> Hello.
> 
>> I've been having some trouble examining classes in Soot that
>> have Synthetic methods and fields. I realize that there are two
>> ways to specify a member as synthetic in a class file, through
>> the Synthetic attribute and through the access flag. [1] It
>> appears that Soot/coffi only supports the attribute and not the
>> access flag. The class file spec [2] shows how to set the
>> access_flags to indicate a synthetic property.
> 
> That's interesting. Do you know why there are two different ways
> to achieve the same thing?

The Synthetic attribute was first, in Java 1.1. The ACC_SYNTHETIC flag
was added in Java 1.5. According to [5], "Use the bit when available.
It's more compact and easier to process."

>> In order to even read this access_flags property, the
>> coffi.ClassFile would need to define and support ACC_SYNTHETIC,
>> probably here: [3]. Would it make more sense to then add an
>> additional constant to soot.Modifier [4], or simply detect when
>> that flag was set and in turn set the Sythentic tag?
> 
> I would go for the latter unless there's a good reason do
> distinguish both cases.

I found that the version of Jasmin in the Soot code base does not
support the ACC_SYNTHETIC flag, so adding the Synthetic attribute when
that flag is set may be the easiest way to go. I'll try it out and see
what problems I run into.

Devin

[5] http://osdir.com/ml/java.objectweb.asm/2005-07/msg00021.html


More information about the Soot-list mailing list