changeset 23929:20c83f619102

bump Java compatibility level to 1.6, minimum supported by Java 9 (bug #51803) * scripts/java/module.mk (%.class): Compile Java with -source 1.6 -target 1.6. * ov-java.cc (octave::JVMArgs::JVMArgs, initialize_jvm, thread_jni_env): Use JNI_VERSION_1_6 to initialize the JVM. Thanks to Ernst Reissner for the suggestion.
author Mike Miller <mtmiller@octave.org>
date Tue, 22 Aug 2017 23:28:06 -0700
parents 712736d43124
children 174b6afa7e7f
files libinterp/octave-value/ov-java.cc scripts/java/module.mk
diffstat 2 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-java.cc	Tue Aug 22 23:17:41 2017 -0700
+++ b/libinterp/octave-value/ov-java.cc	Tue Aug 22 23:28:06 2017 -0700
@@ -191,7 +191,7 @@
 
     JVMArgs (void)
     {
-      vm_args.version = JNI_VERSION_1_2;
+      vm_args.version = JNI_VERSION_1_6;
       vm_args.nOptions = 0;
       vm_args.options = nullptr;
       vm_args.ignoreUnrecognized = false;
@@ -591,12 +591,12 @@
       // At least one JVM exists, try to attach to it
 
       switch (jvm->GetEnv (reinterpret_cast<void **> (&current_env),
-                           JNI_VERSION_1_2))
+                           JNI_VERSION_1_6))
         {
         case JNI_EDETACHED:
           // Attach the current thread
           JavaVMAttachArgs vm_args;
-          vm_args.version = JNI_VERSION_1_2;
+          vm_args.version = JNI_VERSION_1_6;
           vm_args.name = const_cast<char *> ("octave");
           vm_args.group = nullptr;
           if (jvm->AttachCurrentThread (reinterpret_cast<void **> (&current_env),
@@ -710,7 +710,7 @@
   JNIEnv *env = nullptr;
 
   if (jvm)
-    jvm->GetEnv (reinterpret_cast<void **> (&env), JNI_VERSION_1_2);
+    jvm->GetEnv (reinterpret_cast<void **> (&env), JNI_VERSION_1_6);
 
   return env;
 }
--- a/scripts/java/module.mk	Tue Aug 22 23:17:41 2017 -0700
+++ b/scripts/java/module.mk	Tue Aug 22 23:28:06 2017 -0700
@@ -36,7 +36,10 @@
 
 $(%canon_reldir%_JAVA_CLASSES) : %.class : %.java | %reldir%/$(octave_dirstamp)
 	$(AM_V_GEN)$(MKDIR_P) %reldir%/$(org_octave_dir) && \
-		( cd $(srcdir)/scripts/java; "$(JAVAC)" -source 1.3 -target 1.3 -Xlint:-options -d $(abs_top_builddir)/scripts/java $(org_octave_dir)/$(<F) )
+	( cd $(srcdir)/scripts/java; \
+	  "$(JAVAC)" -source 1.6 -target 1.6 -Xlint:-options \
+	             -d $(abs_top_builddir)/scripts/java \
+	             $(org_octave_dir)/$(<F) )
 
 if AMCOND_HAVE_JAVA
 %reldir%/octave.jar: $(%canon_reldir%_JAVA_CLASSES)