summaryrefslogtreecommitdiff
path: root/Examples/test-suite/java_enums.i
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2004-05-24 20:05:40 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2004-05-24 20:05:40 +0000
commitc88daea0013ecb76e5228a5413bcb8eea909691a (patch)
tree601cdd73579742f571d2f3d25b335790cb97a753 /Examples/test-suite/java_enums.i
parent3d51247b244646394d9173b22c49101016078616 (diff)
downloadswig-c88daea0013ecb76e5228a5413bcb8eea909691a.tar.gz
New default C/C++ enum wrapping approach which uses the type safe enum pattern for Java and C#
Also tests for Java and C# simple enums (enum items mapped to integers) Also proper Java (J2SDK1.5) enums git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5919 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Examples/test-suite/java_enums.i')
-rw-r--r--Examples/test-suite/java_enums.i8
1 files changed, 6 insertions, 2 deletions
diff --git a/Examples/test-suite/java_enums.i b/Examples/test-suite/java_enums.i
index 5088e63d3..f81320995 100644
--- a/Examples/test-suite/java_enums.i
+++ b/Examples/test-suite/java_enums.i
@@ -3,7 +3,9 @@
%module java_enums
-// Some pragmas to add in an interface to the module class - checks that the java_enumsConstants interface class is also 'implemented'
+%include "enumtypeunsafe.swg"
+
+// Some pragmas to add in an interface to the module class
%pragma(java) moduleinterfaces="Serializable"
%pragma(java) moduleimports=%{
import java.io.*; // For Serializable
@@ -12,6 +14,9 @@ import java.io.*; // For Serializable
// Set default Java const code generation
%javaconst(1);
+// Change the default generation so that these enums are generated into an interface instead of a class
+%typemap(javaclassmodifiers) enum stuff "public interface"
+
%inline %{
enum stuff { FIDDLE = 2*100, STICKS = 5+8, BONGO, DRUMS };
%}
@@ -28,7 +33,6 @@ enum stuff { FIDDLE = 2*100, STICKS = 5+8, BONGO, DRUMS };
return $jnicall;
}
-
%inline %{
enum nonsense { POPPYCOCK, JUNK };
nonsense test1(nonsense n) { return n; }