Пример #1
0
 /**
  * Constructs a new <code>EncodedMethod</code> with the given values
  *
  * @param method The <code>MethodIdItem</code> that this <code>EncodedMethod</code> is
  *     associated with
  * @param accessFlags The access flags for this method
  * @param codeItem The <code>CodeItem</code> containing the code for this method, or null if
  *     there is no code for this method (i.e. an abstract method)
  */
 public EncodedMethod(MethodIdItem method, int accessFlags, CodeItem codeItem) {
   this.method = method;
   this.accessFlags = accessFlags;
   this.codeItem = codeItem;
   if (codeItem != null) {
     codeItem.setParent(this);
   }
 }
Пример #2
0
 /**
  * This is used internally to construct a new <code>EncodedMethod</code> while reading in a
  * <code>DexFile</code>
  *
  * @param dexFile The <code>DexFile</code> that is being read in
  * @param readContext a <code>ReadContext</code> object to hold information that is only needed
  *     while reading in a file
  * @param in the Input object to read the <code>EncodedMethod</code> from
  * @param previousEncodedMethod The previous <code>EncodedMethod</code> in the list containing
  *     this <code>EncodedMethod</code>.
  */
 public EncodedMethod(
     DexFile dexFile, ReadContext readContext, Input in, EncodedMethod previousEncodedMethod) {
   int previousIndex =
       previousEncodedMethod == null ? 0 : previousEncodedMethod.method.getIndex();
   method = dexFile.MethodIdsSection.getItemByIndex(in.readUnsignedLeb128() + previousIndex);
   accessFlags = in.readUnsignedLeb128();
   if (dexFile.skipInstructions()) {
     in.readUnsignedLeb128();
     codeItem = null;
   } else {
     codeItem =
         (CodeItem)
             readContext.getOptionalOffsettedItemByOffset(
                 ItemType.TYPE_CODE_ITEM, in.readUnsignedLeb128());
   }
   if (codeItem != null) {
     codeItem.setParent(this);
   }
 }