com.android.dx.rop.cst.CstNat Java Examples
The following examples show how to use
com.android.dx.rop.cst.CstNat.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StdAttributeFactory.java From buck with Apache License 2.0 | 6 votes |
/** * 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; }
Example #2
Source File: StdMember.java From Box with Apache License 2.0 | 6 votes |
/** * 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; }
Example #3
Source File: AttributeTranslator.java From Box with Apache License 2.0 | 6 votes |
/** * 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)); }
Example #4
Source File: StdAttributeFactory.java From Box with Apache License 2.0 | 6 votes |
/** * 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; }
Example #5
Source File: MemberIdItem.java From Box with Apache License 2.0 | 6 votes |
/** {@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); }
Example #6
Source File: AttributeTranslator.java From Box with Apache License 2.0 | 6 votes |
/** * 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)); }
Example #7
Source File: MemberIdItem.java From Box with Apache License 2.0 | 6 votes |
/** {@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); }
Example #8
Source File: StdMember.java From Box with Apache License 2.0 | 6 votes |
/** * 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; }
Example #9
Source File: StdAttributeFactory.java From Box with Apache License 2.0 | 6 votes |
/** * 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; }
Example #10
Source File: AnnotationId.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Convert a value of an element to a {@code Constant}. * <p><strong>Warning:</strong> Array or TypeId value is not supported yet. * * @param value an annotation element value. * @return a Constant */ static Constant toConstant(Object value) { Class clazz = value.getClass(); if (clazz.isEnum()) { CstString descriptor = new CstString(TypeId.get(clazz).getName()); CstString name = new CstString(((Enum) value).name()); CstNat cstNat = new CstNat(name, descriptor); return new CstEnumRef(cstNat); } else if (clazz.isArray()) { throw new UnsupportedOperationException("Array is not supported yet"); } else if (value instanceof TypeId) { throw new UnsupportedOperationException("TypeId is not supported yet"); } else { return Constants.getConstant(value); } }
Example #11
Source File: AttributeTranslator.java From J2ME-Loader with Apache License 2.0 | 6 votes |
/** * 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)); }
Example #12
Source File: MemberIdItem.java From J2ME-Loader with Apache License 2.0 | 6 votes |
/** {@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); }
Example #13
Source File: StdMember.java From J2ME-Loader with Apache License 2.0 | 6 votes |
/** * 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; }
Example #14
Source File: StdAttributeFactory.java From J2ME-Loader with Apache License 2.0 | 6 votes |
/** * 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; }
Example #15
Source File: AttributeTranslator.java From buck with Apache License 2.0 | 6 votes |
/** * 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)); }
Example #16
Source File: MemberIdItem.java From buck with Apache License 2.0 | 6 votes |
/** {@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); }
Example #17
Source File: StdMember.java From buck with Apache License 2.0 | 6 votes |
/** * 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; }
Example #18
Source File: MethodListParser.java From buck with Apache License 2.0 | 5 votes |
/** {@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; }
Example #19
Source File: FieldListParser.java From buck with Apache License 2.0 | 5 votes |
/** {@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; }
Example #20
Source File: EscapeAnalysis.java From buck with Apache License 2.0 | 5 votes |
/** * 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); }
Example #21
Source File: AttEnclosingMethod.java From Box with Apache License 2.0 | 5 votes |
/** * 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; }
Example #22
Source File: StdMethod.java From buck with Apache License 2.0 | 5 votes |
/** * 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()); }
Example #23
Source File: EscapeAnalysis.java From J2ME-Loader with Apache License 2.0 | 5 votes |
/** * 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); }
Example #24
Source File: FieldListParser.java From J2ME-Loader with Apache License 2.0 | 5 votes |
/** {@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; }
Example #25
Source File: MethodListParser.java From J2ME-Loader with Apache License 2.0 | 5 votes |
/** {@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; }
Example #26
Source File: StdMethod.java From J2ME-Loader with Apache License 2.0 | 5 votes |
/** * 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()); }
Example #27
Source File: AttEnclosingMethod.java From J2ME-Loader with Apache License 2.0 | 5 votes |
/** * 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; }
Example #28
Source File: StdMethod.java From Box with Apache License 2.0 | 5 votes |
/** * 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()); }
Example #29
Source File: FieldId.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
FieldId(TypeId<D> declaringType, TypeId<V> type, String name) { if (declaringType == null || type == null || name == null) { throw new NullPointerException(); } this.declaringType = declaringType; this.type = type; this.name = name; this.nat = new CstNat(new CstString(name), new CstString(type.name)); this.constant = new CstFieldRef(declaringType.constant, nat); }
Example #30
Source File: FieldId.java From dexmaker with Apache License 2.0 | 5 votes |
FieldId(TypeId<D> declaringType, TypeId<V> type, String name) { if (declaringType == null || type == null || name == null) { throw new NullPointerException(); } this.declaringType = declaringType; this.type = type; this.name = name; this.nat = new CstNat(new CstString(name), new CstString(type.name)); this.constant = new CstFieldRef(declaringType.constant, nat); }