diff --git a/trunk/src/com/jpexs/decompiler/flash/Configuration.java b/trunk/src/com/jpexs/decompiler/flash/Configuration.java index 70c3e890c..aa3fa6817 100644 --- a/trunk/src/com/jpexs/decompiler/flash/Configuration.java +++ b/trunk/src/com/jpexs/decompiler/flash/Configuration.java @@ -58,11 +58,11 @@ public class Configuration { public static final int SUBLIMITER = 500; //using parameter names in decompiling may cause problems because oficial programs like Flash CS 5.5 inserts wrong parameter names indices public static final boolean PARAM_NAMES_ENABLE = false; - private static HashMap config = new HashMap(); + private static HashMap config = new HashMap<>(); /** * List of replacements */ - public static java.util.List replacements = new ArrayList(); + public static java.util.List replacements = new ArrayList<>(); /** * Saves replacements to file for future use @@ -90,7 +90,7 @@ public class Configuration { * Load replacements from file */ private static void loadReplacements(String replacementsFile) { - replacements = new ArrayList(); + replacements = new ArrayList<>(); try { BufferedReader br = new BufferedReader(new FileReader(replacementsFile)); String s; diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java index 8d3349584..d6b90fb8b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWF.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java @@ -123,7 +123,7 @@ public class SWF { /** * Tags inside of file */ - public List tags = new ArrayList(); + public List tags = new ArrayList<>(); /** * Rectangle for the display */ @@ -168,7 +168,7 @@ public class SWF { * @return List of tags */ public List getTagData(int tagId) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (Tag tag : tags) { if (tag.getId() == tagId) { ret.add(tag); @@ -309,7 +309,7 @@ public class SWF { } public void assignClassesToSymbols() { - HashMap classes = new HashMap(); + HashMap classes = new HashMap<>(); for (Tag t : tags) { if (t instanceof SymbolClassTag) { SymbolClassTag sct = (SymbolClassTag) t; @@ -424,7 +424,7 @@ public class SWF { } public boolean exportAS3Class(String className, String outdir, boolean isPcode) throws Exception { - List abcTags = new ArrayList(); + List abcTags = new ArrayList<>(); for (Tag t : tags) { if (t instanceof ABCContainerTag) { @@ -459,7 +459,7 @@ public class SWF { } } }; - List abcTags = new ArrayList(); + List abcTags = new ArrayList<>(); for (Tag t : tags) { if (t instanceof ABCContainerTag) { abcTags.add((ABCContainerTag) t); @@ -473,7 +473,7 @@ public class SWF { } if (!asV3Found) { - List list2 = new ArrayList(); + List list2 = new ArrayList<>(); list2.addAll(tags); List list = createASTagList(list2, null); @@ -488,11 +488,11 @@ public class SWF { } public static List createASTagList(List list, Object parent) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); int frame = 1; - List frames = new ArrayList(); + List frames = new ArrayList<>(); - List exportAssetsTags = new ArrayList(); + List exportAssetsTags = new ArrayList<>(); for (Object t : list) { if (t instanceof ExportAssetsTag) { exportAssetsTags.add((ExportAssetsTag) t); @@ -555,7 +555,7 @@ public class SWF { } return ret; } - private HashSet listeners = new HashSet(); + private HashSet listeners = new HashSet<>(); public final void addEventListener(EventListener listener) { listeners.add(listener); @@ -654,7 +654,7 @@ public class SWF { } if (t instanceof SoundStreamHeadTypeTag) { SoundStreamHeadTypeTag shead = (SoundStreamHeadTypeTag) t; - List blocks = new ArrayList(); + List blocks = new ArrayList<>(); List objs = new ArrayList(this.tags); populateSoundStreamBlocks(objs, t, blocks); if ((shead.getSoundFormat() == DefineSoundTag.FORMAT_ADPCM) && wave) { @@ -778,7 +778,7 @@ public class SWF { } if (t instanceof SoundStreamHeadTypeTag) { SoundStreamHeadTypeTag shead = (SoundStreamHeadTypeTag) t; - List blocks = new ArrayList(); + List blocks = new ArrayList<>(); List objs = new ArrayList(this.tags); populateSoundStreamBlocks(objs, t, blocks); if ((shead.getSoundFormat() == DefineSoundTag.FORMAT_ADPCM) && wave) { @@ -824,7 +824,7 @@ public class SWF { } public byte[] exportMovie(DefineVideoStreamTag videoStream) throws IOException { - HashMap frames = new HashMap(); + HashMap frames = new HashMap<>(); List os = new ArrayList(this.tags); populateVideoFrames(videoStream.characterID, os, frames); @@ -1076,16 +1076,16 @@ public class SWF { } return false; } - private HashMap deobfuscated = new HashMap(); + private HashMap deobfuscated = new HashMap<>(); private Random rnd = new Random(); private final int DEFAULT_FOO_SIZE = 10; public static final String validFirstCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_"; public static final String validNextCharacters = validFirstCharacters + "0123456789"; public static final String fooCharacters = "bcdfghjklmnpqrstvwz"; public static final String fooJoinCharacters = "aeiouy"; - private HashMap allVariableNames = new HashMap(); - private HashSet allVariableNamesStr = new HashSet(); - private List allFunctions = new ArrayList(); + private HashMap allVariableNames = new HashMap<>(); + private HashSet allVariableNamesStr = new HashSet<>(); + private List allFunctions = new ArrayList<>(); private String fooString(String orig, boolean firstUppercase, int rndSize) { boolean exists; @@ -1271,13 +1271,13 @@ public class SWF { } private HashMap getVariables(HashMap variables, List functions, ASMSource src) { - HashMap ret = new HashMap(); + HashMap ret = new HashMap<>(); List actions = src.getActions(version); actionsMap.put(src, actions); getVariables(variables, functions, new ActionGraphSource(actions, version, new HashMap(), new HashMap(), new HashMap()), 0); return ret; } - private HashMap> actionsMap = new HashMap>(); + private HashMap> actionsMap = new HashMap<>(); private void getVariables(List objs, String path) { for (Object o : objs) { @@ -1292,10 +1292,10 @@ public class SWF { } public int deobfuscateAS2Identifiers() { - actionsMap = new HashMap>(); - allFunctions = new ArrayList(); - allVariableNames = new HashMap(); - List objs = new ArrayList(); + actionsMap = new HashMap<>(); + allFunctions = new ArrayList<>(); + allVariableNames = new HashMap<>(); + List objs = new ArrayList<>(); int ret = 0; objs.addAll(tags); getVariables(objs, ""); @@ -1325,7 +1325,7 @@ public class SWF { if (changed != null) { ActionPush pu = (ActionPush) ti.src; if (pu.replacement == null) { - pu.replacement = new ArrayList(); + pu.replacement = new ArrayList<>(); pu.replacement.addAll(pu.values); } pu.replacement.set(ti.pos, changed); @@ -1548,7 +1548,7 @@ public class SWF { } public static BufferedImage frameToImage(int containerId, int frame, List allTags, List controlTags, RECT displayRect, int totalFrameCount) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); framesToImage(containerId, ret, frame, frame, allTags, controlTags, displayRect, totalFrameCount); if (ret.isEmpty()) { return new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); @@ -1582,7 +1582,7 @@ public class SWF { } - HashMap characters = new HashMap(); + HashMap characters = new HashMap<>(); for (Tag t : allTags) { if (t instanceof CharacterTag) { CharacterTag ch = (CharacterTag) t; @@ -1590,7 +1590,7 @@ public class SWF { } } - HashMap layers = new HashMap(); + HashMap layers = new HashMap<>(); int maxDepth = 0; int f = 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java index 165a2a304..6914598cf 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -60,6 +60,10 @@ import java.util.HashMap; import java.util.List; import java.util.Scanner; import java.util.Stack; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; import java.util.logging.Level; import java.util.logging.Logger; import java.util.zip.InflaterInputStream; @@ -72,13 +76,13 @@ import java.util.zip.InflaterInputStream; public class SWFInputStream extends InputStream { private InputStream is; - private Stack margedPos = new Stack(); + private Stack margedPos = new Stack<>(); private long pos; private int version; private static final Logger log = Logger.getLogger(SWFInputStream.class.getName()); - private List listeners = new ArrayList(); + private List listeners = new ArrayList<>(); private long percentMax; - private List buffered = new ArrayList(); + private List buffered = new ArrayList<>(); private ByteArrayOutputStream buffer; private static boolean DEOBFUSCATION_ALL_CODE_IN_PREVIOUS_TAG = (Boolean) Configuration.getConfig("deobfuscateUsePrevTagOnly", true); @@ -550,7 +554,7 @@ public class SWFInputStream extends InputStream { if (ins instanceof GraphSourceItemContainer) { GraphSourceItemContainer cnt = (GraphSourceItemContainer) ins; if (ins instanceof Action) { - List> output2s = new ArrayList>(); + List> output2s = new ArrayList<>(); long endAddr = ((Action) ins).getAddress() + cnt.getHeaderSize(); for (long size : cnt.getContainerSizes()) { if (size == 0) { @@ -558,7 +562,7 @@ public class SWFInputStream extends InputStream { continue; } List localData2 = Helper.toList(new HashMap(), new HashMap(), new HashMap()); - List output2 = new ArrayList(); + List output2 = new ArrayList<>(); output2s.add(output2); getConstantPool(listeners, cpool, localData2, new Stack(), output2, code, code.adr2pos(endAddr), lastIp, constantPools, visited, version, code.adr2pos(endAddr + size)); endAddr += size; @@ -694,7 +698,7 @@ public class SWFInputStream extends InputStream { } public static List getConstantPool(List listeners, ActionGraphSource code, int addr, int version) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); List localData = Helper.toList(new HashMap(), new HashMap(), new HashMap()); try { getConstantPool(listeners, null, localData, new Stack(), new ArrayList(), code, code.adr2pos(addr), 0, ret, new ArrayList(), version, -1); @@ -712,10 +716,10 @@ public class SWFInputStream extends InputStream { * @throws IOException */ public static List readActionList(List listeners, long address, long containerSWFOffset, ReReadableInputStream rri, int version, int ip, int endip) throws IOException { - List retdups = new ArrayList(); + List retdups = new ArrayList<>(); ConstantPool cpool = new ConstantPool(); - Stack stack = new Stack(); + Stack stack = new Stack<>(); List localData = Helper.toList(new HashMap(), new HashMap(), new HashMap()); @@ -739,7 +743,7 @@ public class SWFInputStream extends InputStream { } } } - List ret = new ArrayList(); + List ret = new ArrayList<>(); Action last = null; for (Action a : retdups) { if (a != last) { @@ -759,7 +763,7 @@ public class SWFInputStream extends InputStream { } } - List pools = new ArrayList(); + List pools = new ArrayList<>(); StringBuilder br = new StringBuilder(); for (int i = 0; i < ret.size(); i++) { br.append(i); @@ -787,7 +791,7 @@ public class SWFInputStream extends InputStream { ret.add(0, aj); } String s = null; - List reta = new ArrayList(); + List reta = new ArrayList<>(); for (Object o : ret) { if (o instanceof Action) { reta.add((Action) o); @@ -1045,14 +1049,14 @@ public class SWFInputStream extends InputStream { } containers.get(endAddr).add((ActionContainer)a); */ - List> output2s = new ArrayList>(); + List> output2s = new ArrayList<>(); for (long size : cnt.getContainerSizes()) { if (size == 0) { output2s.add(new ArrayList()); continue; } List localData2 = Helper.toList(new HashMap(), new HashMap(), new HashMap()); - List output2 = new ArrayList(); + List output2 = new ArrayList<>(); readActionListAtPos(listeners, output2, containers, address, containerSWFOffset, notCompileTime, enableVariables, localData2, new Stack(), cpool, sis, rri, (int) endAddr, ret, startIp, (int) (endAddr + size)); output2s.add(output2); endAddr += size; @@ -1132,6 +1136,24 @@ public class SWFInputStream extends InputStream { } } + private class TagResolutionTask implements Callable { + + private final Tag tag; + private final int version; + private final int level; + + public TagResolutionTask(Tag tag, int version, int level) { + this.tag = tag; + this.version = version; + this.level = level; + } + + @Override + public Tag call() throws Exception { + return SWFInputStream.resolveTag(tag, version, level); + } + } + /** * Reads list of tags from the stream. Reading ends with End tag(=0) or end * of the stream. @@ -1140,47 +1162,45 @@ public class SWFInputStream extends InputStream { * @throws IOException */ public List readTagList(int level) throws IOException { - List tags = new ArrayList(); + ExecutorService executor = Executors.newCachedThreadPool(); + List> futureResults = new ArrayList<>(); + List tags = new ArrayList<>(); Tag tag; Tag previousTag = null; while (true) { long pos = getPos(); - tag = readTag(level, pos); + tag = readTag(level, pos, false); if (tag == null) { break; } - tags.add(tag); if (Configuration.dump_tags && level == 0) { dumpTag(System.out, version, tag, level); } tag.previousTag = previousTag; previousTag = tag; + + Future future = executor.submit(new TagResolutionTask(tag, version, level)); + futureResults.add(future); + } + executor.shutdown(); + + for (Future future : futureResults) { + try { + tags.add(future.get()); + } catch (Exception e) { + Logger.getLogger(SWFInputStream.class.getName()).log(Level.SEVERE, "Error during tag reading", e); + } } return tags; } - /** - * Reads one Tag from the stream - * - * @return Tag or null when End tag - * @throws IOException - */ - public Tag readTag(int level, long pos) throws IOException { - int tagIDTagLength = readUI16(); - int tagID = (tagIDTagLength) >> 6; - if (tagID == 0) { - return null; - } - long tagLength = (tagIDTagLength & 0x003F); - boolean readLong = false; - if (tagLength == 0x3f) { - tagLength = readSI32(); - readLong = true; - } - byte data[] = readBytes((int) tagLength); + public static Tag resolveTag(Tag tag, int version, int level) { Tag ret; + + byte data[] = tag.getData(version); + long pos = tag.getPos(); try { - switch (tagID) { + switch (tag.getId()) { case 0: ret = new EndTag(data, version, pos); break; @@ -1399,12 +1419,48 @@ public class SWFInputStream extends InputStream { ret = new DefineFont4Tag(data, version, pos); break; default: - ret = new Tag(tagID, "Unknown", data, pos); + ret = new Tag(tag.getId(), "Unknown", data, pos); } } catch (Exception ex) { Logger.getLogger(SWFInputStream.class.getName()).log(Level.SEVERE, "Error during tag reading", ex); - ret = new Tag(tagID, "ErrorTag", data, pos); + ret = new Tag(tag.getId(), "ErrorTag", data, pos); } + ret.previousTag = tag.previousTag; + ret.forceWriteAsLong = tag.forceWriteAsLong; + return ret; + } + + /** + * Reads one Tag from the stream + * + * @return Tag or null when End tag + * @throws IOException + */ + public Tag readTag(int level, long pos) throws IOException { + return readTag(level, pos, true); + } + + /** + * Reads one Tag from the stream with optional resolving (= reading tag + * content) + * + * @return Tag or null when End tag + * @throws IOException + */ + public Tag readTag(int level, long pos, boolean resolve) throws IOException { + int tagIDTagLength = readUI16(); + int tagID = (tagIDTagLength) >> 6; + if (tagID == 0) { + return null; + } + long tagLength = (tagIDTagLength & 0x003F); + boolean readLong = false; + if (tagLength == 0x3f) { + tagLength = readSI32(); + readLong = true; + } + byte data[] = readBytes((int) tagLength); + Tag ret = new Tag(tagID, "Unknown", data, pos); ret.forceWriteAsLong = readLong; byte dataNew[] = ret.getData(version); @@ -1439,6 +1495,9 @@ public class SWFInputStream extends InputStream { log.fine(e); } } + if (resolve) { + return resolveTag(ret, version, level); + } return ret; } @@ -1833,7 +1892,7 @@ public class SWFInputStream extends InputStream { readUI16();//reserved ret.allEventFlags = readCLIPEVENTFLAGS(); CLIPACTIONRECORD cr; - ret.clipActionRecords = new ArrayList(); + ret.clipActionRecords = new ArrayList<>(); while ((cr = readCLIPACTIONRECORD()) != null) { ret.clipActionRecords.add(cr); } @@ -2069,7 +2128,7 @@ public class SWFInputStream extends InputStream { * @throws IOException */ public List readFILTERLIST() throws IOException { - List ret = new ArrayList(); + List ret = new ArrayList<>(); int numberOfFilters = readUI8(); for (int i = 0; i < numberOfFilters; i++) { ret.add(readFILTER()); @@ -2116,7 +2175,7 @@ public class SWFInputStream extends InputStream { * @throws IOException */ public List readBUTTONRECORDList(boolean inDefineButton2) throws IOException { - List ret = new ArrayList(); + List ret = new ArrayList<>(); BUTTONRECORD br; while ((br = readBUTTONRECORD(inDefineButton2)) != null) { ret.add(br); @@ -2178,7 +2237,7 @@ public class SWFInputStream extends InputStream { * @throws IOException */ public List readBUTTONCONDACTIONList() throws IOException { - List ret = new ArrayList(); + List ret = new ArrayList<>(); BUTTONCONDACTION bc; while (!(bc = readBUTTONCONDACTION()).isLast) { ret.add(bc); @@ -2498,7 +2557,7 @@ public class SWFInputStream extends InputStream { * @throws IOException */ public List readSHAPERECORDS(int shapeNum, int fillBits, int lineBits) throws IOException { - List ret = new ArrayList(); + List ret = new ArrayList<>(); SHAPERECORD rec; do { rec = readSHAPERECORD(fillBits, lineBits, shapeNum); @@ -2907,8 +2966,8 @@ public class SWFInputStream extends InputStream { */ public BITMAPDATA readBITMAPDATA(int bitmapFormat, int bitmapWidth, int bitmapHeight) throws IOException { BITMAPDATA ret = new BITMAPDATA(); - List pix15 = new ArrayList(); - List pix24 = new ArrayList(); + List pix15 = new ArrayList<>(); + List pix24 = new ArrayList<>(); int dataLen = 0; for (int y = 0; y < bitmapHeight; y++) { int x = 0; diff --git a/trunk/src/com/jpexs/decompiler/flash/TagNode.java b/trunk/src/com/jpexs/decompiler/flash/TagNode.java index f5638ab6c..971e098a8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/TagNode.java +++ b/trunk/src/com/jpexs/decompiler/flash/TagNode.java @@ -58,7 +58,7 @@ public class TagNode { public boolean export = false; public List getAllSubs() { - List ret = new ArrayList(); + List ret = new ArrayList<>(); ret.addAll(subItems); for (TagNode n : subItems) { ret.addAll(n.getAllSubs()); @@ -68,7 +68,7 @@ public class TagNode { public TagNode(Object tag) { this.tag = tag; - this.subItems = new ArrayList(); + this.subItems = new ArrayList<>(); } @Override @@ -77,19 +77,19 @@ public class TagNode { } public static List createTagList(List list) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); int frame = 1; - List frames = new ArrayList(); - List shapes = new ArrayList(); - List morphShapes = new ArrayList(); - List sprites = new ArrayList(); - List buttons = new ArrayList(); - List images = new ArrayList(); - List fonts = new ArrayList(); - List texts = new ArrayList(); + List frames = new ArrayList<>(); + List shapes = new ArrayList<>(); + List morphShapes = new ArrayList<>(); + List sprites = new ArrayList<>(); + List buttons = new ArrayList<>(); + List images = new ArrayList<>(); + List fonts = new ArrayList<>(); + List texts = new ArrayList<>(); - List exportAssetsTags = new ArrayList(); + List exportAssetsTags = new ArrayList<>(); for (Object t : list) { if (t instanceof ExportAssetsTag) { exportAssetsTags.add((ExportAssetsTag) t); @@ -237,7 +237,7 @@ public class TagNode { if (!outdir.endsWith(File.separator)) { outdir = outdir + File.separator; } - List existingNames = new ArrayList(); + List existingNames = new ArrayList<>(); for (TagNode node : nodeList) { String name = ""; if (node.tag instanceof Tag) { diff --git a/trunk/src/com/jpexs/decompiler/flash/Version.java b/trunk/src/com/jpexs/decompiler/flash/Version.java index 6191ef09f..e4cf087e4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/Version.java +++ b/trunk/src/com/jpexs/decompiler/flash/Version.java @@ -33,5 +33,5 @@ public class Version { public String appName; public String appFullName; public String updateLink; - public Map> changes = new HashMap>(); + public Map> changes = new HashMap<>(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java b/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java index 9cf9f67bf..b52ac6e6a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java @@ -53,7 +53,7 @@ public class ABC { public long stringOffsets[]; public static String IDENT_STRING = " "; public static final int MINORwithDECIMAL = 17; - protected HashSet listeners = new HashSet(); + protected HashSet listeners = new HashSet<>(); private static Logger logger = Logger.getLogger(ABC.class.getName()); public void addEventListener(EventListener listener) { @@ -521,7 +521,7 @@ public class ABC { private HashMap namespaceMap; private void loadNamespaceMap() { - namespaceMap = new HashMap(); + namespaceMap = new HashMap<>(); for (ScriptInfo si : script_info) { for (Trait t : si.traits.traits) { if (t instanceof TraitSlotConst) { @@ -612,7 +612,7 @@ public class ABC { public static final String validNsCharacters = ".:$"; public static final String fooCharacters = "bcdfghjklmnpqrstvwz"; public static final String fooJoinCharacters = "aeiouy"; - private HashMap deobfuscated = new HashMap(); + private HashMap deobfuscated = new HashMap<>(); private Random rnd = new Random(); private final int DEFAULT_FOO_SIZE = 10; @@ -815,7 +815,7 @@ public class ABC { } public List findMultinameUsage(int multinameIndex) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); if (multinameIndex == 0) { return ret; } @@ -893,7 +893,7 @@ public class ABC { for (int t = 0; t < script_info[c].traits.traits.length; t++) { Trait tr = script_info[c].traits.traits[t]; if (tr.getPath(this).equals(name)) { - List indices = new ArrayList(); + List indices = new ArrayList<>(); indices.add(t); return new ScriptPack(this, c, indices); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java b/trunk/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java index 76aa45551..03c65aab9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ABCInputStream.java @@ -203,7 +203,7 @@ public class ABCInputStream extends InputStream { int name_index = -1; int namespace_set_index = -1; int qname_index = -1; - List params = new ArrayList(); + List params = new ArrayList<>(); if ((kind == 7) || (kind == 0xd)) { // CONSTANT_QName and CONSTANT_QNameA. namespace_index = readU30(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java index f8f63a232..9ff4976ab 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -65,7 +65,7 @@ public class AVM2Code implements Serializable { private static final boolean DEBUG_MODE = false; public static int toSourceLimit = -1; - public ArrayList code = new ArrayList(); + public ArrayList code = new ArrayList<>(); public static boolean DEBUG_REWRITE = false; public static final int OPT_U30 = 0x100; public static final int OPT_U8 = 0x200; @@ -709,7 +709,7 @@ public class AVM2Code implements Serializable { ret.append("exception " + e + " m[" + body.exceptions[e].name_index + "]\"" + Helper.escapeString(body.exceptions[e].getVarName(constants, new ArrayList())) + "\" " + "m[" + body.exceptions[e].type_index + "]\"" + Helper.escapeString(body.exceptions[e].getTypeName(constants, new ArrayList())) + "\"\n"); } - List offsets = new ArrayList(); + List offsets = new ArrayList<>(); for (AVM2Instruction ins : code) { offsets.addAll(ins.getOffsets()); } @@ -798,7 +798,7 @@ public class AVM2Code implements Serializable { private List posCache; private void buildCache() { - posCache = new ArrayList(); + posCache = new ArrayList<>(); long a = 0; for (int i = 0; i < code.size(); i++) { posCache.add(a); @@ -994,7 +994,7 @@ public class AVM2Code implements Serializable { } public HashMap getLocalRegNamesFromDebug(ABC abc) { - HashMap localRegNames = new HashMap(); + HashMap localRegNames = new HashMap<>(); for (AVM2Instruction ins : code) { if (ins.definition instanceof DebugIns) { if (ins.operands[0] == 1) { @@ -1048,7 +1048,7 @@ public class AVM2Code implements Serializable { throw new ConvertException("Limit of subs(" + toSourceLimit + ") was reached", start); } } - List output = new ArrayList(); + List output = new ArrayList<>(); String ret = ""; int ip = start; try { @@ -1309,7 +1309,7 @@ public class AVM2Code implements Serializable { } public HashMap getLocalRegTypes(ConstantPool constants, List fullyQualifiedNames) { - HashMap ret = new HashMap(); + HashMap ret = new HashMap<>(); AVM2Instruction prev = null; for (AVM2Instruction ins : code) { if (ins.definition instanceof SetLocalTypeIns) { @@ -1354,18 +1354,18 @@ public class AVM2Code implements Serializable { public void initToSource() { toSourceCount = 0; - loopList = new ArrayList(); - unknownJumps = new ArrayList(); - finallyJumps = new ArrayList(); - parsedExceptions = new ArrayList(); - ignoredIns = new ArrayList(); + loopList = new ArrayList<>(); + unknownJumps = new ArrayList<>(); + finallyJumps = new ArrayList<>(); + parsedExceptions = new ArrayList<>(); + ignoredIns = new ArrayList<>(); } public String toSource(String path, boolean isStatic, int scriptIndex, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body, boolean hilighted, HashMap localRegNames, Stack scopeStack, boolean isStaticInitializer, List fullyQualifiedNames, Traits initTraits) { initToSource(); List list; String s; - HashMap localRegs = new HashMap(); + HashMap localRegs = new HashMap<>(); int regCount = getRegisterCount(); int paramCount; @@ -1424,7 +1424,7 @@ public class AVM2Code implements Serializable { } } if (isStaticInitializer) { - List newList = new ArrayList(); + List newList = new ArrayList<>(); for (GraphTargetItem ti : list) { if (!(ti instanceof ReturnVoidTreeItem)) { if (!(ti instanceof InitPropertyTreeItem)) { @@ -1444,7 +1444,7 @@ public class AVM2Code implements Serializable { for (int b = 0; b < declaredRegisters.length; b++) { declaredRegisters[b] = false; } - List declaredSlots = new ArrayList(); + List declaredSlots = new ArrayList<>(); for (int i = 0; i < list.size(); i++) { GraphTargetItem ti = list.get(i); if (ti instanceof SetLocalTreeItem) { @@ -1597,7 +1597,7 @@ public class AVM2Code implements Serializable { public int removeTraps(ConstantPool constants, MethodBody body, ABC abc, int scriptIndex, int classIndex, boolean isStatic) { removeDeadCode(constants, body); - List localData = new ArrayList(); + List localData = new ArrayList<>(); localData.add((Boolean) isStatic); //isStatic localData.add((Integer) (classIndex)); //classIndex localData.add(new HashMap()); @@ -1762,7 +1762,7 @@ public class AVM2Code implements Serializable { } public HashMap> visitCode(MethodBody body) { - HashMap> refs = new HashMap>(); + HashMap> refs = new HashMap<>(); for (int i = 0; i < code.size(); i++) { refs.put(i, new ArrayList()); } @@ -1923,7 +1923,7 @@ public class AVM2Code implements Serializable { } public void restoreControlFlow(int ip, HashMap> refs, int visited2[], HashMap> appended) throws ConvertException { - List buf = new ArrayList(); + List buf = new ArrayList<>(); boolean cont = false; int continueip = 0; AVM2Instruction prev = null; @@ -1983,7 +1983,7 @@ public class AVM2Code implements Serializable { if ((newip < code.size()) && (refs.containsKey(newip) && refs.get(newip).size() == 1)) { if (!cont) { continueip = ip; - buf = new ArrayList(); + buf = new ArrayList<>(); appended.put(continueip, buf); } cont = true; @@ -2019,7 +2019,7 @@ public class AVM2Code implements Serializable { HashMap> refs; int visited2[] = new int[code.size()]; refs = visitCode(body); - HashMap> appended = new HashMap>(); + HashMap> appended = new HashMap<>(); /*if (secondpass) { restoreControlFlow(code.size() - 1, refs, visited2, appended); } else*/ { @@ -2042,7 +2042,7 @@ public class AVM2Code implements Serializable { } invalidateCache(); try { - List outputMap = new ArrayList(); + List outputMap = new ArrayList<>(); String src = Highlighting.stripHilights(toASMSource(constants, body, outputMap, false)); AVM2Code acode = ASM3Parser.parse(new ByteArrayInputStream(src.getBytes("UTF-8")), constants, null, body); @@ -2082,7 +2082,7 @@ public class AVM2Code implements Serializable { }*/ public void removeIgnored(ConstantPool constants, MethodBody body) { try { - List outputMap = new ArrayList(); + List outputMap = new ArrayList<>(); String src = toASMSource(constants, body, outputMap, false); AVM2Code acode = ASM3Parser.parse(new ByteArrayInputStream(src.getBytes("UTF-8")), constants, body); for (int i = 0; i < acode.code.size(); i++) { @@ -2341,7 +2341,7 @@ public class AVM2Code implements Serializable { } public static int removeTraps(List localData, AVM2GraphSource code, int addr) { - HashMap decisions = new HashMap(); + HashMap decisions = new HashMap<>(); removeTraps(false, false, localData, new Stack(), new ArrayList(), code, code.adr2pos(addr), 0, new HashMap(), new HashMap>(), decisions); localData.set(2, new HashMap()); return removeTraps(true, false, localData, new Stack(), new ArrayList(), code, code.adr2pos(addr), 0, new HashMap(), new HashMap>(), decisions); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/LocalDataArea.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/LocalDataArea.java index bbb22c4db..9f781d4e4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/LocalDataArea.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/LocalDataArea.java @@ -21,7 +21,7 @@ import java.util.Stack; public class LocalDataArea { - public Stack operandStack = new Stack(); - public Stack scopeStack = new Stack(); - public HashMap localRegisters = new HashMap(); + public Stack operandStack = new Stack<>(); + public Stack scopeStack = new Stack<>(); + public HashMap localRegisters = new HashMap<>(); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java index 85b23177d..55e76b571 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java @@ -105,11 +105,11 @@ public class AVM2Graph extends Graph { public static List translateViaGraph(String path, AVM2Code code, ABC abc, MethodBody body, boolean isStatic, int scriptIndex, int classIndex, HashMap localRegs, Stack scopeStack, HashMap localRegNames, List fullyQualifiedNames) { AVM2Graph g = new AVM2Graph(code, abc, body, isStatic, scriptIndex, classIndex, localRegs, scopeStack, localRegNames, fullyQualifiedNames); - List allParts = new ArrayList(); + List allParts = new ArrayList<>(); for (GraphPart head : g.heads) { populateParts(head, allParts); } - List localData = new ArrayList(); + List localData = new ArrayList<>(); localData.add((Boolean) isStatic); localData.add((Integer) classIndex); localData.add(localRegs); @@ -1161,7 +1161,7 @@ public class AVM2Graph extends Graph { int ip = part.start; int addr = code.fixAddrAfterDebugLine(code.pos2adr(part.start)); int maxend = -1; - List catchedExceptions = new ArrayList(); + List catchedExceptions = new ArrayList<>(); for (int e = 0; e < body.exceptions.length; e++) { if (addr == code.fixAddrAfterDebugLine(body.exceptions[e].start)) { if (!body.exceptions[e].isFinally()) { @@ -1181,7 +1181,7 @@ public class AVM2Graph extends Graph { int endposStartBlock = code.adr2pos(catchedExceptions.get(0).end); - List> catchedCommands = new ArrayList>(); + List> catchedCommands = new ArrayList<>(); if (code.code.get(endpos).definition instanceof JumpIns) { int afterCatchAddr = code.pos2adr(endpos + 1) + code.code.get(endpos).operands[0]; int afterCatchPos = code.adr2pos(afterCatchAddr); @@ -1193,7 +1193,7 @@ public class AVM2Graph extends Graph { }); - List finallyCommands = new ArrayList(); + List finallyCommands = new ArrayList<>(); int returnPos = afterCatchPos; for (int e = 0; e < body.exceptions.length; e++) { if (body.exceptions[e].isFinally()) { @@ -1271,7 +1271,7 @@ public class AVM2Graph extends Graph { } } stack.add(new ExceptionTreeItem(catchedExceptions.get(e))); - List localData2 = new ArrayList(); + List localData2 = new ArrayList<>(); localData2.addAll(localData); localData2.set(DATA_SCOPESTACK, new Stack()); catchedCommands.add(printGraph(new ArrayList(), localData2, stack, allParts, parent, npart, nepart, loops, forFinalCommands)); @@ -1305,7 +1305,7 @@ public class AVM2Graph extends Graph { } } } - ret = new ArrayList(); + ret = new ArrayList<>(); ret.addAll(output); GraphTargetItem lop = checkLoop(part, stopPart, loops); if (lop == null) { @@ -1323,7 +1323,7 @@ public class AVM2Graph extends Graph { if (code.code.get(part.getPosAt(part.getHeight() - 3)).definition instanceof GetLocalTypeIns) { if (output.size() >= 2) { if (output.get(output.size() - 2) instanceof SetLocalTreeItem) { - ret = new ArrayList(); + ret = new ArrayList<>(); ret.addAll(output); ret.remove(ret.size() - 1); ret.add(new ReturnValueTreeItem(code.code.get(part.end), ((SetLocalTreeItem) output.get(output.size() - 2)).value)); @@ -1336,7 +1336,7 @@ public class AVM2Graph extends Graph { } } if (code.code.get(part.end).definition instanceof LookupSwitchIns) { - ret = new ArrayList(); + ret = new ArrayList<>(); ret.addAll(output); return ret; } @@ -1353,7 +1353,7 @@ public class AVM2Graph extends Graph { && (part.nextParts.get(1).getHeight() >= 2) && (code.code.get(code.fixIPAfterDebugLine(part.nextParts.get(1).start)).definition instanceof PushIntegerTypeIns) && (code.code.get(part.nextParts.get(1).nextParts.get(0).end).definition instanceof LookupSwitchIns))) { - ret = new ArrayList(); + ret = new ArrayList<>(); ret.addAll(output); boolean reversed = false; if (stack.peek() instanceof StrictEqTreeItem) { @@ -1368,7 +1368,7 @@ public class AVM2Graph extends Graph { if (switchedObject == null) { switchedObject = new NullTreeItem(null); } - HashMap caseValuesMap = new HashMap(); + HashMap caseValuesMap = new HashMap<>(); GraphTargetItem tar = stack.pop(); if (tar instanceof StrictEqTreeItem) { @@ -1412,7 +1412,7 @@ public class AVM2Graph extends Graph { if (code.code.get(dp.start).definition instanceof PushIntegerTypeIns) { hasDefault = true; } - List caseValues = new ArrayList(); + List caseValues = new ArrayList<>(); for (int i = 0; i < switchLoc.nextParts.size() - 1; i++) { if (caseValuesMap.containsKey(i)) { caseValues.add(caseValuesMap.get(i)); @@ -1421,7 +1421,7 @@ public class AVM2Graph extends Graph { } } - List> caseCommands = new ArrayList>(); + List> caseCommands = new ArrayList<>(); GraphPart next = null; List loopContinues = getLoopsContinues(loops); @@ -1435,8 +1435,8 @@ public class AVM2Graph extends Graph { Loop currentLoop = new Loop(loops.size(), null, next); loops.add(currentLoop); //switchLoc.getNextPartPath(new ArrayList()); - List valuesMapping = new ArrayList(); - List caseBodies = new ArrayList(); + List valuesMapping = new ArrayList<>(); + List caseBodies = new ArrayList<>(); for (int i = 0; i < caseValues.size(); i++) { GraphPart cur = switchLoc.nextParts.get(1 + i); if (!caseBodies.contains(cur)) { @@ -1445,20 +1445,20 @@ public class AVM2Graph extends Graph { valuesMapping.add(caseBodies.indexOf(cur)); } - List defaultCommands = new ArrayList(); + List defaultCommands = new ArrayList<>(); GraphPart defaultPart = null; if (hasDefault) { defaultPart = switchLoc.nextParts.get(switchLoc.nextParts.size() - 1); defaultCommands = printGraph(new ArrayList(), localData, stack, allParts, switchLoc, defaultPart, next, loops, forFinalCommands); } - List ignored = new ArrayList(); + List ignored = new ArrayList<>(); for (Loop l : loops) { ignored.add(l.loopContinue); } for (int i = 0; i < caseBodies.size(); i++) { - List cc = new ArrayList(); + List cc = new ArrayList<>(); GraphPart nextCase = null; nextCase = next; if (next != null) { @@ -1568,11 +1568,11 @@ public class AVM2Graph extends Graph { @Override public List prepareBranchLocalData(List localData) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); ret.addAll(localData); @SuppressWarnings("unchecked") Stack scopeStack = (Stack) ret.get(DATA_SCOPESTACK); - Stack copyScopeStack = new Stack(); + Stack copyScopeStack = new Stack<>(); copyScopeStack.addAll(scopeStack); ret.set(DATA_SCOPESTACK, copyScopeStack); return ret; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2GraphSource.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2GraphSource.java index f5ab543c2..6839efbd8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2GraphSource.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2GraphSource.java @@ -65,7 +65,7 @@ public class AVM2GraphSource extends GraphSource { @Override @SuppressWarnings("unchecked") public List translatePart(GraphPart part, List localData, Stack stack, int start, int end) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); Object o = localData.get(AVM2Graph.DATA_SCOPESTACK); Stack newstack = (Stack) o; ConvertOutput co = code.toSourceOutput(part, false, isStatic, scriptIndex, classIndex, localRegs, stack, newstack, abc, abc.constants, abc.method_info, body, start, end, localRegNames, fullyQualifiedNames, new boolean[size()]); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java index 91ff0ba68..091a8491a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java @@ -103,7 +103,7 @@ public class AVM2Instruction implements Serializable, GraphSourceItem { } public List getOffsets() { - List ret = new ArrayList(); + List ret = new ArrayList<>(); String s = ""; for (int i = 0; i < definition.operands.length; i++) { switch (definition.operands[i]) { @@ -125,7 +125,7 @@ public class AVM2Instruction implements Serializable, GraphSourceItem { } public List getParamsAsList(ConstantPool constants) { - List s = new ArrayList(); + List s = new ArrayList<>(); for (int i = 0; i < definition.operands.length; i++) { switch (definition.operands[i]) { case AVM2Code.DAT_MULTINAME_INDEX: @@ -276,7 +276,7 @@ public class AVM2Instruction implements Serializable, GraphSourceItem { @Override public List getBranches(GraphSource code) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); if (definition instanceof IfTypeIns) { ret.add(code.adr2pos(offset + getBytes().length + operands[0])); if (!(definition instanceof JumpIns)) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructIns.java index fc27452b5..3e6c1ad74 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructIns.java @@ -76,7 +76,7 @@ public class ConstructIns extends InstructionDefinition { @Override public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int argCount = ins.operands[0]; - List args = new ArrayList(); + List args = new ArrayList<>(); for (int a = 0; a < argCount; a++) { args.add(0, (GraphTargetItem) stack.pop()); } @@ -100,7 +100,7 @@ public class ConstructIns extends InstructionDefinition { if (isXML) { if (args.size() == 1) { GraphTargetItem arg = args.get(0); - List xmlLines = new ArrayList(); + List xmlLines = new ArrayList<>(); if (walkXML(arg, xmlLines)) { stack.push(new XMLTreeItem(ins, xmlLines)); return; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructPropIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructPropIns.java index 3f66dbe38..58862f2bb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructPropIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructPropIns.java @@ -57,7 +57,7 @@ public class ConstructPropIns extends InstructionDefinition { public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; int argCount = ins.operands[1]; - List args = new ArrayList(); + List args = new ArrayList<>(); for (int a = 0; a < argCount; a++) { args.add(0, (GraphTargetItem) stack.pop()); } @@ -67,7 +67,7 @@ public class ConstructPropIns extends InstructionDefinition { if (multiname.isXML(constants, localRegNames, fullyQualifiedNames)) { if (args.size() == 1) { GraphTargetItem arg = args.get(0); - List xmlLines = new ArrayList(); + List xmlLines = new ArrayList<>(); if (ConstructIns.walkXML(arg, xmlLines)) { stack.push(new XMLTreeItem(ins, xmlLines)); return; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructSuperIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructSuperIns.java index 72a861fd7..4897cd949 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructSuperIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructSuperIns.java @@ -52,7 +52,7 @@ public class ConstructSuperIns extends InstructionDefinition { @Override public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int argCount = ins.operands[0]; - List args = new ArrayList(); + List args = new ArrayList<>(); for (int a = 0; a < argCount; a++) { args.add(0, (GraphTargetItem) stack.pop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewArrayIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewArrayIns.java index 58d70d8a6..30642caf0 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewArrayIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewArrayIns.java @@ -38,7 +38,7 @@ public class NewArrayIns extends InstructionDefinition { @Override public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int argCount = ins.operands[0]; - List args = new ArrayList(); + List args = new ArrayList<>(); for (int a = 0; a < argCount; a++) { args.add(0, (GraphTargetItem) stack.pop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewObjectIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewObjectIns.java index 0ca3882d0..1c2b98ee7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewObjectIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewObjectIns.java @@ -39,7 +39,7 @@ public class NewObjectIns extends InstructionDefinition { @Override public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int argCount = ins.operands[0]; - List args = new ArrayList(); + List args = new ArrayList<>(); for (int a = 0; a < argCount; a++) { GraphTargetItem value = (GraphTargetItem) stack.pop(); GraphTargetItem name = (GraphTargetItem) stack.pop(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallIns.java index 2f4921b4b..13d384144 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallIns.java @@ -52,7 +52,7 @@ public class CallIns extends InstructionDefinition { @Override public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int argCount = ins.operands[0]; - List args = new ArrayList(); + List args = new ArrayList<>(); for (int a = 0; a < argCount; a++) { args.add(0, (GraphTargetItem) stack.pop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallMethodIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallMethodIns.java index c4b931861..63513969b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallMethodIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallMethodIns.java @@ -53,7 +53,7 @@ public class CallMethodIns extends InstructionDefinition { public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int methodIndex = ins.operands[0]; int argCount = ins.operands[1]; - List args = new ArrayList(); + List args = new ArrayList<>(); for (int a = 0; a < argCount; a++) { args.add(0, (GraphTargetItem) stack.pop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropLexIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropLexIns.java index d8a6f100e..01ac8b6cc 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropLexIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropLexIns.java @@ -39,7 +39,7 @@ public class CallPropLexIns extends CallPropertyIns { public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; int argCount = ins.operands[1]; - List args = new ArrayList(); + List args = new ArrayList<>(); for (int a = 0; a < argCount; a++) { args.add(0, (GraphTargetItem) stack.pop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropVoidIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropVoidIns.java index 8516ca03f..27b691985 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropVoidIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropVoidIns.java @@ -58,7 +58,7 @@ public class CallPropVoidIns extends InstructionDefinition { public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; int argCount = ins.operands[1]; - List args = new ArrayList(); + List args = new ArrayList<>(); for (int a = 0; a < argCount; a++) { args.add(0, (GraphTargetItem) stack.pop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropertyIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropertyIns.java index e3f0a6f1f..0ecb00d55 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropertyIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropertyIns.java @@ -56,7 +56,7 @@ public class CallPropertyIns extends InstructionDefinition { public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; int argCount = ins.operands[1]; - List args = new ArrayList(); + List args = new ArrayList<>(); for (int a = 0; a < argCount; a++) { args.add(0, (GraphTargetItem) stack.pop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallStaticIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallStaticIns.java index 4c94b145a..3d26d5658 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallStaticIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallStaticIns.java @@ -53,7 +53,7 @@ public class CallStaticIns extends InstructionDefinition { public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int methodIndex = ins.operands[0]; int argCount = ins.operands[1]; - List args = new ArrayList(); + List args = new ArrayList<>(); for (int a = 0; a < argCount; a++) { args.add(0, (GraphTargetItem) stack.pop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperIns.java index 9cbd912f4..b75903f80 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperIns.java @@ -56,7 +56,7 @@ public class CallSuperIns extends InstructionDefinition { public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; int argCount = ins.operands[1]; - List args = new ArrayList(); + List args = new ArrayList<>(); for (int a = 0; a < argCount; a++) { args.add(0, (GraphTargetItem) stack.pop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperVoidIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperVoidIns.java index 6e3219570..b22dc41d4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperVoidIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperVoidIns.java @@ -56,7 +56,7 @@ public class CallSuperVoidIns extends InstructionDefinition { public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int multinameIndex = ins.operands[0]; int argCount = ins.operands[1]; - List args = new ArrayList(); + List args = new ArrayList<>(); for (int a = 0; a < argCount; a++) { args.add(0, (GraphTargetItem) stack.pop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ApplyTypeIns.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ApplyTypeIns.java index 57c627dbd..c34c7b279 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ApplyTypeIns.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ApplyTypeIns.java @@ -36,7 +36,7 @@ public class ApplyTypeIns extends InstructionDefinition { @Override public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { int argCount = (int) ((Long) arguments.get(0)).longValue(); - List params = new ArrayList(); + List params = new ArrayList<>(); for (int i = 0; i < argCount; i++) { params.add(lda.operandStack.pop()); } @@ -47,7 +47,7 @@ public class ApplyTypeIns extends InstructionDefinition { @Override public void translate(boolean isStatic, int scriptIndex, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.decompiler.flash.abc.types.MethodBody body, com.jpexs.decompiler.flash.abc.ABC abc, HashMap localRegNames, List fullyQualifiedNames) { int argCount = ins.operands[0]; - List params = new ArrayList(); + List params = new ArrayList<>(); for (int i = 0; i < argCount; i++) { params.add(0, stack.pop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/ASM3Parser.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/ASM3Parser.java index 86c45f087..46277c98e 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/ASM3Parser.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/ASM3Parser.java @@ -75,10 +75,10 @@ public class ASM3Parser { public static AVM2Code parse(InputStream is, ConstantPool constants, MissingSymbolHandler missingHandler, MethodBody body) throws IOException, ParseException { AVM2Code code = new AVM2Code(); - List offsetItems = new ArrayList(); - List labelItems = new ArrayList(); - List exceptions = new ArrayList(); - List exceptionIndices = new ArrayList(); + List offsetItems = new ArrayList<>(); + List labelItems = new ArrayList<>(); + List exceptions = new ArrayList<>(); + List exceptionIndices = new ArrayList<>(); int offset = 0; Flasm3Lexer lexer = new Flasm3Lexer(new InputStreamReader(is, "UTF-8")); @@ -149,7 +149,7 @@ public class ASM3Parser { for (InstructionDefinition def : AVM2Code.instructionSet) { if (def.instructionName.equals((String) symb.value)) { insFound = true; - List operandsList = new ArrayList(); + List operandsList = new ArrayList<>(); for (int i = 0; i < def.operands.length; i++) { ParsedSymbol parsedOperand = lexer.yylex(); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/NewActivationTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/NewActivationTreeItem.java index 64f92eb10..f3b5b7b62 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/NewActivationTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/NewActivationTreeItem.java @@ -24,7 +24,7 @@ import java.util.List; public class NewActivationTreeItem extends TreeItem { - public HashMap slots = new HashMap(); + public HashMap slots = new HashMap<>(); public NewActivationTreeItem(AVM2Instruction instruction) { super(instruction, NOPRECEDENCE); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/WithTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/WithTreeItem.java index a58476640..a4492b1ce 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/WithTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/WithTreeItem.java @@ -37,7 +37,7 @@ public class WithTreeItem extends TreeItem { public WithTreeItem(AVM2Instruction instruction, GraphTargetItem scope) { super(instruction, NOPRECEDENCE); this.scope = scope; - this.items = new ArrayList(); + this.items = new ArrayList<>(); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/ForEachInTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/ForEachInTreeItem.java index e0d8f9c94..1f0e72877 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/ForEachInTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/ForEachInTreeItem.java @@ -33,7 +33,7 @@ public class ForEachInTreeItem extends LoopItem implements Block { @Override public List> getSubs() { - List> ret = new ArrayList>(); + List> ret = new ArrayList<>(); ret.add(commands); return ret; } @@ -81,7 +81,7 @@ public class ForEachInTreeItem extends LoopItem implements Block { @Override public List getContinues() { - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (GraphTargetItem ti : commands) { if (ti instanceof ContinueItem) { ret.add((ContinueItem) ti); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/ForInTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/ForInTreeItem.java index 42732fef7..2b6013e35 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/ForInTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/ForInTreeItem.java @@ -33,7 +33,7 @@ public class ForInTreeItem extends LoopItem implements Block { @Override public List> getSubs() { - List> ret = new ArrayList>(); + List> ret = new ArrayList<>(); ret.add(commands); return ret; } @@ -81,7 +81,7 @@ public class ForInTreeItem extends LoopItem implements Block { @Override public List getContinues() { - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (GraphTargetItem ti : commands) { if (ti instanceof ContinueItem) { ret.add((ContinueItem) ti); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/TryTreeItem.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/TryTreeItem.java index 506c7d6e4..92cc5028b 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/TryTreeItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/treemodel/clauses/TryTreeItem.java @@ -36,7 +36,7 @@ public class TryTreeItem extends TreeItem implements Block { @Override public List> getSubs() { - List> ret = new ArrayList>(); + List> ret = new ArrayList<>(); ret.add(tryCommands); ret.addAll(catchCommands); ret.add(finallyCommands); @@ -85,7 +85,7 @@ public class TryTreeItem extends TreeItem implements Block { @Override public List getContinues() { - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (GraphTargetItem ti : tryCommands) { if (ti instanceof ContinueItem) { ret.add((ContinueItem) ti); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/ABCPanel.java b/trunk/src/com/jpexs/decompiler/flash/abc/gui/ABCPanel.java index ce8987526..fd61b32b2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/gui/ABCPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/gui/ABCPanel.java @@ -68,7 +68,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener { public JTabbedPane tabbedPane; public JPanel searchPanel; public JLabel searchPos; - private List found = new ArrayList(); + private List found = new ArrayList<>(); private int foundPos = 0; private JLabel searchForLabel; private String searchFor; @@ -81,7 +81,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener { searchRegexp = regexp; ClassesListTreeModel clModel = (ClassesListTreeModel) classTree.getModel(); HashMap allpacks = clModel.getList(); - found = new ArrayList(); + found = new ArrayList<>(); Pattern pat = null; if (regexp) { pat = Pattern.compile(txt, ignoreCase ? Pattern.CASE_INSENSITIVE : 0); @@ -202,7 +202,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener { if (index == -1) { classTree.setDoABCTags(list); } else { - List oneList = new ArrayList(); + List oneList = new ArrayList<>(); oneList.add(list.get(index)); this.abc = list.get(index).getABC(); classTree.setDoABCTags(oneList); @@ -475,7 +475,7 @@ public class ABCPanel extends JPanel implements ItemListener, ActionListener { if (e.getActionCommand().equals("SEARCHCANCEL")) { foundPos = 0; searchPanel.setVisible(false); - found = new ArrayList(); + found = new ArrayList<>(); searchFor = null; } if (e.getActionCommand().equals("SEARCHPREV")) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/ASMSourceEditorPane.java b/trunk/src/com/jpexs/decompiler/flash/abc/gui/ASMSourceEditorPane.java index 26645d7f2..625dae5d2 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/gui/ASMSourceEditorPane.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/gui/ASMSourceEditorPane.java @@ -40,7 +40,7 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi public ABC abc; public int bodyIndex = -1; - private List disassembledHilights = new ArrayList(); + private List disassembledHilights = new ArrayList<>(); private DecompiledEditorPane decompiledEditor; private boolean ignoreCarret = false; private String name; @@ -115,7 +115,7 @@ public class ASMSourceEditorPane extends LineMarkedEditorPane implements CaretLi } public void exec() { - HashMap args = new HashMap(); + HashMap args = new HashMap<>(); args.put(0, new Object()); //object "this" args.put(1, new Long(466561)); //param1 Object o = abc.bodies[bodyIndex].code.execute(args, abc.constants); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/ClassesListTree.java b/trunk/src/com/jpexs/decompiler/flash/abc/gui/ClassesListTree.java index d6ce2bd66..eb307bd32 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/gui/ClassesListTree.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/gui/ClassesListTree.java @@ -62,7 +62,7 @@ public class ClassesListTree extends JTree implements TreeSelectionListener { public List getSelectedScripts() { TreeSelectionModel tsm = getSelectionModel(); - final List selectedScripts = new ArrayList(); + final List selectedScripts = new ArrayList<>(); TreePath tps[] = tsm.getSelectionPaths(); if (tps == null) { return selectedScripts; @@ -96,7 +96,7 @@ public class ClassesListTree extends JTree implements TreeSelectionListener { } public HashMap getTreeList(List list) { - HashMap ret = new HashMap(); + HashMap ret = new HashMap<>(); for (ABCContainerTag tag : list) { ABC abc = tag.getABC(); for (int i = 0; i < abc.script_info.length; i++) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/DecompiledEditorPane.java b/trunk/src/com/jpexs/decompiler/flash/abc/gui/DecompiledEditorPane.java index 18a0c043e..7ea1418a1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/gui/DecompiledEditorPane.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/gui/DecompiledEditorPane.java @@ -33,10 +33,10 @@ import javax.swing.event.CaretListener; public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretListener { - private List highlights = new ArrayList(); - private List traitHighlights = new ArrayList(); - private List methodHighlights = new ArrayList(); - private List classHighlights = new ArrayList(); + private List highlights = new ArrayList<>(); + private List traitHighlights = new ArrayList<>(); + private List methodHighlights = new ArrayList<>(); + private List classHighlights = new ArrayList<>(); private Highlighting currentMethodHighlight; private ABC abc; private ScriptPack script; @@ -309,9 +309,9 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL script = abc.script_info[scriptIndex]; } if (script == null) { - highlights = new ArrayList(); - traitHighlights = new ArrayList(); - methodHighlights = new ArrayList(); + highlights = new ArrayList<>(); + traitHighlights = new ArrayList<>(); + methodHighlights = new ArrayList<>(); this.script = scriptLeaf; return; } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/DetailPanel.java b/trunk/src/com/jpexs/decompiler/flash/abc/gui/DetailPanel.java index 575124ba0..a04d2f49c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/gui/DetailPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/gui/DetailPanel.java @@ -46,7 +46,7 @@ public class DetailPanel extends JPanel implements ActionListener { public JButton saveButton = new JButton("Save", View.getIcon("save16")); public JButton editButton = new JButton("Edit", View.getIcon("edit16")); public JButton cancelButton = new JButton("Cancel", View.getIcon("cancel16")); - private HashMap cardMap = new HashMap(); + private HashMap cardMap = new HashMap<>(); private String selectedCard; private JLabel selectedLabel; private boolean editMode = false; diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/TraitsListModel.java b/trunk/src/com/jpexs/decompiler/flash/abc/gui/TraitsListModel.java index cb89c5f5e..2cc22fde7 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/gui/TraitsListModel.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/gui/TraitsListModel.java @@ -47,7 +47,7 @@ public class TraitsListModel implements ListModel { } private void reset() { - items = new ArrayList(); + items = new ArrayList<>(); for (int t = 0; t < abc.class_info[classIndex].static_traits.traits.length; t++) { items.add(new TraitsListItem(TraitsListItem.Type.getTypeForTrait(abc.class_info[classIndex].static_traits.traits[t]), t, true, abcTags, abc, classIndex, scriptIndex)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/gui/TreeElement.java b/trunk/src/com/jpexs/decompiler/flash/abc/gui/TreeElement.java index d60986c90..18f5e589c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/gui/TreeElement.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/gui/TreeElement.java @@ -33,8 +33,8 @@ public class TreeElement { this.path = path; this.item = item; this.parent = parent; - branches = new TreeMap(); - leafs = new TreeMap(); + branches = new TreeMap<>(); + leafs = new TreeMap<>(); } public TreeElement getParent() { @@ -50,7 +50,7 @@ public class TreeElement { } public TreePath getTreePath() { - List pathList = new ArrayList(); + List pathList = new ArrayList<>(); TreeElement temp = this; do { pathList.add(0, temp); diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoParser.java b/trunk/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoParser.java index ed60c0e51..00d2ebef1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/methodinfo_parser/MethodInfoParser.java @@ -147,9 +147,9 @@ public class MethodInfoParser { public static boolean parseParams(String text, MethodInfo update, ABC abc) throws ParseException { MethodInfoLexer lexer = new MethodInfoLexer(new ByteArrayInputStream(text.getBytes())); - List paramNames = new ArrayList(); - List paramTypes = new ArrayList(); - List optionalValues = new ArrayList(); + List paramNames = new ArrayList<>(); + List paramTypes = new ArrayList<>(); + List optionalValues = new ArrayList<>(); boolean hasOptional = false; boolean needsRest = false; try { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java index cb1b32624..f8c6ae3e8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java @@ -46,7 +46,7 @@ public class MethodBody implements Cloneable, Serializable { public Traits traits = new Traits(); public List getExceptionEntries() { - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (ABCException e : exceptions) { ret.add(code.adr2pos(e.start)); ret.add(code.adr2pos(e.end)); @@ -76,7 +76,7 @@ public class MethodBody implements Cloneable, Serializable { } public HashMap getLocalRegNames(ABC abc) { - HashMap ret = new HashMap(); + HashMap ret = new HashMap<>(); for (int i = 1; i <= abc.method_info[this.method_info].param_types.length; i++) { String paramName = "param" + i; if (abc.method_info[this.method_info].flagHas_paramnames() && Configuration.PARAM_NAMES_ENABLE) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java index a06c15a67..93db53998 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/MethodInfo.java @@ -230,7 +230,7 @@ public class MethodInfo { } public String getParamStr(ConstantPool constants, MethodBody body, ABC abc, List fullyQualifiedNames) { - HashMap localRegNames = new HashMap(); + HashMap localRegNames = new HashMap<>(); if (body != null) { localRegNames = body.code.getLocalRegNamesFromDebug(abc); } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/ScriptInfo.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/ScriptInfo.java index e0ddf1871..ccc330b27 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/ScriptInfo.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/ScriptInfo.java @@ -32,9 +32,9 @@ public class ScriptInfo { public Traits traits; public HashMap getPacks(ABC abc, int scriptIndex) { - HashMap ret = new HashMap(); + HashMap ret = new HashMap<>(); - List otherTraits = new ArrayList(); + List otherTraits = new ArrayList<>(); for (int j = 0; j < traits.traits.length; j++) { Trait t = traits.traits[j]; Multiname name = t.getName(abc); @@ -53,13 +53,13 @@ public class ScriptInfo { String packageName = ns.getName(abc.constants); String objectName = name.getName(abc.constants, new ArrayList()); String path = packageName + "." + objectName; - List traitIndices = new ArrayList(); + List traitIndices = new ArrayList<>(); traitIndices.add(j); if (!otherTraits.isEmpty()) { traitIndices.addAll(otherTraits); } - otherTraits = new ArrayList(); + otherTraits = new ArrayList<>(); ret.put(path, new ScriptPack(abc, scriptIndex, traitIndices)); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java index b548af51e..515e4005a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java @@ -324,7 +324,7 @@ public class TraitClass extends Trait implements TraitWithSlot { if (debugMode) { System.err.println("Decompiling " + packageName + "." + abc.instance_info[class_info].getName(abc.constants).getName(abc.constants, fullyQualifiedNames)); } - List namesInThisPackage = new ArrayList(); + List namesInThisPackage = new ArrayList<>(); for (ABCContainerTag tag : abcTags) { for (ScriptInfo si : tag.getABC().script_info) { for (Trait t : si.traits.traits) { @@ -343,13 +343,13 @@ public class TraitClass extends Trait implements TraitWithSlot { } } //imports - List imports = new ArrayList(); - List uses = new ArrayList(); + List imports = new ArrayList<>(); + List uses = new ArrayList<>(); getImportsUsages(abcTags, abc, imports, uses, new ArrayList()); - fullyQualifiedNames = new ArrayList(); + fullyQualifiedNames = new ArrayList<>(); - List importnames = new ArrayList(); + List importnames = new ArrayList<>(); importnames.addAll(namesInThisPackage); for (String ipath : imports) { String name = ipath; @@ -399,7 +399,7 @@ public class TraitClass extends Trait implements TraitWithSlot { out.println(ABC.IDENT_STRING + "{"); String toPrint; - List outTraits = new LinkedList(); + List outTraits = new LinkedList<>(); int bodyIndex; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/Action.java b/trunk/src/com/jpexs/decompiler/flash/action/Action.java index 5d2ea84a8..93cb04779 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/Action.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/Action.java @@ -128,7 +128,7 @@ public class Action implements GraphSourceItem { * @return List of addresses */ public List getAllRefs(int version) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); return ret; } @@ -138,7 +138,7 @@ public class Action implements GraphSourceItem { * @return List of actions */ public List getAllIfsOrJumps() { - List ret = new ArrayList(); + List ret = new ArrayList<>(); return ret; } @@ -149,7 +149,7 @@ public class Action implements GraphSourceItem { * @return List of actions */ public static List getActionsAllIfsOrJumps(List list) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (Action a : list) { List part = a.getAllIfsOrJumps(); ret.addAll(part); @@ -165,7 +165,7 @@ public class Action implements GraphSourceItem { * @return List of addresses */ public static List getActionsAllRefs(List list, int version) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (Action a : list) { if (a.replaceWith != null) { a.replaceWith.setAddress(a.getAddress(), version, false); @@ -389,8 +389,8 @@ public class Action implements GraphSourceItem { if (!cps.isEmpty()) { setConstantPool(list, cps.get(cps.size() - 1)); } - HashMap> containers = new HashMap>(); - HashMap containersPos = new HashMap(); + HashMap> containers = new HashMap<>(); + HashMap containersPos = new HashMap<>(); offset = address; int pos = -1; boolean lastPush = false; @@ -690,7 +690,7 @@ public class Action implements GraphSourceItem { @Override public List getBranches(GraphSource code) { - return new ArrayList(); + return new ArrayList<>(); } @Override @@ -729,11 +729,11 @@ public class Action implements GraphSourceItem { if (start < actions.size() && (end > 0) && (start > 0)) { log("Entering " + start + "-" + end + (actions.size() > 0 ? (" (" + actions.get(start).toString() + " - " + actions.get(end == actions.size() ? end - 1 : end) + ")") : "")); } - List localData = new ArrayList(); + List localData = new ArrayList<>(); localData.add(registerNames); localData.add(variables); localData.add(functions); - List output = new ArrayList(); + List output = new ArrayList<>(); int ip = start; boolean isWhile = false; boolean isForIn = false; @@ -790,7 +790,7 @@ public class Action implements GraphSourceItem { GraphSourceItemContainer cnt = (GraphSourceItemContainer) action; //List out=actionsPartToTree(new HashMap(), new HashMap(),new HashMap(), new Stack(), src, ip+1,endip-1 , version); long endAddr = action.getAddress() + cnt.getHeaderSize(); - List> outs = new ArrayList>(); + List> outs = new ArrayList<>(); for (long size : cnt.getContainerSizes()) { if (size == 0) { outs.add(new ArrayList()); @@ -954,14 +954,14 @@ public class Action implements GraphSourceItem { if (true) { //return output; } - List ret = new ArrayList(); - List functions = new ArrayList(); - List staticFunctions = new ArrayList(); - HashMap vars = new HashMap(); - HashMap staticVars = new HashMap(); + List ret = new ArrayList<>(); + List functions = new ArrayList<>(); + List staticFunctions = new ArrayList<>(); + HashMap vars = new HashMap<>(); + HashMap staticVars = new HashMap<>(); GraphTargetItem className; GraphTargetItem extendsOp = null; - List implementsOp = new ArrayList(); + List implementsOp = new ArrayList<>(); boolean ok = true; int prevCount = 0; for (GraphTargetItem t : output) { @@ -1015,7 +1015,7 @@ public class Action implements GraphSourceItem { } if (parts.size() <= pos) { - List output2 = new ArrayList(); + List output2 = new ArrayList<>(); for (int i = 0; i < prevCount; i++) { output2.add(output.get(i)); } @@ -1083,7 +1083,7 @@ public class Action implements GraphSourceItem { } pos++; if (parts.size() <= pos) { - List output2 = new ArrayList(); + List output2 = new ArrayList<>(); for (int i = 0; i < prevCount; i++) { output2.add(output.get(i)); } @@ -1146,7 +1146,7 @@ public class Action implements GraphSourceItem { pos++; } if (ok) { - List output2 = new ArrayList(); + List output2 = new ArrayList<>(); for (int i = 0; i < prevCount; i++) { output2.add(output.get(i)); } @@ -1180,7 +1180,7 @@ public class Action implements GraphSourceItem { break; } } - List output2 = new ArrayList(); + List output2 = new ArrayList<>(); for (int i = 0; i < prevCount; i++) { output2.add(output.get(i)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java index 5b240c9bc..c0d5652f1 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraph.java @@ -66,7 +66,7 @@ public class ActionGraph extends Graph { public static List translateViaGraph(HashMap registerNames, HashMap variables, HashMap functions, List code, int version) { ActionGraph g = new ActionGraph(code, registerNames, variables, functions, version); - List localData = new ArrayList(); + List localData = new ArrayList<>(); localData.add(registerNames); return g.translate(localData); } @@ -145,7 +145,7 @@ public class ActionGraph extends Graph { if (switchedObject == null) { switchedObject = new DirectValueTreeItem(null, -1, new Null(), null); } - HashMap caseValuesMap = new HashMap(); + HashMap caseValuesMap = new HashMap<>(); int pos = 0; StrictEqTreeItem set = (StrictEqTreeItem) stack.pop(); @@ -154,7 +154,7 @@ public class ActionGraph extends Graph { switchedObject = ((StoreRegisterTreeItem) set.leftSide).value; } //GraphPart switchLoc = part.nextParts.get(1).nextParts.get(0); - List caseBodyParts = new ArrayList(); + List caseBodyParts = new ArrayList<>(); caseBodyParts.add(part.nextParts.get(0)); GraphTargetItem top = null; int cnt = 1; @@ -180,25 +180,25 @@ public class ActionGraph extends Graph { - List defaultAndLastPart = new ArrayList(); + List defaultAndLastPart = new ArrayList<>(); defaultAndLastPart.add(defaultPart); defaultAndLastPart.add(caseBodyParts.get(caseBodyParts.size() - 1)); GraphPart defaultPart2 = getCommonPart(defaultAndLastPart); - List defaultCommands = new ArrayList(); + List defaultCommands = new ArrayList<>(); defaultCommands = printGraph(new ArrayList(), localData, stack, allParts, null, defaultPart, defaultPart2, loops, forFinalCommands); - List loopContinues = new ArrayList(); + List loopContinues = new ArrayList<>(); for (Loop l : loops) { if (l.loopContinue != null) { loopContinues.add(l.loopContinue); } } - List breakParts = new ArrayList(); + List breakParts = new ArrayList<>(); for (int g = 0; g < caseBodyParts.size(); g++) { if (g < caseBodyParts.size() - 1) { if (caseBodyParts.get(g).leadsTo(code, caseBodyParts.get(g + 1), loopContinues)) { @@ -223,7 +223,7 @@ public class ActionGraph extends Graph { } - List caseValues = new ArrayList(); + List caseValues = new ArrayList<>(); for (int i = 0; i < caseBodyParts.size(); i++) { if (caseValuesMap.containsKey(i)) { caseValues.add(caseValuesMap.get(i)); @@ -232,7 +232,7 @@ public class ActionGraph extends Graph { } } - List> caseCommands = new ArrayList>(); + List> caseCommands = new ArrayList<>(); GraphPart next = null; @@ -243,8 +243,8 @@ public class ActionGraph extends Graph { Loop currentLoop = new Loop(loops.size(), null, next); loops.add(currentLoop); //switchLoc.getNextPartPath(new ArrayList()); - List valuesMapping = new ArrayList(); - List caseBodies = new ArrayList(); + List valuesMapping = new ArrayList<>(); + List caseBodies = new ArrayList<>(); for (int i = 0; i < caseValues.size(); i++) { GraphPart cur = caseBodyParts.get(i); if (!caseBodies.contains(cur)) { @@ -263,13 +263,13 @@ public class ActionGraph extends Graph { defaultCommands = printGraph(new ArrayList(), localData, stack, allParts, null, defaultPart, next, loops, forFinalCommands); } - List ignored = new ArrayList(); + List ignored = new ArrayList<>(); for (Loop l : loops) { ignored.add(l.loopContinue); } for (int i = 0; i < caseBodies.size(); i++) { - List cc = new ArrayList(); + List cc = new ArrayList<>(); GraphPart nextCase = null; nextCase = next; if (next != null) { @@ -297,7 +297,7 @@ public class ActionGraph extends Graph { } caseCommands.add(cc); } - ret = new ArrayList(); + ret = new ArrayList<>(); if (!output.isEmpty()) { if (output.get(output.size() - 1) instanceof StoreRegisterTreeItem) { output.remove(output.size() - 1); diff --git a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java index 30bb66676..6b4051bee 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/ActionGraphSource.java @@ -62,7 +62,7 @@ public class ActionGraphSource extends GraphSource { private List posCache = null; private void rebuildCache() { - posCache = new ArrayList(); + posCache = new ArrayList<>(); for (int i = 0; i < size(); i++) { posCache.add(pos2adr(i)); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/flashlite/ActionFSCommand2.java b/trunk/src/com/jpexs/decompiler/flash/action/flashlite/ActionFSCommand2.java index 0711bd912..169bbe587 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/flashlite/ActionFSCommand2.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/flashlite/ActionFSCommand2.java @@ -39,7 +39,7 @@ public class ActionFSCommand2 extends Action { public void translate(Stack stack, List output, java.util.HashMap regNames, HashMap variables, HashMap functions) { long numArgs = popLong(stack); GraphTargetItem command = stack.pop(); - List args = new ArrayList(); + List args = new ArrayList<>(); for (long l = 0; l < numArgs; l++) { args.add(stack.pop()); } diff --git a/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java b/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java index 6fdbe3691..fee5e47ae 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/gui/ActionPanel.java @@ -88,8 +88,8 @@ public class ActionPanel extends JPanel implements ActionListener { public JButton loadHexButton = new JButton("Load hex"); public JLabel asmLabel = new JLabel("P-code source"); public JLabel decLabel = new JLabel("ActionScript source"); - public List decompiledHilights = new ArrayList(); - public List disassembledHilights = new ArrayList(); + public List decompiledHilights = new ArrayList<>(); + public List disassembledHilights = new ArrayList<>(); public String lastDisasm = ""; private boolean ignoreCarret = false; private boolean editMode = false; @@ -102,7 +102,7 @@ public class ActionPanel extends JPanel implements ActionListener { private String lastDecompiled = ""; public JPanel searchPanel; public JLabel searchPos; - private List found = new ArrayList(); + private List found = new ArrayList<>(); private int foundPos = 0; private JLabel searchForLabel; private String searchFor; @@ -125,7 +125,7 @@ public class ActionPanel extends JPanel implements ActionListener { } private List getASMs(List nodes) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (TagNode n : nodes) { if (n.tag instanceof ASMSource) { //cacheScript((ASMSource) n.tag); @@ -143,7 +143,7 @@ public class ActionPanel extends JPanel implements ActionListener { List tags = new ArrayList(Main.swf.tags); List list = Main.swf.createASTagList(tags, null); List asms = getASMs(list); - found = new ArrayList(); + found = new ArrayList<>(); Pattern pat = null; if (regexp) { pat = Pattern.compile(txt, ignoreCase ? Pattern.CASE_INSENSITIVE : 0); @@ -550,7 +550,7 @@ public class ActionPanel extends JPanel implements ActionListener { if (e.getActionCommand().equals("SEARCHCANCEL")) { foundPos = 0; searchPanel.setVisible(false); - found = new ArrayList(); + found = new ArrayList<>(); searchFor = null; } if (e.getActionCommand().equals("SEARCHPREV")) { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java b/trunk/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java index 042e6a5a7..c95ae4d24 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java @@ -41,11 +41,11 @@ import java.util.logging.Logger; public class ASMParser { public static List parse(long containerSWFOffset, boolean ignoreNops, List