Modifications to testcase to test the enums and constants in a separate Java interface.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4662 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2003-04-03 12:30:26 +00:00
commit 399e9f5504
2 changed files with 21 additions and 1 deletions

View file

@ -1,7 +1,7 @@
import java_enums.*;
public class java_enums_runme {
public class java_enums_runme implements java_enumsConstants {
static {
try {
System.loadLibrary("java_enums");
@ -36,5 +36,19 @@ public class java_enums_runme {
short nonsense = java_enums.POPPYCOCK;
short tst1 = java_enums.test1(nonsense);
short tst2 = java_enums.test2(nonsense);
// Check that we can drop the java_enums keyword as this class implements the java_enumsConstants interface
switch(number) {
case FIDDLE:
break;
case STICKS:
break;
case BONGO:
break;
case DRUMS:
break;
default:
break;
}
}
}

View file

@ -3,6 +3,12 @@
%module java_enums
// Some pragmas to add in an interface to the module class - checks that the java_enumsConstants interface class is also 'implemented'
%pragma(java) moduleinterfaces="Serializable"
%pragma(java) moduleimports=%{
import java.io.*; // For Serializable
%}
// Set default Java const code generation
%javaconst(1);