diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index 67a63287d..795dc6209 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -324,6 +324,7 @@ CPP_TEST_CASES += \ nested_directors \ nested_comment \ nested_ignore \ + nested_inheritance_interface \ nested_in_template \ nested_scope \ nested_template_base \ diff --git a/Examples/test-suite/java/nested_inheritance_interface_runme.java b/Examples/test-suite/java/nested_inheritance_interface_runme.java new file mode 100644 index 000000000..92f83ee22 --- /dev/null +++ b/Examples/test-suite/java/nested_inheritance_interface_runme.java @@ -0,0 +1,28 @@ +import nested_inheritance_interface.*; +import java.util.Arrays; + +public class nested_inheritance_interface_runme { + + static { + try { + System.loadLibrary("nested_inheritance_interface"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) { + Class[] BNInterfaces = B.N.class.getInterfaces(); + String expectedInterfacesString = "[interface nested_inheritance_interface.IASwigInterface]"; + String actualInterfacesString = Arrays.toString(BNInterfaces); + if (!expectedInterfacesString.equals(actualInterfacesString)) + throw new RuntimeException("Expected interfaces for " + B.N.class.getName() + ": \n" + expectedInterfacesString + "\n" + "Actual interfaces: \n" + actualInterfacesString); + + if (!IASwigInterface.class.isInterface()) + throw new RuntimeException(IASwigInterface.class.getName() + " should be an interface but is not"); + + // overloaded methods check + B.N d = new B.N(); + } +} diff --git a/Examples/test-suite/nested_inheritance_interface.i b/Examples/test-suite/nested_inheritance_interface.i new file mode 100644 index 000000000..2d144ff72 --- /dev/null +++ b/Examples/test-suite/nested_inheritance_interface.i @@ -0,0 +1,15 @@ +%module nested_inheritance_interface + +%warnfilter(SWIGWARN_RUBY_MULTIPLE_INHERITANCE, + SWIGWARN_D_MULTIPLE_INHERITANCE, + SWIGWARN_PHP_MULTIPLE_INHERITANCE); /* languages not supporting multiple inheritance or %interface */ + +#if defined(SWIGJAVA) || defined(SWIGCSHARP) +%include "swiginterface.i" +%interface(IA) +#endif + +%inline %{ +struct IA {}; +struct B { struct N : IA {}; }; +%}