test/langtools/tools/javac/classfiles/ClassVersionChecker.java
changeset 50892 a5557f24b4d4
parent 48355 4944950606ef
child 50935 dfd59db382c6
equal deleted inserted replaced
50891:9948ea5ea1af 50892:a5557f24b4d4
     1 /*
     1 /*
     2  * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 7157626 8001112 8188870 8173382
    26  * @bug 7157626 8001112 8188870 8173382 8193290 8205619
    27  * @summary Test major version for all legal combinations for -source and -target
    27  * @summary Test major version for all legal combinations for -source and -target
    28  * @author sgoel
    28  * @author sgoel
    29  *
    29  *
    30  * @modules jdk.compiler
    30  * @modules jdk.compiler
    31  */
    31  */
    36 import java.util.regex.*;
    36 import java.util.regex.*;
    37 
    37 
    38 public class ClassVersionChecker {
    38 public class ClassVersionChecker {
    39 
    39 
    40     int errors;
    40     int errors;
    41     String[] jdk = {"", "1.6", "1.7", "1.8", "1.9", "1.10", "11"};
    41     String[] jdk = {"", "1.6", "1.7", "1.8", "1.9", "1.10", "11", "12"};
    42     File javaFile = null;
    42     File javaFile = null;
    43 
    43 
    44     public static void main(String[] args) throws Throwable {
    44     public static void main(String[] args) throws Throwable {
    45         new ClassVersionChecker().run();
    45         new ClassVersionChecker().run();
    46     }
    46     }
    56         /* -source (0=>empty,1=>1.2,...) X -target (0=>empty,1=>1.2,...)
    56         /* -source (0=>empty,1=>1.2,...) X -target (0=>empty,1=>1.2,...)
    57          * ver[0][0] => no -source or -target was given
    57          * ver[0][0] => no -source or -target was given
    58          * -1 => invalid combinations
    58          * -1 => invalid combinations
    59          */
    59          */
    60         int[][] ver =
    60         int[][] ver =
    61                 {{55, -1, -1, -1, -1, -1, -1},
    61             {{56, -1, -1, -1, -1, -1, -1, -1},
    62                  {55, 50, 51, 52, 53, 54, 55},
    62              {56, 50, 51, 52, 53, 54, 55, 56},
    63                  {55, -1, 51, 52, 53, 54, 55},
    63              {56, -1, 51, 52, 53, 54, 55, 56},
    64                  {55, -1, -1, 52, 53, 54, 55},
    64              {56, -1, -1, 52, 53, 54, 55, 56},
    65                  {55, -1, -1, -1, 53, 54, 55},
    65              {56, -1, -1, -1, 53, 54, 55, 56},
    66                  {55, -1, -1, -1, -1, 54, 55}};
    66              {56, -1, -1, -1, -1, 54, 55, 56}};
    67 
    67 
    68         // Loop to run all possible combinations of source/target values
    68         // Loop to run all possible combinations of source/target values
    69         for (int i = 0; i< ver.length; i++) {
    69         for (int i = 0; i< ver.length; i++) {
    70             for (int j = 0 ; j< ver[i].length; j++) {
    70             for (int j = 0 ; j< ver[i].length; j++) {
    71                 if(ver[i][j] != -1) {
    71                 if(ver[i][j] != -1) {