Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
JDK 17 jdk.jdeps.jmod - JDeps Tool
JDK 17 jdk.jdeps.jmod is the JMOD file for JDK 17 JDeps tool, which can be invoked by the "jdeps" command.
JDK 17 JDeps tool compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\jdk.jdeps.jmod.
JDK 17 JDeps tool compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 JDeps tool source code files are stored in \fyicenter\jdk-17.0.5\lib\src.zip\jdk.jdeps.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ com/sun/tools/jdeps/ModuleInfoBuilder.java
/* * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package com.sun.tools.jdeps; import static com.sun.tools.jdeps.JdepsTask.*; import static com.sun.tools.jdeps.Analyzer.*; import static com.sun.tools.jdeps.JdepsFilter.DEFAULT_FILTER; import java.io.IOException; import java.io.PrintWriter; import java.io.UncheckedIOException; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleDescriptor.Exports; import java.lang.module.ModuleDescriptor.Provides; import java.lang.module.ModuleDescriptor.Requires; import java.lang.module.ModuleFinder; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; import static java.util.stream.Collectors.*; public class ModuleInfoBuilder { final JdepsConfiguration configuration; final Path outputdir; final boolean open; final DependencyFinder dependencyFinder; final Analyzer analyzer; // an input JAR file (loaded as an automatic module for analysis) // maps to a normal module to generate module-info.java final Map<Module, Module> automaticToNormalModule; public ModuleInfoBuilder(JdepsConfiguration configuration, List<String> args, Path outputdir, boolean open) { this.configuration = configuration; this.outputdir = outputdir; this.open = open; this.dependencyFinder = new DependencyFinder(configuration, DEFAULT_FILTER); this.analyzer = new Analyzer(configuration, Type.CLASS, DEFAULT_FILTER); // add targets to modulepath if it has module-info.class List<Path> paths = args.stream() .map(fn -> Paths.get(fn)) .toList(); // automatic module to convert to normal module this.automaticToNormalModule = ModuleFinder.of(paths.toArray(new Path[0])) .findAll().stream() .map(configuration::toModule) .collect(toMap(Function.identity(), Function.identity())); Optional<Module> om = automaticToNormalModule.keySet().stream() .filter(m -> !m.descriptor().isAutomatic()) .findAny(); if (om.isPresent()) { throw new UncheckedBadArgs(new BadArgs("err.genmoduleinfo.not.jarfile", om.get().getPathName())); } if (automaticToNormalModule.isEmpty()) { throw new UncheckedBadArgs(new BadArgs("err.invalid.path", args)); } } public boolean run(boolean ignoreMissingDeps, PrintWriter log, boolean quiet) throws IOException { try { // pass 1: find API dependencies Map<Archive, Set<Archive>> requiresTransitive = computeRequiresTransitive(); // pass 2: analyze all class dependences dependencyFinder.parse(automaticModules().stream()); analyzer.run(automaticModules(), dependencyFinder.locationToArchive()); for (Module m : automaticModules()) { Set<Archive> apiDeps = requiresTransitive.containsKey(m) ? requiresTransitive.get(m) : Collections.emptySet(); // if this is a multi-release JAR, write to versions/$VERSION/module-info.java Runtime.Version version = configuration.getVersion(); Path dir = version != null ? outputdir.resolve(m.name()) .resolve("versions") .resolve(String.valueOf(version.feature())) : outputdir.resolve(m.name()); Path file = dir.resolve("module-info.java"); // computes requires and requires transitive Module normalModule = toNormalModule(m, apiDeps, ignoreMissingDeps); if (normalModule != null) { automaticToNormalModule.put(m, normalModule); // generate module-info.java if (!quiet) { if (ignoreMissingDeps && analyzer.requires(m).anyMatch(Analyzer::notFound)) { log.format("Warning: --ignore-missing-deps specified. Missing dependencies from %s are ignored%n", m.name()); } log.format("writing to %s%n", file); } writeModuleInfo(file, normalModule.descriptor()); } else { // find missing dependences return false; } } } finally { dependencyFinder.shutdown(); } return true; } private Module toNormalModule(Module module, Set<Archive> requiresTransitive, boolean ignoreMissingDeps) throws IOException { // done analysis module.close(); if (!ignoreMissingDeps && analyzer.requires(module).anyMatch(Analyzer::notFound)) { // missing dependencies return null; } Map<String, Boolean> requires = new HashMap<>(); requiresTransitive.stream() .filter(a -> !(ignoreMissingDeps && Analyzer.notFound(a))) .map(Archive::getModule) .forEach(m -> requires.put(m.name(), Boolean.TRUE)); analyzer.requires(module) .filter(a -> !(ignoreMissingDeps && Analyzer.notFound(a))) .map(Archive::getModule) .forEach(d -> requires.putIfAbsent(d.name(), Boolean.FALSE)); return module.toNormalModule(requires); } /** * Returns the stream of resulting modules */ Stream<Module> modules() { return automaticToNormalModule.values().stream(); } /** * Returns the stream of resulting ModuleDescriptors */ public Stream<ModuleDescriptor> descriptors() { return automaticToNormalModule.entrySet().stream() .map(Map.Entry::getValue) .map(Module::descriptor); } void visitMissingDeps(Analyzer.Visitor visitor) { automaticModules().stream() .filter(m -> analyzer.requires(m).anyMatch(Analyzer::notFound)) .forEach(m -> { analyzer.visitDependences(m, visitor, Analyzer.Type.VERBOSE, Analyzer::notFound); }); } void writeModuleInfo(Path file, ModuleDescriptor md) { try { Files.createDirectories(file.getParent()); try (PrintWriter pw = new PrintWriter(Files.newOutputStream(file))) { printModuleInfo(pw, md); } } catch (IOException e) { throw new UncheckedIOException(e); } } private void printModuleInfo(PrintWriter writer, ModuleDescriptor md) { writer.format("%smodule %s {%n", open ? "open " : "", md.name()); Map<String, Module> modules = configuration.getModules(); // first print requires Set<Requires> reqs = md.requires().stream() .filter(req -> !req.name().equals("java.base") && req.modifiers().isEmpty()) .collect(Collectors.toSet()); reqs.stream() .sorted(Comparator.comparing(Requires::name)) .forEach(req -> writer.format(" requires %s;%n", toString(req.modifiers(), req.name()))); if (!reqs.isEmpty()) { writer.println(); } // requires transitive reqs = md.requires().stream() .filter(req -> !req.name().equals("java.base") && !req.modifiers().isEmpty()) .collect(Collectors.toSet()); reqs.stream() .sorted(Comparator.comparing(Requires::name)) .forEach(req -> writer.format(" requires %s;%n", toString(req.modifiers(), req.name()))); if (!reqs.isEmpty()) { writer.println(); } if (!open) { md.exports().stream() .peek(exp -> { if (exp.isQualified()) throw new InternalError(md.name() + " qualified exports: " + exp); }) .sorted(Comparator.comparing(Exports::source)) .forEach(exp -> writer.format(" exports %s;%n", exp.source())); if (!md.exports().isEmpty()) { writer.println(); } } md.provides().stream() .sorted(Comparator.comparing(Provides::service)) .map(p -> p.providers().stream() .map(impl -> " " + impl.replace('$', '.')) .collect(joining(",\n", String.format(" provides %s with%n", p.service().replace('$', '.')), ";"))) .forEach(writer::println); if (!md.provides().isEmpty()) { writer.println(); } writer.println("}"); } private Set<Module> automaticModules() { return automaticToNormalModule.keySet(); } /** * Returns a string containing the given set of modifiers and label. */ private static <M> String toString(Set<M> mods, String what) { return (Stream.concat(mods.stream().map(e -> e.toString().toLowerCase(Locale.US)), Stream.of(what))) .collect(Collectors.joining(" ")); } /** * Compute 'requires transitive' dependences by analyzing API dependencies */ private Map<Archive, Set<Archive>> computeRequiresTransitive() throws IOException { // parse the input modules dependencyFinder.parseExportedAPIs(automaticModules().stream()); return dependencyFinder.dependences(); } }
⏎ com/sun/tools/jdeps/ModuleInfoBuilder.java
Or download all of them as a single archive file:
File name: jdk.jdeps-17.0.5-src.zip File size: 258425 bytes Release date: 2022-09-13 Download
⇒ JDK 17 jdk.jdi.jmod - JDI Tool
2023-04-17, 5943👍, 0💬
Popular Posts:
What Is commons-fileupload-1.3.3 .jar?commons-fileupload-1.3.3 .jaris the JAR file for Apache Common...
The Java Naming and Directory Interface (JNDI) is part of the Java platform, providing applications ...
JDK 11 jdk.compiler.jmod is the JMOD file for JDK 11 Compiler tool, which can be invoked by the "jav...
What Is jniwrap.jar in JNIWrapper 3.7.1? winpack.jar in JNIWrapper 3.7.1 is an add-on JAR file for J...
maven-compat-3.8.6.jar is the JAR file for Apache Maven 3.8.6 Compact module. The JAR file name may ...