java-decompiler: post-import cleanup (common fixes and optimizations)

This commit is contained in:
Roman Shevchenko
2014-08-29 21:58:12 +04:00
parent 63b8d35d08
commit f5431c3bb1
62 changed files with 410 additions and 422 deletions

View File

@@ -216,8 +216,11 @@ public class StructMethod implements CodeConstants {
}
}
private void readAttribute(DataInputFullStream in, ConstantPool pool, VBStyleCollection<StructGeneralAttribute, String> lstAttribute,
int attr_nameindex, String attrname) throws IOException {
private static void readAttribute(DataInputFullStream in,
ConstantPool pool,
VBStyleCollection<StructGeneralAttribute, String> lstAttribute,
int attr_nameindex,
String attrname) throws IOException {
StructGeneralAttribute attribute = StructGeneralAttribute.getMatchingAttributeInstance(attr_nameindex, attrname);

View File

@@ -252,7 +252,7 @@ public class ConstantPool {
buffer.append("[");
}
buffer.append("L" + newname + ";");
buffer.append("L").append(newname).append(";");
}
else {
buffer.append(newname);

View File

@@ -306,7 +306,7 @@ public class VarType { // TODO: optimize switch
}
}
private int getType(char c) {
private static int getType(char c) {
switch (c) {
case 'B':
return CodeConstants.TYPE_BYTE;
@@ -343,7 +343,7 @@ public class VarType { // TODO: optimize switch
}
}
private String getChar(int type) {
private static String getChar(int type) {
switch (type) {
case CodeConstants.TYPE_BYTE:
return "B";

View File

@@ -221,7 +221,7 @@ public class GenericMain {
String res = name.replace('/', '.');
if (res.indexOf("$") >= 0) {
if (res.contains("$")) {
StructClass cl = DecompilerContext.getStructcontext().getClass(name);
if (cl == null || !cl.isOwn()) {
res = res.replace('$', '.');

View File

@@ -105,7 +105,7 @@ public class GenericType {
}
}
private String getNextClassSignature(String value) {
private static String getNextClassSignature(String value) {
int counter = 0;
int index = 0;
@@ -131,7 +131,7 @@ public class GenericType {
return value.substring(0, index);
}
private void parseArgumentsList(String value, GenericType type) {
private static void parseArgumentsList(String value, GenericType type) {
if (value == null) {
return;
@@ -214,7 +214,7 @@ public class GenericType {
return value.substring(0, index + 1);
}
private int getType(char c) {
private static int getType(char c) {
switch (c) {
case 'B':
return CodeConstants.TYPE_BYTE;

View File

@@ -158,7 +158,7 @@ public class LazyLoader {
return link == null ? null : getClassStream(link.externPath, link.internPath);
}
private void skipAttributes(DataInputFullStream in) throws IOException {
private static void skipAttributes(DataInputFullStream in) throws IOException {
int length = in.readUnsignedShort();
for (int i = 0; i < length; i++) {