Add premature garbage collection prevention parameter test
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9487 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
eb142ad08a
commit
ef0b9a8ba2
2 changed files with 35 additions and 1 deletions
|
|
@ -50,7 +50,6 @@ public class java_typemaps_proxy_runme {
|
|||
|
||||
// Check the %javamethodmodifiers feature
|
||||
try {
|
||||
|
||||
Method methodmodifiertest = nullFarewell.getClass().getDeclaredMethod("methodmodifiertest", (java.lang.Class[])null);
|
||||
if ( !Modifier.isPrivate(methodmodifiertest.getModifiers()) )
|
||||
throw new RuntimeException("NS::Farewell::methodmodifiertest not private" );
|
||||
|
|
@ -60,6 +59,23 @@ public class java_typemaps_proxy_runme {
|
|||
} catch (SecurityException s) {
|
||||
throw new RuntimeException("SecurityException caught. Test failed.");
|
||||
}
|
||||
|
||||
// Check the premature garbage collection prevention parameter
|
||||
// Check it is normally present
|
||||
long nullPtr = 0;
|
||||
With with = new With(null);
|
||||
java_typemaps_proxyJNI.new_With(nullPtr, with);
|
||||
java_typemaps_proxyJNI.With_static_method(nullPtr, with);
|
||||
java_typemaps_proxyJNI.With_member_method(nullPtr, with, nullPtr, with);
|
||||
java_typemaps_proxyJNI.delete_With(nullPtr);
|
||||
java_typemaps_proxyJNI.global_method_with(nullPtr, with);
|
||||
|
||||
// Check that it can be turned off
|
||||
java_typemaps_proxyJNI.new_Without(nullPtr);
|
||||
java_typemaps_proxyJNI.Without_static_method(nullPtr);
|
||||
java_typemaps_proxyJNI.Without_member_method(nullPtr, nullPtr);
|
||||
java_typemaps_proxyJNI.delete_Without(nullPtr);
|
||||
java_typemaps_proxyJNI.global_method_without(nullPtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -87,4 +87,22 @@ namespace NS {
|
|||
|
||||
%template(AdieuIntPtrPtr) NS::Adieu<int**>;
|
||||
|
||||
// Check the premature garbage collection prevention parameter can be turned off
|
||||
%typemap(jtype, nopgcpp="1") Without * "long";
|
||||
%pragma(java) jniclassclassmodifiers="public class"
|
||||
|
||||
%inline %{
|
||||
struct Without {
|
||||
Without(Without *p) {}
|
||||
static void static_method(Without *p) {}
|
||||
void member_method(Without *p) {}
|
||||
};
|
||||
void global_method_without(Without *p) {}
|
||||
struct With {
|
||||
With(With *p) {}
|
||||
static void static_method(With *p) {}
|
||||
void member_method(With *p) {}
|
||||
};
|
||||
void global_method_with(With *p) {}
|
||||
%}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue