diff --git a/CHANGELOG.md b/CHANGELOG.md index 98b199111..bcb43404c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ All notable changes to this project will be documented in this file. - [#2450] Morphshape replace button/menu is not working (throws exception due to missing icon) - [#2355] AS1/2 Simplify expressions feature colliding with some other features like hex values - Exception on FFDec start when simple editor is on +- [#2419] AS3 - There should be empty line after class header ## [22.0.2] - 2025-01-17 ### Added @@ -3754,6 +3755,7 @@ Major version of SWF to XML export changed to 2. [#2447]: https://www.free-decompiler.com/flash/issues/2447 [#2450]: https://www.free-decompiler.com/flash/issues/2450 [#2355]: https://www.free-decompiler.com/flash/issues/2355 +[#2419]: https://www.free-decompiler.com/flash/issues/2419 [#2375]: https://www.free-decompiler.com/flash/issues/2375 [#2374]: https://www.free-decompiler.com/flash/issues/2374 [#2389]: https://www.free-decompiler.com/flash/issues/2389 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java index b01a04c02..dca92beae 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java @@ -241,15 +241,29 @@ public class TraitClass extends Trait implements TraitWithSlot { writer.endTrait(); writer.startBlock(); writer.startClass(class_info); - + first.setVal(true); - - //static variables & constants + ClassInfo classInfo = abc.class_info.get(class_info); + + //static initializer + int bodyIndex = abc.findBodyIndex(classInfo.cinit_index); + + if (bodyIndex != -1) { + writer.startTrait(GraphTextWriter.TRAIT_CLASS_INITIALIZER); + writer.startMethod(classInfo.cinit_index, "cinit"); + writer.append(""); + writer.newLine(); + writer.endMethod(); + writer.endTrait(); + } else { + writer.newLine(); + } + + //static variables & constants classInfo.static_traits.toString(swfVersion, packageName, first, abcIndex, new Class[]{TraitSlotConst.class}, this, convertData, path + "/" + instanceInfoName, abc, true, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel, new ArrayList<>(), isInterface); - //static initializer - int bodyIndex = abc.findBodyIndex(classInfo.cinit_index); + //static initializer continue if (bodyIndex != -1) { writer.startTrait(GraphTextWriter.TRAIT_CLASS_INITIALIZER); writer.startMethod(classInfo.cinit_index, "cinit"); @@ -268,7 +282,7 @@ public class TraitClass extends Trait implements TraitWithSlot { } else { //Note: There must be trait/method highlight even if the initializer is empty to TraitList in GUI to work correctly //TODO: handle this better in GUI(?) - writer.append(""); + writer.append(""); } } writer.endMethod();