< prev index next >

src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java

Print this page

397                                  null);
398             task.setProcessors(List.of(proc));
399             if (!task.call()) {
400                 return false;
401             }
402             Map<PackageElement, List<TypeElement>> types = proc.getPublicTypes();
403             options.add("--add-modules");
404             options.add(String.join(",", rootMods));
405             return doClassNames(
406                 types.values().stream()
407                      .flatMap(List::stream)
408                      .map(TypeElement::toString)
409                      .toList());
410         } else {
411             JDKPlatformProvider pp = new JDKPlatformProvider();
412             if (StreamSupport.stream(pp.getSupportedPlatformNames().spliterator(),
413                                  false)
414                              .noneMatch(n -> n.equals(release))) {
415                 return false;
416             }
417             JavaFileManager fm = pp.getPlatformTrusted(release).getFileManager();
418             List<String> classNames = new ArrayList<>();
419             for (JavaFileObject fo : fm.list(StandardLocation.PLATFORM_CLASS_PATH,
420                                              "",
421                                              EnumSet.of(Kind.CLASS),
422                                              true)) {
423                 classNames.add(fm.inferBinaryName(StandardLocation.PLATFORM_CLASS_PATH, fo));
424             }
425 
426             options.add("-Xlint:-options");
427 
428             return doClassNames(classNames);
429         }
430     }
431 
432     /**
433      * An enum denoting the mode in which the tool is running.
434      * Different modes correspond to the different process* methods.
435      * The exception is UNKNOWN, which indicates that a mode wasn't
436      * specified on the command line, which is an error.
437      */

397                                  null);
398             task.setProcessors(List.of(proc));
399             if (!task.call()) {
400                 return false;
401             }
402             Map<PackageElement, List<TypeElement>> types = proc.getPublicTypes();
403             options.add("--add-modules");
404             options.add(String.join(",", rootMods));
405             return doClassNames(
406                 types.values().stream()
407                      .flatMap(List::stream)
408                      .map(TypeElement::toString)
409                      .toList());
410         } else {
411             JDKPlatformProvider pp = new JDKPlatformProvider();
412             if (StreamSupport.stream(pp.getSupportedPlatformNames().spliterator(),
413                                  false)
414                              .noneMatch(n -> n.equals(release))) {
415                 return false;
416             }
417             JavaFileManager fm = pp.getPlatformTrusted(release, "").getFileManager();
418             List<String> classNames = new ArrayList<>();
419             for (JavaFileObject fo : fm.list(StandardLocation.PLATFORM_CLASS_PATH,
420                                              "",
421                                              EnumSet.of(Kind.CLASS),
422                                              true)) {
423                 classNames.add(fm.inferBinaryName(StandardLocation.PLATFORM_CLASS_PATH, fo));
424             }
425 
426             options.add("-Xlint:-options");
427 
428             return doClassNames(classNames);
429         }
430     }
431 
432     /**
433      * An enum denoting the mode in which the tool is running.
434      * Different modes correspond to the different process* methods.
435      * The exception is UNKNOWN, which indicates that a mode wasn't
436      * specified on the command line, which is an error.
437      */
< prev index next >