< prev index next >

test/tools/javac/profiles/ProfileOptionTest.java

Print this page




 131                     JavacTask task = (JavacTask) javac.getTask(sw, fm, null, opts, null,
 132                             Arrays.asList(fo));
 133                     task.analyze();
 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                         if (p == Profile.DEFAULT)
 152                             break;
 153                         if (ise == null)
 154                             error("IllegalStateException not thrown as expected");
 155                         else if (!ise.getMessage().contains("option -profile " +
 156                                 "not allowed with target " + t.name)) {
 157                             error("exception not thrown as expected: " + ise);
 158                         }
 159                         break;
 160                     default:
 161                         if (p == Profile.DEFAULT)
 162                             break;
 163                         if (ise == null)
 164                             error("IllegalStateException not thrown as expected");
 165                         else if (!ise.getMessage().contains("profile " + p.name
 166                                     + " is not valid for target release " + t.name)) {
 167                             error("exception not thrown as expected: " + ise);
 168                         }
 169                         break;
 170                 }




 131                     JavacTask task = (JavacTask) javac.getTask(sw, fm, null, opts, null,
 132                             Arrays.asList(fo));
 133                     task.analyze();
 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                         if (p == Profile.DEFAULT)
 153                             break;
 154                         if (ise == null)
 155                             error("IllegalStateException not thrown as expected");
 156                         else if (!ise.getMessage().contains("option -profile " +
 157                                 "not allowed with target " + t.name)) {
 158                             error("exception not thrown as expected: " + ise);
 159                         }
 160                         break;
 161                     default:
 162                         if (p == Profile.DEFAULT)
 163                             break;
 164                         if (ise == null)
 165                             error("IllegalStateException not thrown as expected");
 166                         else if (!ise.getMessage().contains("profile " + p.name
 167                                     + " is not valid for target release " + t.name)) {
 168                             error("exception not thrown as expected: " + ise);
 169                         }
 170                         break;
 171                 }


< prev index next >