Added %javamethodmodifiers check

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5558 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2003-12-13 00:20:42 +00:00
commit 531e78b236
2 changed files with 21 additions and 0 deletions

View file

@ -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. // 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_typemaps_proxy.*;
import java.lang.reflect.*;
public class java_typemaps_proxy_runme { 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 // Create a NULL pointer for Farewell using the constructor with changed modifiers
Farewell nullFarewell = new Farewell(0, false); 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.");
}
} }
} }

View file

@ -47,6 +47,8 @@ import java.lang.*; // for Exception
} }
%} %}
// Check the %javamethodmodifiers feature
%javamethodmodifiers NS::Farewell::methodmodifiertest() "private";
%inline %{ %inline %{
namespace NS { namespace NS {
@ -56,9 +58,13 @@ namespace NS {
static void ciao(Greeting* g) {} static void ciao(Greeting* g) {}
}; };
class Farewell { class Farewell {
public:
void methodmodifiertest() {}
}; };
template<class T> class Adieu {}; template<class T> class Adieu {};
} }
%} %}
%template(AdieuIntPtrPtr) NS::Adieu<int**>; %template(AdieuIntPtrPtr) NS::Adieu<int**>;