langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/OptionHelper.java
changeset 26107 a4a156a33c94
parent 26098 32588700060b
parent 25874 83c19f00452c
child 27383 716ed9a6d607
equal deleted inserted replaced
25876:d06a6d3c66c0 26107:a4a156a33c94
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 
    25 
    26 package com.sun.tools.sjavac.options;
    26 package com.sun.tools.sjavac.options;
    27 
    27 
    28 import java.nio.file.Files;
    28 import java.io.IOException;
    29 import java.nio.file.Path;
    29 import java.nio.file.Path;
    30 import java.nio.file.Paths;
    30 import java.nio.file.Paths;
    31 import java.util.Arrays;
    31 import java.util.Arrays;
    32 import java.util.List;
    32 import java.util.List;
    33 
    33 
       
    34 import com.sun.tools.javac.main.CommandLine;
    34 import com.sun.tools.sjavac.Transformer;
    35 import com.sun.tools.sjavac.Transformer;
    35 
    36 
    36 /**
    37 /**
    37  * This class is used to decode sjavac options.
    38  * This class is used to decode sjavac options.
    38  * See com.sun.tools.sjavac.options.Options for example usage.
    39  * See com.sun.tools.sjavac.options.Options for example usage.
       
    40  *
       
    41  *  <p><b>This is NOT part of any supported API.
       
    42  *  If you write code that depends on this, you do so at your own risk.
       
    43  *  This code and its internal interfaces are subject to change or
       
    44  *  deletion without notice.</b>
    39  */
    45  */
    40 public abstract class OptionHelper {
    46 public abstract class OptionHelper {
    41 
    47 
    42     /** Handle error */
    48     /** Handle error */
    43     public abstract void reportError(String msg);
    49     public abstract void reportError(String msg);
    76     public abstract void logLevel(String level);
    82     public abstract void logLevel(String level);
    77 
    83 
    78     /** Record path for reference source list */
    84     /** Record path for reference source list */
    79     public abstract void compareFoundSources(Path referenceList);
    85     public abstract void compareFoundSources(Path referenceList);
    80 
    86 
       
    87     /** Record a single permitted artifact */
       
    88     public abstract void permitArtifact(String f);
       
    89 
    81     /** Record the fact that unidentified artifacts are permitted */
    90     /** Record the fact that unidentified artifacts are permitted */
    82     public abstract void permitUnidentifiedArtifacts();
    91     public abstract void permitUnidentifiedArtifacts();
    83 
    92 
    84     /** Record the fact that sources in the default package are permitted */
    93     /** Record the fact that sources in the default package are permitted */
    85     public abstract void permitDefaultPackage();
    94     public abstract void permitDefaultPackage();
   100     public abstract void generatedSourcesDir(Path genSrcDir);
   109     public abstract void generatedSourcesDir(Path genSrcDir);
   101 
   110 
   102     /** Sets the directory for generated headers */
   111     /** Sets the directory for generated headers */
   103     public abstract void headerDir(Path dir);
   112     public abstract void headerDir(Path dir);
   104 
   113 
       
   114     /** Sets the directory for state and log files generated by sjavac */
       
   115     public abstract void stateDir(Path dir);
       
   116 
   105     /** Sets the implicit policy */
   117     /** Sets the implicit policy */
   106     public abstract void implicit(String policy);
   118     public abstract void implicit(String policy);
   107 
   119 
   108 
   120 
   109     /**
   121     /**
   110      * Traverses an array of arguments and performs the appropriate callbacks.
   122      * Traverses an array of arguments and performs the appropriate callbacks.
   111      *
   123      *
   112      * @param args the arguments to traverse.
   124      * @param args the arguments to traverse.
   113      */
   125      */
   114     void traverse(String[] args) {
   126     void traverse(String[] args) {
   115 
   127         try {
       
   128             args = CommandLine.parse(args); // Detect @file and load it as a command line.
       
   129         } catch (java.io.IOException e) {
       
   130             throw new IllegalArgumentException("Problem reading @"+e.getMessage());
       
   131         }
   116         ArgumentIterator argIter = new ArgumentIterator(Arrays.asList(args));
   132         ArgumentIterator argIter = new ArgumentIterator(Arrays.asList(args));
   117 
   133 
   118         nextArg:
   134         nextArg:
   119         while (argIter.hasNext()) {
   135         while (argIter.hasNext()) {
   120 
   136