A long overdue update of the 'javacomp' module.
2016-12-04 Bruno Haible <br...@clisp.org> javacomp: Support Java 7 and 8. * m4/javacomp.m4 (gt_JAVACOMP): Accept source-version 1.7, 1.8 and target-version 1.7, 1.8. diff --git a/m4/javacomp.m4 b/m4/javacomp.m4 index 6d370d1..176de89 100644 --- a/m4/javacomp.m4 +++ b/m4/javacomp.m4 @@ -1,4 +1,4 @@ -# javacomp.m4 serial 12 +# javacomp.m4 serial 13 dnl Copyright (C) 2001-2003, 2006-2007, 2009-2016 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -15,7 +15,12 @@ dnl with or without modifications, as long as this notice is preserved. # 1.3 inner classes # 1.4 assert keyword # 1.5 generic classes and methods -# 1.6 (not yet supported) +# 1.6 (not supported) +# 1.7 switch(string) +# 1.8 lambdas +# Instead of source-version 1.6, use 1.5, since Java 6 did not introduce any +# language changes. See +# http://docs.oracle.com/javase/8/docs/technotes/guides/language/enhancements.html # # target-version can be: classfile version: # 1.1 45.3 @@ -24,6 +29,8 @@ dnl with or without modifications, as long as this notice is preserved. # 1.4 48.0 # 1.5 49.0 # 1.6 50.0 +# 1.7 51.0 +# 1.8 52.0 # The classfile version of a .class file can be determined through the "file" # command. More portably, the classfile major version can be determined through # "od -A n -t d1 -j 7 -N 1 classfile". @@ -36,6 +43,8 @@ dnl with or without modifications, as long as this notice is preserved. # 1.4 JDK/JRE 1.4, gij 4.0, 4.1 # 1.5 JDK/JRE 1.5 # 1.6 JDK/JRE 1.6 +# 1.7 JDK/JRE 1.7 +# 1.8 JDK/JRE 1.8 # Note: gij >= 3.3 can in some cases handle classes compiled with -target 1.4, # and gij >= 4.1 can in some cases partially handle classes compiled with # -target 1.5, but I have no idea how complete this support is. @@ -48,7 +57,7 @@ dnl with or without modifications, as long as this notice is preserved. # - target-version < 1.4 with source-version >= 1.4, or # - target-version < 1.5 with source-version >= 1.5, or # - target-version < 1.6 with source-version >= 1.6, -# because even Sun's javac doesn't support these combinations. +# because even Sun's/Oracle's javac doesn't support these combinations. # # It is redundant to ask for a target-version > source-version, since the # smaller target-version = source-version will also always work and newer JVMs @@ -99,7 +108,7 @@ changequote([,])dnl CLASSPATH=.${CLASSPATH:+$CLASSPATH_SEPARATOR$CLASSPATH} $CONF_JAVA conftestver 2>&AS_MESSAGE_LOG_FD }` case "$target_version" in - 1.1 | 1.2 | 1.3 | 1.4 | 1.5 | 1.6) ;; + 1.1 | 1.2 | 1.3 | 1.4 | 1.5 | 1.6 | 1.7 | 1.8) ;; null) dnl JDK 1.1.X returns null. target_version=1.1 ;; @@ -117,6 +126,10 @@ changequote([,])dnl 1.4) goodcode='class conftest { static { assert(true); } }' failcode='class conftestfail<T> { T foo() { return null; } }' ;; 1.5) goodcode='class conftest<T> { T foo() { return null; } }' + failcode='class conftestfail { void foo () { switch ("A") {} } }' ;; + 1.7) goodcode='class conftest { void foo () { switch ("A") {} } }' + failcode='class conftestfail { void foo () { Runnable r = () -> {}; } }' ;; + 1.8) goodcode='class conftest { void foo () { Runnable r = () -> {}; } }' failcode='class conftestfail syntax error' ;; *) AC_MSG_ERROR([invalid source-version argument to gt_@&t@JAVACOMP: $source_version]) ;; esac @@ -127,6 +140,8 @@ changequote([,])dnl 1.4) cfversion=48 ;; 1.5) cfversion=49 ;; 1.6) cfversion=50 ;; + 1.7) cfversion=51 ;; + 1.8) cfversion=52 ;; *) AC_MSG_ERROR([invalid target-version argument to gt_@&t@JAVACOMP: $target_version]) ;; esac # Function to output the classfile version of a file (8th byte) in decimal. @@ -161,7 +176,7 @@ changequote([,])dnl dnl "-fno-assert" switches to source-version 1.3. dnl gcj >= 4.3 has an option -fsource=1.X. dnl - dnl The support of Sun javac for target-version and source-version: + dnl The support of Sun/Oracle javac for target-version and source-version: dnl dnl javac 1.3: -target 1.1 1.2 1.3 default: 1.1 dnl source always: 1.3 @@ -181,6 +196,21 @@ changequote([,])dnl dnl -target 1.4 only possible with -source 1.3/1.4 dnl -target 1.5 only possible with -source 1.3/1.4/1.5 or no -source dnl + dnl javac 1.7: -target 1.1 1.2 1.3 1.4 1.5 1.6 1.7 default: 1.7 + dnl -source 1.3 1.4 1.5 1.6 1.7 default: 1.7 + dnl -target 1.1/1.2/1.3 only possible with -source 1.3 + dnl -target 1.4 only possible with -source 1.3/1.4 + dnl -target 1.5 only possible with -source 1.3/1.4/1.5 + dnl -target 1.6 only possible with -source 1.3/1.4/1.5/1.6 + dnl + dnl javac 1.8: -target 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 default: 1.8 + dnl -source [1.3 1.4 1.5] 1.6 1.7 1.8 default: 1.8 + dnl -target 1.1/1.2/1.3 only possible with -source 1.3 + dnl -target 1.4 only possible with -source 1.3/1.4 + dnl -target 1.5 only possible with -source 1.3/1.4/1.5 + dnl -target 1.6 only possible with -source 1.3/1.4/1.5/1.6 + dnl -target 1.7 only possible with -source 1.3/1.4/1.5/1.6/1.7 + dnl dnl The support of jikes for target-version and source-version: dnl dnl jikes 1.14 does not have a way to specify the target-version. It