Search in sources :

Example 1 with Synthetic

use of org.apache.bcel.classfile.Synthetic in project jop by jop-devel.

the class MemberInfo method setSynthetic.

////////////////////////////////////////////////////////////////////////////
// Attribute access and helpers for custom attributes
////////////////////////////////////////////////////////////////////////////    
public void setSynthetic(boolean flag) {
    // from major version 49 on, ACC_SYNTHETIC is supported
    Synthetic s = findSynthetic();
    if (getClassInfo().getMajor() < 49) {
        if (flag) {
            if (s == null) {
                ConstantPoolGen cpg = getClassInfo().getConstantPoolGen();
                int index = cpg.addUtf8("Synthetic");
                addAttribute(new Synthetic(index, 0, new byte[0], cpg.getConstantPool()));
            }
        } else {
            if (s != null) {
                removeAttribute(s);
            }
        }
    } else {
        accessFlags.isSynthetic(flag);
        if (!flag && s != null) {
            removeAttribute(s);
        }
    }
}
Also used : ConstantPoolGen(org.apache.bcel.generic.ConstantPoolGen) Synthetic(org.apache.bcel.classfile.Synthetic)

Aggregations

Synthetic (org.apache.bcel.classfile.Synthetic)1 ConstantPoolGen (org.apache.bcel.generic.ConstantPoolGen)1