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(
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< | 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< | Gets the source directories that are associated with the classpath. |
public int | hashCode() Returns a hash code value for the object. |
public default boolean | Checks if the file location of this classpath may be considered static. |
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 returntrue
. - It is symmetric: for any non-null reference values
x
andy
,x.equals(y)
should returntrue
if and only ify.equals(x)
returnstrue
. - It is transitive: for any non-null reference values
x
,y
, andz
, ifx.equals(y)
returnstrue
andy.equals(z)
returnstrue
, thenx.equals(z)
should returntrue
. - It is consistent: for any non-null reference values
x
andy
, multiple invocations ofx.equals(y)
consistently returntrue
or consistently returnfalse
, provided no information used inequals
comparisons on the objects is modified. - For any non-null reference value
x
,x.equals(null)
should returnfalse
.
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.
true
if this object is the same as the obj argument; false
otherwise.
An ABI version key is an arbitrary object that implements Object.equals(
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.
null
if none.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.
null
if none.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.
null
if none.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.
null
if none.The file may be a JAR, or class directory. The interface doesn't specify a restriction on its nature.
An implementation version key is an arbitrary object that implements Object.equals(
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.
null
if none.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 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.
null
if none.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.
null
if none.
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 inequals
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 thehashCode
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 thehashCode
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 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.