< prev index next >

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

Print this page




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




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


< prev index next >