netbeans inpector fixes

This commit is contained in:
honfika@gmail.com
2016-04-29 20:54:38 +02:00
parent 577bdd4844
commit 508c618b37
37 changed files with 231 additions and 95 deletions

View File

@@ -36,7 +36,7 @@ import java.util.Map;
*/
public class ABCMethodIndexing {
private ABC abc;
private final ABC abc;
private Map<MethodInfo, Integer> bodyIdxFromMethod = new HashMap<>();

View File

@@ -193,10 +193,10 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.other2.MultiplyPIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.other2.NegatePIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.other2.PrologueIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.other2.PushConstantIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.other2.PushFloatIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.other2.PushDNanIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.other2.PushDecimalIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.other2.PushFloat4Ins;
import com.jpexs.decompiler.flash.abc.avm2.instructions.other2.PushFloatIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.other2.SendEnterIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.other2.SetPropertyLateIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.other2.Sf32x4Ins;
@@ -306,7 +306,6 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -427,6 +426,7 @@ public class AVM2Code implements Cloneable {
}
public static final InstructionDefinition[] instructionSet = new InstructionDefinition[256];
public static final InstructionDefinition[] allInstructionSet = new InstructionDefinition[]{
/*0x00*/null,
/*0x01*/ new BkptIns(),
@@ -480,7 +480,7 @@ public class AVM2Code implements Cloneable {
/*0x30*/ new PushScopeIns(),
/*0x31*/ new PushNamespaceIns(),
/*0x32*/ new HasNext2Ins(),
/*0x33*/ new PushDecimalIns(), //pushdecimal(minor 17), lix8 (internal-only) according to Tamarin
/*0x33*/ new PushDecimalIns(), //pushdecimal(minor 17), lix8 (internal-only) according to Tamarin
/*0x34*/ new PushDNanIns(), //pushdnan according to Flex SDK, lix16 (internal-only) according to Tamarin
/*0x35*/ new Li8Ins(),
/*0x36*/ new Li16Ins(),
@@ -717,6 +717,7 @@ public class AVM2Code implements Cloneable {
}
}
public static final String IDENTOPEN = "/*IDENTOPEN*/";
public static final String IDENTCLOSE = "/*IDENTCLOSE*/";
@@ -1637,7 +1638,7 @@ public class AVM2Code implements Cloneable {
}
}//*/
/*if ((ip + 2 < code.size()) && (ins.definition instanceof NewCatchIns)) { // Filling local register in catch clause
/*if ((ip + 2 < code.size()) && (ins.definition instanceof NewCatchIns)) { // Filling local register in catch clause
if (code.get(ip + 1).definition instanceof DupIns) {
if (code.get(ip + 2).definition instanceof SetLocalTypeIns) {
ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc, localRegNames, fullyQualifiedNames);

View File

@@ -16,6 +16,7 @@
*/
package com.jpexs.decompiler.flash.abc.avm2;
import com.jpexs.decompiler.flash.abc.ABCVersionRequirements;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions;
import com.jpexs.decompiler.flash.abc.types.Decimal;
@@ -37,7 +38,6 @@ import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jpexs.decompiler.flash.abc.ABCVersionRequirements;
/**
*

View File

@@ -87,7 +87,6 @@ import com.jpexs.decompiler.flash.abc.avm2.model.StringAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.UndefinedAVM2Item;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.flash.ecma.Null;
import com.jpexs.decompiler.flash.ecma.Undefined;
import com.jpexs.decompiler.flash.helpers.SWFDecompilerAdapter;
@@ -238,14 +237,14 @@ public class AVM2DeobfuscatorSimpleOld extends SWFDecompilerAdapter {
InstructionDefinition def = ins.definition;
//System.err.println("" + ins + " stack size:" + stack.size());
/*if (ins.definition instanceof NewFunctionIns) {
if (idx + 1 < code.code.size()) {
if (code.code.get(idx + 1).definition instanceof PopIns) {
code.removeInstruction(idx + 1, body);
code.removeInstruction(idx, body);
continue;
}
}
} else */
if (idx + 1 < code.code.size()) {
if (code.code.get(idx + 1).definition instanceof PopIns) {
code.removeInstruction(idx + 1, body);
code.removeInstruction(idx, body);
continue;
}
}
} else */
{
// do not throw EmptyStackException, much faster
int requiredStackSize = ins.getStackPopCount(localData);

View File

@@ -28,7 +28,6 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.other.ReturnVoidIns;
import com.jpexs.decompiler.flash.abc.avm2.instructions.other.ThrowIns;
import com.jpexs.decompiler.flash.abc.types.Float4;
import com.jpexs.decompiler.flash.abc.types.Multiname;
import com.jpexs.decompiler.flash.abc.types.Namespace;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.graph.DottedChain;
import com.jpexs.decompiler.graph.GraphSource;

View File

@@ -27,7 +27,6 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.NameValuePair;
import com.jpexs.decompiler.flash.abc.avm2.model.NewObjectAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.NullAVM2Item;
import com.jpexs.decompiler.flash.ecma.ArrayType;
import com.jpexs.decompiler.flash.ecma.ObjectType;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;

View File

@@ -28,13 +28,10 @@ import com.jpexs.decompiler.flash.abc.avm2.model.ScriptAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.ThisAVM2Item;
import com.jpexs.decompiler.flash.abc.types.Multiname;
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
import com.jpexs.decompiler.flash.abc.types.traits.TraitMethodGetterSetter;
import com.jpexs.decompiler.flash.ecma.Undefined;
import com.jpexs.decompiler.graph.DottedChain;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.NotCompileTimeItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.ArrayList;
import java.util.List;
/**

View File

@@ -29,7 +29,6 @@ import com.jpexs.decompiler.flash.abc.avm2.model.GetPropertyAVM2Item;
import com.jpexs.decompiler.flash.abc.types.Multiname;
import com.jpexs.decompiler.flash.ecma.ArrayType;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.flash.ecma.EcmaType;
import com.jpexs.decompiler.flash.ecma.ObjectType;
import com.jpexs.decompiler.flash.ecma.Undefined;
import com.jpexs.decompiler.graph.GraphTargetItem;

View File

@@ -17,8 +17,6 @@
package com.jpexs.decompiler.flash.abc.avm2.instructions.other2;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.LocalDataArea;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2InstructionFlag;
import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;

View File

@@ -26,7 +26,6 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.operations.AsTypeAVM2Item;
import com.jpexs.decompiler.flash.ecma.NotCompileTime;
import com.jpexs.decompiler.graph.DottedChain;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TranslateStack;
import java.util.ArrayList;

View File

@@ -16,24 +16,18 @@
*/
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.graph.model.Callable;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TypeItem;
import com.jpexs.decompiler.graph.model.Callable;
import com.jpexs.decompiler.graph.model.LocalData;
import com.jpexs.helpers.utf8.Utf8Helper;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*

View File

@@ -24,7 +24,6 @@ import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.TypeItem;
import com.jpexs.decompiler.graph.model.LocalData;
import java.util.ArrayList;
/**
*
@@ -33,7 +32,8 @@ import java.util.ArrayList;
public class GetLexAVM2Item extends AVM2Item {
public Multiname propertyName;
private DottedChain fullPropertyName;
private final DottedChain fullPropertyName;
public GetLexAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, Multiname propertyName, AVM2ConstantPool constants) {
super(instruction, lineStartIns, PRECEDENCE_PRIMARY);

View File

@@ -27,7 +27,6 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.SourceGenerator;
import com.jpexs.decompiler.graph.TypeItem;
import com.jpexs.decompiler.graph.model.LocalData;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

View File

@@ -1,6 +1,5 @@
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.graph.model.Callable;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
@@ -18,6 +17,7 @@ import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.SourceGenerator;
import com.jpexs.decompiler.graph.TypeItem;
import com.jpexs.decompiler.graph.model.Callable;
import com.jpexs.decompiler.graph.model.LocalData;
import com.jpexs.helpers.Helper;
import java.util.ArrayList;

View File

@@ -17,7 +17,6 @@
package com.jpexs.decompiler.flash.abc.avm2.model;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions;
import com.jpexs.decompiler.flash.abc.types.Multiname;
@@ -41,7 +40,9 @@ import java.util.Set;
public class ThisAVM2Item extends AVM2Item {
public DottedChain className;
public boolean basicObject;
public Multiname classMultiname;
public ThisAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, Multiname classMultiname, DottedChain className, boolean basicObject) {

View File

@@ -22,7 +22,6 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions;
import com.jpexs.decompiler.flash.ecma.Undefined;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.graph.CompilationException;
import com.jpexs.decompiler.graph.DottedChain;
import com.jpexs.decompiler.graph.GraphSourceItem;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.SimpleValue;

View File

@@ -18,8 +18,6 @@ package com.jpexs.decompiler.flash.abc.avm2.model.clauses;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
import com.jpexs.decompiler.flash.abc.avm2.model.InAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.LocalRegAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.model.SetTypeAVM2Item;
import com.jpexs.decompiler.flash.abc.avm2.parser.script.AVM2SourceGenerator;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.LoopWithType;
@@ -62,39 +60,39 @@ public class ForEachInAVM2Item extends LoopItem implements Block {
super(instruction, lineStartIns, loop);
/*
Following was commented out:
The code should fix following:
for each (var a in col)
{
var b = a; //a is temp reg
trace(b);
}
but fails for following:
for each (var a in col)
{
c[a] = a;
}
*/
/*
if (!commands.isEmpty()) {
GraphTargetItem firstAssign = commands.get(0);
if (firstAssign instanceof SetTypeAVM2Item) {
if (expression.object instanceof LocalRegAVM2Item) {
if (((SetTypeAVM2Item) firstAssign).getValue().getNotCoerced() instanceof LocalRegAVM2Item) {
if (((LocalRegAVM2Item) ((SetTypeAVM2Item) firstAssign).getValue().getNotCoerced()).regIndex == ((LocalRegAVM2Item) expression.object).regIndex) {
commands.remove(0);
expression.object = ((SetTypeAVM2Item) firstAssign).getObject();
}
}
Following was commented out:
}
//locAssign.
}
}*/
The code should fix following:
for each (var a in col)
{
var b = a; //a is temp reg
trace(b);
}
but fails for following:
for each (var a in col)
{
c[a] = a;
}
*/
/*
if (!commands.isEmpty()) {
GraphTargetItem firstAssign = commands.get(0);
if (firstAssign instanceof SetTypeAVM2Item) {
if (expression.object instanceof LocalRegAVM2Item) {
if (((SetTypeAVM2Item) firstAssign).getValue().getNotCoerced() instanceof LocalRegAVM2Item) {
if (((LocalRegAVM2Item) ((SetTypeAVM2Item) firstAssign).getValue().getNotCoerced()).regIndex == ((LocalRegAVM2Item) expression.object).regIndex) {
commands.remove(0);
expression.object = ((SetTypeAVM2Item) firstAssign).getObject();
}
}
}
//locAssign.
}
}*/
this.expression = expression;
this.commands = commands;
}

View File

@@ -2236,7 +2236,7 @@ public class ActionScript3Parser {
case REGEXP:
String p = (String) s.value;
p = p.substring(1);
int spos = p.lastIndexOf("/");
int spos = p.lastIndexOf('/');
String mod = p.substring(spos + 1);
p = p.substring(0, spos);
p = p.replace("\\/", "/");

View File

@@ -133,7 +133,7 @@ public class Namespace {
if (name == null) {
return false;
}
if (name.equals("") && name_index == 0) {
if (name.isEmpty() && name_index == 0) {
return true;
}
if (name_index == 0) {

View File

@@ -67,6 +67,7 @@ public class ActionListReader {
* @param ip
* @param endIp
* @param path
* @param deobfuscationMode
* @return List of actions
* @throws IOException
* @throws java.lang.InterruptedException

View File

@@ -35,7 +35,7 @@ import java.util.Random;
*/
public class RandomNumberActionItem extends ActionItem {
private static Random rnd = new Random();
private static final Random rnd = new Random();
public RandomNumberActionItem(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem maximum) {
super(instruction, lineStartIns, PRECEDENCE_PRIMARY, maximum);

View File

@@ -116,8 +116,8 @@ public class ActionGotoFrame2 extends Action {
String frame = EcmaScript.toString(lda.stack.pop());
String target = "/";
if (frame.contains(":")) {
target = frame.substring(0, frame.indexOf(":"));
frame = frame.substring(frame.indexOf(":") + 1);
target = frame.substring(0, frame.indexOf(':'));
frame = frame.substring(frame.indexOf(':') + 1);
}
if (frame.matches("[1-9][0-9]*|0")) {
int frameNum = Integer.parseInt(frame);

View File

@@ -51,7 +51,7 @@ public class ActionInitObject extends Action {
return false;
}
int num = (int) (double) (Double) lda.popAsNumber();
int num = (int) (double) lda.popAsNumber();
if (lda.stack.size() < 2 * num) {
return false;
}

View File

@@ -52,7 +52,7 @@ public class ActionNewObject extends Action {
}
String objectName = lda.popAsString();
int numArgs = (int) (double) (Double) lda.popAsNumber();
int numArgs = (int) (double) lda.popAsNumber();
if (lda.stack.size() < numArgs) {
return false;
}

View File

@@ -1038,6 +1038,7 @@ public class EcmaFloatingDecimal {
// Per-thread buffer for string/stringbuffer conversion
private static ThreadLocal perThreadBuffer = new ThreadLocal() {
@Override
protected synchronized Object initialValue() {
return new char[26];
}
@@ -1657,6 +1658,7 @@ class FDBigInt {
return ((long) (data[1]) << 32) | ((long) data[0] & 0xffffffffL);
}
@Override
public String toString() {
StringBuffer r = new StringBuffer(30);
r.append('[');

View File

@@ -29,7 +29,7 @@ public enum EcmaType {
OBJECT("Object"),
BOOLEAN("Boolean");
private String clsName;
private final String clsName;
private EcmaType(String clsName) {
this.clsName = clsName;

View File

@@ -56,7 +56,7 @@ public abstract class GraphTextWriter {
* Highlights specified text as instruction
*
* @param src
* @param firstLineItem
* @param startLineItem
* @param pos Offset of instruction
* @param data
* @return GraphTextWriter

View File

@@ -80,6 +80,7 @@ public class HighlightedTextWriter extends GraphTextWriter {
* Highlights specified text as instruction by adding special tags
*
* @param src
* @param startLineItem
* @param pos Offset of instruction
* @param data
* @return HighlightedTextWriter

View File

@@ -50,7 +50,7 @@ public class MD5Crypt {
String checksum = hash.substring(magic.length());
String salt = "";
if (checksum.contains("$")) {
salt = checksum.substring(0, checksum.indexOf("$"));
salt = checksum.substring(0, checksum.indexOf('$'));
}
return hash.equals(crypt(password, salt, magic));
}

View File

@@ -28,17 +28,12 @@ import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.IndexColorModel;
import java.awt.image.VolatileImage;
import java.awt.image.WritableRaster;
import java.io.File;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Hashtable;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
/**
*