APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.tools.javac.launcher

public final Record ProgramDescriptor

extends Record
Class Inheritance
Record Components
fileObject:ProgramFileObject 
packageName:Optional<String> 
qualifiedTypeNames:List<String> 
sourceRootPath:Path 
Imports
com.sun.source.tree.ClassTree, com.sun.tools.javac.api.JavacTool, com.sun.tools.javac.resources.LauncherProperties.Errors, java.io.File, .IOException, .UncheckedIOException, java.lang.module.InvalidModuleDescriptorException, java.nio.file.Files, .Path, java.util.ArrayList, .List, .Optional, .Set, .TreeSet, java.util.stream.Collectors, .Stream, javax.lang.model.SourceVersion

Describes a launch-able Java compilation unit.

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.

Field Summary

Modifier and TypeField and Description
private final ProgramFileObject
fileObject

Record Component accessed by fileObject().

private final Optional<String>
packageName

Record Component accessed by packageName().

private final List<String>
qualifiedTypeNames

Record Component accessed by qualifiedTypeNames().

private final Path
sourceRootPath

Record Component accessed by sourceRootPath().

Constructor Summary

AccessConstructor and Description
public
ProgramDescriptor(ProgramFileObject fileObject, Optional<String> packageName, List<String> qualifiedTypeNames, Path sourceRootPath)

Method Summary

Modifier and TypeMethod and Description
public Set<String>
public static Path
computeSourceRootPath(Path program, String packageName)

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

private static Set<String>
public ProgramFileObject
fileObject()

Record Component getter of fileObject.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

private static boolean
isHidden(Path file)

Returns true if the given file exists and is a hidden file

public boolean
pack-priv static ProgramDescriptor
of(ProgramFileObject fileObject)

public Optional<String>
packageName()

Record Component getter of packageName.

public List<String>
qualifiedTypeNames()

Record Component getter of qualifiedTypeNames.

public Path
sourceRootPath()

Record Component getter of sourceRootPath.

private static Optional<String>
toPackageName(Path file, String separator)

Maps the relative path of an entry in an exploded module to a package name.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

fileObjectback to summary
private final ProgramFileObject fileObject

Record Component accessed by fileObject().

packageNameback to summary
private final Optional<String> packageName

Record Component accessed by packageName().

qualifiedTypeNamesback to summary
private final List<String> qualifiedTypeNames

Record Component accessed by qualifiedTypeNames().

sourceRootPathback to summary
private final Path sourceRootPath

Record Component accessed by sourceRootPath().

Constructor Detail

ProgramDescriptorback to summary
public ProgramDescriptor(ProgramFileObject fileObject, Optional<String> packageName, List<String> qualifiedTypeNames, Path sourceRootPath)

Method Detail

computePackageNamesback to summary
public Set<String> computePackageNames()
computeSourceRootPathback to summary
public static Path computeSourceRootPath(Path program, String packageName) throws Fault
equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
explodedPackagesback to summary
private static Set<String> explodedPackages(Path dir)
fileObjectback to summary
public ProgramFileObject fileObject()

Record Component getter of fileObject.

hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

isHiddenback to summary
private static boolean isHidden(Path file)

Returns true if the given file exists and is a hidden file

isModularback to summary
public boolean isModular()
ofback to summary
pack-priv static ProgramDescriptor of(ProgramFileObject fileObject) throws Fault
packageNameback to summary
public Optional<String> packageName()

Record Component getter of packageName.

qualifiedTypeNamesback to summary
public List<String> qualifiedTypeNames()

Record Component getter of qualifiedTypeNames.

sourceRootPathback to summary
public Path sourceRootPath()

Record Component getter of sourceRootPath.

toPackageNameback to summary
private static Optional<String> toPackageName(Path file, String separator)

Maps the relative path of an entry in an exploded module to a package name.

Exceptions
InvalidModuleDescriptorException:
if the name is a class file in the top-level directory (and it's not module-info.class)
toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.