src/share/classes/com/sun/tools/javac/main/Option.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File langtools Sdiff src/share/classes/com/sun/tools/javac/main

src/share/classes/com/sun/tools/javac/main/Option.java

Print this page




  23  * questions.
  24  */
  25 
  26 package com.sun.tools.javac.main;
  27 
  28 import java.io.File;
  29 import java.io.FileWriter;
  30 import java.io.PrintWriter;
  31 import java.util.Collections;
  32 import java.util.EnumSet;
  33 import java.util.LinkedHashMap;
  34 import java.util.Map;
  35 import java.util.Set;
  36 
  37 import javax.lang.model.SourceVersion;
  38 
  39 import com.sun.tools.doclint.DocLint;
  40 import com.sun.tools.javac.code.Lint;
  41 import com.sun.tools.javac.code.Source;
  42 import com.sun.tools.javac.code.Type;

  43 import com.sun.tools.javac.jvm.Target;
  44 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
  45 import com.sun.tools.javac.util.Log;
  46 import com.sun.tools.javac.util.Log.PrefixKind;
  47 import com.sun.tools.javac.util.Log.WriterKind;
  48 import com.sun.tools.javac.util.Options;
  49 import static com.sun.tools.javac.main.Option.ChoiceKind.*;
  50 import static com.sun.tools.javac.main.Option.OptionGroup.*;
  51 import static com.sun.tools.javac.main.Option.OptionKind.*;
  52 
  53 /**
  54  * Options for javac. The specific Option to handle a command-line option
  55  * is identified by searching the members of this enum in order, looking
  56  * the first {@link #matches match}. The action for an Option is performed
  57  * by calling {@link #process process}, and by providing a suitable
  58  * {@link OptionHelper} to provide access the compiler state.
  59  *
  60  * <p><b>This is NOT part of any supported API.
  61  * If you write code that depends on this, you do so at your own
  62  * risk.  This code and its internal interfaces are subject to change


 195     },
 196 
 197     SOURCE("-source", "opt.arg.release", "opt.source", STANDARD, BASIC) {
 198         @Override
 199         public boolean process(OptionHelper helper, String option, String operand) {
 200             Source source = Source.lookup(operand);
 201             if (source == null) {
 202                 helper.error("err.invalid.source", operand);
 203                 return true;
 204             }
 205             return super.process(helper, option, operand);
 206         }
 207     },
 208 
 209     TARGET("-target", "opt.arg.release", "opt.target", STANDARD, BASIC) {
 210         @Override
 211         public boolean process(OptionHelper helper, String option, String operand) {
 212             Target target = Target.lookup(operand);
 213             if (target == null) {
 214                 helper.error("err.invalid.target", operand);












 215                 return true;
 216             }
 217             return super.process(helper, option, operand);
 218         }
 219     },
 220 
 221     VERSION("-version", "opt.version", STANDARD, INFO) {
 222         @Override
 223         public boolean process(OptionHelper helper, String option) {
 224             Log log = helper.getLog();
 225             String ownName = helper.getOwnName();
 226             log.printLines(PrefixKind.JAVAC, "version", ownName,  JavaCompiler.version());
 227             return super.process(helper, option);
 228         }
 229     },
 230 
 231     FULLVERSION("-fullversion", null, HIDDEN, INFO) {
 232         @Override
 233         public boolean process(OptionHelper helper, String option) {
 234             Log log = helper.getLog();




  23  * questions.
  24  */
  25 
  26 package com.sun.tools.javac.main;
  27 
  28 import java.io.File;
  29 import java.io.FileWriter;
  30 import java.io.PrintWriter;
  31 import java.util.Collections;
  32 import java.util.EnumSet;
  33 import java.util.LinkedHashMap;
  34 import java.util.Map;
  35 import java.util.Set;
  36 
  37 import javax.lang.model.SourceVersion;
  38 
  39 import com.sun.tools.doclint.DocLint;
  40 import com.sun.tools.javac.code.Lint;
  41 import com.sun.tools.javac.code.Source;
  42 import com.sun.tools.javac.code.Type;
  43 import com.sun.tools.javac.jvm.Profile;
  44 import com.sun.tools.javac.jvm.Target;
  45 import com.sun.tools.javac.processing.JavacProcessingEnvironment;
  46 import com.sun.tools.javac.util.Log;
  47 import com.sun.tools.javac.util.Log.PrefixKind;
  48 import com.sun.tools.javac.util.Log.WriterKind;
  49 import com.sun.tools.javac.util.Options;
  50 import static com.sun.tools.javac.main.Option.ChoiceKind.*;
  51 import static com.sun.tools.javac.main.Option.OptionGroup.*;
  52 import static com.sun.tools.javac.main.Option.OptionKind.*;
  53 
  54 /**
  55  * Options for javac. The specific Option to handle a command-line option
  56  * is identified by searching the members of this enum in order, looking
  57  * the first {@link #matches match}. The action for an Option is performed
  58  * by calling {@link #process process}, and by providing a suitable
  59  * {@link OptionHelper} to provide access the compiler state.
  60  *
  61  * <p><b>This is NOT part of any supported API.
  62  * If you write code that depends on this, you do so at your own
  63  * risk.  This code and its internal interfaces are subject to change


 196     },
 197 
 198     SOURCE("-source", "opt.arg.release", "opt.source", STANDARD, BASIC) {
 199         @Override
 200         public boolean process(OptionHelper helper, String option, String operand) {
 201             Source source = Source.lookup(operand);
 202             if (source == null) {
 203                 helper.error("err.invalid.source", operand);
 204                 return true;
 205             }
 206             return super.process(helper, option, operand);
 207         }
 208     },
 209 
 210     TARGET("-target", "opt.arg.release", "opt.target", STANDARD, BASIC) {
 211         @Override
 212         public boolean process(OptionHelper helper, String option, String operand) {
 213             Target target = Target.lookup(operand);
 214             if (target == null) {
 215                 helper.error("err.invalid.target", operand);
 216                 return true;
 217             }
 218             return super.process(helper, option, operand);
 219         }
 220     },
 221     
 222     PROFILE("-profile", "opt.arg.profile", "opt.profile", STANDARD, BASIC) {
 223         @Override
 224         public boolean process(OptionHelper helper, String option, String operand) {
 225             Profile profile = Profile.lookup(operand);
 226             if (profile == null) {
 227                 helper.error("err.invalid.profile", operand);
 228                 return true;
 229             }
 230             return super.process(helper, option, operand);
 231         }
 232     },
 233 
 234     VERSION("-version", "opt.version", STANDARD, INFO) {
 235         @Override
 236         public boolean process(OptionHelper helper, String option) {
 237             Log log = helper.getLog();
 238             String ownName = helper.getOwnName();
 239             log.printLines(PrefixKind.JAVAC, "version", ownName,  JavaCompiler.version());
 240             return super.process(helper, option);
 241         }
 242     },
 243 
 244     FULLVERSION("-fullversion", null, HIDDEN, INFO) {
 245         @Override
 246         public boolean process(OptionHelper helper, String option) {
 247             Log log = helper.getLog();


src/share/classes/com/sun/tools/javac/main/Option.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File