From 399e9f5504c66a102d0201ffe4d66fdcd32f244b Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 3 Apr 2003 12:30:26 +0000 Subject: [PATCH] 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 --- Examples/test-suite/java/java_enums_runme.java | 16 +++++++++++++++- Examples/test-suite/java_enums.i | 6 ++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Examples/test-suite/java/java_enums_runme.java b/Examples/test-suite/java/java_enums_runme.java index 065ab4c9c..300241416 100644 --- a/Examples/test-suite/java/java_enums_runme.java +++ b/Examples/test-suite/java/java_enums_runme.java @@ -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; + } } } diff --git a/Examples/test-suite/java_enums.i b/Examples/test-suite/java_enums.i index 27197a197..5088e63d3 100644 --- a/Examples/test-suite/java_enums.i +++ b/Examples/test-suite/java_enums.i @@ -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);