langtools/test/tools/javac/cast/intersection/IntersectionTypeParserTest.java
changeset 27319 030080f03e4f
parent 22448 a85fbad9d687
child 30730 d3ce7619db2c
equal deleted inserted replaced
27318:4660a5da7d90 27319:030080f03e4f
     1 /*
     1 /*
     2  * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2012, 2014, 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.
   102     }
   102     }
   103 
   103 
   104     public static void main(String... args) throws Exception {
   104     public static void main(String... args) throws Exception {
   105         //create default shared JavaCompiler - reused across multiple compilations
   105         //create default shared JavaCompiler - reused across multiple compilations
   106         JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
   106         JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
   107         StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
   107         try (StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
   108 
   108 
   109         for (CastKind ck : CastKind.values()) {
   109             for (CastKind ck : CastKind.values()) {
   110             for (TypeKind t1 : TypeKind.values()) {
   110                 for (TypeKind t1 : TypeKind.values()) {
   111                 for (ArrayKind ak1 : ArrayKind.values()) {
   111                     for (ArrayKind ak1 : ArrayKind.values()) {
   112                     Type typ1 = new Type(t1, ak1);
   112                         Type typ1 = new Type(t1, ak1);
   113                     if (ck.nBounds == 1) {
   113                         if (ck.nBounds == 1) {
   114                         new IntersectionTypeParserTest(ck, typ1).run(comp, fm);
   114                             new IntersectionTypeParserTest(ck, typ1).run(comp, fm);
   115                         continue;
   115                             continue;
   116                     }
   116                         }
   117                     for (TypeKind t2 : TypeKind.values()) {
   117                         for (TypeKind t2 : TypeKind.values()) {
   118                         for (ArrayKind ak2 : ArrayKind.values()) {
   118                             for (ArrayKind ak2 : ArrayKind.values()) {
   119                             Type typ2 = new Type(t2, ak2);
   119                                 Type typ2 = new Type(t2, ak2);
   120                             if (ck.nBounds == 2) {
   120                                 if (ck.nBounds == 2) {
   121                                 new IntersectionTypeParserTest(ck, typ1, typ2).run(comp, fm);
   121                                     new IntersectionTypeParserTest(ck, typ1, typ2).run(comp, fm);
   122                                 continue;
   122                                     continue;
   123                             }
   123                                 }
   124                             for (TypeKind t3 : TypeKind.values()) {
   124                                 for (TypeKind t3 : TypeKind.values()) {
   125                                 for (ArrayKind ak3 : ArrayKind.values()) {
   125                                     for (ArrayKind ak3 : ArrayKind.values()) {
   126                                     Type typ3 = new Type(t3, ak3);
   126                                         Type typ3 = new Type(t3, ak3);
   127                                     new IntersectionTypeParserTest(ck, typ1, typ2, typ3).run(comp, fm);
   127                                         new IntersectionTypeParserTest(ck, typ1, typ2, typ3).run(comp, fm);
       
   128                                     }
   128                                 }
   129                                 }
   129                             }
   130                             }
   130                         }
   131                         }
   131                     }
   132                     }
   132                 }
   133                 }
   133             }
   134             }
       
   135             System.out.println("Total check executed: " + checkCount);
   134         }
   136         }
   135         System.out.println("Total check executed: " + checkCount);
       
   136     }
   137     }
   137 
   138 
   138     CastKind ck;
   139     CastKind ck;
   139     Type[] types;
   140     Type[] types;
   140     JavaSource source;
   141     JavaSource source;