From 8583eafef92ebcc51b9faed42b4b66c54658a278 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Fri, 13 Oct 2006 23:44:32 +0000 Subject: [PATCH] Better control on what the java base class is (overriding the real C++ base class with the javabase 'replace' typemap attribute) git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9446 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Source/Modules/java.cxx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/SWIG/Source/Modules/java.cxx b/SWIG/Source/Modules/java.cxx index 8706553da..da5998ee2 100644 --- a/SWIG/Source/Modules/java.cxx +++ b/SWIG/Source/Modules/java.cxx @@ -1558,12 +1558,19 @@ class JAVA : public Language { baseclass = NewString(""); // Inheritance from pure Java classes - const String *pure_baseclass = typemapLookup("javabase", typemap_lookup_type, WARN_NONE); + Node *attributes = NewHash(); + const String *pure_baseclass = typemapLookup("javabase", typemap_lookup_type, WARN_NONE, attributes); if (Len(pure_baseclass) > 0 && Len(baseclass) > 0) { - Swig_warning(WARN_JAVA_MULTIPLE_INHERITANCE, input_file, line_number, - "Warning for %s proxy: Base %s ignored. Multiple inheritance is not supported in Java.\n", typemap_lookup_type, pure_baseclass); - pure_baseclass = empty_string; + if (GetFlag(attributes, "tmap:javabase:replace")) { + Delete(baseclass); + baseclass = NewString(""); + } else { + Swig_warning(WARN_JAVA_MULTIPLE_INHERITANCE, input_file, line_number, + "Warning for %s proxy: Base %s ignored. Multiple inheritance is not supported in Java.\n", typemap_lookup_type, pure_baseclass); + pure_baseclass = empty_string; + } } + Delete(attributes); // Pure Java interfaces const String *pure_interfaces = typemapLookup("javainterfaces", typemap_lookup_type, WARN_NONE); @@ -1593,7 +1600,7 @@ class JAVA : public Language { // Note that the method name is specified in a typemap attribute called methodname String *destruct = NewString(""); const String *tm = NULL; - Node *attributes = NewHash(); + attributes = NewHash(); String *destruct_methodname = NULL; String *destruct_methodmodifiers = NULL; if (derived) {