Fix regression introduced in r12784 where SWIG accepts a non standard constructor and destructor name in %extend, where the typedef name is used as the constructor/destructor name.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12801 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2011-09-08 18:19:45 +00:00
commit a141af9574
4 changed files with 178 additions and 16 deletions

View file

@ -0,0 +1,40 @@
import extend_constructor_destructor.*;
public class extend_constructor_destructor_runme {
static {
try {
System.loadLibrary("extend_constructor_destructor");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
System.exit(1);
}
}
public static void main(String argv[]) {
AStruct a = new AStruct(10);
checkGlobal(10);
BStruct b = new BStruct(20);
checkGlobal(20);
CStruct c = new CStruct(30);
checkGlobal(30);
DStruct d = new DStruct(40);
checkGlobal(40);
a.delete();
checkGlobal(-10);
b.delete();
checkGlobal(-20);
c.delete();
checkGlobal(-30);
d.delete();
checkGlobal(-40);
}
public static void checkGlobal(int val) {
int global = extend_constructor_destructor.getGlobal();
if (global != val)
throw new RuntimeException("global value incorrect. Expected: " + val + " got: " + global);
}
}