List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:December 5 2007 6:38am
Subject:Rev 326: Fixed java enums. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/devel
View as plain text  
At http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/devel

------------------------------------------------------------
revno: 326
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: devel
timestamp: Tue 2007-12-04 22:37:22 -0800
message:
  Fixed java enums.
removed:
  java/lib/mysql-connector-java-5.0.4-bin.jar
mysqlconnectorjava5.-20070130205851-y8xfweyg7ktm3kq7-2
added:
  java/lib/mysql-connector-java-5.1.5-bin.jar
mysqlconnectorjava5.-20071205054433-ug2xnyzc703kky8w-1
modified:
  configure.in                   configure.in-20070228020914-u2pk759xg7thauwf-13
  java/Makefile.am               makefile.am-20070415032352-9dpe6aurqcnuwcrd-1
  swig/Makefile.am               makefile.am-20071104211339-fod7yzi8t7xd3g0w-3
  swig/SWIG/Lib/java/enums.swg   enums.swg-20071104211339-fod7yzi8t7xd3g0w-909
  swig/SWIG/Lib/java/enumtypesafe.swg enumtypesafe.swg-20071104211339-fod7yzi8t7xd3g0w-911
  swig/SWIG/Source/Modules/java.cxx java.cxx-20071104211339-fod7yzi8t7xd3g0w-1275
  swig/update_from_swigsvn.sh    update_from_swigsvn.-20071104211339-fod7yzi8t7xd3g0w-5
=== removed file 'java/lib/mysql-connector-java-5.0.4-bin.jar'
Binary files a/java/lib/mysql-connector-java-5.0.4-bin.jar	2007-01-30 21:02:20 +0000 and
b/java/lib/mysql-connector-java-5.0.4-bin.jar	1970-01-01 00:00:00 +0000 differ
=== added file 'java/lib/mysql-connector-java-5.1.5-bin.jar'
Binary files a/java/lib/mysql-connector-java-5.1.5-bin.jar	1970-01-01 00:00:00 +0000 and
b/java/lib/mysql-connector-java-5.1.5-bin.jar	2007-12-05 06:37:22 +0000 differ
=== modified file 'configure.in'
--- a/configure.in	2007-12-04 02:04:12 +0000
+++ b/configure.in	2007-12-05 06:37:22 +0000
@@ -1,4 +1,4 @@
-AC_INIT([ndb-connectors], [0.5.1.22.9])
+AC_INIT([ndb-connectors], [0.5.1.22.10])
 AC_CONFIG_AUX_DIR([.])
 AM_INIT_AUTOMAKE
 AM_CONFIG_HEADER(config.h)
@@ -39,14 +39,17 @@
 AC_PROG_SWIG(1.3.32)
 AS_IF([test "x$SWIG" = "xno"],[
   SWIG_LIB="\${top_srcdir}/swig/SWIG/Lib"
-  SWIG="SWIG_LIB=${SWIG_LIB} \${top_builddir}/swig/SWIG/swig"
+  SWIG_BIN="\${top_builddir}/swig/SWIG/swig"
+  SWIG="SWIG_LIB=${SWIG_LIB} ${SWIG_BIN}"
   build_swig=yes
 ],[
   build_swig=no
+  SWIG_BIN="${SWIG}"
 ])  
 SWIG_ENABLE_CXX()
 AC_SUBST(SWIG)
 AC_SUBST(SWIG_LIB)
+AC_SUBST(SWIG_BIN)
 
 
 

=== modified file 'java/Makefile.am'
--- a/java/Makefile.am	2007-12-05 05:27:58 +0000
+++ b/java/Makefile.am	2007-12-05 06:37:22 +0000
@@ -326,7 +326,7 @@
 
 .java.class:
 	@mkdir -p `dirname $*`
-	$(JAVAC) -classpath
$(srcdir):$(srcdir)/lib/mysql-connector-java-5.0.4-bin.jar:$(srcdir)/lib/junit.jar
-sourcepath $(srcdir):$(builddir) -d $(builddir) $<
+	$(JAVAC) -classpath
$(srcdir):$(srcdir)/lib/mysql-connector-java-5.1.5-bin.jar:$(srcdir)/lib/junit.jar
-sourcepath $(srcdir):$(builddir) -d $(builddir) $<
 
 .i.cxx: 
 	@mkdir -p ${package_builddir}/$(*F)
@@ -335,19 +335,19 @@
 # $(NDBAPI_JAVA_CLASSES) $(MGMAPI_JAVA_CLASSES)
 mgmj.jar: libmgmj.la $(MGMAPI_JAVA_SRC) $(MGMAPI_BUILT_J)
 	@echo "Building MGM/J java files"
-	@$(JAVAC) -classpath
$(srcdir):$(srcdir)/lib/mysql-connector-java-5.0.4-bin.jar:$(srcdir)/lib/junit.jar
-sourcepath $(srcdir):$(builddir) -d $(builddir)  $(MGMAPI_JAVA_SRC) $(MGMAPI_BUILT_J)
+	@$(JAVAC) -classpath
$(srcdir):$(srcdir)/lib/mysql-connector-java-5.1.5-bin.jar:$(srcdir)/lib/junit.jar
-sourcepath $(srcdir):$(builddir) -d $(builddir)  $(MGMAPI_JAVA_SRC) $(MGMAPI_BUILT_J)
 	@echo "Building mgmj.jar"
 	@$(JAR) cf $@ $(MGMAPI_JAVA_CLASSES) ${package_builddir}/ndbj/*\$$*class
 
 ndbj.jar: libndbj.la $(NDBAPI_JAVA_SRC) $(NDBAPI_BUILT_J)
 	@echo "Building NDB/J java files"
-	@$(JAVAC) -classpath
$(srcdir):$(srcdir)/lib/mysql-connector-java-5.0.4-bin.jar:$(srcdir)/lib/junit.jar
-sourcepath $(srcdir):$(builddir) -d $(builddir)  $(NDBAPI_JAVA_SRC) $(NDBAPI_BUILT_J) 
+	@$(JAVAC) -classpath
$(srcdir):$(srcdir)/lib/mysql-connector-java-5.1.5-bin.jar:$(srcdir)/lib/junit.jar
-sourcepath $(srcdir):$(builddir) -d $(builddir)  $(NDBAPI_JAVA_SRC) $(NDBAPI_BUILT_J) 
 	@echo "Building ndbj.jar"
 	@$(JAR) cf $@ ${NDBAPI_JAVA_CLASSES} ${package_builddir}/ndbj/*\$$*class
 
 check-local: all-am
-	$(JAVA) -Djava.library.path=$(builddir)/.libs 
-Dcom.mysql.jdbc.testsuite.url=jdbc:mysql://localhost/test -classpath
$(builddir):$(builddir)/lib/mysql-connector-java-5.0.4-bin.jar:$(builddir)/lib/junit.jar 
junit.textui.TestRunner testsuite.ndbj.AllTests
-	$(JAVA) -Djava.library.path=$(builddir)/.libs 
-Dcom.mysql.jdbc.testsuite.url=jdbc:mysql://localhost/test -classpath
$(builddir):$(builddir)/lib/mysql-connector-java-5.0.4-bin.jar:$(builddir)/lib/junit.jar 
junit.textui.TestRunner testsuite.mgmj.AllTests
+	$(JAVA) -Djava.library.path=$(builddir)/.libs 
-Dcom.mysql.jdbc.testsuite.url=jdbc:mysql://localhost/test -classpath
$(builddir):$(builddir)/lib/mysql-connector-java-5.1.5-bin.jar:$(builddir)/lib/junit.jar 
junit.textui.TestRunner testsuite.ndbj.AllTests
+	$(JAVA) -Djava.library.path=$(builddir)/.libs 
-Dcom.mysql.jdbc.testsuite.url=jdbc:mysql://localhost/test -classpath
$(builddir):$(builddir)/lib/mysql-connector-java-5.1.5-bin.jar:$(builddir)/lib/junit.jar 
junit.textui.TestRunner testsuite.mgmj.AllTests
 
 install-exec-local: ndbj.jar mgmj.jar
 	mkdir -p $(DESTDIR)$(datadir)/java

=== modified file 'swig/Makefile.am'
--- a/swig/Makefile.am	2007-11-26 02:05:33 +0000
+++ b/swig/Makefile.am	2007-12-05 06:37:22 +0000
@@ -7,7 +7,7 @@
 distclean: 
 	cd $(top_builddir)/swig/SWIG && $(MAKE) $(AM_MAKEFLAGS) distclean
 
-dist-hook:
+dist-hook: clean
 	mkdir $(distdir)/SWIG
 	for f in `bzr ls --versioned SWIG` ; do tar cfp - $$f | tar xfp - -C $(distdir) ; done
 	cp $(srcdir)/SWIG/configure  $(distdir)/SWIG

=== modified file 'swig/SWIG/Lib/java/enums.swg'
--- a/swig/SWIG/Lib/java/enums.swg	2007-11-04 21:32:20 +0000
+++ b/swig/SWIG/Lib/java/enums.swg	2007-12-05 06:37:22 +0000
@@ -92,15 +92,18 @@
     throw new IllegalArgumentException("No enum " + $javaclassname.class + " with value "
+ swigValue);
   }
 
+  @SuppressWarnings("unused")
   private $javaclassname() {
     this.swigValue = SwigNext.next++;
   }
 
+  @SuppressWarnings("unused")
   private $javaclassname(int swigValue) {
     this.swigValue = swigValue;
     SwigNext.next = swigValue+1;
   }
 
+  @SuppressWarnings("unused")
   private $javaclassname($javaclassname swigEnum) {
     this.swigValue = swigEnum.swigValue;
     SwigNext.next = this.swigValue+1;

=== modified file 'swig/SWIG/Lib/java/enumtypesafe.swg'
--- a/swig/SWIG/Lib/java/enumtypesafe.swg	2007-11-04 21:32:20 +0000
+++ b/swig/SWIG/Lib/java/enumtypesafe.swg	2007-12-05 06:37:22 +0000
@@ -94,17 +94,20 @@
     throw new IllegalArgumentException("No enum " + $javaclassname.class + " with value "
+ swigValue);
   }
 
+  $suppresswarnings
   private $javaclassname(String swigName) {
     this.swigName = swigName;
     this.swigValue = swigNext++;
   }
 
+  $suppresswarnings
   private $javaclassname(String swigName, int swigValue) {
     this.swigName = swigName;
     this.swigValue = swigValue;
     swigNext = swigValue+1;
   }
 
+  $suppresswarnings
   private $javaclassname(String swigName, $javaclassname swigEnum) {
     this.swigName = swigName;
     this.swigValue = swigEnum.swigValue;

=== modified file 'swig/SWIG/Source/Modules/java.cxx'
--- a/swig/SWIG/Source/Modules/java.cxx	2007-11-04 21:32:20 +0000
+++ b/swig/SWIG/Source/Modules/java.cxx	2007-12-05 06:37:22 +0000
@@ -42,6 +42,7 @@
   bool wrapping_member_flag;	// Flag for when wrapping a member variable/enum/const
   bool global_variable_flag;	// Flag for when wrapping a global variable
   bool old_variable_names;	// Flag for old style variable names in the intermediary class
+  bool use_java5;		// Flag to use newer Java5 features
   bool member_func_flag;	// flag set when wrapping a member function
 
   String *imclass_name;		// intermediary class name
@@ -115,6 +116,7 @@
       wrapping_member_flag(false),
       global_variable_flag(false),
       old_variable_names(false),
+      use_java5(false),
       member_func_flag(false),
       imclass_name(NULL),
       module_class_name(NULL),
@@ -230,6 +232,9 @@
 	} else if (strcmp(argv[i], "-oldvarnames") == 0) {
 	  Swig_mark_arg(i);
 	  old_variable_names = true;
+	} else if (strcmp(argv[i], "-usejava5") == 0) { 
+	  Swig_mark_arg(i);
+	  use_java5 = true;
 	} else if (strcmp(argv[i], "-jnic") == 0) {
 	  Swig_mark_arg(i);
 	  Printf(stderr, "Deprecated command line option: -jnic. C JNI calling convention now
used when -c++ not specified.\n");
@@ -247,6 +252,7 @@
 
     // Add a symbol to the parser for conditional compilation
     Preprocessor_define("SWIGJAVA 1", 0);
+    Preprocessor_define("USEJAVA5 1", 0);
 
     // Add typemap definitions
     SWIG_typemap_lang("java");
@@ -1194,6 +1200,11 @@
 	       typemapLookup("javacode", typemap_lookup_type, WARN_NONE),	// extra Java code
 	       "}", NIL);
 
+        if (use_java5) { 
+	  Replaceall(enum_code, "$suppresswarnings", "@SuppressWarnings(\"unused\")"); 
+        } else { 
+          Replaceall(enum_code, "$suppresswarnings", "");
+        }
 	Replaceall(enum_code, "$javaclassname", symname);
 
 	// Substitute $enumvalues - intended usage is for typesafe enums
@@ -1680,6 +1691,15 @@
 	   "\n", NIL);
 
     // Substitute various strings into the above template
+
+    if (use_java5) {
+      Replaceall(proxy_class_code, "$suppresswarnings", "@SuppressWarnings(\"unused\")");
+      Replaceall(proxy_class_def, "$suppresswarnings", "@SuppressWarnings(\"unused\")");
+    } else {
+      Replaceall(proxy_class_code, "$suppresswarnings", "");
+      Replaceall(proxy_class_def, "$suppresswarnings", "");
+    }
+
     Replaceall(proxy_class_code, "$javaclassname", proxy_class_name);
     Replaceall(proxy_class_def, "$javaclassname", proxy_class_name);
 
@@ -2820,6 +2840,11 @@
 	   typemapLookup("javacode", type, WARN_NONE),	// extra Java code
 	   "}\n", "\n", NIL);
 
+        if (use_java5) { 
+	  Replaceall(swigtype, "$suppresswarnings", "@SuppressWarnings(\"unused\")"); 
+        } else { 
+          Replaceall(swigtype, "$suppresswarnings", "");
+        }
     Replaceall(swigtype, "$javaclassname", classname);
     Replaceall(swigtype, "$module", module_class_name);
     Replaceall(swigtype, "$imclassname", imclass_name);
@@ -4108,5 +4133,6 @@
      -noproxy        - Generate the low-level functional interface instead\n\
                        of proxy classes\n\
      -oldvarnames    - old intermediary method names for variable wrappers\n\
+     -usejava5          - Enable use of newer Java5 constructs\n\
      -package <name> - set name of the Java package to <name>\n\
 \n";

=== modified file 'swig/update_from_swigsvn.sh'
--- a/swig/update_from_swigsvn.sh	2007-11-26 02:09:08 +0000
+++ b/swig/update_from_swigsvn.sh	2007-12-05 06:37:22 +0000
@@ -1,7 +1,10 @@
 #!/bin/sh
 
-bzr diff -r231..293 SWIG/Source/Makefile.am > SWIG.patch 
+bzr diff -r231..309 SWIG/Source/Makefile.am > SWIG.patch 
 bzr diff -r290..293 SWIG/Makefile.in >> SWIG.patch
+bzr diff -r324..325 SWIG/Lib/java/enums.swg >> SWIG.patch
+bzr diff -r324..328 SWIG/Lib/java/enumtypesafe.swg >> SWIG.patch
+bzr diff -r324..328 SWIG/Source/Modules/java.cxx >> SWIG.patch
 rm -rf SWIG
 svn export https://swig.svn.sourceforge.net/svnroot/swig/tags/rel-1.3.33 SWIG
 rm SWIG/Tools/config/config.guess SWIG/Tools/config/config.sub

Thread
Rev 326: Fixed java enums. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/develMonty Taylor5 Dec