Coverage Report - com.sun.tools.javafx.main.RecognizedOptions
 
Classes in this File Line Coverage Branch Coverage Complexity
RecognizedOptions
85%
11/13
100%
4/4
0
RecognizedOptions$1
33%
1/3
N/A
0
RecognizedOptions$10
50%
1/2
N/A
0
RecognizedOptions$11
29%
2/7
33%
2/6
0
RecognizedOptions$12
33%
2/6
50%
2/4
0
RecognizedOptions$13
17%
1/6
0%
0/2
0
RecognizedOptions$14
67%
4/6
50%
1/2
0
RecognizedOptions$15
100%
1/1
N/A
0
RecognizedOptions$16
33%
1/3
N/A
0
RecognizedOptions$17
33%
1/3
N/A
0
RecognizedOptions$18
33%
1/3
N/A
0
RecognizedOptions$19
33%
1/3
N/A
0
RecognizedOptions$2
20%
2/10
0%
0/2
0
RecognizedOptions$20
25%
1/4
N/A
0
RecognizedOptions$21
33%
1/3
N/A
0
RecognizedOptions$22
33%
1/3
N/A
0
RecognizedOptions$23
14%
1/7
N/A
0
RecognizedOptions$24
33%
2/6
50%
2/4
0
RecognizedOptions$25
100%
9/9
50%
2/4
0
RecognizedOptions$26
67%
10/15
50%
3/6
0
RecognizedOptions$3
100%
10/10
100%
2/2
0
RecognizedOptions$4
33%
1/3
N/A
0
RecognizedOptions$5
100%
3/3
N/A
0
RecognizedOptions$6
100%
2/2
N/A
0
RecognizedOptions$7
25%
1/4
N/A
0
RecognizedOptions$8
25%
1/4
N/A
0
RecognizedOptions$9
50%
1/2
N/A
0
RecognizedOptions$GrumpyHelper
11%
1/9
N/A
0
RecognizedOptions$OptionHelper
N/A
N/A
0
 
 1  
 /*
 2  
  * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
 3  
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 4  
  *
 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
 7  
  * published by the Free Software Foundation.  Sun designates this
 8  
  * particular file as subject to the "Classpath" exception as provided
 9  
  * by Sun in the LICENSE file that accompanied this code.
 10  
  *
 11  
  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  
  * version 2 for more details (a copy is included in the LICENSE file that
 15  
  * accompanied this code).
 16  
  *
 17  
  * You should have received a copy of the GNU General Public License version
 18  
  * 2 along with this work; if not, write to the Free Software Foundation,
 19  
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  
  *
 21  
  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
 22  
  * CA 95054 USA or visit www.sun.com if you need additional information or
 23  
  * have any questions.
 24  
  */
 25  
 
 26  
 package com.sun.tools.javafx.main;
 27  
 
 28  
 import com.sun.tools.javac.code.Source;
 29  
 import com.sun.tools.javac.code.Type;
 30  
 import com.sun.tools.javac.jvm.Target;
 31  
 import com.sun.tools.javafx.main.JavafxOption.HiddenOption;
 32  
 import com.sun.tools.javafx.main.JavafxOption.Option;
 33  
 import com.sun.tools.javafx.main.JavafxOption.XOption;
 34  
 import com.sun.tools.javafx.util.MsgSym;
 35  
 import com.sun.tools.javac.util.List;
 36  
 import com.sun.tools.javac.util.ListBuffer;
 37  
 import com.sun.tools.javac.util.Log;
 38  
 import com.sun.tools.javac.util.Options;
 39  
 import java.io.File;
 40  
 import java.io.FileWriter;
 41  
 import java.io.PrintWriter;
 42  
 import java.util.EnumSet;
 43  
 import java.util.Set;
 44  
 import java.util.StringTokenizer;
 45  
 import javax.lang.model.SourceVersion;
 46  
 import static com.sun.tools.javafx.main.OptionName.*;
 47  
 
 48  
 /**
 49  
  * TODO: describe com.sun.tools.javac.main.RecognizedOptions
 50  
  *
 51  
  * <p><b>This is NOT part of any API supported by Sun Microsystems.
 52  
  * If you write code that depends on this, you do so at your own
 53  
  * risk.  This code and its internal interfaces are subject to change
 54  
  * or deletion without notice.</b></p>
 55  
  */
 56  
 public class RecognizedOptions {
 57  
     
 58  0
     private RecognizedOptions() {}
 59  
 
 60  
     public interface OptionHelper {
 61  
 
 62  
         void setOut(PrintWriter out);
 63  
 
 64  
         void error(String key, Object... args);
 65  
 
 66  
         void printVersion();
 67  
 
 68  
         void printFullVersion();
 69  
 
 70  
         void printHelp();
 71  
 
 72  
         void printXhelp();
 73  
 
 74  
         void addFile(File f);
 75  
 
 76  
         void addClassName(String s);
 77  
 
 78  
     }
 79  
 
 80  33
     public static class GrumpyHelper implements OptionHelper {
 81  
         
 82  
         public void setOut(PrintWriter out) {
 83  0
             throw new IllegalArgumentException();
 84  
         }
 85  
         
 86  
         public void error(String key, Object... args) {
 87  0
             throw new IllegalArgumentException(Main.getLocalizedString(key, args));
 88  
         }
 89  
         
 90  
         public void printVersion() {
 91  0
             throw new IllegalArgumentException();
 92  
         }
 93  
         
 94  
         public void printFullVersion() {
 95  0
             throw new IllegalArgumentException();
 96  
         }
 97  
         
 98  
         public void printHelp() {
 99  0
             throw new IllegalArgumentException();
 100  
         }
 101  
         
 102  
         public void printXhelp() {
 103  0
             throw new IllegalArgumentException();
 104  
         }
 105  
         
 106  
         public void addFile(File f) {
 107  0
             throw new IllegalArgumentException(f.getPath());
 108  
         }
 109  
         
 110  
         public void addClassName(String s) {
 111  0
             throw new IllegalArgumentException(s);
 112  
         }
 113  
         
 114  
     }
 115  
 
 116  12
     static Set<OptionName> javafxcOptions = EnumSet.of(
 117  
         G,
 118  
         G_NONE,
 119  
         G_CUSTOM,
 120  
         XLINT,
 121  
         XLINT_CUSTOM,
 122  
         NOWARN,
 123  
         VERBOSE,
 124  
         DEPRECATION,
 125  
         CLASSPATH,
 126  
         CP,
 127  
         SOURCEPATH,
 128  
         BOOTCLASSPATH,
 129  
         XBOOTCLASSPATH_PREPEND,
 130  
         XBOOTCLASSPATH_APPEND,
 131  
         XBOOTCLASSPATH,
 132  
         EXTDIRS,
 133  
         DJAVA_EXT_DIRS,
 134  
         ENDORSEDDIRS,
 135  
         DJAVA_ENDORSED_DIRS,
 136  
         PROC_CUSTOM,
 137  
         PROCESSOR,
 138  
         PROCESSORPATH,
 139  
         D,
 140  
         S,
 141  
         IMPLICIT,
 142  
         ENCODING,
 143  
         SOURCE,
 144  
         TARGET,
 145  
         PLATFORM,
 146  
         VERSION,
 147  
         FULLVERSION,
 148  
         HELP,
 149  
         A,
 150  
         X,
 151  
         J,
 152  
         MOREINFO,
 153  
         WERROR,
 154  
         // COMPLEXINFERENCE,
 155  
         PROMPT,
 156  
         DOE,
 157  
         PRINTSOURCE,
 158  
         WARNUNCHECKED,
 159  
         XMAXERRS,
 160  
         XMAXWARNS,
 161  
         XSTDOUT,
 162  
         XPRINT,
 163  
         XPRINTROUNDS,
 164  
         XPRINTPROCESSORINFO,
 165  
         XPREFER,
 166  
         O,
 167  
         XJCOV,
 168  
         XD,
 169  
         DUMPJAVA,
 170  
         DUMPFX,
 171  
         SOURCEFILE);
 172  
 
 173  12
     static Set<OptionName> javacFileManagerOptions = EnumSet.of(
 174  
         CLASSPATH,
 175  
         CP,
 176  
         SOURCEPATH,
 177  
         BOOTCLASSPATH,
 178  
         XBOOTCLASSPATH_PREPEND,
 179  
         XBOOTCLASSPATH_APPEND,
 180  
         XBOOTCLASSPATH,
 181  
         EXTDIRS,
 182  
         DJAVA_EXT_DIRS,
 183  
         ENDORSEDDIRS,
 184  
         DJAVA_ENDORSED_DIRS,
 185  
         PROCESSORPATH,
 186  
         D,
 187  
         S,
 188  
         ENCODING,
 189  
         SOURCE);
 190  
 
 191  12
     static Set<OptionName> javacToolOptions = EnumSet.of(
 192  
         G,
 193  
         G_NONE,
 194  
         G_CUSTOM,
 195  
         XLINT,
 196  
         XLINT_CUSTOM,
 197  
         NOWARN,
 198  
         VERBOSE,
 199  
         DEPRECATION,
 200  
         PROC_CUSTOM,
 201  
         PROCESSOR,
 202  
         IMPLICIT,
 203  
         SOURCE,
 204  
         TARGET,
 205  
         // VERSION,
 206  
         // FULLVERSION,
 207  
         // HELP,
 208  
         A,
 209  
         // X,
 210  
         // J,
 211  
         MOREINFO,
 212  
         WERROR,
 213  
         // COMPLEXINFERENCE,
 214  
         PROMPT,
 215  
         DOE,
 216  
         PRINTSOURCE,
 217  
         WARNUNCHECKED,
 218  
         XMAXERRS,
 219  
         XMAXWARNS,
 220  
         // XSTDOUT,
 221  
         XPRINT,
 222  
         XPRINTROUNDS,
 223  
         XPRINTPROCESSORINFO,
 224  
         XPREFER,
 225  
         O,
 226  
         XJCOV,
 227  
         XD);
 228  
 
 229  
     static Option[] getJavaCompilerOptions(OptionHelper helper) {
 230  459
         return getOptions(helper, javafxcOptions);
 231  
     }
 232  
 
 233  
     public static Option[] getJavacFileManagerOptions(OptionHelper helper) {
 234  0
         return getOptions(helper, javacFileManagerOptions);
 235  
     }
 236  
 
 237  
     public static Option[] getJavacToolOptions(OptionHelper helper) {
 238  33
         return getOptions(helper, javacToolOptions);
 239  
     }
 240  
 
 241  
     static Option[] getOptions(OptionHelper helper, Set<OptionName> desired) {
 242  492
         ListBuffer<Option> options = new ListBuffer<Option>();
 243  27060
         for (Option option : getAll(helper))
 244  26568
             if (desired.contains(option.getName()))
 245  25251
                 options.append(option);
 246  492
         return options.toArray(new Option[options.length()]);
 247  
     }
 248  
     
 249  
     /**
 250  
      * @param out the writer to use for diagnostic output
 251  
      */
 252  
     public static Option[] getAll(final OptionHelper helper) {
 253  492
         return new Option[]{
 254  
         new Option(G,                       MsgSym.MESSAGE_OPT_G),
 255  492
         new Option(G_NONE,                                        MsgSym.MESSAGE_OPT_G_NONE) {
 256  
         @Override
 257  
             public boolean process(Options options, String option) {
 258  0
                 options.put("-g:", "none");
 259  0
                 return false;
 260  
             }
 261  
         },
 262  
 
 263  492
         new Option(G_CUSTOM,                MsgSym.MESSAGE_OPT_G_LINES_VARS_SOURCE) {
 264  
         @Override
 265  
             public boolean matches(String s) {
 266  1345
                 return s.startsWith("-g:");
 267  
             }
 268  
         @Override
 269  
             public boolean process(Options options, String option) {
 270  0
                 String suboptions = option.substring(3);
 271  0
                 options.put("-g:", suboptions);
 272  
                 // enter all the -g suboptions as "-g:suboption"
 273  0
                 for (StringTokenizer t = new StringTokenizer(suboptions, ","); t.hasMoreTokens(); ) {
 274  0
                     String tok = t.nextToken();
 275  0
                     String opt = "-g:" + tok;
 276  0
                     options.put(opt, opt);
 277  0
                 }
 278  0
                 return false;
 279  
             }
 280  
         },
 281  
 
 282  
         new XOption(XLINT,                  MsgSym.MESSAGE_OPT_XLINT),
 283  492
         new XOption(XLINT_CUSTOM,           MsgSym.MESSAGE_OPT_XLINT_SUBOPTLIST) {
 284  
         @Override
 285  
             public boolean matches(String s) {
 286  1345
                 return s.startsWith("-Xlint:");
 287  
             }
 288  
         @Override
 289  
             public boolean process(Options options, String option) {
 290  58
                 String suboptions = option.substring(7);
 291  58
                 options.put("-Xlint:", suboptions);
 292  
                 // enter all the -Xlint suboptions as "-Xlint:suboption"
 293  58
                 for (StringTokenizer t = new StringTokenizer(suboptions, ","); t.hasMoreTokens(); ) {
 294  58
                     String tok = t.nextToken();
 295  58
                     String opt = "-Xlint:" + tok;
 296  58
                     options.put(opt, opt);
 297  58
                 }
 298  58
                 return false;
 299  
             }
 300  
         },
 301  
 
 302  
         // -nowarn is retained for command-line backward compatibility
 303  492
         new Option(NOWARN,                                        MsgSym.MESSAGE_OPT_NOWARN) {
 304  
         @Override
 305  
                 public boolean process(Options options, String option) {
 306  0
                     options.put("-Xlint:none", option);
 307  0
                     return false;
 308  
                 }
 309  
             },
 310  
 
 311  
         new Option(VERBOSE,                                        MsgSym.MESSAGE_OPT_VERBOSE),
 312  
 
 313  
         // -deprecation is retained for command-line backward compatibility
 314  492
         new Option(DEPRECATION,             MsgSym.MESSAGE_OPT_DEPRECATION) {
 315  
         @Override
 316  
                 public boolean process(Options options, String option) {
 317  58
                     options.put("-Xlint:deprecation", option);
 318  58
                     return false;
 319  
                 }
 320  
             },
 321  
 
 322  
         new Option(CLASSPATH,               MsgSym.MESSAGE_OPT_ARG_PATH,        MsgSym.MESSAGE_OPT_CLASSPATH),
 323  492
         new Option(CP,                      MsgSym.MESSAGE_OPT_ARG_PATH,        MsgSym.MESSAGE_OPT_CLASSPATH) {
 324  
         @Override
 325  
             public boolean process(Options options, String option, String arg) {
 326  350
                 return super.process(options, "-classpath", arg);
 327  
             }
 328  
         },
 329  
         new Option(SOURCEPATH,              MsgSym.MESSAGE_OPT_ARG_PATH,        MsgSym.MESSAGE_OPT_SOURCEPATH),
 330  492
         new Option(BOOTCLASSPATH,           MsgSym.MESSAGE_OPT_ARG_PATH,        MsgSym.MESSAGE_OPT_BOOTCLASSPATH) {
 331  
         @Override
 332  
             public boolean process(Options options, String option, String arg) {
 333  0
                  options.remove("-Xbootclasspath/p:");
 334  0
                  options.remove("-Xbootclasspath/a:");
 335  0
                 return super.process(options, option, arg);
 336  
             }
 337  
         },
 338  
         new XOption(XBOOTCLASSPATH_PREPEND,MsgSym.MESSAGE_OPT_ARG_PATH, MsgSym.MESSAGE_OPT_XBOOTCLASSPATH_P),
 339  
         new XOption(XBOOTCLASSPATH_APPEND, MsgSym.MESSAGE_OPT_ARG_PATH, MsgSym.MESSAGE_OPT_XBOOTCLASSPATH_A),
 340  492
         new XOption(XBOOTCLASSPATH,        MsgSym.MESSAGE_OPT_ARG_PATH, MsgSym.MESSAGE_OPT_BOOTCLASSPATH) {
 341  
         @Override
 342  
             public boolean process(Options options, String option, String arg) {
 343  0
                  options.remove("-Xbootclasspath/p:");
 344  0
                  options.remove("-Xbootclasspath/a:");
 345  0
                  return super.process(options, "-bootclasspath", arg);
 346  
             }
 347  
         },
 348  
         new Option(EXTDIRS,                 MsgSym.MESSAGE_OPT_ARG_DIRS,        MsgSym.MESSAGE_OPT_EXTDIRS),
 349  492
         new XOption(DJAVA_EXT_DIRS,         MsgSym.MESSAGE_OPT_ARG_DIRS,        MsgSym.MESSAGE_OPT_EXTDIRS) {
 350  
         @Override
 351  
             public boolean process(Options options, String option, String arg) {
 352  0
                  return super.process(options, "-extdirs", arg);
 353  
             }
 354  
         },
 355  
         new Option(ENDORSEDDIRS,            MsgSym.MESSAGE_OPT_ARG_DIRS,        MsgSym.MESSAGE_OPT_ENDORSEDDIRS),
 356  492
         new XOption(DJAVA_ENDORSED_DIRS,    MsgSym.MESSAGE_OPT_ARG_DIRS,        MsgSym.MESSAGE_OPT_ENDORSEDDIRS) {
 357  
         @Override
 358  
             public boolean process(Options options, String option, String arg) {
 359  0
                  return super.process(options, "-endorseddirs", arg);
 360  
             }
 361  
         },
 362  492
         new Option(PROC_CUSTOM,             MsgSym.MESSAGE_OPT_PROC_NONE_ONLY) {
 363  
         @Override
 364  
             public boolean matches(String s) {
 365  849
                 return s.equals("-proc:none") || s.equals("-proc:only");
 366  
             }
 367  
 
 368  
         @Override
 369  
             public boolean process(Options options, String option) {
 370  0
                 if (option.equals("-proc:none")) {
 371  0
                     options.remove("-proc:only");
 372  
                 } else {
 373  0
                     options.remove("-proc:none");
 374  
                 }
 375  0
                 options.put(option, option);
 376  0
                 return false;
 377  
             }
 378  
         },
 379  
         new Option(PROCESSOR,           MsgSym.MESSAGE_OPT_ARG_CLASS_LIST,        MsgSym.MESSAGE_OPT_PROCESSOR),
 380  
         new Option(PROCESSORPATH,       MsgSym.MESSAGE_OPT_ARG_PATH,                MsgSym.MESSAGE_OPT_PROCESSORPATH),
 381  
         new Option(D,                   MsgSym.MESSAGE_OPT_ARG_DIRECTORY,        MsgSym.MESSAGE_OPT_D),
 382  
         new Option(S,                   MsgSym.MESSAGE_OPT_ARG_DIRECTORY,        MsgSym.MESSAGE_OPT_SOURCE_DEST),
 383  
         //new Option(IMPLICIT,                                    "opt.implicit") {
 384  492
         new HiddenOption(IMPLICIT) {
 385  
             @Override
 386  
             public boolean matches(String s) {
 387  498
                 return s.equals("-implicit:none") || s.equals("-implicit:class");
 388  
             }
 389  
             @Override
 390  
             public boolean process(Options options, String option, String operand) {
 391  0
                 int sep = option.indexOf(":");
 392  0
                 options.put(option.substring(0, sep), option.substring(sep+1));
 393  0
                 options.put(option,option);
 394  0
                 return false;
 395  
             }
 396  
         },
 397  
         new Option(ENCODING,            MsgSym.MESSAGE_OPT_ARG_ENCODING,        MsgSym.MESSAGE_OPT_ENCODING),
 398  492
         new Option(SOURCE,              MsgSym.MESSAGE_OPT_ARG_RELEASE,     MsgSym.MESSAGE_OPT_SOURCE) {
 399  
         @Override
 400  
             public boolean process(Options options, String option, String operand) {
 401  0
                 Source source = Source.lookup(operand);
 402  0
                 if (source == null) {
 403  0
                     helper.error(MsgSym.MESSAGE_ERR_INVALID_SOURCE, operand);
 404  0
                     return true;
 405  
                 }
 406  0
                 return super.process(options, option, operand);
 407  
             }
 408  
         },
 409  492
         new Option(TARGET,              MsgSym.MESSAGE_OPT_ARG_RELEASE,        MsgSym.MESSAGE_OPT_TARGET) {
 410  
         @Override
 411  
             public boolean process(Options options, String option, String operand) {
 412  408
                 Target target = Target.lookup(operand);
 413  408
                 if (target == null) {
 414  0
                     helper.error(MsgSym.MESSAGE_ERR_INVALID_TARGET, operand);
 415  0
                     return true;
 416  
                 }
 417  408
                 return super.process(options, option, operand);
 418  
             }
 419  
         },
 420  492
         new JavafxOption.FXOption(PLATFORM,        MsgSym.MESSAGE_JAVAFX_OPT_ARG_NAME,        MsgSym.MESSAGE_JAVAFX_OPT_PLATFORM) {
 421  
         },
 422  492
         new Option(VERSION,                                        MsgSym.MESSAGE_OPT_VERSION) {
 423  
         @Override
 424  
             public boolean process(Options options, String option) {
 425  0
                 helper.printVersion();
 426  0
                 return super.process(options, option);
 427  
             }
 428  
         },
 429  492
         new HiddenOption(FULLVERSION) {
 430  
         @Override
 431  
             public boolean process(Options options, String option) {
 432  0
                 helper.printFullVersion();
 433  0
                 return super.process(options, option);
 434  
             }
 435  
         },
 436  492
         new Option(HELP,                                        MsgSym.MESSAGE_OPT_HELP) {
 437  
         @Override
 438  
             public boolean process(Options options, String option) {
 439  0
             helper.printHelp();
 440  0
             return super.process(options, option);
 441  
             }
 442  
         },
 443  492
         new Option(X,                                           MsgSym.MESSAGE_OPT_X) {
 444  
         @Override
 445  
             public boolean process(Options options, String option) {
 446  0
             helper.printXhelp();
 447  0
             return super.process(options, option);
 448  
             }
 449  
         },
 450  
 
 451  
         // This option exists only for the purpose of documenting itself.
 452  
         // It's actually implemented by the launcher.
 453  492
         new Option(J,                       MsgSym.MESSAGE_OPT_ARG_FLAG,    MsgSym.MESSAGE_OPT_J) {
 454  
         @Override
 455  
             String helpSynopsis() {
 456  0
             hasSuffix = true;
 457  0
             return super.helpSynopsis();
 458  
             }
 459  
         @Override
 460  
             public boolean process(Options options, String option) {
 461  0
             throw new AssertionError
 462  
                 ("the -J flag should be caught by the launcher.");
 463  
             }
 464  
         },
 465  
 
 466  
         // stop after parsing and attributing.
 467  
         // new HiddenOption("-attrparseonly"),
 468  
 
 469  
         // new Option("-moreinfo",                                        "opt.moreinfo") {
 470  492
         new HiddenOption(MOREINFO) {
 471  
         @Override
 472  
             public boolean process(Options options, String option) {
 473  0
                 Type.moreInfo = true;
 474  0
                 return super.process(options, option);
 475  
             }
 476  
         },
 477  
 
 478  
         // treat warnings as errors
 479  
         new HiddenOption(WERROR),
 480  
 
 481  
         // use complex inference from context in the position of a method call argument
 482  
         new HiddenOption(COMPLEXINFERENCE),
 483  
 
 484  
         // generare source stubs
 485  
         // new HiddenOption("-stubs"),
 486  
 
 487  
         // relax some constraints to allow compiling from stubs
 488  
         // new HiddenOption("-relax"),
 489  
 
 490  
         // output source after translating away inner classes
 491  
         // new Option("-printflat",                                "opt.printflat"),
 492  
         // new HiddenOption("-printflat"),
 493  
 
 494  
         // display scope search details
 495  
         // new Option("-printsearch",                                "opt.printsearch"),
 496  
         // new HiddenOption("-printsearch"),
 497  
 
 498  
         // prompt after each error
 499  
         // new Option("-prompt",                                        "opt.prompt"),
 500  
         new HiddenOption(PROMPT),
 501  
 
 502  
         // dump stack on error
 503  
         new HiddenOption(DOE),
 504  
 
 505  
         // output source after type erasure
 506  
         // new Option("-s",                                        "opt.s"),
 507  
         new HiddenOption(PRINTSOURCE),
 508  
 
 509  
         // output shrouded class files
 510  
         // new Option("-scramble",                                "opt.scramble"),
 511  
         // new Option("-scrambleall",                                "opt.scrambleall"),
 512  
 
 513  
         // display warnings for generic unchecked operations
 514  492
         new HiddenOption(WARNUNCHECKED) {
 515  
         @Override
 516  
             public boolean process(Options options, String option) {
 517  0
                 options.put("-Xlint:unchecked", option);
 518  0
                 return false;
 519  
             }
 520  
         },
 521  
 
 522  
         new XOption(XMAXERRS,           MsgSym.MESSAGE_OPT_ARG_NUMBER,        MsgSym.MESSAGE_OPT_MAXERRS),
 523  
         new XOption(XMAXWARNS,          MsgSym.MESSAGE_OPT_ARG_NUMBER,        MsgSym.MESSAGE_OPT_MAXWARNS),
 524  492
         new XOption(XSTDOUT,                MsgSym.MESSAGE_OPT_ARG_FILE,    MsgSym.MESSAGE_OPT_XSTDOUT) {
 525  
         @Override
 526  
             public boolean process(Options options, String option, String arg) {
 527  
                 try {
 528  0
                     helper.setOut(new PrintWriter(new FileWriter(arg), true));
 529  0
                 } catch (java.io.IOException e) {
 530  0
                     helper.error(MsgSym.MESSAGE_ERR_ERROR_WRITING_FILE, arg, e);
 531  0
                     return true;
 532  0
                 }
 533  0
                 return super.process(options, option, arg);
 534  
             }
 535  
         },
 536  
 
 537  
         new XOption(XPRINT,                                           MsgSym.MESSAGE_OPT_PRINT),
 538  
 
 539  
         new XOption(XPRINTROUNDS,                           MsgSym.MESSAGE_OPT_PRINT_ROUNDS),
 540  
 
 541  
         new XOption(XPRINTPROCESSORINFO,                MsgSym.MESSAGE_OPT_PRINT_PROCESSOR_INFO),
 542  
         
 543  492
     new XOption(XPREFER,                MsgSym.MESSAGE_OPT_PREFER) {
 544  
         @Override
 545  
         public boolean matches(String s) {
 546  89
             return s.equals("-Xprefer:source") || s.equals("-Xprefer:newer");
 547  
         }
 548  
         @Override
 549  
         public boolean process(Options options, String option, String operand) {
 550  0
             int sep = option.indexOf(":");
 551  0
             options.put(option.substring(0, sep), option.substring(sep+1));
 552  0
             options.put(option,option);
 553  0
             return false;
 554  
         }
 555  
     },
 556  
 
 557  
         /* -O is a no-op, accepted for backward compatibility. */
 558  
         new HiddenOption(O),
 559  
 
 560  
         /* -Xjcov produces tables to support the code coverage tool jcov. */
 561  
         new HiddenOption(XJCOV),
 562  
 
 563  
         /* This is a back door to the compiler's option table.
 564  
          * -XDx=y sets the option x to the value y.
 565  
          * -XDx sets the option x to the value x.
 566  
          */
 567  492
         new HiddenOption(XD) {
 568  
             String s;
 569  
         @Override
 570  
             public boolean matches(String s) {
 571  89
                 this.s = s;
 572  89
                 return s.startsWith(name.optionName);
 573  
             }
 574  
         @Override
 575  
             public boolean process(Options options, String option) {
 576  58
                 s = s.substring(name.optionName.length());
 577  58
                 int eq = s.indexOf('=');
 578  58
                 String key = (eq < 0) ? s : s.substring(0, eq);
 579  58
                 String value = (eq < 0) ? s : s.substring(eq+1);
 580  58
                 options.put(key, value);
 581  58
                 return false;
 582  
             }
 583  
         },
 584  
 
 585  
         // Javafxc-specific options
 586  
         new HiddenOption(DUMPJAVA),
 587  
         new HiddenOption(DUMPFX),
 588  
 
 589  
         /*
 590  
          * TODO: With apt, the matches method accepts anything if
 591  
          * -XclassAsDecls is used; code elsewhere does the lookup to
 592  
          * see if the class name is both legal and found.
 593  
          *
 594  
          * In apt, the process method adds the candiate class file
 595  
          * name to a separate list.
 596  
          */
 597  492
         new HiddenOption(SOURCEFILE) {
 598  
             String s;
 599  
         @Override
 600  
             public boolean matches(String s) {
 601  365
                 this.s = s;
 602  365
                 return s.endsWith(".fx");  // Javafx source file
 603  
             }
 604  
         @Override
 605  
             public boolean process(Options options, String option) {
 606  365
                 if (s.endsWith(".fx") ) {
 607  365
                     File f = new File(s);
 608  365
                     if (!f.exists()) {
 609  0
                         helper.error(MsgSym.MESSAGE_ERR_FILE_NOT_FOUND, f);
 610  0
                         return true;
 611  
                     }
 612  365
                     if (!f.isFile()) {
 613  0
                         helper.error(MsgSym.MESSAGE_ERR_FILE_NOT_FILE, f);
 614  0
                         return true;
 615  
                     }
 616  365
                     helper.addFile(f);
 617  365
                 }
 618  
                 else
 619  0
                     helper.addClassName(s);
 620  365
                 return false;
 621  
             }
 622  
         },
 623  
     };        
 624  
     }
 625  
     
 626  
 }