Checkstyle fix

This commit is contained in:
Jindra Petřík
2025-07-27 18:07:04 +02:00
parent fcdf363efc
commit fa0f9a1fa8
2 changed files with 20 additions and 24 deletions

View File

@@ -21,7 +21,6 @@ import com.jpexs.decompiler.flash.DeobfuscationListener;
import com.jpexs.decompiler.flash.EndOfStreamException;
import com.jpexs.decompiler.flash.EventListener;
import com.jpexs.decompiler.flash.IdentifiersDeobfuscation;
import static com.jpexs.decompiler.flash.IdentifiersDeobfuscation.SAFE_STRING_PREFIX;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
@@ -658,8 +657,8 @@ public class ABC implements Openable {
}
if (s.matches("^" + IdentifiersDeobfuscation.SAFE_STRING_PREFIX + "[0-9]+$")
|| s.matches("^" + IdentifiersDeobfuscation.SAFE_PACKAGE_PREFIX + "[0-9]+$")
|| s.matches("^" + IdentifiersDeobfuscation.SAFE_CLASS_PREFIX + "[0-9]+$")) {
|| s.matches("^" + IdentifiersDeobfuscation.SAFE_PACKAGE_PREFIX + "[0-9]+$")
|| s.matches("^" + IdentifiersDeobfuscation.SAFE_CLASS_PREFIX + "[0-9]+$")) {
String foundKey = null;
for (Map.Entry<String, String> entry : map.entrySet()) {
if (entry.getValue().equals(s)) {
@@ -674,18 +673,18 @@ public class ABC implements Openable {
if (foundKey.equals(s)) {
return;
}
String foundPrefix = SAFE_STRING_PREFIX;
String foundPrefix = IdentifiersDeobfuscation.SAFE_STRING_PREFIX;
if (s.startsWith(IdentifiersDeobfuscation.SAFE_PACKAGE_PREFIX)) {
foundPrefix = IdentifiersDeobfuscation.SAFE_PACKAGE_PREFIX;
} else if (s.startsWith(IdentifiersDeobfuscation.SAFE_CLASS_PREFIX)) {
foundPrefix = IdentifiersDeobfuscation.SAFE_CLASS_PREFIX;
}
map.put(foundKey, foundPrefix + map.size());
map.put(foundKey, foundPrefix + map.size());
map.put(s, s);
return;
}
}
map.put(s, prefix + map.size());
}
@@ -707,10 +706,10 @@ public class ABC implements Openable {
String[] parts = s.split("\\.", -1);
List<String> deobfuscatedList = new ArrayList<>();
for (String part : parts) {
if (!deobfuscation.isValidNSPart(part)) {
if (!deobfuscation.isValidNSPart(part)) {
if (part.matches("^" + IdentifiersDeobfuscation.SAFE_STRING_PREFIX + "[0-9]+$")
|| part.matches("^" + IdentifiersDeobfuscation.SAFE_PACKAGE_PREFIX + "[0-9]+$")
|| part.matches("^" + IdentifiersDeobfuscation.SAFE_CLASS_PREFIX + "[0-9]+$")) {
|| part.matches("^" + IdentifiersDeobfuscation.SAFE_PACKAGE_PREFIX + "[0-9]+$")
|| part.matches("^" + IdentifiersDeobfuscation.SAFE_CLASS_PREFIX + "[0-9]+$")) {
String foundKey = null;
for (Map.Entry<String, String> entry : map.entrySet()) {
if (entry.getValue().equals(part)) {
@@ -719,20 +718,20 @@ public class ABC implements Openable {
}
}
if (foundKey == null) {
map.put(part, part);
map.put(part, part);
} else {
if (!foundKey.equals(part)) {
String foundPrefix = SAFE_STRING_PREFIX;
if (!foundKey.equals(part)) {
String foundPrefix = IdentifiersDeobfuscation.SAFE_STRING_PREFIX;
if (part.startsWith(IdentifiersDeobfuscation.SAFE_PACKAGE_PREFIX)) {
foundPrefix = IdentifiersDeobfuscation.SAFE_PACKAGE_PREFIX;
} else if (part.startsWith(IdentifiersDeobfuscation.SAFE_CLASS_PREFIX)) {
foundPrefix = IdentifiersDeobfuscation.SAFE_CLASS_PREFIX;
}
map.put(foundKey, foundPrefix + map.size());
map.put(foundKey, foundPrefix + map.size());
map.put(part, part);
}
}
} else {
} else {
deobfuscatedList.add(IdentifiersDeobfuscation.SAFE_PACKAGE_PREFIX + map.size());
map.put(part, IdentifiersDeobfuscation.SAFE_PACKAGE_PREFIX + map.size());
}
@@ -756,7 +755,7 @@ public class ABC implements Openable {
getObfuscatedIdentifier(constants.getMultiname(insti.super_index).name_index, ret, IdentifiersDeobfuscation.SAFE_CLASS_PREFIX);
}
for (int iface : insti.interfaces) {
getObfuscatedIdentifier(constants.getMultiname(iface).name_index, ret, IdentifiersDeobfuscation.SAFE_CLASS_PREFIX );
getObfuscatedIdentifier(constants.getMultiname(iface).name_index, ret, IdentifiersDeobfuscation.SAFE_CLASS_PREFIX);
}
}

View File

@@ -17,9 +17,6 @@
package com.jpexs.decompiler.flash.abc.avm2;
import com.jpexs.decompiler.flash.IdentifiersDeobfuscation;
import static com.jpexs.decompiler.flash.IdentifiersDeobfuscation.SAFE_CLASS_PREFIX;
import static com.jpexs.decompiler.flash.IdentifiersDeobfuscation.SAFE_PACKAGE_PREFIX;
import static com.jpexs.decompiler.flash.IdentifiersDeobfuscation.SAFE_STRING_PREFIX;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.abc.RenameType;
import com.jpexs.decompiler.flash.configuration.Configuration;
@@ -108,9 +105,9 @@ public class AVM2Deobfuscation {
}
if (Configuration.autoDeobfuscateIdentifiers.get()
&& (s.contains(SAFE_STRING_PREFIX)
|| s.contains(SAFE_PACKAGE_PREFIX)
|| s.contains(SAFE_CLASS_PREFIX))) {
&& (s.contains(IdentifiersDeobfuscation.SAFE_STRING_PREFIX)
|| s.contains(IdentifiersDeobfuscation.SAFE_PACKAGE_PREFIX)
|| s.contains(IdentifiersDeobfuscation.SAFE_CLASS_PREFIX))) {
return false;
}
@@ -261,9 +258,9 @@ public class AVM2Deobfuscation {
String s = constants.getString(strIndex);
if (Configuration.autoDeobfuscateIdentifiers.get()
&& (s.startsWith(SAFE_STRING_PREFIX)
|| s.startsWith(SAFE_PACKAGE_PREFIX)
|| s.startsWith(SAFE_CLASS_PREFIX))) {
&& (s.startsWith(IdentifiersDeobfuscation.SAFE_STRING_PREFIX)
|| s.startsWith(IdentifiersDeobfuscation.SAFE_PACKAGE_PREFIX)
|| s.startsWith(IdentifiersDeobfuscation.SAFE_CLASS_PREFIX))) {
return false;
}