From fcef37d682e7125288d7c732ffc8f94900314a0c Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 21 Nov 2014 19:50:23 +0000 Subject: [PATCH] Fix incorrect symbol clash error in C# and Java when using %rename for enums When using using 'simple enum' wrappers --- CHANGES.current | 3 +++ Examples/test-suite/enum_thorough.i | 12 ++++++++++++ Source/Modules/csharp.cxx | 2 +- Source/Modules/java.cxx | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGES.current b/CHANGES.current index a5f089dbf..aff98df24 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,6 +5,9 @@ See the RELEASENOTES file for a summary of changes in each release. Version 3.0.3 (in progress) =========================== +2014-11-21: wsfulton + [Java C#] Fix multiply defined error when using %rename of enum items when using the "simple enum" wrappers. + 2014-10-28: vadz [Python] Patch #201 The generated .py file no longer uses *args for all Python parameters. Instead, the parameters are named using the C++ parameter names. diff --git a/Examples/test-suite/enum_thorough.i b/Examples/test-suite/enum_thorough.i index ec31c2787..3ece5471b 100644 --- a/Examples/test-suite/enum_thorough.i +++ b/Examples/test-suite/enum_thorough.i @@ -277,6 +277,18 @@ OldNameStruct::doublenametag renameTest6(OldNameStruct::doublenametag e) OldNameStruct::singlename renameTest7(OldNameStruct::singlename e) { return e; } %} +%rename(Clash1_di1) Clash1::di1; +%rename(Clash1_di2) Clash1::di2; +%rename(Clash1_di3) Clash1::di3; +%inline %{ +namespace Clash1 { + enum DuplicateItems1 { di1, di2 = 10, di3 }; +} +namespace Clash2 { + enum DuplicateItems2 { di1, di2 = 10, di3 }; +} +%} + %inline %{ struct TreesClass { enum trees {oak, fir, pine }; diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx index 81563c6d6..0a698ca2c 100644 --- a/Source/Modules/csharp.cxx +++ b/Source/Modules/csharp.cxx @@ -1308,7 +1308,7 @@ public: else Printf(scope, ".%s", Getattr(parent, "sym:name")); } - if (!addSymbol(name, n, scope)) + if (!addSymbol(symname, n, scope)) return SWIG_ERROR; const String *csattributes = Getattr(n, "feature:cs:attributes"); diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index 3649995d5..2b17721d9 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -1410,7 +1410,7 @@ public: else Printf(scope, ".%s", Getattr(parent, "sym:name")); } - if (!addSymbol(name, n, scope)) + if (!addSymbol(symname, n, scope)) return SWIG_ERROR; if ((enum_feature == ProperEnum) && parent_name && !unnamedinstance) {