diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/IdentifiersDeobfuscation.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/IdentifiersDeobfuscation.java index 512658ce0..58ddb7ef0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/IdentifiersDeobfuscation.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/IdentifiersDeobfuscation.java @@ -54,10 +54,11 @@ import natorder.NaturalOrderComparator; public class IdentifiersDeobfuscation { /** - * Prefix to be put instead of obfuscated name. It will by suffixed with a number. + * Prefix to be put instead of obfuscated name. It will by suffixed with a + * number. */ public static final String SAFE_STR_PREFIX = "_SafeStr_"; - + /** * Random number generator. */ @@ -546,7 +547,7 @@ public class IdentifiersDeobfuscation { * * @param swf SWF * @param used Used deobfuscations - * @param s String + * @param s String * @param writer Writer * @return Writer */ @@ -559,12 +560,12 @@ public class IdentifiersDeobfuscation { writer.append(map.get(s)); } else { String ret = IdentifiersDeobfuscation.SAFE_STR_PREFIX + map.size(); - map.put(s, ret); + map.put(s, ret); writer.append(ret); - } + } return writer; } - + writer.append("\u00A7"); escapeOIdentifier(s, writer); return writer.append("\u00A7"); @@ -574,7 +575,8 @@ public class IdentifiersDeobfuscation { * Ensures identifier is valid and if not, uses paragraph syntax. * * @param swf SWF - * @param used Set of used obfuscated identifiers in this script - the method will add to it + * @param used Set of used obfuscated identifiers in this script - the + * method will add to it * @param as3 Is ActionScript3 * @param s Identifier * @param validExceptions Exceptions which are valid (e.g. some reserved @@ -585,23 +587,20 @@ public class IdentifiersDeobfuscation { if (s == null || s.isEmpty()) { return ""; } - + Map map = new LinkedHashMap<>(); if (Configuration.autoDeobfuscateIdentifiers.get()) { - + if (swf != null) { map = swf.getObfuscatedIdentifiersMap(); } - + if (map.containsKey(s)) { used.add(s); return map.get(s); } } - - - - + if (s.startsWith("\u00A7") && s.endsWith("\u00A7")) { // Assuming already printed - TODO:detect better return s; } @@ -629,7 +628,7 @@ public class IdentifiersDeobfuscation { used.add(s); return ret; } - + String ret = "\u00A7" + escapeOIdentifier(s) + "\u00A7"; nameCache.put(s, ret); return ret; @@ -679,8 +678,8 @@ public class IdentifiersDeobfuscation { } return writer; - } - + } + /** * Escapes obfuscated identifier. * @@ -726,16 +725,17 @@ public class IdentifiersDeobfuscation { return ret.toString(); } - + /** * Unescapes deobfuscated identifier + * * @param swf SWF * @param s String * @return Unescaped string */ public static String unescapeOIdentifier(SWF swf, String s) { StringBuilder ret = new StringBuilder(s.length()); - + Map map = swf.getObfuscatedIdentifiersMap(); for (Map.Entry entry : map.entrySet()) { if (s.equals(entry.getValue())) { @@ -767,8 +767,8 @@ public class IdentifiersDeobfuscation { } else if (c == '\\') { ret.append("\\"); } else if (c == '\u00A7') { - ret.append("\u00A7"); - } else if (c == 'x' && i + 2 < s.length() - 1) { + ret.append("\u00A7"); + } else if (c == 'x' && i + 2 < s.length() - 1) { ret.append((char) Integer.parseInt(s.substring(i + 1, i + 3), 16)); i += 2; } else if (c == '{') { @@ -798,7 +798,7 @@ public class IdentifiersDeobfuscation { as2NameCache.clear(); as3NameCache.clear(); } - + @SuppressWarnings("unchecked") public static GraphTextWriter writeCurrentScriptReplacements(GraphTextWriter writer, Set usedDeobfuscations, SWF swf) { if (!usedDeobfuscations.isEmpty() && Configuration.autoDeobfuscateIdentifiers.get()) { @@ -819,12 +819,12 @@ public class IdentifiersDeobfuscation { } return writer; } - + public static Map getReplacementsFromDoc(String s) throws Exception { ActionScriptDocParser asd = new ActionScriptDocParser(); List comments = asd.parse(s); Map replacements = new LinkedHashMap<>(); - for (AsDocComment comment:comments) { + for (AsDocComment comment : comments) { for (AsDocTag tag : comment.tags) { if ("identifier".equals(tag.tagName)) { String tagText = tag.tagText; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java index 5992374fa..668894eca 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java @@ -640,9 +640,6 @@ public class ABC implements Openable { } } - - - private void getObfuscatedIdentifier(int strIndex, Map ret) { if (strIndex >= constants.getStringCount()) { return; @@ -653,15 +650,15 @@ public class ABC implements Openable { String s = constants.getString(strIndex); if (ret.containsKey(s)) { return; - } - AVM2Deobfuscation deobfuscation = getDeobfuscation(); + } + AVM2Deobfuscation deobfuscation = getDeobfuscation(); if (deobfuscation.isValidName(strIndex)) { return; } - + ret.put(s, IdentifiersDeobfuscation.SAFE_STR_PREFIX + ret.size()); } - + private void getObfuscatedPackageIdentifier(int strIndex, Map ret) { if (strIndex >= constants.getStringCount()) { return; @@ -672,7 +669,7 @@ public class ABC implements Openable { String s = constants.getString(strIndex); if (ret.containsKey(s)) { return; - } + } AVM2Deobfuscation deobfuscation = getDeobfuscation(); if (deobfuscation.isValidPackageName(strIndex)) { return; @@ -682,21 +679,21 @@ public class ABC implements Openable { for (String part : parts) { if (!deobfuscation.isValidNSPart(part)) { deobfuscatedList.add(IdentifiersDeobfuscation.SAFE_STR_PREFIX + ret.size()); - ret.put(part, IdentifiersDeobfuscation.SAFE_STR_PREFIX + ret.size()); + ret.put(part, IdentifiersDeobfuscation.SAFE_STR_PREFIX + ret.size()); } else { deobfuscatedList.add(part); } } ret.put(s, String.join(".", deobfuscatedList)); } - + public void getObfuscatedIdentifiers(Map ret) { for (int i = 0; i < instance_info.size(); i++) { InstanceInfo insti = instance_info.get(i); if (insti.name_index != 0) { getObfuscatedIdentifier(constants.getMultiname(insti.name_index).name_index, ret); if (constants.getMultiname(insti.name_index).namespace_index != 0) { - getObfuscatedPackageIdentifier( constants.getNamespace(constants.getMultiname(insti.name_index).namespace_index).name_index, ret); + getObfuscatedPackageIdentifier(constants.getNamespace(constants.getMultiname(insti.name_index).namespace_index).name_index, ret); } } if (insti.super_index != 0) { @@ -706,7 +703,7 @@ public class ABC implements Openable { getObfuscatedIdentifier(constants.getMultiname(iface).name_index, ret); } } - + for (int i = 1; i < constants.getMultinameCount(); i++) { Multiname m = constants.getMultiname(i); int strIndex = m.name_index; @@ -720,9 +717,9 @@ public class ABC implements Openable { continue; } getObfuscatedPackageIdentifier(constants.getNamespace(i).name_index, ret); - } + } } - + /** * Deobfuscates identifiers. * @@ -868,9 +865,10 @@ public class ABC implements Openable { public boolean hasFloatSupport() { return minVersionCheck(47, 16); } - + /** * Checks whether the ABC has float4 support + * * @return Whether the ABC has float4 support */ public boolean hasFloat4Support() { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ClassPath.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ClassPath.java index aaf62200b..683913821 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ClassPath.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ClassPath.java @@ -43,7 +43,7 @@ public class ClassPath implements Serializable { * Namespace suffix */ public final String namespaceSuffix; - + /** * SWF */ @@ -55,7 +55,7 @@ public class ClassPath implements Serializable { * @param packageStr Package name * @param className Class name * @param namespaceSuffix Namespace suffix - * @param SWF swf + * @param swf SWF */ public ClassPath(DottedChain packageStr, String className, String namespaceSuffix, SWF swf) { this.packageStr = packageStr == null ? DottedChain.TOPLEVEL : packageStr; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java index 3955d698d..e41dfb5fe 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -2042,7 +2042,7 @@ public class AVM2Code implements Cloneable { } if (debugMode) { System.err.println("CLOSE SubSource:" + start + "-" + end + " " + code.get(start).toString() + " to " + code.get(end).toString()); - } + } } /** @@ -2083,7 +2083,7 @@ public class AVM2Code implements Cloneable { if (ins.definition instanceof SetLocalTypeIns) { if (prev != null) { if (prev.definition instanceof CoerceOrConvertTypeIns) { - ret.put(((SetLocalTypeIns) ins.definition).getRegisterId(ins), ((CoerceOrConvertTypeIns) prev.definition).getTargetType(usedDeobfuscations,abc, constants, prev)); + ret.put(((SetLocalTypeIns) ins.definition).getRegisterId(ins), ((CoerceOrConvertTypeIns) prev.definition).getTargetType(usedDeobfuscations, abc, constants, prev)); } } } @@ -3648,7 +3648,7 @@ public class AVM2Code implements Cloneable { cnt++; } } - if ((ins.definition instanceof LabelIns) || (ins.definition instanceof DebugLineIns)) { + if ((ins.definition instanceof LabelIns) || (ins.definition instanceof DebugLineIns)) { ins.setIgnored(true, 0); if (minChangedIp == -1 || minChangedIp > i) { minChangedIp = i; @@ -3663,23 +3663,24 @@ public class AVM2Code implements Cloneable { return cnt; } - + /** * Removes label and debugline instructions + * * @param body Method body * @return Number of removed instructions - * @throws InterruptedException + * @throws InterruptedException */ - public int removeLabelsAndDebugLine(MethodBody body) throws InterruptedException { + public int removeLabelsAndDebugLine(MethodBody body) throws InterruptedException { int cnt = 0; for (int i = code.size() - 1; i >= 0; i--) { - AVM2Instruction ins = code.get(i); - if ((ins.definition instanceof LabelIns) || (ins.definition instanceof DebugLineIns)) { + AVM2Instruction ins = code.get(i); + if ((ins.definition instanceof LabelIns) || (ins.definition instanceof DebugLineIns)) { ins.setIgnored(true, 0); cnt++; } } - removeIgnored(body); + removeIgnored(body); return cnt; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java index ac8a11a69..0a09845ce 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java @@ -701,7 +701,8 @@ public class ActionScript3Parser { //s = lex(); ParsedSymbol s = lex(); - loops: while (s.isType(SymbolType.NATIVE, SymbolType.STATIC, SymbolType.PUBLIC, SymbolType.PRIVATE, SymbolType.PROTECTED, SymbolType.OVERRIDE, SymbolType.FINAL, SymbolType.DYNAMIC, SymbolGroup.IDENTIFIER, SymbolType.INTERNAL, SymbolType.PREPROCESSOR)) { + loops: + while (s.isType(SymbolType.NATIVE, SymbolType.STATIC, SymbolType.PUBLIC, SymbolType.PRIVATE, SymbolType.PROTECTED, SymbolType.OVERRIDE, SymbolType.FINAL, SymbolType.DYNAMIC, SymbolGroup.IDENTIFIER, SymbolType.INTERNAL, SymbolType.PREPROCESSOR)) { if (s.type == SymbolType.FINAL) { if (isFinal) { throw new AVM2ParseException("Only one final keyword allowed", lexer.yyline()); @@ -2753,7 +2754,7 @@ public class ActionScript3Parser { } private ActionScriptLexer lexer = null; - + private Map replacements = new LinkedHashMap<>(); private List constantPool; @@ -3024,11 +3025,11 @@ public class ActionScript3Parser { * @throws CompilationException On compilation error * @throws InterruptedException On interrupt */ - public void addScript(String s, String fileName, int classPos, int scriptIndex, String documentClass, ABC abc) throws AVM2ParseException, IOException, CompilationException, InterruptedException { + public void addScript(String s, String fileName, int classPos, int scriptIndex, String documentClass, ABC abc) throws AVM2ParseException, IOException, CompilationException, InterruptedException { try { replacements = IdentifiersDeobfuscation.getReplacementsFromDoc(s); } catch (Exception ex) { - throw new AVM2ParseException(ex.getMessage(), -1); + throw new AVM2ParseException(ex.getMessage(), -1); } List> allOpenedNamespaces = new ArrayList<>(); Reference numberContextRef = new Reference<>(null); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ABCException.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ABCException.java index fd2377f60..66d252606 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ABCException.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ABCException.java @@ -71,6 +71,7 @@ public class ABCException implements Serializable, Cloneable { /** * To string. + * * @return String */ @Override @@ -80,8 +81,9 @@ public class ABCException implements Serializable, Cloneable { /** * To string. + * * @param usedDeobfuscations Used deobfuscations - * @param ABC abc + * @param abc ABC * @param constants AVM2 constant pool * @param fullyQualifiedNames Fully qualified names * @return String @@ -92,6 +94,7 @@ public class ABCException implements Serializable, Cloneable { /** * To string. + * * @param usedDeobfuscations Used deobfuscations * @param abc ABC * @param constants AVM2 constant pool @@ -109,6 +112,7 @@ public class ABCException implements Serializable, Cloneable { /** * Checks if exception is finally. + * * @return True if exception is finally */ public boolean isFinally() { @@ -117,6 +121,7 @@ public class ABCException implements Serializable, Cloneable { /** * Gets variable name. + * * @param usedDeobfuscations Used deobfuscations * @param abc ABC * @param constants AVM2 constant pool @@ -132,6 +137,7 @@ public class ABCException implements Serializable, Cloneable { /** * Gets type name. + * * @param usedDeobfuscations Used deobfuscations * @param abc ABC * @param constants AVM2 constant pool @@ -147,6 +153,7 @@ public class ABCException implements Serializable, Cloneable { /** * Clones exception. + * * @return Cloned exception */ @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Multiname.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Multiname.java index bcdf80545..f9f889692 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Multiname.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Multiname.java @@ -699,7 +699,7 @@ public class Multiname { return (isAttribute() ? "@" : "") + (dontDeobfuscate ? name : IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), usedDeobfuscations, true, name)) + (withSuffix ? getNamespaceSuffix() : ""); } } - + /** * Gets the name with custom namespace. * @@ -741,7 +741,7 @@ public class Multiname { DottedChain dc = getNameWithNamespace(usedDeobfuscations, abc, abc.constants, withSuffix); return dontDeobfuscate ? dc.toRawString() : dc.toPrintableString(usedDeobfuscations, abc.getSwf(), true); } - return (isAttribute() ? "@" : "") + (dontDeobfuscate ? name : IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), usedDeobfuscations,true, name)) + (withSuffix ? getNamespaceSuffix() : ""); + return (isAttribute() ? "@" : "") + (dontDeobfuscate ? name : IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), usedDeobfuscations, true, name)) + (withSuffix ? getNamespaceSuffix() : ""); } } @@ -773,13 +773,13 @@ public class Multiname { NamespaceSet nss = getNamespaceSet(constants); if (nss != null) { if (nss.namespaces.length == 1) { - ns = constants.getNamespace(nss.namespaces[0]); + ns = constants.getNamespace(nss.namespaces[0]); } } - } + } if (ns != null && (ns.kind == Namespace.KIND_PACKAGE || ns.kind == Namespace.KIND_PACKAGE_INTERNAL)) { isPublic = true; - } + } if (isPublic && fullyQualifiedNames != null && !fullyQualifiedNames.isEmpty() && fullyQualifiedNames.contains(DottedChain.parseWithSuffix(name))) { DottedChain dc = getNameWithNamespace(usedDeobfuscations, abc, constants, withSuffix); return dontDeobfuscate ? dc.toRawString() : dc.toPrintableString(usedDeobfuscations, abc.getSwf(), true); @@ -1032,8 +1032,8 @@ public class Multiname { } /** - * Checks if this multiname is effectively a QName. Effectively means that it - * is a QName or QNameA or MULTINAME with only one namespace. + * Checks if this multiname is effectively a QName. Effectively means that + * it is a QName or QNameA or MULTINAME with only one namespace. * * @param thisCpool This constant pool * @return True if it's effectively a QName diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Namespace.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Namespace.java index 58b32ce2e..54e101d72 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Namespace.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/Namespace.java @@ -181,9 +181,9 @@ public class Namespace { /** * To string. - * + * * @param usedDeobfuscations Used deobuscations - * @param ABC abc + * @param abc ABC * @param constants Constant pool * @return String representation */ diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java index fe76ed947..7d2b8ddb9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/Trait.java @@ -422,7 +422,7 @@ public abstract class Trait implements Cloneable, Serializable { imports.add(d.getId()); } } - + List importedNames = new ArrayList<>(); importedNames.addAll(Arrays.asList(builtInClasses)); @@ -485,13 +485,13 @@ public abstract class Trait implements Cloneable, Serializable { writer.appendNoHilight("import "); if (imp.size() > 1) { - writer.appendNoHilight(imp.getWithoutLast().toPrintableString(usedDeobfuscations,abc.getSwf(), true)); + writer.appendNoHilight(imp.getWithoutLast().toPrintableString(usedDeobfuscations, abc.getSwf(), true)); writer.appendNoHilight("."); } if ("*".equals(imp.getLast())) { writer.appendNoHilight("*"); } else { - writer.hilightSpecial(IdentifiersDeobfuscation.printIdentifier(abc.getSwf(),usedDeobfuscations, true, imp.getLast()), HighlightSpecialType.TYPE_NAME, imp.toRawString()); + writer.hilightSpecial(IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), usedDeobfuscations, true, imp.getLast()), HighlightSpecialType.TYPE_NAME, imp.toRawString()); } writer.appendNoHilight(";").newLine(); hasImport = true; @@ -676,7 +676,7 @@ public abstract class Trait implements Cloneable, Serializable { } } - if (!(classIndex == -1 && nskind == Namespace.KIND_PACKAGE_INTERNAL)) { + if (!(classIndex == -1 && nskind == Namespace.KIND_PACKAGE_INTERNAL)) { String nsPrefix = Namespace.getPrefix(nskind); if (nsPrefix != null && !nsPrefix.isEmpty()) { writer.appendNoHilight(nsPrefix).appendNoHilight(" "); @@ -888,8 +888,8 @@ public abstract class Trait implements Cloneable, Serializable { } writer.startBlock(); List traits = new ArrayList<>(); - traits.add(this); - writeImports(usedDeobfuscations, traits, -1, abcIndex, scriptIndex, classIndex, isStatic, abc, writer, getPackage(abc), fullyQualifiedNames); + traits.add(this); + writeImports(usedDeobfuscations, traits, -1, abcIndex, scriptIndex, classIndex, isStatic, abc, writer, getPackage(abc), fullyQualifiedNames); toString(usedDeobfuscations, swfVersion, abcIndex, name.getNameWithNamespace(usedDeobfuscations, abc, abc.constants, true).getWithoutLast(), parent, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel, insideInterface); writer.endBlock(); writer.newLine(); @@ -900,7 +900,7 @@ public abstract class Trait implements Cloneable, Serializable { /** * Converts trait including package. * - * @param usedDeobfuscations Used deobfuscations + * @param usedDeobfuscations Used deobfuscations * @param swfVersion * @param abcIndex ABC indexing * @param parent Parent trait diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java index a7531610d..aa08cc97c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java @@ -256,12 +256,12 @@ public class ActionScript2Parser { * Charset */ private String charset; - + /** * SWF */ private SWF swf; - + /** * Obfuscation identifiers replacements */ @@ -1821,7 +1821,7 @@ public class ActionScript2Parser { //Both ASs case "dup": ret = new DuplicateItem(DIALECT, null, null, expression(inFunction, inMethod, inTellTarget, allowRemainder, variables, functions, false, hasEval)); - allowMemberOrCall = true; + allowMemberOrCall = true; break; case "push": ret = new PushItem(expression(inFunction, inMethod, inTellTarget, allowRemainder, variables, functions, false, hasEval)); @@ -2210,13 +2210,13 @@ public class ActionScript2Parser { * @throws InterruptedException On interrupt */ public List treeFromString(String str, List constantPool) throws ActionParseException, IOException, InterruptedException { - + try { replacements = IdentifiersDeobfuscation.getReplacementsFromDoc(str); } catch (Exception ex) { - throw new ActionParseException(ex.getMessage(), -1); + throw new ActionParseException(ex.getMessage(), -1); } - + List retTree = new ArrayList<>(); this.constantPool = constantPool; lexer = new ActionScriptLexer(new StringReader(str)); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/asdoc/ActionScriptDocParser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/asdoc/ActionScriptDocParser.java index b19f914de..4d1f0a00f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/asdoc/ActionScriptDocParser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/asdoc/ActionScriptDocParser.java @@ -27,14 +27,15 @@ import java.util.logging.Logger; * @author JPEXS */ public class ActionScriptDocParser { + public List parse(String str) { - List comments = new ArrayList<>(); + List comments = new ArrayList<>(); ActionScriptDocLexer lexer = new ActionScriptDocLexer(str); try { ParsedSymbol s = lexer.yylex(); String startText = null; List tags = new ArrayList<>(); - while(s.type != SymbolType.EOF) { + while (s.type != SymbolType.EOF) { if (s.type == SymbolType.DOC_BEGIN) { startText = s.text; } @@ -49,7 +50,7 @@ public class ActionScriptDocParser { s = lexer.yylex(); } } catch (IOException | AsDocParseException ex) { - + //ignored } return comments; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java index bf7c55118..7dcb22c53 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DoInitActionTag.java @@ -171,7 +171,7 @@ public class DoInitActionTag extends Tag implements CharacterIdTag, ASMSource { return Action.actionsToSource(requiresUninitielizedClassTraitsDetection() ? swf.getUninitializedAs2ClassTraits() : new HashMap<>(), this, actions, getScriptName(), writer, getCharset(), treeOperations); } - + private boolean requiresUninitielizedClassTraitsDetection() { return swf.needsCalculatingAS2UninitializeClassTraits(this); } @@ -301,7 +301,7 @@ public class DoInitActionTag extends Tag implements CharacterIdTag, ASMSource { @Override public List getActionsToTree() { try { - return Action.actionsToTree(new LinkedHashSet<>(),requiresUninitielizedClassTraitsDetection(), requiresUninitielizedClassTraitsDetection() ? swf.getUninitializedAs2ClassTraits() : new HashMap<>(), true, false, getActions(), swf.version, 0, getScriptName(), swf.getCharset()); + return Action.actionsToTree(new LinkedHashSet<>(), requiresUninitielizedClassTraitsDetection(), requiresUninitielizedClassTraitsDetection() ? swf.getUninitializedAs2ClassTraits() : new HashMap<>(), true, false, getActions(), swf.version, 0, getScriptName(), swf.getCharset()); } catch (InterruptedException ex) { return new ArrayList<>(); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/ButtonAction.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/ButtonAction.java index 1ffccf366..2fb16246e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/ButtonAction.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/ButtonAction.java @@ -220,7 +220,7 @@ public class ButtonAction implements ASMSource { @Override public List getActionsToTree() { try { - return Action.actionsToTree(new LinkedHashSet<>(),false, new HashMap<>(), false, false, getActions(), buttonTag.getSwf().version, 0, getScriptName(), buttonTag.getSwf().getCharset()); + return Action.actionsToTree(new LinkedHashSet<>(), false, new HashMap<>(), false, false, getActions(), buttonTag.getSwf().version, 0, getScriptName(), buttonTag.getSwf().getCharset()); } catch (InterruptedException ex) { return new ArrayList<>(); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java index 041e6038f..3e8a4b011 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/CLIPACTIONRECORD.java @@ -122,6 +122,7 @@ public class CLIPACTIONRECORD implements ASMSource, Serializable, HasSwfAndTag { /** * Get parent CLIPACTIONS object + * * @return Parent CLIPACTIONS object */ public CLIPACTIONS getParentClipActions() { @@ -130,6 +131,7 @@ public class CLIPACTIONRECORD implements ASMSource, Serializable, HasSwfAndTag { /** * Converts key code to string + * * @param key Key code * @return String representation of key code */ @@ -143,6 +145,7 @@ public class CLIPACTIONRECORD implements ASMSource, Serializable, HasSwfAndTag { /** * Converts string to key code + * * @param str String representation of key code * @return Key code */ @@ -160,9 +163,6 @@ public class CLIPACTIONRECORD implements ASMSource, Serializable, HasSwfAndTag { return null; } - - - /** * Constructor for Generic tag editor. */ @@ -175,6 +175,7 @@ public class CLIPACTIONRECORD implements ASMSource, Serializable, HasSwfAndTag { /** * Constructor. + * * @param swf SWF * @param tag Tag */ @@ -192,6 +193,7 @@ public class CLIPACTIONRECORD implements ASMSource, Serializable, HasSwfAndTag { /** * Sets parent CLIPACTIONS object + * * @param parentClipActions Parent CLIPACTIONS object */ public void setParentClipActions(CLIPACTIONS parentClipActions) { @@ -211,6 +213,7 @@ public class CLIPACTIONRECORD implements ASMSource, Serializable, HasSwfAndTag { /** * Constructor. + * * @param swf SWF * @param sis SWF input stream * @param tag Tag @@ -406,7 +409,7 @@ public class CLIPACTIONRECORD implements ASMSource, Serializable, HasSwfAndTag { @Override public List getActionsToTree() { try { - return Action.actionsToTree(new LinkedHashSet<>(),false, new HashMap<>(), false, false, getActions(), swf.version, 0, getScriptName(), swf.getCharset()); + return Action.actionsToTree(new LinkedHashSet<>(), false, new HashMap<>(), false, false, getActions(), swf.version, 0, getScriptName(), swf.getCharset()); } catch (InterruptedException ex) { return new ArrayList<>(); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/DottedChain.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/DottedChain.java index ae4a7b363..44b29d2a4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/DottedChain.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/DottedChain.java @@ -534,7 +534,6 @@ public class DottedChain implements Serializable, Comparable { /** * To raw string. (without deobfuscation) * - * @param swf SWF * @return Raw string */ public String toRawString() { //Is SUFFIX correctly handled? diff --git a/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java b/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java index 87e26a75c..ecd869675 100644 --- a/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java +++ b/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java @@ -162,7 +162,7 @@ public class GenericTagTreePanel extends GenericTagPanel { super.paint(g, c); } }); - setCellRenderer(new MyTreeCellRenderer()); + setCellRenderer(new MyTreeCellRenderer()); setInvokesStopCellEditing(true); } @@ -917,7 +917,7 @@ public class GenericTagTreePanel extends GenericTagPanel { if (di.exportName()) { valStr += " = " + escapeHtml(Helper.escapeExportname(swf, val.toString(), true)); } else { - valStr += " = " + escapeHtml("\"" + Helper.escapePCodeString(val.toString()) +"\""); + valStr += " = " + escapeHtml("\"" + Helper.escapePCodeString(val.toString()) + "\""); //escapeHtml(DottedChain.parseNoSuffix(val.toString()).toPrintableString(new LinkedHashSet<>(), swf, di.as3())); } } else if (val instanceof byte[]) { @@ -932,7 +932,7 @@ public class GenericTagTreePanel extends GenericTagPanel { } return getNameType(fieldIndex) + valStr; } - + private String escapeHtml(String val) { return val.replace("&", "&") .replace("<", "<") @@ -977,7 +977,7 @@ public class GenericTagTreePanel extends GenericTagPanel { } String typeStr = type.getSimpleName(); - + if ("RGB".equals(typeStr)) { try { Object val = ReflectionTools.getValue(obj, fieldSet.get(fieldIndex), index); @@ -1627,7 +1627,7 @@ public class GenericTagTreePanel extends GenericTagPanel { if ((obj instanceof CLIPACTIONS) && (v instanceof CLIPACTIONRECORD)) { ((CLIPACTIONRECORD) v).setParentClipActions((CLIPACTIONS) obj); } - + //Hack to set GRADRECORD to RGB or RGBA based on shape num if (v instanceof GRADRECORD) { GRADRECORD grad = (GRADRECORD) v; diff --git a/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java b/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java index e589c288a..82c394680 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/ClassesListTreeModel.java @@ -52,7 +52,7 @@ public class ClassesListTreeModel extends AS3ClassTreeItem implements TreeModel private final List listeners = new ArrayList<>(); private boolean flat = true; - + private SWF swf; public List getList() { @@ -293,6 +293,6 @@ public class ClassesListTreeModel extends AS3ClassTreeItem implements TreeModel @Override protected SWF getSwf() { - return swf; + return swf; } } diff --git a/src/com/jpexs/decompiler/flash/gui/generictageditors/StringEditor.java b/src/com/jpexs/decompiler/flash/gui/generictageditors/StringEditor.java index 855b7137b..d0c9a69c5 100644 --- a/src/com/jpexs/decompiler/flash/gui/generictageditors/StringEditor.java +++ b/src/com/jpexs/decompiler/flash/gui/generictageditors/StringEditor.java @@ -85,7 +85,7 @@ public class StringEditor extends JTextArea implements GenericTagEditor { setSize(d); } reset(); - } + } @Override public void reset() { @@ -120,7 +120,7 @@ public class StringEditor extends JTextArea implements GenericTagEditor { //DottedChain.parsePrintable(newValue).toRawString(); } } - + if (Objects.equals(oldValue, newValue)) { return false; } @@ -177,9 +177,9 @@ public class StringEditor extends JTextArea implements GenericTagEditor { public Object getObject() { return obj; } - + @Override public void setValueNormalizer(ValueNormalizer normalizer) { - - } + + } }