JDK 11 jdk.compiler.jmod - Compiler Tool

JDK 11 jdk.compiler.jmod is the JMOD file for JDK 11 Compiler tool, which can be invoked by the "javac" command.

JDK 11 Compiler tool compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\jdk.compiler.jmod.

JDK 11 Compiler tool compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.

JDK 11 Compiler source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\jdk.compiler.

You can click and view the content of each source code file in the list below.

✍: FYIcenter


 * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.

package com.sun.tools.sjavac;

import java.io.File;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Stream;

import com.sun.tools.javac.util.Assert;
import com.sun.tools.sjavac.pubapi.PubApi;

 * The Package class maintains meta information about a package.
 * For example its sources, dependents,its pubapi and its artifacts.
 * It might look odd that we track dependents/pubapi/artifacts on
 * a package level, but it makes sense since recompiling a full package
 * takes as long as recompiling a single java file in that package,
 * if you take into account the startup time of the jvm.
 * Also the dependency information will be much smaller (good for the javac_state file size)
 * and it simplifies tracking artifact generation, you do not always know from which
 * source a class file was generated, but you always know which package it belongs to.
 * It is also educational to see package dependencies triggering recompilation of
 * other packages. Even though the recompilation was perhaps not necessary,
 * the visible recompilation of the dependent packages indicates how much circular
 * dependencies your code has.
 *  <p><b>This is NOT part of any supported API.
 *  If you write code that depends on this, you do so at your own risk.
 *  This code and its internal interfaces are subject to change or
 *  deletion without notice.</b>
public class Package implements Comparable<Package> {
    // The module this package belongs to. (There is a legacy module with an empty string name,
    // used for all legacy sources.)
    private Module mod;
    // Name of this package, module:pkg
    // ex1 jdk.base:java.lang
    // ex2 :java.lang (when in legacy mode)
    private String name;
    // The directory path to the package. If the package belongs to a module,
    // then that module's file system name is part of the path.
    private String dirname;
    // This package has the following dependents, that depend on this package.
    private Set<String> dependents = new HashSet<>();

    // Fully qualified name of class in this package -> fully qualified name of dependency
    private Map<String, Set<String>> dependencies = new TreeMap<>();
    // Fully qualified name of class in this package -> fully qualified name of dependency on class path
    private Map<String, Set<String>> cpDependencies = new TreeMap<>();

    // This is the public api of this package.
    private PubApi pubApi = new PubApi();
    // Map from source file name to Source info object.
    private Map<String,Source> sources = new HashMap<>();
    // This package generated these artifacts.
    private Map<String,File> artifacts = new HashMap<>();

    public Package(Module m, String n) {
        int c = n.indexOf(":");
        Assert.check(c != -1);
        name = n;
        dirname = n.replace('.', File.separatorChar);
        if (m.name().length() > 0) {
            // There is a module here, prefix the module dir name to the path.
            dirname = m.dirname()+File.separatorChar+dirname;

    public Module mod() { return mod; }
    public String name() { return name; }
    public String dirname() { return dirname; }
    public Map<String,Source> sources() { return sources; }
    public Map<String,File> artifacts() { return artifacts; }
    public PubApi getPubApi() { return pubApi; }

    public Map<String,Set<String>> typeDependencies() { return dependencies; }
    public Map<String,Set<String>> typeClasspathDependencies() { return cpDependencies; }

    public Set<String> dependents() { return dependents; }

    public boolean equals(Object o) {
        return (o instanceof Package) && name.equals(((Package)o).name);

    public int hashCode() {
        return name.hashCode();

    public int compareTo(Package o) {
        return name.compareTo(o.name);

    public void addSource(Source s) {
        sources.put(s.file().getPath(), s);

    private static Pattern DEP_PATTERN = Pattern.compile("(.*) -> (.*)");
    public void parseAndAddDependency(String d, boolean cp) {
        Matcher m = DEP_PATTERN.matcher(d);
        if (!m.matches())
            throw new IllegalArgumentException("Bad dependency string: " + d);
        addDependency(m.group(1), m.group(2), cp);

    public void addDependency(String fullyQualifiedFrom,
                              String fullyQualifiedTo,
                              boolean cp) {
        Map<String, Set<String>> map = cp ? cpDependencies : dependencies;
        if (!map.containsKey(fullyQualifiedFrom))
            map.put(fullyQualifiedFrom, new HashSet<>());

    public void addDependent(String d) {

     * Check if we have knowledge in the javac state that
     * describe the results of compiling this package before.
    public boolean existsInJavacState() {
        return artifacts.size() > 0 || !pubApi.isEmpty();

    public boolean hasPubApiChanged(PubApi newPubApi) {
        return !newPubApi.isBackwardCompatibleWith(pubApi);

    public void setPubapi(PubApi newPubApi) {
        pubApi = newPubApi;

    public void setDependencies(Map<String, Set<String>> ds, boolean cp) {
        (cp ? cpDependencies : dependencies).clear();
        for (String fullyQualifiedFrom : ds.keySet())
            for (String fullyQualifiedTo : ds.get(fullyQualifiedFrom))
                addDependency(fullyQualifiedFrom, fullyQualifiedTo, cp);

    public void save(StringBuilder b) {
        b.append("P ").append(name).append("\n");
        Source.saveSources(sources, b);

    static public Package load(Module module, String l) {
        String name = l.substring(2);
        return new Package(module, name);

    public void saveDependencies(StringBuilder b) {

        // Dependencies where *to* is among sources
        for (String fullyQualifiedFrom : dependencies.keySet()) {
            for (String fullyQualifiedTo : dependencies.get(fullyQualifiedFrom)) {
                b.append(String.format("D S %s -> %s%n", fullyQualifiedFrom, fullyQualifiedTo));

        // Dependencies where *to* is on class path
        for (String fullyQualifiedFrom : cpDependencies.keySet()) {
            for (String fullyQualifiedTo : cpDependencies.get(fullyQualifiedFrom)) {
                b.append(String.format("D C %s -> %s%n", fullyQualifiedFrom, fullyQualifiedTo));

    public void savePubapi(StringBuilder b) {
              .flatMap(l -> Stream.of("I ", l, "\n"))

    public static void savePackages(Map<String,Package> packages, StringBuilder b) {
        List<String> sorted_packages = new ArrayList<>();
        for (String key : packages.keySet() ) {
        for (String s : sorted_packages) {
            Package p = packages.get(s);

    public void addArtifact(String a) {
        artifacts.put(a, new File(a));

    public void addArtifact(File f) {
        artifacts.put(f.getPath(), f);

    public void addArtifacts(Set<URI> as) {
        for (URI u : as) {
            addArtifact(new File(u));

    public void setArtifacts(Set<URI> as) {
        artifacts = new HashMap<>();

    public void loadArtifact(String l) {
        // Find next space after "A ".
        int dp = l.indexOf(' ',2);
        String fn = l.substring(2,dp);
        long last_modified = Long.parseLong(l.substring(dp+1));
        File f = new File(fn);
        if (f.exists() && f.lastModified() != last_modified) {
            // Hmm, the artifact on disk does not have the same last modified
            // timestamp as the information from the build database.
            // We no longer trust the artifact on disk. Delete it.
            // The smart javac wrapper will then rebuild the artifact.
            Log.debug("Removing "+f.getPath()+" since its timestamp does not match javac_state.");
        artifacts.put(f.getPath(), f);

    public void saveArtifacts(StringBuilder b) {
        List<File> sorted_artifacts = new ArrayList<>();
        for (File f : artifacts.values()) {
        for (File f : sorted_artifacts) {
            // The last modified information is only used
            // to detect tampering with the output dir.
            // If the outputdir has been modified, not by javac,
            // then a mismatch will be detected in the last modified
            // timestamps stored in the build database compared
            // to the timestamps on disk and the artifact will be deleted.

            b.append("A "+f.getPath()+" "+f.lastModified()+"\n");

     * Always clean out a tainted package before it is recompiled.
    public void deleteArtifacts() {
        for (File a : artifacts.values()) {



Or download all of them as a single archive file:

File name: jdk.compiler-11.0.1-src.zip
File size: 1347269 bytes
Release date: 2018-11-04


JDK 11 jdk.crypto.cryptoki.jmod - Crypto KI Module

JDK 11 jdk.charsets.jmod - Charsets Module

Download and Use JDK 11

⇑⇑ FAQ for JDK (Java Development Kit)

2020-08-13, 64025👍, 0💬