ASDec: Small changes to eliminate notices

This commit is contained in:
Jindra Petk
2012-12-28 12:17:33 +01:00
parent 1223dd8aad
commit dbe3dc2905
63 changed files with 116 additions and 104 deletions

View File

@@ -82,7 +82,7 @@ public class Configuration {
replacements = new ArrayList<Replacement>();
try {
BufferedReader br = new BufferedReader(new FileReader(getReplacementsFile()));
String s = "";
String s;
while ((s = br.readLine()) != null) {
Replacement r = new Replacement(s, br.readLine());
replacements.add(r);

View File

@@ -62,10 +62,10 @@ public class Main {
public static String maskURL;
public static SWF swf;
public static final String version = "1.0.1";
public static String applicationName = "JP ActionScript Decompiler v." + version;
public static String shortApplicationName = "ASDec";
public static String shortApplicationVerName = shortApplicationName + " v." + version;
public static String projectPage = "http://code.google.com/p/asdec/";
public static final String applicationName = "JP ActionScript Decompiler v." + version;
public static final String shortApplicationName = "ASDec";
public static final String shortApplicationVerName = shortApplicationName + " v." + version;
public static final String projectPage = "http://code.google.com/p/asdec/";
public static LoadingDialog loadingDialog;
public static ModeFrame modeFrame;
private static boolean working = false;
@@ -338,7 +338,7 @@ public class Main {
}
try {
BufferedReader br = new BufferedReader(new FileReader(f));
String s = "";
String s;
boolean packageFound = false;
String author = defaultAuthor;
String yearStr = defaultYearStr;
@@ -472,7 +472,7 @@ public class Main {
badArguments();
}
commandLineMode = true;
boolean exportOK = true;
boolean exportOK;
try {
printHeader();
SWF exfile = new SWF(new FileInputStream(inFile));
@@ -505,7 +505,7 @@ public class Main {
if (SWF.fws2cws(new FileInputStream(args[1]), new FileOutputStream(args[2]))) {
System.out.println("OK");
} else {
System.err.println("FAIL");;
System.err.println("FAIL");
}
} else if (args[0].equals("-decompress")) {
if (args.length < 3) {
@@ -658,7 +658,7 @@ public class Main {
OutputStream os = sock.getOutputStream();
os.write("GET /feeds/p/asdec/downloads/basic HTTP/1.1\r\nHost: code.google.com\r\nConnection: close\r\n\r\n".getBytes());
BufferedReader br = new BufferedReader(new InputStreamReader(sock.getInputStream()));
String s = "";
String s;
String response = "";
boolean start = false;
while ((s = br.readLine()) != null) {

View File

@@ -237,7 +237,7 @@ public class SWF {
swfHead[0] = 'C';
fos.write(swfHead);
fos = new DeflaterOutputStream(fos);
int i = 0;
int i;
while ((i = fis.read()) != -1) {
fos.write(i);
}
@@ -269,7 +269,7 @@ public class SWF {
}
swfHead[0] = 'F';
fos.write(swfHead);
int i = 0;
int i;
while ((i = iis.read()) != -1) {
fos.write(i);
}
@@ -315,7 +315,7 @@ public class SWF {
}
List<String> existingNames = new ArrayList<String>();
for (TagNode node : nodeList) {
String name = "";
String name;
if (node.tag instanceof TagName) {
name = ((TagName) node.tag).getName();
} else {
@@ -333,7 +333,7 @@ public class SWF {
try {
String f = outdir + File.separatorChar + name + ".as";
informListeners("export", "Exporting " + f + " ...");
String ret = "";
String ret;
if (isPcode) {
ret = ((ASMSource) node.tag).getASMSource(10); //TODO:Ensure correct version here
} else {

View File

@@ -125,7 +125,7 @@ public class SWFInputStream extends InputStream {
*/
public String readString() throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int r = 0;
int r;
while (true) {
r = read();
if (r <= 0) {
@@ -233,7 +233,7 @@ public class SWFInputStream extends InputStream {
+ ((long) (readBuffer[7] & 255) << 24)
+ ((readBuffer[6] & 255) << 16)
+ ((readBuffer[5] & 255) << 8)
+ ((readBuffer[4] & 255) << 0));
+ ((readBuffer[4] & 255)));
}
/**

View File

@@ -179,7 +179,7 @@ public class SWFOutputStream extends OutputStream {
writeBuffer[7] = (byte) (value >>> 24);
writeBuffer[6] = (byte) (value >>> 16);
writeBuffer[5] = (byte) (value >>> 8);
writeBuffer[4] = (byte) (value >>> 0);
writeBuffer[4] = (byte) (value);
write(writeBuffer);
}
@@ -473,9 +473,9 @@ public class SWFOutputStream extends OutputStream {
public void writeMatrix(MATRIX value) throws IOException {
writeUB(1, value.hasScale ? 1 : 0);
if (value.hasScale) {
int nBits = 0;
nBits = enlargeBitCountF(nBits, value.scaleX);
nBits = enlargeBitCountF(nBits, value.scaleY);
int nBits;
//nBits = enlargeBitCountF(nBits, value.scaleX);
//nBits = enlargeBitCountF(nBits, value.scaleY);
nBits = value.scaleNBits; //FFFUUU
writeUB(5, nBits);
writeFB(nBits, value.scaleX);
@@ -483,17 +483,17 @@ public class SWFOutputStream extends OutputStream {
}
writeUB(1, value.hasRotate ? 1 : 0);
if (value.hasRotate) {
int nBits = 0;
nBits = enlargeBitCountF(nBits, value.rotateSkew0);
nBits = enlargeBitCountF(nBits, value.rotateSkew1);
int nBits;// = 0;
//nBits = enlargeBitCountF(nBits, value.rotateSkew0);
//nBits = enlargeBitCountF(nBits, value.rotateSkew1);
nBits = value.rotateNBits; //FFFUUU
writeUB(5, nBits);
writeFB(nBits, value.rotateSkew0);
writeFB(nBits, value.rotateSkew1);
}
int NTranslateBits = 0;
NTranslateBits = enlargeBitCountS(NTranslateBits, value.translateX);
NTranslateBits = enlargeBitCountS(NTranslateBits, value.translateY);
int NTranslateBits;
//NTranslateBits = enlargeBitCountS(NTranslateBits, value.translateX);
///NTranslateBits = enlargeBitCountS(NTranslateBits, value.translateY);
NTranslateBits = value.translateNBits; //FFFUUU
writeUB(5, NTranslateBits);

View File

@@ -595,7 +595,7 @@ public class ABC {
out.println(IDENT_STRING + classHeader);
out.println(IDENT_STRING + "{");
String toPrint = "";
String toPrint;
List<String> outTraits = new LinkedList<String>();
//if (class_info[i].cinit_index != 0) {
@@ -654,7 +654,7 @@ public class ABC {
}
}
}
String constructorParams = "";
String constructorParams;
bodyStr = "";
bodyIndex = findBodyIndex(instance_info[i].iinit_index);

View File

@@ -97,11 +97,11 @@ public class ABCInputStream extends InputStream {
}
public int readU32() throws IOException {
int i = 0;
int i;
int ret = 0;
int bytePos = 0;
int byteCount = 0;
boolean nextByte = false;
boolean nextByte;
do {
i = read();
nextByte = (i >> 7) == 1;
@@ -132,11 +132,11 @@ public class ABCInputStream extends InputStream {
}
public long readS32() throws IOException {
int i = 0;
int i;
long ret = 0;
int bytePos = 0;
int byteCount = 0;
boolean nextByte = false;
boolean nextByte;
do {
i = read();
nextByte = (i >> 7) == 1;
@@ -168,7 +168,7 @@ public class ABCInputStream extends InputStream {
+ ((long) (readBuffer[3] & 255) << 24)
+ ((readBuffer[2] & 255) << 16)
+ ((readBuffer[1] & 255) << 8)
+ ((readBuffer[0] & 255) << 0));
+ ((readBuffer[0] & 255)));
}
public double readDouble() throws IOException {

View File

@@ -83,7 +83,6 @@ public class ABCOutputStream extends OutputStream {
value = value >> 8;
ret = (int) (value & 0xff);
write(ret);
value = value >> 8;
}
public void writeS32(long value) throws IOException {
@@ -127,7 +126,7 @@ public class ABCOutputStream extends OutputStream {
writeBuffer[3] = (byte) (value >>> 24);
writeBuffer[2] = (byte) (value >>> 16);
writeBuffer[1] = (byte) (value >>> 8);
writeBuffer[0] = (byte) (value >>> 0);
writeBuffer[0] = (byte) (value);
write(writeBuffer);
}

View File

@@ -1073,7 +1073,7 @@ public class AVM2Code {
}
for (int e = 0; e < catchedExceptions.size(); e++) {
int eendpos = 0;
int eendpos;
if (e < catchedExceptions.size() - 1) {
eendpos = adr2pos(fixAddrAfterDebugLine(catchedExceptions.get(e + 1).target)) - 2;
} else {
@@ -1149,7 +1149,6 @@ public class AVM2Code {
if (ins.definition instanceof JumpIns) { //Ifs with multiple conditions
if (ins.operands[0] == 0) {
ip++;
addr = pos2adr(ip);
} else if (ins.operands[0] > 0) {
int secondAddr = addr + ins.getBytes().length;
int jumpAddr = secondAddr + ins.operands[0];
@@ -1181,14 +1180,12 @@ public class AVM2Code {
for (Loop l : loopList) {
if (l.loopBreak == jumpPos) {
output.add(new BreakTreeItem(ins, l.loopBreak));
addr = secondAddr;
ip = ip + 1;
continue iploop;
}
if (l.loopContinue == jumpPos) {
l.continueCount++;
output.add(new ContinueTreeItem(ins, l.loopBreak));
addr = secondAddr;
ip = ip + 1;
continue iploop;
}
@@ -1323,18 +1320,15 @@ public class AVM2Code {
} while (true);
output.add(new SwitchTreeItem(code.get(switchPos), switchBreak, switchedValue, casesList, caseCommands, defaultCommands));
ip = switchPos + 1;
addr = pos2adr(ip);
continue;
}
if (!backJumpFound) {
if (jumpPos <= end + 1) { //probably skipping catch
ip = jumpPos;
addr = pos2adr(ip);
continue;
}
output.add(new ContinueTreeItem(ins, jumpPos, false));
addr = secondAddr;
ip = ip + 1;
if (!unknownJumps.contains(jumpPos)) {
unknownJumps.add(jumpPos);
@@ -1451,7 +1445,7 @@ public class AVM2Code {
throw new ConvertException("Unknown pattern: back jump ", ip);
}
} else if (ins.definition instanceof DupIns) {
int nextPos = 0;
int nextPos;
do {
AVM2Instruction insAfter = code.get(ip + 1);
AVM2Instruction insBefore = ins;
@@ -1464,7 +1458,7 @@ public class AVM2Code {
insAfter = code.get(ip + 1);
}
boolean isAnd = false;
boolean isAnd;
if (insAfter.definition instanceof IfFalseIns) {
//stack.add("(" + stack.pop() + ")&&");
isAnd = true;
@@ -1496,14 +1490,12 @@ public class AVM2Code {
ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc, localRegNames);
}
ip++;
addr = pos2adr(ip);
break;
break;
//}
} else {
ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc, localRegNames);
ip++;
addr = pos2adr(ip);
break;
//throw new ConvertException("Unknown pattern after DUP:" + insComparsion.toString());
}
@@ -1566,14 +1558,12 @@ public class AVM2Code {
}
}
ConvertOutput onTrue = toSource(isStatic, classIndex, localRegs, new Stack<TreeItem>(), scopeStack, abc, constants, method_info, body, ip + 1, targetIns - 1 - ((hasElse || hasReturn) ? 1 : 0), localRegNames);
addr = targetAddr;
ip = targetIns;
ConvertOutput onFalse = new ConvertOutput(new Stack<TreeItem>(), new ArrayList<TreeItem>());
if (hasElse) {
int finalAddr = targetAddr + code.get(targetIns - 1).operands[0];
int finalIns = adr2pos(finalAddr);
onFalse = toSource(isStatic, classIndex, localRegs, new Stack<TreeItem>(), scopeStack, abc, constants, method_info, body, targetIns, finalIns - 1, localRegNames);
addr = finalAddr;
ip = finalIns;
}
if ((onTrue.stack.size() > 0) && (onFalse != null) && (onFalse.stack.size() > 0)) {
@@ -1709,11 +1699,11 @@ public class AVM2Code {
parsedExceptions = new ArrayList<ABCException>();
ignoredIns = new ArrayList<Integer>();
List<TreeItem> list;
String s = "";
String s;
HashMap<Integer, TreeItem> localRegs = new HashMap<Integer, TreeItem>();
int regCount = getRegisterCount();
int paramCount = 0;
int paramCount;
if (body.method_info != -1) {
MethodInfo mi = method_info[body.method_info];
paramCount = mi.param_types.length;
@@ -2120,7 +2110,7 @@ public class AVM2Code {
}
System.out.println("trueIndex:" + trueIndex);
System.out.println("falseIndex:" + falseIndex);
boolean found = false;
boolean found;
do {
found = false;
for (int ip = pos; ip < code.size(); ip++) {
@@ -2196,7 +2186,7 @@ public class AVM2Code {
}
} while (found);
} else {
isSecure = false;
//isSecure = false;
}
}

View File

@@ -99,7 +99,7 @@ public class InstructionDefinition {
protected String resolveMultinameNoPop(int pos, Stack<TreeItem> stack, ConstantPool constants, int multinameIndex, AVM2Instruction ins) {
String ns = "";
String name = "";
String name;
if (constants.constant_multiname[multinameIndex].needsNs()) {
ns = "[" + stack.get(pos) + "]";
pos++;

View File

@@ -38,12 +38,12 @@ public class ConstructIns extends InstructionDefinition {
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int argCount = (int) ((Long) arguments.get(0)).longValue();
/*int argCount = (int) ((Long) arguments.get(0)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object obj = lda.operandStack.pop();
Object obj = lda.operandStack.pop();*/
throw new RuntimeException("Cannot call constructor");
//call construct property of obj
//push new instance

View File

@@ -39,12 +39,12 @@ public class ConstructPropIns extends InstructionDefinition {
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
/*int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
}*/
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
throw new RuntimeException("Cannot construct property");

View File

@@ -38,12 +38,12 @@ public class ConstructSuperIns extends InstructionDefinition {
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int argCount = (int) ((Long) arguments.get(0)).longValue();
/*int argCount = (int) ((Long) arguments.get(0)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object obj = lda.operandStack.pop();
Object obj = lda.operandStack.pop();*/
throw new RuntimeException("Cannot call super constructor");
//call construct property of obj
//do not push anything

View File

@@ -38,13 +38,13 @@ public class CallIns extends InstructionDefinition {
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int argCount = (int) ((Long) arguments.get(0)).longValue();
/*int argCount = (int) ((Long) arguments.get(0)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object receiver = lda.operandStack.pop();
Object function = lda.operandStack.pop();
Object function = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown function");
//push(result)
}

View File

@@ -38,13 +38,13 @@ public class CallMethodIns extends InstructionDefinition {
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of object's method
/*int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of object's method
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object receiver = lda.operandStack.pop();
Object receiver = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown method");
//push(result)
}

View File

@@ -40,7 +40,7 @@ public class CallPropVoidIns extends InstructionDefinition {
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
//same as callproperty
/*
int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
@@ -49,7 +49,7 @@ public class CallPropVoidIns extends InstructionDefinition {
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
Object obj = lda.operandStack.pop();
Object obj = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown property");
//do not push anything
}

View File

@@ -39,7 +39,7 @@ public class CallPropertyIns extends InstructionDefinition {
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
/*int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
@@ -47,7 +47,7 @@ public class CallPropertyIns extends InstructionDefinition {
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
Object obj = lda.operandStack.pop();
Object obj = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown property");
//push(result)
}

View File

@@ -38,13 +38,13 @@ public class CallStaticIns extends InstructionDefinition {
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of method_info
/*int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of method_info
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object receiver = lda.operandStack.pop();
Object receiver = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown static method");
//push(result)
}

View File

@@ -39,7 +39,7 @@ public class CallSuperIns extends InstructionDefinition {
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
/*int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
@@ -47,7 +47,7 @@ public class CallSuperIns extends InstructionDefinition {
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
Object receiver = lda.operandStack.pop();
Object receiver = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown super method");
//push(result)
}

View File

@@ -39,7 +39,7 @@ public class CallSuperVoidIns extends InstructionDefinition {
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
/*int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
@@ -47,7 +47,7 @@ public class CallSuperVoidIns extends InstructionDefinition {
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
Object receiver = lda.operandStack.pop();
Object receiver = lda.operandStack.pop();*/
throw new RuntimeException("Call to unknown super method");
//do not push anything
}

View File

@@ -37,7 +37,7 @@ public class ConvertBIns extends InstructionDefinition implements CoerceOrConver
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object value = lda.operandStack.pop();
boolean bval = false;
boolean bval;
if (value instanceof Boolean) {
bval = (Boolean) value;
} else if (value instanceof Long) {
@@ -47,7 +47,7 @@ public class ConvertBIns extends InstructionDefinition implements CoerceOrConver
} else {
bval = true;
}
lda.operandStack.push(new Boolean(bval));
lda.operandStack.push((Boolean)bval);
}
@Override

View File

@@ -37,7 +37,7 @@ public class ConvertDIns extends InstructionDefinition implements CoerceOrConver
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object value = lda.operandStack.pop();
double ret = 0;
double ret;
if (value == null) {
ret = 0;
} else if (value instanceof Boolean) {

View File

@@ -37,7 +37,7 @@ public class ConvertIIns extends InstructionDefinition implements CoerceOrConver
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object value = lda.operandStack.pop();
long ret = 0;
long ret;
if (value == null) {
ret = 0;
} else if (value instanceof Boolean) {

View File

@@ -294,7 +294,7 @@ public class ASM3Parser {
for (LabelItem li : labelItems) {
if (oi.label.equals(li.label)) {
AVM2Instruction ins = code.code.get((int) oi.insPosition);
int relOffset = 0;
int relOffset;
if (oi instanceof CaseOffsetItem) {
relOffset = li.offset - (int) ins.offset;
} else {

View File

@@ -53,7 +53,7 @@ public class FullMultinameTreeItem extends TreeItem {
@Override
public String toString(ConstantPool constants, HashMap<Integer, String> localRegNames) {
String ret = "";
String ret;
if (name != null) {
ret = "[" + name.toString(constants, localRegNames) + "]";
} else {

View File

@@ -41,7 +41,7 @@ public class WithTreeItem extends TreeItem {
@Override
public String toString(ConstantPool constants, HashMap<Integer, String> localRegNames) {
String ret = "";
String ret;
ret = hilight("with(") + scope.toString(constants, localRegNames) + hilight(")\r\n{\r\n");
for (TreeItem ti : items) {
ret += ti.toString(constants, localRegNames) + "\r\n";

View File

@@ -39,7 +39,7 @@ public class IfTreeItem extends TreeItem implements Block {
@Override
public String toString(ConstantPool constants, HashMap<Integer, String> localRegNames) {
String ret = "";
String ret;
ret = hilight("if(") + expression.toString(constants, localRegNames) + hilight(")") + "\r\n{\r\n";
for (TreeItem ti : onTrue) {
ret += ti.toStringSemicoloned(constants, localRegNames) + "\r\n";

View File

@@ -90,7 +90,7 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane {
String text = getText();
int lineCnt = 1;
int lineStart = 0;
int lineEnd = -1;
int lineEnd;
int instrCount = 0;
int dot = -2;
for (int i = 0; i < text.length(); i++) {
@@ -111,7 +111,7 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane {
}
}
if (lineCnt == -1) {
lineEnd = text.length() - 1;
//lineEnd = text.length() - 1;
}
//select(lineStart, lineEnd);
setCaretPosition(lineStart);

View File

@@ -144,7 +144,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements MouseL
public void setClassIndex(int index, ABC abc) {
setText("//Please wait...");
String hilightedCode = "";
String hilightedCode;
if (!bufferedClasses.containsKey(index)) {
hilightedCode = abc.classToString(index, true, false);
highlights = Highlighting.getInstrHighlights(hilightedCode);

View File

@@ -100,7 +100,7 @@ public class GraphFrame extends JFrame {
return 1;
}
used.add(part);
if (part.nextParts.size() == 0) {
if (part.nextParts.isEmpty()) {
return 1;
}
int w = 0;

View File

@@ -67,7 +67,7 @@ public class MainFrame extends JFrame implements ActionListener, ItemListener {
statusLabel.setText(s);
}
public JTable autoResizeColWidth(JTable table, TableModel model) {
private JTable autoResizeColWidth(JTable table, TableModel model) {
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
table.setModel(model);
@@ -77,7 +77,7 @@ public class MainFrame extends JFrame implements ActionListener, ItemListener {
int vColIndex = i;
DefaultTableColumnModel colModel = (DefaultTableColumnModel) table.getColumnModel();
TableColumn col = colModel.getColumn(vColIndex);
int width = 0;
int width;
// Get width of column header
TableCellRenderer renderer = col.getHeaderRenderer();

View File

@@ -49,8 +49,8 @@ public class SlotConstTraitDetailPanel extends JPanel implements TraitDetail {
public void load(TraitSlotConst trait, ABC abc) {
this.abc = abc;
this.trait = trait;
String s = "";
String typeStr = "*";
String s;
String typeStr;
if (trait.type_index > 0) {
typeStr = "m[" + trait.type_index + "]\"" + Helper.escapeString(abc.constants.constant_multiname[trait.type_index].toString(abc.constants)) + "\"";
} else {

View File

@@ -85,7 +85,7 @@ public class UsageFrame extends JFrame implements ActionListener, MouseListener
}
if (usage instanceof TraitMultinameUsage) {
TraitMultinameUsage tmu = (TraitMultinameUsage) usage;
int traitIndex = 0;
int traitIndex;
if (tmu.parentTraitIndex > -1) {
traitIndex = tmu.parentTraitIndex;
} else {

View File

@@ -53,7 +53,7 @@ public class InstanceInfo {
if (super_index > 0) {
supIndexStr = " extends " + constants.constant_multiname[super_index].getName(constants);////+" flags="+flags+" protectedNS="+protectedNS+" interfaces="+Helper.intArrToString(interfaces)+" method_index="+iinit_index
}
String modifiers = "";
String modifiers;
Namespace ns = constants.constant_multiname[name_index].getNamespace(constants);
modifiers = ns.getPrefix(constants);
if (!modifiers.equals("")) {

View File

@@ -350,7 +350,7 @@ public class Action {
*/
public static String actionsToString(List<Action> list, List<Long> importantOffsets, List<String> constantPool, int version) {
String ret = "";
long offset = 0;
long offset;
if (importantOffsets == null) {
setActionsAddresses(list, 0, version);
importantOffsets = getActionsAllRefs(list, version);
@@ -437,7 +437,7 @@ public class Action {
*/
public static long ip2adr(List<Action> actions, int ip, int version) {
if (ip >= actions.size()) {
if (actions.size() == 0) {
if (actions.isEmpty()) {
return 0;
}
return actions.get(actions.size() - 1).getAddress() + actions.get(actions.size() - 1).getBytes(version).length;
@@ -715,7 +715,6 @@ public class Action {
if (!unknownJumps.contains(((ActionJump) action).getRef(version))) {
unknownJumps.add(((ActionJump) action).getRef(version));
}
ip = ip + 1;
break;
} else if (action instanceof ActionIf) {
@@ -776,7 +775,7 @@ public class Action {
try {
onTrue = actionsToTree(registerNames, unknownJumps, loopList, jumpsOrIfs, trueStack, constants, actions, ip + 1, jumpIp - 1 - (hasElse || isWhile || isForIn ? 1 : 0), version);
if (onTrue.size() == 0 && trueStack.size() > 0) {
if (onTrue.isEmpty() && trueStack.size() > 0) {
isTernar = true;
}
} catch (UnknownJumpException uje) {

View File

@@ -104,7 +104,7 @@ public class TagNode {
continue;
}
}
if (ret.get(i).subItems.size() == 0) {
if (ret.get(i).subItems.isEmpty()) {
ret.remove(i);
}
}

View File

@@ -43,6 +43,7 @@ public class ActionStrictMode extends Action {
mode = (int) lexLong(lexer);
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);

View File

@@ -50,6 +50,7 @@ public class ActionGetURL extends Action {
targetString = lexString(lexer);
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);

View File

@@ -47,6 +47,7 @@ public class ActionGoToLabel extends Action {
return "GoToLabel \"" + Helper.escapeString(label) + "\"";
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);

View File

@@ -43,6 +43,7 @@ public class ActionGotoFrame extends Action {
return "GotoFrame " + frame;
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);

View File

@@ -47,6 +47,7 @@ public class ActionSetTarget extends Action {
return "SetTarget \"" + Helper.escapeString(targetName) + "\"";
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);

View File

@@ -45,6 +45,7 @@ public class ActionWaitForFrame extends Action {
return "WaitForFrame " + frame + " " + skipCount;
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);

View File

@@ -50,6 +50,7 @@ public class ActionGetURL2 extends Action {
return "GetURL2 " + sendVarsMethod + " " + loadTargetFlag + " " + loadVariablesFlag;
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);

View File

@@ -45,6 +45,7 @@ public class ActionGotoFrame2 extends Action {
}
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);

View File

@@ -48,6 +48,7 @@ public class ActionIf extends Action {
return getAddress() + getBytes(version).length + offset;
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);

View File

@@ -48,6 +48,7 @@ public class ActionJump extends Action {
return getAddress() + getBytes(version).length + offset;
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);

View File

@@ -61,7 +61,7 @@ public class ActionPush extends Action {
values.add(new RegisterNumber(sis.readUI8()));
break;
case 5:
values.add(new Boolean(sis.readUI8() == 1));
values.add((Boolean)(sis.readUI8() == 1));
break;
case 6:
values.add(sis.readDOUBLE());
@@ -79,6 +79,7 @@ public class ActionPush extends Action {
}
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);
@@ -142,7 +143,7 @@ public class ActionPush extends Action {
switch (symb.type) {
case ParsedSymbol.TYPE_STRING:
count++;
if (constantPool.contains(symb.value)) {
if (constantPool.contains((String)symb.value)) {
values.add(new ConstantIndex(constantPool.indexOf(symb.value), constantPool));
} else {
values.add(symb.value);

View File

@@ -43,6 +43,7 @@ public class ActionWaitForFrame2 extends Action {
skipCount = (int) lexLong(lexer);
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);

View File

@@ -58,6 +58,7 @@ public class ActionConstantPool extends Action {
}
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);

View File

@@ -62,6 +62,7 @@ public class ActionDefineFunction extends Action {
code = ASMParser.parse(labels, address + getPreLen(version), lexer, constantPool, version);
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);

View File

@@ -44,6 +44,7 @@ public class ActionStoreRegister extends Action {
registerNumber = (int) lexLong(lexer);
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);

View File

@@ -52,6 +52,7 @@ public class ActionWith extends Action {
Action.setActionsAddresses(actions, address + 5, version);
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();

View File

@@ -92,6 +92,7 @@ public class ActionTry extends Action {
}
}
@Override
public byte[] getBytes(int version) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);

View File

@@ -48,6 +48,7 @@ public abstract class TreeItem {
public abstract String toString(ConstantPool constants);
@Override
public String toString() {
return toString(null);
}

View File

@@ -38,8 +38,8 @@ public class IfTreeItem extends TreeItem implements Block {
@Override
public String toString(ConstantPool constants) {
String ret = "";
ret = hilight("if(") + expression.toString(constants) + hilight(")\r\n{\r\n");
String ret;
ret = hilight("if(") + expression.toString(constants) + hilight(")")+"\r\n{\r\n";
for (TreeItem ti : onTrue) {
ret += ti.toString(constants) + "\r\n";
}

View File

@@ -41,7 +41,7 @@ public class WithTreeItem extends TreeItem {
@Override
public String toString(ConstantPool constants) {
String ret = "";
String ret;
ret = hilight("with(") + scope.toString(constants) + hilight(")\r\n{\r\n");
for (TreeItem ti : items) {
ret += ti.toString(constants) + "\r\n";

View File

@@ -48,6 +48,7 @@ public class LinkLabel extends JLabel {
/**
* Sets the text of the label.
*/
@Override
public void setText(String text) {
super.setText("<html><font color=\"#0000CF\"><u>" + text + "</u></font></html>");
this.text = text;
@@ -63,6 +64,7 @@ public class LinkLabel extends JLabel {
/**
* Processes mouse events and responds to clicks.
*/
@Override
protected void processMouseEvent(MouseEvent evt) {
super.processMouseEvent(evt);
if (evt.getID() == MouseEvent.MOUSE_CLICKED) {

View File

@@ -342,7 +342,7 @@ public class ProxyFrame extends JFrame implements ActionListener, CatchedListene
FileOutputStream fos = new FileOutputStream(f);
fos.write(hdr);
byte buf[] = new byte[2048];
int count = 0;
int count;
while ((count = data.read(buf)) > 0) {
fos.write(buf, 0, count);
}

View File

@@ -128,7 +128,7 @@ public class DefineButton2Tag extends Tag implements Container, TagName {
if (Main.DEBUG_COPY) {
sos = new SWFOutputStream(baos, version);
}
if ((actions == null) || (actions.size() == 0)) {
if ((actions == null) || (actions.isEmpty())) {
sos.writeUI16(0);
} else {
sos.writeUI16(2 + brdata.length);
@@ -169,6 +169,7 @@ public class DefineButton2Tag extends Tag implements Container, TagName {
return "DefineButton2Tag" + buttonId;
}
@Override
public String toString() {
String name = "";
for (ExportAssetsTag eat : exportAssetsTags) {

View File

@@ -102,6 +102,7 @@ public class DefineButtonTag extends Tag implements ASMSource, TagName {
return "DefineButtonTag" + buttonId;
}
@Override
public String toString() {
String name = "";
for (ExportAssetsTag eat : exportAssetsTags) {

View File

@@ -99,6 +99,7 @@ public class DefineSpriteTag extends Tag implements Container, TagName {
return "DefineSpriteTag" + spriteId;
}
@Override
public String toString() {
String name = "";
for (ExportAssetsTag eat : exportAssetsTags) {

View File

@@ -76,6 +76,7 @@ public class DoInitActionTag extends Tag implements ASMSource, TagName {
return baos.toByteArray();
}
@Override
public String toString() {
String name = "";
for (ExportAssetsTag eat : exportAssetsTags) {

View File

@@ -61,7 +61,7 @@ public class CLIPACTIONRECORD implements ASMSource {
* @return String representation of events
*/
public String getHeader() {
String ret = "";
String ret;
ret = eventFlags.toString();
if (eventFlags.clipEventKeyPress) {
ret = ret.replace("keyPress", "keyPress<" + keyCode + ">");