< prev index next >

test/langtools/tools/javac/versions/Versions.java

Print this page
rev 48342 : imported patch JDK-8173382-release-version
rev 48343 : imported patch JDK-8173382-classfile-version


   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112 8028545 8000961 8030610 8028546 8188870 8173382
  27  * @summary Check interpretation of -target and -source options
  28  * @modules java.compiler
  29  *          jdk.compiler
  30  * @run main Versions
  31  */
  32 
  33 import java.io.*;
  34 import java.nio.*;
  35 import java.nio.channels.*;
  36 
  37 import javax.tools.JavaCompiler;
  38 import javax.tools.ToolProvider;
  39 import javax.tools.JavaFileObject;
  40 import javax.tools.StandardJavaFileManager;
  41 import java.util.List;
  42 import java.util.ArrayList;
  43 import java.util.Arrays;
  44 
  45 
  46 public class Versions {
  47 
  48     protected JavaCompiler javacompiler;
  49     protected int failedCases;
  50 
  51     public Versions() throws IOException {
  52         javacompiler = ToolProvider.getSystemJavaCompiler();
  53         genSourceFiles();
  54         failedCases = 0;
  55     }
  56 
  57     public static void main(String... args) throws IOException {
  58         Versions versions = new Versions();
  59         versions.run();
  60     }
  61 
  62     void run() {
  63 
  64         String TC = "";
  65         System.out.println("Version.java: Starting");
  66 
  67         check("54.0");
  68         check("54.0", "-source 1.6");
  69         check("54.0", "-source 1.7");
  70         check("54.0", "-source 1.8");
  71         check("54.0", "-source 1.9");
  72         check("54.0", "-source 1.10");
  73         check("54.0", "-source 11");
  74 
  75         check_source_target(true, "50.0", "6", "6");
  76         check_source_target(true, "51.0", "6", "7");
  77         check_source_target(true, "51.0", "7", "7");
  78         check_source_target(true, "52.0", "6", "8");
  79         check_source_target(true, "52.0", "7", "8");
  80         check_source_target(true, "52.0", "8", "8");
  81         check_source_target(true, "53.0", "6", "9");
  82         check_source_target(true, "53.0", "7", "9");
  83         check_source_target(true, "53.0", "8", "9");
  84         check_source_target(true, "53.0", "9", "9");
  85         check_source_target(true, "54.0", "6", "10");
  86         check_source_target(true, "54.0", "7", "10");
  87         check_source_target(true, "54.0", "8", "10");
  88         check_source_target(true, "54.0", "9", "10");
  89         check_source_target(true, "54.0", "10", "10");
  90         check_source_target(false, "54.0", "11", "11");





  91 
  92         checksrc16("-source 1.6");
  93         checksrc16("-source 6");
  94         checksrc16("-source 1.6", "-target 1.6");
  95         checksrc16("-source 6", "-target 6");
  96         checksrc17("-source 1.7");
  97         checksrc17("-source 7");
  98         checksrc17("-source 1.7", "-target 1.7");
  99         checksrc17("-source 7", "-target 7");
 100         checksrc18("-source 1.8");
 101         checksrc18("-source 8");
 102         checksrc18("-source 1.8", "-target 1.8");
 103         checksrc18("-source 8", "-target 8");
 104         checksrc19("-source 1.9");
 105         checksrc19("-source 9");
 106         checksrc19("-source 1.9", "-target 1.9");
 107         checksrc19("-source 9", "-target 9");
 108         checksrc110();
 109         checksrc110("-source 1.10");
 110         checksrc110("-source 10");




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112 8028545 8000961 8030610 8028546 8188870 8173382 8173382
  27  * @summary Check interpretation of -target and -source options
  28  * @modules java.compiler
  29  *          jdk.compiler
  30  * @run main Versions
  31  */
  32 
  33 import java.io.*;
  34 import java.nio.*;
  35 import java.nio.channels.*;
  36 
  37 import javax.tools.JavaCompiler;
  38 import javax.tools.ToolProvider;
  39 import javax.tools.JavaFileObject;
  40 import javax.tools.StandardJavaFileManager;
  41 import java.util.List;
  42 import java.util.ArrayList;
  43 import java.util.Arrays;
  44 
  45 
  46 public class Versions {
  47 
  48     protected JavaCompiler javacompiler;
  49     protected int failedCases;
  50 
  51     public Versions() throws IOException {
  52         javacompiler = ToolProvider.getSystemJavaCompiler();
  53         genSourceFiles();
  54         failedCases = 0;
  55     }
  56 
  57     public static void main(String... args) throws IOException {
  58         Versions versions = new Versions();
  59         versions.run();
  60     }
  61 
  62     void run() {
  63 
  64         String TC = "";
  65         System.out.println("Version.java: Starting");
  66 
  67         check("55.0");
  68         check("55.0", "-source 1.6");
  69         check("55.0", "-source 1.7");
  70         check("55.0", "-source 1.8");
  71         check("55.0", "-source 1.9");
  72         check("55.0", "-source 1.10");
  73         check("55.0", "-source 11");
  74 
  75         check_source_target(true, "50.0", "6", "6");
  76         check_source_target(true, "51.0", "6", "7");
  77         check_source_target(true, "51.0", "7", "7");
  78         check_source_target(true, "52.0", "6", "8");
  79         check_source_target(true, "52.0", "7", "8");
  80         check_source_target(true, "52.0", "8", "8");
  81         check_source_target(true, "53.0", "6", "9");
  82         check_source_target(true, "53.0", "7", "9");
  83         check_source_target(true, "53.0", "8", "9");
  84         check_source_target(true, "53.0", "9", "9");
  85         check_source_target(true, "54.0", "6", "10");
  86         check_source_target(true, "54.0", "7", "10");
  87         check_source_target(true, "54.0", "8", "10");
  88         check_source_target(true, "54.0", "9", "10");
  89         check_source_target(true, "54.0", "10", "10");
  90         check_source_target(false, "55.0", "6", "11");
  91         check_source_target(false, "55.0", "7", "11");
  92         check_source_target(false, "55.0", "8", "11");
  93         check_source_target(false, "55.0", "9", "11");
  94         check_source_target(false, "55.0", "10", "11");
  95         check_source_target(false, "55.0", "11", "11");
  96 
  97         checksrc16("-source 1.6");
  98         checksrc16("-source 6");
  99         checksrc16("-source 1.6", "-target 1.6");
 100         checksrc16("-source 6", "-target 6");
 101         checksrc17("-source 1.7");
 102         checksrc17("-source 7");
 103         checksrc17("-source 1.7", "-target 1.7");
 104         checksrc17("-source 7", "-target 7");
 105         checksrc18("-source 1.8");
 106         checksrc18("-source 8");
 107         checksrc18("-source 1.8", "-target 1.8");
 108         checksrc18("-source 8", "-target 8");
 109         checksrc19("-source 1.9");
 110         checksrc19("-source 9");
 111         checksrc19("-source 1.9", "-target 1.9");
 112         checksrc19("-source 9", "-target 9");
 113         checksrc110();
 114         checksrc110("-source 1.10");
 115         checksrc110("-source 10");


< prev index next >