From 84ea54eb1e2c68091080951a3024cca98f70aca2 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Fri, 29 Aug 2014 14:31:45 +0400 Subject: [PATCH] java-decompiler: post-import cleanup (code style issues) --- .../java/decompiler/code/CodeConstants.java | 584 +++++++++--------- .../java/decompiler/code/Instruction.java | 2 +- .../decompiler/code/InstructionSequence.java | 26 +- .../decompiler/code/cfg/ControlFlowGraph.java | 36 +- .../code/interpreter/InstructionImpact.java | 2 +- .../main/ClassReference14Processor.java | 2 +- .../java/decompiler/main/ClassWriter.java | 2 - .../java/decompiler/main/Fernflower.java | 7 +- .../decompiler/main/InitializerProcessor.java | 2 +- .../main/decompiler/ConsoleDecompiler.java | 2 +- .../main/extern/IBytecodeProvider.java | 2 +- .../main/extern/IDecompilatSaver.java | 18 +- .../main/extern/IFernflowerLogger.java | 34 +- .../main/extern/IFernflowerPreferences.java | 64 +- .../main/extern/IIdentifierRenamer.java | 14 +- .../main/rels/MethodProcessorThread.java | 10 +- .../main/rels/NestedClassProcessor.java | 3 +- .../main/rels/NestedMemberAccess.java | 6 +- .../modules/code/DeadCodeHelper.java | 14 +- .../decompiler/ConcatenationHelper.java | 2 +- .../modules/decompiler/DecHelper.java | 2 +- .../modules/decompiler/DomHelper.java | 6 +- .../modules/decompiler/ExitHelper.java | 6 +- .../modules/decompiler/ExprProcessor.java | 8 +- .../modules/decompiler/ExprentStack.java | 4 +- .../modules/decompiler/FinallyProcessor.java | 6 +- .../modules/decompiler/IdeaNotNullHelper.java | 6 +- .../modules/decompiler/IfHelper.java | 11 +- .../decompiler/InlineSingleBlockHelper.java | 2 +- .../modules/decompiler/LabelHelper.java | 4 +- .../modules/decompiler/LoopExtractHelper.java | 4 +- .../modules/decompiler/LowBreakHelper.java | 6 +- .../modules/decompiler/MergeHelper.java | 2 +- .../modules/decompiler/SequenceHelper.java | 6 +- .../decompiler/SimplifyExprentsHelper.java | 8 +- .../decompiler/StackVarsProcessor.java | 6 +- .../decompiler/decompose/DominatorEngine.java | 2 +- .../FastExtendedPostdominanceHelper.java | 4 +- .../decompose/GenericDominatorEngine.java | 2 +- .../modules/decompiler/decompose/IGraph.java | 4 +- .../decompiler/decompose/IGraphNode.java | 2 +- .../IrreducibleCFGDeobfuscator.java | 2 +- .../modules/decompiler/exps/Exprent.java | 2 +- .../decompiler/exps/FunctionExprent.java | 5 +- .../modules/decompiler/exps/VarExprent.java | 2 - .../decompiler/sforms/DirectGraph.java | 2 +- .../sforms/FlattenStatementsHelper.java | 2 +- .../sforms/SSAUConstructorSparseEx.java | 2 +- .../decompiler/stats/CatchAllStatement.java | 4 +- .../decompiler/stats/SequenceStatement.java | 4 +- .../modules/decompiler/stats/Statement.java | 18 +- .../decompiler/vars/VarDefinitionHelper.java | 2 +- .../modules/renamer/IdentifierConverter.java | 2 +- .../decompiler/struct/IDecompiledData.java | 4 +- .../java/decompiler/struct/ISaveClass.java | 6 +- .../java/decompiler/struct/StructContext.java | 4 +- .../java/decompiler/struct/StructMethod.java | 7 +- .../attr/StructExceptionsAttribute.java | 4 +- .../struct/consts/ConstantPool.java | 2 +- .../struct/consts/LinkConstant.java | 1 - .../struct/consts/VariableTypeEnum.java | 52 +- .../struct/gen/FieldDescriptor.java | 8 +- .../java/decompiler/struct/gen/VarType.java | 28 +- .../struct/gen/generics/GenericMain.java | 4 +- .../struct/gen/generics/GenericType.java | 2 +- .../decompiler/struct/lazy/LazyLoader.java | 2 +- .../decompiler/util/DataInputFullStream.java | 4 +- .../decompiler/util/FastSparseSetFactory.java | 4 +- .../java/decompiler/util/InterpreterUtil.java | 41 +- .../java/decompiler/util/SFormsFastMap.java | 6 +- .../decompiler/util/SFormsFastMapOld.java | 6 +- .../decompiler/util/VBStyleCollection.java | 2 +- 72 files changed, 567 insertions(+), 600 deletions(-) diff --git a/src/org/jetbrains/java/decompiler/code/CodeConstants.java b/src/org/jetbrains/java/decompiler/code/CodeConstants.java index de5198b..4a7ef0f 100644 --- a/src/org/jetbrains/java/decompiler/code/CodeConstants.java +++ b/src/org/jetbrains/java/decompiler/code/CodeConstants.java @@ -21,350 +21,350 @@ public interface CodeConstants { // BYTECODE VERSIONS // ---------------------------------------------------------------------- - public final static int BYTECODE_JAVA_LE_4 = 1; - public final static int BYTECODE_JAVA_5 = 2; - public final static int BYTECODE_JAVA_6 = 3; - public final static int BYTECODE_JAVA_7 = 4; - public final static int BYTECODE_JAVA_8 = 5; + int BYTECODE_JAVA_LE_4 = 1; + int BYTECODE_JAVA_5 = 2; + int BYTECODE_JAVA_6 = 3; + int BYTECODE_JAVA_7 = 4; + int BYTECODE_JAVA_8 = 5; // ---------------------------------------------------------------------- // VARIABLE TYPES // ---------------------------------------------------------------------- - public final static int TYPE_BYTE = 0; - public final static int TYPE_CHAR = 1; - public final static int TYPE_DOUBLE = 2; - public final static int TYPE_FLOAT = 3; - public final static int TYPE_INT = 4; - public final static int TYPE_LONG = 5; - public final static int TYPE_SHORT = 6; - public final static int TYPE_BOOLEAN = 7; - public final static int TYPE_OBJECT = 8; - public final static int TYPE_ADDRESS = 9; - public final static int TYPE_VOID = 10; - public final static int TYPE_ANY = 11; - public final static int TYPE_GROUP2EMPTY = 12; - public final static int TYPE_NULL = 13; - public final static int TYPE_NOTINITIALIZED = 14; - public final static int TYPE_BYTECHAR = 15; - public final static int TYPE_SHORTCHAR = 16; - public final static int TYPE_UNKNOWN = 17; - public final static int TYPE_GENVAR = 18; + int TYPE_BYTE = 0; + int TYPE_CHAR = 1; + int TYPE_DOUBLE = 2; + int TYPE_FLOAT = 3; + int TYPE_INT = 4; + int TYPE_LONG = 5; + int TYPE_SHORT = 6; + int TYPE_BOOLEAN = 7; + int TYPE_OBJECT = 8; + int TYPE_ADDRESS = 9; + int TYPE_VOID = 10; + int TYPE_ANY = 11; + int TYPE_GROUP2EMPTY = 12; + int TYPE_NULL = 13; + int TYPE_NOTINITIALIZED = 14; + int TYPE_BYTECHAR = 15; + int TYPE_SHORTCHAR = 16; + int TYPE_UNKNOWN = 17; + int TYPE_GENVAR = 18; // ---------------------------------------------------------------------- // VARIABLE TYPE FAMILIES // ---------------------------------------------------------------------- - public final static int TYPE_FAMILY_UNKNOWN = 0; - public final static int TYPE_FAMILY_BOOLEAN = 1; - public final static int TYPE_FAMILY_INTEGER = 2; - public final static int TYPE_FAMILY_FLOAT = 3; - public final static int TYPE_FAMILY_LONG = 4; - public final static int TYPE_FAMILY_DOUBLE = 5; - public final static int TYPE_FAMILY_OBJECT = 6; + int TYPE_FAMILY_UNKNOWN = 0; + int TYPE_FAMILY_BOOLEAN = 1; + int TYPE_FAMILY_INTEGER = 2; + int TYPE_FAMILY_FLOAT = 3; + int TYPE_FAMILY_LONG = 4; + int TYPE_FAMILY_DOUBLE = 5; + int TYPE_FAMILY_OBJECT = 6; // ---------------------------------------------------------------------- // MODULE CONSTANTS // ---------------------------------------------------------------------- - public final static int STACKSIZE_SIMPLE = 1; - public final static int STACKSIZE_DOUBLE = 2; + int STACKSIZE_SIMPLE = 1; + int STACKSIZE_DOUBLE = 2; - public final static int VAR_LOCAL = 0; - public final static int VAR_STACK = 1; + int VAR_LOCAL = 0; + int VAR_STACK = 1; - public final static int VAR_WRITE = 0; - public final static int VAR_READ = 1; + int VAR_WRITE = 0; + int VAR_READ = 1; // ---------------------------------------------------------------------- // ACCESS FLAGS // ---------------------------------------------------------------------- - public final static int ACC_PUBLIC = 0x0001; - public final static int ACC_PRIVATE = 0x0002; - public final static int ACC_PROTECTED = 0x0004; - public final static int ACC_STATIC = 0x0008; - public final static int ACC_FINAL = 0x0010; - public final static int ACC_SYNCHRONIZED = 0x0020; - public final static int ACC_NATIVE = 0x0100; - public final static int ACC_ABSTRACT = 0x0400; - public final static int ACC_STRICT = 0x0800; - public final static int ACC_VOLATILE = 0x0040; - public final static int ACC_BRIDGE = 0x0040; - public final static int ACC_TRANSIENT = 0x0080; - public final static int ACC_VARARGS = 0x0080; - public final static int ACC_SYNTHETIC = 0x1000; - public final static int ACC_ANNOTATION = 0x2000; - public final static int ACC_ENUM = 0x4000; + int ACC_PUBLIC = 0x0001; + int ACC_PRIVATE = 0x0002; + int ACC_PROTECTED = 0x0004; + int ACC_STATIC = 0x0008; + int ACC_FINAL = 0x0010; + int ACC_SYNCHRONIZED = 0x0020; + int ACC_NATIVE = 0x0100; + int ACC_ABSTRACT = 0x0400; + int ACC_STRICT = 0x0800; + int ACC_VOLATILE = 0x0040; + int ACC_BRIDGE = 0x0040; + int ACC_TRANSIENT = 0x0080; + int ACC_VARARGS = 0x0080; + int ACC_SYNTHETIC = 0x1000; + int ACC_ANNOTATION = 0x2000; + int ACC_ENUM = 0x4000; // ---------------------------------------------------------------------- // CLASS FLAGS // ---------------------------------------------------------------------- - public final static int ACC_SUPER = 0x0020; - public final static int ACC_INTERFACE = 0x0200; + int ACC_SUPER = 0x0020; + int ACC_INTERFACE = 0x0200; // ---------------------------------------------------------------------- // DEPENDENCY CONSTANTS // ---------------------------------------------------------------------- - public final static int DEP_CONSTANT = 0; - public final static int DEP_UNKNOWN = 1; - public final static int DEP_GENERAL = 2; - public final static int DEP_PARAMS = 4; - public final static int DEP_STATIC = 8; + int DEP_CONSTANT = 0; + int DEP_UNKNOWN = 1; + int DEP_GENERAL = 2; + int DEP_PARAMS = 4; + int DEP_STATIC = 8; // ---------------------------------------------------------------------- // INSTRUCTION GROUPS // ---------------------------------------------------------------------- - public final static int GROUP_GENERAL = 1; - public final static int GROUP_JUMP = 2; - public final static int GROUP_SWITCH = 3; - public final static int GROUP_INVOCATION = 4; - public final static int GROUP_FIELDACCESS = 5; - public final static int GROUP_RETURN = 6; + int GROUP_GENERAL = 1; + int GROUP_JUMP = 2; + int GROUP_SWITCH = 3; + int GROUP_INVOCATION = 4; + int GROUP_FIELDACCESS = 5; + int GROUP_RETURN = 6; // ---------------------------------------------------------------------- // POOL CONSTANTS // ---------------------------------------------------------------------- - public final static int CONSTANT_Utf8 = 1; - public final static int CONSTANT_Integer = 3; - public final static int CONSTANT_Float = 4; - public final static int CONSTANT_Long = 5; - public final static int CONSTANT_Double = 6; - public final static int CONSTANT_Class = 7; - public final static int CONSTANT_String = 8; - public final static int CONSTANT_Fieldref = 9; - public final static int CONSTANT_Methodref = 10; - public final static int CONSTANT_InterfaceMethodref = 11; - public final static int CONSTANT_NameAndType = 12; - public final static int CONSTANT_MethodHandle = 15; - public final static int CONSTANT_MethodType = 16; - public final static int CONSTANT_InvokeDynamic = 18; + int CONSTANT_Utf8 = 1; + int CONSTANT_Integer = 3; + int CONSTANT_Float = 4; + int CONSTANT_Long = 5; + int CONSTANT_Double = 6; + int CONSTANT_Class = 7; + int CONSTANT_String = 8; + int CONSTANT_Fieldref = 9; + int CONSTANT_Methodref = 10; + int CONSTANT_InterfaceMethodref = 11; + int CONSTANT_NameAndType = 12; + int CONSTANT_MethodHandle = 15; + int CONSTANT_MethodType = 16; + int CONSTANT_InvokeDynamic = 18; // ---------------------------------------------------------------------- // MethodHandle reference_kind values // ---------------------------------------------------------------------- - public final static int CONSTANT_MethodHandle_REF_getField = 1; - public final static int CONSTANT_MethodHandle_REF_getStatic = 2; - public final static int CONSTANT_MethodHandle_REF_putField = 3; - public final static int CONSTANT_MethodHandle_REF_putStatic = 4; - public final static int CONSTANT_MethodHandle_REF_invokeVirtual = 5; - public final static int CONSTANT_MethodHandle_REF_invokeStatic = 6; - public final static int CONSTANT_MethodHandle_REF_invokeSpecial = 7; - public final static int CONSTANT_MethodHandle_REF_newInvokeSpecial = 8; - public final static int CONSTANT_MethodHandle_REF_invokeInterface = 9; + int CONSTANT_MethodHandle_REF_getField = 1; + int CONSTANT_MethodHandle_REF_getStatic = 2; + int CONSTANT_MethodHandle_REF_putField = 3; + int CONSTANT_MethodHandle_REF_putStatic = 4; + int CONSTANT_MethodHandle_REF_invokeVirtual = 5; + int CONSTANT_MethodHandle_REF_invokeStatic = 6; + int CONSTANT_MethodHandle_REF_invokeSpecial = 7; + int CONSTANT_MethodHandle_REF_newInvokeSpecial = 8; + int CONSTANT_MethodHandle_REF_invokeInterface = 9; // ---------------------------------------------------------------------- // VM OPCODES // ---------------------------------------------------------------------- - public final static int opc_nop = 0; - public final static int opc_aconst_null = 1; - public final static int opc_iconst_m1 = 2; - public final static int opc_iconst_0 = 3; - public final static int opc_iconst_1 = 4; - public final static int opc_iconst_2 = 5; - public final static int opc_iconst_3 = 6; - public final static int opc_iconst_4 = 7; - public final static int opc_iconst_5 = 8; - public final static int opc_lconst_0 = 9; - public final static int opc_lconst_1 = 10; - public final static int opc_fconst_0 = 11; - public final static int opc_fconst_1 = 12; - public final static int opc_fconst_2 = 13; - public final static int opc_dconst_0 = 14; - public final static int opc_dconst_1 = 15; - public final static int opc_bipush = 16; - public final static int opc_sipush = 17; - public final static int opc_ldc = 18; - public final static int opc_ldc_w = 19; - public final static int opc_ldc2_w = 20; - public final static int opc_iload = 21; - public final static int opc_lload = 22; - public final static int opc_fload = 23; - public final static int opc_dload = 24; - public final static int opc_aload = 25; - public final static int opc_iload_0 = 26; - public final static int opc_iload_1 = 27; - public final static int opc_iload_2 = 28; - public final static int opc_iload_3 = 29; - public final static int opc_lload_0 = 30; - public final static int opc_lload_1 = 31; - public final static int opc_lload_2 = 32; - public final static int opc_lload_3 = 33; - public final static int opc_fload_0 = 34; - public final static int opc_fload_1 = 35; - public final static int opc_fload_2 = 36; - public final static int opc_fload_3 = 37; - public final static int opc_dload_0 = 38; - public final static int opc_dload_1 = 39; - public final static int opc_dload_2 = 40; - public final static int opc_dload_3 = 41; - public final static int opc_aload_0 = 42; - public final static int opc_aload_1 = 43; - public final static int opc_aload_2 = 44; - public final static int opc_aload_3 = 45; - public final static int opc_iaload = 46; - public final static int opc_laload = 47; - public final static int opc_faload = 48; - public final static int opc_daload = 49; - public final static int opc_aaload = 50; - public final static int opc_baload = 51; - public final static int opc_caload = 52; - public final static int opc_saload = 53; - public final static int opc_istore = 54; - public final static int opc_lstore = 55; - public final static int opc_fstore = 56; - public final static int opc_dstore = 57; - public final static int opc_astore = 58; - public final static int opc_istore_0 = 59; - public final static int opc_istore_1 = 60; - public final static int opc_istore_2 = 61; - public final static int opc_istore_3 = 62; - public final static int opc_lstore_0 = 63; - public final static int opc_lstore_1 = 64; - public final static int opc_lstore_2 = 65; - public final static int opc_lstore_3 = 66; - public final static int opc_fstore_0 = 67; - public final static int opc_fstore_1 = 68; - public final static int opc_fstore_2 = 69; - public final static int opc_fstore_3 = 70; - public final static int opc_dstore_0 = 71; - public final static int opc_dstore_1 = 72; - public final static int opc_dstore_2 = 73; - public final static int opc_dstore_3 = 74; - public final static int opc_astore_0 = 75; - public final static int opc_astore_1 = 76; - public final static int opc_astore_2 = 77; - public final static int opc_astore_3 = 78; - public final static int opc_iastore = 79; - public final static int opc_lastore = 80; - public final static int opc_fastore = 81; - public final static int opc_dastore = 82; - public final static int opc_aastore = 83; - public final static int opc_bastore = 84; - public final static int opc_castore = 85; - public final static int opc_sastore = 86; - public final static int opc_pop = 87; - public final static int opc_pop2 = 88; - public final static int opc_dup = 89; - public final static int opc_dup_x1 = 90; - public final static int opc_dup_x2 = 91; - public final static int opc_dup2 = 92; - public final static int opc_dup2_x1 = 93; - public final static int opc_dup2_x2 = 94; - public final static int opc_swap = 95; - public final static int opc_iadd = 96; - public final static int opc_ladd = 97; - public final static int opc_fadd = 98; - public final static int opc_dadd = 99; - public final static int opc_isub = 100; - public final static int opc_lsub = 101; - public final static int opc_fsub = 102; - public final static int opc_dsub = 103; - public final static int opc_imul = 104; - public final static int opc_lmul = 105; - public final static int opc_fmul = 106; - public final static int opc_dmul = 107; - public final static int opc_idiv = 108; - public final static int opc_ldiv = 109; - public final static int opc_fdiv = 110; - public final static int opc_ddiv = 111; - public final static int opc_irem = 112; - public final static int opc_lrem = 113; - public final static int opc_frem = 114; - public final static int opc_drem = 115; - public final static int opc_ineg = 116; - public final static int opc_lneg = 117; - public final static int opc_fneg = 118; - public final static int opc_dneg = 119; - public final static int opc_ishl = 120; - public final static int opc_lshl = 121; - public final static int opc_ishr = 122; - public final static int opc_lshr = 123; - public final static int opc_iushr = 124; - public final static int opc_lushr = 125; - public final static int opc_iand = 126; - public final static int opc_land = 127; - public final static int opc_ior = 128; - public final static int opc_lor = 129; - public final static int opc_ixor = 130; - public final static int opc_lxor = 131; - public final static int opc_iinc = 132; - public final static int opc_i2l = 133; - public final static int opc_i2f = 134; - public final static int opc_i2d = 135; - public final static int opc_l2i = 136; - public final static int opc_l2f = 137; - public final static int opc_l2d = 138; - public final static int opc_f2i = 139; - public final static int opc_f2l = 140; - public final static int opc_f2d = 141; - public final static int opc_d2i = 142; - public final static int opc_d2l = 143; - public final static int opc_d2f = 144; - public final static int opc_i2b = 145; - public final static int opc_i2c = 146; - public final static int opc_i2s = 147; - public final static int opc_lcmp = 148; - public final static int opc_fcmpl = 149; - public final static int opc_fcmpg = 150; - public final static int opc_dcmpl = 151; - public final static int opc_dcmpg = 152; - public final static int opc_ifeq = 153; - public final static int opc_ifne = 154; - public final static int opc_iflt = 155; - public final static int opc_ifge = 156; - public final static int opc_ifgt = 157; - public final static int opc_ifle = 158; - public final static int opc_if_icmpeq = 159; - public final static int opc_if_icmpne = 160; - public final static int opc_if_icmplt = 161; - public final static int opc_if_icmpge = 162; - public final static int opc_if_icmpgt = 163; - public final static int opc_if_icmple = 164; - public final static int opc_if_acmpeq = 165; - public final static int opc_if_acmpne = 166; - public final static int opc_goto = 167; - public final static int opc_jsr = 168; - public final static int opc_ret = 169; - public final static int opc_tableswitch = 170; - public final static int opc_lookupswitch = 171; - public final static int opc_ireturn = 172; - public final static int opc_lreturn = 173; - public final static int opc_freturn = 174; - public final static int opc_dreturn = 175; - public final static int opc_areturn = 176; - public final static int opc_return = 177; - public final static int opc_getstatic = 178; - public final static int opc_putstatic = 179; - public final static int opc_getfield = 180; - public final static int opc_putfield = 181; - public final static int opc_invokevirtual = 182; - public final static int opc_invokespecial = 183; - public final static int opc_invokestatic = 184; - public final static int opc_invokeinterface = 185; - public final static int opc_invokedynamic = 186; - public final static int opc_xxxunusedxxx = 186; - public final static int opc_new = 187; - public final static int opc_newarray = 188; - public final static int opc_anewarray = 189; - public final static int opc_arraylength = 190; - public final static int opc_athrow = 191; - public final static int opc_checkcast = 192; - public final static int opc_instanceof = 193; - public final static int opc_monitorenter = 194; - public final static int opc_monitorexit = 195; - public final static int opc_wide = 196; - public final static int opc_multianewarray = 197; - public final static int opc_ifnull = 198; - public final static int opc_ifnonnull = 199; - public final static int opc_goto_w = 200; - public final static int opc_jsr_w = 201; + int opc_nop = 0; + int opc_aconst_null = 1; + int opc_iconst_m1 = 2; + int opc_iconst_0 = 3; + int opc_iconst_1 = 4; + int opc_iconst_2 = 5; + int opc_iconst_3 = 6; + int opc_iconst_4 = 7; + int opc_iconst_5 = 8; + int opc_lconst_0 = 9; + int opc_lconst_1 = 10; + int opc_fconst_0 = 11; + int opc_fconst_1 = 12; + int opc_fconst_2 = 13; + int opc_dconst_0 = 14; + int opc_dconst_1 = 15; + int opc_bipush = 16; + int opc_sipush = 17; + int opc_ldc = 18; + int opc_ldc_w = 19; + int opc_ldc2_w = 20; + int opc_iload = 21; + int opc_lload = 22; + int opc_fload = 23; + int opc_dload = 24; + int opc_aload = 25; + int opc_iload_0 = 26; + int opc_iload_1 = 27; + int opc_iload_2 = 28; + int opc_iload_3 = 29; + int opc_lload_0 = 30; + int opc_lload_1 = 31; + int opc_lload_2 = 32; + int opc_lload_3 = 33; + int opc_fload_0 = 34; + int opc_fload_1 = 35; + int opc_fload_2 = 36; + int opc_fload_3 = 37; + int opc_dload_0 = 38; + int opc_dload_1 = 39; + int opc_dload_2 = 40; + int opc_dload_3 = 41; + int opc_aload_0 = 42; + int opc_aload_1 = 43; + int opc_aload_2 = 44; + int opc_aload_3 = 45; + int opc_iaload = 46; + int opc_laload = 47; + int opc_faload = 48; + int opc_daload = 49; + int opc_aaload = 50; + int opc_baload = 51; + int opc_caload = 52; + int opc_saload = 53; + int opc_istore = 54; + int opc_lstore = 55; + int opc_fstore = 56; + int opc_dstore = 57; + int opc_astore = 58; + int opc_istore_0 = 59; + int opc_istore_1 = 60; + int opc_istore_2 = 61; + int opc_istore_3 = 62; + int opc_lstore_0 = 63; + int opc_lstore_1 = 64; + int opc_lstore_2 = 65; + int opc_lstore_3 = 66; + int opc_fstore_0 = 67; + int opc_fstore_1 = 68; + int opc_fstore_2 = 69; + int opc_fstore_3 = 70; + int opc_dstore_0 = 71; + int opc_dstore_1 = 72; + int opc_dstore_2 = 73; + int opc_dstore_3 = 74; + int opc_astore_0 = 75; + int opc_astore_1 = 76; + int opc_astore_2 = 77; + int opc_astore_3 = 78; + int opc_iastore = 79; + int opc_lastore = 80; + int opc_fastore = 81; + int opc_dastore = 82; + int opc_aastore = 83; + int opc_bastore = 84; + int opc_castore = 85; + int opc_sastore = 86; + int opc_pop = 87; + int opc_pop2 = 88; + int opc_dup = 89; + int opc_dup_x1 = 90; + int opc_dup_x2 = 91; + int opc_dup2 = 92; + int opc_dup2_x1 = 93; + int opc_dup2_x2 = 94; + int opc_swap = 95; + int opc_iadd = 96; + int opc_ladd = 97; + int opc_fadd = 98; + int opc_dadd = 99; + int opc_isub = 100; + int opc_lsub = 101; + int opc_fsub = 102; + int opc_dsub = 103; + int opc_imul = 104; + int opc_lmul = 105; + int opc_fmul = 106; + int opc_dmul = 107; + int opc_idiv = 108; + int opc_ldiv = 109; + int opc_fdiv = 110; + int opc_ddiv = 111; + int opc_irem = 112; + int opc_lrem = 113; + int opc_frem = 114; + int opc_drem = 115; + int opc_ineg = 116; + int opc_lneg = 117; + int opc_fneg = 118; + int opc_dneg = 119; + int opc_ishl = 120; + int opc_lshl = 121; + int opc_ishr = 122; + int opc_lshr = 123; + int opc_iushr = 124; + int opc_lushr = 125; + int opc_iand = 126; + int opc_land = 127; + int opc_ior = 128; + int opc_lor = 129; + int opc_ixor = 130; + int opc_lxor = 131; + int opc_iinc = 132; + int opc_i2l = 133; + int opc_i2f = 134; + int opc_i2d = 135; + int opc_l2i = 136; + int opc_l2f = 137; + int opc_l2d = 138; + int opc_f2i = 139; + int opc_f2l = 140; + int opc_f2d = 141; + int opc_d2i = 142; + int opc_d2l = 143; + int opc_d2f = 144; + int opc_i2b = 145; + int opc_i2c = 146; + int opc_i2s = 147; + int opc_lcmp = 148; + int opc_fcmpl = 149; + int opc_fcmpg = 150; + int opc_dcmpl = 151; + int opc_dcmpg = 152; + int opc_ifeq = 153; + int opc_ifne = 154; + int opc_iflt = 155; + int opc_ifge = 156; + int opc_ifgt = 157; + int opc_ifle = 158; + int opc_if_icmpeq = 159; + int opc_if_icmpne = 160; + int opc_if_icmplt = 161; + int opc_if_icmpge = 162; + int opc_if_icmpgt = 163; + int opc_if_icmple = 164; + int opc_if_acmpeq = 165; + int opc_if_acmpne = 166; + int opc_goto = 167; + int opc_jsr = 168; + int opc_ret = 169; + int opc_tableswitch = 170; + int opc_lookupswitch = 171; + int opc_ireturn = 172; + int opc_lreturn = 173; + int opc_freturn = 174; + int opc_dreturn = 175; + int opc_areturn = 176; + int opc_return = 177; + int opc_getstatic = 178; + int opc_putstatic = 179; + int opc_getfield = 180; + int opc_putfield = 181; + int opc_invokevirtual = 182; + int opc_invokespecial = 183; + int opc_invokestatic = 184; + int opc_invokeinterface = 185; + int opc_invokedynamic = 186; + int opc_xxxunusedxxx = 186; + int opc_new = 187; + int opc_newarray = 188; + int opc_anewarray = 189; + int opc_arraylength = 190; + int opc_athrow = 191; + int opc_checkcast = 192; + int opc_instanceof = 193; + int opc_monitorenter = 194; + int opc_monitorexit = 195; + int opc_wide = 196; + int opc_multianewarray = 197; + int opc_ifnull = 198; + int opc_ifnonnull = 199; + int opc_goto_w = 200; + int opc_jsr_w = 201; } diff --git a/src/org/jetbrains/java/decompiler/code/Instruction.java b/src/org/jetbrains/java/decompiler/code/Instruction.java index 2c0be6b..d77f3b4 100644 --- a/src/org/jetbrains/java/decompiler/code/Instruction.java +++ b/src/org/jetbrains/java/decompiler/code/Instruction.java @@ -58,7 +58,7 @@ public class Instruction implements CodeConstants { } public Instruction clone() { - return ConstantsUtil.getInstructionInstance(opcode, wide, group, bytecode_version, operands == null ? null : (int[])operands.clone()); + return ConstantsUtil.getInstructionInstance(opcode, wide, group, bytecode_version, operands == null ? null : operands.clone()); } public String toString() { diff --git a/src/org/jetbrains/java/decompiler/code/InstructionSequence.java b/src/org/jetbrains/java/decompiler/code/InstructionSequence.java index 696908c..68c2dab 100644 --- a/src/org/jetbrains/java/decompiler/code/InstructionSequence.java +++ b/src/org/jetbrains/java/decompiler/code/InstructionSequence.java @@ -74,23 +74,23 @@ public abstract class InstructionSequence { } public Instruction getCurrentInstr() { - return (Instruction)collinstr.get(pointer); + return collinstr.get(pointer); } public Instruction getInstr(int index) { - return (Instruction)collinstr.get(index); + return collinstr.get(index); } public Instruction getLastInstr() { - return (Instruction)collinstr.getLast(); + return collinstr.getLast(); } public int getCurrentOffset() { - return ((Integer)collinstr.getKey(pointer)).intValue(); + return collinstr.getKey(pointer).intValue(); } - public int getOffset(int index) { - return ((Integer)collinstr.getKey(index)).intValue(); +public int getOffset(int index) { + return collinstr.getKey(index).intValue(); } public int getPointerByAbsOffset(int offset) { @@ -104,7 +104,7 @@ public abstract class InstructionSequence { } public int getPointerByRelOffset(int offset) { - Integer absoffset = new Integer(((Integer)collinstr.getKey(pointer)).intValue() + offset); + Integer absoffset = new Integer(collinstr.getKey(pointer).intValue() + offset); if (collinstr.containsKey(absoffset)) { return collinstr.getIndexByKey(absoffset); } @@ -114,7 +114,7 @@ public abstract class InstructionSequence { } public void setPointerByAbsOffset(int offset) { - Integer absoffset = new Integer(((Integer)collinstr.getKey(pointer)).intValue() + offset); + Integer absoffset = new Integer(collinstr.getKey(pointer).intValue() + offset); if (collinstr.containsKey(absoffset)) { pointer = collinstr.getIndexByKey(absoffset); } @@ -143,10 +143,10 @@ public abstract class InstructionSequence { StringBuffer buf = new StringBuffer(); for (int i = 0; i < collinstr.size(); i++) { - buf.append(InterpreterUtil.getIndentString(indent)); - buf.append(((Integer)collinstr.getKey(i)).intValue()); + buf.append(InterpreterUtil.getIndentString(indent)); + buf.append(collinstr.getKey(i).intValue()); buf.append(": "); - buf.append(((Instruction)collinstr.get(i)).toString()); + buf.append(collinstr.get(i).toString()); buf.append(new_line_separator); } @@ -156,7 +156,7 @@ public abstract class InstructionSequence { public void writeCodeToStream(DataOutputStream out) throws IOException { for (int i = 0; i < collinstr.size(); i++) { - ((Instruction)collinstr.get(i)).writeToStream(out, ((Integer)collinstr.getKey(i)).intValue()); + collinstr.get(i).writeToStream(out, collinstr.getKey(i).intValue()); } } @@ -166,7 +166,7 @@ public abstract class InstructionSequence { out.writeShort(handlers.size()); for (int i = 0; i < handlers.size(); i++) { - ((ExceptionHandler)handlers.get(i)).writeToStream(out); + handlers.get(i).writeToStream(out); } } diff --git a/src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java b/src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java index 6b0624f..1e395ed 100644 --- a/src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java +++ b/src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java @@ -94,11 +94,11 @@ public class ControlFlowGraph implements CodeConstants { List suc = block.getSuccs(); for (int j = 0; j < suc.size(); j++) { - buf.append(">>>>>>>>(regular) Block " + ((BasicBlock)suc.get(j)).id + new_line_separator); + buf.append(">>>>>>>>(regular) Block " + suc.get(j).id + new_line_separator); } suc = block.getSuccExceptions(); for (int j = 0; j < suc.size(); j++) { - BasicBlock handler = (BasicBlock)suc.get(j); + BasicBlock handler = suc.get(j); ExceptionRangeCFG range = getExceptionRange(handler, block); if (range == null) { @@ -134,19 +134,19 @@ public class ControlFlowGraph implements CodeConstants { public void removeBlock(BasicBlock block) { while (block.getSuccs().size() > 0) { - block.removeSuccessor((BasicBlock)block.getSuccs().get(0)); + block.removeSuccessor(block.getSuccs().get(0)); } while (block.getSuccExceptions().size() > 0) { - block.removeSuccessorException((BasicBlock)block.getSuccExceptions().get(0)); + block.removeSuccessorException(block.getSuccExceptions().get(0)); } while (block.getPreds().size() > 0) { - ((BasicBlock)block.getPreds().get(0)).removeSuccessor(block); + block.getPreds().get(0).removeSuccessor(block); } while (block.getPredExceptions().size() > 0) { - ((BasicBlock)block.getPredExceptions().get(0)).removeSuccessorException(block); + block.getPredExceptions().get(0).removeSuccessorException(block); } last.removePredecessor(block); @@ -154,7 +154,7 @@ public class ControlFlowGraph implements CodeConstants { blocks.removeWithKey(block.id); for (int i = exceptions.size() - 1; i >= 0; i--) { - ExceptionRangeCFG range = (ExceptionRangeCFG)exceptions.get(i); + ExceptionRangeCFG range = exceptions.get(i); if (range.getHandler() == block) { exceptions.remove(i); } @@ -394,7 +394,7 @@ public class ControlFlowGraph implements CodeConstants { ExceptionRangeCFG range = new ExceptionRangeCFG(protectedRange, handle, handler.exceptionClass == null ? null - : Arrays.asList(new String[]{handler.exceptionClass})); + : Arrays.asList(handler.exceptionClass)); mapRanges.put(key, range); exceptions.add(range); @@ -495,11 +495,11 @@ public class ControlFlowGraph implements CodeConstants { // find the first intersection for (int i = 0; i < lstJsr.size(); i++) { - Object[] arr = (Object[])lstJsr.get(i); + Object[] arr = lstJsr.get(i); HashSet set = (HashSet)arr[1]; for (int j = i + 1; j < lstJsr.size(); j++) { - Object[] arr1 = (Object[])lstJsr.get(j); + Object[] arr1 = lstJsr.get(j); HashSet set1 = (HashSet)arr1[1]; if (!set.contains(arr1[0]) && !set1.contains(arr[0])) { // rang 0 doesn't contain entry 1 and vice versa @@ -613,11 +613,11 @@ public class ControlFlowGraph implements CodeConstants { for (int i = lst.size() - 1; i >= 0; i--) { - BasicBlock child = (BasicBlock)lst.get(i); + BasicBlock child = lst.get(i); Integer childid = child.id; if (mapNewNodes.containsKey(childid)) { - node.replaceSuccessor(child, (BasicBlock)mapNewNodes.get(childid)); + node.replaceSuccessor(child, mapNewNodes.get(childid)); } else if (common_blocks.contains(child)) { @@ -632,11 +632,11 @@ public class ControlFlowGraph implements CodeConstants { } else { for (int k = 0; k < child.getSuccs().size(); k++) { - copy.addSuccessor((BasicBlock)child.getSuccs().get(k)); + copy.addSuccessor(child.getSuccs().get(k)); } } for (int k = 0; k < child.getSuccExceptions().size(); k++) { - copy.addSuccessorException((BasicBlock)child.getSuccExceptions().get(k)); + copy.addSuccessorException(child.getSuccExceptions().get(k)); } lstNodes.add(copy); @@ -666,7 +666,7 @@ public class ControlFlowGraph implements CodeConstants { for (int i = exceptions.size() - 1; i >= 0; i--) { - ExceptionRangeCFG range = (ExceptionRangeCFG)exceptions.get(i); + ExceptionRangeCFG range = exceptions.get(i); List lstRange = range.getProtectedRange(); HashSet setBoth = new HashSet(common_blocks); @@ -678,7 +678,7 @@ public class ControlFlowGraph implements CodeConstants { if (setBoth.size() == lstRange.size()) { lstNewRange = new ArrayList(); ExceptionRangeCFG newRange = new ExceptionRangeCFG(lstNewRange, - (BasicBlock)mapNewNodes.get(range.getHandler().id), range.getExceptionTypes()); + mapNewNodes.get(range.getHandler().id), range.getExceptionTypes()); exceptions.add(newRange); } else { @@ -729,14 +729,14 @@ public class ControlFlowGraph implements CodeConstants { block.mark = 1; for (int i = 0; i < block.getSuccs().size(); i++) { - BasicBlock suc = (BasicBlock)block.getSuccs().get(i); + BasicBlock suc = block.getSuccs().get(i); if (suc.mark != 1) { removeJsrInstructions(pool, suc, data.copy()); } } for (int i = 0; i < block.getSuccExceptions().size(); i++) { - BasicBlock suc = (BasicBlock)block.getSuccExceptions().get(i); + BasicBlock suc = block.getSuccExceptions().get(i); if (suc.mark != 1) { DataPoint point = new DataPoint(); diff --git a/src/org/jetbrains/java/decompiler/code/interpreter/InstructionImpact.java b/src/org/jetbrains/java/decompiler/code/interpreter/InstructionImpact.java index a3da8a6..1af23a4 100644 --- a/src/org/jetbrains/java/decompiler/code/interpreter/InstructionImpact.java +++ b/src/org/jetbrains/java/decompiler/code/interpreter/InstructionImpact.java @@ -432,7 +432,7 @@ public class InstructionImpact { stack.push(new VarType(var1.type, var1.arraydim - 1, var1.value)); break; case CodeConstants.opc_astore: - data.setVariable(instr.getOperand(0), (VarType)stack.pop()); + data.setVariable(instr.getOperand(0), stack.pop()); break; case CodeConstants.opc_dup: case CodeConstants.opc_dup_x1: diff --git a/src/org/jetbrains/java/decompiler/main/ClassReference14Processor.java b/src/org/jetbrains/java/decompiler/main/ClassReference14Processor.java index 411789c..060497a 100644 --- a/src/org/jetbrains/java/decompiler/main/ClassReference14Processor.java +++ b/src/org/jetbrains/java/decompiler/main/ClassReference14Processor.java @@ -225,7 +225,7 @@ public class ClassReference14Processor { boolean res = false; - for (; ; ) { + while (true) { boolean found = false; diff --git a/src/org/jetbrains/java/decompiler/main/ClassWriter.java b/src/org/jetbrains/java/decompiler/main/ClassWriter.java index 3c8afab..7808b26 100644 --- a/src/org/jetbrains/java/decompiler/main/ClassWriter.java +++ b/src/org/jetbrains/java/decompiler/main/ClassWriter.java @@ -159,7 +159,6 @@ public class ClassWriter { boolean firstpar = true; int index = node.lambda_information.is_content_method_static ? 0 : 1; - ; int start_index = md_content.params.length - md_lambda.params.length; @@ -625,7 +624,6 @@ public class ClassWriter { boolean firstpar = true; int index = node_lambda.lambda_information.is_content_method_static ? 0 : 1; - ; int start_index = md_content.params.length - md_lambda.params.length; diff --git a/src/org/jetbrains/java/decompiler/main/Fernflower.java b/src/org/jetbrains/java/decompiler/main/Fernflower.java index 4365ca1..bc0fcd4 100644 --- a/src/org/jetbrains/java/decompiler/main/Fernflower.java +++ b/src/org/jetbrains/java/decompiler/main/Fernflower.java @@ -39,12 +39,9 @@ public class Fernflower implements IDecompiledData { private ClassesProcessor clprocessor; - public Fernflower(IBytecodeProvider provider, IDecompilatSaver saver, - HashMap propertiesCustom) { + public Fernflower(IBytecodeProvider provider, IDecompilatSaver saver, HashMap propertiesCustom) { - StructContext context = new StructContext(saver, this, new LazyLoader(provider)); - - structcontext = context; + structcontext = new StructContext(saver, this, new LazyLoader(provider)); DecompilerContext.initContext(propertiesCustom); DecompilerContext.setCountercontainer(new CounterContainer()); diff --git a/src/org/jetbrains/java/decompiler/main/InitializerProcessor.java b/src/org/jetbrains/java/decompiler/main/InitializerProcessor.java index c738163..e401adc 100644 --- a/src/org/jetbrains/java/decompiler/main/InitializerProcessor.java +++ b/src/org/jetbrains/java/decompiler/main/InitializerProcessor.java @@ -191,7 +191,7 @@ public class InitializerProcessor { return; } - for (; ; ) { + while (true) { String fieldWithDescr = null; Exprent value = null; diff --git a/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java b/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java index 995f8c2..0a8261f 100644 --- a/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java +++ b/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java @@ -31,7 +31,7 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipOutputStream; - +@SuppressWarnings({"UseOfSystemOutOrSystemErr", "CallToPrintStackTrace"}) public class ConsoleDecompiler implements IBytecodeProvider, IDecompilatSaver { private File root; diff --git a/src/org/jetbrains/java/decompiler/main/extern/IBytecodeProvider.java b/src/org/jetbrains/java/decompiler/main/extern/IBytecodeProvider.java index 7ff43fc..8fe0b31 100644 --- a/src/org/jetbrains/java/decompiler/main/extern/IBytecodeProvider.java +++ b/src/org/jetbrains/java/decompiler/main/extern/IBytecodeProvider.java @@ -19,5 +19,5 @@ import java.io.InputStream; public interface IBytecodeProvider { - public InputStream getBytecodeStream(String externPath, String internPath); + InputStream getBytecodeStream(String externPath, String internPath); } diff --git a/src/org/jetbrains/java/decompiler/main/extern/IDecompilatSaver.java b/src/org/jetbrains/java/decompiler/main/extern/IDecompilatSaver.java index 0270b5e..9cbac0c 100644 --- a/src/org/jetbrains/java/decompiler/main/extern/IDecompilatSaver.java +++ b/src/org/jetbrains/java/decompiler/main/extern/IDecompilatSaver.java @@ -19,21 +19,21 @@ import java.util.jar.Manifest; public interface IDecompilatSaver { - public void copyFile(String source, String destpath, String destfilename); + void copyFile(String source, String destpath, String destfilename); - public void saveFolder(String path); + void saveFolder(String path); - public void saveClassFile(String path, String qualifiedName, String entryName, String content); + void saveClassFile(String path, String qualifiedName, String entryName, String content); - public void saveFile(String path, String filename, String content); + void saveFile(String path, String filename, String content); - public void createArchive(String path, String archivename, Manifest manifest); + void createArchive(String path, String archivename, Manifest manifest); - public void saveClassEntry(String path, String archivename, String qualifiedName, String entryName, String content); + void saveClassEntry(String path, String archivename, String qualifiedName, String entryName, String content); - public void saveEntry(String path, String archivename, String entryName, String content); + void saveEntry(String path, String archivename, String entryName, String content); - public void copyEntry(String source, String destpath, String archivename, String entry); + void copyEntry(String source, String destpath, String archivename, String entry); - public void closeArchive(String path, String archivename); + void closeArchive(String path, String archivename); } diff --git a/src/org/jetbrains/java/decompiler/main/extern/IFernflowerLogger.java b/src/org/jetbrains/java/decompiler/main/extern/IFernflowerLogger.java index c80039d..d9c8f74 100644 --- a/src/org/jetbrains/java/decompiler/main/extern/IFernflowerLogger.java +++ b/src/org/jetbrains/java/decompiler/main/extern/IFernflowerLogger.java @@ -19,13 +19,13 @@ import java.util.HashMap; public interface IFernflowerLogger { - public static final int TRACE = 1; - public static final int INFO = 2; - public static final int WARNING = 3; - public static final int ERROR = 4; - public static final int IMMEDIATE = 5; + int TRACE = 1; + int INFO = 2; + int WARNING = 3; + int ERROR = 4; + int IMMEDIATE = 5; - public static final HashMap mapLogLevel = new HashMap() {{ + HashMap mapLogLevel = new HashMap() {{ put("TRACE", 1); put("INFO", 2); put("WARN", 3); @@ -33,25 +33,25 @@ public interface IFernflowerLogger { put("IMME", 5); }}; - public static final String[] names = new String[]{""/*DUMMY ENTRY*/, "TRACE", "INFO", "WARNING", "ERROR", ""/*IMMEDIATE*/}; + String[] names = new String[]{""/*DUMMY ENTRY*/, "TRACE", "INFO", "WARNING", "ERROR", ""/*IMMEDIATE*/}; - public void writeMessage(String message, int severity); + void writeMessage(String message, int severity); - public void writeMessage(String message, Throwable t); + void writeMessage(String message, Throwable t); - public void startClass(String classname); + void startClass(String classname); - public void endClass(); + void endClass(); - public void startWriteClass(String classname); + void startWriteClass(String classname); - public void endWriteClass(); + void endWriteClass(); - public void startMethod(String method); + void startMethod(String method); - public void endMethod(); + void endMethod(); - public int getSeverity(); + int getSeverity(); - public void setSeverity(int severity); + void setSeverity(int severity); } diff --git a/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java b/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java index 2fcc5e1..867bff2 100644 --- a/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java +++ b/src/org/jetbrains/java/decompiler/main/extern/IFernflowerPreferences.java @@ -17,42 +17,42 @@ package org.jetbrains.java.decompiler.main.extern; public interface IFernflowerPreferences { - public static final String REMOVE_BRIDGE = "rbr"; - public static final String REMOVE_SYNTHETIC = "rsy"; - public static final String DECOMPILE_INNER = "din"; - public static final String DECOMPILE_CLASS_1_4 = "dc4"; - public static final String DECOMPILE_ASSERTIONS = "das"; - public static final String HIDE_EMPTY_SUPER = "hes"; - public static final String HIDE_DEFAULT_CONSTRUCTOR = "hdc"; - public static final String DECOMPILE_GENERIC_SIGNATURES = "dgs"; - public static final String OUTPUT_COPYRIGHT_COMMENT = "occ"; - public static final String NO_EXCEPTIONS_RETURN = "ner"; - public static final String DECOMPILE_ENUM = "den"; - public static final String REMOVE_GETCLASS_NEW = "rgn"; - public static final String LITERALS_AS_IS = "lit"; - public static final String BOOLEAN_TRUE_ONE = "bto"; - public static final String SYNTHETIC_NOT_SET = "nns"; - public static final String UNDEFINED_PARAM_TYPE_OBJECT = "uto"; - public static final String USE_DEBUG_VARNAMES = "udv"; - public static final String MAX_PROCESSING_METHOD = "mpm"; - public static final String REMOVE_EMPTY_RANGES = "rer"; - public static final String ASCII_STRING_CHARACTERS = "asc"; + String REMOVE_BRIDGE = "rbr"; + String REMOVE_SYNTHETIC = "rsy"; + String DECOMPILE_INNER = "din"; + String DECOMPILE_CLASS_1_4 = "dc4"; + String DECOMPILE_ASSERTIONS = "das"; + String HIDE_EMPTY_SUPER = "hes"; + String HIDE_DEFAULT_CONSTRUCTOR = "hdc"; + String DECOMPILE_GENERIC_SIGNATURES = "dgs"; + String OUTPUT_COPYRIGHT_COMMENT = "occ"; + String NO_EXCEPTIONS_RETURN = "ner"; + String DECOMPILE_ENUM = "den"; + String REMOVE_GETCLASS_NEW = "rgn"; + String LITERALS_AS_IS = "lit"; + String BOOLEAN_TRUE_ONE = "bto"; + String SYNTHETIC_NOT_SET = "nns"; + String UNDEFINED_PARAM_TYPE_OBJECT = "uto"; + String USE_DEBUG_VARNAMES = "udv"; + String MAX_PROCESSING_METHOD = "mpm"; + String REMOVE_EMPTY_RANGES = "rer"; + String ASCII_STRING_CHARACTERS = "asc"; - public static final String FINALLY_DEINLINE = "fdi"; + String FINALLY_DEINLINE = "fdi"; - public static final String FINALLY_CATCHALL = "FINALLY_CATCHALL"; - public static final String FINALLY_SEMAPHOR = "FINALLY_SEMAPHOR"; + String FINALLY_CATCHALL = "FINALLY_CATCHALL"; + String FINALLY_SEMAPHOR = "FINALLY_SEMAPHOR"; - public static final String RENAME_ENTITIES = "ren"; - public static final String USER_RENAMER_CLASS = "urc"; + String RENAME_ENTITIES = "ren"; + String USER_RENAMER_CLASS = "urc"; - public static final String LOG_LEVEL = "log"; + String LOG_LEVEL = "log"; - public static final String NEW_LINE_SEPARATOR = "nls"; - public static final String IDEA_NOT_NULL_ANNOTATION = "inn"; - public static final String LAMBDA_TO_ANONYMOUS_CLASS = "lac"; - public static final String INDENT_STRING = "ind"; + String NEW_LINE_SEPARATOR = "nls"; + String IDEA_NOT_NULL_ANNOTATION = "inn"; + String LAMBDA_TO_ANONYMOUS_CLASS = "lac"; + String INDENT_STRING = "ind"; - public static final String LINE_SEPARATOR_WIN = "\r\n"; - public static final String LINE_SEPARATOR_LIN = "\n"; + String LINE_SEPARATOR_WIN = "\r\n"; + String LINE_SEPARATOR_LIN = "\n"; } diff --git a/src/org/jetbrains/java/decompiler/main/extern/IIdentifierRenamer.java b/src/org/jetbrains/java/decompiler/main/extern/IIdentifierRenamer.java index 88b1ca4..fc0971e 100644 --- a/src/org/jetbrains/java/decompiler/main/extern/IIdentifierRenamer.java +++ b/src/org/jetbrains/java/decompiler/main/extern/IIdentifierRenamer.java @@ -18,18 +18,18 @@ package org.jetbrains.java.decompiler.main.extern; public interface IIdentifierRenamer { - public static final int ELEMENT_CLASS = 1; + int ELEMENT_CLASS = 1; - public static final int ELEMENT_FIELD = 2; + int ELEMENT_FIELD = 2; - public static final int ELEMENT_METHOD = 3; + int ELEMENT_METHOD = 3; - public boolean toBeRenamed(int element_type, String classname, String element, String descriptor); + boolean toBeRenamed(int element_type, String classname, String element, String descriptor); - public String getNextClassname(String fullname, String shortname); + String getNextClassname(String fullname, String shortname); - public String getNextFieldname(String classname, String field, String descriptor); + String getNextFieldname(String classname, String field, String descriptor); - public String getNextMethodname(String classname, String method, String descriptor); + String getNextMethodname(String classname, String method, String descriptor); } diff --git a/src/org/jetbrains/java/decompiler/main/rels/MethodProcessorThread.java b/src/org/jetbrains/java/decompiler/main/rels/MethodProcessorThread.java index 038e057..eeee352 100644 --- a/src/org/jetbrains/java/decompiler/main/rels/MethodProcessorThread.java +++ b/src/org/jetbrains/java/decompiler/main/rels/MethodProcessorThread.java @@ -62,9 +62,7 @@ public class MethodProcessorThread implements Runnable { this.notify(); } } - catch (ThreadDeath ex) { - ; - } + catch (ThreadDeath ignored) { } catch (Throwable ex) { error = ex; } @@ -169,7 +167,7 @@ public class MethodProcessorThread implements Runnable { //System.out.println("~~~~~~~~~~~~~~~~~~~~~~ \r\n"+root.toJava()); - for (; ; ) { + while (true) { StackVarsProcessor stackproc = new StackVarsProcessor(); stackproc.simplifyStackVars(root, mt, cl); @@ -184,11 +182,11 @@ public class MethodProcessorThread implements Runnable { } } - for (; ; ) { + while (true) { LabelHelper.cleanUpEdges(root); - for (; ; ) { + while (true) { MergeHelper.enhanceLoops(root); diff --git a/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java b/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java index 9dba114..6cd2204 100644 --- a/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java +++ b/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java @@ -151,7 +151,6 @@ public class NestedClassProcessor { InvocationExprent inv_dynamic = new_expr.getConstructor(); int param_index = is_static_lambda_content ? 0 : 1; - ; int varindex = is_static_lambda_content ? 0 : 1; for (int i = 0; i < vars_count; ++i) { @@ -713,7 +712,7 @@ public class NestedClassProcessor { private void mergeListSignatures(List first, List second, boolean both) { int i = 1; - for (; ; ) { + while (true) { if (first.size() <= i || second.size() <= i) { break; } diff --git a/src/org/jetbrains/java/decompiler/main/rels/NestedMemberAccess.java b/src/org/jetbrains/java/decompiler/main/rels/NestedMemberAccess.java index e81a69e..d8c67ac 100644 --- a/src/org/jetbrains/java/decompiler/main/rels/NestedMemberAccess.java +++ b/src/org/jetbrains/java/decompiler/main/rels/NestedMemberAccess.java @@ -286,7 +286,7 @@ public class NestedMemberAccess { res |= replaceInvocations(caller, meth, expr); } - for (; ; ) { + while (true) { boolean found = false; @@ -397,10 +397,10 @@ public class NestedMemberAccess { AssignmentExprent ret; if (source.type == Exprent.EXPRENT_EXIT) { ExitExprent extex = (ExitExprent)source; - ret = (AssignmentExprent)((AssignmentExprent)extex.getValue()).copy(); + ret = (AssignmentExprent)extex.getValue().copy(); } else { - ret = (AssignmentExprent)((AssignmentExprent)source).copy(); + ret = (AssignmentExprent)source.copy(); } FieldExprent fexpr = (FieldExprent)ret.getLeft(); diff --git a/src/org/jetbrains/java/decompiler/modules/code/DeadCodeHelper.java b/src/org/jetbrains/java/decompiler/modules/code/DeadCodeHelper.java index 386f6ae..e8377ae 100644 --- a/src/org/jetbrains/java/decompiler/modules/code/DeadCodeHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/code/DeadCodeHelper.java @@ -70,7 +70,7 @@ public class DeadCodeHelper { cont = false; for (int i = blocks.size() - 1; i >= 0; i--) { - BasicBlock block = (BasicBlock)blocks.get(i); + BasicBlock block = blocks.get(i); if (removeEmptyBlock(graph, block, false)) { cont = true; @@ -197,7 +197,7 @@ public class DeadCodeHelper { graph.removeBlock(block); if (deletedRanges) { - DeadCodeHelper.removeDeadBlocks(graph); + removeDeadBlocks(graph); } } } @@ -219,7 +219,7 @@ public class DeadCodeHelper { while (!lstNodes.isEmpty()) { - BasicBlock node = (BasicBlock)lstNodes.remove(0); + BasicBlock node = lstNodes.remove(0); if (marked.contains(node)) { continue; } @@ -232,14 +232,14 @@ public class DeadCodeHelper { } for (int i = 0; i < node.getPreds().size(); i++) { - BasicBlock pred = (BasicBlock)node.getPreds().get(i); + BasicBlock pred = node.getPreds().get(i); if (!marked.contains(pred) && pred != dom) { lstNodes.add(pred); } } for (int i = 0; i < node.getPredExceptions().size(); i++) { - BasicBlock pred = (BasicBlock)node.getPredExceptions().get(i); + BasicBlock pred = node.getPredExceptions().get(i); if (!marked.contains(pred) && pred != dom) { lstNodes.add(pred); } @@ -259,7 +259,7 @@ public class DeadCodeHelper { } } - DeadCodeHelper.removeEmptyBlocks(graph); + removeEmptyBlocks(graph); } public static void connectDummyExitBlock(ControlFlowGraph graph) { @@ -392,7 +392,7 @@ public class DeadCodeHelper { public static void mergeBasicBlocks(ControlFlowGraph graph) { - for (; ; ) { + while (true) { boolean merged = false; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/ConcatenationHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/ConcatenationHelper.java index db67902..1b641a6 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/ConcatenationHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/ConcatenationHelper.java @@ -62,7 +62,7 @@ public class ConcatenationHelper { // iterate in depth, collecting possible operands List lstOperands = new ArrayList(); - for (; ; ) { + while (true) { int found = 0; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/DecHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/DecHelper.java index ec1fada..50b6673 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/DecHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/DecHelper.java @@ -76,7 +76,7 @@ public class DecHelper { return false; } - for (; ; ) { + while (true) { lst.clear(); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/DomHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/DomHelper.java index 79bea88..2b911e7 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/DomHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/DomHelper.java @@ -254,7 +254,7 @@ public class DomHelper { if (stat.type == Statement.TYPE_SEQUENCE) { - for (; ; ) { + while (true) { boolean found = false; @@ -371,7 +371,7 @@ public class DomHelper { boolean forceall = i != 0; - for (; ; ) { + while (true) { if (findSimpleStatements(general, mapExtPost)) { reducibility = 0; @@ -494,7 +494,7 @@ public class DomHelper { // collect statement nodes HashSet setHandlers = new HashSet(); setHandlers.add(head); - for (; ; ) { + while (true) { boolean hdfound = false; Iterator itHandlers = setHandlers.iterator(); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/ExitHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/ExitHelper.java index cddbc21..2eddd57 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/ExitHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/ExitHelper.java @@ -91,7 +91,7 @@ public class ExitHelper { if (stat.getExprents() == null) { - for (; ; ) { + while (true) { int changed = 0; @@ -160,7 +160,7 @@ public class ExitHelper { bstat.addSuccessor(newexitedge); oldexitedge.closure.addLabeledEdge(newexitedge); - SequenceStatement block = new SequenceStatement(Arrays.asList(new Statement[]{stat, bstat})); + SequenceStatement block = new SequenceStatement(Arrays.asList(stat, bstat)); block.setAllParent(); parent.replaceStatement(stat, block); @@ -324,7 +324,7 @@ public class ExitHelper { bstat.setExprents(new ArrayList(Arrays.asList(new Exprent[]{retexpr}))); // build sequence to replace the former top statement - SequenceStatement seq = new SequenceStatement(Arrays.asList(new Statement[]{top, bstat})); + SequenceStatement seq = new SequenceStatement(Arrays.asList(top, bstat)); top.setParent(seq); bstat.setParent(seq); seq.setParent(root); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java index 3b35d36..1612d32 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java @@ -706,7 +706,7 @@ public class ExprProcessor implements CodeConstants { return "void"; } else if (tp == CodeConstants.TYPE_OBJECT) { - String ret = ExprProcessor.buildJavaClassName(type.value); + String ret = buildJavaClassName(type.value); if (getShort) { ret = DecompilerContext.getImpcollector().getShortName(ret); } @@ -761,7 +761,7 @@ public class ExprProcessor implements CodeConstants { List lstSuccs = stat.getSuccessorEdges(Statement.STATEDGE_DIRECT_ALL); if (lstSuccs.size() == 1) { StatEdge edge = lstSuccs.get(0); - if (edge.getType() != StatEdge.TYPE_REGULAR && edge.explicit == true && edge.getDestination().type != Statement.TYPE_DUMMYEXIT) { + if (edge.getType() != StatEdge.TYPE_REGULAR && edge.explicit && edge.getDestination().type != Statement.TYPE_DUMMYEXIT) { buf.append(InterpreterUtil.getIndentString(indent)); switch (edge.getType()) { @@ -820,7 +820,7 @@ public class ExprProcessor implements CodeConstants { if (expr.type == Exprent.EXPRENT_MONITOR && ((MonitorExprent)expr).getMontype() == MonitorExprent.MONITOR_ENTER) { buf.append("{}"); // empty synchronized block } - if (ExprProcessor.endsWithSemikolon(expr)) { + if (endsWithSemikolon(expr)) { buf.append(";"); } buf.append(new_line_separator); @@ -885,7 +885,7 @@ public class ExprProcessor implements CodeConstants { res = "(" + res + ")"; } - res = "(" + ExprProcessor.getCastTypeName(leftType) + ")" + res; + res = "(" + getCastTypeName(leftType) + ")" + res; ret = true; } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/ExprentStack.java b/src/org/jetbrains/java/decompiler/modules/decompiler/ExprentStack.java index dafc655..c4cded2 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/ExprentStack.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/ExprentStack.java @@ -36,9 +36,7 @@ public class ExprentStack extends ListStack { public Exprent pop() { - Exprent o = this.remove(--pointer); - - return o; + return this.remove(--pointer); } public ExprentStack clone() { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java index a56c0f2..103b933 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java @@ -81,7 +81,7 @@ public class FinallyProcessor { BasicBlock handler = fin.getHandler().getBasichead().getBlock(); if (catchallBlockIDs.containsKey(handler.id)) { - ; // do nothing + // do nothing } else if (finallyBlockIDs.containsKey(handler.id)) { @@ -465,8 +465,6 @@ public class FinallyProcessor { range.getProtectedRange().remove(newheadinit); } } - - return; } @@ -677,7 +675,7 @@ public class FinallyProcessor { // exception successors if (isLastBlock && blockSample.getSeq().isEmpty()) { - ; // do nothing, blockSample will be removed anyway + // do nothing, blockSample will be removed anyway } else { if (blockCatch.getSuccExceptions().size() == blockSample.getSuccExceptions().size()) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/IdeaNotNullHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/IdeaNotNullHelper.java index 0af6de0..9934298 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/IdeaNotNullHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/IdeaNotNullHelper.java @@ -78,7 +78,7 @@ public class IdeaNotNullHelper { Exprent second_param = func.getLstOperands().get(1); if (second_param.type == Exprent.EXPRENT_CONST && - ((ConstExprent)second_param).getExprType().type == CodeConstants.TYPE_NULL) { // TODO: reversed parameter order + second_param.getExprType().type == CodeConstants.TYPE_NULL) { // TODO: reversed parameter order if (first_param.type == Exprent.EXPRENT_VAR) { VarExprent var = (VarExprent)first_param; @@ -227,7 +227,7 @@ public class IdeaNotNullHelper { Statement elsebranch = ifparent.getElsestat(); if (second_param.type == Exprent.EXPRENT_CONST && - ((ConstExprent)second_param).getExprType().type == CodeConstants.TYPE_NULL) { // TODO: reversed parameter order + second_param.getExprType().type == CodeConstants.TYPE_NULL) { // TODO: reversed parameter order //if(first_param.type == Exprent.EXPRENT_VAR && ((VarExprent)first_param).getIndex() == var_value.getIndex()) { if (first_param.equals(exprent_value)) { // TODO: check for absence of side effects like method invocations etc. if (ifbranch.type == Statement.TYPE_BASICBLOCK && @@ -291,7 +291,7 @@ public class IdeaNotNullHelper { Statement ifbranch = ifstat.getIfstat(); if (second_param.type == Exprent.EXPRENT_CONST && - ((ConstExprent)second_param).getExprType().type == CodeConstants.TYPE_NULL) { // TODO: reversed parameter order + second_param.getExprType().type == CodeConstants.TYPE_NULL) { // TODO: reversed parameter order if (first_param.equals(exprent_value)) { // TODO: check for absence of side effects like method invocations etc. if (ifbranch.type == Statement.TYPE_BASICBLOCK && ifbranch.getExprents().size() == 1 && diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java index d5f4c9c..b1a955c 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java @@ -50,7 +50,7 @@ public class IfHelper { if (stat.getExprents() == null) { - for (; ; ) { + while (true) { boolean changed = false; @@ -59,7 +59,7 @@ public class IfHelper { res |= mergeAllIfsRec(st, setReorderedIfs); // collapse composed if's - if (changed = IfHelper.mergeIfs(st, setReorderedIfs)) { + if (changed = mergeIfs(st, setReorderedIfs)) { break; } } @@ -84,7 +84,7 @@ public class IfHelper { boolean res = false; - for (; ; ) { + while (true) { boolean updated = false; @@ -442,7 +442,6 @@ public class IfHelper { } boolean ifdirect = false, elsedirect = false; - ; boolean noifstat = false, noelsestat = false; boolean ifdirectpath = false, elsedirectpath = false; @@ -471,7 +470,7 @@ public class IfHelper { } } - Statement last = parent.type == Statement.TYPE_SEQUENCE ? ((SequenceStatement)parent).getStats().getLast() : ifstat; + Statement last = parent.type == Statement.TYPE_SEQUENCE ? parent.getStats().getLast() : ifstat; noelsestat = (last == ifstat); if (!last.getAllSuccessorEdges().isEmpty() && last.getAllSuccessorEdges().get(0).getType() == StatEdge.TYPE_FINALLYEXIT) { @@ -575,7 +574,7 @@ public class IfHelper { } else { Statement ifbranch = ifstat.getIfstat(); - SequenceStatement newseq = new SequenceStatement(Arrays.asList(new Statement[]{ifstat, ifbranch})); + SequenceStatement newseq = new SequenceStatement(Arrays.asList(ifstat, ifbranch)); ifstat.getFirst().removeSuccessor(ifedge); ifstat.getStats().removeWithKey(ifbranch.id); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/InlineSingleBlockHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/InlineSingleBlockHelper.java index b9ffb8f..adeda02 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/InlineSingleBlockHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/InlineSingleBlockHelper.java @@ -155,7 +155,7 @@ public class InlineSingleBlockHelper { Statement from = edge.getSource(); Statement to = edge.getDestination(); - for (; ; ) { + while (true) { Statement parent = from.getParent(); if (parent.containsStatementStrict(to)) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/LabelHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/LabelHelper.java index 2e00d5b..00da7ac 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/LabelHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/LabelHelper.java @@ -65,7 +65,7 @@ public class LabelHelper { List lst = new ArrayList(); if (parent.type == Statement.TYPE_SEQUENCE) { - lst.addAll(((SequenceStatement)parent).getStats()); + lst.addAll(parent.getStats()); } else if (parent.type == Statement.TYPE_SWITCH) { lst.addAll(((SwitchStatement)parent).getCaseStatements()); @@ -489,7 +489,7 @@ public class LabelHelper { private static Statement getMinContinueClosure(StatEdge edge) { Statement closure = edge.closure; - for (; ; ) { + while (true) { boolean found = false; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/LoopExtractHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/LoopExtractHelper.java index 180f162..d5c9e8f 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/LoopExtractHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/LoopExtractHelper.java @@ -44,7 +44,7 @@ public class LoopExtractHelper { boolean res = false; - for (; ; ) { + while (true) { boolean updated = false; @@ -183,7 +183,7 @@ public class LoopExtractHelper { loop.addLabeledEdge(ifedge); - SequenceStatement block = new SequenceStatement(Arrays.asList(new Statement[]{loop, target})); + SequenceStatement block = new SequenceStatement(Arrays.asList(loop, target)); loop.getParent().replaceStatement(loop, block); block.setAllParent(); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/LowBreakHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/LowBreakHelper.java index dcd501a..67e9248 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/LowBreakHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/LowBreakHelper.java @@ -32,7 +32,7 @@ public class LowBreakHelper { private static void lowBreakLabelsRec(Statement stat) { - for (; ; ) { + while (true) { boolean found = false; @@ -79,7 +79,7 @@ public class LowBreakHelper { public static Statement getMinClosure(Statement closure, Statement source) { - for (; ; ) { + while (true) { Statement newclosure = null; @@ -152,7 +152,7 @@ public class LowBreakHelper { } - for (; ; ) { + while (true) { boolean found = false; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/MergeHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/MergeHelper.java index 4ce408b..2d2f8b5 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/MergeHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/MergeHelper.java @@ -323,7 +323,7 @@ public class MergeHelper { // search for an initializing exprent Statement current = stat; - for (; ; ) { + while (true) { Statement parent = current.getParent(); if (parent == null) { break; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/SequenceHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/SequenceHelper.java index aa69931..6ffa709 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/SequenceHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/SequenceHelper.java @@ -142,7 +142,7 @@ public class SequenceHelper { // replace flat statements with synthetic basic blocks outer: - for (; ; ) { + while (true) { for (Statement st : stat.getStats()) { if ((st.getStats().isEmpty() || st.getExprents() != null) && st.type != Statement.TYPE_BASICBLOCK) { destroyAndFlattenStatement(st); @@ -185,7 +185,7 @@ public class SequenceHelper { mergeFlatStatements(sequence); - for (; ; ) { + while (true) { boolean found = false; @@ -242,7 +242,7 @@ public class SequenceHelper { private static void mergeFlatStatements(SequenceStatement sequence) { - for (; ; ) { + while (true) { Statement next = null; Statement current = null; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/SimplifyExprentsHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/SimplifyExprentsHelper.java index a7d5702..362a1e3 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/SimplifyExprentsHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/SimplifyExprentsHelper.java @@ -45,7 +45,7 @@ public class SimplifyExprentsHelper { if (stat.getExprents() == null) { - for (; ; ) { + while (true) { boolean changed = false; @@ -402,7 +402,7 @@ public class SimplifyExprentsHelper { AssignmentExprent asf = (AssignmentExprent)first; AssignmentExprent ass = (AssignmentExprent)second; - for (; ; ) { + while (true) { if (asf.getRight().equals(ass.getRight())) { if ((asf.getLeft().type == Exprent.EXPRENT_VAR && ((VarExprent)asf.getLeft()).isStack()) && (ass.getLeft().type != Exprent.EXPRENT_VAR || !((VarExprent)ass.getLeft()).isStack())) { @@ -789,7 +789,7 @@ public class SimplifyExprentsHelper { data.add(new AssignmentExprent(ifvar, new FunctionExprent(FunctionExprent.FUNCTION_IIF, Arrays.asList(new Exprent[]{ - ((IfExprent)stif.getHeadexprent()).getCondition(), + stif.getHeadexprent().getCondition(), ifas.getRight(), elseas.getRight()})))); stif.setExprents(data); @@ -830,7 +830,7 @@ public class SimplifyExprentsHelper { data.add(new ExitExprent(ifex.getExittype(), new FunctionExprent(FunctionExprent.FUNCTION_IIF, Arrays.asList(new Exprent[]{ - ((IfExprent)stif.getHeadexprent()).getCondition(), + stif.getHeadexprent().getCondition(), ifex.getValue(), elseex.getValue()})), ifex.getRettype())); stif.setExprents(data); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/StackVarsProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/StackVarsProcessor.java index d0f3f03..e72c646 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/StackVarsProcessor.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/StackVarsProcessor.java @@ -43,7 +43,7 @@ public class StackVarsProcessor { SSAUConstructorSparseEx ssau = null; - for (; ; ) { + while (true) { boolean found = false; @@ -287,7 +287,7 @@ public class StackVarsProcessor { int changed = 0; for (Exprent expr : exprent.getAllExprents()) { - for (; ; ) { + while (true) { Object[] arr = iterateChildExprent(expr, exprent, next, mapVarValues, ssau); Exprent retexpr = (Exprent)arr[0]; changed |= (Boolean)arr[1] ? 1 : 0; @@ -464,7 +464,7 @@ public class StackVarsProcessor { boolean changed = false; for (Exprent expr : exprent.getAllExprents()) { - for (; ; ) { + while (true) { Object[] arr = iterateChildExprent(expr, parent, next, mapVarValues, ssau); Exprent retexpr = (Exprent)arr[0]; changed |= (Boolean)arr[1]; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DominatorEngine.java b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DominatorEngine.java index b79c864..0980bee 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DominatorEngine.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DominatorEngine.java @@ -78,7 +78,7 @@ public class DominatorEngine { // exclude first statement List lstIds = colOrderedIDoms.getLstKeys().subList(1, colOrderedIDoms.getLstKeys().size()); - for (; ; ) { + while (true) { boolean changed = false; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/FastExtendedPostdominanceHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/FastExtendedPostdominanceHelper.java index daa898a..f029016 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/FastExtendedPostdominanceHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/FastExtendedPostdominanceHelper.java @@ -286,7 +286,7 @@ public class FastExtendedPostdominanceHelper { private void iterateReachability(IReachabilityAction action, int edgetype) { - for (; ; ) { + while (true) { boolean iterate = false; @@ -350,6 +350,6 @@ public class FastExtendedPostdominanceHelper { private interface IReachabilityAction { - public boolean action(Statement node, HashMap> mapSets); + boolean action(Statement node, HashMap> mapSets); } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/GenericDominatorEngine.java b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/GenericDominatorEngine.java index 2eca3b7..f77e950 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/GenericDominatorEngine.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/GenericDominatorEngine.java @@ -91,7 +91,7 @@ public class GenericDominatorEngine { List lstNodes = colOrderedIDoms.getLstKeys(); - for (; ; ) { + while (true) { boolean changed = false; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/IGraph.java b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/IGraph.java index 9179f9c..faaf4c6 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/IGraph.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/IGraph.java @@ -20,7 +20,7 @@ import java.util.Set; public interface IGraph { - public List getReversePostOrderList(); + List getReversePostOrderList(); - public Set getRoots(); + Set getRoots(); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/IGraphNode.java b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/IGraphNode.java index 191b974..19d59b5 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/IGraphNode.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/IGraphNode.java @@ -19,5 +19,5 @@ import java.util.List; public interface IGraphNode { - public List getPredecessors(); + List getPredecessors(); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/IrreducibleCFGDeobfuscator.java b/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/IrreducibleCFGDeobfuscator.java index 11f9483..31e171e 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/IrreducibleCFGDeobfuscator.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/IrreducibleCFGDeobfuscator.java @@ -63,7 +63,7 @@ public class IrreducibleCFGDeobfuscator { } // transforming and reducing the graph - for (; ; ) { + while (true) { int ttype = 0; Node node = null; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Exprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Exprent.java index 63b3a5f..a0518b1 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Exprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Exprent.java @@ -108,7 +108,7 @@ public class Exprent { lstAllExprents.add(this); for (Exprent expr : lstAllExprents) { - if (expr.type == Exprent.EXPRENT_VAR) { + if (expr.type == EXPRENT_VAR) { set.add(new VarVersionPaar((VarExprent)expr)); } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java index 305fd59..844a7a9 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java @@ -292,10 +292,7 @@ public class FunctionExprent extends Exprent { else if (functype == FUNCTION_STRCONCAT) { exprType = VarType.VARTYPE_STRING; } - else if (functype >= FUNCTION_EQ) { - exprType = VarType.VARTYPE_BOOLEAN; - } - else if (functype == FUNCTION_INSTANCEOF) { + else if (functype >= FUNCTION_EQ || functype == FUNCTION_INSTANCEOF) { exprType = VarType.VARTYPE_BOOLEAN; } else if (functype >= FUNCTION_ARRAYLENGTH) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java index cd75f1f..e589494 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java @@ -43,7 +43,6 @@ public class VarExprent extends Exprent { private VarType vartype; private boolean definition = false; - ; private VarProcessor processor; @@ -52,7 +51,6 @@ public class VarExprent extends Exprent { private boolean classdef = false; private boolean stack = false; - ; { this.type = EXPRENT_VAR; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectGraph.java b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectGraph.java index 1fc568f..2f4ed80 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectGraph.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectGraph.java @@ -131,6 +131,6 @@ public class DirectGraph { // 0 - success, do nothing // 1 - cancel iteration // 2 - success, delete exprent - public int processExprent(Exprent exprent); + int processExprent(Exprent exprent); } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/FlattenStatementsHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/FlattenStatementsHelper.java index 1eb79e9..27d3c9a 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/FlattenStatementsHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/FlattenStatementsHelper.java @@ -321,7 +321,7 @@ public class FlattenStatementsHelper { boolean isFinallyExit = false; - for (; ; ) { + while (true) { StackEntry entry = null; if (!stack.isEmpty()) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAUConstructorSparseEx.java b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAUConstructorSparseEx.java index 596da31..9b1ce0e 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAUConstructorSparseEx.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAUConstructorSparseEx.java @@ -791,7 +791,7 @@ public class SSAUConstructorSparseEx { private Integer getFirstProtectedRange(Statement stat) { - for (; ; ) { + while (true) { Statement parent = stat.getParent(); if (parent == null) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java index 9f1a3f5..f2b6bc4 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java @@ -49,8 +49,6 @@ public class CatchAllStatement extends Statement { type = Statement.TYPE_CATCHALL; } - ; - private CatchAllStatement(Statement head, Statement handler) { this(); @@ -102,7 +100,7 @@ public class CatchAllStatement extends Statement { return null; } - if (DecHelper.checkStatementExceptions(Arrays.asList(new Statement[]{head, exc}))) { + if (DecHelper.checkStatementExceptions(Arrays.asList(head, exc))) { return new CatchAllStatement(head, exc); } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SequenceStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SequenceStatement.java index 8fd8a43..d561b9e 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SequenceStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SequenceStatement.java @@ -51,7 +51,7 @@ public class SequenceStatement extends Statement { private SequenceStatement(Statement head, Statement tail) { - this(Arrays.asList(new Statement[]{head, tail})); + this(Arrays.asList(head, tail)); List lstSuccs = tail.getSuccessorEdges(STATEDGE_DIRECT_ALL); if (!lstSuccs.isEmpty()) { @@ -88,7 +88,7 @@ public class SequenceStatement extends Statement { && !stat.isMonitorEnter()) { if (stat.getLastBasicType() == Statement.LASTBASICTYPE_GENERAL) { - if (DecHelper.checkStatementExceptions(Arrays.asList(new Statement[]{head, stat}))) { + if (DecHelper.checkStatementExceptions(Arrays.asList(head, stat))) { return new SequenceStatement(head, stat); } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/Statement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/Statement.java index aceb2b8..52118d2 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/Statement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/Statement.java @@ -124,7 +124,6 @@ public class Statement { // FIXME: used in FlattenStatementsHelper.flattenStatement()! check and remove //lastBasicType = LASTBASICTYPE_GENERAL; isMonitorEnter = false; - ; containsMonitorExit = false; for (Map> map : new Map[]{mapSuccEdges, mapPredEdges}) { @@ -234,7 +233,7 @@ public class Statement { // monitorenter and monitorexit stat.buildMonitorFlags(); - if (stat.type == Statement.TYPE_SWITCH) { + if (stat.type == TYPE_SWITCH) { // special case switch, sorting leaf nodes ((SwitchStatement)stat).sortEdgesAndNodes(); } @@ -390,7 +389,7 @@ public class Statement { continueSet.add(edge.getDestination().getBasichead()); } - if (type == Statement.TYPE_DO) { + if (type == TYPE_DO) { continueSet.remove(first.getBasichead()); } @@ -513,11 +512,11 @@ public class Statement { } public void initExprents() { - ; // do nothing + // do nothing } public void replaceExprent(Exprent oldexpr, Exprent newexpr) { - ; // do nothing + // do nothing } public Statement getSimpleCopy() { @@ -804,7 +803,7 @@ public class Statement { } public BasicBlockStatement getBasichead() { - if (type == Statement.TYPE_BASICBLOCK) { + if (type == TYPE_BASICBLOCK) { return (BasicBlockStatement)this; } else { @@ -823,13 +822,12 @@ public class Statement { } public boolean hasBasicSuccEdge() { - boolean res = type == Statement.TYPE_BASICBLOCK || (type == Statement.TYPE_IF && - ((IfStatement)this).iftype == IfStatement.IFTYPE_IF) || - (type == Statement.TYPE_DO && ((DoStatement)this).getLooptype() != DoStatement.LOOP_DO); // FIXME: default switch - return res; + return type == TYPE_BASICBLOCK || (type == TYPE_IF && + ((IfStatement)this).iftype == IfStatement.IFTYPE_IF) || + (type == TYPE_DO && ((DoStatement)this).getLooptype() != DoStatement.LOOP_DO); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java index 7e5a56f..1c52517 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java @@ -148,7 +148,7 @@ public class VarDefinitionHelper { continue; } else { - List lstSpecial = Arrays.asList(new Exprent[]{dstat.getConditionExprent(), dstat.getIncExprent()}); + List lstSpecial = Arrays.asList(dstat.getConditionExprent(), dstat.getIncExprent()); for (VarExprent var : getAllVars(lstSpecial)) { if (var.getIndex() == index.intValue()) { stat = stat.getParent(); diff --git a/src/org/jetbrains/java/decompiler/modules/renamer/IdentifierConverter.java b/src/org/jetbrains/java/decompiler/modules/renamer/IdentifierConverter.java index a665de8..c8ec379 100644 --- a/src/org/jetbrains/java/decompiler/modules/renamer/IdentifierConverter.java +++ b/src/org/jetbrains/java/decompiler/modules/renamer/IdentifierConverter.java @@ -56,7 +56,7 @@ public class IdentifierConverter { helper = (IIdentifierRenamer)IdentifierConverter.class.getClassLoader().loadClass(user_class).newInstance(); } catch (Exception ex) { - ; // ignore errors + // ignore errors } } diff --git a/src/org/jetbrains/java/decompiler/struct/IDecompiledData.java b/src/org/jetbrains/java/decompiler/struct/IDecompiledData.java index 1976216..f309b0e 100644 --- a/src/org/jetbrains/java/decompiler/struct/IDecompiledData.java +++ b/src/org/jetbrains/java/decompiler/struct/IDecompiledData.java @@ -17,7 +17,7 @@ package org.jetbrains.java.decompiler.struct; public interface IDecompiledData { - public String getClassEntryName(StructClass cl, String entryname); + String getClassEntryName(StructClass cl, String entryname); - public String getClassContent(StructClass cl); + String getClassContent(StructClass cl); } diff --git a/src/org/jetbrains/java/decompiler/struct/ISaveClass.java b/src/org/jetbrains/java/decompiler/struct/ISaveClass.java index 69a90f9..c8a5a45 100644 --- a/src/org/jetbrains/java/decompiler/struct/ISaveClass.java +++ b/src/org/jetbrains/java/decompiler/struct/ISaveClass.java @@ -22,9 +22,9 @@ import java.io.IOException; public interface ISaveClass { - public String getClassEntryName(StructClass cl, String entryname); + String getClassEntryName(StructClass cl, String entryname); - public void saveClassToFile(StructClass cl, File file) throws FileNotFoundException, IOException; + void saveClassToFile(StructClass cl, File file) throws FileNotFoundException, IOException; - public void saveClassToStream(StructClass cl, DataOutputStream out); + void saveClassToStream(StructClass cl, DataOutputStream out); } diff --git a/src/org/jetbrains/java/decompiler/struct/StructContext.java b/src/org/jetbrains/java/decompiler/struct/StructContext.java index 3728a2a..ecca95a 100644 --- a/src/org/jetbrains/java/decompiler/struct/StructContext.java +++ b/src/org/jetbrains/java/decompiler/struct/StructContext.java @@ -41,8 +41,6 @@ public class StructContext { private HashMap units = new HashMap(); - private ContextUnit defaultUnit; - private IDecompilatSaver saver; private IDecompiledData decdata; @@ -53,7 +51,7 @@ public class StructContext { this.decdata = decdata; this.loader = loader; - defaultUnit = new ContextUnit(ContextUnit.TYPE_FOLDER, null, "", true, saver, decdata); + ContextUnit defaultUnit = new ContextUnit(ContextUnit.TYPE_FOLDER, null, "", true, saver, decdata); units.put("", defaultUnit); } diff --git a/src/org/jetbrains/java/decompiler/struct/StructMethod.java b/src/org/jetbrains/java/decompiler/struct/StructMethod.java index baaf633..08101d2 100644 --- a/src/org/jetbrains/java/decompiler/struct/StructMethod.java +++ b/src/org/jetbrains/java/decompiler/struct/StructMethod.java @@ -78,8 +78,6 @@ public class StructMethod implements CodeConstants { private boolean containsCode = false; - private boolean own; - private StructClass classStruct; @@ -104,7 +102,6 @@ public class StructMethod implements CodeConstants { public StructMethod(DataInputFullStream in, boolean lazy, boolean own, StructClass clstruct) throws IOException { - this.own = own; this.lazy = lazy; this.expanded = !lazy; this.classStruct = clstruct; @@ -125,7 +122,7 @@ public class StructMethod implements CodeConstants { String attrname = pool.getPrimitiveConstant(attr_nameindex).getString(); if (StructGeneralAttribute.ATTRIBUTE_CODE.equals(attrname)) { - if (!this.own) { + if (!own) { // skip code in foreign classes in.skip(8); in.skip(in.readInt()); @@ -478,7 +475,7 @@ public class StructMethod implements CodeConstants { int[] ops = new int[operands.size()]; for (int j = 0; j < operands.size(); j++) { - ops[j] = ((Integer)operands.get(j)).intValue(); + ops[j] = operands.get(j).intValue(); } Instruction instr = ConstantsUtil.getInstructionInstance(opcode, wide, group, bytecode_version, ops); diff --git a/src/org/jetbrains/java/decompiler/struct/attr/StructExceptionsAttribute.java b/src/org/jetbrains/java/decompiler/struct/attr/StructExceptionsAttribute.java index 930db78..c52fcc7 100644 --- a/src/org/jetbrains/java/decompiler/struct/attr/StructExceptionsAttribute.java +++ b/src/org/jetbrains/java/decompiler/struct/attr/StructExceptionsAttribute.java @@ -51,7 +51,7 @@ public class StructExceptionsAttribute extends StructGeneralAttribute { if (len > 0) { info = new byte[len * 2]; for (int i = 0, j = 0; i < len; i++, j += 2) { - int index = ((Integer)throwsExceptions.get(i)).intValue(); + int index = throwsExceptions.get(i).intValue(); info[j] = (byte)(index >> 8); info[j + 1] = (byte)(index & 0xFF); } @@ -63,7 +63,7 @@ public class StructExceptionsAttribute extends StructGeneralAttribute { } public String getExcClassname(int index, ConstantPool pool) { - return pool.getPrimitiveConstant(((Integer)throwsExceptions.get(index)).intValue()).getString(); + return pool.getPrimitiveConstant(throwsExceptions.get(index).intValue()).getString(); } public List getThrowsExceptions() { diff --git a/src/org/jetbrains/java/decompiler/struct/consts/ConstantPool.java b/src/org/jetbrains/java/decompiler/struct/consts/ConstantPool.java index 5a593af..ac3c5a5 100644 --- a/src/org/jetbrains/java/decompiler/struct/consts/ConstantPool.java +++ b/src/org/jetbrains/java/decompiler/struct/consts/ConstantPool.java @@ -129,7 +129,7 @@ public class ConstantPool { out.writeShort(pool.size()); for (int i = 1; i < pool.size(); i++) { - PooledConstant cnst = (PooledConstant)pool.get(i); + PooledConstant cnst = pool.get(i); if (cnst != null) { cnst.writeToStream(out); } diff --git a/src/org/jetbrains/java/decompiler/struct/consts/LinkConstant.java b/src/org/jetbrains/java/decompiler/struct/consts/LinkConstant.java index c20b5af..71bf146 100644 --- a/src/org/jetbrains/java/decompiler/struct/consts/LinkConstant.java +++ b/src/org/jetbrains/java/decompiler/struct/consts/LinkConstant.java @@ -40,7 +40,6 @@ public class LinkConstant extends PooledConstant { public int paramCount = 0; public boolean isVoid = false; - ; public boolean returnCategory2 = false; diff --git a/src/org/jetbrains/java/decompiler/struct/consts/VariableTypeEnum.java b/src/org/jetbrains/java/decompiler/struct/consts/VariableTypeEnum.java index ef949aa..7950d5b 100644 --- a/src/org/jetbrains/java/decompiler/struct/consts/VariableTypeEnum.java +++ b/src/org/jetbrains/java/decompiler/struct/consts/VariableTypeEnum.java @@ -17,31 +17,31 @@ package org.jetbrains.java.decompiler.struct.consts; public interface VariableTypeEnum { - public final static int BOOLEAN = 1; - public final static int BYTE = 2; - public final static int CHAR = 3; - public final static int SHORT = 4; - public final static int INT = 5; - public final static int FLOAT = 6; - public final static int LONG = 7; - public final static int DOUBLE = 8; - public final static int RETURN_ADDRESS = 9; - public final static int REFERENCE = 10; - public final static int INSTANCE_UNINITIALIZED = 11; - public final static int VALUE_UNKNOWN = 12; - public final static int VOID = 13; + int BOOLEAN = 1; + int BYTE = 2; + int CHAR = 3; + int SHORT = 4; + int INT = 5; + int FLOAT = 6; + int LONG = 7; + int DOUBLE = 8; + int RETURN_ADDRESS = 9; + int REFERENCE = 10; + int INSTANCE_UNINITIALIZED = 11; + int VALUE_UNKNOWN = 12; + int VOID = 13; - public final static Integer BOOLEAN_OBJ = new Integer(BOOLEAN); - public final static Integer BYTE_OBJ = new Integer(BYTE); - public final static Integer CHAR_OBJ = new Integer(CHAR); - public final static Integer SHORT_OBJ = new Integer(SHORT); - public final static Integer INT_OBJ = new Integer(INT); - public final static Integer FLOAT_OBJ = new Integer(FLOAT); - public final static Integer LONG_OBJ = new Integer(LONG); - public final static Integer DOUBLE_OBJ = new Integer(DOUBLE); - public final static Integer RETURN_ADDRESS_OBJ = new Integer(RETURN_ADDRESS); - public final static Integer REFERENCE_OBJ = new Integer(REFERENCE); - public final static Integer INSTANCE_UNINITIALIZED_OBJ = new Integer(INSTANCE_UNINITIALIZED); - public final static Integer VALUE_UNKNOWN_OBJ = new Integer(VALUE_UNKNOWN); - public final static Integer VOID_OBJ = new Integer(VOID); + Integer BOOLEAN_OBJ = new Integer(BOOLEAN); + Integer BYTE_OBJ = new Integer(BYTE); + Integer CHAR_OBJ = new Integer(CHAR); + Integer SHORT_OBJ = new Integer(SHORT); + Integer INT_OBJ = new Integer(INT); + Integer FLOAT_OBJ = new Integer(FLOAT); + Integer LONG_OBJ = new Integer(LONG); + Integer DOUBLE_OBJ = new Integer(DOUBLE); + Integer RETURN_ADDRESS_OBJ = new Integer(RETURN_ADDRESS); + Integer REFERENCE_OBJ = new Integer(REFERENCE); + Integer INSTANCE_UNINITIALIZED_OBJ = new Integer(INSTANCE_UNINITIALIZED); + Integer VALUE_UNKNOWN_OBJ = new Integer(VALUE_UNKNOWN); + Integer VOID_OBJ = new Integer(VOID); } diff --git a/src/org/jetbrains/java/decompiler/struct/gen/FieldDescriptor.java b/src/org/jetbrains/java/decompiler/struct/gen/FieldDescriptor.java index ff731ae..fd213f0 100644 --- a/src/org/jetbrains/java/decompiler/struct/gen/FieldDescriptor.java +++ b/src/org/jetbrains/java/decompiler/struct/gen/FieldDescriptor.java @@ -17,10 +17,10 @@ package org.jetbrains.java.decompiler.struct.gen; public class FieldDescriptor { - public static final FieldDescriptor INTEGER_DESCRIPTOR = FieldDescriptor.parseDescriptor("Ljava/lang/Integer;"); - public static final FieldDescriptor LONG_DESCRIPTOR = FieldDescriptor.parseDescriptor("Ljava/lang/Long;"); - public static final FieldDescriptor FLOAT_DESCRIPTOR = FieldDescriptor.parseDescriptor("Ljava/lang/Float;"); - public static final FieldDescriptor DOUBLE_DESCRIPTOR = FieldDescriptor.parseDescriptor("Ljava/lang/Double;"); + public static final FieldDescriptor INTEGER_DESCRIPTOR = parseDescriptor("Ljava/lang/Integer;"); + public static final FieldDescriptor LONG_DESCRIPTOR = parseDescriptor("Ljava/lang/Long;"); + public static final FieldDescriptor FLOAT_DESCRIPTOR = parseDescriptor("Ljava/lang/Float;"); + public static final FieldDescriptor DOUBLE_DESCRIPTOR = parseDescriptor("Ljava/lang/Double;"); public VarType type; diff --git a/src/org/jetbrains/java/decompiler/struct/gen/VarType.java b/src/org/jetbrains/java/decompiler/struct/gen/VarType.java index 79e2cbf..1b6ff99 100644 --- a/src/org/jetbrains/java/decompiler/struct/gen/VarType.java +++ b/src/org/jetbrains/java/decompiler/struct/gen/VarType.java @@ -119,7 +119,7 @@ public class VarType { // TODO: optimize switch } public boolean isFalseBoolean() { - return (convinfo & VarType.FALSEBOOLEAN) != 0; + return (convinfo & FALSEBOOLEAN) != 0; } public boolean isSuperset(VarType val) { @@ -189,13 +189,13 @@ public class VarType { // TODO: optimize switch case CodeConstants.TYPE_FAMILY_INTEGER: if ((type1.type == CodeConstants.TYPE_CHAR && type2.type == CodeConstants.TYPE_SHORT) || (type1.type == CodeConstants.TYPE_SHORT && type2.type == CodeConstants.TYPE_CHAR)) { - return VarType.VARTYPE_SHORTCHAR; + return VARTYPE_SHORTCHAR; } else { - return VarType.VARTYPE_BYTECHAR; + return VARTYPE_BYTECHAR; } case CodeConstants.TYPE_FAMILY_OBJECT: - return VarType.VARTYPE_NULL; + return VARTYPE_NULL; } } @@ -220,13 +220,13 @@ public class VarType { // TODO: optimize switch case CodeConstants.TYPE_FAMILY_INTEGER: if ((type1.type == CodeConstants.TYPE_SHORTCHAR && type2.type == CodeConstants.TYPE_BYTE) || (type1.type == CodeConstants.TYPE_BYTE && type2.type == CodeConstants.TYPE_SHORTCHAR)) { - return VarType.VARTYPE_SHORT; + return VARTYPE_SHORT; } else { - return VarType.VARTYPE_INT; + return VARTYPE_INT; } case CodeConstants.TYPE_FAMILY_OBJECT: - return VarType.VARTYPE_OBJECT; + return VARTYPE_OBJECT; } } @@ -236,19 +236,19 @@ public class VarType { // TODO: optimize switch public static VarType getMinTypeInFamily(int family) { switch (family) { case CodeConstants.TYPE_FAMILY_BOOLEAN: - return VarType.VARTYPE_BOOLEAN; + return VARTYPE_BOOLEAN; case CodeConstants.TYPE_FAMILY_INTEGER: - return VarType.VARTYPE_BYTECHAR; + return VARTYPE_BYTECHAR; case CodeConstants.TYPE_FAMILY_OBJECT: - return VarType.VARTYPE_NULL; + return VARTYPE_NULL; case CodeConstants.TYPE_FAMILY_FLOAT: - return VarType.VARTYPE_FLOAT; + return VARTYPE_FLOAT; case CodeConstants.TYPE_FAMILY_LONG: - return VarType.VARTYPE_LONG; + return VARTYPE_LONG; case CodeConstants.TYPE_FAMILY_DOUBLE: - return VarType.VARTYPE_DOUBLE; + return VARTYPE_DOUBLE; case CodeConstants.TYPE_FAMILY_UNKNOWN: - return VarType.VARTYPE_UNKNOWN; + return VARTYPE_UNKNOWN; default: throw new RuntimeException("invalid type family!"); } diff --git a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericMain.java b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericMain.java index db7d84b..6a4f52e 100644 --- a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericMain.java +++ b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericMain.java @@ -127,7 +127,7 @@ public class GenericMain { List lstBounds = new ArrayList(); - for (; ; ) { + while (true) { if (value.charAt(0) == ':') { // empty superclass, skip value = value.substring(1); @@ -199,7 +199,7 @@ public class GenericMain { GenericType genpar = type.getArguments().get(i); if (genpar != null) { - buffer.append(GenericMain.getGenericCastTypeName(genpar)); + buffer.append(getGenericCastTypeName(genpar)); } } buffer.append(">"); diff --git a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericType.java b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericType.java index e2faa4a..61d07a0 100644 --- a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericType.java +++ b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericType.java @@ -70,7 +70,7 @@ public class GenericType { type = CodeConstants.TYPE_OBJECT; sig = sig.substring(index + 1, sig.length() - 1); - for (; ; ) { + while (true) { String cl = getNextClassSignature(sig); String name = cl; diff --git a/src/org/jetbrains/java/decompiler/struct/lazy/LazyLoader.java b/src/org/jetbrains/java/decompiler/struct/lazy/LazyLoader.java index 46a334e..ad87235 100644 --- a/src/org/jetbrains/java/decompiler/struct/lazy/LazyLoader.java +++ b/src/org/jetbrains/java/decompiler/struct/lazy/LazyLoader.java @@ -109,7 +109,7 @@ public class LazyLoader { int name_index = in.readUnsignedShort(); int descriptor_index = in.readUnsignedShort(); - String elem_arr[] = pool.getClassElement(ConstantPool.METHOD, this_class, name_index, descriptor_index); + String[] elem_arr = pool.getClassElement(ConstantPool.METHOD, this_class, name_index, descriptor_index); String name = elem_arr[0]; if (mt.getName().equals(name)) { diff --git a/src/org/jetbrains/java/decompiler/util/DataInputFullStream.java b/src/org/jetbrains/java/decompiler/util/DataInputFullStream.java index a13b27c..0ed20dc 100644 --- a/src/org/jetbrains/java/decompiler/util/DataInputFullStream.java +++ b/src/org/jetbrains/java/decompiler/util/DataInputFullStream.java @@ -25,14 +25,14 @@ public class DataInputFullStream extends DataInputStream { super(in); } - public final int readFull(byte b[]) throws IOException { + public final int readFull(byte[] b) throws IOException { int length = b.length; byte[] btemp = new byte[length]; int pos = 0; int bytes_read = -1; - for (; ; ) { + while (true) { bytes_read = read(btemp, 0, length - pos); if (bytes_read == -1) { return -1; diff --git a/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java b/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java index 301a1ff..863dd72 100644 --- a/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java +++ b/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java @@ -122,9 +122,7 @@ public class FastSparseSetFactory { System.arraycopy(data, 0, cpdata, 0, arrlength); System.arraycopy(next, 0, cpnext, 0, arrlength); - FastSparseSet copy = new FastSparseSet(factory, cpdata, cpnext); - - return copy; + return new FastSparseSet(factory, cpdata, cpnext); } private int[] ensureCapacity(int index) { diff --git a/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java b/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java index f429636..a1da87b 100644 --- a/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java +++ b/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java @@ -27,27 +27,26 @@ import java.util.List; public class InterpreterUtil { public static void copyFile(File in, File out) throws IOException { - FileChannel inChannel = new FileInputStream(in).getChannel(); - FileChannel outChannel = new FileOutputStream(out).getChannel(); + FileInputStream inStream = new FileInputStream(in); try { - // magic number for Windows, 64Mb - 32Kb) - int maxCount = (64 * 1024 * 1024) - (32 * 1024); - long size = inChannel.size(); - long position = 0; - while (position < size) { - position += inChannel.transferTo(position, maxCount, outChannel); + FileOutputStream outStream = new FileOutputStream(out); + try { + FileChannel inChannel = inStream.getChannel(); + FileChannel outChannel = outStream.getChannel(); + // magic number for Windows, 64Mb - 32Kb) + int maxCount = (64 * 1024 * 1024) - (32 * 1024); + long size = inChannel.size(); + long position = 0; + while (position < size) { + position += inChannel.transferTo(position, maxCount, outChannel); + } + } + finally { + outStream.close(); } - } - catch (IOException e) { - throw e; } finally { - if (inChannel != null) { - inChannel.close(); - } - if (outChannel != null) { - outChannel.close(); - } + inStream.close(); } } @@ -74,12 +73,10 @@ public class InterpreterUtil { public static boolean equalSets(Collection c1, Collection c2) { if (c1 == null) { - return c2 == null ? true : false; + return c2 == null; } - else { - if (c2 == null) { - return false; - } + else if (c2 == null) { + return false; } if (c1.size() != c2.size()) { diff --git a/src/org/jetbrains/java/decompiler/util/SFormsFastMap.java b/src/org/jetbrains/java/decompiler/util/SFormsFastMap.java index 26fb216..51c64d2 100644 --- a/src/org/jetbrains/java/decompiler/util/SFormsFastMap.java +++ b/src/org/jetbrains/java/decompiler/util/SFormsFastMap.java @@ -243,9 +243,9 @@ public class SFormsFastMap { return arrnew; } - public static interface IElementsUnion { - public E union(E first, E second); + public interface IElementsUnion { + E union(E first, E second); - public E copy(E element); + E copy(E element); } } diff --git a/src/org/jetbrains/java/decompiler/util/SFormsFastMapOld.java b/src/org/jetbrains/java/decompiler/util/SFormsFastMapOld.java index 834b3b6..7d428a4 100644 --- a/src/org/jetbrains/java/decompiler/util/SFormsFastMapOld.java +++ b/src/org/jetbrains/java/decompiler/util/SFormsFastMapOld.java @@ -217,10 +217,10 @@ public class SFormsFastMapOld { } } - public static interface IElementsUnion { - public E union(E first, E second); + public interface IElementsUnion { + E union(E first, E second); - public E copy(E element); + E copy(E element); } // public class SFormsFastMapIterator implements Iterator> { diff --git a/src/org/jetbrains/java/decompiler/util/VBStyleCollection.java b/src/org/jetbrains/java/decompiler/util/VBStyleCollection.java index fcb579d..f4d5968 100644 --- a/src/org/jetbrains/java/decompiler/util/VBStyleCollection.java +++ b/src/org/jetbrains/java/decompiler/util/VBStyleCollection.java @@ -106,7 +106,7 @@ public class VBStyleCollection extends ArrayList { } public void removeWithKey(K key) { - int index = ((Integer)map.get(key)).intValue(); + int index = map.get(key).intValue(); addToListIndex(index + 1, -1); super.remove(index); lstKeys.remove(index);