本文整理汇总了Java中com.android.dx.rop.cst.CstNat类的典型用法代码示例。如果您正苦于以下问题:Java CstNat类的具体用法?Java CstNat怎么用?Java CstNat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CstNat类属于com.android.dx.rop.cst包,在下文中一共展示了CstNat类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: translateEnclosingMethod
import com.android.dx.rop.cst.CstNat; //导入依赖的package包/类
/**
* Gets the {@code EnclosingMethod} attribute out of a given
* {@link AttributeList}, if any, translating it to an annotation.
* If the class really has an enclosing method, this returns an
* {@code EnclosingMethod} annotation; if not, this returns
* an {@code EnclosingClass} annotation.
*
* @param attribs {@code non-null;} the attributes list to search in
* @return {@code null-ok;} the converted {@code EnclosingMethod} or
* {@code EnclosingClass} annotation, if there was an
* attribute to translate
*/
private static Annotation translateEnclosingMethod(AttributeList attribs) {
AttEnclosingMethod enclosingMethod = (AttEnclosingMethod)
attribs.findFirst(AttEnclosingMethod.ATTRIBUTE_NAME);
if (enclosingMethod == null) {
return null;
}
CstType enclosingClass = enclosingMethod.getEnclosingClass();
CstNat nat = enclosingMethod.getMethod();
if (nat == null) {
/*
* Dalvik doesn't use EnclosingMethod annotations unless
* there really is an enclosing method. Anonymous classes
* are unambiguously identified by having an InnerClass
* annotation with an empty name along with an appropriate
* EnclosingClass.
*/
return AnnotationUtils.makeEnclosingClass(enclosingClass);
}
return AnnotationUtils.makeEnclosingMethod(
new CstMethodRef(enclosingClass, nat));
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:38,代码来源:AttributeTranslator.java
示例2: writeTo
import com.android.dx.rop.cst.CstNat; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public final void writeTo(DexFile file, AnnotatedOutput out) {
TypeIdsSection typeIds = file.getTypeIds();
StringIdsSection stringIds = file.getStringIds();
CstNat nat = cst.getNat();
int classIdx = typeIds.indexOf(getDefiningClass());
int nameIdx = stringIds.indexOf(nat.getName());
int typoidIdx = getTypoidIdx(file);
if (out.annotates()) {
out.annotate(0, indexString() + ' ' + cst.toHuman());
out.annotate(2, " class_idx: " + Hex.u2(classIdx));
out.annotate(2, String.format(" %-10s %s", getTypoidName() + ':',
Hex.u2(typoidIdx)));
out.annotate(4, " name_idx: " + Hex.u4(nameIdx));
}
out.writeShort(classIdx);
out.writeShort(typoidIdx);
out.writeInt(nameIdx);
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:23,代码来源:MemberIdItem.java
示例3: StdMember
import com.android.dx.rop.cst.CstNat; //导入依赖的package包/类
/**
* Constructs an instance.
*
* @param definingClass {@code non-null;} the defining class
* @param accessFlags access flags
* @param nat {@code non-null;} member name and type (descriptor)
* @param attributes {@code non-null;} list of associated attributes
*/
public StdMember(CstType definingClass, int accessFlags, CstNat nat,
AttributeList attributes) {
if (definingClass == null) {
throw new NullPointerException("definingClass == null");
}
if (nat == null) {
throw new NullPointerException("nat == null");
}
if (attributes == null) {
throw new NullPointerException("attributes == null");
}
this.definingClass = definingClass;
this.accessFlags = accessFlags;
this.nat = nat;
this.attributes = attributes;
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:28,代码来源:StdMember.java
示例4: enclosingMethod
import com.android.dx.rop.cst.CstNat; //导入依赖的package包/类
/**
* Parses an {@code EnclosingMethod} attribute.
*/
private Attribute enclosingMethod(DirectClassFile cf, int offset,
int length, ParseObserver observer) {
if (length != 4) {
throwBadLength(4);
}
ByteArray bytes = cf.getBytes();
ConstantPool pool = cf.getConstantPool();
int idx = bytes.getUnsignedShort(offset);
CstType type = (CstType) pool.get(idx);
idx = bytes.getUnsignedShort(offset + 2);
CstNat method = (CstNat) pool.get0Ok(idx);
Attribute result = new AttEnclosingMethod(type, method);
if (observer != null) {
observer.parsed(bytes, offset, 2, "class: " + type);
observer.parsed(bytes, offset + 2, 2, "method: " +
DirectClassFile.stringOrNone(method));
}
return result;
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:29,代码来源:StdAttributeFactory.java
示例5: AttEnclosingMethod
import com.android.dx.rop.cst.CstNat; //导入依赖的package包/类
/**
* Constructs an instance.
*
* @param type {@code non-null;} the innermost enclosing class
* @param method {@code null-ok;} the name-and-type of the innermost enclosing
* method, if any
*/
public AttEnclosingMethod(CstType type, CstNat method) {
super(ATTRIBUTE_NAME);
if (type == null) {
throw new NullPointerException("type == null");
}
this.type = type;
this.method = method;
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:18,代码来源:AttEnclosingMethod.java
示例6: StdMethod
import com.android.dx.rop.cst.CstNat; //导入依赖的package包/类
/**
* Constructs an instance.
*
* @param definingClass {@code non-null;} the defining class
* @param accessFlags access flags
* @param nat {@code non-null;} member name and type (descriptor)
* @param attributes {@code non-null;} list of associated attributes
*/
public StdMethod(CstType definingClass, int accessFlags, CstNat nat,
AttributeList attributes) {
super(definingClass, accessFlags, nat, attributes);
String descStr = getDescriptor().getString();
effectiveDescriptor =
Prototype.intern(descStr, definingClass.getClassType(),
AccessFlags.isStatic(accessFlags),
nat.isInstanceInit());
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:19,代码来源:StdMethod.java
示例7: set
import com.android.dx.rop.cst.CstNat; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected Member set(int n, int accessFlags, CstNat nat,
AttributeList attributes) {
StdMethod meth =
new StdMethod(getDefiner(), accessFlags, nat, attributes);
methods.set(n, meth);
return meth;
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:11,代码来源:MethodListParser.java
示例8: set
import com.android.dx.rop.cst.CstNat; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected Member set(int n, int accessFlags, CstNat nat,
AttributeList attributes) {
StdField field =
new StdField(getDefiner(), accessFlags, nat, attributes);
fields.set(n, field);
return field;
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:11,代码来源:FieldListParser.java
示例9: insertExceptionThrow
import com.android.dx.rop.cst.CstNat; //导入依赖的package包/类
/**
* Replaces instructions that trigger an ArrayIndexOutofBounds exception
* with an actual throw of the exception.
*
* @param insn {@code non-null;} instruction causing the exception
* @param index {@code non-null;} index value that is out of bounds
* @param deletedInsns {@code non-null;} set of instructions marked for
* deletion
*/
private void insertExceptionThrow(SsaInsn insn, RegisterSpec index,
HashSet<SsaInsn> deletedInsns) {
// Create a new ArrayIndexOutOfBoundsException
CstType exception =
new CstType(Exceptions.TYPE_ArrayIndexOutOfBoundsException);
insertThrowingInsnBefore(insn, RegisterSpecList.EMPTY, null,
RegOps.NEW_INSTANCE, exception);
// Add a successor block with a move result pseudo for the exception
SsaBasicBlock currBlock = insn.getBlock();
SsaBasicBlock newBlock =
currBlock.insertNewSuccessor(currBlock.getPrimarySuccessor());
SsaInsn newInsn = newBlock.getInsns().get(0);
RegisterSpec newReg =
RegisterSpec.make(ssaMeth.makeNewSsaReg(), exception);
insertPlainInsnBefore(newInsn, RegisterSpecList.EMPTY, newReg,
RegOps.MOVE_RESULT_PSEUDO, null);
// Add another successor block to initialize the exception
SsaBasicBlock newBlock2 =
newBlock.insertNewSuccessor(newBlock.getPrimarySuccessor());
SsaInsn newInsn2 = newBlock2.getInsns().get(0);
CstNat newNat = new CstNat(new CstString("<init>"), new CstString("(I)V"));
CstMethodRef newRef = new CstMethodRef(exception, newNat);
insertThrowingInsnBefore(newInsn2, RegisterSpecList.make(newReg, index),
null, RegOps.INVOKE_DIRECT, newRef);
deletedInsns.add(newInsn2);
// Add another successor block to throw the new exception
SsaBasicBlock newBlock3 =
newBlock2.insertNewSuccessor(newBlock2.getPrimarySuccessor());
SsaInsn newInsn3 = newBlock3.getInsns().get(0);
insertThrowingInsnBefore(newInsn3, RegisterSpecList.make(newReg), null,
RegOps.THROW, null);
newBlock3.replaceSuccessor(newBlock3.getPrimarySuccessorIndex(),
ssaMeth.getExitBlock().getIndex());
deletedInsns.add(newInsn3);
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:48,代码来源:EscapeAnalysis.java
注:本文中的com.android.dx.rop.cst.CstNat类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论