diff --git a/src/de/inetsoftware/classparser/MethodInfo.java b/src/de/inetsoftware/classparser/MethodInfo.java index e95dc50..51910f9 100644 --- a/src/de/inetsoftware/classparser/MethodInfo.java +++ b/src/de/inetsoftware/classparser/MethodInfo.java @@ -1,5 +1,5 @@ /* - Copyright 2011 - 2020 Volker Berlin (i-net software) + Copyright 2011 - 2021 Volker Berlin (i-net software) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -110,6 +110,15 @@ public class MethodInfo implements Member { return (accessFlags & 0x0400) > 0; } + /** + * If the method is synthetic + * + * @return true, if synthetic + */ + public boolean isSynthetic() { + return (accessFlags & 0x1000) > 0; + } + /** * @return the name */ diff --git a/src/de/inetsoftware/jwebassembly/module/ModuleGenerator.java b/src/de/inetsoftware/jwebassembly/module/ModuleGenerator.java index e52e6fd..4966a7a 100644 --- a/src/de/inetsoftware/jwebassembly/module/ModuleGenerator.java +++ b/src/de/inetsoftware/jwebassembly/module/ModuleGenerator.java @@ -222,7 +222,9 @@ public class ModuleGenerator { } if( method != null ) { createInstructions( functions.replace( next, method ) ); - boolean needThisParameter = !method.isStatic() || "".equals( method.getName() ); + boolean needThisParameter = !method.isStatic() // if not static there is a not declared THIS parameter + || "".equals( method.getName() ) // constructor method need also the THIS parameter also if marked as static + || (method.isSynthetic() && method.getName().startsWith( "lambda$" )); // lambda functions are static but will call with a THIS parameter which need be removed from stack functions.markAsScanned( next, needThisParameter ); if( needThisParameter ) { types.valueOf( next.className ); // for the case that the type unknown yet