Methods Summary |
---|
public void | accept(IClassDefVisitor visitor, java.lang.Object ctx)
visitor.visit (this, ctx);
|
public int | add(Attribute_info attribute)
final List/* Attribute_info */ attributes = m_attributes;
final int result = attributes.size ();
attributes.add (attribute);
if (attribute instanceof SyntheticAttribute_info)
++ m_syntheticRefCount;
else if (attribute instanceof InnerClassesAttribute_info)
{
if (m_innerClassesAttributeOffset >= 0)
throw new IllegalArgumentException ("this attribute collection already has an InnerClasses attribute");
m_innerClassesAttributeOffset = result;
}
else if (attribute instanceof BridgeAttribute_info)
++ m_bridgeRefCount;
if (DISALLOW_MULTIPLE_SYNTHETIC_ATTRIBUTES && $assert.ENABLED)
$assert.ASSERT (m_syntheticRefCount >= 0 && m_syntheticRefCount <= 1,
"bad synthetic attribute count: " + m_syntheticRefCount);
return result;
|
public java.lang.Object | clone()Performs a deep copy.
try
{
final AttributeCollection _clone = (AttributeCollection) super.clone ();
// deep clone:
final int attributes_count = m_attributes.size (); // use size() if this class becomes non-final
_clone.m_attributes = new ArrayList (attributes_count);
for (int a = 0; a < attributes_count; ++ a)
{
_clone.m_attributes.add (((Attribute_info) m_attributes.get (a)).clone ());
}
return _clone;
}
catch (CloneNotSupportedException e)
{
throw new InternalError (e.toString ());
}
|
public final Attribute_info | get(int offset)
return (Attribute_info) m_attributes.get (offset);
|
public final InnerClassesAttribute_info | getInnerClassesAttribute()
final int innerClassesAttributeOffset = m_innerClassesAttributeOffset;
if (innerClassesAttributeOffset < 0)
return null;
else
return (InnerClassesAttribute_info) get (innerClassesAttributeOffset);
|
public final boolean | hasBridge()
return m_bridgeRefCount > 0;
|
public final boolean | hasSynthetic()
return m_syntheticRefCount > 0;
|
public final long | length()
// TODO: cache?
long result = 2;
int _attributes_count = m_attributes.size (); // use size() if this class becomes non-final
for (int i = 0; i < _attributes_count; i++) result += get (i).length ();
return result;
|
public Attribute_info | remove(int offset)
final Attribute_info result = (Attribute_info) m_attributes.remove (offset);
if (result instanceof SyntheticAttribute_info)
-- m_syntheticRefCount;
else if (result instanceof InnerClassesAttribute_info)
m_innerClassesAttributeOffset = -1;
else if (result instanceof BridgeAttribute_info)
-- m_bridgeRefCount;
if (DISALLOW_MULTIPLE_SYNTHETIC_ATTRIBUTES && $assert.ENABLED)
$assert.ASSERT (m_syntheticRefCount >= 0 && m_syntheticRefCount <= 1,
"bad synthetic attribute count: " + m_syntheticRefCount);
return result;
|
public Attribute_info | set(int offset, Attribute_info attribute)
final Attribute_info result = (Attribute_info) m_attributes.set (offset, attribute);
if (result instanceof SyntheticAttribute_info)
-- m_syntheticRefCount;
else if (result instanceof InnerClassesAttribute_info)
m_innerClassesAttributeOffset = -1;
else if (result instanceof BridgeAttribute_info)
-- m_bridgeRefCount;
if (attribute instanceof SyntheticAttribute_info)
++ m_syntheticRefCount;
else if (attribute instanceof InnerClassesAttribute_info)
m_innerClassesAttributeOffset = offset;
else if (attribute instanceof BridgeAttribute_info)
++ m_bridgeRefCount;
if (DISALLOW_MULTIPLE_SYNTHETIC_ATTRIBUTES && $assert.ENABLED)
$assert.ASSERT (m_syntheticRefCount >= 0 && m_syntheticRefCount <= 1,
"bad synthetic attribute count: " + m_syntheticRefCount);
return result;
|
public final int | size()
return m_attributes.size ();
|
public void | writeInClassFormat(com.vladium.jcd.lib.UDataOutputStream out)
int attributes_count = size ();
out.writeU2 (attributes_count);
for (int i = 0; i < attributes_count; i++)
{
get (i).writeInClassFormat (out);
}
|