Wed, 31 Oct 2012 10:21:14 -0700
8001112: Make -target 8 in javac generate version 52.0 classfile
Reviewed-by: darcy, jjg
1.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Target.java Sun Nov 04 11:01:49 2012 +0000 1.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Target.java Wed Oct 31 10:21:14 2012 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -68,8 +68,8 @@ 1.11 /** JDK 7. */ 1.12 JDK1_7("1.7", 51, 0), 1.13 1.14 - /** JDK 8. */ // For now, a clone of 7 1.15 - JDK1_8("1.8", 51, 0); 1.16 + /** JDK 8. */ 1.17 + JDK1_8("1.8", 52, 0); 1.18 1.19 private static final Context.Key<Target> targetKey = 1.20 new Context.Key<Target>();
2.1 --- a/test/tools/javac/classfiles/ClassVersionChecker.java Sun Nov 04 11:01:49 2012 +0000 2.2 +++ b/test/tools/javac/classfiles/ClassVersionChecker.java Wed Oct 31 10:21:14 2012 -0700 2.3 @@ -23,7 +23,7 @@ 2.4 2.5 /* 2.6 * @test 2.7 - * @bug 7157626 2.8 + * @bug 7157626 8001112 2.9 * @summary Test major version for all legal combinations for -source and -target 2.10 * @author sgoel 2.11 * 2.12 @@ -57,14 +57,14 @@ 2.13 * -1 => invalid combinations 2.14 */ 2.15 int[][] ver = 2.16 - {{51, -1, -1, -1, -1, -1, -1, -1}, 2.17 - {48, 46, 47, 48, 49, 50, 51, 51}, 2.18 - {48, 46, 47, 48, 49, 50, 51, 51}, 2.19 - {48, -1, -1, 48, 49, 50, 51, 51}, 2.20 - {51, -1, -1, -1, 49, 50, 51, 51}, 2.21 - {51, -1, -1, -1, -1, 50, 51, 51}, 2.22 - {51, -1, -1, -1, -1, -1, 51, 51}, 2.23 - {51, -1, -1, -1, -1, -1, -1, 51}}; 2.24 + {{52, -1, -1, -1, -1, -1, -1, -1}, 2.25 + {48, 46, 47, 48, 49, 50, 51, 52}, 2.26 + {48, 46, 47, 48, 49, 50, 51, 52}, 2.27 + {48, -1, -1, 48, 49, 50, 51, 52}, 2.28 + {52, -1, -1, -1, 49, 50, 51, 52}, 2.29 + {52, -1, -1, -1, -1, 50, 51, 52}, 2.30 + {52, -1, -1, -1, -1, -1, 51, 52}, 2.31 + {52, -1, -1, -1, -1, -1, -1, 52}}; 2.32 2.33 // Loop to run all possible combinations of source/target values 2.34 for (int i = 0; i< ver.length; i++) {
3.1 --- a/test/tools/javac/versions/check.sh Sun Nov 04 11:01:49 2012 +0000 3.2 +++ b/test/tools/javac/versions/check.sh Wed Oct 31 10:21:14 2012 -0700 3.3 @@ -1,5 +1,5 @@ 3.4 # 3.5 -# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. 3.6 +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. 3.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.8 # 3.9 # This code is free software; you can redistribute it and/or modify it 3.10 @@ -22,7 +22,7 @@ 3.11 # 3.12 3.13 # @test 3.14 -# @bug 4981566 5028634 5094412 6304984 7025786 7025789 3.15 +# @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112 3.16 # @summary Check interpretation of -target and -source options 3.17 # @build CheckClassFileVersion 3.18 # @run shell check.sh 3.19 @@ -47,32 +47,39 @@ 3.20 "$JC" ${TESTTOOLVMOPTS} -d $TC $* $TC/X.java && "$J" $CFV $TC/X.class $V || exit 2 3.21 } 3.22 3.23 +# check for all combinations of target values 3.24 +check_target() { 3.25 + check $1 -source $2 -target $3 3.26 + check $1 -source $2 -target 1.${3} 3.27 +} 3.28 +# check for all combinations of source and target values 3.29 +check_source_target() { 3.30 + check_target $1 $2 $3 3.31 + check_target $1 1.${2} $3 3.32 +} 3.33 + 3.34 check 48.0 -source 1.4 3.35 3.36 check 49.0 -source 1.4 -target 1.5 3.37 check 49.0 -source 1.5 -target 1.5 3.38 3.39 -check 50.0 -source 1.4 -target 1.6 3.40 -check 50.0 -source 1.5 -target 1.6 3.41 -check 50.0 -source 1.6 -target 1.6 3.42 -check 50.0 -source 1.6 -target 6 3.43 -check 50.0 -source 6 -target 1.6 3.44 -check 50.0 -source 6 -target 6 3.45 +check_target 50.0 1.4 6 3.46 +check_target 50.0 1.5 6 3.47 +check_source_target 50.0 6 6 3.48 3.49 -check 51.0 3.50 -check 51.0 -source 1.5 3.51 -check 51.0 -source 1.6 3.52 -check 51.0 -source 6 3.53 -check 51.0 -source 1.7 3.54 -check 51.0 -source 7 3.55 -check 51.0 -source 7 -target 1.7 3.56 -check 51.0 -source 7 -target 7 3.57 +check_target 51.0 1.4 7 3.58 +check_target 51.0 1.5 7 3.59 +check_source_target 51.0 6 7 3.60 +check_source_target 51.0 7 7 3.61 3.62 -# Update when class file version is revved 3.63 -check 51.0 -source 1.8 3.64 -check 51.0 -source 8 3.65 -check 51.0 -target 1.8 3.66 -check 51.0 -target 8 3.67 +check_target 52.0 1.4 8 3.68 +check_target 52.0 1.5 8 3.69 +check_source_target 52.0 6 8 3.70 +check_source_target 52.0 7 8 3.71 +check_source_target 52.0 8 8 3.72 + 3.73 +# and finally the default with no options 3.74 +check 52.0 3.75 3.76 # Check source versions 3.77