├── .gitattributes ├── .gitignore ├── LICENSE ├── LICENSE.txt ├── NOTICE.txt ├── README.md ├── README_EN.md ├── asm ├── build.gradle └── src │ └── main │ └── java │ └── org │ └── objectweb │ └── asm │ ├── AnnotationVisitor.java │ ├── AnnotationWriter.java │ ├── Attribute.java │ ├── ByteVector.java │ ├── ClassReader.java │ ├── ClassTooLargeException.java │ ├── ClassVisitor.java │ ├── ClassWriter.java │ ├── ConstantDynamic.java │ ├── Constants.java │ ├── Context.java │ ├── CurrentFrame.java │ ├── Edge.java │ ├── FieldVisitor.java │ ├── FieldWriter.java │ ├── Frame.java │ ├── Handle.java │ ├── Handler.java │ ├── Label.java │ ├── MethodTooLargeException.java │ ├── MethodVisitor.java │ ├── MethodWriter.java │ ├── ModuleVisitor.java │ ├── ModuleWriter.java │ ├── Opcodes.java │ ├── RecordComponentVisitor.java │ ├── RecordComponentWriter.java │ ├── Symbol.java │ ├── SymbolTable.java │ ├── Type.java │ ├── TypePath.java │ ├── TypeReference.java │ ├── commons │ ├── AdviceAdapter.java │ ├── AnalyzerAdapter.java │ ├── AnnotationRemapper.java │ ├── ClassRemapper.java │ ├── CodeSizeEvaluator.java │ ├── FieldRemapper.java │ ├── GeneratorAdapter.java │ ├── InstructionAdapter.java │ ├── JSRInlinerAdapter.java │ ├── LocalVariablesSorter.java │ ├── Method.java │ ├── MethodRemapper.java │ ├── ModuleHashesAttribute.java │ ├── ModuleRemapper.java │ ├── ModuleResolutionAttribute.java │ ├── ModuleTargetAttribute.java │ ├── RecordComponentRemapper.java │ ├── Remapper.java │ ├── SerialVersionUIDAdder.java │ ├── SignatureRemapper.java │ ├── SimpleRemapper.java │ ├── StaticInitMerger.java │ ├── TableSwitchGenerator.java │ ├── TryCatchBlockSorter.java │ └── package.html │ ├── package.html │ ├── signature │ ├── SignatureReader.java │ ├── SignatureVisitor.java │ ├── SignatureWriter.java │ └── package.html │ ├── tree │ ├── AbstractInsnNode.java │ ├── AnnotationNode.java │ ├── ClassNode.java │ ├── FieldInsnNode.java │ ├── FieldNode.java │ ├── FrameNode.java │ ├── IincInsnNode.java │ ├── InnerClassNode.java │ ├── InsnList.java │ ├── InsnNode.java │ ├── IntInsnNode.java │ ├── InvokeDynamicInsnNode.java │ ├── JumpInsnNode.java │ ├── LabelNode.java │ ├── LdcInsnNode.java │ ├── LineNumberNode.java │ ├── LocalVariableAnnotationNode.java │ ├── LocalVariableNode.java │ ├── LookupSwitchInsnNode.java │ ├── MethodInsnNode.java │ ├── MethodNode.java │ ├── ModuleExportNode.java │ ├── ModuleNode.java │ ├── ModuleOpenNode.java │ ├── ModuleProvideNode.java │ ├── ModuleRequireNode.java │ ├── MultiANewArrayInsnNode.java │ ├── ParameterNode.java │ ├── RecordComponentNode.java │ ├── TableSwitchInsnNode.java │ ├── TryCatchBlockNode.java │ ├── TypeAnnotationNode.java │ ├── TypeInsnNode.java │ ├── UnsupportedClassVersionException.java │ ├── Util.java │ ├── VarInsnNode.java │ ├── analysis │ │ ├── Analyzer.java │ │ ├── AnalyzerException.java │ │ ├── BasicInterpreter.java │ │ ├── BasicValue.java │ │ ├── BasicVerifier.java │ │ ├── Frame.java │ │ ├── Interpreter.java │ │ ├── SimpleVerifier.java │ │ ├── SmallSet.java │ │ ├── SourceInterpreter.java │ │ ├── SourceValue.java │ │ ├── Subroutine.java │ │ ├── Value.java │ │ └── package.html │ └── package.html │ └── util │ ├── ASMifier.java │ ├── ASMifierSupport.java │ ├── CheckAnnotationAdapter.java │ ├── CheckClassAdapter.java │ ├── CheckFieldAdapter.java │ ├── CheckFrameAnalyzer.java │ ├── CheckMethodAdapter.java │ ├── CheckModuleAdapter.java │ ├── CheckRecordComponentAdapter.java │ ├── CheckSignatureAdapter.java │ ├── Printer.java │ ├── Textifier.java │ ├── TextifierSupport.java │ ├── TraceAnnotationVisitor.java │ ├── TraceClassVisitor.java │ ├── TraceFieldVisitor.java │ ├── TraceMethodVisitor.java │ ├── TraceModuleVisitor.java │ ├── TraceRecordComponentVisitor.java │ ├── TraceSignatureVisitor.java │ └── package.html ├── build.gradle ├── d2j-base-cmd ├── build.gradle └── src │ └── main │ └── java │ └── com │ └── googlecode │ └── dex2jar │ └── tools │ └── BaseCmd.java ├── d2j-jasmin ├── build.gradle └── src │ ├── main │ ├── antlr3 │ │ └── com │ │ │ └── googlecode │ │ │ └── d2j │ │ │ └── jasmin │ │ │ └── Jasmin.g │ └── java │ │ └── com │ │ └── googlecode │ │ └── d2j │ │ └── jasmin │ │ ├── Jar2JasminCmd.java │ │ ├── Jasmin2JarCmd.java │ │ ├── JasminDumper.java │ │ └── Jasmins.java │ └── test │ ├── java │ └── com │ │ └── googlecode │ │ └── d2j │ │ └── tools │ │ └── jar │ │ └── test │ │ └── Jasmin2jTest.java │ └── resources │ └── jasmins │ └── type.j ├── d2j-smali ├── build.gradle └── src │ ├── main │ ├── antlr4 │ │ └── com │ │ │ └── googlecode │ │ │ └── d2j │ │ │ └── smali │ │ │ └── antlr4 │ │ │ └── Smali.g4 │ └── java │ │ └── com │ │ └── googlecode │ │ └── d2j │ │ └── smali │ │ ├── AntlrSmaliUtil.java │ │ ├── Baksmali.java │ │ ├── BaksmaliCmd.java │ │ ├── BaksmaliCodeDumper.java │ │ ├── BaksmaliDexFileVisitor.java │ │ ├── BaksmaliDumpOut.java │ │ ├── BaksmaliDumper.java │ │ ├── Smali.java │ │ ├── SmaliCmd.java │ │ ├── SmaliCodeVisitor.java │ │ └── Utils.java │ └── test │ ├── java │ └── a │ │ ├── BaksmaliTest.java │ │ └── SmaliTest.java │ └── resources │ └── a.smali ├── dex-ir ├── build.gradle └── src │ ├── main │ └── java │ │ └── com │ │ └── googlecode │ │ └── dex2jar │ │ └── ir │ │ ├── ET.java │ │ ├── IrMethod.java │ │ ├── LabelAndLocalMapper.java │ │ ├── LocalVar.java │ │ ├── StmtSearcher.java │ │ ├── StmtTraveler.java │ │ ├── TransformerException.java │ │ ├── Trap.java │ │ ├── TypeClass.java │ │ ├── Util.java │ │ ├── expr │ │ ├── AbstractInvokeExpr.java │ │ ├── ArrayExpr.java │ │ ├── BinopExpr.java │ │ ├── CastExpr.java │ │ ├── Constant.java │ │ ├── Exprs.java │ │ ├── FieldExpr.java │ │ ├── FilledArrayExpr.java │ │ ├── InvokeCustomExpr.java │ │ ├── InvokeExpr.java │ │ ├── InvokePolymorphicExpr.java │ │ ├── Local.java │ │ ├── NewExpr.java │ │ ├── NewMutiArrayExpr.java │ │ ├── PhiExpr.java │ │ ├── RefExpr.java │ │ ├── StaticFieldExpr.java │ │ ├── TypeExpr.java │ │ ├── UnopExpr.java │ │ └── Value.java │ │ ├── stmt │ │ ├── AssignStmt.java │ │ ├── BaseSwitchStmt.java │ │ ├── GotoStmt.java │ │ ├── IfStmt.java │ │ ├── JumpStmt.java │ │ ├── LabelStmt.java │ │ ├── LookupSwitchStmt.java │ │ ├── NopStmt.java │ │ ├── ReturnVoidStmt.java │ │ ├── Stmt.java │ │ ├── StmtList.java │ │ ├── Stmts.java │ │ ├── TableSwitchStmt.java │ │ ├── UnopStmt.java │ │ └── VoidInvokeStmt.java │ │ └── ts │ │ ├── AggTransformer.java │ │ ├── Cfg.java │ │ ├── CleanLabel.java │ │ ├── ConstTransformer.java │ │ ├── DeadCodeTransformer.java │ │ ├── EndRemover.java │ │ ├── ExceptionHandlerTrim.java │ │ ├── FixVar.java │ │ ├── Ir2JRegAssignTransformer.java │ │ ├── JimpleTransformer.java │ │ ├── MultiArrayTransformer.java │ │ ├── NewTransformer.java │ │ ├── NpeTransformer.java │ │ ├── RemoveConstantFromSSA.java │ │ ├── RemoveLocalFromSSA.java │ │ ├── SSATransformer.java │ │ ├── StatedTransformer.java │ │ ├── Transformer.java │ │ ├── TypeTransformer.java │ │ ├── UnSSATransformer.java │ │ ├── UniqueQueue.java │ │ ├── VoidInvokeTransformer.java │ │ ├── ZeroTransformer.java │ │ ├── an │ │ ├── AnalyzeValue.java │ │ ├── BaseAnalyze.java │ │ ├── SimpleLiveAnalyze.java │ │ └── SimpleLiveValue.java │ │ └── array │ │ ├── ArrayElementTransformer.java │ │ ├── ArrayNullPointerTransformer.java │ │ └── FillArrayTransformer.java │ └── test │ └── java │ └── com │ └── googlecode │ └── dex2jar │ └── ir │ └── test │ ├── AggTransformerTest.java │ ├── BaseTransformerTest.java │ ├── ConstTransformerTest.java │ ├── ConstantStringTest.java │ ├── DeadCodeTrnasformerTest.java │ ├── JimpleTransformerTest.java │ ├── RemoveConstantFromSSATest.java │ ├── RemoveLocalFromSSATest.java │ ├── SSATransformerTest.java │ ├── StmtListTest.java │ ├── TypeTransformerTest.java │ ├── UnSSATransformerTransformerTest.java │ └── ZeroTransformerTest.java ├── dex-obfuscator ├── build.gradle └── src │ └── main │ └── java │ └── top │ └── niunaijun │ └── obfuscator │ ├── IRObfuscator.java │ ├── LBlock.java │ ├── ObfDic.java │ ├── ObfuscatorConfiguration.java │ ├── RebuildIfResult.java │ └── chain │ ├── FlowObfuscator.java │ ├── IfObfuscator.java │ ├── SubObfuscator.java │ └── base │ ├── BaseObfuscatorChain.java │ └── ObfuscatorChain.java ├── dex-reader-api ├── build.gradle └── src │ └── main │ └── java │ └── com │ └── googlecode │ └── d2j │ ├── DexConstants.java │ ├── DexException.java │ ├── DexLabel.java │ ├── DexType.java │ ├── Field.java │ ├── Method.java │ ├── MethodHandle.java │ ├── Proto.java │ ├── Visibility.java │ ├── node │ ├── DexAnnotationNode.java │ ├── DexClassNode.java │ ├── DexCodeNode.java │ ├── DexDebugNode.java │ ├── DexFieldNode.java │ ├── DexFileNode.java │ ├── DexMethodNode.java │ ├── TryCatchNode.java │ ├── analysis │ │ ├── DvmFrame.java │ │ └── DvmInterpreter.java │ └── insn │ │ ├── AbstractMethodStmtNode.java │ │ ├── BaseSwitchStmtNode.java │ │ ├── ConstStmtNode.java │ │ ├── DexLabelStmtNode.java │ │ ├── DexStmtNode.java │ │ ├── FieldStmtNode.java │ │ ├── FillArrayDataStmtNode.java │ │ ├── FilledNewArrayStmtNode.java │ │ ├── JumpStmtNode.java │ │ ├── MethodCustomStmtNode.java │ │ ├── MethodPolymorphicStmtNode.java │ │ ├── MethodStmtNode.java │ │ ├── PackedSwitchStmtNode.java │ │ ├── SparseSwitchStmtNode.java │ │ ├── Stmt0RNode.java │ │ ├── Stmt1RNode.java │ │ ├── Stmt2R1NNode.java │ │ ├── Stmt2RNode.java │ │ ├── Stmt3RNode.java │ │ └── TypeStmtNode.java │ ├── reader │ ├── CFG.java │ ├── InstructionFormat.java │ ├── InstructionIndexType.java │ └── Op.java │ └── visitors │ ├── DexAnnotationAble.java │ ├── DexAnnotationVisitor.java │ ├── DexClassVisitor.java │ ├── DexCodeVisitor.java │ ├── DexDebugVisitor.java │ ├── DexFieldVisitor.java │ ├── DexFileVisitor.java │ └── DexMethodVisitor.java ├── dex-reader ├── build.gradle └── src │ ├── main │ └── java │ │ └── com │ │ └── googlecode │ │ └── d2j │ │ ├── reader │ │ ├── BaseDexFileReader.java │ │ ├── DexFileReader.java │ │ ├── MultiDexFileReader.java │ │ └── zip │ │ │ └── ZipUtil.java │ │ └── util │ │ ├── ASMifierAnnotationV.java │ │ ├── ASMifierClassV.java │ │ ├── ASMifierCodeV.java │ │ ├── ASMifierFileV.java │ │ ├── ArrayOut.java │ │ ├── Escape.java │ │ ├── Mutf8.java │ │ ├── Out.java │ │ ├── Utf8Utils.java │ │ └── zip │ │ ├── AccessBufByteArrayOutputStream.java │ │ ├── AutoSTOREDZipOutputStream.java │ │ ├── ZipConstants.java │ │ ├── ZipEntry.java │ │ └── ZipFile.java │ └── test │ ├── java │ └── com │ │ └── googlecode │ │ └── d2j │ │ └── reader │ │ └── test │ │ ├── AsmfierTest.java │ │ ├── BadZipEntryFlagTest.java │ │ └── SkipDupMethod.java │ └── resources │ └── i200.dex ├── dex-tools ├── build.gradle ├── open-source-license.txt └── src │ ├── main │ ├── assemble │ │ └── package.xml │ ├── bin_gen │ │ ├── bat_template │ │ ├── class.cfg │ │ ├── d2j_invoke.bat │ │ ├── d2j_invoke.sh │ │ └── sh_template │ ├── java │ │ └── com │ │ │ └── googlecode │ │ │ ├── d2j │ │ │ ├── signapk │ │ │ │ ├── AbstractJarSign.java │ │ │ │ ├── Base64.java │ │ │ │ ├── SunJarSignImpl.java │ │ │ │ └── TinySignImpl.java │ │ │ ├── tools │ │ │ │ └── jar │ │ │ │ │ ├── BaseWeaver.java │ │ │ │ │ ├── ClassInfo.java │ │ │ │ │ ├── DexWeaver.java │ │ │ │ │ ├── InitOut.java │ │ │ │ │ ├── InvocationWeaver.java │ │ │ │ │ ├── ScanBridgeAdapter.java │ │ │ │ │ └── WebApp.java │ │ │ └── util │ │ │ │ └── AccUtils.java │ │ │ └── dex2jar │ │ │ ├── bin_gen │ │ │ └── BinGen.java │ │ │ └── tools │ │ │ ├── ApkSign.java │ │ │ ├── AsmVerify.java │ │ │ ├── BaksmaliBaseDexExceptionHandler.java │ │ │ ├── BlackObfuscatorCmd.java │ │ │ ├── ClassVersionSwitch.java │ │ │ ├── DeObfInitCmd.java │ │ │ ├── DecryptStringCmd.java │ │ │ ├── Dex2jarCmd.java │ │ │ ├── Dex2jarMultiThreadCmd.java │ │ │ ├── DexRecomputeChecksum.java │ │ │ ├── DexWeaverCmd.java │ │ │ ├── ExtractOdexFromCoredumpCmd.java │ │ │ ├── GenerateCompileStubFromOdex.java │ │ │ ├── Jar2Dex.java │ │ │ ├── JarAccessCmd.java │ │ │ ├── JarWeaverCmd.java │ │ │ ├── StdApkCmd.java │ │ │ └── to │ │ │ └── Do.java │ └── resources │ │ └── com │ │ └── googlecode │ │ └── dex2jar │ │ └── tools │ │ ├── ApkSign.cer │ │ └── ApkSign.private │ └── test │ ├── java │ └── com │ │ └── googlecode │ │ └── d2j │ │ └── tools │ │ └── jar │ │ ├── MethodInvocation.java │ │ └── test │ │ ├── DexWaveTest.java │ │ └── WaveTest.java │ └── resources │ └── weave │ ├── a-after.j │ ├── a-before.j │ ├── a-gen.j │ ├── b-after.j │ ├── b-before.j │ ├── b-gen.j │ ├── c-after.j │ ├── c-before.j │ ├── c-gen.j │ └── smali │ ├── a-after.smali │ ├── a-before.smali │ ├── a-gen.smali │ ├── b-after.smali │ ├── b-before.smali │ └── b-gen.smali ├── dex-translator ├── build.gradle └── src │ ├── main │ ├── java │ │ ├── com │ │ │ └── googlecode │ │ │ │ └── d2j │ │ │ │ ├── asm │ │ │ │ └── LdcOptimizeAdapter.java │ │ │ │ ├── converter │ │ │ │ ├── Dex2IRConverter.java │ │ │ │ ├── IR2JConverter.java │ │ │ │ └── J2IRConverter.java │ │ │ │ ├── dex │ │ │ │ ├── BaseDexExceptionHandler.java │ │ │ │ ├── ClassVisitorFactory.java │ │ │ │ ├── Dex2Asm.java │ │ │ │ ├── Dex2IrAdapter.java │ │ │ │ ├── Dex2jar.java │ │ │ │ ├── DexExceptionHandler.java │ │ │ │ ├── DexFix.java │ │ │ │ ├── ExDex2Asm.java │ │ │ │ ├── LambadaNameSafeClassAdapter.java │ │ │ │ └── V3.java │ │ │ │ └── util │ │ │ │ └── Types.java │ │ └── org │ │ │ └── objectweb │ │ │ └── asm │ │ │ └── AsmBridge.java │ └── resources │ │ └── d2j_hex_decode_stub.data │ └── test │ ├── java │ ├── com │ │ └── googlecode │ │ │ └── dex2jar │ │ │ └── test │ │ │ ├── ASMifierTest.java │ │ │ ├── ArrayTypeTest.java │ │ │ ├── AutoCastTest.java │ │ │ ├── D2jErrorZipsTest.java │ │ │ ├── D2jTest.java │ │ │ ├── DexTranslatorRunner.java │ │ │ ├── EmptyTrapTest.java │ │ │ ├── I101Test.java │ │ │ ├── I121Test.java │ │ │ ├── I168Test.java │ │ │ ├── I63Test.java │ │ │ ├── Issue71Test.java │ │ │ ├── OptSyncTest.java │ │ │ ├── ResTest.java │ │ │ ├── Smali2jTest.java │ │ │ ├── TestDexClassV.java │ │ │ ├── TestUtils.java │ │ │ └── ZeroTest.java │ ├── dex2jar │ │ └── gen │ │ │ └── FTPClient__parsePassiveModeReply.java │ └── res │ │ ├── ArrayRes.java │ │ ├── ChineseRes.java │ │ ├── ConstValues.java │ │ ├── ExceptionRes.java │ │ ├── Gh28Type.java │ │ ├── Hex.java │ │ ├── I142_annotation_default.java │ │ ├── I56_AccessFlag.java │ │ ├── I71.java │ │ ├── I73.java │ │ ├── I88.java │ │ ├── LongDoubleRes.java │ │ ├── NoEndRes.java │ │ ├── NullZero.java │ │ ├── OptimizeSynchronized.java │ │ ├── PopRes.java │ │ ├── ResChild.java │ │ ├── ResParent.java │ │ ├── SwitchRes.java │ │ ├── U0000String.java │ │ ├── WideRes.java │ │ └── i55 │ │ ├── AAbstractClass.java │ │ ├── AClass.java │ │ └── AInterface.java │ └── resources │ ├── dexes │ └── i_jetty.dex │ └── smalis │ ├── 0zs.smali │ ├── ML.smali │ ├── bb-1-can-not-merge-z-and-i.smali │ ├── bb-5-ArrayIndexOutOfBoundsOnType.smali │ ├── empty-try-catch-with-goto-head.smali │ ├── gh-issue-186.smali │ ├── gh-issue-4.smali │ ├── gh501-r4k.smali │ ├── goto-first-label.smali │ ├── i230.smali │ ├── int-or-boolean.smali │ ├── issue-220-219-uninit-reg.smali │ ├── loop-enclosing-class.smali │ ├── method-code-too-large.smali │ ├── negative-array-size.smali │ ├── npe-cause-trap-fail.smali │ ├── opt-lock.smali │ ├── useless-new.smali │ └── writeString.smali ├── dex-writer ├── build.gradle └── src │ ├── main │ └── java │ │ └── com │ │ └── googlecode │ │ └── d2j │ │ └── dex │ │ └── writer │ │ ├── AnnotationWriter.java │ │ ├── CantNotFixContentException.java │ │ ├── ClassWriter.java │ │ ├── CodeWriter.java │ │ ├── DexFileWriter.java │ │ ├── DexWriteException.java │ │ ├── FieldWriter.java │ │ ├── MethodWriter.java │ │ ├── ann │ │ ├── Alignment.java │ │ ├── Idx.java │ │ └── Off.java │ │ ├── ev │ │ ├── EncodedAnnotation.java │ │ ├── EncodedArray.java │ │ └── EncodedValue.java │ │ ├── insn │ │ ├── Insn.java │ │ ├── JumpOp.java │ │ ├── Label.java │ │ ├── OpInsn.java │ │ └── PreBuildInsn.java │ │ ├── io │ │ ├── ByteBufferOut.java │ │ └── DataOut.java │ │ └── item │ │ ├── AnnotationItem.java │ │ ├── AnnotationSetItem.java │ │ ├── AnnotationSetRefListItem.java │ │ ├── AnnotationsDirectoryItem.java │ │ ├── BaseItem.java │ │ ├── ClassDataItem.java │ │ ├── ClassDefItem.java │ │ ├── CodeItem.java │ │ ├── ConstPool.java │ │ ├── DebugInfoItem.java │ │ ├── EncodedArrayItem.java │ │ ├── FieldIdItem.java │ │ ├── HeadItem.java │ │ ├── MapListItem.java │ │ ├── MethodIdItem.java │ │ ├── ProtoIdItem.java │ │ ├── SectionItem.java │ │ ├── StringDataItem.java │ │ ├── StringIdItem.java │ │ ├── TypeIdItem.java │ │ └── TypeListItem.java │ └── test │ └── java │ └── a │ ├── AppWriterTest.java │ └── CpStringTest.java ├── dexlib2 ├── .DS_Store ├── build.gradle └── src │ ├── .DS_Store │ ├── main │ ├── .DS_Store │ └── java │ │ ├── .DS_Store │ │ └── org │ │ ├── .DS_Store │ │ └── jf │ │ ├── CloseUtils.java │ │ ├── DexLib2Utils.java │ │ ├── baksmali │ │ ├── Adaptors │ │ │ ├── AnnotationFormatter.java │ │ │ ├── BlankMethodItem.java │ │ │ ├── CatchMethodItem.java │ │ │ ├── ClassDefinition.java │ │ │ ├── CommentMethodItem.java │ │ │ ├── CommentedOutMethodItem.java │ │ │ ├── CommentingIndentingWriter.java │ │ │ ├── Debug │ │ │ │ ├── BeginEpilogueMethodItem.java │ │ │ │ ├── DebugMethodItem.java │ │ │ │ ├── EndLocalMethodItem.java │ │ │ │ ├── EndPrologueMethodItem.java │ │ │ │ ├── LineNumberMethodItem.java │ │ │ │ ├── LocalFormatter.java │ │ │ │ ├── RestartLocalMethodItem.java │ │ │ │ ├── SetSourceFileMethodItem.java │ │ │ │ └── StartLocalMethodItem.java │ │ │ ├── EncodedValue │ │ │ │ ├── AnnotationEncodedValueAdaptor.java │ │ │ │ ├── ArrayEncodedValueAdaptor.java │ │ │ │ └── EncodedValueAdaptor.java │ │ │ ├── EndTryLabelMethodItem.java │ │ │ ├── FieldDefinition.java │ │ │ ├── Format │ │ │ │ ├── ArrayDataMethodItem.java │ │ │ │ ├── InstructionMethodItem.java │ │ │ │ ├── InstructionMethodItemFactory.java │ │ │ │ ├── OffsetInstructionFormatMethodItem.java │ │ │ │ ├── PackedSwitchMethodItem.java │ │ │ │ ├── SparseSwitchMethodItem.java │ │ │ │ └── UnresolvedOdexInstructionMethodItem.java │ │ │ ├── LabelMethodItem.java │ │ │ ├── MethodDefinition.java │ │ │ ├── MethodItem.java │ │ │ ├── PostInstructionRegisterInfoMethodItem.java │ │ │ ├── PreInstructionRegisterInfoMethodItem.java │ │ │ ├── ReferenceFormatter.java │ │ │ ├── RegisterFormatter.java │ │ │ └── SyntheticAccessCommentMethodItem.java │ │ ├── Baksmali.java │ │ ├── BaksmaliOptions.java │ │ └── Renderers │ │ │ ├── BooleanRenderer.java │ │ │ ├── ByteRenderer.java │ │ │ ├── CharRenderer.java │ │ │ ├── DoubleRenderer.java │ │ │ ├── FloatRenderer.java │ │ │ ├── IntegerRenderer.java │ │ │ ├── LongRenderer.java │ │ │ └── ShortRenderer.java │ │ ├── dexlib2 │ │ ├── AccessFlags.java │ │ ├── AnnotationVisibility.java │ │ ├── DebugItemType.java │ │ ├── DexFileFactory.java │ │ ├── Format.java │ │ ├── Opcode.java │ │ ├── Opcodes.java │ │ ├── ReferenceType.java │ │ ├── ValueType.java │ │ ├── VerificationError.java │ │ ├── VersionMap.java │ │ ├── analysis │ │ │ ├── AnalysisException.java │ │ │ ├── AnalyzedInstruction.java │ │ │ ├── AnalyzedMethodUtil.java │ │ │ ├── ArrayProto.java │ │ │ ├── ClassPath.java │ │ │ ├── ClassPathResolver.java │ │ │ ├── ClassProto.java │ │ │ ├── ClassProvider.java │ │ │ ├── DexClassProvider.java │ │ │ ├── InlineMethodResolver.java │ │ │ ├── MethodAnalyzer.java │ │ │ ├── OdexedFieldInstructionMapper.java │ │ │ ├── PrimitiveProto.java │ │ │ ├── RegisterType.java │ │ │ ├── TypeProto.java │ │ │ ├── UnknownClassProto.java │ │ │ ├── UnresolvedClassException.java │ │ │ ├── UnresolvedOdexInstruction.java │ │ │ ├── reflection │ │ │ │ ├── ReflectionClassDef.java │ │ │ │ ├── ReflectionConstructor.java │ │ │ │ ├── ReflectionField.java │ │ │ │ ├── ReflectionMethod.java │ │ │ │ └── util │ │ │ │ │ └── ReflectionUtils.java │ │ │ └── util │ │ │ │ └── TypeProtoUtils.java │ │ ├── base │ │ │ ├── BaseAnnotation.java │ │ │ ├── BaseAnnotationElement.java │ │ │ ├── BaseExceptionHandler.java │ │ │ ├── BaseMethodParameter.java │ │ │ ├── BaseTryBlock.java │ │ │ ├── reference │ │ │ │ ├── BaseFieldReference.java │ │ │ │ ├── BaseMethodProtoReference.java │ │ │ │ ├── BaseMethodReference.java │ │ │ │ ├── BaseStringReference.java │ │ │ │ └── BaseTypeReference.java │ │ │ └── value │ │ │ │ ├── BaseAnnotationEncodedValue.java │ │ │ │ ├── BaseArrayEncodedValue.java │ │ │ │ ├── BaseBooleanEncodedValue.java │ │ │ │ ├── BaseByteEncodedValue.java │ │ │ │ ├── BaseCharEncodedValue.java │ │ │ │ ├── BaseDoubleEncodedValue.java │ │ │ │ ├── BaseEnumEncodedValue.java │ │ │ │ ├── BaseFieldEncodedValue.java │ │ │ │ ├── BaseFloatEncodedValue.java │ │ │ │ ├── BaseIntEncodedValue.java │ │ │ │ ├── BaseLongEncodedValue.java │ │ │ │ ├── BaseMethodEncodedValue.java │ │ │ │ ├── BaseNullEncodedValue.java │ │ │ │ ├── BaseShortEncodedValue.java │ │ │ │ ├── BaseStringEncodedValue.java │ │ │ │ └── BaseTypeEncodedValue.java │ │ ├── builder │ │ │ ├── BuilderDebugItem.java │ │ │ ├── BuilderExceptionHandler.java │ │ │ ├── BuilderInstruction.java │ │ │ ├── BuilderOffsetInstruction.java │ │ │ ├── BuilderSwitchPayload.java │ │ │ ├── BuilderTryBlock.java │ │ │ ├── Label.java │ │ │ ├── MethodImplementationBuilder.java │ │ │ ├── MethodLocation.java │ │ │ ├── MutableMethodImplementation.java │ │ │ ├── SwitchLabelElement.java │ │ │ ├── debug │ │ │ │ ├── BuilderEndLocal.java │ │ │ │ ├── BuilderEpilogueBegin.java │ │ │ │ ├── BuilderLineNumber.java │ │ │ │ ├── BuilderPrologueEnd.java │ │ │ │ ├── BuilderRestartLocal.java │ │ │ │ ├── BuilderSetSourceFile.java │ │ │ │ └── BuilderStartLocal.java │ │ │ └── instruction │ │ │ │ ├── BuilderArrayPayload.java │ │ │ │ ├── BuilderInstruction10t.java │ │ │ │ ├── BuilderInstruction10x.java │ │ │ │ ├── BuilderInstruction11n.java │ │ │ │ ├── BuilderInstruction11x.java │ │ │ │ ├── BuilderInstruction12x.java │ │ │ │ ├── BuilderInstruction20bc.java │ │ │ │ ├── BuilderInstruction20t.java │ │ │ │ ├── BuilderInstruction21c.java │ │ │ │ ├── BuilderInstruction21ih.java │ │ │ │ ├── BuilderInstruction21lh.java │ │ │ │ ├── BuilderInstruction21s.java │ │ │ │ ├── BuilderInstruction21t.java │ │ │ │ ├── BuilderInstruction22b.java │ │ │ │ ├── BuilderInstruction22c.java │ │ │ │ ├── BuilderInstruction22cs.java │ │ │ │ ├── BuilderInstruction22s.java │ │ │ │ ├── BuilderInstruction22t.java │ │ │ │ ├── BuilderInstruction22x.java │ │ │ │ ├── BuilderInstruction23x.java │ │ │ │ ├── BuilderInstruction30t.java │ │ │ │ ├── BuilderInstruction31c.java │ │ │ │ ├── BuilderInstruction31i.java │ │ │ │ ├── BuilderInstruction31t.java │ │ │ │ ├── BuilderInstruction32x.java │ │ │ │ ├── BuilderInstruction35c.java │ │ │ │ ├── BuilderInstruction35mi.java │ │ │ │ ├── BuilderInstruction35ms.java │ │ │ │ ├── BuilderInstruction3rc.java │ │ │ │ ├── BuilderInstruction3rmi.java │ │ │ │ ├── BuilderInstruction3rms.java │ │ │ │ ├── BuilderInstruction45cc.java │ │ │ │ ├── BuilderInstruction4rcc.java │ │ │ │ ├── BuilderInstruction51l.java │ │ │ │ ├── BuilderPackedSwitchPayload.java │ │ │ │ ├── BuilderSparseSwitchPayload.java │ │ │ │ └── BuilderSwitchElement.java │ │ ├── dexbacked │ │ │ ├── BaseDexBuffer.java │ │ │ ├── BaseDexReader.java │ │ │ ├── DexBackedAnnotation.java │ │ │ ├── DexBackedAnnotationElement.java │ │ │ ├── DexBackedCatchAllExceptionHandler.java │ │ │ ├── DexBackedClassDef.java │ │ │ ├── DexBackedDexFile.java │ │ │ ├── DexBackedExceptionHandler.java │ │ │ ├── DexBackedField.java │ │ │ ├── DexBackedMethod.java │ │ │ ├── DexBackedMethodImplementation.java │ │ │ ├── DexBackedOdexFile.java │ │ │ ├── DexBackedTryBlock.java │ │ │ ├── DexBackedTypedExceptionHandler.java │ │ │ ├── DexReader.java │ │ │ ├── OatFile.java │ │ │ ├── ZipDexContainer.java │ │ │ ├── instruction │ │ │ │ ├── DexBackedArrayPayload.java │ │ │ │ ├── DexBackedInstruction.java │ │ │ │ ├── DexBackedInstruction10t.java │ │ │ │ ├── DexBackedInstruction10x.java │ │ │ │ ├── DexBackedInstruction11n.java │ │ │ │ ├── DexBackedInstruction11x.java │ │ │ │ ├── DexBackedInstruction12x.java │ │ │ │ ├── DexBackedInstruction20bc.java │ │ │ │ ├── DexBackedInstruction20t.java │ │ │ │ ├── DexBackedInstruction21c.java │ │ │ │ ├── DexBackedInstruction21ih.java │ │ │ │ ├── DexBackedInstruction21lh.java │ │ │ │ ├── DexBackedInstruction21s.java │ │ │ │ ├── DexBackedInstruction21t.java │ │ │ │ ├── DexBackedInstruction22b.java │ │ │ │ ├── DexBackedInstruction22c.java │ │ │ │ ├── DexBackedInstruction22cs.java │ │ │ │ ├── DexBackedInstruction22s.java │ │ │ │ ├── DexBackedInstruction22t.java │ │ │ │ ├── DexBackedInstruction22x.java │ │ │ │ ├── DexBackedInstruction23x.java │ │ │ │ ├── DexBackedInstruction30t.java │ │ │ │ ├── DexBackedInstruction31c.java │ │ │ │ ├── DexBackedInstruction31i.java │ │ │ │ ├── DexBackedInstruction31t.java │ │ │ │ ├── DexBackedInstruction32x.java │ │ │ │ ├── DexBackedInstruction35c.java │ │ │ │ ├── DexBackedInstruction35mi.java │ │ │ │ ├── DexBackedInstruction35ms.java │ │ │ │ ├── DexBackedInstruction3rc.java │ │ │ │ ├── DexBackedInstruction3rmi.java │ │ │ │ ├── DexBackedInstruction3rms.java │ │ │ │ ├── DexBackedInstruction45cc.java │ │ │ │ ├── DexBackedInstruction4rcc.java │ │ │ │ ├── DexBackedInstruction51l.java │ │ │ │ ├── DexBackedPackedSwitchPayload.java │ │ │ │ ├── DexBackedSparseSwitchPayload.java │ │ │ │ └── DexBackedUnknownInstruction.java │ │ │ ├── raw │ │ │ │ ├── AnnotationDirectoryItem.java │ │ │ │ ├── AnnotationItem.java │ │ │ │ ├── AnnotationSetItem.java │ │ │ │ ├── AnnotationSetRefList.java │ │ │ │ ├── ClassDataItem.java │ │ │ │ ├── ClassDefItem.java │ │ │ │ ├── CodeItem.java │ │ │ │ ├── DebugInfoItem.java │ │ │ │ ├── EncodedArrayItem.java │ │ │ │ ├── EncodedValue.java │ │ │ │ ├── FieldIdItem.java │ │ │ │ ├── HeaderItem.java │ │ │ │ ├── ItemType.java │ │ │ │ ├── MapItem.java │ │ │ │ ├── MethodIdItem.java │ │ │ │ ├── OdexHeaderItem.java │ │ │ │ ├── ProtoIdItem.java │ │ │ │ ├── RawDexFile.java │ │ │ │ ├── SectionAnnotator.java │ │ │ │ ├── StringDataItem.java │ │ │ │ ├── StringIdItem.java │ │ │ │ ├── TypeIdItem.java │ │ │ │ ├── TypeListItem.java │ │ │ │ └── util │ │ │ │ │ └── DexAnnotator.java │ │ │ ├── reference │ │ │ │ ├── DexBackedFieldReference.java │ │ │ │ ├── DexBackedMethodProtoReference.java │ │ │ │ ├── DexBackedMethodReference.java │ │ │ │ ├── DexBackedReference.java │ │ │ │ ├── DexBackedStringReference.java │ │ │ │ └── DexBackedTypeReference.java │ │ │ ├── util │ │ │ │ ├── AnnotationsDirectory.java │ │ │ │ ├── DebugInfo.java │ │ │ │ ├── FixedSizeList.java │ │ │ │ ├── FixedSizeSet.java │ │ │ │ ├── ParameterIterator.java │ │ │ │ ├── StaticInitialValueIterator.java │ │ │ │ ├── VariableSizeCollection.java │ │ │ │ ├── VariableSizeIterator.java │ │ │ │ ├── VariableSizeList.java │ │ │ │ ├── VariableSizeListIterator.java │ │ │ │ ├── VariableSizeLookaheadIterator.java │ │ │ │ └── VariableSizeSet.java │ │ │ └── value │ │ │ │ ├── DexBackedAnnotationEncodedValue.java │ │ │ │ ├── DexBackedArrayEncodedValue.java │ │ │ │ ├── DexBackedEncodedValue.java │ │ │ │ ├── DexBackedEnumEncodedValue.java │ │ │ │ ├── DexBackedFieldEncodedValue.java │ │ │ │ ├── DexBackedMethodEncodedValue.java │ │ │ │ ├── DexBackedStringEncodedValue.java │ │ │ │ └── DexBackedTypeEncodedValue.java │ │ ├── iface │ │ │ ├── Annotatable.java │ │ │ ├── Annotation.java │ │ │ ├── AnnotationElement.java │ │ │ ├── BasicAnnotation.java │ │ │ ├── ClassDef.java │ │ │ ├── DexFile.java │ │ │ ├── ExceptionHandler.java │ │ │ ├── Field.java │ │ │ ├── Member.java │ │ │ ├── Method.java │ │ │ ├── MethodImplementation.java │ │ │ ├── MethodParameter.java │ │ │ ├── MultiDexContainer.java │ │ │ ├── TryBlock.java │ │ │ ├── UpdateReference.java │ │ │ ├── debug │ │ │ │ ├── DebugItem.java │ │ │ │ ├── EndLocal.java │ │ │ │ ├── EpilogueBegin.java │ │ │ │ ├── LineNumber.java │ │ │ │ ├── LocalInfo.java │ │ │ │ ├── PrologueEnd.java │ │ │ │ ├── RestartLocal.java │ │ │ │ ├── SetSourceFile.java │ │ │ │ └── StartLocal.java │ │ │ ├── instruction │ │ │ │ ├── DualReferenceInstruction.java │ │ │ │ ├── FieldOffsetInstruction.java │ │ │ │ ├── FiveRegisterInstruction.java │ │ │ │ ├── HatLiteralInstruction.java │ │ │ │ ├── InlineIndexInstruction.java │ │ │ │ ├── Instruction.java │ │ │ │ ├── LongHatLiteralInstruction.java │ │ │ │ ├── NarrowHatLiteralInstruction.java │ │ │ │ ├── NarrowLiteralInstruction.java │ │ │ │ ├── OffsetInstruction.java │ │ │ │ ├── OneRegisterInstruction.java │ │ │ │ ├── PayloadInstruction.java │ │ │ │ ├── ReferenceInstruction.java │ │ │ │ ├── RegisterRangeInstruction.java │ │ │ │ ├── SwitchElement.java │ │ │ │ ├── SwitchPayload.java │ │ │ │ ├── ThreeRegisterInstruction.java │ │ │ │ ├── TwoRegisterInstruction.java │ │ │ │ ├── VariableRegisterInstruction.java │ │ │ │ ├── VerificationErrorInstruction.java │ │ │ │ ├── VtableIndexInstruction.java │ │ │ │ ├── WideLiteralInstruction.java │ │ │ │ └── formats │ │ │ │ │ ├── ArrayPayload.java │ │ │ │ │ ├── Instruction10t.java │ │ │ │ │ ├── Instruction10x.java │ │ │ │ │ ├── Instruction11n.java │ │ │ │ │ ├── Instruction11x.java │ │ │ │ │ ├── Instruction12x.java │ │ │ │ │ ├── Instruction20bc.java │ │ │ │ │ ├── Instruction20t.java │ │ │ │ │ ├── Instruction21c.java │ │ │ │ │ ├── Instruction21ih.java │ │ │ │ │ ├── Instruction21lh.java │ │ │ │ │ ├── Instruction21s.java │ │ │ │ │ ├── Instruction21t.java │ │ │ │ │ ├── Instruction22b.java │ │ │ │ │ ├── Instruction22c.java │ │ │ │ │ ├── Instruction22cs.java │ │ │ │ │ ├── Instruction22s.java │ │ │ │ │ ├── Instruction22t.java │ │ │ │ │ ├── Instruction22x.java │ │ │ │ │ ├── Instruction23x.java │ │ │ │ │ ├── Instruction30t.java │ │ │ │ │ ├── Instruction31c.java │ │ │ │ │ ├── Instruction31i.java │ │ │ │ │ ├── Instruction31t.java │ │ │ │ │ ├── Instruction32x.java │ │ │ │ │ ├── Instruction35c.java │ │ │ │ │ ├── Instruction35mi.java │ │ │ │ │ ├── Instruction35ms.java │ │ │ │ │ ├── Instruction3rc.java │ │ │ │ │ ├── Instruction3rmi.java │ │ │ │ │ ├── Instruction3rms.java │ │ │ │ │ ├── Instruction45cc.java │ │ │ │ │ ├── Instruction4rcc.java │ │ │ │ │ ├── Instruction51l.java │ │ │ │ │ ├── PackedSwitchPayload.java │ │ │ │ │ ├── SparseSwitchPayload.java │ │ │ │ │ └── UnknownInstruction.java │ │ │ ├── reference │ │ │ │ ├── FieldReference.java │ │ │ │ ├── MethodProtoReference.java │ │ │ │ ├── MethodReference.java │ │ │ │ ├── Reference.java │ │ │ │ ├── StringReference.java │ │ │ │ └── TypeReference.java │ │ │ └── value │ │ │ │ ├── AnnotationEncodedValue.java │ │ │ │ ├── ArrayEncodedValue.java │ │ │ │ ├── BooleanEncodedValue.java │ │ │ │ ├── ByteEncodedValue.java │ │ │ │ ├── CharEncodedValue.java │ │ │ │ ├── DoubleEncodedValue.java │ │ │ │ ├── EncodedValue.java │ │ │ │ ├── EnumEncodedValue.java │ │ │ │ ├── FieldEncodedValue.java │ │ │ │ ├── FloatEncodedValue.java │ │ │ │ ├── IntEncodedValue.java │ │ │ │ ├── LongEncodedValue.java │ │ │ │ ├── MethodEncodedValue.java │ │ │ │ ├── NullEncodedValue.java │ │ │ │ ├── ShortEncodedValue.java │ │ │ │ ├── StringEncodedValue.java │ │ │ │ └── TypeEncodedValue.java │ │ ├── immutable │ │ │ ├── ImmutableAnnotation.java │ │ │ ├── ImmutableAnnotationElement.java │ │ │ ├── ImmutableClassDef.java │ │ │ ├── ImmutableDexFile.java │ │ │ ├── ImmutableExceptionHandler.java │ │ │ ├── ImmutableField.java │ │ │ ├── ImmutableMethod.java │ │ │ ├── ImmutableMethodImplementation.java │ │ │ ├── ImmutableMethodParameter.java │ │ │ ├── ImmutableTryBlock.java │ │ │ ├── debug │ │ │ │ ├── ImmutableDebugItem.java │ │ │ │ ├── ImmutableEndLocal.java │ │ │ │ ├── ImmutableEpilogueBegin.java │ │ │ │ ├── ImmutableLineNumber.java │ │ │ │ ├── ImmutablePrologueEnd.java │ │ │ │ ├── ImmutableRestartLocal.java │ │ │ │ ├── ImmutableSetSourceFile.java │ │ │ │ └── ImmutableStartLocal.java │ │ │ ├── instruction │ │ │ │ ├── ImmutableArrayPayload.java │ │ │ │ ├── ImmutableInstruction.java │ │ │ │ ├── ImmutableInstruction10t.java │ │ │ │ ├── ImmutableInstruction10x.java │ │ │ │ ├── ImmutableInstruction11n.java │ │ │ │ ├── ImmutableInstruction11x.java │ │ │ │ ├── ImmutableInstruction12x.java │ │ │ │ ├── ImmutableInstruction20bc.java │ │ │ │ ├── ImmutableInstruction20t.java │ │ │ │ ├── ImmutableInstruction21c.java │ │ │ │ ├── ImmutableInstruction21ih.java │ │ │ │ ├── ImmutableInstruction21lh.java │ │ │ │ ├── ImmutableInstruction21s.java │ │ │ │ ├── ImmutableInstruction21t.java │ │ │ │ ├── ImmutableInstruction22b.java │ │ │ │ ├── ImmutableInstruction22c.java │ │ │ │ ├── ImmutableInstruction22cs.java │ │ │ │ ├── ImmutableInstruction22s.java │ │ │ │ ├── ImmutableInstruction22t.java │ │ │ │ ├── ImmutableInstruction22x.java │ │ │ │ ├── ImmutableInstruction23x.java │ │ │ │ ├── ImmutableInstruction30t.java │ │ │ │ ├── ImmutableInstruction31c.java │ │ │ │ ├── ImmutableInstruction31i.java │ │ │ │ ├── ImmutableInstruction31t.java │ │ │ │ ├── ImmutableInstruction32x.java │ │ │ │ ├── ImmutableInstruction35c.java │ │ │ │ ├── ImmutableInstruction35mi.java │ │ │ │ ├── ImmutableInstruction35ms.java │ │ │ │ ├── ImmutableInstruction3rc.java │ │ │ │ ├── ImmutableInstruction3rmi.java │ │ │ │ ├── ImmutableInstruction3rms.java │ │ │ │ ├── ImmutableInstruction51l.java │ │ │ │ ├── ImmutableInstructionFactory.java │ │ │ │ ├── ImmutablePackedSwitchPayload.java │ │ │ │ ├── ImmutableSparseSwitchPayload.java │ │ │ │ ├── ImmutableSwitchElement.java │ │ │ │ └── ImmutableUnknownInstruction.java │ │ │ ├── reference │ │ │ │ ├── ImmutableFieldReference.java │ │ │ │ ├── ImmutableMethodProtoReference.java │ │ │ │ ├── ImmutableMethodReference.java │ │ │ │ ├── ImmutableReference.java │ │ │ │ ├── ImmutableReferenceFactory.java │ │ │ │ ├── ImmutableStringReference.java │ │ │ │ └── ImmutableTypeReference.java │ │ │ ├── util │ │ │ │ ├── CharSequenceConverter.java │ │ │ │ └── ParamUtil.java │ │ │ └── value │ │ │ │ ├── ImmutableAnnotationEncodedValue.java │ │ │ │ ├── ImmutableArrayEncodedValue.java │ │ │ │ ├── ImmutableBooleanEncodedValue.java │ │ │ │ ├── ImmutableByteEncodedValue.java │ │ │ │ ├── ImmutableCharEncodedValue.java │ │ │ │ ├── ImmutableDoubleEncodedValue.java │ │ │ │ ├── ImmutableEncodedValue.java │ │ │ │ ├── ImmutableEncodedValueFactory.java │ │ │ │ ├── ImmutableEnumEncodedValue.java │ │ │ │ ├── ImmutableFieldEncodedValue.java │ │ │ │ ├── ImmutableFloatEncodedValue.java │ │ │ │ ├── ImmutableIntEncodedValue.java │ │ │ │ ├── ImmutableLongEncodedValue.java │ │ │ │ ├── ImmutableMethodEncodedValue.java │ │ │ │ ├── ImmutableNullEncodedValue.java │ │ │ │ ├── ImmutableShortEncodedValue.java │ │ │ │ ├── ImmutableStringEncodedValue.java │ │ │ │ └── ImmutableTypeEncodedValue.java │ │ ├── util │ │ │ ├── AlignmentUtils.java │ │ │ ├── AnnotatedBytes.java │ │ │ ├── DexUtil.java │ │ │ ├── EncodedValueUtils.java │ │ │ ├── FieldUtil.java │ │ │ ├── InstructionOffsetMap.java │ │ │ ├── InstructionUtil.java │ │ │ ├── MethodUtil.java │ │ │ ├── Preconditions.java │ │ │ ├── ReferenceUtil.java │ │ │ ├── SyntheticAccessorFSM.java │ │ │ ├── SyntheticAccessorResolver.java │ │ │ └── TypeUtils.java │ │ └── writer │ │ │ ├── AnnotationSection.java │ │ │ ├── AnnotationSetSection.java │ │ │ ├── ClassSection.java │ │ │ ├── DebugWriter.java │ │ │ ├── DexDataWriter.java │ │ │ ├── DexWriter.java │ │ │ ├── EncodedValueWriter.java │ │ │ ├── FieldSection.java │ │ │ ├── IndexSection.java │ │ │ ├── InstructionFactory.java │ │ │ ├── InstructionWriter.java │ │ │ ├── MethodSection.java │ │ │ ├── NullableIndexSection.java │ │ │ ├── NullableOffsetSection.java │ │ │ ├── OffsetSection.java │ │ │ ├── ProtoSection.java │ │ │ ├── StringSection.java │ │ │ ├── TypeListSection.java │ │ │ ├── TypeSection.java │ │ │ ├── builder │ │ │ ├── BaseBuilderPool.java │ │ │ ├── BuilderAnnotation.java │ │ │ ├── BuilderAnnotationElement.java │ │ │ ├── BuilderAnnotationPool.java │ │ │ ├── BuilderAnnotationSet.java │ │ │ ├── BuilderAnnotationSetPool.java │ │ │ ├── BuilderClassDef.java │ │ │ ├── BuilderClassPool.java │ │ │ ├── BuilderEncodedValues.java │ │ │ ├── BuilderExceptionHandler.java │ │ │ ├── BuilderField.java │ │ │ ├── BuilderFieldPool.java │ │ │ ├── BuilderFieldReference.java │ │ │ ├── BuilderMapEntryCollection.java │ │ │ ├── BuilderMethod.java │ │ │ ├── BuilderMethodParameter.java │ │ │ ├── BuilderMethodPool.java │ │ │ ├── BuilderMethodProtoReference.java │ │ │ ├── BuilderMethodReference.java │ │ │ ├── BuilderProtoPool.java │ │ │ ├── BuilderReference.java │ │ │ ├── BuilderStringPool.java │ │ │ ├── BuilderStringReference.java │ │ │ ├── BuilderTryBlock.java │ │ │ ├── BuilderTypeList.java │ │ │ ├── BuilderTypeListPool.java │ │ │ ├── BuilderTypePool.java │ │ │ ├── BuilderTypeReference.java │ │ │ └── DexBuilder.java │ │ │ ├── io │ │ │ ├── DeferredOutputStream.java │ │ │ ├── DeferredOutputStreamFactory.java │ │ │ ├── DexDataStore.java │ │ │ ├── FileDataStore.java │ │ │ ├── FileDeferredOutputStream.java │ │ │ ├── MemoryDataStore.java │ │ │ └── MemoryDeferredOutputStream.java │ │ │ ├── pool │ │ │ ├── AnnotationPool.java │ │ │ ├── AnnotationSetPool.java │ │ │ ├── BaseIndexPool.java │ │ │ ├── BaseNullableOffsetPool.java │ │ │ ├── BaseOffsetPool.java │ │ │ ├── BasePool.java │ │ │ ├── ClassPool.java │ │ │ ├── DexPool.java │ │ │ ├── FieldPool.java │ │ │ ├── Markable.java │ │ │ ├── MethodPool.java │ │ │ ├── PoolClassDef.java │ │ │ ├── PoolMethod.java │ │ │ ├── PoolMethodProto.java │ │ │ ├── ProtoPool.java │ │ │ ├── StringPool.java │ │ │ ├── StringTypeBasePool.java │ │ │ ├── TypeListPool.java │ │ │ └── TypePool.java │ │ │ └── util │ │ │ └── TryListBuilder.java │ │ ├── smali │ │ ├── InvalidToken.java │ │ ├── LexerErrorInterface.java │ │ ├── LiteralTools.java │ │ ├── MsgRecognitionException.java │ │ ├── OdexedInstructionException.java │ │ ├── SemanticException.java │ │ ├── Smali.java │ │ ├── SmaliCatchParser.java │ │ ├── SmaliCatchTreeWalker.java │ │ ├── SmaliMethodParameter.java │ │ ├── SmaliOptions.java │ │ ├── WithRegister.java │ │ ├── smaliFlexLexer.java │ │ ├── smaliParser.java │ │ └── smaliTreeWalker.java │ │ └── util │ │ ├── AbstractForwardSequentialList.java │ │ ├── AbstractListIterator.java │ │ ├── AlignmentUtils.java │ │ ├── ArraySortedSet.java │ │ ├── BitSetUtils.java │ │ ├── BlankReader.java │ │ ├── CharSequenceUtils.java │ │ ├── ClassFileNameHandler.java │ │ ├── CollectionUtils.java │ │ ├── ConsoleUtil.java │ │ ├── ExceptionWithContext.java │ │ ├── Hex.java │ │ ├── ImmutableConverter.java │ │ ├── ImmutableUtils.java │ │ ├── IndentingWriter.java │ │ ├── LinearSearch.java │ │ ├── NakedByteArrayOutputStream.java │ │ ├── NibbleUtils.java │ │ ├── NumberUtils.java │ │ ├── OldWrappedIndentingWriter.java │ │ ├── PathUtil.java │ │ ├── RandomAccessFileInputStream.java │ │ ├── RandomAccessFileOutputStream.java │ │ ├── SparseArray.java │ │ ├── SparseIntArray.java │ │ ├── StringUtils.java │ │ ├── StringWrapper.java │ │ ├── TextUtils.java │ │ ├── TrieTree.java │ │ ├── TwoColumnOutput.java │ │ ├── Utf8Utils.java │ │ └── WrappedIndentingWriter.java │ └── test │ └── java │ └── Test.java ├── dx ├── build.gradle └── src │ └── main │ └── java │ └── com │ └── android │ ├── dex │ ├── Annotation.java │ ├── CallSiteId.java │ ├── ClassData.java │ ├── ClassDef.java │ ├── Code.java │ ├── Dex.java │ ├── DexException.java │ ├── DexFormat.java │ ├── DexIndexOverflowException.java │ ├── EncodedValue.java │ ├── EncodedValueCodec.java │ ├── EncodedValueReader.java │ ├── FieldId.java │ ├── Leb128.java │ ├── MethodHandle.java │ ├── MethodId.java │ ├── Mutf8.java │ ├── ProtoId.java │ ├── SizeOf.java │ ├── TableOfContents.java │ ├── TypeList.java │ └── util │ │ ├── ByteArrayByteInput.java │ │ ├── ByteInput.java │ │ ├── ByteOutput.java │ │ ├── ExceptionWithContext.java │ │ ├── FileUtils.java │ │ └── Unsigned.java │ ├── dx │ ├── Version.java │ ├── cf │ │ ├── attrib │ │ │ ├── AttAnnotationDefault.java │ │ │ ├── AttBootstrapMethods.java │ │ │ ├── AttCode.java │ │ │ ├── AttConstantValue.java │ │ │ ├── AttDeprecated.java │ │ │ ├── AttEnclosingMethod.java │ │ │ ├── AttExceptions.java │ │ │ ├── AttInnerClasses.java │ │ │ ├── AttLineNumberTable.java │ │ │ ├── AttLocalVariableTable.java │ │ │ ├── AttLocalVariableTypeTable.java │ │ │ ├── AttRuntimeInvisibleAnnotations.java │ │ │ ├── AttRuntimeInvisibleParameterAnnotations.java │ │ │ ├── AttRuntimeVisibleAnnotations.java │ │ │ ├── AttRuntimeVisibleParameterAnnotations.java │ │ │ ├── AttSignature.java │ │ │ ├── AttSourceDebugExtension.java │ │ │ ├── AttSourceFile.java │ │ │ ├── AttSynthetic.java │ │ │ ├── BaseAnnotations.java │ │ │ ├── BaseAttribute.java │ │ │ ├── BaseLocalVariables.java │ │ │ ├── BaseParameterAnnotations.java │ │ │ ├── InnerClassList.java │ │ │ ├── RawAttribute.java │ │ │ └── package.html │ │ ├── code │ │ │ ├── BaseMachine.java │ │ │ ├── BasicBlocker.java │ │ │ ├── BootstrapMethodArgumentsList.java │ │ │ ├── BootstrapMethodsList.java │ │ │ ├── ByteBlock.java │ │ │ ├── ByteBlockList.java │ │ │ ├── ByteCatchList.java │ │ │ ├── ByteOps.java │ │ │ ├── BytecodeArray.java │ │ │ ├── ConcreteMethod.java │ │ │ ├── ExecutionStack.java │ │ │ ├── Frame.java │ │ │ ├── LineNumberList.java │ │ │ ├── LocalVariableList.java │ │ │ ├── LocalsArray.java │ │ │ ├── LocalsArraySet.java │ │ │ ├── Machine.java │ │ │ ├── Merger.java │ │ │ ├── OneLocalsArray.java │ │ │ ├── ReturnAddress.java │ │ │ ├── Ropper.java │ │ │ ├── RopperMachine.java │ │ │ ├── SimException.java │ │ │ ├── Simulator.java │ │ │ ├── SwitchList.java │ │ │ ├── ValueAwareMachine.java │ │ │ └── package.html │ │ ├── cst │ │ │ ├── ConstantPoolParser.java │ │ │ ├── ConstantTags.java │ │ │ └── MethodHandleKind.java │ │ ├── direct │ │ │ ├── AnnotationParser.java │ │ │ ├── AttributeFactory.java │ │ │ ├── AttributeListParser.java │ │ │ ├── ClassPathOpener.java │ │ │ ├── CodeObserver.java │ │ │ ├── DirectClassFile.java │ │ │ ├── FieldListParser.java │ │ │ ├── MemberListParser.java │ │ │ ├── MethodListParser.java │ │ │ ├── StdAttributeFactory.java │ │ │ └── package.html │ │ └── iface │ │ │ ├── Attribute.java │ │ │ ├── AttributeList.java │ │ │ ├── ClassFile.java │ │ │ ├── Field.java │ │ │ ├── FieldList.java │ │ │ ├── HasAttribute.java │ │ │ ├── Member.java │ │ │ ├── Method.java │ │ │ ├── MethodList.java │ │ │ ├── ParseException.java │ │ │ ├── ParseObserver.java │ │ │ ├── StdAttributeList.java │ │ │ ├── StdField.java │ │ │ ├── StdFieldList.java │ │ │ ├── StdMember.java │ │ │ ├── StdMethod.java │ │ │ ├── StdMethodList.java │ │ │ └── package.html │ ├── command │ │ ├── Main.java │ │ ├── UsageException.java │ │ ├── annotool │ │ │ ├── AnnotationLister.java │ │ │ └── Main.java │ │ ├── dexer │ │ │ ├── DxContext.java │ │ │ └── Main.java │ │ ├── dump │ │ │ ├── Args.java │ │ │ ├── BaseDumper.java │ │ │ ├── BlockDumper.java │ │ │ ├── ClassDumper.java │ │ │ ├── DotDumper.java │ │ │ ├── Main.java │ │ │ └── SsaDumper.java │ │ ├── findusages │ │ │ ├── FindUsages.java │ │ │ └── Main.java │ │ └── grep │ │ │ ├── Grep.java │ │ │ └── Main.java │ ├── dex │ │ ├── DexOptions.java │ │ ├── cf │ │ │ ├── AttributeTranslator.java │ │ │ ├── CfOptions.java │ │ │ ├── CfTranslator.java │ │ │ ├── CodeStatistics.java │ │ │ ├── OptimizerOptions.java │ │ │ └── package.html │ │ ├── code │ │ │ ├── ArrayData.java │ │ │ ├── BlockAddresses.java │ │ │ ├── CatchBuilder.java │ │ │ ├── CatchHandlerList.java │ │ │ ├── CatchTable.java │ │ │ ├── CodeAddress.java │ │ │ ├── CstInsn.java │ │ │ ├── DalvCode.java │ │ │ ├── DalvInsn.java │ │ │ ├── DalvInsnList.java │ │ │ ├── Dop.java │ │ │ ├── Dops.java │ │ │ ├── FixedSizeInsn.java │ │ │ ├── HighRegisterPrefix.java │ │ │ ├── InsnFormat.java │ │ │ ├── LocalList.java │ │ │ ├── LocalSnapshot.java │ │ │ ├── LocalStart.java │ │ │ ├── MultiCstInsn.java │ │ │ ├── OddSpacer.java │ │ │ ├── OutputCollector.java │ │ │ ├── OutputFinisher.java │ │ │ ├── PositionList.java │ │ │ ├── RopToDop.java │ │ │ ├── RopTranslator.java │ │ │ ├── SimpleInsn.java │ │ │ ├── StdCatchBuilder.java │ │ │ ├── SwitchData.java │ │ │ ├── TargetInsn.java │ │ │ ├── VariableSizeInsn.java │ │ │ ├── ZeroSizeInsn.java │ │ │ └── form │ │ │ │ ├── Form10t.java │ │ │ │ ├── Form10x.java │ │ │ │ ├── Form11n.java │ │ │ │ ├── Form11x.java │ │ │ │ ├── Form12x.java │ │ │ │ ├── Form20t.java │ │ │ │ ├── Form21c.java │ │ │ │ ├── Form21h.java │ │ │ │ ├── Form21s.java │ │ │ │ ├── Form21t.java │ │ │ │ ├── Form22b.java │ │ │ │ ├── Form22c.java │ │ │ │ ├── Form22s.java │ │ │ │ ├── Form22t.java │ │ │ │ ├── Form22x.java │ │ │ │ ├── Form23x.java │ │ │ │ ├── Form30t.java │ │ │ │ ├── Form31c.java │ │ │ │ ├── Form31i.java │ │ │ │ ├── Form31t.java │ │ │ │ ├── Form32x.java │ │ │ │ ├── Form35c.java │ │ │ │ ├── Form3rc.java │ │ │ │ ├── Form45cc.java │ │ │ │ ├── Form4rcc.java │ │ │ │ ├── Form51l.java │ │ │ │ └── SpecialFormat.java │ │ └── file │ │ │ ├── AnnotationItem.java │ │ │ ├── AnnotationSetItem.java │ │ │ ├── AnnotationSetRefItem.java │ │ │ ├── AnnotationUtils.java │ │ │ ├── AnnotationsDirectoryItem.java │ │ │ ├── CallSiteIdItem.java │ │ │ ├── CallSiteIdsSection.java │ │ │ ├── CallSiteItem.java │ │ │ ├── CatchStructs.java │ │ │ ├── ClassDataItem.java │ │ │ ├── ClassDefItem.java │ │ │ ├── ClassDefsSection.java │ │ │ ├── CodeItem.java │ │ │ ├── DebugInfoConstants.java │ │ │ ├── DebugInfoDecoder.java │ │ │ ├── DebugInfoEncoder.java │ │ │ ├── DebugInfoItem.java │ │ │ ├── DexFile.java │ │ │ ├── EncodedArrayItem.java │ │ │ ├── EncodedField.java │ │ │ ├── EncodedMember.java │ │ │ ├── EncodedMethod.java │ │ │ ├── FieldAnnotationStruct.java │ │ │ ├── FieldIdItem.java │ │ │ ├── FieldIdsSection.java │ │ │ ├── HeaderItem.java │ │ │ ├── HeaderSection.java │ │ │ ├── IdItem.java │ │ │ ├── IndexedItem.java │ │ │ ├── Item.java │ │ │ ├── ItemType.java │ │ │ ├── MapItem.java │ │ │ ├── MemberIdItem.java │ │ │ ├── MemberIdsSection.java │ │ │ ├── MethodAnnotationStruct.java │ │ │ ├── MethodHandleItem.java │ │ │ ├── MethodHandlesSection.java │ │ │ ├── MethodIdItem.java │ │ │ ├── MethodIdsSection.java │ │ │ ├── MixedItemSection.java │ │ │ ├── OffsettedItem.java │ │ │ ├── ParameterAnnotationStruct.java │ │ │ ├── ProtoIdItem.java │ │ │ ├── ProtoIdsSection.java │ │ │ ├── Section.java │ │ │ ├── Statistics.java │ │ │ ├── StringDataItem.java │ │ │ ├── StringIdItem.java │ │ │ ├── StringIdsSection.java │ │ │ ├── TypeIdItem.java │ │ │ ├── TypeIdsSection.java │ │ │ ├── TypeListItem.java │ │ │ ├── UniformItemSection.java │ │ │ ├── UniformListItem.java │ │ │ └── ValueEncoder.java │ ├── io │ │ ├── CodeReader.java │ │ ├── DexIndexPrinter.java │ │ ├── IndexType.java │ │ ├── OpcodeInfo.java │ │ ├── Opcodes.java │ │ └── instructions │ │ │ ├── AddressMap.java │ │ │ ├── BaseCodeCursor.java │ │ │ ├── CodeCursor.java │ │ │ ├── CodeInput.java │ │ │ ├── CodeOutput.java │ │ │ ├── DecodedInstruction.java │ │ │ ├── FillArrayDataPayloadDecodedInstruction.java │ │ │ ├── FiveRegisterDecodedInstruction.java │ │ │ ├── FourRegisterDecodedInstruction.java │ │ │ ├── InstructionCodec.java │ │ │ ├── InvokePolymorphicDecodedInstruction.java │ │ │ ├── InvokePolymorphicRangeDecodedInstruction.java │ │ │ ├── OneRegisterDecodedInstruction.java │ │ │ ├── PackedSwitchPayloadDecodedInstruction.java │ │ │ ├── RegisterRangeDecodedInstruction.java │ │ │ ├── ShortArrayCodeInput.java │ │ │ ├── ShortArrayCodeOutput.java │ │ │ ├── SparseSwitchPayloadDecodedInstruction.java │ │ │ ├── ThreeRegisterDecodedInstruction.java │ │ │ ├── TwoRegisterDecodedInstruction.java │ │ │ └── ZeroRegisterDecodedInstruction.java │ ├── merge │ │ ├── CollisionPolicy.java │ │ ├── DexMerger.java │ │ ├── IndexMap.java │ │ ├── InstructionTransformer.java │ │ └── SortableType.java │ ├── rop │ │ ├── annotation │ │ │ ├── Annotation.java │ │ │ ├── AnnotationVisibility.java │ │ │ ├── Annotations.java │ │ │ ├── AnnotationsList.java │ │ │ └── NameValuePair.java │ │ ├── code │ │ │ ├── AccessFlags.java │ │ │ ├── BasicBlock.java │ │ │ ├── BasicBlockList.java │ │ │ ├── ConservativeTranslationAdvice.java │ │ │ ├── CstInsn.java │ │ │ ├── DexTranslationAdvice.java │ │ │ ├── Exceptions.java │ │ │ ├── FillArrayDataInsn.java │ │ │ ├── Insn.java │ │ │ ├── InsnList.java │ │ │ ├── InvokePolymorphicInsn.java │ │ │ ├── LocalItem.java │ │ │ ├── LocalVariableExtractor.java │ │ │ ├── LocalVariableInfo.java │ │ │ ├── PlainCstInsn.java │ │ │ ├── PlainInsn.java │ │ │ ├── RegOps.java │ │ │ ├── RegisterSpec.java │ │ │ ├── RegisterSpecList.java │ │ │ ├── RegisterSpecSet.java │ │ │ ├── Rop.java │ │ │ ├── RopMethod.java │ │ │ ├── Rops.java │ │ │ ├── SourcePosition.java │ │ │ ├── SwitchInsn.java │ │ │ ├── ThrowingCstInsn.java │ │ │ ├── ThrowingInsn.java │ │ │ ├── TranslationAdvice.java │ │ │ └── package.html │ │ ├── cst │ │ │ ├── Constant.java │ │ │ ├── ConstantPool.java │ │ │ ├── CstAnnotation.java │ │ │ ├── CstArray.java │ │ │ ├── CstBaseMethodRef.java │ │ │ ├── CstBoolean.java │ │ │ ├── CstByte.java │ │ │ ├── CstCallSite.java │ │ │ ├── CstCallSiteRef.java │ │ │ ├── CstChar.java │ │ │ ├── CstDouble.java │ │ │ ├── CstEnumRef.java │ │ │ ├── CstFieldRef.java │ │ │ ├── CstFloat.java │ │ │ ├── CstInteger.java │ │ │ ├── CstInterfaceMethodRef.java │ │ │ ├── CstInvokeDynamic.java │ │ │ ├── CstKnownNull.java │ │ │ ├── CstLiteral32.java │ │ │ ├── CstLiteral64.java │ │ │ ├── CstLiteralBits.java │ │ │ ├── CstLong.java │ │ │ ├── CstMemberRef.java │ │ │ ├── CstMethodHandle.java │ │ │ ├── CstMethodRef.java │ │ │ ├── CstNat.java │ │ │ ├── CstProtoRef.java │ │ │ ├── CstShort.java │ │ │ ├── CstString.java │ │ │ ├── CstType.java │ │ │ ├── StdConstantPool.java │ │ │ ├── TypedConstant.java │ │ │ ├── Zeroes.java │ │ │ └── package.html │ │ ├── package-info.java │ │ └── type │ │ │ ├── Prototype.java │ │ │ ├── StdTypeList.java │ │ │ ├── Type.java │ │ │ ├── TypeBearer.java │ │ │ ├── TypeList.java │ │ │ └── package.html │ ├── ssa │ │ ├── BasicRegisterMapper.java │ │ ├── ConstCollector.java │ │ ├── DeadCodeRemover.java │ │ ├── DomFront.java │ │ ├── Dominators.java │ │ ├── EscapeAnalysis.java │ │ ├── InterferenceRegisterMapper.java │ │ ├── LiteralOpUpgrader.java │ │ ├── LocalVariableExtractor.java │ │ ├── LocalVariableInfo.java │ │ ├── MoveParamCombiner.java │ │ ├── NormalSsaInsn.java │ │ ├── Optimizer.java │ │ ├── PhiInsn.java │ │ ├── PhiTypeResolver.java │ │ ├── RegisterMapper.java │ │ ├── SCCP.java │ │ ├── SetFactory.java │ │ ├── SsaBasicBlock.java │ │ ├── SsaConverter.java │ │ ├── SsaInsn.java │ │ ├── SsaMethod.java │ │ ├── SsaRenamer.java │ │ ├── back │ │ │ ├── FirstFitAllocator.java │ │ │ ├── FirstFitLocalCombiningAllocator.java │ │ │ ├── IdenticalBlockCombiner.java │ │ │ ├── InterferenceGraph.java │ │ │ ├── LivenessAnalyzer.java │ │ │ ├── NullRegisterAllocator.java │ │ │ ├── RegisterAllocator.java │ │ │ └── SsaToRop.java │ │ └── package-info.java │ └── util │ │ ├── AnnotatedOutput.java │ │ ├── BitIntSet.java │ │ ├── Bits.java │ │ ├── ByteArray.java │ │ ├── ByteArrayAnnotatedOutput.java │ │ ├── FixedSizeList.java │ │ ├── Hex.java │ │ ├── HexParser.java │ │ ├── IndentingWriter.java │ │ ├── IntIterator.java │ │ ├── IntList.java │ │ ├── IntSet.java │ │ ├── LabeledItem.java │ │ ├── LabeledList.java │ │ ├── ListIntSet.java │ │ ├── MutabilityControl.java │ │ ├── MutabilityException.java │ │ ├── Output.java │ │ ├── ToHuman.java │ │ ├── TwoColumnOutput.java │ │ ├── Warning.java │ │ ├── Writers.java │ │ └── package.html │ └── multidex │ ├── ArchivePathElement.java │ ├── ClassPathElement.java │ ├── ClassReferenceListBuilder.java │ ├── FolderPathElement.java │ ├── MainDexListBuilder.java │ └── Path.java ├── filter.txt ├── gradle └── wrapper │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── image ├── aliplay.jpg ├── obf1.png ├── obf2.png ├── orig.png └── wechat.png ├── local.properties ├── main ├── build.gradle └── src │ └── main │ └── java │ └── Main.java ├── proguard-dic.txt └── settings.gradle /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.war 15 | *.nar 16 | *.ear 17 | *.zip 18 | *.tar.gz 19 | *.rar 20 | 21 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 22 | hs_err_pid* 23 | .idea/* 24 | .gradle/* 25 | */build/* 26 | gradle/wrapper/gradle-wrapper.jar 27 | .DS_Store 28 | -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | dex2jar - Tools to work with android .dex and java .class files 2 | Copyright (c) 2009-2014 Panxiaobo 3 | 4 | contributors 5 | - Bob Pan 6 | - HyperSpeeed 7 | - Enea Stanzani 8 | - t3stwhat 9 | - paulhooijenga 10 | - yyjdelete 11 | - jcmdev0 12 | -------------------------------------------------------------------------------- /asm/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | } 8 | 9 | dependencies { 10 | testCompile group: 'junit', name: 'junit', version: '4.12' 11 | } 12 | -------------------------------------------------------------------------------- /asm/src/main/java/org/objectweb/asm/tree/UnsupportedClassVersionException.java: -------------------------------------------------------------------------------- 1 | package org.objectweb.asm.tree; 2 | 3 | /** 4 | * Exception thrown in {@link AnnotationNode#check}, {@link ClassNode#check}, {@link 5 | * FieldNode#check} and {@link MethodNode#check} when these nodes (or their children, recursively) 6 | * contain elements that were introduced in more recent versions of the ASM API than version passed 7 | * to these methods. 8 | * 9 | * @author Eric Bruneton 10 | */ 11 | public class UnsupportedClassVersionException extends RuntimeException { 12 | 13 | private static final long serialVersionUID = -3502347765891805831L; 14 | } 15 | -------------------------------------------------------------------------------- /d2j-base-cmd/build.gradle: -------------------------------------------------------------------------------- 1 | description = 'a simple cmd parser' 2 | 3 | dependencies { 4 | } 5 | -------------------------------------------------------------------------------- /d2j-jasmin/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'antlr' 2 | 3 | dependencies { 4 | compile(group: 'org.antlr', name: 'antlr-runtime', version: '3.5.2') { 5 | exclude(module: 'stringtemplate') 6 | } 7 | compile project(":asm") 8 | compile project(':d2j-base-cmd') 9 | antlr "org.antlr:antlr:3.5.2" 10 | } 11 | 12 | sourceSets.main.antlr.srcDirs = ['src/main/antlr3'] 13 | -------------------------------------------------------------------------------- /d2j-jasmin/src/test/resources/jasmins/type.j: -------------------------------------------------------------------------------- 1 | .class public 'public' 2 | .implements A 3 | .implements interface 4 | .implements public 5 | 6 | .annotation visible Ljava/lang/A; 7 | .annotation visible java/lang/B 8 | .end annotation 9 | 10 | .annotation visible Ljava/lang/annotation/Retention; 11 | value e Ljava/lang/annotation/RetentionPolicy; = CLASS 12 | value [e LR; = CLASS 'CLASS2' "CLASS3" 13 | .end annotation 14 | 15 | .method public ldc()V 16 | ldc 0 17 | ldc 1L 18 | ldc "abc" 19 | ldc I ;;;;;;; equals to LI; 20 | ldc Ljava/lang/Object; 21 | ldc [I 22 | ldc [[Ljava/lang/Object; 23 | .end method 24 | 25 | .method public checkcast()V 26 | invokeinterface android/content/DialogInterface/dismiss()V 0 27 | checkcast Ljava/lang/Object; 28 | checkcast [I 29 | checkcast [[Ljava/lang/Object; 30 | checkcast I 31 | invokestatic LB;->clone()V 32 | invokestatic B/clone()V 33 | invokestatic [B->clone()V 34 | invokestatic [B/clone()V 35 | getstatic LB;->a:I 36 | getstatic B/a I 37 | getstatic [B->a:I 38 | getstatic [B/a I 39 | 40 | 41 | getstatic B/public I 42 | 43 | .end method 44 | .method public "public"()V 45 | .end method 46 | .method public 'static'()V 47 | .end method 48 | -------------------------------------------------------------------------------- /d2j-smali/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'antlr' 2 | 3 | dependencies { 4 | compile 'org.antlr:antlr4-runtime:4.9.3' // Newer versions only for Java 11+ 5 | compile project(':dex-reader') 6 | antlr 'org.antlr:antlr4:4.9.3' // Newer versions only for Java 11+ 7 | compile project(':d2j-base-cmd') 8 | compile project(':dex-writer') 9 | testCompile 'org.smali:baksmali:2.0.6' 10 | } 11 | 12 | generateGrammarSource { 13 | arguments += ['-no-listener', '-visitor','-package','com.googlecode.d2j.smali.antlr4'] 14 | } 15 | 16 | sourceSets { 17 | test.output.resourcesDir = "build/classes/test" 18 | main.antlr.srcDirs = ['src/main/antlr4'] 19 | } 20 | -------------------------------------------------------------------------------- /dex-ir/build.gradle: -------------------------------------------------------------------------------- 1 | description = 'Dex Translator' 2 | 3 | dependencies { 4 | compile project(':dex-reader-api') 5 | } 6 | 7 | -------------------------------------------------------------------------------- /dex-ir/src/main/java/com/googlecode/dex2jar/ir/ET.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012 Panxiaobo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.dex2jar.ir; 17 | 18 | import com.googlecode.dex2jar.ir.expr.Value; 19 | import com.googlecode.dex2jar.ir.stmt.Stmt; 20 | 21 | /** 22 | * The number of argument 23 | * 24 | * @author Panxiaobo 25 | * @version $Rev$ 26 | * @see Stmt 27 | * @see Value 28 | */ 29 | public enum ET { 30 | 31 | /** 32 | * no argument 33 | */ 34 | E0, 35 | /** 36 | * 1 argument 37 | */ 38 | E1, 39 | /** 40 | * 2 argument 41 | */ 42 | E2, 43 | /** 44 | * 3+ argument 45 | */ 46 | En 47 | } -------------------------------------------------------------------------------- /dex-ir/src/main/java/com/googlecode/dex2jar/ir/LabelAndLocalMapper.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.dex2jar.ir; 2 | 3 | import com.googlecode.dex2jar.ir.expr.Local; 4 | import com.googlecode.dex2jar.ir.stmt.LabelStmt; 5 | import com.googlecode.dex2jar.ir.stmt.Stmts; 6 | 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | 10 | public class LabelAndLocalMapper { 11 | Map labels = new HashMap<>(); 12 | Map locals = new HashMap<>(); 13 | 14 | public LabelStmt map(LabelStmt label) { 15 | LabelStmt nTarget = labels.get(label); 16 | if (nTarget == null) { 17 | nTarget = Stmts.nLabel(); 18 | labels.put(label, nTarget); 19 | } 20 | return nTarget; 21 | } 22 | 23 | public Local map(Local local) { 24 | Local nTarget = locals.get(local); 25 | if (nTarget == null) { 26 | nTarget = (Local) local.clone(); 27 | locals.put(local, nTarget); 28 | } 29 | return nTarget; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /dex-ir/src/main/java/com/googlecode/dex2jar/ir/LocalVar.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.dex2jar.ir; 2 | 3 | import com.googlecode.dex2jar.ir.expr.Local; 4 | import com.googlecode.dex2jar.ir.stmt.LabelStmt; 5 | 6 | public class LocalVar { 7 | 8 | public LabelStmt start, end; 9 | public String name, type, signature; 10 | public Local reg; 11 | 12 | public LocalVar(String name, String type, String signature, LabelStmt start, LabelStmt end, Local reg) { 13 | this.name = name; 14 | this.start = start; 15 | this.end = end; 16 | this.type = type; 17 | this.signature = signature; 18 | this.reg = reg; 19 | } 20 | 21 | public LocalVar clone(LabelAndLocalMapper map) { 22 | return new LocalVar(name, type, signature, start.clone(map), end.clone(map), (Local) reg.clone()); 23 | } 24 | 25 | @Override 26 | public String toString() { 27 | return String.format(".var %s ~ %s %s -> %s //%s", start.getDisplayName(), end.getDisplayName(), reg, name, 28 | type); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dex-ir/src/main/java/com/googlecode/dex2jar/ir/TransformerException.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.dex2jar.ir; 2 | 3 | public class TransformerException extends RuntimeException { 4 | 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = 1L; 9 | 10 | public TransformerException() { 11 | super(); 12 | } 13 | 14 | public TransformerException(String arg0, Throwable arg1) { 15 | super(arg0, arg1); 16 | } 17 | 18 | public TransformerException(String arg0) { 19 | super(arg0); 20 | } 21 | 22 | public TransformerException(Throwable arg0) { 23 | super(arg0); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /dex-ir/src/main/java/com/googlecode/dex2jar/ir/expr/AbstractInvokeExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2017 Panxiaobo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.dex2jar.ir.expr; 17 | 18 | 19 | import com.googlecode.d2j.Proto; 20 | import com.googlecode.dex2jar.ir.expr.Value.EnExpr; 21 | 22 | public abstract class AbstractInvokeExpr extends EnExpr { 23 | @Override 24 | protected void releaseMemory() { 25 | super.releaseMemory(); 26 | } 27 | 28 | public abstract Proto getProto(); 29 | 30 | public AbstractInvokeExpr(VT type, Value[] args) { 31 | super(type, args); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /dex-ir/src/main/java/com/googlecode/dex2jar/ir/stmt/BaseSwitchStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * dex2jar - Tools to work with android .dex and java .class files 3 | * Copyright (c) 2009-2012 Panxiaobo 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.googlecode.dex2jar.ir.stmt; 18 | 19 | import com.googlecode.dex2jar.ir.expr.Value; 20 | import com.googlecode.dex2jar.ir.stmt.Stmt.E1Stmt; 21 | 22 | /** 23 | * Parent class of {@link LookupSwitchStmt} and {@link TableSwitchStmt} 24 | * 25 | * @author Panxiaobo 26 | * 27 | */ 28 | public abstract class BaseSwitchStmt extends E1Stmt { 29 | public BaseSwitchStmt(ST type, Value op) { 30 | super(type, op); 31 | } 32 | 33 | public LabelStmt[] targets; 34 | public LabelStmt defaultTarget; 35 | } 36 | -------------------------------------------------------------------------------- /dex-ir/src/main/java/com/googlecode/dex2jar/ir/stmt/JumpStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * dex2jar - Tools to work with android .dex and java .class files 3 | * Copyright (c) 2009-2012 Panxiaobo 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.googlecode.dex2jar.ir.stmt; 18 | 19 | public interface JumpStmt { 20 | 21 | LabelStmt getTarget(); 22 | 23 | void setTarget(LabelStmt labelStmt); 24 | } 25 | -------------------------------------------------------------------------------- /dex-ir/src/main/java/com/googlecode/dex2jar/ir/stmt/NopStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012 Panxiaobo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.dex2jar.ir.stmt; 17 | 18 | import com.googlecode.dex2jar.ir.LabelAndLocalMapper; 19 | import com.googlecode.dex2jar.ir.stmt.Stmt.E0Stmt; 20 | 21 | /** 22 | * Represent a NOP statement 23 | * 24 | * @see ST#NOP 25 | * 26 | * @author Panxiaobo 27 | * @version $Rev$ 28 | */ 29 | public class NopStmt extends E0Stmt { 30 | 31 | public NopStmt() { 32 | super(ST.NOP); 33 | } 34 | 35 | @Override 36 | public Stmt clone(LabelAndLocalMapper mapper) { 37 | return new NopStmt(); 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return "NOP"; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /dex-ir/src/main/java/com/googlecode/dex2jar/ir/stmt/ReturnVoidStmt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012 Panxiaobo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.dex2jar.ir.stmt; 17 | 18 | import com.googlecode.dex2jar.ir.LabelAndLocalMapper; 19 | import com.googlecode.dex2jar.ir.stmt.Stmt.E0Stmt; 20 | 21 | /** 22 | * Represent a RETURN_VOID statement 23 | * 24 | * @see ST#RETURN_VOID 25 | * 26 | * @author Panxiaobo 27 | * @version $Rev$ 28 | */ 29 | public class ReturnVoidStmt extends E0Stmt { 30 | 31 | public ReturnVoidStmt() { 32 | super(ST.RETURN_VOID); 33 | } 34 | 35 | @Override 36 | public Stmt clone(LabelAndLocalMapper mapper) { 37 | return new ReturnVoidStmt(); 38 | } 39 | 40 | @Override 41 | public String toString() { 42 | return "return"; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /dex-ir/src/main/java/com/googlecode/dex2jar/ir/ts/StatedTransformer.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.dex2jar.ir.ts; 2 | 3 | import com.googlecode.dex2jar.ir.IrMethod; 4 | 5 | public abstract class StatedTransformer implements Transformer { 6 | public abstract boolean transformReportChanged(IrMethod method); 7 | 8 | @Override 9 | public void transform(IrMethod method) { 10 | transformReportChanged(method); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /dex-ir/src/main/java/com/googlecode/dex2jar/ir/ts/Transformer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012 Panxiaobo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.dex2jar.ir.ts; 17 | 18 | import com.googlecode.dex2jar.ir.IrMethod; 19 | 20 | /** 21 | * TODO DOC 22 | * 23 | * @author Panxiaobo 24 | * @version $Rev$ 25 | */ 26 | public interface Transformer { 27 | 28 | public void transform(IrMethod method); 29 | } 30 | -------------------------------------------------------------------------------- /dex-ir/src/main/java/com/googlecode/dex2jar/ir/ts/UniqueQueue.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.dex2jar.ir.ts; 2 | 3 | import java.util.Collection; 4 | import java.util.HashSet; 5 | import java.util.LinkedList; 6 | import java.util.Set; 7 | 8 | public class UniqueQueue extends LinkedList { 9 | Set set = new HashSet<>(); 10 | 11 | public UniqueQueue() { 12 | } 13 | 14 | @Override 15 | public boolean addAll(Collection c) { 16 | boolean result = false; 17 | for (T t : c) { 18 | if (add(t)) { 19 | result = true; 20 | } 21 | } 22 | return result; 23 | 24 | } 25 | 26 | @Override 27 | public boolean add(T t) { 28 | if (set.add(t)) { 29 | super.add(t); 30 | } 31 | return true; 32 | } 33 | 34 | public T poll() { 35 | T t = super.poll(); 36 | set.remove(t); 37 | return t; 38 | } 39 | 40 | @Override 41 | public T pop() { 42 | T t = super.pop(); 43 | set.remove(t); 44 | return t; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /dex-ir/src/main/java/com/googlecode/dex2jar/ir/ts/an/AnalyzeValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * dex2jar - Tools to work with android .dex and java .class files 3 | * Copyright (c) 2009-2012 Panxiaobo 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.googlecode.dex2jar.ir.ts.an; 18 | 19 | public interface AnalyzeValue { 20 | 21 | public char toRsp(); 22 | } 23 | -------------------------------------------------------------------------------- /dex-ir/src/main/java/com/googlecode/dex2jar/ir/ts/an/SimpleLiveValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * dex2jar - Tools to work with android .dex and java .class files 3 | * Copyright (c) 2009-2013 Panxiaobo 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.googlecode.dex2jar.ir.ts.an; 18 | 19 | import java.util.List; 20 | 21 | public class SimpleLiveValue implements AnalyzeValue { 22 | public boolean used = false; 23 | 24 | public SimpleLiveValue parent; 25 | public List otherParents; 26 | 27 | @Override 28 | public char toRsp() { 29 | return used ? 'x' : '.'; 30 | } 31 | } -------------------------------------------------------------------------------- /dex-ir/src/test/java/com/googlecode/dex2jar/ir/test/ConstantStringTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.dex2jar.ir.test; 2 | 3 | 4 | import com.googlecode.dex2jar.ir.expr.Exprs; 5 | import org.junit.Assert; 6 | import org.junit.Test; 7 | 8 | public class ConstantStringTest { 9 | @Test 10 | public void test() { 11 | String s = Exprs.nString("a\nb").toString(); 12 | Assert.assertEquals("\"a\\nb\"", s); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /dex-ir/src/test/java/com/googlecode/dex2jar/ir/test/DeadCodeTrnasformerTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.dex2jar.ir.test; 2 | 3 | import com.googlecode.dex2jar.ir.stmt.Stmt; 4 | import com.googlecode.dex2jar.ir.stmt.Stmts; 5 | import com.googlecode.dex2jar.ir.ts.DeadCodeTransformer; 6 | import org.junit.Assert; 7 | import org.junit.Test; 8 | 9 | public class DeadCodeTrnasformerTest extends BaseTransformerTest { 10 | @Test 11 | public void test09DeadCode() { 12 | Stmt ret = addStmt(Stmts.nReturnVoid()); 13 | Stmt lb = addStmt(newLabel()); 14 | addStmt(Stmts.nReturnVoid()); 15 | transform(); 16 | Assert.assertSame(ret, method.stmts.getFirst()); 17 | Assert.assertSame(ret, method.stmts.getLast()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /dex-ir/src/test/java/com/googlecode/dex2jar/ir/test/RemoveLocalFromSSATest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.dex2jar.ir.test; 2 | 3 | import com.googlecode.dex2jar.ir.expr.Local; 4 | import com.googlecode.dex2jar.ir.stmt.Stmt; 5 | import com.googlecode.dex2jar.ir.ts.RemoveLocalFromSSA; 6 | import org.junit.Assert; 7 | import org.junit.Test; 8 | 9 | import static com.googlecode.dex2jar.ir.expr.Exprs.nInt; 10 | import static com.googlecode.dex2jar.ir.stmt.Stmts.nAssign; 11 | import static com.googlecode.dex2jar.ir.stmt.Stmts.nReturn; 12 | 13 | public class RemoveLocalFromSSATest extends BaseTransformerTest { 14 | @Test 15 | public void t001() { 16 | 17 | Local a = addLocal("a"); 18 | Local b = addLocal("b"); 19 | Local c = addLocal("c"); 20 | 21 | Stmt sa = addStmt(nAssign(a, nInt(0))); 22 | addStmt(nAssign(b, a)); 23 | addStmt(nAssign(c, b)); 24 | Stmt sb = addStmt(nReturn(c)); 25 | transform(); 26 | Assert.assertEquals(sa.getOp1(), sb.getOp()); 27 | Assert.assertEquals("1 local should left", 1, locals.size()); 28 | } 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /dex-ir/src/test/java/com/googlecode/dex2jar/ir/test/StmtListTest.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.dex2jar.ir.test; 2 | 3 | import static com.googlecode.dex2jar.ir.expr.Exprs.nCast; 4 | import static com.googlecode.dex2jar.ir.expr.Exprs.nGt; 5 | import static com.googlecode.dex2jar.ir.expr.Exprs.nInt; 6 | import static com.googlecode.dex2jar.ir.expr.Exprs.nLocal; 7 | import static com.googlecode.dex2jar.ir.expr.Exprs.nParameterRef; 8 | import static com.googlecode.dex2jar.ir.expr.Exprs.nThisRef; 9 | 10 | import org.junit.Test; 11 | 12 | import com.googlecode.dex2jar.ir.expr.Local; 13 | import com.googlecode.dex2jar.ir.stmt.LabelStmt; 14 | import com.googlecode.dex2jar.ir.stmt.StmtList; 15 | import com.googlecode.dex2jar.ir.stmt.Stmts; 16 | 17 | public class StmtListTest { 18 | @Test 19 | public void toStringTest() { 20 | 21 | StmtList list = new StmtList(); 22 | Local a = nLocal("this"); 23 | Local b = nLocal("b"); 24 | Local c = nLocal("c"); 25 | Local d = nLocal("d"); 26 | LabelStmt L1 = Stmts.nLabel(); 27 | 28 | list.add(Stmts.nIdentity(a, nThisRef("La/Some;"))); 29 | list.add(Stmts.nIdentity(b, nParameterRef("I", 0))); 30 | list.add(Stmts.nIdentity(c, nParameterRef("J", 1))); 31 | list.add(Stmts.nIdentity(d, nParameterRef("F", 2))); 32 | list.add(Stmts.nIf(nGt(b, nInt(0), "I"), L1)); 33 | list.add(Stmts.nAssign(c, nCast(d, "F", "J"))); 34 | list.add(L1); 35 | list.toString(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /dex-obfuscator/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | } 8 | 9 | dependencies { 10 | compile project(':dex-ir') 11 | compile project(":asm") 12 | 13 | // compile 'org.ow2.asm:asm-debug-all:5.0.3' 14 | } 15 | -------------------------------------------------------------------------------- /dex-obfuscator/src/main/java/top/niunaijun/obfuscator/ObfuscatorConfiguration.java: -------------------------------------------------------------------------------- 1 | package top.niunaijun.obfuscator; 2 | 3 | public abstract class ObfuscatorConfiguration { 4 | 5 | /** 6 | * 混淆深度 7 | */ 8 | public int getObfDepth() { 9 | return 1; 10 | } 11 | 12 | /** 13 | * 是否处理此method 14 | * @param className className 15 | * @param methodName methodName 16 | */ 17 | public boolean accept(String className, String methodName) { 18 | return true; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /dex-obfuscator/src/main/java/top/niunaijun/obfuscator/RebuildIfResult.java: -------------------------------------------------------------------------------- 1 | package top.niunaijun.obfuscator; 2 | 3 | import com.googlecode.dex2jar.ir.stmt.Stmt; 4 | 5 | import java.util.List; 6 | 7 | public class RebuildIfResult { 8 | private List result; 9 | 10 | public RebuildIfResult(List result) { 11 | this.result = result; 12 | } 13 | 14 | public List getResult() { 15 | return result; 16 | } 17 | 18 | public void setResult(List result) { 19 | this.result = result; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /dex-obfuscator/src/main/java/top/niunaijun/obfuscator/chain/base/ObfuscatorChain.java: -------------------------------------------------------------------------------- 1 | package top.niunaijun.obfuscator.chain.base; 2 | 3 | import com.googlecode.dex2jar.ir.IrMethod; 4 | import com.googlecode.dex2jar.ir.stmt.Stmt; 5 | import top.niunaijun.obfuscator.RebuildIfResult; 6 | 7 | import java.util.List; 8 | 9 | public interface ObfuscatorChain { 10 | 11 | boolean canDepth(); 12 | 13 | boolean canHandle(IrMethod ir, Stmt stmt); 14 | 15 | RebuildIfResult reBuild(IrMethod ir, Stmt stmt, List origStmts); 16 | 17 | void reBuildEnd(IrMethod ir, List newStmts, List origStmts); 18 | } 19 | -------------------------------------------------------------------------------- /dex-reader-api/build.gradle: -------------------------------------------------------------------------------- 1 | description = 'Dex Reader API' 2 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/DexType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012 Panxiaobo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.d2j; 17 | 18 | /** 19 | * a light weight version of org.objectweb.asm.Type 20 | * 21 | * @author Panxiaobo 22 | * @version $Rev$ 23 | * 24 | */ 25 | public class DexType { 26 | public DexType(String desc) { 27 | this.desc = desc; 28 | } 29 | 30 | /** 31 | * type descriptor, in TypeDescriptor format 32 | */ 33 | final public String desc; 34 | 35 | @Override 36 | public String toString() { 37 | return desc; 38 | } 39 | } -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/Visibility.java: -------------------------------------------------------------------------------- 1 | /* 2 | * dex2jar - Tools to work with android .dex and java .class files 3 | * Copyright (c) 2009-2013 Panxiaobo 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.googlecode.d2j; 18 | 19 | /** 20 | * @author bob 21 | */ 22 | public enum Visibility { 23 | BUILD(0), RUNTIME(1), SYSTEM(2); 24 | public int value; 25 | 26 | // int VISIBILITY_BUILD = 0; 27 | // int VISIBILITY_RUNTIME = 1; 28 | // int VISIBILITY_SYSTEM = 2; 29 | Visibility(int v) { 30 | this.value = v; 31 | } 32 | 33 | public String displayName() { 34 | return name().toLowerCase(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/node/TryCatchNode.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.node; 2 | 3 | import com.googlecode.d2j.DexLabel; 4 | import com.googlecode.d2j.visitors.DexCodeVisitor; 5 | 6 | public class TryCatchNode { 7 | 8 | public final DexLabel start; 9 | public final DexLabel end; 10 | public final DexLabel[] handler; 11 | public final String[] type; 12 | 13 | public TryCatchNode(DexLabel start, DexLabel end, DexLabel[] handler, String[] type) { 14 | this.start = start; 15 | this.end = end; 16 | this.handler = handler; 17 | this.type = type; 18 | } 19 | 20 | public void accept(DexCodeVisitor cv) { 21 | cv.visitTryCatch(start, end, handler, type); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/node/analysis/DvmInterpreter.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.node.analysis; 2 | 3 | import com.googlecode.d2j.node.insn.DexStmtNode; 4 | 5 | import java.util.List; 6 | 7 | public abstract class DvmInterpreter { 8 | 9 | /** 10 | * CONST* 11 | * SGET* 12 | * NEW 13 | * 14 | * 15 | */ 16 | public abstract V newOperation(DexStmtNode insn) ; 17 | 18 | /** 19 | * MOVE* 20 | */ 21 | public abstract V copyOperation(DexStmtNode insn, V value) ; 22 | 23 | /** 24 | * NEG* 25 | * *_TO_* 26 | * IF_*Z 27 | * *SWITCH 28 | * IGET* 29 | * NEW_ARRAY 30 | * MONITOR_* 31 | * CHECK_CAST 32 | * INSTANCEOF 33 | 34 | */ 35 | public abstract V unaryOperation(DexStmtNode insn, V value); 36 | 37 | /** 38 | * AGET* 39 | * IPUT* 40 | * 41 | */ 42 | public abstract V binaryOperation(DexStmtNode insn, V value1, V value2); 43 | 44 | /** 45 | * APUT 46 | */ 47 | public abstract V ternaryOperation(DexStmtNode insn, V value1, 48 | V value2, V value3) ; 49 | 50 | /** 51 | * INVOKE* 52 | * MULTIANEWARRAY 53 | * FilledNewArrayStmt 54 | */ 55 | public abstract V naryOperation(DexStmtNode insn, 56 | List values) ; 57 | 58 | /** 59 | * RETURN* 60 | */ 61 | public abstract void returnOperation(DexStmtNode insn, V value); 62 | } 63 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/node/insn/AbstractMethodStmtNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2017 Panxiaobo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.d2j.node.insn; 17 | 18 | import com.googlecode.d2j.Proto; 19 | import com.googlecode.d2j.reader.Op; 20 | 21 | public abstract class AbstractMethodStmtNode extends DexStmtNode { 22 | public final int[] args; 23 | 24 | public AbstractMethodStmtNode(Op op, int[] args) { 25 | super(op); 26 | this.args = args; 27 | } 28 | 29 | public abstract Proto getProto(); 30 | } 31 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/node/insn/BaseSwitchStmtNode.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.node.insn; 2 | 3 | import com.googlecode.d2j.DexLabel; 4 | import com.googlecode.d2j.reader.Op; 5 | 6 | public abstract class BaseSwitchStmtNode extends DexStmtNode { 7 | 8 | public final int a; 9 | public final DexLabel[] labels; 10 | 11 | protected BaseSwitchStmtNode(Op op, int a, DexLabel[] labels) { 12 | super(op); 13 | this.a = a; 14 | this.labels = labels; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/node/insn/ConstStmtNode.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.node.insn; 2 | 3 | import com.googlecode.d2j.reader.Op; 4 | import com.googlecode.d2j.visitors.DexCodeVisitor; 5 | 6 | 7 | public class ConstStmtNode extends DexStmtNode { 8 | public final int a; 9 | public final Object value; 10 | 11 | public ConstStmtNode(Op op, int a, Object value) { 12 | super(op); 13 | this.a = a; 14 | this.value = value; 15 | } 16 | 17 | @Override 18 | public void accept(DexCodeVisitor cv) { 19 | cv.visitConstStmt(op, a, value); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/node/insn/DexLabelStmtNode.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.node.insn; 2 | 3 | import com.googlecode.d2j.DexLabel; 4 | import com.googlecode.d2j.visitors.DexCodeVisitor; 5 | 6 | public class DexLabelStmtNode extends DexStmtNode { 7 | public DexLabel label; 8 | 9 | public DexLabelStmtNode(DexLabel label) { 10 | super(null); 11 | this.label = label; 12 | } 13 | 14 | @Override 15 | public void accept(DexCodeVisitor cv) { 16 | cv.visitLabel(label); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/node/insn/DexStmtNode.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.node.insn; 2 | 3 | import com.googlecode.d2j.reader.Op; 4 | import com.googlecode.d2j.visitors.DexCodeVisitor; 5 | 6 | 7 | public abstract class DexStmtNode { 8 | public final Op op; 9 | 10 | public int __index; 11 | 12 | protected DexStmtNode(Op op) { 13 | this.op = op; 14 | } 15 | 16 | public abstract void accept(DexCodeVisitor cv); 17 | } 18 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/node/insn/FieldStmtNode.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.node.insn; 2 | 3 | import com.googlecode.d2j.Field; 4 | import com.googlecode.d2j.reader.Op; 5 | import com.googlecode.d2j.visitors.DexCodeVisitor; 6 | 7 | public class FieldStmtNode extends DexStmtNode { 8 | 9 | public final int a; 10 | public final int b; 11 | public final Field field; 12 | 13 | public FieldStmtNode(Op op, int a, int b, Field field) { 14 | super(op); 15 | this.a = a; 16 | this.b = b; 17 | this.field = field; 18 | } 19 | 20 | @Override 21 | public void accept(DexCodeVisitor cv) { 22 | cv.visitFieldStmt(op, a, b, field); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/node/insn/FillArrayDataStmtNode.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.node.insn; 2 | 3 | import com.googlecode.d2j.reader.Op; 4 | import com.googlecode.d2j.visitors.DexCodeVisitor; 5 | 6 | public class FillArrayDataStmtNode extends DexStmtNode { 7 | 8 | public final int ra; 9 | public final Object array; 10 | 11 | public FillArrayDataStmtNode(Op op, int ra, Object array) { 12 | super(op); 13 | this.ra = ra; 14 | this.array = array; 15 | } 16 | 17 | @Override 18 | public void accept(DexCodeVisitor cv) { 19 | cv.visitFillArrayDataStmt(op, ra, array); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/node/insn/FilledNewArrayStmtNode.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.node.insn; 2 | 3 | import com.googlecode.d2j.reader.Op; 4 | import com.googlecode.d2j.visitors.DexCodeVisitor; 5 | 6 | public class FilledNewArrayStmtNode extends DexStmtNode { 7 | 8 | public final int[] args; 9 | public final String type; 10 | 11 | public FilledNewArrayStmtNode(Op op, int[] args, String type) { 12 | super(op); 13 | this.args = args; 14 | this.type = type; 15 | } 16 | 17 | @Override 18 | public void accept(DexCodeVisitor cv) { 19 | cv.visitFilledNewArrayStmt(op, args, type); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/node/insn/JumpStmtNode.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.node.insn; 2 | 3 | import com.googlecode.d2j.DexLabel; 4 | import com.googlecode.d2j.reader.Op; 5 | import com.googlecode.d2j.visitors.DexCodeVisitor; 6 | 7 | public class JumpStmtNode extends DexStmtNode { 8 | public final int a; 9 | public final int b; 10 | public final DexLabel label; 11 | 12 | public JumpStmtNode(Op op, int a, int b, DexLabel label) { 13 | super(op); 14 | this.a = a; 15 | this.b = b; 16 | this.label = label; 17 | } 18 | 19 | @Override 20 | public void accept(DexCodeVisitor cv) { 21 | cv.visitJumpStmt(op, a, b, label); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/node/insn/MethodPolymorphicStmtNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2017 Panxiaobo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.d2j.node.insn; 17 | 18 | import com.googlecode.d2j.Method; 19 | import com.googlecode.d2j.Proto; 20 | import com.googlecode.d2j.reader.Op; 21 | import com.googlecode.d2j.visitors.DexCodeVisitor; 22 | 23 | public class MethodPolymorphicStmtNode extends AbstractMethodStmtNode { 24 | public final Method method; 25 | public final Proto proto; 26 | 27 | public MethodPolymorphicStmtNode(Op op, int[] args, Method method, Proto proto) { 28 | super(op, args); 29 | this.method = method; 30 | this.proto = proto; 31 | } 32 | 33 | @Override 34 | public void accept(DexCodeVisitor cv) { 35 | cv.visitMethodStmt(op, args, method, proto); 36 | } 37 | 38 | @Override 39 | public Proto getProto() { 40 | return proto; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/node/insn/MethodStmtNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2017 Panxiaobo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.d2j.node.insn; 17 | 18 | import com.googlecode.d2j.Method; 19 | import com.googlecode.d2j.Proto; 20 | import com.googlecode.d2j.reader.Op; 21 | import com.googlecode.d2j.visitors.DexCodeVisitor; 22 | 23 | public class MethodStmtNode extends AbstractMethodStmtNode { 24 | public final Method method; 25 | 26 | public MethodStmtNode(Op op, int[] args, Method method) { 27 | super(op, args); 28 | this.method = method; 29 | } 30 | 31 | @Override 32 | public void accept(DexCodeVisitor cv) { 33 | cv.visitMethodStmt(op, args, method); 34 | } 35 | 36 | @Override 37 | public Proto getProto() { 38 | return method.getProto(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/node/insn/PackedSwitchStmtNode.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.node.insn; 2 | 3 | import com.googlecode.d2j.DexLabel; 4 | import com.googlecode.d2j.reader.Op; 5 | import com.googlecode.d2j.visitors.DexCodeVisitor; 6 | 7 | public class PackedSwitchStmtNode extends BaseSwitchStmtNode { 8 | 9 | public final int first_case; 10 | 11 | public PackedSwitchStmtNode(Op op, int a, int first_case, DexLabel[] labels) { 12 | super(op, a,labels); 13 | this.first_case = first_case; 14 | } 15 | 16 | @Override 17 | public void accept(DexCodeVisitor cv) { 18 | cv.visitPackedSwitchStmt(op, a, first_case, labels); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/node/insn/SparseSwitchStmtNode.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.node.insn; 2 | 3 | import com.googlecode.d2j.DexLabel; 4 | import com.googlecode.d2j.reader.Op; 5 | import com.googlecode.d2j.visitors.DexCodeVisitor; 6 | 7 | public class SparseSwitchStmtNode extends BaseSwitchStmtNode { 8 | 9 | public final int[] cases; 10 | 11 | public SparseSwitchStmtNode(Op op, int a, int[] cases, DexLabel[] labels) { 12 | super(op, a, labels); 13 | this.cases = cases; 14 | } 15 | 16 | @Override 17 | public void accept(DexCodeVisitor cv) { 18 | cv.visitSparseSwitchStmt(op, a, cases, labels); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/node/insn/Stmt0RNode.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.node.insn; 2 | 3 | import com.googlecode.d2j.reader.Op; 4 | import com.googlecode.d2j.visitors.DexCodeVisitor; 5 | 6 | public class Stmt0RNode extends DexStmtNode { 7 | public Stmt0RNode(Op op) { 8 | super(op); 9 | } 10 | @Override 11 | public void accept(DexCodeVisitor cv) { 12 | cv.visitStmt0R(op); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/node/insn/Stmt1RNode.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.node.insn; 2 | 3 | import com.googlecode.d2j.reader.Op; 4 | import com.googlecode.d2j.visitors.DexCodeVisitor; 5 | 6 | public class Stmt1RNode extends DexStmtNode { 7 | 8 | public final int a; 9 | 10 | public Stmt1RNode(Op op, int a) { 11 | super(op); 12 | this.a = a; 13 | } 14 | 15 | @Override 16 | public void accept(DexCodeVisitor cv) { 17 | cv.visitStmt1R(op, a); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/node/insn/Stmt2R1NNode.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.node.insn; 2 | 3 | import com.googlecode.d2j.reader.Op; 4 | import com.googlecode.d2j.visitors.DexCodeVisitor; 5 | 6 | public class Stmt2R1NNode extends DexStmtNode { 7 | 8 | public final int distReg; 9 | public final int srcReg; 10 | public final int content; 11 | 12 | public Stmt2R1NNode(Op op, int distReg, int srcReg, int content) { 13 | super(op); 14 | this.distReg = distReg; 15 | this.srcReg = srcReg; 16 | this.content = content; 17 | } 18 | 19 | @Override 20 | public void accept(DexCodeVisitor cv) { 21 | cv.visitStmt2R1N(op, distReg, srcReg, content); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/node/insn/Stmt2RNode.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.node.insn; 2 | 3 | import com.googlecode.d2j.reader.Op; 4 | import com.googlecode.d2j.visitors.DexCodeVisitor; 5 | 6 | public class Stmt2RNode extends DexStmtNode { 7 | public final int a; 8 | public final int b; 9 | 10 | public Stmt2RNode(Op op, int a, int b) { 11 | super(op); 12 | this.a = a; 13 | this.b = b; 14 | } 15 | 16 | @Override 17 | public void accept(DexCodeVisitor cv) { 18 | cv.visitStmt2R(op, a, b); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/node/insn/Stmt3RNode.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.node.insn; 2 | 3 | import com.googlecode.d2j.reader.Op; 4 | import com.googlecode.d2j.visitors.DexCodeVisitor; 5 | 6 | public class Stmt3RNode extends DexStmtNode { 7 | public final int a; 8 | public final int b; 9 | public final int c; 10 | 11 | public Stmt3RNode(Op op, int a, int b, int c) { 12 | super(op); 13 | this.a = a; 14 | this.b = b; 15 | this.c = c; 16 | } 17 | 18 | @Override 19 | public void accept(DexCodeVisitor cv) { 20 | cv.visitStmt3R(op, a, b, c); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/node/insn/TypeStmtNode.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.node.insn; 2 | 3 | import com.googlecode.d2j.reader.Op; 4 | import com.googlecode.d2j.visitors.DexCodeVisitor; 5 | 6 | public class TypeStmtNode extends DexStmtNode { 7 | 8 | public final int a; 9 | public final int b; 10 | public final String type; 11 | 12 | public TypeStmtNode(Op op, int a, int b, String type) { 13 | super(op); 14 | this.a = a; 15 | this.b = b; 16 | this.type = type; 17 | } 18 | 19 | @Override 20 | public void accept(DexCodeVisitor cv) { 21 | cv.visitTypeStmt(op, a, b, type); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/reader/CFG.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.reader; 2 | 3 | public interface CFG { 4 | public static final int kInstrCanBranch = 1; // conditional or unconditional branch 5 | public static final int kInstrCanContinue = 1 << 1; // flow can continue to next statement 6 | public static final int kInstrCanSwitch = 1 << 2; // switch 7 | public static final int kInstrCanThrow = 1 << 3; // could cause an exception to be thrown 8 | public static final int kInstrCanReturn = 1 << 4; // returns, no additional statements 9 | public static final int kInstrInvoke = 1 << 5; // a flavor of invoke 10 | 11 | } 12 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/reader/InstructionIndexType.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.reader; 2 | 3 | /* package */enum InstructionIndexType { 4 | kIndexUnknown, // 5 | kIndexNone, // has no index 6 | kIndexVaries, // "It depends." Used for throw-verification-error 7 | kIndexTypeRef, // type reference index 8 | kIndexStringRef, // string reference index 9 | kIndexMethodRef, // method reference index 10 | kIndexFieldRef, // field reference index 11 | kIndexInlineMethod, // inline method index (for inline linked methods) 12 | kIndexVtableOffset, // vtable offset (for static linked methods) 13 | kIndexFieldOffset, // field offset (for static linked fields) 14 | kIndexMethodAndProtoRef, // 038, 15 | kIndexCallSiteRef, // 038, 16 | }; -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/visitors/DexAnnotationAble.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012 Panxiaobo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.d2j.visitors; 17 | 18 | import com.googlecode.d2j.Visibility; 19 | 20 | /** 21 | * 用于访问注解 22 | * 23 | * @author Panxiaobo 24 | * @version $Rev$ 25 | */ 26 | public interface DexAnnotationAble { 27 | 28 | /** 29 | * 访问注解 30 | * 31 | * @param name 32 | * 注解名 33 | * @param visibility 34 | * 是否运行时可见 35 | * @return 36 | */ 37 | DexAnnotationVisitor visitAnnotation(String name, Visibility visibility); 38 | } 39 | -------------------------------------------------------------------------------- /dex-reader-api/src/main/java/com/googlecode/d2j/visitors/DexFieldVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012 Panxiaobo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.googlecode.d2j.visitors; 18 | 19 | import com.googlecode.d2j.Visibility; 20 | 21 | /** 22 | * @author bob 23 | * 24 | */ 25 | public class DexFieldVisitor implements DexAnnotationAble { 26 | protected DexFieldVisitor visitor; 27 | 28 | public DexFieldVisitor(DexFieldVisitor visitor) { 29 | super(); 30 | this.visitor = visitor; 31 | } 32 | 33 | public DexFieldVisitor() { 34 | } 35 | 36 | public void visitEnd() { 37 | if (visitor == null) { 38 | return; 39 | } 40 | visitor.visitEnd(); 41 | } 42 | 43 | public DexAnnotationVisitor visitAnnotation(String name, Visibility visibility) { 44 | if (visitor == null) { 45 | return null; 46 | } 47 | return visitor.visitAnnotation(name, visibility); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /dex-reader/build.gradle: -------------------------------------------------------------------------------- 1 | description = 'Dex Reader' 2 | 3 | dependencies { 4 | compile project(':dex-reader-api') 5 | testCompile (group: 'org.apache.commons', name: 'commons-compress', version:'1.4.1') 6 | } 7 | 8 | 9 | -------------------------------------------------------------------------------- /dex-reader/src/main/java/com/googlecode/d2j/reader/BaseDexFileReader.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.reader; 2 | 3 | import com.googlecode.d2j.visitors.DexFileVisitor; 4 | 5 | import java.util.List; 6 | 7 | public interface BaseDexFileReader { 8 | 9 | int getDexVersion(); 10 | 11 | void accept(DexFileVisitor dv); 12 | 13 | List getClassNames(); 14 | 15 | void accept(DexFileVisitor dv, int config); 16 | 17 | void accept(DexFileVisitor dv, int classIdx, int config); 18 | } 19 | -------------------------------------------------------------------------------- /dex-reader/src/main/java/com/googlecode/d2j/util/ArrayOut.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012 Panxiaobo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.d2j.util; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | 21 | /** 22 | * @author Panxiaobo 23 | * @version $Rev$ 24 | */ 25 | public class ArrayOut implements Out { 26 | 27 | int i = 0; 28 | 29 | public List array = new ArrayList(); 30 | public List is = new ArrayList(); 31 | 32 | @Override 33 | public void push() { 34 | i++; 35 | } 36 | 37 | @Override 38 | public void s(String s) { 39 | is.add(i); 40 | array.add(s); 41 | } 42 | 43 | @Override 44 | public void s(String format, Object... arg) { 45 | s(String.format(format, arg)); 46 | } 47 | 48 | @Override 49 | public void pop() { 50 | i--; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /dex-reader/src/main/java/com/googlecode/d2j/util/Out.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.util; 2 | 3 | public interface Out { 4 | void push(); 5 | 6 | void s(String s); 7 | 8 | void s(String format, Object... arg); 9 | 10 | void pop(); 11 | } 12 | -------------------------------------------------------------------------------- /dex-reader/src/main/java/com/googlecode/d2j/util/zip/AccessBufByteArrayOutputStream.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.util.zip; 2 | 3 | import java.io.ByteArrayOutputStream; 4 | 5 | public class AccessBufByteArrayOutputStream extends ByteArrayOutputStream { 6 | public byte[] getBuf() { 7 | return buf; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /dex-reader/src/test/java/com/googlecode/d2j/reader/test/SkipDupMethod.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.reader.test; 2 | 3 | 4 | import com.googlecode.d2j.node.DexFileNode; 5 | import com.googlecode.d2j.reader.DexFileReader; 6 | import org.junit.Assert; 7 | import org.junit.Test; 8 | 9 | import java.io.IOException; 10 | import java.io.InputStream; 11 | 12 | public class SkipDupMethod { 13 | @Test 14 | public void test() throws IOException { 15 | InputStream is = SkipDupMethod.class.getClassLoader().getResourceAsStream("i200.dex"); 16 | Assert.assertNotNull(is); 17 | DexFileReader reader = new DexFileReader(is); 18 | DexFileNode dfn1 = new DexFileNode(); 19 | reader.accept(dfn1, DexFileReader.KEEP_ALL_METHODS); 20 | DexFileNode dfn2 = new DexFileNode(); 21 | reader.accept(dfn2, 0); 22 | Assert.assertTrue(dfn1.clzs.get(0).methods.size() > dfn2.clzs.get(0).methods.size()); 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /dex-reader/src/test/resources/i200.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Familyye/BlackObfuscator/1215be685eb63c383023faefa8fcb0c6a91c6b14/dex-reader/src/test/resources/i200.dex -------------------------------------------------------------------------------- /dex-tools/build.gradle: -------------------------------------------------------------------------------- 1 | description = 'Dex Tools' 2 | apply plugin: 'application' 3 | 4 | mainClassName = "com.googlecode.dex2jar.tools.BaseCmd" 5 | 6 | dependencies { 7 | compile project(':dex-translator') 8 | compile project(':d2j-smali') 9 | compile project(':d2j-jasmin') 10 | compile project(':dex-writer') 11 | compile project(':dex-obfuscator') 12 | compile project(':d2j-base-cmd') 13 | compile project(':dexlib2') 14 | compile project(":asm") 15 | compile project(":dx") 16 | 17 | } 18 | 19 | task bin_gen(type: JavaExec) { 20 | dependsOn jar 21 | classpath sourceSets.main.runtimeClasspath 22 | ext.binDir = "$buildDir/generated-sources/bin" 23 | outputs.dir file(ext.binDir) 24 | main = 'com.googlecode.dex2jar.bin_gen.BinGen' 25 | args = ["$projectDir/src/main/bin_gen", "$ext.binDir"] 26 | } 27 | applicationDistribution.from(bin_gen) 28 | //applicationDistribution.from('src/main/jars') { 29 | // into("lib") 30 | //} 31 | applicationDistribution.from('open-source-license.txt') { 32 | into("lib") 33 | } 34 | applicationDistribution.from("$parent.rootDir") { 35 | include("NOTICE.txt") 36 | include("LICENSE.txt") 37 | } 38 | 39 | startScripts.dependsOn bin_gen 40 | 41 | artifacts.archives distZip 42 | 43 | -------------------------------------------------------------------------------- /dex-tools/src/main/assemble/package.xml: -------------------------------------------------------------------------------- 1 | 5 | distribution 6 | 7 | zip 8 | 9 | 10 | 11 | 12 | target/bin/ 13 | 14 | *.sh 15 | *.bat 16 | 17 | / 18 | 19 | 20 | 21 | 22 | ../LICENSE.txt 23 | 664 24 | / 25 | 26 | 27 | ../NOTICE.txt 28 | 664 29 | / 30 | 31 | 32 | open-source-license.txt 33 | 664 34 | /lib 35 | 36 | 37 | 38 | 39 | /lib 40 | runtime 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /dex-tools/src/main/bin_gen/bat_template: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM 4 | REM dex2jar - Tools to work with android .dex and java .class files 5 | REM Copyright (c) 2009-2013 Panxiaobo 6 | REM 7 | REM Licensed under the Apache License, Version 2.0 (the "License"); 8 | REM you may not use this file except in compliance with the License. 9 | REM You may obtain a copy of the License at 10 | REM 11 | REM http://www.apache.org/licenses/LICENSE-2.0 12 | REM 13 | REM Unless required by applicable law or agreed to in writing, software 14 | REM distributed under the License is distributed on an "AS IS" BASIS, 15 | REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | REM See the License for the specific language governing permissions and 17 | REM limitations under the License. 18 | REM 19 | 20 | REM call d2j_invoke.bat to setup java environment 21 | @"%~dp0d2j_invoke.bat" __@class_name@__ %* 22 | -------------------------------------------------------------------------------- /dex-tools/src/main/bin_gen/class.cfg: -------------------------------------------------------------------------------- 1 | 2 | # from dex-reader 3 | #d2j-dex-asmifier=com.googlecode.dex2jar.util.ASMifierFileV 4 | #d2j-dex-dump=com.googlecode.dex2jar.util.Dump 5 | 6 | # from dex-tool 7 | #d2j-dex2jar=com.googlecode.dex2jar.tools.Dex2jarCmd 8 | #d2j-jar2dex=com.googlecode.dex2jar.tools.Jar2Dex 9 | #d2j-asm-verify=com.googlecode.dex2jar.tools.AsmVerify 10 | #d2j-jar2jasmin=com.googlecode.d2j.jasmin.Jar2JasminCmd 11 | #d2j-jasmin2jar=com.googlecode.d2j.jasmin.Jasmin2JarCmd 12 | 13 | #d2j-apk-sign=com.googlecode.dex2jar.tools.ApkSign 14 | 15 | #d2j-init-deobf=com.googlecode.dex2jar.tools.DeObfInitCmd 16 | #d2j-jar-remap=com.googlecode.dex2jar.tools.JarRemap 17 | #d2j-jar-access=com.googlecode.dex2jar.tools.JarAccessCmd 18 | #d2j-decrypt-string=com.googlecode.dex2jar.tools.DecryptStringCmd 19 | black-obfuscator=com.googlecode.dex2jar.tools.BlackObfuscatorCmd 20 | #d2j-smali=com.googlecode.d2j.smali.SmaliCmd 21 | #d2j-baksmali=com.googlecode.d2j.smali.BaksmaliCmd 22 | #d2j-dex2smali=com.googlecode.d2j.smali.BaksmaliCmd 23 | #d2j-dex-remap=com.googlecode.dex2jar.tools.DexRemapCmd 24 | 25 | 26 | #d2j-dex-recompute-checksum=com.googlecode.dex2jar.tools.DexRecomputeChecksum 27 | #d2j-std-apk=com.googlecode.dex2jar.tools.StdApkCmd 28 | 29 | #d2j-dex-weaver=com.googlecode.dex2jar.tools.DexWeaverCmd 30 | #d2j-jar-weaver=com.googlecode.dex2jar.tools.JarWeaverCmd 31 | 32 | #d2j-class-version-switch=com.googlecode.dex2jar.tools.ClassVersionSwitch 33 | 34 | #EOF 35 | -------------------------------------------------------------------------------- /dex-tools/src/main/bin_gen/d2j_invoke.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | REM better invocation scripts for windows from lanchon, release in public domain. thanks! 3 | REM https://code.google.com/p/dex2jar/issues/detail?id=192 4 | 5 | setlocal enabledelayedexpansion 6 | 7 | set LIB=%~dp0lib 8 | 9 | set CP= 10 | for %%X in ("%LIB%"\*.jar) do ( 11 | set CP=!CP!%%X; 12 | ) 13 | 14 | java -Xms512m -Xmx2048m -cp "%CP%" %* 15 | -------------------------------------------------------------------------------- /dex-tools/src/main/bin_gen/d2j_invoke.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # dex2jar - Tools to work with android .dex and java .class files 5 | # Copyright (c) 2009-2013 Panxiaobo 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | # copy from $Tomcat/bin/startup.sh 21 | # resolve links - $0 may be a softlink 22 | PRG="$0" 23 | while [ -h "$PRG" ] ; do 24 | ls=`ls -ld "$PRG"` 25 | link=`expr "$ls" : '.*-> \(.*\)$'` 26 | if expr "$link" : '/.*' > /dev/null; then 27 | PRG="$link" 28 | else 29 | PRG=`dirname "$PRG"`/"$link" 30 | fi 31 | done 32 | PRGDIR=`dirname "$PRG"` 33 | # 34 | 35 | _classpath="." 36 | if [ `uname -a | grep -i -c cygwin` -ne 0 ]; then # Cygwin, translate the path 37 | for k in "$PRGDIR"/lib/*.jar 38 | do 39 | _classpath="${_classpath};`cygpath -w ${k}`" 40 | done 41 | else 42 | for k in "$PRGDIR"/lib/*.jar 43 | do 44 | _classpath="${_classpath}:${k}" 45 | done 46 | fi 47 | 48 | java -Xms512m -Xmx2048m -classpath "${_classpath}" "$@" 49 | -------------------------------------------------------------------------------- /dex-tools/src/main/bin_gen/sh_template: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # dex2jar - Tools to work with android .dex and java .class files 5 | # Copyright (c) 2009-2013 Panxiaobo 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | # copy from $Tomcat/bin/startup.sh 21 | # resolve links - $0 may be a softlink 22 | PRG="$0" 23 | while [ -h "$PRG" ] ; do 24 | ls=`ls -ld "$PRG"` 25 | link=`expr "$ls" : '.*-> \(.*\)$'` 26 | if expr "$link" : '/.*' > /dev/null; then 27 | PRG="$link" 28 | else 29 | PRG=`dirname "$PRG"`/"$link" 30 | fi 31 | done 32 | PRGDIR=`dirname "$PRG"` 33 | # 34 | 35 | _classpath="." 36 | if [ `uname -a | grep -i -c cygwin` -ne 0 ]; then # Cygwin, translate the path 37 | for k in "$PRGDIR"/lib/*.jar 38 | do 39 | _classpath="${_classpath};`cygpath -w ${k}`" 40 | done 41 | else 42 | for k in "$PRGDIR"/lib/*.jar 43 | do 44 | _classpath="${_classpath}:${k}" 45 | done 46 | fi 47 | 48 | java -Xms512m -Xmx2048m -classpath "${_classpath}" "__@class_name@__" "$@" 49 | -------------------------------------------------------------------------------- /dex-tools/src/main/java/com/googlecode/d2j/tools/jar/ClassInfo.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.tools.jar; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.List; 6 | import java.util.Set; 7 | 8 | public class ClassInfo { 9 | 10 | final public String name; 11 | public List members = new ArrayList(5); 12 | public Set parent = new HashSet(); 13 | 14 | public ClassInfo(String name) { 15 | this.name = name; 16 | } 17 | 18 | public boolean equals(Object o) { 19 | return name.equals(((ClassInfo) o).name); 20 | } 21 | 22 | public int hashCode() { 23 | return name.hashCode(); 24 | } 25 | 26 | public String toString() { 27 | return name; 28 | } 29 | 30 | public static class MemberInfo { 31 | public int access; 32 | public String desc; 33 | public String name; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /dex-tools/src/main/java/com/googlecode/d2j/util/AccUtils.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.util; 2 | 3 | import org.objectweb.asm.Opcodes; 4 | 5 | public class AccUtils { 6 | public static boolean isBridge(int acc) { 7 | return (acc & Opcodes.ACC_BRIDGE) != 0; 8 | } 9 | 10 | public static boolean isEnum(int acc) { 11 | return (acc & Opcodes.ACC_ENUM) != 0; 12 | } 13 | 14 | public static boolean isFinal(int acc) { 15 | return (acc & Opcodes.ACC_FINAL) != 0; 16 | } 17 | 18 | public static boolean isPrivate(int acc) { 19 | return (acc & Opcodes.ACC_PRIVATE) != 0; 20 | } 21 | 22 | public static boolean isProtected(int acc) { 23 | return (acc & Opcodes.ACC_PROTECTED) != 0; 24 | } 25 | 26 | public static boolean isPublic(int acc) { 27 | return (acc & Opcodes.ACC_PUBLIC) != 0; 28 | } 29 | 30 | public static boolean isStatic(int acc) { 31 | return (acc & Opcodes.ACC_STATIC) != 0; 32 | } 33 | 34 | public static boolean isSynthetic(int acc) { 35 | return (acc & Opcodes.ACC_SYNTHETIC) != 0; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /dex-tools/src/main/java/com/googlecode/dex2jar/tools/to/Do.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.dex2jar.tools.to; 2 | 3 | public class Do { 4 | 5 | /** 6 | * @param args 7 | */ 8 | public static void main(String[] args) { 9 | System.out.println("This is not support!"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /dex-tools/src/main/resources/com/googlecode/dex2jar/tools/ApkSign.cer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Familyye/BlackObfuscator/1215be685eb63c383023faefa8fcb0c6a91c6b14/dex-tools/src/main/resources/com/googlecode/dex2jar/tools/ApkSign.cer -------------------------------------------------------------------------------- /dex-tools/src/main/resources/com/googlecode/dex2jar/tools/ApkSign.private: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Familyye/BlackObfuscator/1215be685eb63c383023faefa8fcb0c6a91c6b14/dex-tools/src/main/resources/com/googlecode/dex2jar/tools/ApkSign.private -------------------------------------------------------------------------------- /dex-tools/src/test/java/com/googlecode/d2j/tools/jar/MethodInvocation.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.tools.jar; 2 | 3 | 4 | public interface MethodInvocation { 5 | Object proceed() throws Throwable; 6 | 7 | String getMethodOwner(); 8 | 9 | String getMethodName(); 10 | 11 | String getMethodDesc(); 12 | 13 | Object getThis(); 14 | // @Nullale 15 | Object[] getArguments(); 16 | } 17 | -------------------------------------------------------------------------------- /dex-tools/src/test/resources/weave/a-after.j: -------------------------------------------------------------------------------- 1 | .bytecode 50.0 2 | .class A 3 | .super java/lang/Object 4 | 5 | .method m()V 6 | new d2j/gen/MI__000 7 | dup 8 | aload 0 9 | aconst_null 10 | iconst_0 11 | invokespecial d2j/gen/MI__000/(Ljava/lang/Object;[Ljava/lang/Object;I)V 12 | invokestatic B/t(Lp;)Ljava/lang/Object; 13 | pop 14 | return 15 | .limit locals 1 16 | .limit stack 5 17 | .end method 18 | 19 | .method public static m_A001_CB002(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; 20 | aload 0 21 | checkcast A 22 | invokevirtual A/m_A001()V 23 | aconst_null 24 | areturn 25 | .limit locals 2 26 | .limit stack 1 27 | .end method 28 | 29 | .method public m_A001()V 30 | return 31 | .limit locals 1 32 | .limit stack 0 33 | .end method 34 | -------------------------------------------------------------------------------- /dex-tools/src/test/resources/weave/a-before.j: -------------------------------------------------------------------------------- 1 | .bytecode 50.0 2 | .class A 3 | .super java/lang/Object 4 | 5 | .method m()V 6 | return 7 | .limit locals -1 8 | .limit stack -1 9 | .end method 10 | -------------------------------------------------------------------------------- /dex-tools/src/test/resources/weave/b-before.j: -------------------------------------------------------------------------------- 1 | .bytecode 50.0 2 | .class public super com/googlecode/d2j/tools/jar/test/res/Res 3 | .super java/util/ArrayList 4 | 5 | .method public ()V 6 | aload 0 7 | invokespecial java/util/ArrayList/()V 8 | return 9 | .limit locals 1 10 | .limit stack 1 11 | .end method 12 | 13 | .method public static varargs main([Ljava/lang/String;)V 14 | getstatic java/lang/System/out Ljava/io/PrintStream; 15 | ldc "" 16 | invokevirtual java/io/PrintStream/append(Ljava/lang/CharSequence;)Ljava/io/PrintStream; 17 | pop 18 | getstatic java/lang/System/out Ljava/io/PrintStream; 19 | ldc "test" 20 | invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V 21 | return 22 | .limit locals 1 23 | .limit stack 2 24 | .end method 25 | 26 | .method public size()I 27 | aload 0 28 | invokespecial java/util/ArrayList/size()I 29 | ireturn 30 | .limit locals 1 31 | .limit stack 1 32 | .end method 33 | 34 | .method public add(Ljava/lang/Object;)Z 35 | aload 0 36 | aload 1 37 | invokespecial java/util/ArrayList/add(Ljava/lang/Object;)Z 38 | ireturn 39 | .limit locals 2 40 | .limit stack 2 41 | .end method 42 | -------------------------------------------------------------------------------- /dex-tools/src/test/resources/weave/c-before.j: -------------------------------------------------------------------------------- 1 | .bytecode 50.0 2 | .class A 3 | .super java/lang/Object 4 | 5 | .method m()V 6 | invokestatic T/a()V 7 | invokestatic T/b()V 8 | invokestatic T/c()I 9 | pop 10 | invokestatic T/d()I 11 | pop 12 | return 13 | .limit locals -1 14 | .limit stack -1 15 | .end method 16 | -------------------------------------------------------------------------------- /dex-tools/src/test/resources/weave/smali/a-before.smali: -------------------------------------------------------------------------------- 1 | .class LA; 2 | .super Ljava/lang/Object; 3 | 4 | .method static m()V 5 | .registers 0 6 | invoke-static {}, LB;->b()V 7 | return-void 8 | .end method 9 | 10 | .method static m1()I 11 | .registers 1 12 | invoke-static {}, LB;->b()V 13 | const v0, 0 14 | return v0 15 | .end method 16 | 17 | .method static m2()J 18 | .registers 2 19 | invoke-static {}, LB;->b()V 20 | const-wide v0,0 21 | return-wide v0 22 | .end method 23 | 24 | .method static m3(J)V 25 | .registers 2 26 | invoke-static {}, LB;->b()V 27 | return-void 28 | .end method 29 | 30 | .method m4()V 31 | .registers 1 32 | invoke-static {}, LB;->b()V 33 | return-void 34 | .end method 35 | 36 | .method m5(J)V 37 | .registers 3 38 | invoke-static {}, LB;->b()V 39 | return-void 40 | .end method 41 | 42 | .method m6(J)J 43 | .registers 3 44 | invoke-static {}, LB;->b()V 45 | return-wide p1 46 | .end method 47 | -------------------------------------------------------------------------------- /dex-tools/src/test/resources/weave/smali/b-before.smali: -------------------------------------------------------------------------------- 1 | .class LA; 2 | .super Ljava/lang/Object; 3 | 4 | .method static m()V 5 | .registers 2 6 | invoke-static {}, LB;->b()V 7 | invoke-static {}, LB;->b()V 8 | const v0, 1 9 | invoke-static {v0}, LB;->c(I)V 10 | const-wide v0, 0 11 | invoke-static {v0,v1}, LB;->d(J)V 12 | return-void 13 | .end method 14 | 15 | .method m()V 16 | .registers 3 17 | const v0, 0 18 | invoke-virtual {v2}, LB;->e()V 19 | invoke-super {v2}, LB;->f()V 20 | invoke-virtual {v2,v0}, LB;->e(I)V 21 | invoke-super {v2,v0}, LB;->f(I)V 22 | return-void 23 | .end method 24 | -------------------------------------------------------------------------------- /dex-translator/build.gradle: -------------------------------------------------------------------------------- 1 | description = 'Dex Translator' 2 | 3 | dependencies { 4 | compile project(':dex-reader') 5 | compile project(':dex-ir') 6 | compile project(':dex-obfuscator') 7 | compile project(':d2j-base-cmd') 8 | compile project(":asm") 9 | testCompile project(':d2j-smali') 10 | testCompile project(':d2j-jasmin') 11 | testCompile project(":dx") 12 | } 13 | 14 | -------------------------------------------------------------------------------- /dex-translator/src/main/java/com/googlecode/d2j/dex/ClassVisitorFactory.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.dex; 2 | 3 | import org.objectweb.asm.ClassVisitor; 4 | 5 | public interface ClassVisitorFactory { 6 | 7 | /** 8 | * 9 | * @param classInternalName 10 | * class name 11 | * @return a ClassVisitor, to generate validate .class file, ClassWriter.COMPUTE_MAXS is required for ClassWriter 12 | */ 13 | ClassVisitor create(String classInternalName); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /dex-translator/src/main/java/com/googlecode/d2j/dex/DexExceptionHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * dex2jar - Tools to work with android .dex and java .class files 3 | * Copyright (c) 2009-2012 Panxiaobo 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.googlecode.d2j.dex; 18 | 19 | import com.googlecode.d2j.Method; 20 | import com.googlecode.d2j.node.DexMethodNode; 21 | import org.objectweb.asm.MethodVisitor; 22 | 23 | public interface DexExceptionHandler { 24 | public void handleFileException(Exception e); 25 | 26 | public void handleMethodTranslateException(Method method, DexMethodNode methodNode, MethodVisitor mv, Exception e); 27 | } 28 | -------------------------------------------------------------------------------- /dex-translator/src/main/java/com/googlecode/d2j/dex/LambadaNameSafeClassAdapter.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.d2j.dex; 2 | 3 | import org.objectweb.asm.ClassVisitor; 4 | import org.objectweb.asm.commons.ClassRemapper; 5 | import org.objectweb.asm.commons.Remapper; 6 | 7 | public class LambadaNameSafeClassAdapter extends ClassRemapper { 8 | public String getClassName() { 9 | return remapper.mapType(className); 10 | } 11 | 12 | public LambadaNameSafeClassAdapter(ClassVisitor cv) { 13 | super(cv, new Remapper() { 14 | @Override 15 | public String mapType(String type) { 16 | if (type == null) { 17 | return null; 18 | } 19 | // return type.replace('-', '_'); 20 | return type; 21 | } 22 | }); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /dex-translator/src/main/java/com/googlecode/d2j/dex/V3.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012 Panxiaobo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.googlecode.d2j.dex; 17 | 18 | 19 | /** 20 | * @author Panxiaobo 21 | * @version $Rev$ 22 | */ 23 | public class V3 { 24 | 25 | public static final int REUSE_REGISTER = 1 << 0; 26 | public static final int TOPOLOGICAL_SORT = 1 << 1; 27 | public static final int PRINT_IR = 1 << 2; 28 | public static final int OPTIMIZE_SYNCHRONIZED = 1 << 3; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /dex-translator/src/main/resources/d2j_hex_decode_stub.data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Familyye/BlackObfuscator/1215be685eb63c383023faefa8fcb0c6a91c6b14/dex-translator/src/main/resources/d2j_hex_decode_stub.data -------------------------------------------------------------------------------- /dex-translator/src/test/java/com/googlecode/dex2jar/test/I168Test.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.dex2jar.test; 2 | 3 | import static com.googlecode.d2j.DexConstants.ACC_PUBLIC; 4 | import static com.googlecode.d2j.DexConstants.ACC_STATIC; 5 | 6 | import org.junit.Test; 7 | 8 | import com.googlecode.d2j.Method; 9 | import com.googlecode.d2j.reader.Op; 10 | import com.googlecode.d2j.visitors.DexClassVisitor; 11 | import com.googlecode.d2j.visitors.DexCodeVisitor; 12 | import com.googlecode.d2j.visitors.DexMethodVisitor; 13 | import org.junit.runner.RunWith; 14 | 15 | /** 16 | * test for huge insn 20000 and locals 2000 17 | * 18 | * @author bob 19 | * 20 | */ 21 | @RunWith(DexTranslatorRunner.class) 22 | public class I168Test { 23 | 24 | @Test 25 | public static void i168(DexClassVisitor cv) { 26 | DexMethodVisitor mv = cv.visitMethod(ACC_PUBLIC | ACC_STATIC, new Method("La;", "a", new String[] {}, "I")); 27 | DexCodeVisitor code = mv.visitCode(); 28 | code.visitRegister(2000); // 2000 locals 29 | for (int i = 0; i < 2000; i++) {// 2000 insns 30 | code.visitConstStmt(Op.CONST, i, i); 31 | } 32 | for (int i = 0; i < 18000; i++) {// 18000 insns 33 | code.visitConstStmt(Op.CONST, 25, i); 34 | } 35 | code.visitStmt1R(Op.RETURN, 25); 36 | code.visitEnd(); 37 | mv.visitEnd(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /dex-translator/src/test/java/com/googlecode/dex2jar/test/I63Test.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.dex2jar.test; 2 | 3 | import com.googlecode.d2j.DexConstants; 4 | import org.junit.Test; 5 | 6 | import com.googlecode.d2j.DexLabel; 7 | import com.googlecode.d2j.Field; 8 | import com.googlecode.d2j.Method; 9 | import com.googlecode.d2j.reader.Op; 10 | import com.googlecode.d2j.visitors.DexClassVisitor; 11 | import com.googlecode.d2j.visitors.DexCodeVisitor; 12 | import com.googlecode.d2j.visitors.DexMethodVisitor; 13 | import org.junit.runner.RunWith; 14 | 15 | /** 16 | * test case for issue 63 17 | */ 18 | @RunWith(DexTranslatorRunner.class) 19 | public class I63Test implements DexConstants { 20 | 21 | @Test 22 | public static void i63(DexClassVisitor cv) { 23 | DexMethodVisitor mv = cv.visitMethod(ACC_STATIC, new Method("La;", "b", new String[] {}, "V")); 24 | if (mv != null) { 25 | DexCodeVisitor code = mv.visitCode(); 26 | if (code != null) { 27 | code.visitRegister(1); 28 | DexLabel L1 = new DexLabel(); 29 | DexLabel L2 = new DexLabel(); 30 | code.visitLabel(L1); 31 | code.visitFieldStmt(Op.SGET, 0, -1, new Field("La;", "f", "J")); 32 | code.visitLabel(L2); 33 | code.visitStmt0R(Op.RETURN_VOID); 34 | code.visitEnd(); 35 | code.visitTryCatch(L1, L2, new DexLabel[] { L2 }, new String[] { "La;" }); 36 | } 37 | mv.visitEnd(); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /dex-translator/src/test/java/com/googlecode/dex2jar/test/TestDexClassV.java: -------------------------------------------------------------------------------- 1 | package com.googlecode.dex2jar.test; 2 | 3 | import com.googlecode.d2j.node.DexMethodNode; 4 | import org.junit.Ignore; 5 | import org.objectweb.asm.ClassWriter; 6 | import org.objectweb.asm.Opcodes; 7 | 8 | import com.googlecode.d2j.Method; 9 | import com.googlecode.d2j.visitors.DexClassVisitor; 10 | import com.googlecode.d2j.visitors.DexMethodVisitor; 11 | 12 | @Ignore 13 | public class TestDexClassV extends DexClassVisitor { 14 | private int config; 15 | private ClassWriter cw; 16 | 17 | public TestDexClassV(String clz, int config) { 18 | super(); 19 | cw = new ClassWriter(ClassWriter.COMPUTE_MAXS); 20 | cw.visit(Opcodes.V1_6, Opcodes.ACC_PUBLIC, clz, null, "java/lang/Object", null); 21 | this.config = config; 22 | } 23 | 24 | public byte[] toByteArray() { 25 | cw.visitEnd(); 26 | return cw.toByteArray(); 27 | } 28 | 29 | @Override 30 | public DexMethodVisitor visitMethod(int accessFlags, Method method) { 31 | return new DexMethodNode(accessFlags, method) { 32 | 33 | @Override 34 | public void visitEnd() { 35 | super.visitEnd(); 36 | // FIXME impl 37 | //methodNode.accept(cw); 38 | } 39 | }; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /dex-translator/src/test/java/res/ChineseRes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012 Panxiaobo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package res; 17 | 18 | /** 19 | * @author Panxiaobo 20 | * 21 | */ 22 | public class ChineseRes { 23 | public void 你() { 24 | System.out.println("你好"); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /dex-translator/src/test/java/res/ConstValues.java: -------------------------------------------------------------------------------- 1 | package res; 2 | 3 | public interface ConstValues { 4 | 5 | byte b1 = 0; 6 | byte b2 = -1; 7 | byte b3 = 1; 8 | byte b4 = 0x7F; 9 | 10 | short s1 = 0; 11 | short s2 = -1; 12 | short s3 = 1; 13 | short s4 = 0x7FFF; 14 | 15 | char c1 = 0; 16 | char c2 = 1; 17 | char c3 = 0x7FFF; 18 | 19 | int i1 = -1; 20 | int i2 = 0; 21 | int i3 = 0xFF; 22 | int i4 = 0xFFFF; 23 | int i5 = 0xFFFFFF; 24 | int i6 = 0x7FFFFFFF; 25 | 26 | float f1 = 0; 27 | float f2 = -1; 28 | float f3 = 1; 29 | float f4 = Float.MAX_VALUE; 30 | float f5 = Float.MIN_VALUE; 31 | 32 | double d1 = 0; 33 | double d2 = -1; 34 | double d3 = 1; 35 | double d4 = Double.MAX_VALUE; 36 | double d5 = Double.MIN_VALUE; 37 | 38 | long l1 = 0; 39 | long l2 = -1; 40 | long l3 = 1; 41 | long l4 = 0x7FFFFFFFFFFFFFFFL; 42 | 43 | boolean bl1 = true; 44 | boolean bl2 = false; 45 | 46 | Abc abc1 = null; 47 | Abc abc2 = Abc.X; 48 | 49 | enum Abc { 50 | X, Y 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /dex-translator/src/test/java/res/ExceptionRes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012 Panxiaobo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package res; 17 | 18 | /** 19 | * @author Panxiaobo 20 | * 21 | */ 22 | public class ExceptionRes { 23 | public int a() { 24 | try { 25 | System.out.println("abc"); 26 | } catch (Exception e) { 27 | e.printStackTrace(); 28 | } 29 | return 0; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /dex-translator/src/test/java/res/Gh28Type.java: -------------------------------------------------------------------------------- 1 | package res; 2 | 3 | import java.lang.reflect.Array; 4 | 5 | /** 6 | * https://github.com/pxb1988/dex2jar/issues/28 7 | */ 8 | public class Gh28Type { 9 | 10 | protected void onCreate() { 11 | double t0[] = new double[2]; 12 | t0[0] = 1.0; 13 | t0[1] = 2.0; // for https://github.com/pxb1988/dex2jar/issues/101 14 | double t1[] = (double[]) Array.newInstance(Double.TYPE, 1); 15 | t1[0] = 0; 16 | double t2[][] = new double[1][1]; 17 | t2[0][0] = 0; // incorrectly translated to 0L (long) rather than 0.0 (double) 18 | double t3[][] = (double[][]) Array.newInstance(Double.TYPE, 1, 1); 19 | t3[0][0] = 0; // incorrectly translated to 0L (long) rather than 0.0 (double) 20 | a(t0); 21 | a(t1); 22 | a(t2[0]); 23 | a(t3[0]); 24 | } 25 | 26 | private void a(double[] t0) { 27 | // Just to avoid optimization of unused local variables in onCreate here above 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /dex-translator/src/test/java/res/I142_annotation_default.java: -------------------------------------------------------------------------------- 1 | package res; 2 | 3 | public @interface I142_annotation_default { 4 | 5 | enum AA { 6 | A, B, C 7 | } 8 | 9 | AA aaa() default AA.A; 10 | 11 | AA bbb(); 12 | 13 | String ccc() default ""; 14 | 15 | String ddd() default "ddd"; 16 | 17 | int eee() default 1; 18 | 19 | byte fff() default 1; 20 | 21 | short ggg() default 1; 22 | 23 | char hhh() default 1; 24 | 25 | boolean iii() default true; 26 | 27 | long jjj() default 1L; 28 | 29 | float kkk() default 1.0F; 30 | 31 | double lll() default 1.0D; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /dex-translator/src/test/java/res/I71.java: -------------------------------------------------------------------------------- 1 | package res; 2 | 3 | public class I71 { 4 | 5 | /** 6 | * code similar to edu.emory.mathcs.backport.java.util.concurrent.ConcurrentSkipListMap.SubMap.size() 7 | * 8 | * @return 9 | */ 10 | public int size() { 11 | long count = 0; 12 | for (int i = 0; i < 5; i++) { 13 | ++count; 14 | } 15 | return count >= Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) count; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /dex-translator/src/test/java/res/I73.java: -------------------------------------------------------------------------------- 1 | package res; 2 | 3 | public class I73 { 4 | String a() { 5 | Object x = new Object(); 6 | String[] y = (String[]) x; 7 | y[0] = null; 8 | int[] z = (int[]) x; 9 | z[0] = 0; 10 | return "" + y + z; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /dex-translator/src/test/java/res/I88.java: -------------------------------------------------------------------------------- 1 | package res; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | import res.I88.A; 9 | 10 | @A 11 | public class I88 { 12 | 13 | public static void main(String... args) { 14 | A a = I88.class.getAnnotation(A.class); 15 | System.out.println(a.a()); 16 | } 17 | 18 | @A 19 | I88() { 20 | } 21 | 22 | @A 23 | int i; 24 | 25 | @A 26 | public void a(@A int i) { 27 | @A 28 | // TODO the annotation is gone. 29 | String b = ""; 30 | } 31 | 32 | @A 33 | @Retention(RetentionPolicy.RUNTIME) 34 | @Target({ ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.LOCAL_VARIABLE, 35 | ElementType.METHOD, ElementType.PACKAGE, ElementType.PARAMETER, ElementType.TYPE }) 36 | public @interface A { 37 | String a() default "234"; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /dex-translator/src/test/java/res/LongDoubleRes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012 Panxiaobo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package res; 17 | 18 | /** 19 | * @author Panxiaobo 20 | * 21 | */ 22 | public class LongDoubleRes { 23 | long a(double d, double d2, long l1, long l2) { 24 | long l3 = l1 + l2; 25 | double d3 = d + d2; 26 | return (long) (d3 + l3); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /dex-translator/src/test/java/res/NoEndRes.java: -------------------------------------------------------------------------------- 1 | package res; 2 | 3 | /** 4 | * test case for issue 87, http://code.google.com/p/dex2jar/issues/detail?id=87 5 | * 6 | * @author Panxiaobo 7 | * 8 | */ 9 | public class NoEndRes { 10 | public void b() { 11 | } 12 | 13 | public void a() { 14 | while (true) { 15 | b(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /dex-translator/src/test/java/res/NullZero.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012 Panxiaobo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package res; 17 | 18 | /** 19 | * @author Panxiaobo 20 | * 21 | */ 22 | public class NullZero { 23 | void nullzero() { 24 | String _null = null; 25 | int zero = 0; 26 | if (_null == null) { 27 | _null = "asdf"; 28 | if (zero == 1) { 29 | zero = 123; 30 | } 31 | } 32 | System.out.println(0); 33 | System.out.println((String) null); 34 | System.out.println(_null); 35 | System.out.println(zero); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /dex-translator/src/test/java/res/OptimizeSynchronized.java: -------------------------------------------------------------------------------- 1 | package res; 2 | 3 | import java.io.PrintStream; 4 | 5 | public class OptimizeSynchronized { 6 | public void a() { 7 | synchronized (this) { 8 | System.out.println(this); 9 | } 10 | } 11 | 12 | Object b; 13 | 14 | public void b() { 15 | synchronized (OptimizeSynchronized.class) { 16 | System.out.println(this); 17 | } 18 | } 19 | 20 | public void c() { 21 | synchronized (this.b) { 22 | System.out.println(this); 23 | } 24 | } 25 | 26 | public void d() { 27 | PrintStream out = System.out; 28 | synchronized (out) { 29 | out.print("aa"); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /dex-translator/src/test/java/res/PopRes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012 Panxiaobo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package res; 17 | 18 | /** 19 | * @author Panxiaobo 20 | * 21 | */ 22 | public class PopRes { 23 | 24 | long aaa() { 25 | return 0; 26 | } 27 | 28 | void bbb() { 29 | aaa(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /dex-translator/src/test/java/res/ResChild.java: -------------------------------------------------------------------------------- 1 | package res; 2 | 3 | public class ResChild extends ResParent { 4 | @Override 5 | public void someMethod(int a, String b) { 6 | super.someMethod(a, b); 7 | this.someMethod(a, b); 8 | } 9 | 10 | public void anotherMethod() { 11 | this.someMethod(0, null); 12 | super.someMethod(0, null); 13 | super.bbb(0, null); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /dex-translator/src/test/java/res/ResParent.java: -------------------------------------------------------------------------------- 1 | package res; 2 | 3 | public class ResParent { 4 | public void someMethod(int a, String b) { 5 | } 6 | 7 | public void bbb(int a, String b) { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /dex-translator/src/test/java/res/U0000String.java: -------------------------------------------------------------------------------- 1 | package res; 2 | 3 | public class U0000String { 4 | void a() { 5 | System.out.println("AAA\u0000ZZZ"); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /dex-translator/src/test/java/res/i55/AAbstractClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012 Panxiaobo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package res.i55; 17 | 18 | /** 19 | * @author Panxiaobo 20 | * 21 | */ 22 | public abstract class AAbstractClass { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /dex-translator/src/test/java/res/i55/AClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012 Panxiaobo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package res.i55; 17 | 18 | /** 19 | * @author Panxiaobo 20 | * 21 | */ 22 | public class AClass { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /dex-translator/src/test/java/res/i55/AInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012 Panxiaobo 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package res.i55; 17 | 18 | /** 19 | * @author Panxiaobo 20 | * 21 | */ 22 | public interface AInterface { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /dex-translator/src/test/resources/dexes/i_jetty.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Familyye/BlackObfuscator/1215be685eb63c383023faefa8fcb0c6a91c6b14/dex-translator/src/test/resources/dexes/i_jetty.dex -------------------------------------------------------------------------------- /dex-translator/src/test/resources/smalis/0zs.smali: -------------------------------------------------------------------------------- 1 | .class Li; 2 | .super Ljava/lang/Object; 3 | 4 | .method protected static getCallScreenClassName()Ljava/lang/String; 5 | .registers 1 6 | 7 | .prologue 8 | .line 888 9 | invoke-static {}, Landroid/telephony/MSimTelephonyManager;->getDefault()Landroid/telephony/MSimTelephonyManager; 10 | 11 | move-result-object v0 12 | 13 | invoke-virtual {v0}, Landroid/telephony/MSimTelephonyManager;->isMultiSimEnabled()Z 14 | 15 | move-result v0 16 | 17 | if-eqz v0, :cond_11 18 | 19 | .line 889 20 | const-class v0, Lcom/android/phone/MSimInCallScreen; 21 | 22 | invoke-virtual {v0}, Ljava/lang/Class;->getName()Ljava/lang/String; 23 | 24 | move-result-object v0 25 | 26 | .line 891 27 | :goto_10 28 | return-object v0 29 | 30 | :cond_11 31 | const-class v0, Lcom/android/phone/InCallScreen; 32 | 33 | invoke-virtual {v0}, Ljava/lang/Class;->getName()Ljava/lang/String; 34 | 35 | move-result-object v0 36 | 37 | goto :goto_10 38 | .end method 39 | -------------------------------------------------------------------------------- /dex-translator/src/test/resources/smalis/ML.smali: -------------------------------------------------------------------------------- 1 | .class LML; 2 | .super Ljava/lang/Object; 3 | .source "ML.java" 4 | 5 | 6 | # direct methods 7 | .method constructor ()V 8 | .registers 1 9 | 10 | .prologue 11 | .line 1 12 | invoke-direct {p0}, Ljava/lang/Object;->()V 13 | 14 | return-void 15 | .end method 16 | 17 | 18 | # virtual methods 19 | .method a()Ljava/lang/Object; 20 | .registers 4 21 | 22 | .prologue 23 | .line 3 24 | const/4 v0, 0x4 25 | 26 | const/4 v1, 0x5 27 | 28 | const/4 v2, 0x6 29 | 30 | filled-new-array {v0, v1, v2}, [I 31 | 32 | move-result-object v0 33 | 34 | const-class v1, Ljava/lang/String; 35 | 36 | invoke-static {v1, v0}, Ljava/lang/reflect/Array;->newInstance(Ljava/lang/Class;[I)Ljava/lang/Object; 37 | 38 | move-result-object v0 39 | 40 | check-cast v0, [[[Ljava/lang/String; 41 | 42 | return-object v0 43 | .end method 44 | -------------------------------------------------------------------------------- /dex-translator/src/test/resources/smalis/bb-1-can-not-merge-z-and-i.smali: -------------------------------------------------------------------------------- 1 | .class Landroid/preference/MultiSelectListPreference; 2 | .super Ljava/lang/Object; 3 | 4 | .method test(Ljava/util/Set;Ljava/lang/Object;)V 5 | .registers 3 6 | invoke-interface { p1, p2 }, Ljava/util/Set;->add(Ljava/lang/Object;)Z 7 | move-result p1 8 | invoke-static { p0, p1 }, // p1 is boolean but used as integer 9 | Landroid/preference/MultiSelectListPreference;->access$076(Landroid/preference/MultiSelectListPreference;I)Z 10 | return-void 11 | .end method 12 | 13 | -------------------------------------------------------------------------------- /dex-translator/src/test/resources/smalis/empty-try-catch-with-goto-head.smali: -------------------------------------------------------------------------------- 1 | .class Letcwgh; 2 | .super Ljava/lang/Object; 3 | 4 | .method private aaa(F)V 5 | .catch Ljava/lang/Exception; { :L1 .. :L2 } :L3 6 | .registers 8 7 | :L0 8 | iget-object v0, p0, Lz;->z:Lz; 9 | if-eqz v0, :L1 10 | iget-object v0, p0, Lz;->z:Lz; 11 | invoke-static { }, Ljava/util/Locale;->getDefault()Ljava/util/Locale; 12 | move-result-object v1 13 | const-string/jumbo v2, "%.1f" 14 | const/4 v3, 1 15 | new-array v3, v3, [Ljava/lang/Object; 16 | const/4 v4, 0 17 | invoke-static { p1 }, Ljava/lang/Float;->valueOf(F)Ljava/lang/Float; 18 | move-result-object v5 19 | aput-object v5, v3, v4 20 | invoke-static { v1, v2, v3 }, Ljava/lang/String;->format(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String; 21 | move-result-object v1 22 | invoke-virtual { v0, v1 }, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V 23 | :L1 24 | return-void 25 | :L2 26 | :L3 27 | goto :L0 28 | .end method -------------------------------------------------------------------------------- /dex-translator/src/test/resources/smalis/gh-issue-4.smali: -------------------------------------------------------------------------------- 1 | .class Lgh/i4; 2 | .super Ljava/lang/Object; 3 | 4 | .method static public a(LIndenter;)Ljava/lang/Object; 5 | .registers 2 6 | if-nez v1, :L0 7 | new-instance v0, LNopIndenter; 8 | move-object v1, v0 #### use before init 9 | invoke-direct { v0 }, LNopIndenter;->()V 10 | :L0 11 | return-object v1 12 | .end method 13 | -------------------------------------------------------------------------------- /dex-translator/src/test/resources/smalis/goto-first-label.smali: -------------------------------------------------------------------------------- 1 | .class Lxgoto/first/label; 2 | .super Ljava/lang/Object; 3 | 4 | .method public static assertSlept()V 5 | .registers 3 6 | :L0 7 | sget-object v1, LA;->sleepSemaphore:Ljava/util/concurrent/Semaphore; 8 | invoke-virtual { v1 }, Ljava/util/concurrent/Semaphore;->availablePermits()I 9 | move-result v1 10 | if-nez v1, :L1 11 | return-void 12 | :L1 13 | const-wide/16 v1, 50 14 | invoke-static { v1, v2 }, Ljava/lang/Thread;->sleep(J)V 15 | goto :L0 16 | .end method 17 | 18 | .method public static g2(LObj;)V 19 | .registers 4 20 | :L0 21 | invoke-virtual { p0 }, LObj;->next()LObj; 22 | move-result-object v3 23 | if-nez v3, :L1 24 | return-void 25 | :L1 26 | invoke-virtual { p0 }, LObj;->next()LObj; 27 | move-result-object p0 28 | goto :L0 29 | .end method 30 | -------------------------------------------------------------------------------- /dex-translator/src/test/resources/smalis/i230.smali: -------------------------------------------------------------------------------- 1 | .class Li230; 2 | .super Li230; 3 | 4 | .method public i230(II)F 5 | .catchall { :L5 .. :L10 } :L9 6 | .registers 10 7 | move-object v0, p0 8 | monitor-enter v0 9 | :L5 10 | int-to-float v0, p1 11 | int-to-float v1, p2 12 | div-float/2addr v1, v0 13 | move-object v0, p0 14 | monitor-exit v0 15 | return v1 16 | 17 | :L9 18 | move-exception v1 19 | monitor-exit v0 20 | :L10 21 | const v1, 0 22 | return v1 23 | .end method 24 | -------------------------------------------------------------------------------- /dex-translator/src/test/resources/smalis/int-or-boolean.smali: -------------------------------------------------------------------------------- 1 | .class Li/or/Z; 2 | .super Ljava/lang/Object; 3 | 4 | .method static synthetic access$376(Lcom/google/android/finsky/widget/consumption/NowPlayingWidgetProvider$ViewTreeWrapper;I)Z 5 | .registers 3 6 | iget-boolean v0, v1, Lcom/google/android/finsky/widget/consumption/NowPlayingWidgetProvider$ViewTreeWrapper;->showBackground:Z 7 | or-int/2addr v0, v2 8 | int-to-byte v0, v0 9 | iput-boolean v0, v1, Lcom/google/android/finsky/widget/consumption/NowPlayingWidgetProvider$ViewTreeWrapper;->showBackground:Z 10 | return v0 11 | .end method 12 | -------------------------------------------------------------------------------- /dex-translator/src/test/resources/smalis/issue-220-219-uninit-reg.smali: -------------------------------------------------------------------------------- 1 | .class Li220/i219; 2 | .super Ljava/lang/Object; 3 | .method public static i219(Ljava/lang/String;)I 4 | .registers 2 5 | return v0 6 | .end method 7 | 8 | .method public i220()Ljava/lang/String; 9 | .registers 7 10 | if-eqz v1, :L0 11 | move v0, v6 12 | :L0 13 | return-object v2 14 | .end method 15 | 16 | .method public onClick(Landroid/content/DialogInterface;I)V 17 | .registers 5 18 | iget-object v0, v2, Lcom/adroidbscpc/a15mSurvival3rh/MainA$2;->this$0:Lcom/adroidbscpc/a15mSurvival3rh/MainA; 19 | move-result-object v0 20 | iget-object v1, v2, Lcom/adroidbscpc/a15mSurvival3rh/MainA$2;->this$0:Lcom/adroidbscpc/a15mSurvival3rh/MainA; 21 | return-void 22 | .end method 23 | -------------------------------------------------------------------------------- /dex-translator/src/test/resources/smalis/loop-enclosing-class.smali: -------------------------------------------------------------------------------- 1 | .class La; 2 | .super Ljava/lang/Object; 3 | 4 | # annotations 5 | .annotation system Ldalvik/annotation/EnclosingClass; 6 | value = La; 7 | .end annotation 8 | .end class 9 | 10 | 11 | .class Lb; 12 | .super Ljava/lang/Object; 13 | 14 | # annotations 15 | .annotation system Ldalvik/annotation/EnclosingClass; 16 | value = Lc; 17 | .end annotation 18 | .end class 19 | 20 | 21 | .class Lc; 22 | .super Ljava/lang/Object; 23 | 24 | # annotations 25 | .annotation system Ldalvik/annotation/EnclosingClass; 26 | value = Lb; 27 | .end annotation 28 | .end class -------------------------------------------------------------------------------- /dex-translator/src/test/resources/smalis/negative-array-size.smali: -------------------------------------------------------------------------------- 1 | .class Li; 2 | .super Ljava/lang/Object; 3 | 4 | .method public getFileLength()I 5 | .catch Ljava/lang/Exception; { :L0 .. :L1 } :L2 6 | .catch Ljava/lang/Exception; { :L3 .. :L4 } :L5 7 | .registers 3 8 | const/4 v0, -1 9 | :L0 10 | new-array v1, v0, [I 11 | :L1 12 | goto :L0 13 | :L2 14 | move-exception v0 15 | const/4 v0, 0 16 | sput v0, Lz;->b:I 17 | :L3 18 | iget v0, p0, Lz;->b:I 19 | :L4 20 | return v0 21 | :L5 22 | move-exception v0 23 | throw v0 24 | .end method 25 | -------------------------------------------------------------------------------- /dex-translator/src/test/resources/smalis/opt-lock.smali: -------------------------------------------------------------------------------- 1 | .class Lopt/lock; 2 | .super Ljava/lang/Object; 3 | .method public static a()V 4 | .catchall { :L0 .. :L1 } :L2 5 | .registers 2 6 | sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; 7 | :L0 8 | monitor-enter v0 9 | const-string v1, "haha" 10 | invoke-virtual { v0, v1 }, Ljava/io/PrintString;->println(Ljava/lang/String;)V 11 | :L1 12 | monitor-exit v0 13 | return-void 14 | :L2 15 | move-exception v1 16 | monitor-exit v0 17 | throw v1 18 | .end method 19 | -------------------------------------------------------------------------------- /dex-writer/build.gradle: -------------------------------------------------------------------------------- 1 | description = 'Dex Writer' 2 | 3 | dependencies { 4 | compile project(':dex-reader-api') 5 | testCompile group: 'junit', name: 'junit', version:'4.10' 6 | testCompile project(':dex-reader') 7 | } 8 | -------------------------------------------------------------------------------- /dex-writer/src/main/java/com/googlecode/d2j/dex/writer/CantNotFixContentException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * dex2jar - Tools to work with android .dex and java .class files 3 | * Copyright (c) 2009-2013 Panxiaobo 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.googlecode.d2j.dex.writer; 18 | 19 | import com.googlecode.d2j.reader.Op; 20 | 21 | public class CantNotFixContentException extends RuntimeException { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public CantNotFixContentException(Op op, String contentName, int v) { 25 | super(String.format("content is not fit for op: %s, %s, value:0x%x", 26 | op.displayName, contentName, v)); 27 | } 28 | 29 | public CantNotFixContentException(Op op, String contentName, long v) { 30 | super(String.format("content is not fit for op: %s, %s, value:0x%x", 31 | op.displayName, contentName, v)); 32 | } 33 | } -------------------------------------------------------------------------------- /dex-writer/src/main/java/com/googlecode/d2j/dex/writer/ann/Alignment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * dex2jar - Tools to work with android .dex and java .class files 3 | * Copyright (c) 2009-2013 Panxiaobo 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.googlecode.d2j.dex.writer.ann; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | @Target(ElementType.TYPE) 25 | @Retention(RetentionPolicy.SOURCE) 26 | public @interface Alignment { 27 | int value(); 28 | } 29 | -------------------------------------------------------------------------------- /dex-writer/src/main/java/com/googlecode/d2j/dex/writer/ann/Idx.java: -------------------------------------------------------------------------------- 1 | /* 2 | * dex2jar - Tools to work with android .dex and java .class files 3 | * Copyright (c) 2009-2013 Panxiaobo 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.googlecode.d2j.dex.writer.ann; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | @Target(ElementType.FIELD) 25 | @Retention(RetentionPolicy.SOURCE) 26 | public @interface Idx { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /dex-writer/src/main/java/com/googlecode/d2j/dex/writer/ann/Off.java: -------------------------------------------------------------------------------- 1 | /* 2 | * dex2jar - Tools to work with android .dex and java .class files 3 | * Copyright (c) 2009-2013 Panxiaobo 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.googlecode.d2j.dex.writer.ann; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | @Target(ElementType.FIELD) 25 | @Retention(RetentionPolicy.SOURCE) 26 | public @interface Off { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /dex-writer/src/main/java/com/googlecode/d2j/dex/writer/insn/Insn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * dex2jar - Tools to work with android .dex and java .class files 3 | * Copyright (c) 2009-2013 Panxiaobo 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.googlecode.d2j.dex.writer.insn; 18 | 19 | import java.nio.ByteBuffer; 20 | 21 | public abstract class Insn { 22 | protected static final boolean DEBUG = false; 23 | /** 24 | * offset in codeUnit 25 | */ 26 | public int offset; 27 | 28 | /** 29 | * size in codeUnit 30 | * 31 | * @return 32 | */ 33 | abstract public int getCodeUnitSize(); 34 | 35 | public void write(ByteBuffer out) { 36 | // TODO Auto-generated method stub 37 | 38 | } 39 | 40 | boolean isLabel() { 41 | return false; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /dex-writer/src/main/java/com/googlecode/d2j/dex/writer/insn/Label.java: -------------------------------------------------------------------------------- 1 | /* 2 | * dex2jar - Tools to work with android .dex and java .class files 3 | * Copyright (c) 2009-2013 Panxiaobo 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.googlecode.d2j.dex.writer.insn; 18 | 19 | 20 | public class Label extends Insn { 21 | 22 | @Override 23 | public int getCodeUnitSize() { 24 | return 0; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /dex-writer/src/main/java/com/googlecode/d2j/dex/writer/insn/OpInsn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * dex2jar - Tools to work with android .dex and java .class files 3 | * Copyright (c) 2009-2013 Panxiaobo 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.googlecode.d2j.dex.writer.insn; 18 | 19 | import com.googlecode.d2j.reader.Op; 20 | 21 | public abstract class OpInsn extends Insn { 22 | public Op op; 23 | 24 | 25 | public OpInsn(Op op) { 26 | this.op = op; 27 | } 28 | 29 | final public boolean isLabel() { 30 | return true; 31 | } 32 | 33 | @Override 34 | public int getCodeUnitSize() { 35 | return op.format.size; 36 | } 37 | } -------------------------------------------------------------------------------- /dex-writer/src/main/java/com/googlecode/d2j/dex/writer/insn/PreBuildInsn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * dex2jar - Tools to work with android .dex and java .class files 3 | * Copyright (c) 2009-2013 Panxiaobo 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.googlecode.d2j.dex.writer.insn; 18 | 19 | import java.nio.ByteBuffer; 20 | 21 | public class PreBuildInsn extends Insn { 22 | 23 | final public byte[] data; 24 | 25 | public PreBuildInsn(byte[] data) { 26 | 27 | this.data = data; 28 | } 29 | 30 | 31 | @Override 32 | public int getCodeUnitSize() { 33 | return data.length / 2; 34 | } 35 | 36 | @Override 37 | public void write(ByteBuffer out) { 38 | out.put(data); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /dex-writer/src/main/java/com/googlecode/d2j/dex/writer/io/DataOut.java: -------------------------------------------------------------------------------- 1 | /* 2 | * dex2jar - Tools to work with android .dex and java .class files 3 | * Copyright (c) 2009-2013 Panxiaobo 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.googlecode.d2j.dex.writer.io; 18 | 19 | public interface DataOut { 20 | 21 | void begin(String s); 22 | 23 | void bytes(String s, byte[] bs); 24 | 25 | void bytes(String string, byte[] buf, int offset, int size); 26 | 27 | void end(); 28 | 29 | int offset(); 30 | 31 | void sbyte(String s, int b); 32 | 33 | void sint(String s, int i); 34 | 35 | void skip(String s, int n); 36 | 37 | void skip4(String s); 38 | 39 | void sleb128(String s, int i); 40 | 41 | void sshort(String s, int i); 42 | 43 | void ubyte(String s, int b); 44 | 45 | void uint(String s, int i); 46 | 47 | void uleb128(String s, int i); 48 | 49 | void uleb128p1(String s, int i); 50 | 51 | void ushort(String s, int i); 52 | } 53 | -------------------------------------------------------------------------------- /dex-writer/src/main/java/com/googlecode/d2j/dex/writer/item/EncodedArrayItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * dex2jar - Tools to work with android .dex and java .class files 3 | * Copyright (c) 2009-2013 Panxiaobo 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.googlecode.d2j.dex.writer.item; 18 | 19 | import com.googlecode.d2j.dex.writer.ev.EncodedArray; 20 | import com.googlecode.d2j.dex.writer.io.DataOut; 21 | 22 | public class EncodedArrayItem extends BaseItem { 23 | public EncodedArray value = new EncodedArray(); 24 | 25 | @Override 26 | public int place(int offset) { 27 | return value.place(offset); 28 | } 29 | 30 | @Override 31 | public void write(DataOut out) { 32 | value.write(out); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /dex-writer/src/test/java/a/CpStringTest.java: -------------------------------------------------------------------------------- 1 | package a; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | 6 | import com.googlecode.d2j.dex.writer.item.ConstPool; 7 | 8 | public class CpStringTest { 9 | @Test 10 | public void test() { 11 | ConstPool cp = new ConstPool(); 12 | Assert.assertTrue(cp.uniqString("b").compareTo(cp.uniqString("a")) > 0); 13 | Assert.assertTrue(cp.uniqType("Lb;").compareTo(cp.uniqType("La;")) > 0); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /dexlib2/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Familyye/BlackObfuscator/1215be685eb63c383023faefa8fcb0c6a91c6b14/dexlib2/.DS_Store -------------------------------------------------------------------------------- /dexlib2/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | } 8 | 9 | dependencies { 10 | testCompile group: 'junit', name: 'junit', version: '4.12' 11 | compile 'com.google.guava:guava:18.0' 12 | compile(group: 'org.antlr', name: 'antlr-runtime', version:'3.5.2') { 13 | exclude(module: 'stringtemplate') 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /dexlib2/src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Familyye/BlackObfuscator/1215be685eb63c383023faefa8fcb0c6a91c6b14/dexlib2/src/.DS_Store -------------------------------------------------------------------------------- /dexlib2/src/main/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Familyye/BlackObfuscator/1215be685eb63c383023faefa8fcb0c6a91c6b14/dexlib2/src/main/.DS_Store -------------------------------------------------------------------------------- /dexlib2/src/main/java/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Familyye/BlackObfuscator/1215be685eb63c383023faefa8fcb0c6a91c6b14/dexlib2/src/main/java/.DS_Store -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Familyye/BlackObfuscator/1215be685eb63c383023faefa8fcb0c6a91c6b14/dexlib2/src/main/java/org/.DS_Store -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/CloseUtils.java: -------------------------------------------------------------------------------- 1 | package org.jf; 2 | 3 | import java.io.Closeable; 4 | import java.io.IOException; 5 | 6 | public class CloseUtils { 7 | public static void close(Closeable... closeables) { 8 | if (closeables == null) { 9 | return; 10 | } 11 | for (Closeable closeable : closeables) { 12 | if (closeable != null) { 13 | try { 14 | closeable.close(); 15 | } catch (IOException e) { 16 | } 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/baksmali/Baksmali.java: -------------------------------------------------------------------------------- 1 | package org.jf.baksmali; 2 | 3 | 4 | 5 | import org.jf.baksmali.Adaptors.ClassDefinition; 6 | import org.jf.dexlib2.iface.ClassDef; 7 | import org.jf.util.IndentingWriter; 8 | 9 | import java.io.IOException; 10 | import java.io.Writer; 11 | 12 | public class Baksmali { 13 | 14 | @SuppressWarnings("InfiniteRecursion") 15 | public static void disassembleClass(StringBuilder stringBuilder, ClassDef classDef, BaksmaliOptions options) throws IOException { 16 | disassembleClass(new StringWriter(stringBuilder), classDef, options); 17 | } 18 | 19 | public static void disassembleClass(Writer writer, ClassDef classDef, BaksmaliOptions options) throws IOException { 20 | ClassDefinition classDefinition = new ClassDefinition(options, classDef); 21 | if (writer instanceof IndentingWriter) 22 | classDefinition.writeTo((IndentingWriter) writer); 23 | else 24 | classDefinition.writeTo(new IndentingWriter(writer)); 25 | } 26 | 27 | private static class StringWriter extends Writer { 28 | final StringBuilder sb; 29 | 30 | private StringWriter(StringBuilder sb) { 31 | this.sb = sb; 32 | } 33 | 34 | @Override 35 | public void write(char[] buf, int off, int len) { 36 | sb.append(buf, off, len); 37 | } 38 | 39 | @Override 40 | public void flush() { 41 | 42 | } 43 | 44 | @Override 45 | public void close() { 46 | 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderSwitchElement.java: -------------------------------------------------------------------------------- 1 | package org.jf.dexlib2.builder.instruction; 2 | 3 | 4 | 5 | import org.jf.dexlib2.builder.BuilderSwitchPayload; 6 | import org.jf.dexlib2.builder.Label; 7 | import org.jf.dexlib2.iface.instruction.SwitchElement; 8 | 9 | public class BuilderSwitchElement implements SwitchElement { 10 | 11 | BuilderSwitchPayload parent; 12 | private final int key; 13 | 14 | private final Label target; 15 | 16 | public BuilderSwitchElement(BuilderSwitchPayload parent, 17 | int key, 18 | Label target) { 19 | this.parent = parent; 20 | this.key = key; 21 | this.target = target; 22 | } 23 | 24 | @Override 25 | public int getKey() { 26 | return key; 27 | } 28 | 29 | @Override 30 | public int getOffset() { 31 | return target.getCodeAddress() - parent.getReferrer().getCodeAddress(); 32 | } 33 | 34 | 35 | public Label getTarget() { 36 | return target; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/iface/BasicAnnotation.java: -------------------------------------------------------------------------------- 1 | package org.jf.dexlib2.iface; 2 | 3 | 4 | 5 | import java.util.Set; 6 | 7 | /** 8 | * This represents a basic annotation, and serves as a common superclass for Annotation and AnnotationEncodedValue 9 | */ 10 | public interface BasicAnnotation { 11 | /** 12 | * Gets the type of this annotation. 13 | *

14 | * This will be the type descriptor of the class that defines this annotation. 15 | * 16 | * @return The type of this annotation 17 | */ 18 | 19 | String getType(); 20 | 21 | /** 22 | * Gets a set of the name/value elements associated with this annotation. 23 | *

24 | * The elements in the returned set will be unique with respect to the element name. 25 | * 26 | * @return A set of AnnotationElements 27 | */ 28 | 29 | Set getElements(); 30 | } 31 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/iface/UpdateReference.java: -------------------------------------------------------------------------------- 1 | package org.jf.dexlib2.iface; 2 | 3 | import org.jf.dexlib2.writer.builder.DexBuilder; 4 | 5 | public interface UpdateReference { 6 | void updateReference(DexBuilder dexBuilder); 7 | } 8 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/ImmutableDexFile.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable; 4 | 5 | 6 | 7 | 8 | import com.google.common.collect.ImmutableSet; 9 | 10 | import org.jf.dexlib2.Opcodes; 11 | import org.jf.dexlib2.iface.ClassDef; 12 | import org.jf.dexlib2.iface.DexFile; 13 | import org.jf.util.ImmutableUtils; 14 | 15 | import java.util.Collection; 16 | 17 | public class ImmutableDexFile implements DexFile { 18 | 19 | protected final ImmutableSet classes; 20 | 21 | private final Opcodes opcodes; 22 | 23 | public ImmutableDexFile(Opcodes opcodes, Collection classes) { 24 | this.classes = ImmutableClassDef.immutableSetOf(classes); 25 | this.opcodes = opcodes; 26 | } 27 | 28 | public ImmutableDexFile(Opcodes opcodes, ImmutableSet classes) { 29 | this.classes = ImmutableUtils.nullToEmptySet(classes); 30 | this.opcodes = opcodes; 31 | } 32 | 33 | public static ImmutableDexFile of(DexFile dexFile) { 34 | if (dexFile instanceof ImmutableDexFile) { 35 | return (ImmutableDexFile) dexFile; 36 | } 37 | return new ImmutableDexFile(dexFile.getOpcodes(), dexFile.getClasses()); 38 | } 39 | 40 | 41 | @Override 42 | public ImmutableSet getClasses() { 43 | return classes; 44 | } 45 | 46 | 47 | @Override 48 | public Opcodes getOpcodes() { 49 | return opcodes; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/debug/ImmutableEpilogueBegin.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.debug; 4 | 5 | 6 | 7 | import org.jf.dexlib2.DebugItemType; 8 | import org.jf.dexlib2.iface.debug.EpilogueBegin; 9 | 10 | public class ImmutableEpilogueBegin extends ImmutableDebugItem implements EpilogueBegin { 11 | public ImmutableEpilogueBegin(int codeAddress) { 12 | super(codeAddress); 13 | } 14 | 15 | 16 | public static ImmutableEpilogueBegin of(EpilogueBegin epilogueBegin) { 17 | if (epilogueBegin instanceof ImmutableEpilogueBegin) { 18 | return (ImmutableEpilogueBegin) epilogueBegin; 19 | } 20 | return new ImmutableEpilogueBegin(epilogueBegin.getCodeAddress()); 21 | } 22 | 23 | @Override 24 | public int getDebugItemType() { 25 | return DebugItemType.EPILOGUE_BEGIN; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/debug/ImmutableLineNumber.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.debug; 4 | 5 | 6 | 7 | import org.jf.dexlib2.DebugItemType; 8 | import org.jf.dexlib2.iface.debug.LineNumber; 9 | 10 | public class ImmutableLineNumber extends ImmutableDebugItem implements LineNumber { 11 | protected final int lineNumber; 12 | 13 | public ImmutableLineNumber(int codeAddress, 14 | int lineNumber) { 15 | super(codeAddress); 16 | this.lineNumber = lineNumber; 17 | } 18 | 19 | 20 | public static ImmutableLineNumber of(LineNumber lineNumber) { 21 | if (lineNumber instanceof ImmutableLineNumber) { 22 | return (ImmutableLineNumber) lineNumber; 23 | } 24 | return new ImmutableLineNumber( 25 | lineNumber.getCodeAddress(), 26 | lineNumber.getLineNumber()); 27 | } 28 | 29 | @Override 30 | public int getLineNumber() { 31 | return lineNumber; 32 | } 33 | 34 | @Override 35 | public int getDebugItemType() { 36 | return DebugItemType.LINE_NUMBER; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/debug/ImmutablePrologueEnd.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.debug; 4 | 5 | 6 | 7 | import org.jf.dexlib2.DebugItemType; 8 | import org.jf.dexlib2.iface.debug.PrologueEnd; 9 | 10 | public class ImmutablePrologueEnd extends ImmutableDebugItem implements PrologueEnd { 11 | public ImmutablePrologueEnd(int codeAddress) { 12 | super(codeAddress); 13 | } 14 | 15 | 16 | public static ImmutablePrologueEnd of(PrologueEnd prologueEnd) { 17 | if (prologueEnd instanceof ImmutablePrologueEnd) { 18 | return (ImmutablePrologueEnd) prologueEnd; 19 | } 20 | return new ImmutablePrologueEnd(prologueEnd.getCodeAddress()); 21 | } 22 | 23 | @Override 24 | public int getDebugItemType() { 25 | return DebugItemType.PROLOGUE_END; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/instruction/ImmutableInstruction10t.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.instruction; 4 | 5 | 6 | 7 | import org.jf.dexlib2.Format; 8 | import org.jf.dexlib2.Opcode; 9 | import org.jf.dexlib2.iface.instruction.formats.Instruction10t; 10 | import org.jf.dexlib2.util.Preconditions; 11 | 12 | public class ImmutableInstruction10t extends ImmutableInstruction implements Instruction10t { 13 | public static final Format FORMAT = Format.Format10t; 14 | 15 | protected final int codeOffset; 16 | 17 | public ImmutableInstruction10t(Opcode opcode, 18 | int codeOffset) { 19 | super(opcode); 20 | this.codeOffset = Preconditions.checkByteCodeOffset(codeOffset); 21 | } 22 | 23 | public static ImmutableInstruction10t of(Instruction10t instruction) { 24 | if (instruction instanceof ImmutableInstruction10t) { 25 | return (ImmutableInstruction10t) instruction; 26 | } 27 | return new ImmutableInstruction10t( 28 | instruction.getOpcode(), 29 | instruction.getCodeOffset()); 30 | } 31 | 32 | @Override 33 | public int getCodeOffset() { 34 | return codeOffset; 35 | } 36 | 37 | @Override 38 | public Format getFormat() { 39 | return FORMAT; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/instruction/ImmutableInstruction10x.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.instruction; 4 | 5 | 6 | 7 | import org.jf.dexlib2.Format; 8 | import org.jf.dexlib2.Opcode; 9 | import org.jf.dexlib2.iface.instruction.formats.Instruction10x; 10 | 11 | public class ImmutableInstruction10x extends ImmutableInstruction implements Instruction10x { 12 | public static final Format FORMAT = Format.Format10x; 13 | 14 | public ImmutableInstruction10x(Opcode opcode) { 15 | super(opcode); 16 | } 17 | 18 | public static ImmutableInstruction10x of(Instruction10x instruction) { 19 | if (instruction instanceof ImmutableInstruction10x) { 20 | return (ImmutableInstruction10x) instruction; 21 | } 22 | return new ImmutableInstruction10x(instruction.getOpcode()); 23 | } 24 | 25 | @Override 26 | public Format getFormat() { 27 | return FORMAT; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/instruction/ImmutableInstruction11x.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.instruction; 4 | 5 | 6 | 7 | import org.jf.dexlib2.Format; 8 | import org.jf.dexlib2.Opcode; 9 | import org.jf.dexlib2.iface.instruction.formats.Instruction11x; 10 | import org.jf.dexlib2.util.Preconditions; 11 | 12 | public class ImmutableInstruction11x extends ImmutableInstruction implements Instruction11x { 13 | public static final Format FORMAT = Format.Format11x; 14 | 15 | protected final int registerA; 16 | 17 | public ImmutableInstruction11x(Opcode opcode, 18 | int registerA) { 19 | super(opcode); 20 | this.registerA = Preconditions.checkByteRegister(registerA); 21 | } 22 | 23 | public static ImmutableInstruction11x of(Instruction11x instruction) { 24 | if (instruction instanceof ImmutableInstruction11x) { 25 | return (ImmutableInstruction11x) instruction; 26 | } 27 | return new ImmutableInstruction11x( 28 | instruction.getOpcode(), 29 | instruction.getRegisterA()); 30 | } 31 | 32 | @Override 33 | public int getRegisterA() { 34 | return registerA; 35 | } 36 | 37 | @Override 38 | public Format getFormat() { 39 | return FORMAT; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/instruction/ImmutableInstruction20t.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.instruction; 4 | 5 | 6 | 7 | import org.jf.dexlib2.Format; 8 | import org.jf.dexlib2.Opcode; 9 | import org.jf.dexlib2.iface.instruction.formats.Instruction20t; 10 | import org.jf.dexlib2.util.Preconditions; 11 | 12 | public class ImmutableInstruction20t extends ImmutableInstruction implements Instruction20t { 13 | public static final Format FORMAT = Format.Format20t; 14 | 15 | protected final int codeOffset; 16 | 17 | public ImmutableInstruction20t(Opcode opcode, 18 | int codeOffset) { 19 | super(opcode); 20 | this.codeOffset = Preconditions.checkShortCodeOffset(codeOffset); 21 | } 22 | 23 | public static ImmutableInstruction20t of(Instruction20t instruction) { 24 | if (instruction instanceof ImmutableInstruction20t) { 25 | return (ImmutableInstruction20t) instruction; 26 | } 27 | return new ImmutableInstruction20t( 28 | instruction.getOpcode(), 29 | instruction.getCodeOffset()); 30 | } 31 | 32 | @Override 33 | public int getCodeOffset() { 34 | return codeOffset; 35 | } 36 | 37 | @Override 38 | public Format getFormat() { 39 | return FORMAT; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/instruction/ImmutableInstruction30t.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.instruction; 4 | 5 | 6 | 7 | import org.jf.dexlib2.Format; 8 | import org.jf.dexlib2.Opcode; 9 | import org.jf.dexlib2.iface.instruction.formats.Instruction30t; 10 | 11 | public class ImmutableInstruction30t extends ImmutableInstruction implements Instruction30t { 12 | public static final Format FORMAT = Format.Format30t; 13 | 14 | protected final int codeOffset; 15 | 16 | public ImmutableInstruction30t(Opcode opcode, 17 | int codeOffset) { 18 | super(opcode); 19 | this.codeOffset = codeOffset; 20 | } 21 | 22 | public static ImmutableInstruction30t of(Instruction30t instruction) { 23 | if (instruction instanceof ImmutableInstruction30t) { 24 | return (ImmutableInstruction30t) instruction; 25 | } 26 | return new ImmutableInstruction30t( 27 | instruction.getOpcode(), 28 | instruction.getCodeOffset()); 29 | } 30 | 31 | @Override 32 | public int getCodeOffset() { 33 | return codeOffset; 34 | } 35 | 36 | @Override 37 | public Format getFormat() { 38 | return FORMAT; 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/instruction/ImmutableUnknownInstruction.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.instruction; 4 | 5 | import org.jf.dexlib2.Format; 6 | import org.jf.dexlib2.Opcode; 7 | import org.jf.dexlib2.iface.instruction.formats.UnknownInstruction; 8 | 9 | public class ImmutableUnknownInstruction extends ImmutableInstruction implements UnknownInstruction { 10 | public static final Format FORMAT = Format.Format10x; 11 | 12 | protected final int originalOpcode; 13 | 14 | public ImmutableUnknownInstruction(int originalOpcode) { 15 | super(Opcode.NOP); 16 | this.originalOpcode = originalOpcode; 17 | } 18 | 19 | public static ImmutableUnknownInstruction of(UnknownInstruction instruction) { 20 | if (instruction instanceof ImmutableUnknownInstruction) { 21 | return (ImmutableUnknownInstruction) instruction; 22 | } 23 | return new ImmutableUnknownInstruction(instruction.getOriginalOpcode()); 24 | } 25 | 26 | @Override 27 | public Format getFormat() { 28 | return FORMAT; 29 | } 30 | 31 | @Override 32 | public int getOriginalOpcode() { 33 | return originalOpcode; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/reference/ImmutableFieldReference.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.reference; 4 | 5 | 6 | 7 | import org.jf.dexlib2.base.reference.BaseFieldReference; 8 | import org.jf.dexlib2.iface.reference.FieldReference; 9 | 10 | public class ImmutableFieldReference extends BaseFieldReference implements ImmutableReference { 11 | 12 | protected final String definingClass; 13 | 14 | protected final String name; 15 | 16 | protected final String type; 17 | 18 | public ImmutableFieldReference(String definingClass, 19 | String name, 20 | String type) { 21 | this.definingClass = definingClass; 22 | this.name = name; 23 | this.type = type; 24 | } 25 | 26 | 27 | public static ImmutableFieldReference of(FieldReference fieldReference) { 28 | if (fieldReference instanceof ImmutableFieldReference) { 29 | return (ImmutableFieldReference) fieldReference; 30 | } 31 | return new ImmutableFieldReference( 32 | fieldReference.getDefiningClass(), 33 | fieldReference.getName(), 34 | fieldReference.getType()); 35 | } 36 | 37 | 38 | public String getDefiningClass() { 39 | return definingClass; 40 | } 41 | 42 | 43 | public String getName() { 44 | return name; 45 | } 46 | 47 | 48 | public String getType() { 49 | return type; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/reference/ImmutableReference.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.reference; 4 | 5 | import org.jf.dexlib2.iface.reference.Reference; 6 | 7 | public interface ImmutableReference extends Reference { 8 | } 9 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/reference/ImmutableStringReference.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.reference; 4 | 5 | 6 | 7 | import org.jf.dexlib2.base.reference.BaseStringReference; 8 | import org.jf.dexlib2.iface.reference.StringReference; 9 | 10 | public class ImmutableStringReference extends BaseStringReference implements ImmutableReference { 11 | 12 | protected final String str; 13 | 14 | public ImmutableStringReference(String str) { 15 | this.str = str; 16 | } 17 | 18 | 19 | public static ImmutableStringReference of(StringReference stringReference) { 20 | if (stringReference instanceof ImmutableStringReference) { 21 | return (ImmutableStringReference) stringReference; 22 | } 23 | return new ImmutableStringReference(stringReference.getString()); 24 | } 25 | 26 | 27 | @Override 28 | public String getString() { 29 | return str; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/util/CharSequenceConverter.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.util; 4 | 5 | 6 | 7 | 8 | import com.google.common.collect.ImmutableList; 9 | 10 | import org.jf.util.ImmutableConverter; 11 | 12 | public final class CharSequenceConverter { 13 | private CharSequenceConverter() { 14 | } 15 | 16 | 17 | public static ImmutableList immutableStringList(Iterable iterable) { 18 | return CONVERTER.toList(iterable); 19 | } 20 | 21 | private static final ImmutableConverter CONVERTER = 22 | new ImmutableConverter() { 23 | @Override 24 | protected boolean isImmutable(CharSequence item) { 25 | return item instanceof String; 26 | } 27 | 28 | 29 | @Override 30 | protected String makeImmutable(CharSequence item) { 31 | return item.toString(); 32 | } 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/value/ImmutableArrayEncodedValue.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.value; 4 | 5 | 6 | 7 | import com.google.common.collect.ImmutableList; 8 | 9 | import org.jf.dexlib2.base.value.BaseArrayEncodedValue; 10 | import org.jf.dexlib2.iface.value.ArrayEncodedValue; 11 | import org.jf.dexlib2.iface.value.EncodedValue; 12 | 13 | import java.util.Collection; 14 | 15 | public class ImmutableArrayEncodedValue extends BaseArrayEncodedValue implements ImmutableEncodedValue { 16 | 17 | protected final ImmutableList value; 18 | 19 | public ImmutableArrayEncodedValue(Collection value) { 20 | this.value = ImmutableEncodedValueFactory.immutableListOf(value); 21 | } 22 | 23 | public ImmutableArrayEncodedValue(ImmutableList value) { 24 | this.value = value; 25 | } 26 | 27 | public static ImmutableArrayEncodedValue of(ArrayEncodedValue arrayEncodedValue) { 28 | if (arrayEncodedValue instanceof ImmutableArrayEncodedValue) { 29 | return (ImmutableArrayEncodedValue) arrayEncodedValue; 30 | } 31 | return new ImmutableArrayEncodedValue(arrayEncodedValue.getValue()); 32 | } 33 | 34 | 35 | public ImmutableList getValue() { 36 | return value; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/value/ImmutableBooleanEncodedValue.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.value; 4 | 5 | import org.jf.dexlib2.base.value.BaseBooleanEncodedValue; 6 | import org.jf.dexlib2.iface.value.BooleanEncodedValue; 7 | 8 | public class ImmutableBooleanEncodedValue extends BaseBooleanEncodedValue implements ImmutableEncodedValue { 9 | public static final ImmutableBooleanEncodedValue TRUE_VALUE = new ImmutableBooleanEncodedValue(true); 10 | public static final ImmutableBooleanEncodedValue FALSE_VALUE = new ImmutableBooleanEncodedValue(false); 11 | 12 | protected final boolean value; 13 | 14 | private ImmutableBooleanEncodedValue(boolean value) { 15 | this.value = value; 16 | } 17 | 18 | public static ImmutableBooleanEncodedValue forBoolean(boolean value) { 19 | return value ? TRUE_VALUE : FALSE_VALUE; 20 | } 21 | 22 | public static ImmutableBooleanEncodedValue of(BooleanEncodedValue booleanEncodedValue) { 23 | return forBoolean(booleanEncodedValue.getValue()); 24 | } 25 | 26 | @Override 27 | public boolean getValue() { 28 | return value; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/value/ImmutableByteEncodedValue.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.value; 4 | 5 | import org.jf.dexlib2.base.value.BaseByteEncodedValue; 6 | import org.jf.dexlib2.iface.value.ByteEncodedValue; 7 | 8 | public class ImmutableByteEncodedValue extends BaseByteEncodedValue implements ImmutableEncodedValue { 9 | protected final byte value; 10 | 11 | public ImmutableByteEncodedValue(byte value) { 12 | this.value = value; 13 | } 14 | 15 | public static ImmutableByteEncodedValue of(ByteEncodedValue byteEncodedValue) { 16 | if (byteEncodedValue instanceof ImmutableByteEncodedValue) { 17 | return (ImmutableByteEncodedValue) byteEncodedValue; 18 | } 19 | return new ImmutableByteEncodedValue(byteEncodedValue.getValue()); 20 | } 21 | 22 | @Override 23 | public byte getValue() { 24 | return value; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/value/ImmutableCharEncodedValue.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.value; 4 | 5 | import org.jf.dexlib2.base.value.BaseCharEncodedValue; 6 | import org.jf.dexlib2.iface.value.CharEncodedValue; 7 | 8 | public class ImmutableCharEncodedValue extends BaseCharEncodedValue implements ImmutableEncodedValue { 9 | protected final char value; 10 | 11 | public ImmutableCharEncodedValue(char value) { 12 | this.value = value; 13 | } 14 | 15 | public static ImmutableCharEncodedValue of(CharEncodedValue charEncodedValue) { 16 | if (charEncodedValue instanceof ImmutableCharEncodedValue) { 17 | return (ImmutableCharEncodedValue) charEncodedValue; 18 | } 19 | return new ImmutableCharEncodedValue(charEncodedValue.getValue()); 20 | } 21 | 22 | @Override 23 | public char getValue() { 24 | return value; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/value/ImmutableDoubleEncodedValue.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.value; 4 | 5 | import org.jf.dexlib2.base.value.BaseDoubleEncodedValue; 6 | import org.jf.dexlib2.iface.value.DoubleEncodedValue; 7 | 8 | public class ImmutableDoubleEncodedValue extends BaseDoubleEncodedValue implements ImmutableEncodedValue { 9 | protected final double value; 10 | 11 | public ImmutableDoubleEncodedValue(double value) { 12 | this.value = value; 13 | } 14 | 15 | public static ImmutableDoubleEncodedValue of(DoubleEncodedValue doubleEncodedValue) { 16 | if (doubleEncodedValue instanceof ImmutableDoubleEncodedValue) { 17 | return (ImmutableDoubleEncodedValue) doubleEncodedValue; 18 | } 19 | return new ImmutableDoubleEncodedValue(doubleEncodedValue.getValue()); 20 | } 21 | 22 | @Override 23 | public double getValue() { 24 | return value; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/value/ImmutableEncodedValue.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.value; 4 | 5 | import org.jf.dexlib2.iface.value.EncodedValue; 6 | 7 | public interface ImmutableEncodedValue extends EncodedValue { 8 | } 9 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/value/ImmutableEnumEncodedValue.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.value; 4 | 5 | 6 | 7 | import org.jf.dexlib2.base.value.BaseEnumEncodedValue; 8 | import org.jf.dexlib2.iface.reference.FieldReference; 9 | import org.jf.dexlib2.iface.value.EnumEncodedValue; 10 | 11 | public class ImmutableEnumEncodedValue extends BaseEnumEncodedValue implements ImmutableEncodedValue { 12 | 13 | protected final FieldReference value; 14 | 15 | public ImmutableEnumEncodedValue(FieldReference value) { 16 | this.value = value; 17 | } 18 | 19 | public static ImmutableEnumEncodedValue of(EnumEncodedValue enumEncodedValue) { 20 | if (enumEncodedValue instanceof ImmutableEnumEncodedValue) { 21 | return (ImmutableEnumEncodedValue) enumEncodedValue; 22 | } 23 | return new ImmutableEnumEncodedValue(enumEncodedValue.getValue()); 24 | } 25 | 26 | 27 | @Override 28 | public FieldReference getValue() { 29 | return value; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/value/ImmutableFieldEncodedValue.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.value; 4 | 5 | 6 | 7 | import org.jf.dexlib2.base.value.BaseFieldEncodedValue; 8 | import org.jf.dexlib2.iface.reference.FieldReference; 9 | import org.jf.dexlib2.iface.value.FieldEncodedValue; 10 | 11 | public class ImmutableFieldEncodedValue extends BaseFieldEncodedValue implements ImmutableEncodedValue { 12 | 13 | protected final FieldReference value; 14 | 15 | public ImmutableFieldEncodedValue(FieldReference value) { 16 | this.value = value; 17 | } 18 | 19 | public static ImmutableFieldEncodedValue of(FieldEncodedValue fieldEncodedValue) { 20 | if (fieldEncodedValue instanceof ImmutableFieldEncodedValue) { 21 | return (ImmutableFieldEncodedValue) fieldEncodedValue; 22 | } 23 | return new ImmutableFieldEncodedValue(fieldEncodedValue.getValue()); 24 | } 25 | 26 | 27 | @Override 28 | public FieldReference getValue() { 29 | return value; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/value/ImmutableFloatEncodedValue.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.value; 4 | 5 | import org.jf.dexlib2.base.value.BaseFloatEncodedValue; 6 | import org.jf.dexlib2.iface.value.FloatEncodedValue; 7 | 8 | public class ImmutableFloatEncodedValue extends BaseFloatEncodedValue implements ImmutableEncodedValue { 9 | protected final float value; 10 | 11 | public ImmutableFloatEncodedValue(float value) { 12 | this.value = value; 13 | } 14 | 15 | public static ImmutableFloatEncodedValue of(FloatEncodedValue floatEncodedValue) { 16 | if (floatEncodedValue instanceof ImmutableFloatEncodedValue) { 17 | return (ImmutableFloatEncodedValue) floatEncodedValue; 18 | } 19 | return new ImmutableFloatEncodedValue(floatEncodedValue.getValue()); 20 | } 21 | 22 | @Override 23 | public float getValue() { 24 | return value; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/value/ImmutableIntEncodedValue.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.value; 4 | 5 | import org.jf.dexlib2.base.value.BaseIntEncodedValue; 6 | import org.jf.dexlib2.iface.value.IntEncodedValue; 7 | 8 | public class ImmutableIntEncodedValue extends BaseIntEncodedValue implements ImmutableEncodedValue { 9 | protected final int value; 10 | 11 | public ImmutableIntEncodedValue(int value) { 12 | this.value = value; 13 | } 14 | 15 | public static ImmutableIntEncodedValue of(IntEncodedValue intEncodedValue) { 16 | if (intEncodedValue instanceof ImmutableIntEncodedValue) { 17 | return (ImmutableIntEncodedValue) intEncodedValue; 18 | } 19 | return new ImmutableIntEncodedValue(intEncodedValue.getValue()); 20 | } 21 | 22 | @Override 23 | public int getValue() { 24 | return value; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/value/ImmutableLongEncodedValue.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.value; 4 | 5 | import org.jf.dexlib2.base.value.BaseLongEncodedValue; 6 | import org.jf.dexlib2.iface.value.LongEncodedValue; 7 | 8 | public class ImmutableLongEncodedValue extends BaseLongEncodedValue implements ImmutableEncodedValue { 9 | protected final long value; 10 | 11 | public ImmutableLongEncodedValue(long value) { 12 | this.value = value; 13 | } 14 | 15 | public static ImmutableLongEncodedValue of(LongEncodedValue longEncodedValue) { 16 | if (longEncodedValue instanceof ImmutableLongEncodedValue) { 17 | return (ImmutableLongEncodedValue) longEncodedValue; 18 | } 19 | return new ImmutableLongEncodedValue(longEncodedValue.getValue()); 20 | } 21 | 22 | @Override 23 | public long getValue() { 24 | return value; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/value/ImmutableMethodEncodedValue.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.value; 4 | 5 | 6 | 7 | import org.jf.dexlib2.base.value.BaseMethodEncodedValue; 8 | import org.jf.dexlib2.iface.reference.MethodReference; 9 | import org.jf.dexlib2.iface.value.MethodEncodedValue; 10 | 11 | public class ImmutableMethodEncodedValue extends BaseMethodEncodedValue implements ImmutableEncodedValue { 12 | 13 | protected final MethodReference value; 14 | 15 | public ImmutableMethodEncodedValue(MethodReference value) { 16 | this.value = value; 17 | } 18 | 19 | public static ImmutableMethodEncodedValue of(MethodEncodedValue methodEncodedValue) { 20 | if (methodEncodedValue instanceof ImmutableMethodEncodedValue) { 21 | return (ImmutableMethodEncodedValue) methodEncodedValue; 22 | } 23 | return new ImmutableMethodEncodedValue(methodEncodedValue.getValue()); 24 | } 25 | 26 | 27 | @Override 28 | public MethodReference getValue() { 29 | return value; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/value/ImmutableNullEncodedValue.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.value; 4 | 5 | import org.jf.dexlib2.base.value.BaseNullEncodedValue; 6 | 7 | public class ImmutableNullEncodedValue extends BaseNullEncodedValue implements ImmutableEncodedValue { 8 | public static final ImmutableNullEncodedValue INSTANCE = new ImmutableNullEncodedValue(); 9 | 10 | private ImmutableNullEncodedValue() { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/value/ImmutableShortEncodedValue.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.value; 4 | 5 | import org.jf.dexlib2.base.value.BaseShortEncodedValue; 6 | import org.jf.dexlib2.iface.value.ShortEncodedValue; 7 | 8 | public class ImmutableShortEncodedValue extends BaseShortEncodedValue implements ImmutableEncodedValue { 9 | protected final short value; 10 | 11 | public ImmutableShortEncodedValue(short value) { 12 | this.value = value; 13 | } 14 | 15 | public static ImmutableShortEncodedValue of(ShortEncodedValue shortEncodedValue) { 16 | if (shortEncodedValue instanceof ImmutableShortEncodedValue) { 17 | return (ImmutableShortEncodedValue) shortEncodedValue; 18 | } 19 | return new ImmutableShortEncodedValue(shortEncodedValue.getValue()); 20 | } 21 | 22 | @Override 23 | public short getValue() { 24 | return value; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/value/ImmutableStringEncodedValue.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.value; 4 | 5 | 6 | 7 | import org.jf.dexlib2.base.value.BaseStringEncodedValue; 8 | import org.jf.dexlib2.iface.value.StringEncodedValue; 9 | 10 | public class ImmutableStringEncodedValue extends BaseStringEncodedValue implements ImmutableEncodedValue { 11 | 12 | protected final String value; 13 | 14 | public ImmutableStringEncodedValue(String value) { 15 | this.value = value; 16 | } 17 | 18 | public static ImmutableStringEncodedValue of(StringEncodedValue stringEncodedValue) { 19 | if (stringEncodedValue instanceof ImmutableStringEncodedValue) { 20 | return (ImmutableStringEncodedValue) stringEncodedValue; 21 | } 22 | return new ImmutableStringEncodedValue(stringEncodedValue.getValue()); 23 | } 24 | 25 | 26 | @Override 27 | public String getValue() { 28 | return value; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/immutable/value/ImmutableTypeEncodedValue.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | package org.jf.dexlib2.immutable.value; 4 | 5 | 6 | 7 | import org.jf.dexlib2.base.value.BaseTypeEncodedValue; 8 | import org.jf.dexlib2.iface.value.TypeEncodedValue; 9 | 10 | public class ImmutableTypeEncodedValue extends BaseTypeEncodedValue implements ImmutableEncodedValue { 11 | 12 | protected final String value; 13 | 14 | public ImmutableTypeEncodedValue(String value) { 15 | this.value = value; 16 | } 17 | 18 | public static ImmutableTypeEncodedValue of(TypeEncodedValue typeEncodedValue) { 19 | if (typeEncodedValue instanceof ImmutableTypeEncodedValue) { 20 | return (ImmutableTypeEncodedValue) typeEncodedValue; 21 | } 22 | return new ImmutableTypeEncodedValue(typeEncodedValue.getValue()); 23 | } 24 | 25 | 26 | @Override 27 | public String getValue() { 28 | return value; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/writer/io/DeferredOutputStream.java: -------------------------------------------------------------------------------- 1 | package org.jf.dexlib2.writer.io; 2 | 3 | import java.io.IOException; 4 | import java.io.OutputStream; 5 | 6 | public abstract class DeferredOutputStream extends OutputStream { 7 | public abstract void writeTo(OutputStream output) throws IOException; 8 | } 9 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/writer/io/DeferredOutputStreamFactory.java: -------------------------------------------------------------------------------- 1 | package org.jf.dexlib2.writer.io; 2 | 3 | import java.io.IOException; 4 | 5 | public interface DeferredOutputStreamFactory { 6 | DeferredOutputStream makeDeferredOutputStream() throws IOException; 7 | } 8 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/writer/io/DexDataStore.java: -------------------------------------------------------------------------------- 1 | package org.jf.dexlib2.writer.io; 2 | 3 | 4 | 5 | import java.io.IOException; 6 | import java.io.InputStream; 7 | import java.io.OutputStream; 8 | 9 | public interface DexDataStore { 10 | 11 | OutputStream outputAt(int offset); 12 | 13 | 14 | InputStream readAt(int offset); 15 | 16 | void close() throws IOException; 17 | } 18 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/dexlib2/writer/io/FileDataStore.java: -------------------------------------------------------------------------------- 1 | package org.jf.dexlib2.writer.io; 2 | 3 | 4 | 5 | import org.jf.util.RandomAccessFileInputStream; 6 | import org.jf.util.RandomAccessFileOutputStream; 7 | 8 | import java.io.File; 9 | import java.io.IOException; 10 | import java.io.InputStream; 11 | import java.io.OutputStream; 12 | import java.io.RandomAccessFile; 13 | 14 | public class FileDataStore implements DexDataStore { 15 | private final RandomAccessFile raf; 16 | 17 | public FileDataStore(File file) throws IOException { 18 | this.raf = new RandomAccessFile(file, "rw"); 19 | this.raf.setLength(0); 20 | } 21 | 22 | 23 | @Override 24 | public OutputStream outputAt(int offset) { 25 | return new RandomAccessFileOutputStream(raf, offset); 26 | } 27 | 28 | 29 | @Override 30 | public InputStream readAt(int offset) { 31 | return new RandomAccessFileInputStream(raf, offset); 32 | } 33 | 34 | @Override 35 | public void close() throws IOException { 36 | raf.close(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/smali/MsgRecognitionException.java: -------------------------------------------------------------------------------- 1 | package org.jf.smali; 2 | 3 | import org.antlr.runtime.RecognitionException; 4 | 5 | public class MsgRecognitionException extends RecognitionException { 6 | private final String msg; 7 | 8 | public MsgRecognitionException(RecognitionException e, String msg) { 9 | this.msg = msg; 10 | this.line = e.line; 11 | this.charPositionInLine = e.charPositionInLine; 12 | } 13 | 14 | public MsgRecognitionException(int line, int charPositionInLine, String msg) { 15 | this.msg = msg; 16 | this.line = line; 17 | this.charPositionInLine = charPositionInLine; 18 | } 19 | 20 | @Override 21 | public String getMessage() { 22 | return msg; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/smali/SmaliCatchParser.java: -------------------------------------------------------------------------------- 1 | package org.jf.smali; 2 | 3 | import org.antlr.runtime.RecognitionException; 4 | import org.antlr.runtime.RecognizerSharedState; 5 | import org.antlr.runtime.TokenStream; 6 | 7 | public class SmaliCatchParser extends smaliParser { 8 | public SmaliCatchParser(TokenStream input) { 9 | super(input); 10 | } 11 | 12 | public SmaliCatchParser(TokenStream input, RecognizerSharedState state) { 13 | super(input, state); 14 | } 15 | 16 | private RecognitionException firstException = null; 17 | 18 | @Override 19 | public void displayRecognitionError(String[] tokenNames, RecognitionException e) { 20 | String hdr = this.getErrorHeader(e); 21 | String msg = this.getErrorMessage(e, tokenNames); 22 | String errMsg = hdr + " " + msg; 23 | this.emitErrorMessage(errMsg); 24 | if (firstException == null) { 25 | firstException = new MsgRecognitionException(e, errMsg); 26 | } 27 | } 28 | 29 | public RecognitionException getFirstException() { 30 | return firstException; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /dexlib2/src/main/java/org/jf/smali/SmaliCatchTreeWalker.java: -------------------------------------------------------------------------------- 1 | package org.jf.smali; 2 | 3 | import org.antlr.runtime.RecognitionException; 4 | import org.antlr.runtime.RecognizerSharedState; 5 | import org.antlr.runtime.tree.TreeNodeStream; 6 | 7 | public class SmaliCatchTreeWalker extends smaliTreeWalker { 8 | 9 | private RecognitionException firstException = null; 10 | 11 | public SmaliCatchTreeWalker(TreeNodeStream input) { 12 | super(input); 13 | } 14 | 15 | public SmaliCatchTreeWalker(TreeNodeStream input, RecognizerSharedState state) { 16 | super(input, state); 17 | } 18 | 19 | @Override 20 | public void displayRecognitionError(String[] tokenNames, RecognitionException e) { 21 | String hdr = this.getErrorHeader(e); 22 | String msg = this.getErrorMessage(e, tokenNames); 23 | String errMsg = hdr + " " + msg; 24 | this.emitErrorMessage(errMsg); 25 | if (firstException == null) { 26 | firstException = new MsgRecognitionException(e, errMsg); 27 | } 28 | } 29 | 30 | public RecognitionException getFirstException() { 31 | return firstException; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /dexlib2/src/test/java/Test.java: -------------------------------------------------------------------------------- 1 | import org.jf.DexLib2Utils; 2 | 3 | import java.io.File; 4 | 5 | public class Test { 6 | public static void main(String[] args) { 7 | File file = new File("/Users/milk/Downloads/classes(1).dex"); 8 | DexLib2Utils.saveDex(file, new File(file.getParentFile(), "classes_fix.dex")); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /dx/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | } 8 | 9 | dependencies { 10 | } -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dex/DexException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dex; 18 | 19 | import com.android.dex.util.ExceptionWithContext; 20 | 21 | /** 22 | * Thrown when there's a format problem reading, writing, or generally 23 | * processing a dex file. 24 | */ 25 | public class DexException extends ExceptionWithContext { 26 | public DexException(String message) { 27 | super(message); 28 | } 29 | 30 | public DexException(Throwable cause) { 31 | super(cause); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dex/DexIndexOverflowException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dex; 18 | 19 | /** 20 | * Thrown when there's an index overflow writing a dex file. 21 | */ 22 | public final class DexIndexOverflowException extends DexException { 23 | public DexIndexOverflowException(String message) { 24 | super(message); 25 | } 26 | 27 | public DexIndexOverflowException(Throwable cause) { 28 | super(cause); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dex/util/ByteArrayByteInput.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dex.util; 18 | 19 | public final class ByteArrayByteInput implements ByteInput { 20 | 21 | private final byte[] bytes; 22 | private int position; 23 | 24 | public ByteArrayByteInput(byte... bytes) { 25 | this.bytes = bytes; 26 | } 27 | 28 | @Override 29 | public byte readByte() { 30 | return bytes[position++]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dex/util/ByteInput.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dex.util; 18 | 19 | /** 20 | * A byte source. 21 | */ 22 | public interface ByteInput { 23 | 24 | /** 25 | * Returns a byte. 26 | * 27 | * @throws IndexOutOfBoundsException if all bytes have been read. 28 | */ 29 | byte readByte(); 30 | } 31 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dex/util/ByteOutput.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dex.util; 18 | 19 | /** 20 | * A byte sink. 21 | */ 22 | public interface ByteOutput { 23 | 24 | /** 25 | * Writes a byte. 26 | * 27 | * @throws IndexOutOfBoundsException if all bytes have been written. 28 | */ 29 | void writeByte(int i); 30 | } 31 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dex/util/Unsigned.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dex.util; 18 | 19 | /** 20 | * Unsigned arithmetic over Java's signed types. 21 | */ 22 | public final class Unsigned { 23 | private Unsigned() {} 24 | 25 | public static int compare(short ushortA, short ushortB) { 26 | if (ushortA == ushortB) { 27 | return 0; 28 | } 29 | int a = ushortA & 0xFFFF; 30 | int b = ushortB & 0xFFFF; 31 | return a < b ? -1 : 1; 32 | } 33 | 34 | public static int compare(int uintA, int uintB) { 35 | if (uintA == uintB) { 36 | return 0; 37 | } 38 | long a = uintA & 0xFFFFFFFFL; 39 | long b = uintB & 0xFFFFFFFFL; 40 | return a < b ? -1 : 1; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/Version.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx; 18 | 19 | /** 20 | * Version number for dx. 21 | */ 22 | public class Version { 23 | /** {@code non-null;} version string */ 24 | public static final String VERSION = "1.16"; 25 | } 26 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/cf/attrib/AttDeprecated.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.cf.attrib; 18 | 19 | /** 20 | * Attribute class for standard {@code Deprecated} attributes. 21 | */ 22 | public final class AttDeprecated extends BaseAttribute { 23 | /** {@code non-null;} attribute name for attributes of this type */ 24 | public static final String ATTRIBUTE_NAME = "Deprecated"; 25 | 26 | /** 27 | * Constructs an instance. 28 | */ 29 | public AttDeprecated() { 30 | super(ATTRIBUTE_NAME); 31 | } 32 | 33 | /** {@inheritDoc} */ 34 | @Override 35 | public int byteLength() { 36 | return 6; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/cf/attrib/AttLocalVariableTable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.cf.attrib; 18 | 19 | import com.android.dx.cf.code.LocalVariableList; 20 | 21 | /** 22 | * Attribute class for standard {@code LocalVariableTable} attributes. 23 | */ 24 | public final class AttLocalVariableTable extends BaseLocalVariables { 25 | /** {@code non-null;} attribute name for attributes of this type */ 26 | public static final String ATTRIBUTE_NAME = "LocalVariableTable"; 27 | 28 | /** 29 | * Constructs an instance. 30 | * 31 | * @param localVariables {@code non-null;} list of local variable entries 32 | */ 33 | public AttLocalVariableTable(LocalVariableList localVariables) { 34 | super(ATTRIBUTE_NAME, localVariables); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/cf/attrib/AttLocalVariableTypeTable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.cf.attrib; 18 | 19 | import com.android.dx.cf.code.LocalVariableList; 20 | 21 | /** 22 | * Attribute class for standard {@code LocalVariableTypeTable} attributes. 23 | */ 24 | public final class AttLocalVariableTypeTable extends BaseLocalVariables { 25 | /** {@code non-null;} attribute name for attributes of this type */ 26 | public static final String ATTRIBUTE_NAME = "LocalVariableTypeTable"; 27 | 28 | /** 29 | * Constructs an instance. 30 | * 31 | * @param localVariables {@code non-null;} list of local variable entries 32 | */ 33 | public AttLocalVariableTypeTable(LocalVariableList localVariables) { 34 | super(ATTRIBUTE_NAME, localVariables); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/cf/attrib/AttSynthetic.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.cf.attrib; 18 | 19 | /** 20 | * Attribute class for standard {@code Synthetic} attributes. 21 | */ 22 | public final class AttSynthetic extends BaseAttribute { 23 | /** {@code non-null;} attribute name for attributes of this type */ 24 | public static final String ATTRIBUTE_NAME = "Synthetic"; 25 | 26 | /** 27 | * Constructs an instance. 28 | */ 29 | public AttSynthetic() { 30 | super(ATTRIBUTE_NAME); 31 | } 32 | 33 | /** {@inheritDoc} */ 34 | @Override 35 | public int byteLength() { 36 | return 6; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/cf/attrib/package.html: -------------------------------------------------------------------------------- 1 | 2 |

Implementation of containers and utilities for all the standard Java 3 | attribute types.

4 | 5 |

PACKAGES USED: 6 |

    7 |
  • com.android.dx.cf.iface
  • 8 |
  • com.android.dx.rop.pool
  • 9 |
  • com.android.dx.util
  • 10 |
11 | 12 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/cf/code/SimException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.cf.code; 18 | 19 | import com.android.dex.util.ExceptionWithContext; 20 | 21 | /** 22 | * Exception from simulation. 23 | */ 24 | public class SimException 25 | extends ExceptionWithContext { 26 | public SimException(String message) { 27 | super(message); 28 | } 29 | 30 | public SimException(Throwable cause) { 31 | super(cause); 32 | } 33 | 34 | public SimException(String message, Throwable cause) { 35 | super(message, cause); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/cf/code/package.html: -------------------------------------------------------------------------------- 1 | 2 |

Implementation of classes having to do with Java simulation, such as 3 | is needed for verification or stack-to-register conversion.

4 | 5 |

PACKAGES USED: 6 |

    7 |
  • com.android.dx.rop.pool
  • 8 |
  • com.android.dx.util
  • 9 |
10 | 11 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/cf/direct/package.html: -------------------------------------------------------------------------------- 1 | 2 |

Implementation of cf.iface.* based on a direct representation 3 | of class files as byte[]s.

4 | 5 |

PACKAGES USED: 6 |

    7 |
  • com.android.dx.cf.attrib
  • 8 |
  • com.android.dx.cf.iface
  • 9 |
  • com.android.dx.rop.pool
  • 10 |
  • com.android.dx.util
  • 11 |
12 | 13 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/cf/iface/Attribute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.cf.iface; 18 | 19 | /** 20 | * Interface representing attributes of class files (directly or indirectly). 21 | */ 22 | public interface Attribute { 23 | /** 24 | * Get the name of the attribute. 25 | * 26 | * @return {@code non-null;} the name 27 | */ 28 | public String getName(); 29 | 30 | /** 31 | * Get the total length of the attribute in bytes, including the 32 | * header. Since the header is always six bytes, the result of 33 | * this method is always at least {@code 6}. 34 | * 35 | * @return {@code >= 6;} the total length, in bytes 36 | */ 37 | public int byteLength(); 38 | } 39 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/cf/iface/Field.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.cf.iface; 18 | 19 | import com.android.dx.rop.cst.TypedConstant; 20 | 21 | /** 22 | * Interface representing fields of class files. 23 | */ 24 | public interface Field 25 | extends Member { 26 | /** 27 | * Get the constant value for this field, if any. This only returns 28 | * non-{@code null} for a {@code static final} field which 29 | * includes a {@code ConstantValue} attribute. 30 | * 31 | * @return {@code null-ok;} the constant value, or {@code null} if this 32 | * field isn't a constant 33 | */ 34 | public TypedConstant getConstantValue(); 35 | } 36 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/cf/iface/HasAttribute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.cf.iface; 18 | 19 | /** 20 | * An element that can have {@link Attribute} 21 | */ 22 | public interface HasAttribute { 23 | 24 | /** 25 | * Get the element {@code attributes} (along with 26 | * {@code attributes_count}). 27 | * 28 | * @return {@code non-null;} the attributes list 29 | */ 30 | public AttributeList getAttributes(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/cf/iface/Method.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.cf.iface; 18 | 19 | import com.android.dx.rop.type.Prototype; 20 | 21 | /** 22 | * Interface representing methods of class files. 23 | */ 24 | public interface Method 25 | extends Member 26 | { 27 | /** 28 | * Get the effective method descriptor, which includes, if 29 | * necessary, a first {@code this} parameter. 30 | * 31 | * @return {@code non-null;} the effective method descriptor 32 | */ 33 | public Prototype getEffectiveDescriptor(); 34 | } 35 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/cf/iface/ParseException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.cf.iface; 18 | 19 | import com.android.dex.util.ExceptionWithContext; 20 | 21 | /** 22 | * Exception from parsing. 23 | */ 24 | public class ParseException 25 | extends ExceptionWithContext { 26 | public ParseException(String message) { 27 | super(message); 28 | } 29 | 30 | public ParseException(Throwable cause) { 31 | super(cause); 32 | } 33 | 34 | public ParseException(String message, Throwable cause) { 35 | super(message, cause); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/cf/iface/package.html: -------------------------------------------------------------------------------- 1 | 2 |

Interfaces and base classes for dealing with class files. This package 3 | doesn't have any parsing but does have basic container implementations.

4 | 5 |

PACKAGES USED: 6 |

    7 |
  • com.android.dx.rop.pool
  • 8 |
  • com.android.dx.util
  • 9 |
10 | 11 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/command/UsageException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.command; 18 | 19 | /** 20 | * Simple exception class used to communicate that the command-line tool 21 | * should print the usage message. 22 | */ 23 | public class UsageException extends RuntimeException { 24 | // This space intentionally left blank. 25 | } 26 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/command/dexer/DxContext.java: -------------------------------------------------------------------------------- 1 | package com.android.dx.command.dexer; 2 | 3 | import com.android.dx.dex.cf.CodeStatistics; 4 | import com.android.dx.dex.cf.OptimizerOptions; 5 | import java.io.IOException; 6 | import java.io.OutputStream; 7 | import java.io.PrintStream; 8 | 9 | /** 10 | * State used by a single invocation of {@link Main}. 11 | */ 12 | public class DxContext { 13 | public final CodeStatistics codeStatistics = new CodeStatistics(); 14 | public final OptimizerOptions optimizerOptions = new OptimizerOptions(); 15 | public final PrintStream out; 16 | public final PrintStream err; 17 | 18 | @SuppressWarnings("IOResourceOpenedButNotSafelyClosed") 19 | final PrintStream noop = new PrintStream(new OutputStream() { 20 | @Override 21 | public void write(int b) throws IOException { 22 | // noop; 23 | } 24 | }); 25 | 26 | public DxContext(OutputStream out, OutputStream err) { 27 | this.out = new PrintStream(out); 28 | this.err = new PrintStream(err); 29 | } 30 | 31 | public DxContext() { 32 | this(System.out, System.err); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/command/findusages/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.command.findusages; 18 | 19 | import com.android.dex.Dex; 20 | import java.io.File; 21 | import java.io.IOException; 22 | import java.io.PrintWriter; 23 | 24 | public final class Main { 25 | public static void main(String[] args) throws IOException { 26 | String dexFile = args[0]; 27 | String declaredBy = args[1]; 28 | String memberName = args[2]; 29 | 30 | Dex dex = new Dex(new File(dexFile)); 31 | PrintWriter out = new PrintWriter(System.out); 32 | new FindUsages(dex, declaredBy, memberName, out).findUsages(); 33 | out.flush(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/command/grep/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.command.grep; 18 | 19 | import com.android.dex.Dex; 20 | import java.io.File; 21 | import java.io.IOException; 22 | import java.io.PrintWriter; 23 | import java.util.regex.Pattern; 24 | 25 | public final class Main { 26 | public static void main(String[] args) throws IOException { 27 | String dexFile = args[0]; 28 | String pattern = args[1]; 29 | 30 | Dex dex = new Dex(new File(dexFile)); 31 | int count = new Grep(dex, Pattern.compile(pattern), new PrintWriter(System.out)).grep(); 32 | System.exit((count > 0) ? 0 : 1); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/dex/cf/package.html: -------------------------------------------------------------------------------- 1 | 2 |

Classes for translating Java classfiles into Dalvik classes.

3 | 4 |

PACKAGES USED: 5 |

    6 |
  • com.android.dx.cf.code
  • 7 |
  • com.android.dx.cf.direct
  • 8 |
  • com.android.dx.cf.iface
  • 9 |
  • com.android.dx.dex.code
  • 10 |
  • com.android.dx.dex.file
  • 11 |
  • com.android.dx.rop.code
  • 12 |
  • com.android.dx.rop.cst
  • 13 |
  • com.android.dx.util
  • 14 |
15 | 16 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/io/instructions/CodeInput.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.io.instructions; 18 | 19 | import java.io.EOFException; 20 | 21 | /** 22 | * Input stream of code units, for reading in Dalvik bytecode. 23 | */ 24 | public interface CodeInput extends CodeCursor { 25 | /** 26 | * Returns whether there are any more code units to read. This 27 | * is analogous to {@code hasNext()} on an interator. 28 | */ 29 | public boolean hasMore(); 30 | 31 | /** 32 | * Reads a code unit. 33 | */ 34 | public int read() throws EOFException; 35 | 36 | /** 37 | * Reads two code units, treating them as a little-endian {@code int}. 38 | */ 39 | public int readInt() throws EOFException; 40 | 41 | /** 42 | * Reads four code units, treating them as a little-endian {@code long}. 43 | */ 44 | public long readLong() throws EOFException; 45 | } 46 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/merge/CollisionPolicy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.merge; 18 | 19 | /** 20 | * What to do when two dex files define the same class. 21 | */ 22 | public enum CollisionPolicy { 23 | 24 | /** 25 | * Keep the class def from the first dex file and discard the def from the 26 | * second dex file. This policy is appropriate for incremental builds. 27 | */ 28 | KEEP_FIRST, 29 | 30 | /** 31 | * Forbid collisions. This policy is appropriate for merging libraries. 32 | */ 33 | FAIL 34 | } 35 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/rop/annotation/AnnotationVisibility.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.rop.annotation; 18 | 19 | import com.android.dx.util.ToHuman; 20 | 21 | /** 22 | * Visibility scope of an annotation. 23 | */ 24 | public enum AnnotationVisibility implements ToHuman { 25 | RUNTIME("runtime"), 26 | BUILD("build"), 27 | SYSTEM("system"), 28 | EMBEDDED("embedded"); 29 | 30 | /** {@code non-null;} the human-oriented string representation */ 31 | private final String human; 32 | 33 | /** 34 | * Constructs an instance. 35 | * 36 | * @param human {@code non-null;} the human-oriented string representation 37 | */ 38 | private AnnotationVisibility(String human) { 39 | this.human = human; 40 | } 41 | 42 | /** {@inheritDoc} */ 43 | @Override 44 | public String toHuman() { 45 | return human; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/rop/code/package.html: -------------------------------------------------------------------------------- 1 | 2 |

Classes relating to a register-based opcode system.

3 | 4 |

PACKAGES USED: 5 |

    6 |
  • com.android.dx.util
  • 7 |
8 | 9 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/rop/cst/CstMethodRef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.rop.cst; 18 | 19 | /** 20 | * Constants of type {@code CONSTANT_Methodref_info}. 21 | */ 22 | public final class CstMethodRef 23 | extends CstBaseMethodRef { 24 | /** 25 | * Constructs an instance. 26 | * 27 | * @param definingClass {@code non-null;} the type of the defining class 28 | * @param nat {@code non-null;} the name-and-type 29 | */ 30 | public CstMethodRef(CstType definingClass, CstNat nat) { 31 | super(definingClass, nat); 32 | } 33 | 34 | /** {@inheritDoc} */ 35 | @Override 36 | public String typeName() { 37 | return "method"; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/rop/cst/package.html: -------------------------------------------------------------------------------- 1 | 2 |

Interfaces and implementation of things related to the constant pool.

3 | 4 |

PACKAGES USED: 5 |

    6 |
  • com.android.dx.rop.type
  • 7 |
  • com.android.dx.util
  • 8 |
9 | 10 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/rop/type/package.html: -------------------------------------------------------------------------------- 1 | 2 |

Implementation of classes that represent types (classes or primitives).

3 | 4 |

PACKAGES USED: 5 |

    6 |
  • com.android.dx.util
  • 7 |
8 | 9 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/util/IntIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.util; 18 | 19 | /** 20 | * An iterator for a list of ints. 21 | */ 22 | public interface IntIterator { 23 | 24 | /** 25 | * Checks to see if the iterator has a next value. 26 | * 27 | * @return true if next() will succeed 28 | */ 29 | boolean hasNext(); 30 | 31 | /** 32 | * Returns the next value in the iterator. 33 | * 34 | * @return next value 35 | * @throws java.util.NoSuchElementException if no next element exists 36 | */ 37 | int next(); 38 | } 39 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/util/LabeledItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.util; 18 | 19 | /** 20 | * An item that has an integer label. 21 | */ 22 | public interface LabeledItem { 23 | 24 | /* 25 | * Gets the label of this block. 26 | * 27 | * @return {@code >= 0;} the label 28 | */ 29 | public int getLabel(); 30 | } 31 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/util/MutabilityException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.util; 18 | 19 | import com.android.dex.util.ExceptionWithContext; 20 | 21 | /** 22 | * Exception due to a mutability problem. 23 | */ 24 | public class MutabilityException 25 | extends ExceptionWithContext { 26 | public MutabilityException(String message) { 27 | super(message); 28 | } 29 | 30 | public MutabilityException(Throwable cause) { 31 | super(cause); 32 | } 33 | 34 | public MutabilityException(String message, Throwable cause) { 35 | super(message, cause); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/util/ToHuman.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.util; 18 | 19 | /** 20 | * Simple interface for objects that can return a "human" (as opposed to 21 | * a complete but often hard to read) string form. 22 | */ 23 | public interface ToHuman { 24 | /** 25 | * Return the "human" string form of this instance. This is 26 | * generally less "debuggy" than {@code toString()}. 27 | * 28 | * @return {@code non-null;} the human string form 29 | */ 30 | public String toHuman(); 31 | } 32 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/util/Warning.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.dx.util; 18 | 19 | /** 20 | * Exception which is meant to indicate a non-fatal warning. 21 | */ 22 | public class Warning extends RuntimeException { 23 | /** 24 | * Constructs an instance. 25 | * 26 | * @param message human-oriented message 27 | */ 28 | public Warning(String message) { 29 | super(message); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/dx/util/package.html: -------------------------------------------------------------------------------- 1 | 2 |

Utility classes for class file access/manipulation.

3 | 4 | -------------------------------------------------------------------------------- /dx/src/main/java/com/android/multidex/ClassPathElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.android.multidex; 18 | 19 | import java.io.IOException; 20 | import java.io.InputStream; 21 | 22 | /** 23 | * An element of the class path in which class files can be found. 24 | */ 25 | interface ClassPathElement { 26 | 27 | char SEPARATOR_CHAR = '/'; 28 | 29 | /** 30 | * Open a "file" from this {@code ClassPathElement}. 31 | * @param path a '/' separated relative path to the wanted file. 32 | * @return an {@code InputStream} ready to read the requested file. 33 | * @throws IOException if the path can not be found or if an error occurred while opening it. 34 | */ 35 | InputStream open(String path) throws IOException; 36 | 37 | void close() throws IOException; 38 | 39 | Iterable list(); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /filter.txt: -------------------------------------------------------------------------------- 1 | #it is annotation 2 | #cn.kaicity 3 | 4 | #class 5 | cn.kaicity.gk.cdk.BuildConfig 6 | 7 | #package 8 | cn.kaicity 9 | 10 | #blackList 11 | !cn.kaicity.gk.cdk 12 | 13 | #blackList中的包或者类不会进行混淆 -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /image/aliplay.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Familyye/BlackObfuscator/1215be685eb63c383023faefa8fcb0c6a91c6b14/image/aliplay.jpg -------------------------------------------------------------------------------- /image/obf1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Familyye/BlackObfuscator/1215be685eb63c383023faefa8fcb0c6a91c6b14/image/obf1.png -------------------------------------------------------------------------------- /image/obf2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Familyye/BlackObfuscator/1215be685eb63c383023faefa8fcb0c6a91c6b14/image/obf2.png -------------------------------------------------------------------------------- /image/orig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Familyye/BlackObfuscator/1215be685eb63c383023faefa8fcb0c6a91c6b14/image/orig.png -------------------------------------------------------------------------------- /image/wechat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Familyye/BlackObfuscator/1215be685eb63c383023faefa8fcb0c6a91c6b14/image/wechat.png -------------------------------------------------------------------------------- /local.properties: -------------------------------------------------------------------------------- 1 | ## This file must *NOT* be checked into Version Control Systems, 2 | # as it contains information specific to your local configuration. 3 | # 4 | # Location of the SDK. This is only used by Gradle. 5 | # For customization when using a Version Control System, please read the 6 | # header note. 7 | #Mon Dec 13 22:17:09 CST 2021 8 | sdk.dir=D\:\\application\\Sdk 9 | -------------------------------------------------------------------------------- /main/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | } 8 | 9 | dependencies { 10 | compile project(':dex-tools') 11 | } 12 | 13 | test { 14 | useJUnitPlatform() 15 | } 16 | -------------------------------------------------------------------------------- /main/src/main/java/Main.java: -------------------------------------------------------------------------------- 1 | import com.googlecode.dex2jar.tools.BlackObfuscatorCmd; 2 | 3 | public class Main { 4 | 5 | public static void main(String[] args) { 6 | System.out.println("Hello Black"); 7 | BlackObfuscatorCmd.main("d2j-black-obfuscator", 8 | "-d", "2", 9 | "-i", "/Users/milk/Documents/classes.dex", 10 | "-o", "/Users/milk/Documents/classes_out.dex", 11 | "-a", "filter.txt"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'dex2jar' 2 | include ':dex-reader-api', ':dex-reader', ':dex-writer', ':dex-translator', ':dex-ir', ':dex-tools', ':d2j-smali', ':d2j-base-cmd', ':d2j-jasmin' 3 | include 'dexlib2' 4 | include 'dex-obfuscator' 5 | include 'main' 6 | include 'dx' 7 | include "asm" 8 | --------------------------------------------------------------------------------