2017/12/13 15:49:53 -0800, [email protected]:
> On 13 Dec 2017, at 14:36, [email protected] wrote:
>> I understand that other incoming changes are waiting for the 11 version
>> bump, but can't we at least do the straightforward parameterizations and
>> introduce _CURRENT constants in this round? We can leave anything that
>> requires code generation to post-11.
>
> On the lang tools side that does seem easy, but I’ll defer to Joe.
>
> With some guidance from the build engineers i would gladly consolidate
> class file version declaration in C/++ files with a passed in macro,
> if this can be expediently worked out. I wanna push condy as early as
> possible in 11 :-)
Understood, but let's do the right thing (or at least closer to that)
with this yak while we're here.
> If we could do something in jvm.h that would be ideal. We already have
> the definitions JVM_CLASSFILE_MAJOR_VERSION and
> JVM_CLASSFILE_MINOR_VERSION pulled in via classfile_constants.h, so
> how can the build process inject values into those macros?
I just went through this for the versioning changes. The attached patch
(against d2a837cf9ff1) does what you want, I think.
> For class file versions embedded in Java code it would make it easier
> if we had programmatic access. Perhaps we could have static methods on
> Runtime.Version to get the major/minor class file versions?
Sure, or maybe better to make them instance methods of Runtime. Parsing
`System.getProperty("java.class.version")` every time is no fun.
- Mark
# HG changeset patch
# User mr
# Parent d2a837cf9ff114d58612d4709766db989be6157e
Define the class-file version in make/autoconf/version-numbers
diff --git a/make/autoconf/generated-configure.sh b/make/autoconf/generated-configure.sh
--- a/make/autoconf/generated-configure.sh
+++ b/make/autoconf/generated-configure.sh
@@ -887,6 +887,8 @@
BOOT_JDK
JAVA_CHECK
JAVAC_CHECK
+VERSION_CLASSFILE_MINOR
+VERSION_CLASSFILE_MAJOR
VENDOR_VERSION_STRING
VERSION_DATE
VERSION_IS_GA
@@ -5185,7 +5187,7 @@
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1513206608
+DATE_WHEN_GENERATED=1513221877
###############################################################################
#
@@ -25457,6 +25459,10 @@
VENDOR_VERSION_STRING="$with_vendor_version_string"
fi
+ # We could define --with flags for these, if really needed
+ VERSION_CLASSFILE_MAJOR="$DEFAULT_VERSION_CLASSFILE_MAJOR"
+ VERSION_CLASSFILE_MINOR="$DEFAULT_VERSION_CLASSFILE_MINOR"
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for version string" >&5
$as_echo_n "checking for version string... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $VERSION_STRING" >&5
@@ -25478,6 +25484,9 @@
+
+
+
###############################################################################
#
# Setup BootJDK, used to bootstrap the build.
diff --git a/make/autoconf/jdk-version.m4 b/make/autoconf/jdk-version.m4
--- a/make/autoconf/jdk-version.m4
+++ b/make/autoconf/jdk-version.m4
@@ -331,6 +331,10 @@
VENDOR_VERSION_STRING="$with_vendor_version_string"
fi
+ # We could define --with flags for these, if really needed
+ VERSION_CLASSFILE_MAJOR="$DEFAULT_VERSION_CLASSFILE_MAJOR"
+ VERSION_CLASSFILE_MINOR="$DEFAULT_VERSION_CLASSFILE_MINOR"
+
AC_MSG_CHECKING([for version string])
AC_MSG_RESULT([$VERSION_STRING])
@@ -348,4 +352,7 @@
AC_SUBST(VERSION_IS_GA)
AC_SUBST(VERSION_DATE)
AC_SUBST(VENDOR_VERSION_STRING)
+ AC_SUBST(VERSION_CLASSFILE_MAJOR)
+ AC_SUBST(VERSION_CLASSFILE_MINOR)
+
])
diff --git a/make/autoconf/spec.gmk.in b/make/autoconf/spec.gmk.in
--- a/make/autoconf/spec.gmk.in
+++ b/make/autoconf/spec.gmk.in
@@ -175,6 +175,10 @@
# Vendor version string
VENDOR_VERSION_STRING := @VENDOR_VERSION_STRING@
+# Class-file version
+VERSION_CLASSFILE_MAJOR := @VERSION_CLASSFILE_MAJOR@
+VERSION_CLASSFILE_MINOR := @VERSION_CLASSFILE_MINOR@
+
# Convenience CFLAGS settings for passing version information into native programs.
VERSION_CFLAGS := \
-DVERSION_FEATURE=$(VERSION_FEATURE) \
@@ -190,6 +194,8 @@
-DVERSION_SPECIFICATION='"$(VERSION_SPECIFICATION)"' \
-DVERSION_DATE='"$(VERSION_DATE)"' \
-DVENDOR_VERSION_STRING='"$(VENDOR_VERSION_STRING)"' \
+ -DVERSION_CLASSFILE_MAJOR=$(VERSION_CLASSFILE_MAJOR) \
+ -DVERSION_CLASSFILE_MINOR=$(VERSION_CLASSFILE_MINOR) \
#
# Platform naming variables
diff --git a/make/autoconf/version-numbers b/make/autoconf/version-numbers
--- a/make/autoconf/version-numbers
+++ b/make/autoconf/version-numbers
@@ -30,6 +30,8 @@
DEFAULT_VERSION_UPDATE=0
DEFAULT_VERSION_PATCH=0
DEFAULT_VERSION_DATE=2018-03-20
+DEFAULT_VERSION_CLASSFILE_MAJOR=56 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
+DEFAULT_VERSION_CLASSFILE_MINOR=2
LAUNCHER_NAME=openjdk
PRODUCT_NAME=OpenJDK
diff --git a/src/java.base/share/native/include/classfile_constants.h b/src/java.base/share/native/include/classfile_constants.h
--- a/src/java.base/share/native/include/classfile_constants.h
+++ b/src/java.base/share/native/include/classfile_constants.h
@@ -31,8 +31,8 @@
#endif
/* Classfile version number for this information */
-#define JVM_CLASSFILE_MAJOR_VERSION 54
-#define JVM_CLASSFILE_MINOR_VERSION 0
+#define JVM_CLASSFILE_MAJOR_VERSION VERSION_CLASSFILE_MAJOR
+#define JVM_CLASSFILE_MINOR_VERSION VERSION_CLASSFILE_MINOR
/* Flags */
diff --git a/src/java.base/share/native/libjava/System.c b/src/java.base/share/native/libjava/System.c
--- a/src/java.base/share/native/libjava/System.c
+++ b/src/java.base/share/native/libjava/System.c
@@ -114,8 +114,8 @@
#define VENDOR_URL_BUG "http://bugreport.java.com/bugreport/"
#endif
-#define JAVA_MAX_SUPPORTED_VERSION 54
-#define JAVA_MAX_SUPPORTED_MINOR_VERSION 0
+#define JAVA_MAX_SUPPORTED_VERSION VERSION_CLASSFILE_MAJOR
+#define JAVA_MAX_SUPPORTED_MINOR_VERSION VERSION_CLASSFILE_MINOR
#ifdef JAVA_SPECIFICATION_VENDOR /* Third party may NOT overwrite this. */
#error "ERROR: No override of JAVA_SPECIFICATION_VENDOR is allowed"