java-decompiler: post-import cleanup (code style issues)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -41,8 +41,6 @@ public class StructContext {
|
||||
|
||||
private HashMap<String, ContextUnit> units = new HashMap<String, ContextUnit>();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<Integer> getThrowsExceptions() {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ public class LinkConstant extends PooledConstant {
|
||||
public int paramCount = 0;
|
||||
|
||||
public boolean isVoid = false;
|
||||
;
|
||||
|
||||
public boolean returnCategory2 = false;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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!");
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public class GenericMain {
|
||||
|
||||
List<GenericType> lstBounds = new ArrayList<GenericType>();
|
||||
|
||||
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(">");
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user