From e33cd9ba990220cb1bf0187c5b47d9fbd4698aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Fri, 26 Nov 2021 20:05:30 +0100 Subject: [PATCH] Fixed AS2 - class detection - warning only if propertyname does not match getter/setter --- CHANGELOG.md | 1 + .../flash/action/ActionScript2ClassDetector.java | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33eb47647..e16a695ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file. - AS1/2 direct editation - commands as expressions - AS1/2 direct editation - delete operator on anything - AS2 - class detection of top level classes +- AS2 - class detection - warning only if propertyname does not match getter/setter ## [14.6.0] - 2021-11-22 ### Added diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionScript2ClassDetector.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionScript2ClassDetector.java index 0d7ff8728..04e05c304 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionScript2ClassDetector.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionScript2ClassDetector.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.action; +import com.jpexs.decompiler.flash.IdentifiersDeobfuscation; import com.jpexs.decompiler.flash.action.model.CallFunctionActionItem; import com.jpexs.decompiler.flash.action.model.CallMethodActionItem; import com.jpexs.decompiler.flash.action.model.DirectValueActionItem; @@ -508,7 +509,9 @@ public class ActionScript2ClassDetector { } String getterNameStr = getAsString(((GetMemberActionItem) propertyGetter).memberName, "getter memberName"); if (!(getterNameStr.equals("__get__" + propertyNameStr))) { - throw new AssertException("getter does not match property name"); + //throw new AssertException("getter does not match property name"); + Logger.getLogger(ActionScript2ClassDetector.class.getName()).warning(scriptPath + ": getter " + IdentifiersDeobfuscation.printIdentifier(false, getterNameStr) + " does not match property name " + IdentifiersDeobfuscation.printIdentifier(false, propertyNameStr)); + continue; } for (MyEntry trait : traits) { @@ -541,7 +544,9 @@ public class ActionScript2ClassDetector { } String setterNameStr = getAsString(((GetMemberActionItem) propertySetter).memberName, "setter memberNAme"); if (!(setterNameStr.equals("__set__" + propertyNameStr))) { - throw new AssertException("setter does not match property name"); + Logger.getLogger(ActionScript2ClassDetector.class.getName()).warning(scriptPath + ": setter " + IdentifiersDeobfuscation.printIdentifier(false, setterNameStr) + " does not match property name " + IdentifiersDeobfuscation.printIdentifier(false, propertyNameStr)); + continue; + //throw new AssertException("setter does not match property name"); } for (MyEntry trait : traits) {