1 /*
2 * Copyright (c) 2016, 2017, Oracle and/or its affiliates. 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. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
489 try {
490 while (!args.isEmpty()) {
491 String a = args.element();
492 if (a.startsWith("-")) {
493 args.remove();
494 switch (a) {
495 case "--class-path":
496 classPath.clear();
497 Arrays.stream(args.remove().split(File.pathSeparator))
498 .map(File::new)
499 .forEachOrdered(classPath::add);
500 break;
501 case "--for-removal":
502 forRemoval = true;
503 break;
504 case "--full-version":
505 out.println(System.getProperty("java.vm.version"));
506 return false;
507 case "--help":
508 case "-h":
509 out.println(Messages.get("main.usage"));
510 out.println();
511 out.println(Messages.get("main.help"));
512 return false;
513 case "-l":
514 case "--list":
515 require(scanMode == ScanMode.ARGS);
516 scanMode = ScanMode.LIST;
517 break;
518 case "--release":
519 loadMode = LoadMode.RELEASE;
520 release = args.remove();
521 if (!validReleases.contains(release)) {
522 throw new UsageException();
523 }
524 break;
525 case "-v":
526 case "--verbose":
527 verbose = true;
528 break;
529 case "--version":
530 out.println(System.getProperty("java.version"));
531 return false;
532 case "--Xcompiler-arg":
|
1 /*
2 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. 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. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
489 try {
490 while (!args.isEmpty()) {
491 String a = args.element();
492 if (a.startsWith("-")) {
493 args.remove();
494 switch (a) {
495 case "--class-path":
496 classPath.clear();
497 Arrays.stream(args.remove().split(File.pathSeparator))
498 .map(File::new)
499 .forEachOrdered(classPath::add);
500 break;
501 case "--for-removal":
502 forRemoval = true;
503 break;
504 case "--full-version":
505 out.println(System.getProperty("java.vm.version"));
506 return false;
507 case "--help":
508 case "-h":
509 case "-?":
510 out.println(Messages.get("main.usage"));
511 out.println();
512 out.println(Messages.get("main.help"));
513 return true;
514 case "-l":
515 case "--list":
516 require(scanMode == ScanMode.ARGS);
517 scanMode = ScanMode.LIST;
518 break;
519 case "--release":
520 loadMode = LoadMode.RELEASE;
521 release = args.remove();
522 if (!validReleases.contains(release)) {
523 throw new UsageException();
524 }
525 break;
526 case "-v":
527 case "--verbose":
528 verbose = true;
529 break;
530 case "--version":
531 out.println(System.getProperty("java.version"));
532 return false;
533 case "--Xcompiler-arg":
|