< prev index next >

src/jdk.rmic/share/classes/sun/rmi/rmic/RMIGenerator.java

Print this page




  62 public class RMIGenerator implements RMIConstants, Generator {
  63 
  64     private static final Hashtable<String, Integer> versionOptions = new Hashtable<>();
  65     static {
  66         versionOptions.put("-v1.1", STUB_VERSION_1_1);
  67         versionOptions.put("-vcompat", STUB_VERSION_FAT);
  68         versionOptions.put("-v1.2", STUB_VERSION_1_2);
  69     }
  70 
  71     /**
  72      * Default constructor for Main to use.
  73      */
  74     public RMIGenerator() {
  75         version = STUB_VERSION_1_2;     // default is -v1.2 (see 4638155)
  76     }
  77 
  78     /**
  79      * Examine and consume command line arguments.
  80      * @param argv The command line arguments. Ignore null
  81      * and unknown arguments. Set each consumed argument to null.
  82      * @param error Report any errors using the main.error() methods.
  83      * @return true if no errors, false otherwise.
  84      */
  85     public boolean parseArgs(String argv[], Main main) {
  86         String explicitVersion = null;
  87         for (int i = 0; i < argv.length; i++) {
  88             if (argv[i] != null) {
  89                 String arg = argv[i].toLowerCase();
  90                 if (versionOptions.containsKey(arg)) {
  91                     if (explicitVersion != null &&
  92                         !explicitVersion.equals(arg))
  93                     {
  94                         main.error("rmic.cannot.use.both",
  95                                    explicitVersion, arg);
  96                         return false;
  97                     }
  98                     explicitVersion = arg;
  99                     version = versionOptions.get(arg);
 100                     argv[i] = null;
 101                 }
 102             }




  62 public class RMIGenerator implements RMIConstants, Generator {
  63 
  64     private static final Hashtable<String, Integer> versionOptions = new Hashtable<>();
  65     static {
  66         versionOptions.put("-v1.1", STUB_VERSION_1_1);
  67         versionOptions.put("-vcompat", STUB_VERSION_FAT);
  68         versionOptions.put("-v1.2", STUB_VERSION_1_2);
  69     }
  70 
  71     /**
  72      * Default constructor for Main to use.
  73      */
  74     public RMIGenerator() {
  75         version = STUB_VERSION_1_2;     // default is -v1.2 (see 4638155)
  76     }
  77 
  78     /**
  79      * Examine and consume command line arguments.
  80      * @param argv The command line arguments. Ignore null
  81      * and unknown arguments. Set each consumed argument to null.
  82      * @param main Report any errors using the main.error() methods.
  83      * @return true if no errors, false otherwise.
  84      */
  85     public boolean parseArgs(String argv[], Main main) {
  86         String explicitVersion = null;
  87         for (int i = 0; i < argv.length; i++) {
  88             if (argv[i] != null) {
  89                 String arg = argv[i].toLowerCase();
  90                 if (versionOptions.containsKey(arg)) {
  91                     if (explicitVersion != null &&
  92                         !explicitVersion.equals(arg))
  93                     {
  94                         main.error("rmic.cannot.use.both",
  95                                    explicitVersion, arg);
  96                         return false;
  97                     }
  98                     explicitVersion = arg;
  99                     version = versionOptions.get(arg);
 100                     argv[i] = null;
 101                 }
 102             }


< prev index next >