use of com.android.dx.cf.attrib.AttConstantValue in project buck by facebook.
the class StdField method getConstantValue.
/** {@inheritDoc} */
public TypedConstant getConstantValue() {
AttributeList attribs = getAttributes();
AttConstantValue cval = (AttConstantValue) attribs.findFirst(AttConstantValue.ATTRIBUTE_NAME);
if (cval == null) {
return null;
}
return cval.getConstantValue();
}
use of com.android.dx.cf.attrib.AttConstantValue in project buck by facebook.
the class StdAttributeFactory method constantValue.
/**
* Parses a {@code ConstantValue} attribute.
*/
private Attribute constantValue(DirectClassFile cf, int offset, int length, ParseObserver observer) {
if (length != 2) {
return throwBadLength(2);
}
ByteArray bytes = cf.getBytes();
ConstantPool pool = cf.getConstantPool();
int idx = bytes.getUnsignedShort(offset);
TypedConstant cst = (TypedConstant) pool.get(idx);
Attribute result = new AttConstantValue(cst);
if (observer != null) {
observer.parsed(bytes, offset, 2, "value: " + cst);
}
return result;
}
Aggregations