added check that pure virtual method is handled by throwing an exception if Java derived class does not provide an implementation
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5289 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
4536730c5a
commit
c1fa548d3d
1 changed files with 12 additions and 0 deletions
|
|
@ -23,6 +23,15 @@ public class director_abstract_runme {
|
||||||
if (!a.pong().equals("Foo::pong();MyFoo::ping()")) {
|
if (!a.pong().equals("Foo::pong();MyFoo::ping()")) {
|
||||||
throw new RuntimeException ( "a.pong()" );
|
throw new RuntimeException ( "a.pong()" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BadFoo b = new BadFoo();
|
||||||
|
try {
|
||||||
|
b.ping();
|
||||||
|
System.out.println( "Test failed. An attempt to call a pure virtual method should throw an exception" );
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
catch (RuntimeException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -32,3 +41,6 @@ class MyFoo extends Foo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class BadFoo extends Foo {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue