use diamond

This commit is contained in:
honfika@gmail.com
2015-07-05 21:34:49 +02:00
parent 8928a3c9ee
commit bf2c6cb822
37 changed files with 160 additions and 158 deletions

View File

@@ -1119,6 +1119,7 @@ public final class SWF implements SWFContainerItem, Timelined {
*
* @param fis Input stream
* @param fos Output stream
* @param compression
* @return True on success
*/
public static boolean compress(InputStream fis, OutputStream fos, SWFCompression compression) {
@@ -1683,11 +1684,11 @@ public final class SWF implements SWFContainerItem, Timelined {
ip = nextip;
}
List<List<GraphTargetItem>> r = new ArrayList<>();
r.add(new ArrayList<GraphTargetItem>());
r.add(new ArrayList<GraphTargetItem>());
r.add(new ArrayList<GraphTargetItem>());
r.add(new ArrayList<>());
r.add(new ArrayList<>());
r.add(new ArrayList<>());
try {
((GraphSourceItemContainer) ins).translateContainer(r, stack, output, new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>());
((GraphSourceItemContainer) ins).translateContainer(r, stack, output, new HashMap<>(), new HashMap<>(), new HashMap<>());
} catch (EmptyStackException ex) {
}
@@ -1777,14 +1778,14 @@ public final class SWF implements SWFContainerItem, Timelined {
private static void getVariables(List<MyEntry<DirectValueActionItem, ConstantPool>> variables, List<GraphSourceItem> functions, HashMap<DirectValueActionItem, ConstantPool> strings, HashMap<DirectValueActionItem, String> usageTypes, ActionGraphSource code, int addr, String path) throws InterruptedException {
ActionLocalData localData = new ActionLocalData();
getVariables(null, localData, new TranslateStack(path), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), variables, functions, strings, new ArrayList<Integer>(), usageTypes, path);
getVariables(null, localData, new TranslateStack(path), new ArrayList<>(), code, code.adr2pos(addr), variables, functions, strings, new ArrayList<>(), usageTypes, path);
}
private List<MyEntry<DirectValueActionItem, ConstantPool>> getVariables(List<MyEntry<DirectValueActionItem, ConstantPool>> variables, HashMap<ASMSource, ActionList> actionsMap, List<GraphSourceItem> functions, HashMap<DirectValueActionItem, ConstantPool> strings, HashMap<DirectValueActionItem, String> usageTypes, ASMSource src, String path) throws InterruptedException {
List<MyEntry<DirectValueActionItem, ConstantPool>> ret = new ArrayList<>();
ActionList actions = src.getActions();
actionsMap.put(src, actions);
getVariables(variables, functions, strings, usageTypes, new ActionGraphSource(actions, version, new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>()), 0, path);
getVariables(variables, functions, strings, usageTypes, new ActionGraphSource(actions, version, new HashMap<>(), new HashMap<>(), new HashMap<>()), 0, path);
return ret;
}
@@ -1856,7 +1857,7 @@ public final class SWF implements SWFContainerItem, Timelined {
sc.setModified(true);
}
}
deobfuscation.deobfuscateInstanceNames(true, deobfuscated, renameType, tags, new HashMap<String, String>());
deobfuscation.deobfuscateInstanceNames(true, deobfuscated, renameType, tags, new HashMap<>());
return deobfuscated.size();
}

View File

@@ -674,7 +674,7 @@ public class AVM2Code implements Cloneable {
}
public void calculateDebugFileLine(ABC abc) {
calculateDebugFileLine(null, 0, 0, abc, new HashSet<Integer>());
calculateDebugFileLine(null, 0, 0, abc, new HashSet<>());
}
private boolean calculateDebugFileLine(String debugFile, int debugLine, int pos, ABC abc, Set<Integer> seen) {
@@ -701,7 +701,7 @@ public class AVM2Code implements Cloneable {
//This avoids bogus functions used in obfuscation or special compilers that can lead to infinite recursion.
if ((pos + 1 < code.size()) && !(code.get(pos + 1).definition instanceof PopIns)) {
MethodBody innerBody = abc.findBody(ins.operands[0]);
innerBody.getCode().calculateDebugFileLine(debugFile, debugLine, 0, abc, new HashSet<Integer>());
innerBody.getCode().calculateDebugFileLine(debugFile, debugLine, 0, abc, new HashSet<>());
}
}
@@ -1355,7 +1355,7 @@ public class AVM2Code implements Cloneable {
if (code.get(k).definition instanceof KillIns) {
int regid = code.get(k).operands[0];
if (!killedRegs.containsKey(regid)) {
killedRegs.put(regid, new HashSet<Integer>());
killedRegs.put(regid, new HashSet<>());
}
killedRegs.get(regid).add(k);
}
@@ -1890,7 +1890,7 @@ public class AVM2Code implements Cloneable {
}
}
// Declarations
injectDeclarations(list, new boolean[regCount], new ArrayList<Slot>(), abc, body);
injectDeclarations(list, new boolean[regCount], new ArrayList<>(), abc, body);
int lastPos = list.size() - 1;
if (lastPos < 0) {
@@ -2205,7 +2205,7 @@ public class AVM2Code implements Cloneable {
localData.refs = refs;
localData.code = this;
int ret = 0;
ret += removeTraps(constants, trait, info, body, localData, new AVM2GraphSource(this, false, -1, -1, new HashMap<Integer, GraphTargetItem>(), new ScopeStack(), abc, body, new HashMap<Integer, String>(), new ArrayList<>(), new HashMap<Integer, Integer>(), refs), 0, path, refs);
ret += removeTraps(constants, trait, info, body, localData, new AVM2GraphSource(this, false, -1, -1, new HashMap<>(), new ScopeStack(), abc, body, new HashMap<>(), new ArrayList<>(), new HashMap<>(), refs), 0, path, refs);
removeIgnored(constants, trait, info, body);
removeDeadCode(constants, trait, info, body);
@@ -2928,7 +2928,7 @@ public class AVM2Code implements Cloneable {
}
public static boolean isDirectAncestor(int currentIp, int ancestor, HashMap<Integer, List<Integer>> refs) {
return isDirectAncestor(currentIp, ancestor, refs, new ArrayList<Integer>());
return isDirectAncestor(currentIp, ancestor, refs, new ArrayList<>());
}
private static boolean isDirectAncestor(int currentIp, int ancestor, HashMap<Integer, List<Integer>> refs, List<Integer> visited) {
@@ -3250,7 +3250,7 @@ public class AVM2Code implements Cloneable {
public static int removeTraps(AVM2ConstantPool constants, Trait trait, MethodInfo info, MethodBody body, AVM2LocalData localData, AVM2GraphSource code, int addr, String path, HashMap<Integer, List<Integer>> refs) throws InterruptedException {
HashMap<AVM2Instruction, AVM2Code.Decision> decisions = new HashMap<>();
removeTraps(refs, false, false, localData, new TranslateStack(path), new ArrayList<GraphTargetItem>(), code, code.adr2pos(addr), new HashMap<Integer, Integer>(), new HashMap<Integer, HashMap<Integer, GraphTargetItem>>(), decisions, path, 0);
removeTraps(refs, false, false, localData, new TranslateStack(path), new ArrayList<>(), code, code.adr2pos(addr), new HashMap<>(), new HashMap<>(), decisions, path, 0);
int cnt = 0;
for (AVM2Instruction src : decisions.keySet()) {
Decision dec = decisions.get(src);

View File

@@ -314,7 +314,7 @@ public class AVM2ConstantPool {
}
public int getQnameId(String name, int namespaceKind, String namespaceName, boolean add) {
return getMultinameId(new Multiname(Multiname.QNAME, getStringId(name, add), getNamespaceId(new Namespace(namespaceKind, getStringId(namespaceName, add)), 0, add), 0, 0, new ArrayList<Integer>()), add);
return getMultinameId(new Multiname(Multiname.QNAME, getStringId(name, add), getNamespaceId(new Namespace(namespaceKind, getStringId(namespaceName, add)), 0, add), 0, 0, new ArrayList<>()), add);
}
public int getPublicQnameId(String name, boolean add) {

View File

@@ -348,7 +348,7 @@ public class AVM2Graph extends Graph {
if (!ncatchedCommands.isEmpty() && (ncatchedCommands.get(0) instanceof SetLocalAVM2Item)) {
SetLocalAVM2Item sl = (SetLocalAVM2Item) ncatchedCommands.get(0);
if (sl.value.getNotCoerced() instanceof ExceptionAVM2Item) {
finCatchName = AVM2Item.localRegName(new HashMap<Integer, String>(), sl.regIndex);
finCatchName = AVM2Item.localRegName(new HashMap<>(), sl.regIndex);
}
}
}
@@ -515,7 +515,7 @@ public class AVM2Graph extends Graph {
if (ins.definition instanceof LookupSwitchIns) {
break;
}
ins.translate(localData, sstack, new ArrayList<GraphTargetItem>(), staticOperation, path);
ins.translate(localData, sstack, new ArrayList<>(), staticOperation, path);
}
if (numPart.nextParts.size() > 1) {
break;
@@ -556,7 +556,7 @@ public class AVM2Graph extends Graph {
if (ins.definition instanceof LookupSwitchIns) {
break;
}
ins.translate(localData, sstack, new ArrayList<GraphTargetItem>(), staticOperation, path);
ins.translate(localData, sstack, new ArrayList<>(), staticOperation, path);
}
if (numPart.nextParts.size() > 1) {
break;

View File

@@ -142,7 +142,7 @@ public class InstructionDefinition implements Serializable {
protected boolean isRegisterCompileTime(int regId, int ip, HashMap<Integer, List<Integer>> refs, AVM2Code code) {
Set<Integer> previous = new HashSet<>();
AVM2Code.getPreviousReachableIps(ip, refs, previous, new HashSet<Integer>());
AVM2Code.getPreviousReachableIps(ip, refs, previous, new HashSet<>());
for (int p : previous) {
if (p < 0) {
continue;

View File

@@ -104,8 +104,8 @@ public class InitVectorAVM2Item extends AVM2Item {
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
AVM2SourceGenerator g = (AVM2SourceGenerator) generator;
List<GraphSourceItem> ret = toSourceMerge(localData, generator,
ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.MULTINAME, g.abc.constants.getStringId("Vector", true), 0, g.abc.constants.getNamespaceSetId(new NamespaceSet(new int[]{g.abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, g.abc.constants.getStringId("__AS3__.vec", true)), 0, true)}), true), 0, new ArrayList<Integer>()), true)),
ins(new GetPropertyIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.MULTINAME, g.abc.constants.getStringId("Vector", true), 0, allNsSet(g.abc), 0, new ArrayList<Integer>()), true)),
ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.MULTINAME, g.abc.constants.getStringId("Vector", true), 0, g.abc.constants.getNamespaceSetId(new NamespaceSet(new int[]{g.abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, g.abc.constants.getStringId("__AS3__.vec", true)), 0, true)}), true), 0, new ArrayList<>()), true)),
ins(new GetPropertyIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.MULTINAME, g.abc.constants.getStringId("Vector", true), 0, allNsSet(g.abc), 0, new ArrayList<>()), true)),
subtype,
ins(new ApplyTypeIns(), 1),
new IntegerValueAVM2Item(null, (long) arguments.size()),

View File

@@ -75,11 +75,11 @@ public class DeletePropertyAVM2Item extends AVM2Item {
}
if (p instanceof IndexAVM2Item) {
IndexAVM2Item ind = (IndexAVM2Item) p;
return ind.toSource(localData, generator, true, false, new ArrayList<GraphTargetItem>(), true, false);
return ind.toSource(localData, generator, true, false, new ArrayList<>(), true, false);
}
if (p instanceof NamespacedAVM2Item) {
NamespacedAVM2Item n = (NamespacedAVM2Item) p;
return n.toSource(localData, generator, true, false, new ArrayList<GraphTargetItem>(), true, false);
return n.toSource(localData, generator, true, false, new ArrayList<>(), true, false);
}
throw new CompilationException("Not a property", line); //TODO: handle line better way

View File

@@ -184,7 +184,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
return GraphTargetItem.toSourceMerge(localData, this,
item.object,
ins(new GetDescendantsIns(), abc.constants.getMultinameId(new Multiname(Multiname.MULTINAME, abc.constants.getStringId(item.nameStr, true), 0, nsset, 0, new ArrayList<Integer>()), true))
ins(new GetDescendantsIns(), abc.constants.getMultinameId(new Multiname(Multiname.MULTINAME, abc.constants.getStringId(item.nameStr, true), 0, nsset, 0, new ArrayList<>()), true))
);
}
@@ -327,7 +327,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
ins(new CheckFilterIns()),
NameAVM2Item.generateCoerce(localData, this, TypeItem.UNBOUNDED),
AssignableAVM2Item.setTemp(localData, this, collectionReg),
ins(new GetLexIns(), abc.constants.getMultinameId(new Multiname(Multiname.QNAME, abc.constants.getStringId("XMLList", true), abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.getStringId("", true)), 0, true), 0, 0, new ArrayList<Integer>()), true)),
ins(new GetLexIns(), abc.constants.getMultinameId(new Multiname(Multiname.QNAME, abc.constants.getStringId("XMLList", true), abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.getStringId("", true)), 0, true), 0, 0, new ArrayList<>()), true)),
ins(new PushStringIns(), abc.constants.getStringId("", true)),
ins(new ConstructIns(), 1),
xmlListSetTemp
@@ -354,7 +354,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
for (int i = 0; i < item.openedNamespaces.size(); i++) {
nss[i] = item.openedNamespaces.get(i);
}
trueBody.add(ins(new SetPropertyIns(), abc.constants.getMultinameId(new Multiname(Multiname.MULTINAMEL, 0, 0, abc.constants.getNamespaceSetId(new NamespaceSet(nss), true), 0, new ArrayList<Integer>()), true)));
trueBody.add(ins(new SetPropertyIns(), abc.constants.getMultinameId(new Multiname(Multiname.MULTINAMEL, 0, 0, abc.constants.getNamespaceSetId(new NamespaceSet(nss), true), 0, new ArrayList<>()), true)));
forBody.add(ins(new IfFalseIns(), insToBytes(trueBody).length));
forBody.addAll(trueBody);
forBody.add(ins(new PopScopeIns()));
@@ -725,14 +725,14 @@ public class AVM2SourceGenerator implements SourceGenerator {
ret.add(ins(new NewObjectIns(), 0));
ret.add(ins(new PushWithIns()));
scope = localData.scopeStack.size();
localData.scopeStack.add(new PropertyAVM2Item(null, item.functionName, abc, allABCs, new ArrayList<Integer>(), localData.callStack));
localData.scopeStack.add(new PropertyAVM2Item(null, item.functionName, abc, allABCs, new ArrayList<>(), localData.callStack));
}
ret.add(ins(new NewFunctionIns(), method(true, false, localData.callStack, localData.pkg, item.needsActivation, item.subvariables, 0 /*Set later*/, item.hasRest, item.line, localData.currentClass, null, false, localData, item.paramTypes, item.paramNames, item.paramValues, item.body, item.retType)));
if (!item.functionName.isEmpty()) {
ret.add(ins(new DupIns()));
ret.add(ins(new GetScopeObjectIns(), scope));
ret.add(ins(new SwapIns()));
ret.add(ins(new SetPropertyIns(), abc.constants.getMultinameId(new Multiname(Multiname.QNAME, abc.constants.getStringId(item.functionName, true), abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.getStringId(localData.pkg, true)), 0, true), 0, 0, new ArrayList<Integer>()), true)));
ret.add(ins(new SetPropertyIns(), abc.constants.getMultinameId(new Multiname(Multiname.QNAME, abc.constants.getStringId(item.functionName, true), abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.getStringId(localData.pkg, true)), 0, true), 0, 0, new ArrayList<>()), true)));
ret.add(ins(new PopScopeIns()));
localData.scopeStack.remove(localData.scopeStack.size() - 1);
}
@@ -754,7 +754,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
int finallyEx = -1;
for (NameAVM2Item e : item.catchExceptions2) {
ABCException aex = new ABCException();
aex.name_index = abc.constants.getMultinameId(new Multiname(Multiname.QNAME, abc.constants.getStringId(e.getVariableName(), true), abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.getStringId("", true)), 0, true), 0, 0, new ArrayList<Integer>()), true);
aex.name_index = abc.constants.getMultinameId(new Multiname(Multiname.QNAME, abc.constants.getStringId(e.getVariableName(), true), abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.getStringId("", true)), 0, true), 0, 0, new ArrayList<>()), true);
aex.type_index = typeName(localData, e.type);
newex.add(aex);
}
@@ -1210,18 +1210,18 @@ public class AVM2SourceGenerator implements SourceGenerator {
Trait[] st = generateTraitsPhase1(name, superName, true, localData, traitItems, classInfo.static_traits, class_index);
generateTraitsPhase2(importedClasses, pkg, traitItems, it, openedNamespaces, localData);
generateTraitsPhase2(importedClasses, pkg, traitItems, st, openedNamespaces, localData);
generateTraitsPhase3(initScope, isInterface, name, superName, false, localData, traitItems, instanceInfo.instance_traits, it, new HashMap<Trait, Integer>(), class_index);
generateTraitsPhase3(initScope, isInterface, name, superName, true, localData, traitItems, classInfo.static_traits, st, new HashMap<Trait, Integer>(), class_index);
generateTraitsPhase3(initScope, isInterface, name, superName, false, localData, traitItems, instanceInfo.instance_traits, it, new HashMap<>(), class_index);
generateTraitsPhase3(initScope, isInterface, name, superName, true, localData, traitItems, classInfo.static_traits, st, new HashMap<>(), class_index);
int init = 0;
if (constructor == null || isInterface) {
instanceInfo.iinit_index = init = method(false, isInterface, new ArrayList<MethodBody>(), pkg, false, new ArrayList<AssignableAVM2Item>(), initScope + 1, false, 0, isInterface ? null : name, extendsVal != null ? extendsVal.toString() : null, true, localData, new ArrayList<GraphTargetItem>(), new ArrayList<>(), new ArrayList<GraphTargetItem>(), new ArrayList<GraphTargetItem>(), TypeItem.UNBOUNDED/*?? FIXME*/);
instanceInfo.iinit_index = init = method(false, isInterface, new ArrayList<>(), pkg, false, new ArrayList<>(), initScope + 1, false, 0, isInterface ? null : name, extendsVal != null ? extendsVal.toString() : null, true, localData, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), TypeItem.UNBOUNDED/*?? FIXME*/);
} else {
MethodAVM2Item m = (MethodAVM2Item) constructor;
instanceInfo.iinit_index = init = method(false, false, new ArrayList<MethodBody>(), pkg, m.needsActivation, m.subvariables, initScope + 1, m.hasRest, m.line, name, extendsVal != null ? extendsVal.toString() : null, true, localData, m.paramTypes, m.paramNames, m.paramValues, m.body, TypeItem.UNBOUNDED/*?? FIXME*/);
instanceInfo.iinit_index = init = method(false, false, new ArrayList<>(), pkg, m.needsActivation, m.subvariables, initScope + 1, m.hasRest, m.line, name, extendsVal != null ? extendsVal.toString() : null, true, localData, m.paramTypes, m.paramNames, m.paramValues, m.body, TypeItem.UNBOUNDED/*?? FIXME*/);
}
//Class initializer
int staticMi = method(false, false, new ArrayList<MethodBody>(), pkg, staticNeedsActivation, sinitVariables, initScope + (implementsStr.isEmpty() ? 0 : 1), false, 0, isInterface ? null : name, superName, false, localData, new ArrayList<GraphTargetItem>(), new ArrayList<>(), new ArrayList<GraphTargetItem>(), staticInit, TypeItem.UNBOUNDED);
int staticMi = method(false, false, new ArrayList<>(), pkg, staticNeedsActivation, sinitVariables, initScope + (implementsStr.isEmpty() ? 0 : 1), false, 0, isInterface ? null : name, superName, false, localData, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), staticInit, TypeItem.UNBOUNDED);
MethodBody sinitBody = abc.findBody(staticMi);
List<AVM2Instruction> sinitcode = new ArrayList<>();
@@ -1320,14 +1320,14 @@ public class AVM2SourceGenerator implements SourceGenerator {
InterfaceAVM2Item iai = (InterfaceAVM2Item) cls;
ii.flags |= InstanceInfo.CLASS_INTERFACE;
ii.flags |= InstanceInfo.CLASS_SEALED;
generateClass(iai.importedClasses, new ArrayList<AssignableAVM2Item>(), false, new ArrayList<GraphTargetItem>(), iai.openedNamespaces, namespace, initScope, pkg, ci, ii, localData, true, iai.name, null, null, iai.superInterfaces, null, iai.methods, class_index);
generateClass(iai.importedClasses, new ArrayList<>(), false, new ArrayList<>(), iai.openedNamespaces, namespace, initScope, pkg, ci, ii, localData, true, iai.name, null, null, iai.superInterfaces, null, iai.methods, class_index);
}
return abc.instance_info.size() - 1;
}
public int traitName(int namespace, String var) {
return abc.constants.getMultinameId(new Multiname(Multiname.QNAME, str(var), namespace, 0, 0, new ArrayList<Integer>()), true);
return abc.constants.getMultinameId(new Multiname(Multiname.QNAME, str(var), namespace, 0, 0, new ArrayList<>()), true);
}
public int typeName(SourceGeneratorLocalData localData, GraphTargetItem type) throws CompilationException {
@@ -1376,7 +1376,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
public int propertyName(GraphTargetItem name) {
if (name instanceof NameAVM2Item) {
NameAVM2Item va = (NameAVM2Item) name;
return abc.constants.getMultinameId(new Multiname(Multiname.QNAME, str(va.getVariableName()), namespace(Namespace.KIND_PACKAGE, ""), 0, 0, new ArrayList<Integer>()), true);
return abc.constants.getMultinameId(new Multiname(Multiname.QNAME, str(va.getVariableName()), namespace(Namespace.KIND_PACKAGE, ""), 0, 0, new ArrayList<>()), true);
}
throw new RuntimeException("no prop"); //FIXME
}
@@ -1408,7 +1408,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
public int method(boolean subMethod, boolean isInterface, List<MethodBody> callStack, String pkg, boolean needsActivation, List<AssignableAVM2Item> subvariables, int initScope, boolean hasRest, int line, String className, String superType, boolean constructor, SourceGeneratorLocalData localData, List<GraphTargetItem> paramTypes, List<String> paramNames, List<GraphTargetItem> paramValues, List<GraphTargetItem> body, GraphTargetItem retType) throws CompilationException {
//Reference<Boolean> hasArgs = new Reference<>(Boolean.FALSE);
//calcRegisters(localData,needsActivation,paramNames,subvariables,body, hasArgs);
SourceGeneratorLocalData newlocalData = new SourceGeneratorLocalData(new HashMap<String, Integer>(), 1, true, 0);
SourceGeneratorLocalData newlocalData = new SourceGeneratorLocalData(new HashMap<>(), 1, true, 0);
newlocalData.currentClass = className;
newlocalData.pkg = localData.pkg;
newlocalData.callStack.addAll(localData.callStack);
@@ -1672,14 +1672,14 @@ public class AVM2SourceGenerator implements SourceGenerator {
for (int i = 1; i < slotNames.size(); i++) {
TraitSlotConst tsc = new TraitSlotConst();
tsc.slot_id = slotId++;
tsc.name_index = abc.constants.getMultinameId(new Multiname(Multiname.QNAME, abc.constants.getStringId(slotNames.get(i), true), abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE_INTERNAL, abc.constants.getStringId(pkg, true)), 0, true), 0, 0, new ArrayList<Integer>()), true);
tsc.name_index = abc.constants.getMultinameId(new Multiname(Multiname.QNAME, abc.constants.getStringId(slotNames.get(i), true), abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE_INTERNAL, abc.constants.getStringId(pkg, true)), 0, true), 0, 0, new ArrayList<>()), true);
tsc.type_index = typeName(localData, new TypeItem(slotTypes.get(i)));
mbody.traits.traits.add(tsc);
}
for (int i = 1; i < paramRegCount; i++) {
NameAVM2Item param = new NameAVM2Item(new TypeItem(registerTypes.get(i)), 0, registerNames.get(i), null, false, new ArrayList<Integer>());
NameAVM2Item param = new NameAVM2Item(new TypeItem(registerTypes.get(i)), 0, registerNames.get(i), null, false, new ArrayList<>());
param.setRegNumber(i);
NameAVM2Item d = new NameAVM2Item(new TypeItem(registerTypes.get(i)), 0, registerNames.get(i), param, true, new ArrayList<Integer>());
NameAVM2Item d = new NameAVM2Item(new TypeItem(registerTypes.get(i)), 0, registerNames.get(i), param, true, new ArrayList<>());
d.setSlotScope(slotScope);
d.setSlotNumber(slotNames.indexOf(registerNames.get(i)));
declarations.add(d);
@@ -1691,7 +1691,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
localData.exceptions = new ArrayList<>();
localData.callStack.add(mbody);
List<GraphSourceItem> src = body == null ? new ArrayList<GraphSourceItem>() : generate(localData, body);
List<GraphSourceItem> src = body == null ? new ArrayList<>() : generate(localData, body);
mbody.method_info = abc.addMethodInfo(mi);
mi.setBody(mbody);
@@ -1709,7 +1709,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
if (tsc.type_index > 0) {
type = new TypeItem(abc.constants.constant_multiname.get(tsc.type_index).getNameWithNamespace(abc.constants));
}
NameAVM2Item d = new NameAVM2Item(type, 0, tsc.getName(abc).getName(abc.constants, new ArrayList<>(), true), NameAVM2Item.getDefaultValue("" + type), true, new ArrayList<Integer>());
NameAVM2Item d = new NameAVM2Item(type, 0, tsc.getName(abc).getName(abc.constants, new ArrayList<>(), true), NameAVM2Item.getDefaultValue("" + type), true, new ArrayList<>());
d.setSlotNumber(tsc.slot_id);
d.setSlotScope(slotScope);
mbodyCode.addAll(0, toInsList(d.toSourceIgnoreReturnValue(localData, this)));
@@ -1870,9 +1870,9 @@ public class AVM2SourceGenerator implements SourceGenerator {
private int genNs(List<DottedChain> importedClasses, String pkg, String custom, int namespace, List<Integer> openedNamespaces, SourceGeneratorLocalData localData, int line) throws CompilationException {
if (custom != null) {
PropertyAVM2Item prop = new PropertyAVM2Item(null, custom, abc, allABCs, openedNamespaces, new ArrayList<MethodBody>());
PropertyAVM2Item prop = new PropertyAVM2Item(null, custom, abc, allABCs, openedNamespaces, new ArrayList<>());
Reference<ValueKind> value = new Reference<>(null);
prop.resolve(localData, new Reference<GraphTargetItem>(null), new Reference<GraphTargetItem>(null), new Reference<>(0), value);
prop.resolve(localData, new Reference<>(null), new Reference<>(null), new Reference<>(0), value);
boolean resolved = true;
if (value.getVal() == null) {
resolved = false;
@@ -1941,12 +1941,12 @@ public class AVM2SourceGenerator implements SourceGenerator {
if (item instanceof ClassAVM2Item) {
InstanceInfo instanceInfo = abc.instance_info.get(((TraitClass) traits[k]).class_info);
instanceInfo.name_index = abc.constants.getMultinameId(new Multiname(Multiname.QNAME, abc.constants.getStringId(((ClassAVM2Item) item).className, true),
abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.getStringId(pkg, true)), 0, true), 0, 0, new ArrayList<Integer>()), true);
abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.getStringId(pkg, true)), 0, true), 0, 0, new ArrayList<>()), true);
if (((ClassAVM2Item) item).extendsOp != null) {
instanceInfo.super_index = typeName(localData, ((ClassAVM2Item) item).extendsOp);
} else {
instanceInfo.super_index = abc.constants.getMultinameId(new Multiname(Multiname.QNAME, str("Object"), namespace(Namespace.KIND_PACKAGE, ""), 0, 0, new ArrayList<Integer>()), true);
instanceInfo.super_index = abc.constants.getMultinameId(new Multiname(Multiname.QNAME, str("Object"), namespace(Namespace.KIND_PACKAGE, ""), 0, 0, new ArrayList<>()), true);
}
instanceInfo.interfaces = new int[((ClassAVM2Item) item).implementsOp.size()];
for (int i = 0; i < ((ClassAVM2Item) item).implementsOp.size(); i++) {
@@ -1956,7 +1956,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
if (item instanceof InterfaceAVM2Item) {
InstanceInfo instanceInfo = abc.instance_info.get(((TraitClass) traits[k]).class_info);
instanceInfo.name_index = abc.constants.getMultinameId(new Multiname(Multiname.QNAME, abc.constants.getStringId(((InterfaceAVM2Item) item).name, true),
abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.getStringId(pkg, true)), 0, true), 0, 0, new ArrayList<Integer>()), true);
abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.getStringId(pkg, true)), 0, true), 0, 0, new ArrayList<>()), true);
instanceInfo.interfaces = new int[((InterfaceAVM2Item) item).superInterfaces.size()];
for (int i = 0; i < ((InterfaceAVM2Item) item).superInterfaces.size(); i++) {
@@ -1969,7 +1969,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
public int superIntName(SourceGeneratorLocalData localData, GraphTargetItem un) throws CompilationException {
if (un instanceof UnresolvedAVM2Item) {
((UnresolvedAVM2Item) un).resolve(null, new ArrayList<GraphTargetItem>(), new ArrayList<>(), abc, allABCs, new ArrayList<MethodBody>(), new ArrayList<AssignableAVM2Item>());
((UnresolvedAVM2Item) un).resolve(null, new ArrayList<>(), new ArrayList<>(), abc, allABCs, new ArrayList<>(), new ArrayList<>());
un = ((UnresolvedAVM2Item) un).resolved;
}
if (!(un instanceof TypeItem)) { //not applyType
@@ -1978,7 +1978,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
TypeItem sup = (TypeItem) un;
int propId = resolveType(localData, sup, abc, allABCs);
int[] nss = new int[]{abc.constants.constant_multiname.get(propId).namespace_index};
return abc.constants.getMultinameId(new Multiname(Multiname.MULTINAME, abc.constants.constant_multiname.get(propId).name_index, 0, abc.constants.getNamespaceSetId(new NamespaceSet(nss), true), 0, new ArrayList<Integer>()), true);
return abc.constants.getMultinameId(new Multiname(Multiname.MULTINAME, abc.constants.constant_multiname.get(propId).name_index, 0, abc.constants.getNamespaceSetId(new NamespaceSet(nss), true), 0, new ArrayList<>()), true);
}
@@ -2001,10 +2001,10 @@ public class AVM2SourceGenerator implements SourceGenerator {
if (mai.isStatic() != generateStatic) {
continue;
}
((TraitMethodGetterSetter) traits[k]).method_info = method(false, isInterface, new ArrayList<MethodBody>(), mai.pkg, mai.needsActivation, mai.subvariables, methodInitScope + (mai.isStatic() ? 0 : 1), mai.hasRest, mai.line, className, superName, false, localData, mai.paramTypes, mai.paramNames, mai.paramValues, mai.body, mai.retType);
((TraitMethodGetterSetter) traits[k]).method_info = method(false, isInterface, new ArrayList<>(), mai.pkg, mai.needsActivation, mai.subvariables, methodInitScope + (mai.isStatic() ? 0 : 1), mai.hasRest, mai.line, className, superName, false, localData, mai.paramTypes, mai.paramNames, mai.paramValues, mai.body, mai.retType);
} else if (item instanceof FunctionAVM2Item) {
FunctionAVM2Item fai = (FunctionAVM2Item) item;
((TraitFunction) traits[k]).method_info = method(false, isInterface, new ArrayList<MethodBody>(), fai.pkg, fai.needsActivation, fai.subvariables, methodInitScope, fai.hasRest, fai.line, className, superName, false, localData, fai.paramTypes, fai.paramNames, fai.paramValues, fai.body, fai.retType);
((TraitFunction) traits[k]).method_info = method(false, isInterface, new ArrayList<>(), fai.pkg, fai.needsActivation, fai.subvariables, methodInitScope, fai.hasRest, fai.line, className, superName, false, localData, fai.paramTypes, fai.paramNames, fai.paramValues, fai.body, fai.retType);
}
}
}
@@ -2144,7 +2144,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
ScriptInfo si = new ScriptInfo();
localData.currentScript = si;
Trait[] traitArr = generateTraitsPhase1(null, null, true, localData, commands, si.traits, class_index);
generateTraitsPhase2(new ArrayList<DottedChain>(), null/*FIXME*/, commands, traitArr, new ArrayList<Integer>(), localData);
generateTraitsPhase2(new ArrayList<>(), null/*FIXME*/, commands, traitArr, new ArrayList<>(), localData);
MethodInfo mi = new MethodInfo(new int[0], 0, 0, 0, new ValueKind[0], new int[0]);
MethodBody mb = new MethodBody(abc);
mb.method_info = abc.addMethodInfo(mi);
@@ -2166,7 +2166,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
traitScope++;
} else {
NamespaceSet nsset = new NamespaceSet(new int[]{abc.constants.constant_multiname.get(tc.name_index).namespace_index});
mbCode.add(ins(new FindPropertyStrictIns(), abc.constants.getMultinameId(new Multiname(Multiname.MULTINAME, abc.constants.constant_multiname.get(tc.name_index).name_index, 0, abc.constants.getNamespaceSetId(nsset, true), 0, new ArrayList<Integer>()), true)));
mbCode.add(ins(new FindPropertyStrictIns(), abc.constants.getMultinameId(new Multiname(Multiname.MULTINAME, abc.constants.constant_multiname.get(tc.name_index).name_index, 0, abc.constants.getNamespaceSetId(nsset, true), 0, new ArrayList<>()), true)));
}
if (abc.instance_info.get(tc.class_info).isInterface()) {
mbCode.add(ins(new PushNullIns()));
@@ -2218,7 +2218,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
abc.constants.getMultinameId(
new Multiname(Multiname.QNAME,
abc.constants.getStringId(superName.getName(a.constants, new ArrayList<>(), true), true),
abc.constants.getNamespaceId(new Namespace(superName.getNamespace(a.constants).kind, abc.constants.getStringId(superName.getNamespace(a.constants).getName(a.constants, true), true)), 0, true), 0, 0, new ArrayList<Integer>()), true)
abc.constants.getNamespaceId(new Namespace(superName.getNamespace(a.constants).kind, abc.constants.getStringId(superName.getNamespace(a.constants).getName(a.constants, true), true)), 0, true), 0, 0, new ArrayList<>()), true)
);
}
}
@@ -2436,7 +2436,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
if (item instanceof UnresolvedAVM2Item) {
String fullClass = localData.getFullClass();
item = ((UnresolvedAVM2Item) item).resolve(new TypeItem(fullClass), new ArrayList<GraphTargetItem>(), new ArrayList<>(), abc, allABCs, new ArrayList<MethodBody>(), new ArrayList<AssignableAVM2Item>());
item = ((UnresolvedAVM2Item) item).resolve(new TypeItem(fullClass), new ArrayList<>(), new ArrayList<>(), abc, allABCs, new ArrayList<>(), new ArrayList<>());
}
if (item instanceof TypeItem) {
typeItem = item;
@@ -2447,7 +2447,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
}
if (typeItem instanceof UnresolvedAVM2Item) {
String fullClass = localData.getFullClass();
typeItem = ((UnresolvedAVM2Item) typeItem).resolve(new TypeItem(fullClass), new ArrayList<GraphTargetItem>(), new ArrayList<>(), abc, allABCs, new ArrayList<MethodBody>(), new ArrayList<AssignableAVM2Item>());
typeItem = ((UnresolvedAVM2Item) typeItem).resolve(new TypeItem(fullClass), new ArrayList<>(), new ArrayList<>(), abc, allABCs, new ArrayList<>(), new ArrayList<>());
}
if (!(typeItem instanceof TypeItem)) {
@@ -2487,7 +2487,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
}
}
if (name_index == 0) {
name_index = abc.constants.getMultinameId(new Multiname(Multiname.QNAME, abc.constants.getStringId(name, true), abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.getStringId(pkg, true)), 0, true), 0, 0, new ArrayList<Integer>()), true);
name_index = abc.constants.getMultinameId(new Multiname(Multiname.QNAME, abc.constants.getStringId(name, true), abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.getStringId(pkg, true)), 0, true), 0, 0, new ArrayList<>()), true);
}
}

View File

@@ -171,7 +171,7 @@ public class ActionScript3Parser {
}
GraphTargetItem t = name(thisType, pkg, needsActivation, true, openedNamespaces, null, false, false, variables, importedClasses);
t = applyType(thisType, pkg, needsActivation, importedClasses, openedNamespaces, t, new HashMap<String, Integer>(), false, false, variables);
t = applyType(thisType, pkg, needsActivation, importedClasses, openedNamespaces, t, new HashMap<>(), false, false, variables);
return t;
}
@@ -287,7 +287,7 @@ public class ActionScript3Parser {
s = lex();
GraphTargetItem ns = null;
if (s.type == SymbolType.NAMESPACE_OP) {
ns = new UnresolvedAVM2Item(new ArrayList<GraphTargetItem>(), importedClasses, false, null, lexer.yyline(), new DottedChain(propName), null, openedNamespaces);
ns = new UnresolvedAVM2Item(new ArrayList<>(), importedClasses, false, null, lexer.yyline(), new DottedChain(propName), null, openedNamespaces);
variables.add((UnresolvedAVM2Item) ns);
s = lex();
if (s.type == SymbolType.BRACKET_OPEN) {
@@ -305,7 +305,7 @@ public class ActionScript3Parser {
if (ns != null) {
ret = new NamespacedAVM2Item(ns, propName, propItem, ret, attr, openedNamespaces, null);
} else {
ret = new PropertyAVM2Item(ret, (attr ? "@" : "") + propName, abc, otherABCs, openedNamespaces, new ArrayList<MethodBody>());
ret = new PropertyAVM2Item(ret, (attr ? "@" : "") + propName, abc, otherABCs, openedNamespaces, new ArrayList<>());
}
s = lex();
}
@@ -375,7 +375,7 @@ public class ActionScript3Parser {
GraphTargetItem ret = null;
if (!name.parts.isEmpty()) {
UnresolvedAVM2Item unr = new UnresolvedAVM2Item(new ArrayList<GraphTargetItem>(), importedClasses, typeOnly, null, lexer.yyline(), name, null, openedNamespaces);
UnresolvedAVM2Item unr = new UnresolvedAVM2Item(new ArrayList<>(), importedClasses, typeOnly, null, lexer.yyline(), name, null, openedNamespaces);
//unr.setIndex(index);
variables.add(unr);
ret = unr;
@@ -385,7 +385,7 @@ public class ActionScript3Parser {
if (attr) {
nsname = nsname.substring(1);
}
UnresolvedAVM2Item ns = new UnresolvedAVM2Item(new ArrayList<GraphTargetItem>(), importedClasses, typeOnly, null, lexer.yyline(), new DottedChain(nsname), null, openedNamespaces);
UnresolvedAVM2Item ns = new UnresolvedAVM2Item(new ArrayList<>(), importedClasses, typeOnly, null, lexer.yyline(), new DottedChain(nsname), null, openedNamespaces);
variables.add(ns);
ret = new NamespacedAVM2Item(ns, nsprop, nspropItem, ret, attr, openedNamespaces, null);
}
@@ -529,7 +529,7 @@ public class ActionScript3Parser {
Reference<Boolean> needsActivation2 = new Reference<>(false);
if (!isInterface) {
expectedType(SymbolType.CURLY_OPEN);
body = commands(thisType, pkg, needsActivation2, importedClasses, openedNamespaces, new Stack<Loop>(), new HashMap<Loop, String>(), new HashMap<String, Integer>(), true, isMethod, 0, subvariables);
body = commands(thisType, pkg, needsActivation2, importedClasses, openedNamespaces, new Stack<>(), new HashMap<>(), new HashMap<>(), true, isMethod, 0, subvariables);
expectedType(SymbolType.CURLY_CLOSE);
} else {
expectedType(SymbolType.SEMICOLON);
@@ -576,7 +576,7 @@ public class ActionScript3Parser {
}
if (inPkg || classNameStr != null) {
if (s.type == SymbolType.CURLY_OPEN) {
staticInitializer.addAll(commands(thisType, pkg, sinitNeedsActivation, importedClasses, openedNamespaces, new Stack<Loop>(), new HashMap<Loop, String>(), new HashMap<String, Integer>(), true, false, 0, sinitVariables));
staticInitializer.addAll(commands(thisType, pkg, sinitNeedsActivation, importedClasses, openedNamespaces, new Stack<>(), new HashMap<>(), new HashMap<>(), true, false, 0, sinitVariables));
expectedType(SymbolType.CURLY_CLOSE);
s = lex();
}
@@ -676,13 +676,13 @@ public class ActionScript3Parser {
GraphTargetItem extendsTypeStr = null;
s = lex();
if (s.type == SymbolType.EXTENDS) {
extendsTypeStr = type(thisType, pkg, new Reference<>(false), importedClasses, subNamespaces, new ArrayList<AssignableAVM2Item>());
extendsTypeStr = type(thisType, pkg, new Reference<>(false), importedClasses, subNamespaces, new ArrayList<>());
s = lex();
}
List<GraphTargetItem> implementsTypeStrs = new ArrayList<>();
if (s.type == SymbolType.IMPLEMENTS) {
do {
GraphTargetItem implementsTypeStr = type(thisType, pkg, new Reference<>(false), importedClasses, subNamespaces, new ArrayList<AssignableAVM2Item>());
GraphTargetItem implementsTypeStr = type(thisType, pkg, new Reference<>(false), importedClasses, subNamespaces, new ArrayList<>());
implementsTypeStrs.add(implementsTypeStr);
s = lex();
} while (s.type == SymbolType.COMMA);
@@ -691,7 +691,7 @@ public class ActionScript3Parser {
if (customAccess != null) {
throw new AVM2ParseException("Class cannot have custom namespace", lexer.yyline());
}
traits.add((classTraits(scriptName, publicNs, pkg, importedClasses, isDynamic, isFinal, subNamespaces, pkg, namespace, false, classTypeStr, extendsTypeStr, implementsTypeStrs, new ArrayList<AssignableAVM2Item>())));
traits.add((classTraits(scriptName, publicNs, pkg, importedClasses, isDynamic, isFinal, subNamespaces, pkg, namespace, false, classTypeStr, extendsTypeStr, implementsTypeStrs, new ArrayList<>())));
expectedType(SymbolType.CURLY_CLOSE);
break;
case INTERFACE:
@@ -716,7 +716,7 @@ public class ActionScript3Parser {
if (s.type == SymbolType.EXTENDS) {
do {
GraphTargetItem intExtendsTypeStr = type(thisType, pkg, new Reference<>(false), importedClasses, openedNamespaces, new ArrayList<AssignableAVM2Item>());
GraphTargetItem intExtendsTypeStr = type(thisType, pkg, new Reference<>(false), importedClasses, openedNamespaces, new ArrayList<>());
intExtendsTypeStrs.add(intExtendsTypeStr);
s = lex();
} while (s.type == SymbolType.COMMA);
@@ -725,7 +725,7 @@ public class ActionScript3Parser {
if (customAccess != null) {
throw new AVM2ParseException("Interface cannot have custom namespace", lexer.yyline());
}
traits.add((classTraits(scriptName, publicNs, pkg, importedClasses, false, isFinal, openedNamespaces, pkg, namespace, true, intTypeStr, null, intExtendsTypeStrs, new ArrayList<AssignableAVM2Item>())));
traits.add((classTraits(scriptName, publicNs, pkg, importedClasses, false, isFinal, openedNamespaces, pkg, namespace, true, intTypeStr, null, intExtendsTypeStrs, new ArrayList<>())));
expectedType(SymbolType.CURLY_CLOSE);
break;
@@ -769,7 +769,7 @@ public class ActionScript3Parser {
}
constr = (method(pkg, false, customAccess, new Reference<>(false), importedClasses, false, false, thisType, openedNamespaces, false, namespace, "", true, constrVariables));
} else {
MethodAVM2Item ft = method(pkg, isInterface, customAccess, new Reference<>(false), importedClasses, isOverride, isFinal, thisType, openedNamespaces, isStatic, namespace, fname, true, new ArrayList<AssignableAVM2Item>());
MethodAVM2Item ft = method(pkg, isInterface, customAccess, new Reference<>(false), importedClasses, isOverride, isFinal, thisType, openedNamespaces, isStatic, namespace, fname, true, new ArrayList<>());
if (isGetter) {
if (!ft.paramTypes.isEmpty()) {
@@ -850,7 +850,7 @@ public class ActionScript3Parser {
s = lex();
GraphTargetItem type = null;
if (s.type == SymbolType.COLON) {
type = type(thisType, pkg, new Reference<>(false), importedClasses, openedNamespaces, new ArrayList<AssignableAVM2Item>());
type = type(thisType, pkg, new Reference<>(false), importedClasses, openedNamespaces, new ArrayList<>());
s = lex();
} else {
type = TypeItem.UNBOUNDED;
@@ -859,7 +859,7 @@ public class ActionScript3Parser {
GraphTargetItem value = null;
if (s.type == SymbolType.ASSIGN) {
value = expression(thisType, pkg, new Reference<>(false), importedClasses, openedNamespaces, new HashMap<String, Integer>(), false, false, true, isStatic || isConst ? sinitVariables : constrVariables);
value = expression(thisType, pkg, new Reference<>(false), importedClasses, openedNamespaces, new HashMap<>(), false, false, true, isStatic || isConst ? sinitVariables : constrVariables);
s = lex();
}
GraphTargetItem tar;
@@ -929,7 +929,7 @@ public class ActionScript3Parser {
List<String> names = new ArrayList<>();
List<String> namespaces = new ArrayList<>();
//FIXME for Private classes in script!!!
AVM2SourceGenerator.parentNamesAddNames(abc, otherABCs, AVM2SourceGenerator.resolveType(new SourceGeneratorLocalData(new HashMap<String, Integer>(), 0, false, 0), ((TypeItem) ((UnresolvedAVM2Item) extendsStr).resolve(null, new ArrayList<GraphTargetItem>(), new ArrayList<>(), abc, otherABCs, new ArrayList<MethodBody>(), new ArrayList<AssignableAVM2Item>())), abc, otherABCs), indices, names, namespaces);
AVM2SourceGenerator.parentNamesAddNames(abc, otherABCs, AVM2SourceGenerator.resolveType(new SourceGeneratorLocalData(new HashMap<>(), 0, false, 0), ((TypeItem) ((UnresolvedAVM2Item) extendsStr).resolve(null, new ArrayList<>(), new ArrayList<>(), abc, otherABCs, new ArrayList<>(), new ArrayList<>())), abc, otherABCs), indices, names, namespaces);
for (int i = 0; i < names.size(); i++) {
if (namespaces.get(i).isEmpty()) {
continue;
@@ -1583,7 +1583,7 @@ public class ActionScript3Parser {
UnresolvedAVM2Item ui = (UnresolvedAVM2Item) a;
if (ui.getVariableName().equals(e.getVariableName())) {
try {
ui.resolve(null, new ArrayList<GraphTargetItem>(), new ArrayList<>(), abc, otherABCs, new ArrayList<MethodBody>(), variables);
ui.resolve(null, new ArrayList<>(), new ArrayList<>(), abc, otherABCs, new ArrayList<>(), variables);
} catch (CompilationException ex) {
// ignore
}
@@ -1606,7 +1606,7 @@ public class ActionScript3Parser {
for (NameAVM2Item e : catchExceptions) {
if (ui.getVariableName().equals(e.getVariableName())) {
try {
ui.resolve(null, new ArrayList<GraphTargetItem>(), new ArrayList<>(), abc, otherABCs, new ArrayList<MethodBody>(), variables);
ui.resolve(null, new ArrayList<>(), new ArrayList<>(), abc, otherABCs, new ArrayList<>(), variables);
} catch (CompilationException ex) {
// ignore
}
@@ -2341,7 +2341,7 @@ public class ActionScript3Parser {
openedNamespaces.add(publicNs = abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, abc.constants.getStringId("", true)), 0, true));
List<GraphTargetItem> items = new ArrayList<>();
traits(fileName, true, new ArrayList<AssignableAVM2Item>(), new Reference<>(false), new ArrayList<GraphTargetItem>(), new ArrayList<DottedChain>(), scriptPrivateNs, 0, publicNs, 0, 0, openedNamespaces, null, null, false, items);
traits(fileName, true, new ArrayList<>(), new Reference<>(false), new ArrayList<>(), new ArrayList<>(), scriptPrivateNs, 0, publicNs, 0, 0, openedNamespaces, null, null, false, items);
return items;
}
@@ -2358,7 +2358,7 @@ public class ActionScript3Parser {
public void addScriptFromTree(List<GraphTargetItem> items, boolean documentClass, int classPos) throws AVM2ParseException, CompilationException {
AVM2SourceGenerator gen = new AVM2SourceGenerator(abc, otherABCs);
SourceGeneratorLocalData localData = new SourceGeneratorLocalData(
new HashMap<String, Integer>(), 0, Boolean.FALSE, 0);
new HashMap<>(), 0, Boolean.FALSE, 0);
localData.documentClass = documentClass;
abc.script_info.add(gen.generateScriptInfo(localData, items, classPos));
}

View File

@@ -95,7 +95,7 @@ public class CallAVM2Item extends AVM2Item {
nobj.setRegNumber(0);
obj = nobj;
}
PropertyAVM2Item p = new PropertyAVM2Item(obj, n.getVariableName(), g.abc, g.allABCs, n.openedNamespaces, new ArrayList<MethodBody>());
PropertyAVM2Item p = new PropertyAVM2Item(obj, n.getVariableName(), g.abc, g.allABCs, n.openedNamespaces, new ArrayList<>());
p.setAssignedValue(n.getAssignedValue());
callable = p;
}
@@ -127,7 +127,7 @@ public class CallAVM2Item extends AVM2Item {
Reference<GraphTargetItem> outPropType = new Reference<>(null);
Reference<ValueKind> outPropValue = new Reference<>(null);
if (cname != null && AVM2SourceGenerator.searchPrototypeChain(true, allAbcs, pkgName, cname, prop.propertyName, outName, outNs, outPropNs, outPropNsKind, outPropNsIndex, outPropType, outPropValue) && (localData.currentClass.equals("".equals(outNs.getVal()) ? outName.getVal() : outNs.getVal() + "." + outName.getVal()))) {
NameAVM2Item nobj = new NameAVM2Item(new TypeItem(localData.getFullClass()), 0, "this", null, false, new ArrayList<Integer>());
NameAVM2Item nobj = new NameAVM2Item(new TypeItem(localData.getFullClass()), 0, "this", null, false, new ArrayList<>());
nobj.setRegNumber(0);
obj = nobj;
}

View File

@@ -97,7 +97,7 @@ public class IndexAVM2Item extends AssignableAVM2Item {
Reference<Integer> index_temp = new Reference<>(-1);
Reference<Integer> val_temp = new Reference<>(-1);
AVM2SourceGenerator g = (AVM2SourceGenerator) generator;
int indexPropIndex = g.abc.constants.getMultinameId(new Multiname(attr ? Multiname.MULTINAMELA : Multiname.MULTINAMEL, 0, 0, allNsSet(g.abc), 0, new ArrayList<Integer>()), true);
int indexPropIndex = g.abc.constants.getMultinameId(new Multiname(attr ? Multiname.MULTINAMELA : Multiname.MULTINAMEL, 0, 0, allNsSet(g.abc), 0, new ArrayList<>()), true);
return toSourceMerge(localData, generator,
object, dupSetTemp(localData, generator, obj_temp),
@@ -119,7 +119,7 @@ public class IndexAVM2Item extends AssignableAVM2Item {
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator, boolean needsReturn, boolean call, List<GraphTargetItem> callargs, boolean delete, boolean construct) throws CompilationException {
AVM2SourceGenerator g = (AVM2SourceGenerator) generator;
int indexPropIndex = g.abc.constants.getMultinameId(new Multiname(attr ? Multiname.MULTINAMELA : Multiname.MULTINAMEL, 0, 0, allNsSet(g.abc), 0, new ArrayList<Integer>()), true);
int indexPropIndex = g.abc.constants.getMultinameId(new Multiname(attr ? Multiname.MULTINAMELA : Multiname.MULTINAMEL, 0, 0, allNsSet(g.abc), 0, new ArrayList<>()), true);
Reference<Integer> ret_temp = new Reference<>(-1);
if (assignedValue != null) {
@@ -147,11 +147,11 @@ public class IndexAVM2Item extends AssignableAVM2Item {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSource(localData, generator, true, false, new ArrayList<GraphTargetItem>(), false, false);
return toSource(localData, generator, true, false, new ArrayList<>(), false, false);
}
@Override
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSource(localData, generator, false, false, new ArrayList<GraphTargetItem>(), false, false);
return toSource(localData, generator, false, false, new ArrayList<>(), false, false);
}
}

View File

@@ -117,14 +117,14 @@ public class NamespacedAVM2Item extends AssignableAVM2Item {
if (name != null) {
return toSourceMerge(localData, generator,
ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem("Namespace")),
ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.RTQNAME, g.abc.constants.getStringId(name, true), 0, 0, 0, new ArrayList<Integer>()), true)),
ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.RTQNAME, g.abc.constants.getStringId(name, true), 0, 0, 0, new ArrayList<>()), true)),
dupSetTemp(localData, generator, name_temp),
ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem("Namespace")),
dupSetTemp(localData, generator, ns_temp),
//Start get original
//getTemp(localData, generator, ns_temp), generateCoerce(generator, "Namespace"), ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.RTQNAME, g.abc.constants.getStringId(variableName, true), 0, 0, 0, new ArrayList<Integer>()), true)),
//getTemp(localData, generator, ns_temp), generateCoerce(generator, "Namespace"),
ins(new GetPropertyIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.MULTINAMEL, 0, 0, allNsSet(g.abc), 0, new ArrayList<Integer>()), true)),
ins(new GetPropertyIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.MULTINAMEL, 0, 0, allNsSet(g.abc), 0, new ArrayList<>()), true)),
!isInteger ? ins(new ConvertDIns()) : null,
//End get original
(!post) ? (decrement ? ins(isInteger ? new DecrementIIns() : new DecrementIns()) : ins(isInteger ? new IncrementIIns() : new IncrementIns())) : null,
@@ -134,7 +134,7 @@ public class NamespacedAVM2Item extends AssignableAVM2Item {
getTemp(localData, generator, name_temp),
getTemp(localData, generator, ns_temp),
getTemp(localData, generator, ret_temp),
ins(new SetPropertyIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.MULTINAMEL, 0, 0, allNsSet(g.abc), 0, new ArrayList<Integer>()), true)),
ins(new SetPropertyIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.MULTINAMEL, 0, 0, allNsSet(g.abc), 0, new ArrayList<>()), true)),
killTemp(localData, generator, Arrays.asList(ret_temp, name_temp, ns_temp))
);
} else {
@@ -168,20 +168,20 @@ public class NamespacedAVM2Item extends AssignableAVM2Item {
if (name == null) {
if (assignedValue != null) {
return toSourceMerge(localData, generator,
obj == null ? ns : null, obj == null ? NameAVM2Item.generateCoerce(localData, generator, new TypeItem("Namespace")) : null, nameItem, ins(new ConvertSIns()), obj != null ? obj : ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.RTQNAMEL, 0, 0, 0, 0, new ArrayList<Integer>()), true)),
obj == null ? ns : null, obj == null ? NameAVM2Item.generateCoerce(localData, generator, new TypeItem("Namespace")) : null, nameItem, ins(new ConvertSIns()), obj != null ? obj : ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.RTQNAMEL, 0, 0, 0, 0, new ArrayList<>()), true)),
ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem("Namespace")), nameItem, ins(new ConvertSIns()), assignedValue,
needsReturn ? dupSetTemp(localData, generator, ret_temp) : null,
ins(new SetPropertyIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.RTQNAMEL, 0, 0, 0, 0, new ArrayList<Integer>()), true)),
ins(new SetPropertyIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.RTQNAMEL, 0, 0, 0, 0, new ArrayList<>()), true)),
needsReturn ? getTemp(localData, generator, ret_temp) : null,
killTemp(localData, generator, Arrays.asList(ns_temp, index_temp, ret_temp))
);
} else {
return toSourceMerge(localData, generator,
obj == null ? ns : null, obj == null ? NameAVM2Item.generateCoerce(localData, generator, new TypeItem("Namespace")) : null, nameItem, ins(new ConvertSIns()), obj != null ? obj : ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.RTQNAMEL, 0, 0, 0, 0, new ArrayList<Integer>()), true)),
obj == null ? ns : null, obj == null ? NameAVM2Item.generateCoerce(localData, generator, new TypeItem("Namespace")) : null, nameItem, ins(new ConvertSIns()), obj != null ? obj : ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.RTQNAMEL, 0, 0, 0, 0, new ArrayList<>()), true)),
call ? dupSetTemp(localData, generator, obj_temp) : null,
ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem("Namespace")), nameItem, ins(new ConvertSIns()),
construct ? callargs : null,
ins(construct ? new ConstructPropIns() : delete ? new DeletePropertyIns() : new GetPropertyIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.RTQNAMEL, 0, 0, 0, 0, new ArrayList<Integer>()), true), construct ? callargs.size() : null),
ins(construct ? new ConstructPropIns() : delete ? new DeletePropertyIns() : new GetPropertyIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.RTQNAMEL, 0, 0, 0, 0, new ArrayList<>()), true), construct ? callargs.size() : null),
call ? getTemp(localData, generator, obj_temp) : null,
call ? callargs : null,
call ? ins(new CallIns(), callargs.size()) : null,
@@ -192,20 +192,20 @@ public class NamespacedAVM2Item extends AssignableAVM2Item {
} else {
if (assignedValue != null) {
return toSourceMerge(localData, generator,
obj == null ? ns : null, obj == null ? NameAVM2Item.generateCoerce(localData, generator, new TypeItem("Namespace")) : null, obj != null ? obj : ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(attr ? Multiname.RTQNAMEA : Multiname.RTQNAME, g.abc.constants.getStringId(name, true), 0, 0, 0, new ArrayList<Integer>()), true)),
obj == null ? ns : null, obj == null ? NameAVM2Item.generateCoerce(localData, generator, new TypeItem("Namespace")) : null, obj != null ? obj : ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(attr ? Multiname.RTQNAMEA : Multiname.RTQNAME, g.abc.constants.getStringId(name, true), 0, 0, 0, new ArrayList<>()), true)),
ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem("Namespace")), assignedValue,
needsReturn ? dupSetTemp(localData, generator, ret_temp) : null,
ins(new SetPropertyIns(), g.abc.constants.getMultinameId(new Multiname(attr ? Multiname.RTQNAMEA : Multiname.RTQNAME, g.abc.constants.getStringId(name, true), 0, 0, 0, new ArrayList<Integer>()), true)),
ins(new SetPropertyIns(), g.abc.constants.getMultinameId(new Multiname(attr ? Multiname.RTQNAMEA : Multiname.RTQNAME, g.abc.constants.getStringId(name, true), 0, 0, 0, new ArrayList<>()), true)),
needsReturn ? getTemp(localData, generator, ret_temp) : null,
killTemp(localData, generator, Arrays.asList(ns_temp, index_temp, ret_temp))
);
} else {
return toSourceMerge(localData, generator,
obj == null ? ns : null, obj == null ? NameAVM2Item.generateCoerce(localData, generator, new TypeItem("Namespace")) : null, obj != null ? obj : ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(attr ? Multiname.RTQNAMEA : Multiname.RTQNAME, g.abc.constants.getStringId(name, true), 0, 0, 0, new ArrayList<Integer>()), true)),
obj == null ? ns : null, obj == null ? NameAVM2Item.generateCoerce(localData, generator, new TypeItem("Namespace")) : null, obj != null ? obj : ins(new FindPropertyStrictIns(), g.abc.constants.getMultinameId(new Multiname(attr ? Multiname.RTQNAMEA : Multiname.RTQNAME, g.abc.constants.getStringId(name, true), 0, 0, 0, new ArrayList<>()), true)),
call ? dupSetTemp(localData, generator, obj_temp) : null,
ns, NameAVM2Item.generateCoerce(localData, generator, new TypeItem("Namespace")),
construct ? callargs : null,
ins(construct ? new ConstructPropIns() : delete ? new DeletePropertyIns() : new GetPropertyIns(), g.abc.constants.getMultinameId(new Multiname(attr ? Multiname.RTQNAMEA : Multiname.RTQNAME, g.abc.constants.getStringId(name, true), 0, 0, 0, new ArrayList<Integer>()), true), construct ? callargs.size() : null),
ins(construct ? new ConstructPropIns() : delete ? new DeletePropertyIns() : new GetPropertyIns(), g.abc.constants.getMultinameId(new Multiname(attr ? Multiname.RTQNAMEA : Multiname.RTQNAME, g.abc.constants.getStringId(name, true), 0, 0, 0, new ArrayList<>()), true), construct ? callargs.size() : null),
call ? getTemp(localData, generator, obj_temp) : null,
call ? callargs : null,
call ? ins(new CallIns(), callargs.size()) : null,
@@ -218,11 +218,11 @@ public class NamespacedAVM2Item extends AssignableAVM2Item {
@Override
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSource(localData, generator, true, false, new ArrayList<GraphTargetItem>(), false, false);
return toSource(localData, generator, true, false, new ArrayList<>(), false, false);
}
@Override
public List<GraphSourceItem> toSourceIgnoreReturnValue(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
return toSource(localData, generator, false, false, new ArrayList<GraphTargetItem>(), false, false);
return toSource(localData, generator, false, false, new ArrayList<>(), false, false);
}
}

View File

@@ -230,7 +230,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
propType = outPropType.getVal();
propIndex = abc.constants.getMultinameId(new Multiname(Multiname.QNAME,
abc.constants.getStringId(propertyName, true),
abc.constants.getNamespaceId(new Namespace(outPropNsKind.getVal(), abc.constants.getStringId(outPropNs.getVal(), true)), outPropNsIndex.getVal(), true), 0, 0, new ArrayList<Integer>()), true
abc.constants.getNamespaceId(new Namespace(outPropNsKind.getVal(), abc.constants.getStringId(outPropNs.getVal(), true)), outPropNsIndex.getVal(), true), 0, 0, new ArrayList<>()), true
);
propValue = outPropValue.getVal();
@@ -252,7 +252,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
propType = multinameToType(tsc.type_index, abc.constants);
propIndex = tsc.name_index;
if (!localData.traitUsages.containsKey(b)) {
localData.traitUsages.put(b, new ArrayList<Integer>());
localData.traitUsages.put(b, new ArrayList<>());
}
localData.traitUsages.get(b).add(i);
}
@@ -348,7 +348,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
propType = outPropType.getVal();
propIndex = abc.constants.getMultinameId(new Multiname(Multiname.QNAME,
abc.constants.getStringId(propertyName, true),
abc.constants.getNamespaceId(new Namespace(outPropNsKind.getVal(), abc.constants.getStringId(outPropNs.getVal(), true)), outPropNsIndex.getVal(), true), 0, 0, new ArrayList<Integer>()), true
abc.constants.getNamespaceId(new Namespace(outPropNsKind.getVal(), abc.constants.getStringId(outPropNs.getVal(), true)), outPropNsIndex.getVal(), true), 0, 0, new ArrayList<>()), true
);
propValue = outPropValue.getVal();
break loopobjType;
@@ -372,7 +372,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
}
propIndex = abc.constants.getMultinameId(new Multiname(attr ? (pname.isEmpty() ? Multiname.MULTINAMELA : Multiname.MULTINAMEA) : Multiname.MULTINAME,
abc.constants.getStringId("*".equals(pname) ? null : pname, true), 0, //Note: name = * is for .@* attribute
attr && pname.isEmpty() ? abc.constants.getNamespaceSetId(new NamespaceSet(new int[]{abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE_INTERNAL, abc.constants.getStringId(localData.pkg, true)), 0, true)}), true) : allNsSet(), 0, new ArrayList<Integer>()), true);
attr && pname.isEmpty() ? abc.constants.getNamespaceSetId(new NamespaceSet(new int[]{abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE_INTERNAL, abc.constants.getStringId(localData.pkg, true)), 0, true)}), true) : allNsSet(), 0, new ArrayList<>()), true);
propType = TypeItem.UNBOUNDED;
objType = TypeItem.UNBOUNDED;
propValue = null;
@@ -558,7 +558,7 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
Reference<GraphTargetItem> propType = new Reference<>(null);
Reference<Integer> propIndex = new Reference<>(0);
Reference<ValueKind> outPropValue = new Reference<>(null);
resolve(new SourceGeneratorLocalData(new HashMap<String, Integer>(), 0, false, 0)/*???*/, objType, propType, propIndex, outPropValue);
resolve(new SourceGeneratorLocalData(new HashMap<>(), 0, false, 0)/*???*/, objType, propType, propIndex, outPropValue);
return propType.getVal();
}

View File

@@ -303,7 +303,7 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
ret.setRegNumber(n.getRegNumber());
resolved = ret;
for (int i = 1; i < parts.size(); i++) {
resolved = new PropertyAVM2Item(resolved, parts.get(i), abc, otherAbcs, openedNamespaces, new ArrayList<MethodBody>());
resolved = new PropertyAVM2Item(resolved, parts.get(i), abc, otherAbcs, openedNamespaces, new ArrayList<>());
if (i == parts.size() - 1) {
((PropertyAVM2Item) resolved).assignedValue = assignedValue;
}
@@ -325,7 +325,7 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
TypeItem ret = new TypeItem(imp);
resolved = ret;
for (int i = 1; i < parts.size(); i++) {
resolved = new PropertyAVM2Item(resolved, parts.get(i), abc, otherAbcs, openedNamespaces, new ArrayList<MethodBody>());
resolved = new PropertyAVM2Item(resolved, parts.get(i), abc, otherAbcs, openedNamespaces, new ArrayList<>());
if (i == parts.size() - 1) {
((PropertyAVM2Item) resolved).assignedValue = assignedValue;
}
@@ -355,7 +355,7 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
TypeItem ret = new TypeItem(fname);
resolved = ret;
for (int j = i + 1; j < parts.size(); j++) {
resolved = new PropertyAVM2Item(resolved, parts.get(j), abc, otherAbcs, openedNamespaces, new ArrayList<MethodBody>());
resolved = new PropertyAVM2Item(resolved, parts.get(j), abc, otherAbcs, openedNamespaces, new ArrayList<>());
if (j == parts.size() - 1) {
((PropertyAVM2Item) resolved).assignedValue = assignedValue;
}
@@ -400,7 +400,7 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
}*/
resolved = ret;
for (int i = 1; i < parts.size(); i++) {
resolved = new PropertyAVM2Item(resolved, parts.get(i), abc, otherAbcs, openedNamespaces, new ArrayList<MethodBody>());
resolved = new PropertyAVM2Item(resolved, parts.get(i), abc, otherAbcs, openedNamespaces, new ArrayList<>());
if (i == parts.size() - 1) {
((PropertyAVM2Item) resolved).assignedValue = assignedValue;
}
@@ -423,7 +423,7 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
NameAVM2Item ret = new NameAVM2Item(thisType, line, parts.get(0), null, false, openedNamespaces);
resolved = ret;
for (int i = 1; i < parts.size(); i++) {
resolved = new PropertyAVM2Item(resolved, parts.get(i), abc, otherAbcs, openedNamespaces, new ArrayList<MethodBody>());
resolved = new PropertyAVM2Item(resolved, parts.get(i), abc, otherAbcs, openedNamespaces, new ArrayList<>());
if (i == parts.size() - 1) {
((PropertyAVM2Item) resolved).assignedValue = assignedValue;
}
@@ -446,7 +446,7 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
GraphTargetItem ret = new NameAVM2Item(t, line, parts.get(0), null, false, openedNamespaces);
resolved = ret;
for (int i = 1; i < parts.size(); i++) {
resolved = new PropertyAVM2Item(resolved, parts.get(i), abc, otherAbcs, openedNamespaces, new ArrayList<MethodBody>());
resolved = new PropertyAVM2Item(resolved, parts.get(i), abc, otherAbcs, openedNamespaces, new ArrayList<>());
if (i == parts.size() - 1) {
((PropertyAVM2Item) resolved).assignedValue = assignedValue;
}

View File

@@ -62,7 +62,7 @@ public class XMLAVM2Item extends AVM2Item {
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
AVM2SourceGenerator g = (AVM2SourceGenerator) generator;
return toSourceMerge(localData, generator,
ins(new GetLexIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.QNAME, g.abc.constants.getStringId("XML", true), g.abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, g.abc.constants.getStringId("", true)), 0, true), 0, 0, new ArrayList<Integer>()), true)),
ins(new GetLexIns(), g.abc.constants.getMultinameId(new Multiname(Multiname.QNAME, g.abc.constants.getStringId("XML", true), g.abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE, g.abc.constants.getStringId("", true)), 0, true), 0, 0, new ArrayList<>()), true)),
value,
ins(new ConstructIns(), 1)
);

View File

@@ -97,7 +97,7 @@ public class InstanceInfo {
}
writer.appendNoHilight(modifiers + objType);
writer.hilightSpecial(abc.constants.getMultiname(name_index).getName(abc.constants, new ArrayList<String>()/* No full names here*/, false), HighlightSpecialType.CLASS_NAME);
writer.hilightSpecial(abc.constants.getMultiname(name_index).getName(abc.constants, new ArrayList<>()/* No full names here*/, false), HighlightSpecialType.CLASS_NAME);
if (super_index > 0) {
String typeName = abc.constants.getMultiname(super_index).getNameWithNamespace(abc.constants).toPrintableString();

View File

@@ -268,7 +268,7 @@ public final class MethodBody implements Cloneable {
public Void call() throws InterruptedException {
MethodBody converted = convertMethodBody(path, isStatic, scriptIndex, classIndex, abc, trait, constants, method_info, scopeStack, isStaticInitializer, fullyQualifiedNames, initTraits);
HashMap<Integer, String> localRegNames = getLocalRegNames(abc);
convertedItems = converted.getCode().toGraphTargetItems(path, isStatic, scriptIndex, classIndex, abc, constants, method_info, converted, localRegNames, scopeStack, isStaticInitializer, fullyQualifiedNames, initTraits, Graph.SOP_USE_STATIC, new HashMap<Integer, Integer>(), converted.getCode().visitCode(converted));
convertedItems = converted.getCode().toGraphTargetItems(path, isStatic, scriptIndex, classIndex, abc, constants, method_info, converted, localRegNames, scopeStack, isStaticInitializer, fullyQualifiedNames, initTraits, Graph.SOP_USE_STATIC, new HashMap<>(), converted.getCode().visitCode(converted));
Graph.graphToString(convertedItems, writer, LocalData.create(constants, localRegNames, fullyQualifiedNames));
return null;
}

View File

@@ -195,7 +195,7 @@ public abstract class Trait implements Serializable {
Multiname name = getName(abc);
Namespace ns = name.getNamespace(abc.constants);
String packageName = ns.getName(abc.constants, false);
String objectName = name.getName(abc.constants, new ArrayList<String>(), false);
String objectName = name.getName(abc.constants, new ArrayList<>(), false);
return new ClassPath(packageName, objectName); //assume not null name
}
}

View File

@@ -319,7 +319,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
TraitMethodGetterSetter tm = (TraitMethodGetterSetter) t;
parseImportsUsagesFromMultiname(abc, imports, uses, abc.constants.getMultiname(tm.name_index), ignorePackage, fullyQualifiedNames);
if (tm.method_info != 0) {
parseImportsUsagesFromMethodInfo(abc, tm.method_info, imports, uses, ignorePackage, fullyQualifiedNames, new ArrayList<Integer>());
parseImportsUsagesFromMethodInfo(abc, tm.method_info, imports, uses, ignorePackage, fullyQualifiedNames, new ArrayList<>());
}
}
parseImportsUsagesFromMultiname(abc, imports, uses, t.getName(abc), ignorePackage, fullyQualifiedNames);
@@ -348,13 +348,13 @@ public class TraitClass extends Trait implements TraitWithSlot {
parseImportsUsagesFromTraits(abc, abc.class_info.get(class_info).static_traits, imports, uses, packageName, fullyQualifiedNames);
//static initializer
parseImportsUsagesFromMethodInfo(abc, abc.class_info.get(class_info).cinit_index, imports, uses, packageName, fullyQualifiedNames, new ArrayList<Integer>());
parseImportsUsagesFromMethodInfo(abc, abc.class_info.get(class_info).cinit_index, imports, uses, packageName, fullyQualifiedNames, new ArrayList<>());
//instance
parseImportsUsagesFromTraits(abc, abc.instance_info.get(class_info).instance_traits, imports, uses, packageName, fullyQualifiedNames);
//instance initializer
parseImportsUsagesFromMethodInfo(abc, abc.instance_info.get(class_info).iinit_index, imports, uses, packageName, fullyQualifiedNames, new ArrayList<Integer>());
parseImportsUsagesFromMethodInfo(abc, abc.instance_info.get(class_info).iinit_index, imports, uses, packageName, fullyQualifiedNames, new ArrayList<>());
return imports;
}

View File

@@ -113,7 +113,7 @@ public class TraitSlotConst extends Trait implements TraitWithSlot {
writer.newLine();
}
}
assignedValue.toString(writer, LocalData.create(abc.constants, new HashMap<Integer, String>(), fullyQualifiedNames));
assignedValue.toString(writer, LocalData.create(abc.constants, new HashMap<>(), fullyQualifiedNames));
if (parent instanceof TraitClass) {
writer.endMethod();
writer.endTrait();

View File

@@ -488,7 +488,7 @@ public abstract class Action implements GraphSourceItem {
continue;
}
if (!containers.containsKey(addr)) {
containers.put(addr, new ArrayList<GraphSourceItemContainer>());
containers.put(addr, new ArrayList<>());
}
containers.get(addr).add(cnt);
}
@@ -737,7 +737,7 @@ public abstract class Action implements GraphSourceItem {
}
public static List<GraphTargetItem> actionsToTree(List<Action> actions, int version, int staticOperation, String path) throws InterruptedException {
return actionsToTree(new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>(), actions, version, staticOperation, path);
return actionsToTree(new HashMap<>(), new HashMap<>(), new HashMap<>(), actions, version, staticOperation, path);
}
/**
@@ -937,7 +937,7 @@ public abstract class Action implements GraphSourceItem {
}
for (long size : cnt.getContainerSizes()) {
if (size == 0) {
outs.add(new ArrayList<GraphTargetItem>());
outs.add(new ArrayList<>());
continue;
}
List<GraphTargetItem> out;

View File

@@ -61,7 +61,7 @@ import java.util.Map;
public class ActionGraph extends Graph {
public ActionGraph(List<Action> code, HashMap<Integer, String> registerNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int version) {
super(new ActionGraphSource(code, version, registerNames, variables, functions), new ArrayList<Integer>());
super(new ActionGraphSource(code, version, registerNames, variables, functions), new ArrayList<>());
//this.version = version;
/*heads = makeGraph(code, new ArrayList<GraphPart>());
for (GraphPart head : heads) {
@@ -120,7 +120,7 @@ public class ActionGraph extends Graph {
break;
}
} else {
target = new DirectValueActionItem(null, 0, st.target, new ArrayList<String>());
target = new DirectValueActionItem(null, 0, st.target, new ArrayList<>());
targetStart = t;
targetStartItem = it;
}

View File

@@ -179,7 +179,7 @@ public class ActionList extends ArrayList<Action> {
public void saveToFile(String fileName) {
File file = new File(fileName);
try (FileTextWriter writer = new FileTextWriter(Configuration.getCodeFormatting(), new FileOutputStream(file))) {
Action.actionsToString(new ArrayList<DisassemblyListener>(), 0, this, SWF.DEFAULT_VERSION, ScriptExportMode.PCODE, writer);
Action.actionsToString(new ArrayList<>(), 0, this, SWF.DEFAULT_VERSION, ScriptExportMode.PCODE, writer);
} catch (IOException ex) {
Logger.getLogger(ActionList.class.getName()).log(Level.SEVERE, null, ex);
}
@@ -187,7 +187,7 @@ public class ActionList extends ArrayList<Action> {
@Override
public String toString() {
return Action.actionsToString(new ArrayList<DisassemblyListener>(), 0, this, SWF.DEFAULT_VERSION, ScriptExportMode.PCODE);
return Action.actionsToString(new ArrayList<>(), 0, this, SWF.DEFAULT_VERSION, ScriptExportMode.PCODE);
}
public String toSource() {

View File

@@ -137,7 +137,7 @@ public class ActionListReader {
Map<Long, Long> nextOffsets = new HashMap<>();
Action entryAction = readActionListAtPos(listeners, null,
sis, actionMap, nextOffsets,
ip, 0, endIp, path, false, new ArrayList<Long>());
ip, 0, endIp, path, false, new ArrayList<>());
if (actionMap.isEmpty()) {
return new ActionList();
@@ -239,9 +239,9 @@ public class ActionListReader {
// Map of the actions. Use TreeMap to sort the keys in ascending order
Map<Long, Action> actionMap = new TreeMap<>();
Map<Long, Long> nextOffsets = new HashMap<>();
readActionListAtPos(new ArrayList<DisassemblyListener>(), null,
readActionListAtPos(new ArrayList<>(), null,
sis, actionMap, nextOffsets,
startIp, startIp, endIp + 1, "", false, new ArrayList<Long>());
startIp, startIp, endIp + 1, "", false, new ArrayList<>());
return new ArrayList<>(actionMap.values());
}
@@ -293,14 +293,14 @@ public class ActionListReader {
}
deobfustaceActionListAtPosRecursive(listeners,
new ArrayList<GraphTargetItem>(),
new HashMap<Long, List<GraphSourceItemContainer>>(),
new ArrayList<>(),
new HashMap<>(),
new ActionLocalData(),
new TranslateStack(path),
new ConstantPool(),
actionMap, ip, retMap, ip, endIp, path,
new HashMap<Integer, Integer>(), false,
new HashMap<Integer, HashMap<String, GraphTargetItem>>(),
new HashMap<>(), false,
new HashMap<>(),
version, 0, maxRecursionLevel);
ActionList ret = new ActionList();
@@ -800,7 +800,7 @@ public class ActionListReader {
}
if (debugMode) {
String atos = a.getASMSource(new ActionList(), new HashSet<Long>(), ScriptExportMode.PCODE);
String atos = a.getASMSource(new ActionList(), new HashSet<>(), ScriptExportMode.PCODE);
if (a instanceof GraphSourceItemContainer) {
atos = a.toString();
}
@@ -888,10 +888,10 @@ public class ActionListReader {
} else if (!(a instanceof GraphSourceItemContainer)) {
//return in for..in, TODO:Handle this better way
if (((a instanceof ActionEquals) || (a instanceof ActionEquals2)) && (stack.size() == 1) && (stack.peek() instanceof DirectValueActionItem)) {
stack.push(new DirectValueActionItem(null, 0, new Null(), new ArrayList<String>()));
stack.push(new DirectValueActionItem(null, 0, new Null(), new ArrayList<>()));
}
if ((a instanceof ActionStoreRegister) && stack.isEmpty()) {
stack.push(new DirectValueActionItem(null, 0, new Null(), new ArrayList<String>()));
stack.push(new DirectValueActionItem(null, 0, new Null(), new ArrayList<>()));
}
a.translate(localData, stack, output, Graph.SOP_USE_STATIC/*Graph.SOP_SKIP_STATIC*/, path);
}
@@ -920,7 +920,7 @@ public class ActionListReader {
List<List<GraphTargetItem>> output2s = new ArrayList<>();
for (long size : cnt.getContainerSizes()) {
if (size == 0) {
output2s.add(new ArrayList<GraphTargetItem>());
output2s.add(new ArrayList<>());
continue;
}
ActionLocalData localData2;

View File

@@ -122,7 +122,7 @@ public class ActionDeobfuscator extends ActionDeobfuscatorSimple {
byte[] actionBytes = Action.actionsToBytes(actions, true, SWF.DEFAULT_VERSION);
try {
SWFInputStream rri = new SWFInputStream(swf, actionBytes);
ActionList newActions = ActionListReader.readActionList(new ArrayList<DisassemblyListener>(), rri, SWF.DEFAULT_VERSION, 0, actionBytes.length, "", -1);
ActionList newActions = ActionListReader.readActionList(new ArrayList<>(), rri, SWF.DEFAULT_VERSION, 0, actionBytes.length, "", -1);
actions.setActions(newActions);
} catch (IOException | InterruptedException ex) {
Logger.getLogger(ActionDeobfuscator.class.getName()).log(Level.SEVERE, null, ex);

View File

@@ -392,9 +392,9 @@ public class ActionScript2Parser {
}
if (s.type == SymbolType.ASSIGN) {
if (isStatic) {
staticVars.add(new MyEntry<GraphTargetItem, GraphTargetItem>(pushConst(ident), expression(false, false, true, variables)));
staticVars.add(new MyEntry<>(pushConst(ident), expression(false, false, true, variables)));
} else {
vars.add(new MyEntry<GraphTargetItem, GraphTargetItem>(pushConst(ident), expression(false, false, true, variables)));
vars.add(new MyEntry<>(pushConst(ident), expression(false, false, true, variables)));
}
s = lex();
}
@@ -1850,7 +1850,7 @@ public class ActionScript2Parser {
ActionSourceGenerator gen = new ActionSourceGenerator(swfVersion, constantPool);
List<Action> ret = new ArrayList<>();
SourceGeneratorLocalData localData = new SourceGeneratorLocalData(
new HashMap<String, Integer>(), 0, Boolean.FALSE, 0);
new HashMap<>(), 0, Boolean.FALSE, 0);
List<GraphSourceItem> srcList = gen.generate(localData, tree);
for (GraphSourceItem s : srcList) {
if (s instanceof Action) {

View File

@@ -582,7 +582,7 @@ public class ActionSourceGenerator implements SourceGenerator {
} while (item instanceof GetMemberActionItem);
if (item instanceof GetVariableActionItem) {
GetVariableActionItem v = (GetVariableActionItem) item;
item = new GetMemberActionItem(null, new GetVariableActionItem(null, new DirectValueActionItem(null, 0, "_global", new ArrayList<String>())), v.name);
item = new GetMemberActionItem(null, new GetVariableActionItem(null, new DirectValueActionItem(null, 0, "_global", new ArrayList<>())), v.name);
if (mem != null) {
mem.object = item;
}
@@ -682,7 +682,7 @@ public class ActionSourceGenerator implements SourceGenerator {
if (constructor == null) {
List<Action> val = new ArrayList<>();
val.add(new ActionDefineFunction("", new ArrayList<String>(), 0, SWF.DEFAULT_VERSION));
val.add(new ActionDefineFunction("", new ArrayList<>(), 0, SWF.DEFAULT_VERSION));
if (!isInterface) {
val.add(new ActionStoreRegister(1));
}
@@ -734,7 +734,7 @@ public class ActionSourceGenerator implements SourceGenerator {
if (constr.isEmpty()) {
List<Action> val = new ArrayList<>();
val.add(new ActionDefineFunction("", new ArrayList<String>(), 0, SWF.DEFAULT_VERSION));
val.add(new ActionDefineFunction("", new ArrayList<>(), 0, SWF.DEFAULT_VERSION));
if (!isInterface) {
val.add(new ActionStoreRegister(1));
}

View File

@@ -148,7 +148,7 @@ public class ActionDefineFunction extends Action implements GraphSourceItemConta
@Override
public void translateContainer(List<List<GraphTargetItem>> content, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions) {
FunctionActionItem fti = new FunctionActionItem(this, functionName, paramNames, content.get(0), constantPool, 1, new ArrayList<VariableActionItem>());
FunctionActionItem fti = new FunctionActionItem(this, functionName, paramNames, content.get(0), constantPool, 1, new ArrayList<>());
//ActionGraph.translateViaGraph(regNames, variables, functions, code, version)
stack.push(fti);
functions.put(functionName, fti);

View File

@@ -288,7 +288,7 @@ public class ActionDefineFunction2 extends Action implements GraphSourceItemCont
@Override
public void translateContainer(List<List<GraphTargetItem>> content, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions) {
FunctionActionItem fti = new FunctionActionItem(this, functionName, paramNames, content.get(0), constantPool, getFirstRegister(), new ArrayList<VariableActionItem>());
FunctionActionItem fti = new FunctionActionItem(this, functionName, paramNames, content.get(0), constantPool, getFirstRegister(), new ArrayList<>());
functions.put(functionName, fti);
stack.push(fti);
}

View File

@@ -98,7 +98,7 @@ public class FontHelper {
continue;
}
if (!ret.containsKey(fam)) {
ret.put(fam, new HashMap<String, Font>());
ret.put(fam, new HashMap<>());
}
ret.get(fam).put(f.getFontName(Locale.ENGLISH), f);

View File

@@ -275,7 +275,7 @@ public class DefineButton2Tag extends ButtonTag implements ASMSourceContainer {
return timeline;
}
timeline = new Timeline(swf, this, new ArrayList<Tag>(), buttonId, getRect());
timeline = new Timeline(swf, this, new ArrayList<>(), buttonId, getRect());
initTimeline(timeline);
return timeline;
}
@@ -283,7 +283,7 @@ public class DefineButton2Tag extends ButtonTag implements ASMSourceContainer {
@Override
public void resetTimeline() {
if (timeline != null) {
timeline.reset(swf, this, new ArrayList<Tag>(), buttonId, getRect());
timeline.reset(swf, this, new ArrayList<>(), buttonId, getRect());
initTimeline(timeline);
}
}

View File

@@ -364,7 +364,7 @@ public class DefineButtonTag extends ButtonTag implements ASMSource {
return timeline;
}
timeline = new Timeline(swf, this, new ArrayList<Tag>(), buttonId, getRect());
timeline = new Timeline(swf, this, new ArrayList<>(), buttonId, getRect());
initTimeline(timeline);
return timeline;
}
@@ -372,7 +372,7 @@ public class DefineButtonTag extends ButtonTag implements ASMSource {
@Override
public void resetTimeline() {
if (timeline != null) {
timeline.reset(swf, this, new ArrayList<Tag>(), buttonId, getRect());
timeline.reset(swf, this, new ArrayList<>(), buttonId, getRect());
initTimeline(timeline);
}
}

View File

@@ -83,7 +83,7 @@ public class Graph {
if (heads != null) {
return;
}
heads = makeGraph(code, new ArrayList<GraphPart>(), alternateEntries);
heads = makeGraph(code, new ArrayList<>(), alternateEntries);
int time = 1;
List<GraphPart> ordered = new ArrayList<>();
List<GraphPart> visited = new ArrayList<>();
@@ -870,7 +870,7 @@ public class Graph {
private void markLevels(String path, BaseLocalData localData, GraphPart part, List<GraphPart> allParts, List<Loop> loops) throws InterruptedException {
clearLoops(loops);
markLevels(path, localData, part, allParts, loops, new ArrayList<GraphPart>(), 1, new ArrayList<GraphPart>(), 0);
markLevels(path, localData, part, allParts, loops, new ArrayList<>(), 1, new ArrayList<>(), 0);
clearLoops(loops);
}
@@ -1021,7 +1021,7 @@ public class Graph {
private void getLoops(BaseLocalData localData, GraphPart part, List<Loop> loops, List<GraphPart> stopPart) throws InterruptedException {
clearLoops(loops);
getLoops(localData, part, loops, stopPart, true, 1, new ArrayList<GraphPart>());
getLoops(localData, part, loops, stopPart, true, 1, new ArrayList<>());
clearLoops(loops);
}
@@ -1841,7 +1841,7 @@ public class Graph {
checkContinueAtTheEnd(finalComm, currentLoop);
}
if (!finalComm.isEmpty()) {
ret.add(index, li = new ForItem(expr.src, currentLoop, new ArrayList<GraphTargetItem>(), exprList.get(exprList.size() - 1), finalComm, commands));
ret.add(index, li = new ForItem(expr.src, currentLoop, new ArrayList<>(), exprList.get(exprList.size() - 1), finalComm, commands));
} else {
ret.add(index, li = new WhileItem(expr.src, currentLoop, exprList, commands));
}

View File

@@ -174,7 +174,7 @@ public class GraphPart implements Serializable {
for (Loop l : loops) {
l.leadsToMark = 0;
}
return leadsTo(localData, gr, code, part, new ArrayList<GraphPart>(), loops);
return leadsTo(localData, gr, code, part, new ArrayList<>(), loops);
}
public GraphPart(int start, int end) {
@@ -279,7 +279,7 @@ public class GraphPart implements Serializable {
}
public boolean containsPart(GraphPart what) {
return containsPart(this, what, new ArrayList<GraphPart>());
return containsPart(this, what, new ArrayList<>());
}
public List<GraphPart> getSubParts() {

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.graph;
import com.jpexs.decompiler.flash.BaseLocalData;
@@ -93,7 +94,7 @@ public abstract class GraphSource implements Serializable {
HashMap<Integer, List<Integer>> refs = new HashMap<>();
int siz = size();
for (int i = 0; i < siz; i++) {
for (int i = 0; i < siz; i++) {
refs.put(i, new ArrayList<>());
}
visitCode(0, 0, refs, -1);
int pos = 0;

View File

@@ -47,7 +47,7 @@ public class TypeItem extends GraphTargetItem {
}
public TypeItem(DottedChain fullTypeName) {
this(fullTypeName, new ArrayList<GraphTargetItem>());
this(fullTypeName, new ArrayList<>());
}
public TypeItem(DottedChain fullTypeName, List<GraphTargetItem> subtypes) {