< prev index next >

test/langtools/tools/javac/profiles/ProfileOptionTest.java

Print this page




 136                     ise = e;
 137                 }
 138 
 139                 // sadly, command line errors are not (yet?) reported to
 140                 // the diag listener
 141                 String out = sw.toString();
 142                 if (!out.isEmpty())
 143                     System.err.println(out.trim());
 144 
 145                 switch (t) {
 146                     case JDK1_8:
 147                         if (ise != null)
 148                             error("unexpected exception from compiler: " + ise);
 149                         break;
 150                     case JDK1_9:
 151                     case JDK1_10:
 152                     case JDK1_11:
 153                     case JDK1_12:
 154                     case JDK1_13:
 155                     case JDK1_14:

 156                         if (p == Profile.DEFAULT)
 157                             break;
 158                         if (ise == null)
 159                             error("IllegalStateException not thrown as expected");
 160                         else if (!ise.getMessage().contains("option -profile " +
 161                                 "not allowed with target " + t.name)) {
 162                             error("exception not thrown as expected: " + ise);
 163                         }
 164                         break;
 165                     default:
 166                         if (p == Profile.DEFAULT)
 167                             break;
 168                         if (ise == null)
 169                             error("IllegalStateException not thrown as expected");
 170                         else if (!ise.getMessage().contains("profile " + p.name
 171                                     + " is not valid for target release " + t.name)) {
 172                             error("exception not thrown as expected: " + ise);
 173                         }
 174                         break;
 175                 }




 136                     ise = e;
 137                 }
 138 
 139                 // sadly, command line errors are not (yet?) reported to
 140                 // the diag listener
 141                 String out = sw.toString();
 142                 if (!out.isEmpty())
 143                     System.err.println(out.trim());
 144 
 145                 switch (t) {
 146                     case JDK1_8:
 147                         if (ise != null)
 148                             error("unexpected exception from compiler: " + ise);
 149                         break;
 150                     case JDK1_9:
 151                     case JDK1_10:
 152                     case JDK1_11:
 153                     case JDK1_12:
 154                     case JDK1_13:
 155                     case JDK1_14:
 156                     case JDK1_15:
 157                         if (p == Profile.DEFAULT)
 158                             break;
 159                         if (ise == null)
 160                             error("IllegalStateException not thrown as expected");
 161                         else if (!ise.getMessage().contains("option -profile " +
 162                                 "not allowed with target " + t.name)) {
 163                             error("exception not thrown as expected: " + ise);
 164                         }
 165                         break;
 166                     default:
 167                         if (p == Profile.DEFAULT)
 168                             break;
 169                         if (ise == null)
 170                             error("IllegalStateException not thrown as expected");
 171                         else if (!ise.getMessage().contains("profile " + p.name
 172                                     + " is not valid for target release " + t.name)) {
 173                             error("exception not thrown as expected: " + ise);
 174                         }
 175                         break;
 176                 }


< prev index next >