< prev index next >

test/langtools/tools/javac/switchexpr/TryCatchFinally.java

Print this page
rev 56806 : 8232684: Make switch expressions final
Reviewed-by: TBD


   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 8220018
  27  * @summary Verify that try-catch-finally inside a switch expression works properly.
  28  * @compile --enable-preview -source ${jdk.version} TryCatchFinally.java
  29  * @run main/othervm --enable-preview TryCatchFinally
  30  */
  31 public class TryCatchFinally {//TODO: yield <double>
  32     public static void main(String[] args) {
  33         for (int p1 = 0; p1 < 2; p1++) {
  34             for (int p2 = 0; p2 < 2; p2++) {
  35                 for (int p3 = 0; p3 < 2; p3++) {
  36                     for (int p4 = 0; p4 < 2; p4++) {
  37                         for (int p5 = 0; p5 < 2; p5++) {
  38                             for (int p6 = 0; p6 < 3; p6++) {
  39                                 int actual = runSwitchesOrdinary(p1, p2, p3, p4, p5, p6);
  40                                 int expected = computeExpectedOrdinary(p1, p2, p3, p4, p5, p6);
  41                                 if (actual != expected) {
  42                                     throw new IllegalStateException("actual=" + actual + "; " +
  43                                                                     "expected=" + expected + ", parameters: " + p1 + ", " + p2 + ", " + p3 + ", " + p4 + ", " + p5 + ", " + p6 + ", ");
  44                                 }
  45                             }
  46                         }
  47                     }
  48                 }
  49             }




   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 8220018
  27  * @summary Verify that try-catch-finally inside a switch expression works properly.
  28  * @compile TryCatchFinally.java
  29  * @run main TryCatchFinally
  30  */
  31 public class TryCatchFinally {//TODO: yield <double>
  32     public static void main(String[] args) {
  33         for (int p1 = 0; p1 < 2; p1++) {
  34             for (int p2 = 0; p2 < 2; p2++) {
  35                 for (int p3 = 0; p3 < 2; p3++) {
  36                     for (int p4 = 0; p4 < 2; p4++) {
  37                         for (int p5 = 0; p5 < 2; p5++) {
  38                             for (int p6 = 0; p6 < 3; p6++) {
  39                                 int actual = runSwitchesOrdinary(p1, p2, p3, p4, p5, p6);
  40                                 int expected = computeExpectedOrdinary(p1, p2, p3, p4, p5, p6);
  41                                 if (actual != expected) {
  42                                     throw new IllegalStateException("actual=" + actual + "; " +
  43                                                                     "expected=" + expected + ", parameters: " + p1 + ", " + p2 + ", " + p3 + ", " + p4 + ", " + p5 + ", " + p6 + ", ");
  44                                 }
  45                             }
  46                         }
  47                     }
  48                 }
  49             }


< prev index next >