diff --git a/SWIG/Examples/test-suite/java/java_typemaps_proxy_runme.java b/SWIG/Examples/test-suite/java/java_typemaps_proxy_runme.java index 997e5b8d1..25e22871a 100644 --- a/SWIG/Examples/test-suite/java/java_typemaps_proxy_runme.java +++ b/SWIG/Examples/test-suite/java/java_typemaps_proxy_runme.java @@ -2,6 +2,7 @@ // This is the java_typemaps_proxy runtime testcase. Contrived example checks that the pure Java code from the Java typemaps compiles. import java_typemaps_proxy.*; +import java.lang.reflect.*; public class java_typemaps_proxy_runme { @@ -43,6 +44,20 @@ public class java_typemaps_proxy_runme { // Create a NULL pointer for Farewell using the constructor with changed modifiers Farewell nullFarewell = new Farewell(0, false); + + // Check the %javamethodmodifiers feature + try { + + Method methodmodifiertest = nullFarewell.getClass().getDeclaredMethod("methodmodifiertest", null); + if ( !Modifier.isPrivate(methodmodifiertest.getModifiers()) ) + throw new RuntimeException("NS::Farewell::methodmodifiertest not private" ); + + } catch (NoSuchMethodException n) { + throw new RuntimeException("NoSuchmethodException caught. Test failed."); + } catch (SecurityException s) { + throw new RuntimeException("SecurityException caught. Test failed."); + } + } } diff --git a/SWIG/Examples/test-suite/java_typemaps_proxy.i b/SWIG/Examples/test-suite/java_typemaps_proxy.i index 154f227c5..a992be124 100644 --- a/SWIG/Examples/test-suite/java_typemaps_proxy.i +++ b/SWIG/Examples/test-suite/java_typemaps_proxy.i @@ -47,6 +47,8 @@ import java.lang.*; // for Exception } %} +// Check the %javamethodmodifiers feature +%javamethodmodifiers NS::Farewell::methodmodifiertest() "private"; %inline %{ namespace NS { @@ -56,9 +58,13 @@ namespace NS { static void ciao(Greeting* g) {} }; class Farewell { + public: + void methodmodifiertest() {} }; template class Adieu {}; } %} %template(AdieuIntPtrPtr) NS::Adieu; + +