From 4f40976019730c81c98723171cc1009d6d9a7af9 Mon Sep 17 00:00:00 2001 From: Volker Berlin Date: Sun, 29 Sep 2019 11:44:01 +0200 Subject: [PATCH] ignore redefinition replacements --- .../inetsoftware/jwebassembly/module/FunctionManager.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/de/inetsoftware/jwebassembly/module/FunctionManager.java b/src/de/inetsoftware/jwebassembly/module/FunctionManager.java index 84f0419..e3d6c19 100644 --- a/src/de/inetsoftware/jwebassembly/module/FunctionManager.java +++ b/src/de/inetsoftware/jwebassembly/module/FunctionManager.java @@ -26,6 +26,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import de.inetsoftware.classparser.MethodInfo; +import de.inetsoftware.jwebassembly.JWebAssembly; /** * Manage the required function/methods @@ -256,7 +257,10 @@ public class FunctionManager { * the new implementation */ void addReplacement( FunctionName name, MethodInfo method ) { - getOrCreate( name ).method = method; + FunctionState state = getOrCreate( name ); + if( state.method == null ) { // ignore redefinition replacements and use the first instance in the library path + state.method = method; + } } /**