EncodedField toEncodedField() { return new EncodedField(fieldId.constant, accessFlags); }
DexFile getDexFile() { if (outputDex == null) { DexOptions options = new DexOptions(); options.minSdkVersion = DexFormat.API_NO_EXTENDED_OPCODES; outputDex = new DexFile(options); } return outputDex; }
/** * Generates a dex file and returns its bytes. */ public byte[] generate() { if (outputDex == null) { DexOptions options = new DexOptions(); options.minSdkVersion = DexFormat.API_NO_EXTENDED_OPCODES; outputDex = new DexFile(options); } for (TypeDeclaration typeDeclaration : types.values()) { outputDex.add(typeDeclaration.toClassDefItem()); } try { return outputDex.toDex(null, false); } catch (IOException e) { throw new RuntimeException(e); } }
/** {@inheritDoc} */ public void addContents(DexFile file) { MethodIdsSection methodIds = file.getMethodIds(); MixedItemSection wordData = file.getWordData(); methodIds.intern(method); wordData.add(annotationsItem); }
/** {@inheritDoc} */ @Override public void addContents(DexFile file) { if (data == null) { // The string data hasn't yet been added, so add it. MixedItemSection stringData = file.getStringData(); data = new StringDataItem(value); stringData.add(data); } }
classDefItem = new ClassDefItem(thisType, flags, supertype.constant, interfaces.ropTypes, new CstString(sourceFile)); EncodedMethod encoded = method.toEncodedMethod(dexOptions); if (method.isDirect()) { classDefItem.addDirectMethod(encoded); } else { classDefItem.addVirtualMethod(encoded); EncodedField encoded = field.toEncodedField(); if (field.isStatic()) { classDefItem.addStaticField(encoded, Constants.getConstant(field.staticValue)); } else { classDefItem.addInstanceField(encoded);
/** {@inheritDoc} */ public void addContents(DexFile file) { FieldIdsSection fieldIds = file.getFieldIds(); MixedItemSection wordData = file.getWordData(); fieldIds.intern(field); annotations = wordData.intern(annotations); }
/** {@inheritDoc} */ public void addContents(DexFile file) { MethodIdsSection methodIds = file.getMethodIds(); MixedItemSection wordData = file.getWordData(); methodIds.intern(method); annotations = wordData.intern(annotations); }
EncodedMethod toEncodedMethod(DexOptions dexOptions) { RopMethod ropMethod = new RopMethod(code.toBasicBlocks(), 0); LocalVariableInfo locals = null; DalvCode dalvCode = RopTranslator.translate( ropMethod, PositionList.NONE, locals, code.paramSize(), dexOptions); return new EncodedMethod(method.constant, flags, dalvCode, StdTypeList.EMPTY); } }
classDefItem.addMethodAnnotations(cstMethodRef, annotations, dexMaker.getDexFile());
/** {@inheritDoc} */ @Override public void addContents(DexFile file) { MethodIdsSection methodIds = file.getMethodIds(); MixedItemSection wordData = file.getWordData(); methodIds.intern(method); if (code != null) { wordData.add(code); } }
/** {@inheritDoc} */ @Override public void addContents(DexFile file) { if (data == null) { // The string data hasn't yet been added, so add it. MixedItemSection stringData = file.getStringData(); data = new StringDataItem(value); stringData.add(data); } }
/** {@inheritDoc} */ public void addContents(DexFile file) { FieldIdsSection fieldIds = file.getFieldIds(); MixedItemSection wordData = file.getWordData(); fieldIds.intern(field); annotations = wordData.intern(annotations); }
com.android.dx.dex.file.DexFile dxFile = new com.android.dx.dex.file.DexFile(dexOptions); try { CfTranslator.translate(new DxContext(), dcf, data, cfOptions, dexOptions, dxFile);
/** {@inheritDoc} */ @Override public void addContents(DexFile file) { MethodIdsSection methodIds = file.getMethodIds(); MixedItemSection wordData = file.getWordData(); methodIds.intern(method); if (code != null) { wordData.add(code); } }
/** {@inheritDoc} */ @Override public void addContents(DexFile file) { if (data == null) { // The string data hasn't yet been added, so add it. MixedItemSection stringData = file.getStringData(); data = new StringDataItem(value); stringData.add(data); } }
/** {@inheritDoc} */ @Override public void addContents(DexFile file) { MethodIdsSection methodIds = file.getMethodIds(); MixedItemSection wordData = file.getWordData(); methodIds.intern(method); if (code != null) { wordData.add(code); } }
/** {@inheritDoc} */ @Override public void addContents(DexFile file) { if (data == null) { // The string data hasn't yet been added, so add it. MixedItemSection stringData = file.getStringData(); data = new StringDataItem(value); stringData.add(data); } }
/** {@inheritDoc} */ @Override public void addContents(DexFile file) { MethodIdsSection methodIds = file.getMethodIds(); MixedItemSection wordData = file.getWordData(); methodIds.intern(method); if (code != null) { wordData.add(code); } }
/** {@inheritDoc} */ public void addContents(DexFile file) { MethodIdsSection methodIds = file.getMethodIds(); MixedItemSection wordData = file.getWordData(); methodIds.intern(method); wordData.add(annotationsItem); }