saker.java.compiler Documentation TaskDoc JavaDoc Packages
public interface ClassPathEntry
Represents a classpath entry that is enclosed in a classpath reference.

The classpath entry is the extension point for defining custom classpaths. The entry provides access to the backing file of the classpath, as well to other transitive classpaths, and related meta-data.

Clients should implement this interface. When doing so, make sure to adhere to the hashCode() and equals(Object) contract. Implementations should also implement the Externalizable interface.

Methods
public boolean
Indicates whether some other object is "equal to" this one.
public default Object
Gets the ABI version key of the classpath.
public default Collection<extends ClassPathReference>
Gets the additional classpaths which are transitively included by this entry.
public default String
Gets the display name for this classpath entry.
public default StructuredTaskResult
Gets a task result object that specifies the documentation attachment to the classpath.
public FileLocation
Use getInputFile() instead. Implement ClassPathEntryInputFileVisitor to perform an appropriate action based on the classpath file type.
public default Object
Gets the implementation version key of the classpath.
public default ClassPathEntryInputFile
Gets the input file of this classpath entry.
public default StructuredTaskResult
Gets a task result object that specifies the source attachment to the classpath.
public default Collection<extends JavaSourceDirectory>
Gets the source directories that are associated with the classpath.
public int
Returns a hash code value for the object.
public default boolean
Checks if the file location of this classpath may be considered static.
public abstract boolean equals(Object obj)
Overridden from: Object
Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values x and y, this method returns true if and only if x and y refer to the same object (x == y has the value true).

Note that it is generally necessary to override the hashCode method whenever this method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes.

objthe reference object with which to compare.
true if this object is the same as the obj argument; false otherwise.
public default Object getAbiVersionKey()
Gets the ABI version key of the classpath.

An ABI version key is an arbitrary object that implements Object.equals(Object) and defines the current version of the ABI of the classpath.

In general, if the ABI version key of a classpath changes, the dependent code needs to be recompiled.

The ABI version key should include the signatures of the classes available in the (non-transitive) classpath, but shouldn't include the method implementations and other non-signature code.

This method has a default implementation that returns null, since saker.java.compiler version 0.8.5.

The ABI version key or null if none.
Gets the additional classpaths which are transitively included by this entry.

The returned collection specifies the transitive classpaths that this entry automatically includes.

This method has a default implementation that returns null, since saker.java.compiler version 0.8.5.

The additional classpaths or null if none.
public default String getDisplayName()
Gets the display name for this classpath entry.

The display name is purely for informational purposes, and is generally used in error messages or in the IDE when IDE configurations are applied. They should be short, human readable, and identify the classpath entry in some way.

The display name or null if none.
saker.java.compiler 0.8.6
Gets a task result object that specifies the documentation attachment to the classpath.

The returned structured task result should be a SakerPath which points to an execution file location or a FileLocation.

This is used to configure IDE project with the documentation of a classpath for better code assistance.

The documentation attachment task result or null if none.
Use getInputFile() instead. Implement ClassPathEntryInputFileVisitor to perform an appropriate action based on the classpath file type.
Gets the classpath file location.

The file may be a JAR, or class directory. The interface doesn't specify a restriction on its nature.

The location of the classpath file.
Gets the implementation version key of the classpath.

An implementation version key is an arbitrary object that implements Object.equals(Object) and defines the current version of the implementation of the classpath.

In general, if the implementation version key of a classpath changes, the dependent code needs to be re-executed or recompiled.

The implementation version key should include all aspects of the class files available in the (non-transitive) classpath.

This method has a default implementation that returns null, since saker.java.compiler version 0.8.5.

The implementation version key or null if none.
Gets the input file of this classpath entry.

The input file contains the necessary class files of this classpath entry. The entry may refer to class directories, or archives, in a configuration dependent way.

Implement a custom ClassPathEntryInputFileVisitor to examine the returned input file.

The input file of the classpath entry.
saker.java.compiler 0.8.4
Gets a task result object that specifies the source attachment to the classpath.

The returned structured task result should be a SakerPath which points to an execution file location or a FileLocation.

This is used to configure IDE project with the sources of a classpath for better code assistance.

The source attachment task result or null if none.
Gets the source directories that are associated with the classpath.

This is usually used to configure IDE projects appropriately. It can be useful to add a classpath as an source directory to the IDE project rather than a JAR or class directory as it can provide better documentation assistance to the developer.

This method has a default implementation that returns null, since saker.java.compiler version 0.8.5.

The source directories that are directly associated with the classpath or null if none.
public abstract int hashCode()
Overridden from: Object
Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the Object.equals(Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the Java™ programming language.)

a hash code value for this object.
public default boolean isStaticFile()
Checks if the file location of this classpath may be considered static.

A static classpath is one that doesn't change during the lifetime of the enclosing build environment. The files of a static classpath will not be attempted to be modified by other agents on the same computer. If the classpath represents a directory, then the enclosed files in the directory mustn't change. If it is a JAR, or other archive, then the file itself mustn't change.

If a classpath is static, that means that the users of the classpath are allowed to load the files of the classpath directly from its location and doesn't need to copy it elsewhere. As the classpath is opened, modifications may be blocked to them by the operating system.

E.g. if a static JAR path is opened by the build environment, and the user attempts to delete, rename, modify, or otherwise manipulate the JAR, then it may fail, as the build environment loaded it.

In order to modify static classpaths, the user may need to reload the build environment. If that is distruptive to the normal workflow, then the classpath shouldn't be considered static.

An example for static classpaths are classpaths from SDKs, artifacts from repositories, and others. These are expected to not be modified after they've been published.

Using static classpaths can improve performance as various tasks may not need to cache them in an off-site location, but can use them in-place as that doesn't distrupt the workflow.

true if the classpath is static.
saker.java.compiler 0.8.1