< prev index next >

src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java

Print this page




 155             if (log instanceof Messager) {
 156                 messager = (Messager) log;
 157             } else {
 158                 PrintWriter out = context.get(Log.errKey);
 159                 messager = (out == null)
 160                         ? new Messager(context, ProgramName)
 161                         : new Messager(context, ProgramName, out, out);
 162             }
 163         }
 164     }
 165 
 166     /**
 167      * Usage
 168      */
 169     @Override
 170     void usage() {
 171         usage(true);
 172     }
 173 
 174     void usage(boolean exit) {
 175         usage("main.usage", "-help", null, exit);
 176     }
 177 
 178     @Override
 179     void Xusage() {
 180         Xusage(true);
 181     }
 182 
 183     void Xusage(boolean exit) {
 184         usage("main.Xusage", "-X", "main.Xusage.foot", exit);
 185     }
 186 
 187     private void usage(String main, String option, String foot, boolean exit) {
 188         messager.notice(main);
 189         // let doclet print usage information (does nothing on error)
 190         if (docletClass != null) {
 191             String name = doclet.getName();
 192             Set<Option> supportedOptions = doclet.getSupportedOptions();
 193             messager.notice("main.doclet.usage.header", name);
 194             Option.Kind myKind = option.equals("-X")
 195                     ? Option.Kind.EXTENDED


 338      * Main program - internal
 339      */
 340     private boolean parseAndExecute(List<String> argList,
 341             Iterable<? extends JavaFileObject> fileObjects) throws IOException {
 342         long tm = System.currentTimeMillis();
 343 
 344         List<String> javaNames = new ArrayList<>();
 345 
 346         compOpts = Options.instance(context);
 347 
 348         // Make sure no obsolete source/target messages are reported
 349         com.sun.tools.javac.main.Option.XLINT.process(getOptionHelper(), "-Xlint:-options");
 350 
 351         doclet.init(locale, messager);
 352         parseArgs(argList, javaNames);
 353 
 354         if (fileManager instanceof BaseFileManager) {
 355             ((BaseFileManager) fileManager).handleOptions(fileManagerOpts);
 356         }
 357 
 358         String platformString = compOpts.get("-release");
 359 
 360         if (platformString != null) {
 361             if (compOpts.isSet("-source")) {
 362                 usageError("main.release.bootclasspath.conflict", "-source");
 363             }
 364             if (fileManagerOpts.containsKey(BOOTCLASSPATH)) {
 365                 usageError("main.release.bootclasspath.conflict", BOOTCLASSPATH.getText());
 366             }
 367 
 368             PlatformDescription platformDescription =
 369                     PlatformUtils.lookupPlatformDescription(platformString);
 370 
 371             if (platformDescription == null) {
 372                 usageError("main.unsupported.release.version", platformString);
 373             }
 374 
 375             compOpts.put(SOURCE, platformDescription.getSourceVersion());
 376 
 377             context.put(PlatformDescription.class, platformDescription);
 378 
 379             Collection<Path> platformCP = platformDescription.getPlatformPath();
 380 
 381             if (platformCP != null) {
 382                 if (fileManager instanceof StandardJavaFileManager) {
 383                     StandardJavaFileManager sfm = (StandardJavaFileManager) fileManager;
 384 
 385                     sfm.setLocationFromPaths(StandardLocation.PLATFORM_CLASS_PATH, platformCP);




 155             if (log instanceof Messager) {
 156                 messager = (Messager) log;
 157             } else {
 158                 PrintWriter out = context.get(Log.errKey);
 159                 messager = (out == null)
 160                         ? new Messager(context, ProgramName)
 161                         : new Messager(context, ProgramName, out, out);
 162             }
 163         }
 164     }
 165 
 166     /**
 167      * Usage
 168      */
 169     @Override
 170     void usage() {
 171         usage(true);
 172     }
 173 
 174     void usage(boolean exit) {
 175         usage("main.usage", "-help", "main.usage.foot", exit);
 176     }
 177 
 178     @Override
 179     void Xusage() {
 180         Xusage(true);
 181     }
 182 
 183     void Xusage(boolean exit) {
 184         usage("main.Xusage", "-X", "main.Xusage.foot", exit);
 185     }
 186 
 187     private void usage(String main, String option, String foot, boolean exit) {
 188         messager.notice(main);
 189         // let doclet print usage information (does nothing on error)
 190         if (docletClass != null) {
 191             String name = doclet.getName();
 192             Set<Option> supportedOptions = doclet.getSupportedOptions();
 193             messager.notice("main.doclet.usage.header", name);
 194             Option.Kind myKind = option.equals("-X")
 195                     ? Option.Kind.EXTENDED


 338      * Main program - internal
 339      */
 340     private boolean parseAndExecute(List<String> argList,
 341             Iterable<? extends JavaFileObject> fileObjects) throws IOException {
 342         long tm = System.currentTimeMillis();
 343 
 344         List<String> javaNames = new ArrayList<>();
 345 
 346         compOpts = Options.instance(context);
 347 
 348         // Make sure no obsolete source/target messages are reported
 349         com.sun.tools.javac.main.Option.XLINT.process(getOptionHelper(), "-Xlint:-options");
 350 
 351         doclet.init(locale, messager);
 352         parseArgs(argList, javaNames);
 353 
 354         if (fileManager instanceof BaseFileManager) {
 355             ((BaseFileManager) fileManager).handleOptions(fileManagerOpts);
 356         }
 357 
 358         String platformString = compOpts.get("--release");
 359 
 360         if (platformString != null) {
 361             if (compOpts.isSet("-source")) {
 362                 usageError("main.release.bootclasspath.conflict", "-source");
 363             }
 364             if (fileManagerOpts.containsKey(BOOT_CLASS_PATH)) {
 365                 usageError("main.release.bootclasspath.conflict", BOOT_CLASS_PATH.getPrimaryName());
 366             }
 367 
 368             PlatformDescription platformDescription =
 369                     PlatformUtils.lookupPlatformDescription(platformString);
 370 
 371             if (platformDescription == null) {
 372                 usageError("main.unsupported.release.version", platformString);
 373             }
 374 
 375             compOpts.put(SOURCE, platformDescription.getSourceVersion());
 376 
 377             context.put(PlatformDescription.class, platformDescription);
 378 
 379             Collection<Path> platformCP = platformDescription.getPlatformPath();
 380 
 381             if (platformCP != null) {
 382                 if (fileManager instanceof StandardJavaFileManager) {
 383                     StandardJavaFileManager sfm = (StandardJavaFileManager) fileManager;
 384 
 385                     sfm.setLocationFromPaths(StandardLocation.PLATFORM_CLASS_PATH, platformCP);


< prev index next >