Fix Java shared_ptr and directors for derived classes java compilation error.

For shared_ptr proxy proxy classes, add a protected method swigSetCMemOwn for modifying
the swigCMemOwn and swigCMemOwnDerived member variables which are used by various other
methods for controlling memory ownership.

Closes #230
Closes #759
This commit is contained in:
William S Fulton 2017-05-23 20:56:15 +01:00
commit 4bf607589f
7 changed files with 138 additions and 6 deletions

View file

@ -33,6 +33,12 @@ public class director_smartptr_runme {
director_smartptr.Foo myFoo2 = new director_smartptr.Foo().makeFoo();
check(myFoo2.pong(), "Foo::pong();Foo::ping()");
check(director_smartptr.Foo.callPong(myFoo2), "Foo::pong();Foo::ping()");
director_smartptr.FooDerived myBarFooDerived = new director_smartptr_MyBarFooDerived();
check(myBarFooDerived.ping(), "director_smartptr_MyBarFooDerived.ping()");
check(director_smartptr.FooDerived.callPong(myBarFooDerived), "director_smartptr_MyBarFooDerived.pong();director_smartptr_MyBarFooDerived.ping()");
check(director_smartptr.FooDerived.callUpcall(myBarFooDerived, fooBar), "overrideDerived;Bar::Foo2::Foo2Bar()");
}
}
@ -58,3 +64,26 @@ class director_smartptr_MyBarFoo extends director_smartptr.Foo {
return new director_smartptr.Foo();
}
}
class director_smartptr_MyBarFooDerived extends director_smartptr.FooDerived {
@Override
public String ping() {
return "director_smartptr_MyBarFooDerived.ping()";
}
@Override
public String pong() {
return "director_smartptr_MyBarFooDerived.pong();" + ping();
}
@Override
public String upcall(director_smartptr.FooBar fooBarPtr) {
return "overrideDerived;" + fooBarPtr.FooBarDo();
}
@Override
public director_smartptr.Foo makeFoo() {
return new director_smartptr.Foo();
}
}