8001112: Make -target 8 in javac generate version 52.0 classfile
authorksrini
Wed, 31 Oct 2012 10:21:14 -0700
changeset 14445 835eb1433d39
parent 14444 2069262b27c5
child 14446 88145bb2ddcd
8001112: Make -target 8 in javac generate version 52.0 classfile Reviewed-by: darcy, jjg
langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java
langtools/test/tools/javac/classfiles/ClassVersionChecker.java
langtools/test/tools/javac/versions/check.sh
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java	Sun Nov 04 11:01:49 2012 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java	Wed Oct 31 10:21:14 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,8 +68,8 @@
     /** JDK 7. */
     JDK1_7("1.7", 51, 0),
 
-    /** JDK 8. */ // For now, a clone of 7
-    JDK1_8("1.8", 51, 0);
+    /** JDK 8. */
+    JDK1_8("1.8", 52, 0);
 
     private static final Context.Key<Target> targetKey =
         new Context.Key<Target>();
--- a/langtools/test/tools/javac/classfiles/ClassVersionChecker.java	Sun Nov 04 11:01:49 2012 +0000
+++ b/langtools/test/tools/javac/classfiles/ClassVersionChecker.java	Wed Oct 31 10:21:14 2012 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7157626
+ * @bug 7157626 8001112
  * @summary Test major version for all legal combinations for -source and -target
  * @author sgoel
  *
@@ -57,14 +57,14 @@
          * -1 => invalid combinations
          */
         int[][] ver =
-                {{51, -1, -1, -1, -1, -1, -1, -1},
-                 {48, 46, 47, 48, 49, 50, 51, 51},
-                 {48, 46, 47, 48, 49, 50, 51, 51},
-                 {48, -1, -1, 48, 49, 50, 51, 51},
-                 {51, -1, -1, -1, 49, 50, 51, 51},
-                 {51, -1, -1, -1, -1, 50, 51, 51},
-                 {51, -1, -1, -1, -1, -1, 51, 51},
-                 {51, -1, -1, -1, -1, -1, -1, 51}};
+                {{52, -1, -1, -1, -1, -1, -1, -1},
+                 {48, 46, 47, 48, 49, 50, 51, 52},
+                 {48, 46, 47, 48, 49, 50, 51, 52},
+                 {48, -1, -1, 48, 49, 50, 51, 52},
+                 {52, -1, -1, -1, 49, 50, 51, 52},
+                 {52, -1, -1, -1, -1, 50, 51, 52},
+                 {52, -1, -1, -1, -1, -1, 51, 52},
+                 {52, -1, -1, -1, -1, -1, -1, 52}};
 
         // Loop to run all possible combinations of source/target values
         for (int i = 0; i< ver.length; i++) {
--- a/langtools/test/tools/javac/versions/check.sh	Sun Nov 04 11:01:49 2012 +0000
+++ b/langtools/test/tools/javac/versions/check.sh	Wed Oct 31 10:21:14 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
 #
 
 # @test
-# @bug 4981566 5028634 5094412 6304984 7025786 7025789
+# @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112
 # @summary Check interpretation of -target and -source options
 # @build CheckClassFileVersion
 # @run shell check.sh 
@@ -47,32 +47,39 @@
   "$JC" ${TESTTOOLVMOPTS} -d $TC $* $TC/X.java && "$J" $CFV $TC/X.class $V || exit 2
 }
 
+# check for all combinations of target values
+check_target() {
+  check $1 -source $2 -target $3
+  check $1 -source $2 -target 1.${3}
+}
+# check for all combinations of source and target values
+check_source_target() {
+  check_target $1 $2     $3
+  check_target $1 1.${2} $3
+}
+
 check 48.0 -source 1.4
 
 check 49.0 -source 1.4 -target 1.5
 check 49.0 -source 1.5 -target 1.5
 
-check 50.0 -source 1.4 -target 1.6
-check 50.0 -source 1.5 -target 1.6
-check 50.0 -source 1.6 -target 1.6
-check 50.0 -source 1.6 -target 6
-check 50.0 -source 6 -target 1.6
-check 50.0 -source 6 -target 6
+check_target        50.0 1.4 6
+check_target        50.0 1.5 6
+check_source_target 50.0 6   6
+
+check_target        51.0 1.4 7
+check_target        51.0 1.5 7
+check_source_target 51.0 6   7
+check_source_target 51.0 7   7
 
-check 51.0
-check 51.0 -source 1.5
-check 51.0 -source 1.6
-check 51.0 -source 6
-check 51.0 -source 1.7
-check 51.0 -source 7
-check 51.0 -source 7 -target 1.7
-check 51.0 -source 7 -target 7
+check_target        52.0 1.4 8
+check_target        52.0 1.5 8
+check_source_target 52.0 6   8
+check_source_target 52.0 7   8
+check_source_target 52.0 8   8
 
-# Update when class file version is revved
-check 51.0 -source 1.8
-check 51.0 -source 8
-check 51.0 -target 1.8
-check 51.0 -target 8
+# and finally the default with no options
+check 52.0
 
 # Check source versions