From 16ed5ea2e05bd385a7591522c9935c6f92d9153a Mon Sep 17 00:00:00 2001 From: Nico Mexis Date: Tue, 10 Aug 2021 15:34:39 +0200 Subject: [PATCH] Reformat code --- .gitignore | 19 + .hgignore | 1 + README.md | 39 +- build.gradle | 2 +- .../com/googlecode/dex2jar/tools/BaseCmd.java | 50 +- d2j-j6/README.md | 52 +- d2j-j6/build.gradle | 2 +- d2j-j6/src/main/java/j6/Files.java | 5 +- d2j-j6/src/main/java/j6/Thro.java | 2 +- .../pxb/java/nio/file/FileVisitResult.java | 4 +- .../java/pxb/java/nio/file/FileVisitor.java | 8 +- .../main/java/pxb/java/nio/file/Files.java | 8 +- .../pxb/java/nio/file/SimpleFileVisitor.java | 9 +- .../java/nio/file/spi/FileSystemProvider.java | 32 +- .../googlecode/d2j/jasmin/Jar2JasminCmd.java | 30 +- .../googlecode/d2j/jasmin/Jasmin2JarCmd.java | 44 +- .../googlecode/d2j/jasmin/JasminDumper.java | 59 +- .../com/googlecode/d2j/jasmin/Jasmins.java | 19 +- .../d2j/tools/jar/test/Jasmin2jTest.java | 29 +- .../googlecode/d2j/smali/AntlrSmaliUtil.java | 293 +++-- .../com/googlecode/d2j/smali/Baksmali.java | 21 +- .../com/googlecode/d2j/smali/BaksmaliCmd.java | 24 +- .../d2j/smali/BaksmaliCodeDumper.java | 27 +- .../d2j/smali/BaksmaliDexFileVisitor.java | 1 - .../googlecode/d2j/smali/BaksmaliDumpOut.java | 1 - .../googlecode/d2j/smali/BaksmaliDumper.java | 33 +- .../java/com/googlecode/d2j/smali/Smali.java | 12 +- .../com/googlecode/d2j/smali/SmaliCmd.java | 20 +- .../d2j/smali/SmaliCodeVisitor.java | 35 +- .../java/com/googlecode/d2j/smali/Utils.java | 259 ++-- d2j-smali/src/test/java/a/BaksmaliTest.java | 3 +- d2j-smali/src/test/java/a/SmaliTest.java | 12 +- .../java/com/googlecode/dex2jar/ir/ET.java | 8 +- .../com/googlecode/dex2jar/ir/IrMethod.java | 20 +- .../dex2jar/ir/LabelAndLocalMapper.java | 1 - .../googlecode/dex2jar/ir/StmtSearcher.java | 60 +- .../googlecode/dex2jar/ir/StmtTraveler.java | 62 +- .../dex2jar/ir/TransformerException.java | 2 +- .../java/com/googlecode/dex2jar/ir/Trap.java | 16 +- .../com/googlecode/dex2jar/ir/TypeClass.java | 78 +- .../java/com/googlecode/dex2jar/ir/Util.java | 17 +- .../dex2jar/ir/expr/AbstractInvokeExpr.java | 6 +- .../googlecode/dex2jar/ir/expr/ArrayExpr.java | 11 +- .../googlecode/dex2jar/ir/expr/BinopExpr.java | 15 +- .../googlecode/dex2jar/ir/expr/CastExpr.java | 10 +- .../googlecode/dex2jar/ir/expr/Constant.java | 9 +- .../com/googlecode/dex2jar/ir/expr/Exprs.java | 46 +- .../googlecode/dex2jar/ir/expr/FieldExpr.java | 12 +- .../dex2jar/ir/expr/FilledArrayExpr.java | 9 +- .../dex2jar/ir/expr/InvokeCustomExpr.java | 9 +- .../dex2jar/ir/expr/InvokeExpr.java | 7 +- .../ir/expr/InvokePolymorphicExpr.java | 6 +- .../com/googlecode/dex2jar/ir/expr/Local.java | 8 +- .../googlecode/dex2jar/ir/expr/NewExpr.java | 6 +- .../dex2jar/ir/expr/NewMutiArrayExpr.java | 6 +- .../googlecode/dex2jar/ir/expr/PhiExpr.java | 8 +- .../googlecode/dex2jar/ir/expr/RefExpr.java | 14 +- .../dex2jar/ir/expr/StaticFieldExpr.java | 12 +- .../googlecode/dex2jar/ir/expr/TypeExpr.java | 13 +- .../googlecode/dex2jar/ir/expr/UnopExpr.java | 18 +- .../com/googlecode/dex2jar/ir/expr/Value.java | 53 +- .../dex2jar/ir/stmt/AssignStmt.java | 13 +- .../dex2jar/ir/stmt/BaseSwitchStmt.java | 9 +- .../googlecode/dex2jar/ir/stmt/GotoStmt.java | 12 +- .../googlecode/dex2jar/ir/stmt/IfStmt.java | 15 +- .../googlecode/dex2jar/ir/stmt/JumpStmt.java | 6 +- .../googlecode/dex2jar/ir/stmt/LabelStmt.java | 16 +- .../dex2jar/ir/stmt/LookupSwitchStmt.java | 13 +- .../googlecode/dex2jar/ir/stmt/NopStmt.java | 11 +- .../dex2jar/ir/stmt/ReturnVoidStmt.java | 11 +- .../com/googlecode/dex2jar/ir/stmt/Stmt.java | 42 +- .../googlecode/dex2jar/ir/stmt/StmtList.java | 23 +- .../com/googlecode/dex2jar/ir/stmt/Stmts.java | 8 +- .../dex2jar/ir/stmt/TableSwitchStmt.java | 11 +- .../googlecode/dex2jar/ir/stmt/UnopStmt.java | 6 +- .../dex2jar/ir/stmt/VoidInvokeStmt.java | 11 +- .../dex2jar/ir/ts/AggTransformer.java | 212 ++-- .../com/googlecode/dex2jar/ir/ts/Cfg.java | 31 +- .../googlecode/dex2jar/ir/ts/CleanLabel.java | 35 +- .../dex2jar/ir/ts/ConstTransformer.java | 17 +- .../dex2jar/ir/ts/DeadCodeTransformer.java | 21 +- .../googlecode/dex2jar/ir/ts/EndRemover.java | 14 +- .../dex2jar/ir/ts/ExceptionHandlerTrim.java | 31 +- .../com/googlecode/dex2jar/ir/ts/FixVar.java | 15 +- .../ir/ts/Ir2JRegAssignTransformer.java | 45 +- .../dex2jar/ir/ts/JimpleTransformer.java | 16 +- .../dex2jar/ir/ts/MultiArrayTransformer.java | 72 +- .../dex2jar/ir/ts/NewTransformer.java | 27 +- .../dex2jar/ir/ts/NpeTransformer.java | 143 +-- .../dex2jar/ir/ts/RemoveConstantFromSSA.java | 31 +- .../dex2jar/ir/ts/RemoveLocalFromSSA.java | 14 +- .../dex2jar/ir/ts/SSATransformer.java | 33 +- .../googlecode/dex2jar/ir/ts/Transformer.java | 8 +- .../dex2jar/ir/ts/TypeTransformer.java | 676 +++++----- .../dex2jar/ir/ts/UnSSATransformer.java | 95 +- .../dex2jar/ir/ts/VoidInvokeTransformer.java | 16 +- .../dex2jar/ir/ts/ZeroTransformer.java | 7 +- .../dex2jar/ir/ts/an/AnalyzeValue.java | 8 +- .../dex2jar/ir/ts/an/BaseAnalyze.java | 15 +- .../dex2jar/ir/ts/an/SimpleLiveAnalyze.java | 15 +- .../dex2jar/ir/ts/an/SimpleLiveValue.java | 6 +- .../ir/ts/array/ArrayElementTransformer.java | 81 +- .../ts/array/ArrayNullPointerTransformer.java | 24 +- .../ir/ts/array/FillArrayTransformer.java | 123 +- .../dex2jar/ir/test/AggTransformerTest.java | 23 +- .../dex2jar/ir/test/BaseTransformerTest.java | 18 +- .../dex2jar/ir/test/ConstTransformerTest.java | 15 +- .../ir/test/JimpleTransformerTest.java | 21 +- .../ir/test/RemoveConstantFromSSATest.java | 15 +- .../dex2jar/ir/test/SSATransformerTest.java | 42 +- .../dex2jar/ir/test/StmtListTest.java | 13 +- .../dex2jar/ir/test/TypeTransformerTest.java | 22 +- .../test/UnSSATransformerTransformerTest.java | 38 +- .../dex2jar/ir/test/ZeroTransformerTest.java | 1 - .../java/com/googlecode/d2j/DexConstants.java | 8 +- .../java/com/googlecode/d2j/DexException.java | 29 +- .../java/com/googlecode/d2j/DexLabel.java | 12 +- .../main/java/com/googlecode/d2j/DexType.java | 9 +- .../main/java/com/googlecode/d2j/Field.java | 10 +- .../main/java/com/googlecode/d2j/Method.java | 20 +- .../java/com/googlecode/d2j/Visibility.java | 6 +- .../d2j/node/DexAnnotationNode.java | 17 +- .../com/googlecode/d2j/node/DexClassNode.java | 18 +- .../com/googlecode/d2j/node/DexCodeNode.java | 38 +- .../com/googlecode/d2j/node/DexDebugNode.java | 5 +- .../com/googlecode/d2j/node/DexFieldNode.java | 14 +- .../com/googlecode/d2j/node/DexFileNode.java | 1 - .../googlecode/d2j/node/DexMethodNode.java | 11 +- .../d2j/node/analysis/DvmFrame.java | 688 +++++----- .../d2j/node/analysis/DvmInterpreter.java | 15 +- .../d2j/node/insn/PackedSwitchStmtNode.java | 2 +- .../googlecode/d2j/node/insn/Stmt0RNode.java | 1 + .../java/com/googlecode/d2j/reader/CFG.java | 12 +- .../java/com/googlecode/d2j/reader/Op.java | 61 +- .../d2j/visitors/DexAnnotationAble.java | 17 +- .../d2j/visitors/DexAnnotationVisitor.java | 32 +- .../d2j/visitors/DexClassVisitor.java | 8 +- .../d2j/visitors/DexCodeVisitor.java | 63 +- .../d2j/visitors/DexDebugVisitor.java | 5 +- .../d2j/visitors/DexFieldVisitor.java | 7 +- .../d2j/visitors/DexFileVisitor.java | 6 +- .../d2j/visitors/DexMethodVisitor.java | 8 +- .../d2j/reader/BaseDexFileReader.java | 1 - .../googlecode/d2j/reader/DexFileReader.java | 232 ++-- .../d2j/reader/MultiDexFileReader.java | 19 +- .../googlecode/d2j/reader/zip/ZipUtil.java | 17 +- .../d2j/util/ASMifierAnnotationV.java | 6 +- .../googlecode/d2j/util/ASMifierClassV.java | 26 +- .../googlecode/d2j/util/ASMifierCodeV.java | 21 +- .../googlecode/d2j/util/ASMifierFileV.java | 21 +- .../com/googlecode/d2j/util/ArrayOut.java | 10 +- .../java/com/googlecode/d2j/util/Escape.java | 14 +- .../java/com/googlecode/d2j/util/Mutf8.java | 2 +- .../com/googlecode/d2j/util/Utf8Utils.java | 29 +- .../util/zip/AutoSTOREDZipOutputStream.java | 3 +- .../googlecode/d2j/util/zip/ZipConstants.java | 10 +- .../com/googlecode/d2j/util/zip/ZipEntry.java | 40 +- .../com/googlecode/d2j/util/zip/ZipFile.java | 49 +- .../d2j/reader/test/AsmfierTest.java | 15 +- .../d2j/reader/test/BadZipEntryFlagTest.java | 11 +- .../d2j/reader/test/SkipDupMethod.java | 5 +- dex-tools/src/main/assemble/package.xml | 6 +- .../d2j/signapk/AbstractJarSign.java | 43 +- .../com/googlecode/d2j/signapk/Base64.java | 265 ++-- .../d2j/signapk/SunJarSignImpl.java | 9 +- .../googlecode/d2j/signapk/TinySignImpl.java | 17 +- .../googlecode/d2j/tools/jar/BaseWeaver.java | 132 +- .../googlecode/d2j/tools/jar/ClassInfo.java | 4 +- .../googlecode/d2j/tools/jar/DexWeaver.java | 343 +++-- .../com/googlecode/d2j/tools/jar/InitOut.java | 71 +- .../d2j/tools/jar/InvocationWeaver.java | 177 +-- .../d2j/tools/jar/ScanBridgeAdapter.java | 9 +- .../com/googlecode/d2j/tools/jar/WebApp.java | 6 +- .../googlecode/dex2jar/bin_gen/BinGen.java | 17 +- .../com/googlecode/dex2jar/tools/ApkSign.java | 33 +- .../googlecode/dex2jar/tools/AsmVerify.java | 52 +- .../BaksmaliBaseDexExceptionHandler.java | 27 +- .../dex2jar/tools/ClassVersionSwitch.java | 16 +- .../dex2jar/tools/DeObfInitCmd.java | 16 +- .../dex2jar/tools/DecryptStringCmd.java | 702 ++++++----- .../googlecode/dex2jar/tools/Dex2jarCmd.java | 22 +- .../dex2jar/tools/Dex2jarMultiThreadCmd.java | 74 +- .../dex2jar/tools/DexRecomputeChecksum.java | 10 +- .../dex2jar/tools/DexWeaverCmd.java | 22 +- .../tools/ExtractOdexFromCoredumpCmd.java | 32 +- .../tools/GenerateCompileStubFromOdex.java | 15 +- .../com/googlecode/dex2jar/tools/Jar2Dex.java | 23 +- .../dex2jar/tools/JarAccessCmd.java | 28 +- .../dex2jar/tools/JarWeaverCmd.java | 22 +- .../googlecode/dex2jar/tools/StdApkCmd.java | 7 +- .../com/googlecode/dex2jar/tools/to/Do.java | 2 +- .../d2j/tools/jar/MethodInvocation.java | 1 + .../d2j/tools/jar/test/DexWaveTest.java | 7 +- .../d2j/tools/jar/test/WaveTest.java | 20 +- .../d2j/asm/LdcOptimizeAdapter.java | 69 +- .../d2j/converter/Dex2IRConverter.java | 1101 +++++++++-------- .../d2j/converter/IR2JConverter.java | 171 +-- .../d2j/converter/J2IRConverter.java | 862 ++++++------- .../d2j/dex/BaseDexExceptionHandler.java | 14 +- .../d2j/dex/ClassVisitorFactory.java | 4 +- .../java/com/googlecode/d2j/dex/Dex2Asm.java | 151 ++- .../com/googlecode/d2j/dex/Dex2IrAdapter.java | 102 +- .../java/com/googlecode/d2j/dex/Dex2jar.java | 29 +- .../d2j/dex/DexExceptionHandler.java | 10 +- .../java/com/googlecode/d2j/dex/DexFix.java | 17 +- .../com/googlecode/d2j/dex/ExDex2Asm.java | 6 +- .../main/java/com/googlecode/d2j/dex/V3.java | 8 +- .../java/com/googlecode/d2j/util/Types.java | 14 +- .../java/org/objectweb/asm/AsmBridge.java | 9 +- .../googlecode/dex2jar/test/ASMifierTest.java | 15 +- .../dex2jar/test/ArrayTypeTest.java | 29 +- .../googlecode/dex2jar/test/AutoCastTest.java | 19 +- .../com/googlecode/dex2jar/test/D2jTest.java | 20 +- .../dex2jar/test/DexTranslatorRunner.java | 3 +- .../dex2jar/test/EmptyTrapTest.java | 71 +- .../com/googlecode/dex2jar/test/I101Test.java | 27 +- .../com/googlecode/dex2jar/test/I121Test.java | 30 +- .../com/googlecode/dex2jar/test/I168Test.java | 14 +- .../com/googlecode/dex2jar/test/I63Test.java | 7 +- .../googlecode/dex2jar/test/Issue71Test.java | 16 +- .../googlecode/dex2jar/test/OptSyncTest.java | 40 +- .../com/googlecode/dex2jar/test/ResTest.java | 15 +- .../googlecode/dex2jar/test/Smali2jTest.java | 17 +- .../dex2jar/test/TestDexClassV.java | 7 +- .../googlecode/dex2jar/test/TestUtils.java | 61 +- .../com/googlecode/dex2jar/test/ZeroTest.java | 14 +- .../gen/FTPClient__parsePassiveModeReply.java | 151 ++- .../src/test/java/res/ArrayRes.java | 17 +- .../src/test/java/res/ChineseRes.java | 7 +- .../src/test/java/res/ExceptionRes.java | 7 +- .../src/test/java/res/Gh28Type.java | 8 +- .../src/test/java/res/I56_AccessFlag.java | 33 +- dex-translator/src/test/java/res/I71.java | 2 - dex-translator/src/test/java/res/I88.java | 5 +- .../src/test/java/res/LongDoubleRes.java | 7 +- .../src/test/java/res/NoEndRes.java | 3 +- .../src/test/java/res/NullZero.java | 7 +- dex-translator/src/test/java/res/PopRes.java | 7 +- .../src/test/java/res/SwitchRes.java | 7 +- dex-translator/src/test/java/res/WideRes.java | 7 +- .../src/test/java/res/i55/AAbstractClass.java | 7 +- .../src/test/java/res/i55/AClass.java | 7 +- .../src/test/java/res/i55/AInterface.java | 7 +- dex-writer/build.gradle | 2 +- .../d2j/dex/writer/AnnotationWriter.java | 1 - .../d2j/dex/writer/ClassWriter.java | 6 +- .../googlecode/d2j/dex/writer/CodeWriter.java | 102 +- .../d2j/dex/writer/DexFileWriter.java | 117 +- .../d2j/dex/writer/MethodWriter.java | 39 +- .../d2j/dex/writer/ev/EncodedAnnotation.java | 1 - .../d2j/dex/writer/ev/EncodedArray.java | 1 - .../d2j/dex/writer/ev/EncodedValue.java | 316 ++--- .../googlecode/d2j/dex/writer/insn/Insn.java | 2 - .../d2j/dex/writer/insn/JumpOp.java | 71 +- .../dex/writer/item/AnnotationSetItem.java | 12 +- .../writer/item/AnnotationsDirectoryItem.java | 1 - .../d2j/dex/writer/item/ClassDataItem.java | 28 +- .../d2j/dex/writer/item/ClassDefItem.java | 7 +- .../d2j/dex/writer/item/CodeItem.java | 30 +- .../d2j/dex/writer/item/ConstPool.java | 16 +- .../d2j/dex/writer/item/DebugInfoItem.java | 55 +- .../d2j/dex/writer/item/MapListItem.java | 1 - .../d2j/dex/writer/item/SectionItem.java | 1 - .../d2j/dex/writer/item/StringDataItem.java | 1 - .../d2j/dex/writer/item/TypeListItem.java | 1 - dex-writer/src/test/java/a/AppWriterTest.java | 13 +- dex-writer/src/test/java/a/CpStringTest.java | 3 +- gradle/wrapper/gradle-wrapper.properties | 10 +- settings.gradle | 2 +- 269 files changed, 6225 insertions(+), 5702 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..82fe233b6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +*/target/* +target/* +*/build +build +*/.project +*/.classpath +*/.* + +.* +*.bak +*.orig +*/nb-configuration.xml +*.iml +*.ipr +*.iws +*~ +*.class + +!.gitignore diff --git a/.hgignore b/.hgignore index 7c02fcce5..cbf0f46d2 100644 --- a/.hgignore +++ b/.hgignore @@ -16,3 +16,4 @@ build *.iws *~ +!.gitignore diff --git a/README.md b/README.md index 4efe17a79..160ea63cd 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,32 @@ # dex2jar +

+ +

+ This is [Nico Mexis'](https://github.com/ThexXTURBOXx) fork of the dex2jar project which aims to fix most issues. # Downloads -**To download latest builds, head to the [Releases](https://github.com/ThexXTURBOXx/dex2jar/releases).** - -**Note: the builds in [Releases](https://github.com/ThexXTURBOXx/dex2jar/releases) are automatically built by GitHub Actions.** - -**Project moved to [SourceForge](https://sourceforge.net/p/dex2jar) and [Bitbucket](https://bitbucket.org/pxb1988/dex2jar) and [Github](https://github.com/pxb1988/dex2jar)** -| _ | Mirror | Wiki | Downloads | Issues | -|--:|:-----|:----:|:---------:|:------:| -| sf | https://sourceforge.net/p/dex2jar | [Wiki](https://sourceforge.net/p/dex2jar/wiki) | [Downloads](https://sourceforge.net/projects/dex2jar/files/) | [Tickets](https://sourceforge.net/p/dex2jar/tickets/) | -| bb | https://bitbucket.org/pxb1988/dex2jar | [Wiki](https://bitbucket.org/pxb1988/dex2jar/wiki) | [Downloads](https://bitbucket.org/pxb1988/dex2jar/downloads) | [Issues](https://bitbucket.org/pxb1988/dex2jar/issues) | -| gh | https://github.com/pxb1988/dex2jar | [Wiki](https://github.com/pxb1988/dex2jar/wiki) | [Releases](https://github.com/pxb1988/dex2jar/releases) | [Issues](https://github.com/pxb1988/dex2jar/issues) | -| gc | https://code.google.com/p/dex2jar | [old](http://code.google.com/p/dex2jar/w/list) | [old](http://code.google.com/p/dex2jar/downloads/list) | [old](http://code.google.com/p/dex2jar/issues/list)| +**To download the latest builds, head to the [Releases](https://github.com/ThexXTURBOXx/dex2jar/releases).** +**Note: the builds in [Releases](https://github.com/ThexXTURBOXx/dex2jar/releases) are automatically built by GitHub +Actions.** -[![Build Status](https://travis-ci.org/ThexXTURBOXx/dex2jar.svg?branch=2.x)](https://travis-ci.org/ThexXTURBOXx/dex2jar) Tools to work with android .dex and java .class files 1. dex-reader/writer: - Read/write the Dalvik Executable (.dex) file. It has a [light weight API similar with ASM](https://sourceforge.net/p/dex2jar/wiki/Faq#markdown-header-want-to-read-dex-file-using-dex2jar). + Read/write the Dalvik Executable (.dex) file. It has + a [light weight API similar with ASM](https://sourceforge.net/p/dex2jar/wiki/Faq#markdown-header-want-to-read-dex-file-using-dex2jar) + . 2. d2j-dex2jar: - Convert .dex file to .class files (zipped as jar) + Convert .dex file to .class files (zipped as jar) 3. smali/baksmali: - disassemble dex to smali files and assemble dex from smali files. different implementation to [smali/baksmali](http://code.google.com/p/smali), same syntax, but we support escape in type desc "Lcom/dex2jar\t\u1234;" + disassemble dex to smali files and assemble dex from smali files. different implementation + to [smali/baksmali](http://code.google.com/p/smali), same syntax, but we support escape in type desc " + Lcom/dex2jar\t\u1234;" 4. other tools: - [d2j-decrypt-string](https://sourceforge.net/p/dex2jar/wiki/DecryptStrings) + [d2j-decrypt-string](https://sourceforge.net/p/dex2jar/wiki/DecryptStrings) ## Usage @@ -38,15 +37,19 @@ Tools to work with android .dex and java .class files ### Example usage: -> sh d2j-dex2jar.sh -f ~/path/to/apk_to_decompile.apk +```shell +sh d2j-dex2jar.sh -f ~/path/to/apk_to_decompile.apk +``` And the output file will be `apk_to_decompile-dex2jar.jar`. ## Need help ? -send email to dex2jar@googlegroups.com + +send email to dex2jar@googlegroups.com or post on issue trackers list above. ## License + [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) diff --git a/build.gradle b/build.gradle index 60d01377d..3de86c5bf 100644 --- a/build.gradle +++ b/build.gradle @@ -42,7 +42,7 @@ subprojects { compileJava.options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" dependencies { - testImplementation group: 'junit', name: 'junit', version: '4.11' + testImplementation group: 'junit', name: 'junit', version: '4.13.2' implementation fileTree(dir: 'libs', include: '*.jar') } diff --git a/d2j-base-cmd/src/main/java/com/googlecode/dex2jar/tools/BaseCmd.java b/d2j-base-cmd/src/main/java/com/googlecode/dex2jar/tools/BaseCmd.java index 8c99ebd60..e2788bb5e 100644 --- a/d2j-base-cmd/src/main/java/com/googlecode/dex2jar/tools/BaseCmd.java +++ b/d2j-base-cmd/src/main/java/com/googlecode/dex2jar/tools/BaseCmd.java @@ -1,13 +1,13 @@ /* * dex2jar - Tools to work with android .dex and java .class files * Copyright (c) 2009-2012 Panxiaobo - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,10 +27,20 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; import java.nio.charset.StandardCharsets; -import java.nio.file.*; +import java.nio.file.FileSystem; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributes; import java.nio.file.spi.FileSystemProvider; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; public abstract class BaseCmd { public static String getBaseName(String fn) { @@ -96,7 +106,7 @@ public static FileSystem openZip(Path in) throws IOException { for (FileSystemProvider p : FileSystemProvider.installedProviders()) { String s = p.getScheme(); if ("jar".equals(s) || "zip".equalsIgnoreCase(s)) { - return p.newFileSystem(in, new HashMap()); + return p.newFileSystem(in, new HashMap<>()); } } throw new IOException("cant find zipfs support"); @@ -115,7 +125,7 @@ public HelpException(String message) { } @Retention(value = RetentionPolicy.RUNTIME) - @Target(value = { ElementType.FIELD }) + @Target(value = {ElementType.FIELD}) public @interface Opt { String argName() default ""; @@ -170,13 +180,13 @@ public String getOptAndLongOpt() { StringBuilder sb = new StringBuilder(); boolean havePrev = false; if (opt != null && opt.length() > 0) { - sb.append("-").append(opt); + sb.append("-").append(opt); havePrev = true; } if (longOpt != null && longOpt.length() > 0) { if (havePrev) { - sb.append(","); - } + sb.append(","); + } sb.append("--").append(longOpt); } return sb.toString(); @@ -185,7 +195,7 @@ public String getOptAndLongOpt() { } @Retention(value = RetentionPolicy.RUNTIME) - @Target(value = { ElementType.TYPE }) + @Target(value = {ElementType.TYPE}) public @interface Syntax { String cmd(); @@ -203,7 +213,7 @@ public String getOptAndLongOpt() { private String desc; private String onlineHelp; - protected Map optMap = new HashMap(); + protected Map optMap = new HashMap<>(); @Opt(opt = "h", longOpt = "help", hasArg = false, description = "Print this help message") private boolean printHelp = false; @@ -242,7 +252,7 @@ private Set