Fix director typemaps for pointers so that NULL pointers are correctly marshalled to C#/Java null in director methods
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10662 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b2cea3c42a
commit
4887e7be7c
6 changed files with 127 additions and 20 deletions
|
|
@ -14,28 +14,43 @@ public class director_basic_runme {
|
|||
|
||||
public static void main(String argv[]) {
|
||||
|
||||
director_basic_MyFoo a = new director_basic_MyFoo();
|
||||
director_basic_MyFoo a = new director_basic_MyFoo();
|
||||
|
||||
if (!a.ping().equals("director_basic_MyFoo::ping()")) {
|
||||
throw new RuntimeException ( "a.ping()" );
|
||||
}
|
||||
if (!a.ping().equals("director_basic_MyFoo::ping()")) {
|
||||
throw new RuntimeException ( "a.ping()" );
|
||||
}
|
||||
|
||||
if (!a.pong().equals("Foo::pong();director_basic_MyFoo::ping()")) {
|
||||
throw new RuntimeException ( "a.pong()" );
|
||||
}
|
||||
if (!a.pong().equals("Foo::pong();director_basic_MyFoo::ping()")) {
|
||||
throw new RuntimeException ( "a.pong()" );
|
||||
}
|
||||
|
||||
Foo b = new Foo();
|
||||
Foo b = new Foo();
|
||||
|
||||
if (!b.ping().equals("Foo::ping()")) {
|
||||
throw new RuntimeException ( "b.ping()" );
|
||||
}
|
||||
if (!b.ping().equals("Foo::ping()")) {
|
||||
throw new RuntimeException ( "b.ping()" );
|
||||
}
|
||||
|
||||
if (!b.pong().equals("Foo::pong();Foo::ping()")) {
|
||||
throw new RuntimeException ( "b.pong()" );
|
||||
}
|
||||
if (!b.pong().equals("Foo::pong();Foo::ping()")) {
|
||||
throw new RuntimeException ( "b.pong()" );
|
||||
}
|
||||
|
||||
A1 a1 = new A1(1, false);
|
||||
a1.delete();
|
||||
A1 a1 = new A1(1, false);
|
||||
a1.delete();
|
||||
|
||||
{
|
||||
MyOverriddenClass my = new MyOverriddenClass();
|
||||
|
||||
my.expectNull = true;
|
||||
if (MyClass.call_pmethod(my, null) != null)
|
||||
throw new RuntimeException("null pointer marshalling problem");
|
||||
|
||||
Bar myBar = new Bar();
|
||||
my.expectNull = false;
|
||||
Bar myNewBar = MyClass.call_pmethod(my, myBar);
|
||||
if (myNewBar == null)
|
||||
throw new RuntimeException("non-null pointer marshalling problem");
|
||||
myNewBar.setX(10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -45,3 +60,13 @@ class director_basic_MyFoo extends Foo {
|
|||
}
|
||||
}
|
||||
|
||||
class MyOverriddenClass extends MyClass {
|
||||
public boolean expectNull = false;
|
||||
public boolean nonNullReceived = false;
|
||||
public Bar pmethod(Bar b) {
|
||||
if ( expectNull && (b != null) )
|
||||
throw new RuntimeException("null not received as expected");
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue