Class ClasspathEntry
- All Implemented Interfaces:
IClasspathEntry
- See Also:
IClasspathEntry
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionint
Describes the kind of package fragment roots found on this classpath entry - either K_BINARY or K_SOURCE or K_OUTPUT.static String
int
Describes the kind of classpath entry - one of CPE_PROJECT, CPE_LIBRARY, CPE_SOURCE, CPE_VARIABLE or CPE_CONTAINERstatic org.eclipse.core.runtime.IPath[]
The extra attributesstatic org.eclipse.core.runtime.IPath[]
boolean
The export flagstatic int
A constant indicating an output location.static IAccessRule[]
static ClasspathEntry[]
static IClasspathAttribute[]
org.eclipse.core.runtime.IPath
The meaning of the path of a classpath entry depends on its entry kind: Source code in the current project (CPE_SOURCE
) - The path associated with this entry is the absolute path to the root folder.org.eclipse.core.runtime.IPath
Describes the path to the source archive associated with this classpath entry, ornull
if this classpath entry has no source attachment.org.eclipse.core.runtime.IPath
Describes the path within the source archive where package fragments are located.org.eclipse.core.runtime.IPath
Specific output location (for this source entry)static String
static String
static String
static String
static String
static String
static String
static String
static String
static String
static String
static String
static String
static String
static String
static String
static String
static String
static String
static String
static String
static String
static String
Fields inherited from interface org.aspectj.org.eclipse.jdt.core.IClasspathEntry
CPE_CONTAINER, CPE_LIBRARY, CPE_PROJECT, CPE_SOURCE, CPE_VARIABLE
-
Constructor Summary
ConstructorDescriptionClasspathEntry(int contentKind, int entryKind, org.eclipse.core.runtime.IPath path, org.eclipse.core.runtime.IPath[] inclusionPatterns, org.eclipse.core.runtime.IPath[] exclusionPatterns, org.eclipse.core.runtime.IPath sourceAttachmentPath, org.eclipse.core.runtime.IPath sourceAttachmentRootPath, org.eclipse.core.runtime.IPath specificOutputLocation, boolean isExported, IAccessRule[] accessRules, boolean combineAccessRules, IClasspathAttribute[] extraAttributes)
ClasspathEntry(int contentKind, int entryKind, org.eclipse.core.runtime.IPath path, org.eclipse.core.runtime.IPath[] inclusionPatterns, org.eclipse.core.runtime.IPath[] exclusionPatterns, org.eclipse.core.runtime.IPath sourceAttachmentPath, org.eclipse.core.runtime.IPath sourceAttachmentRootPath, org.eclipse.core.runtime.IPath specificOutputLocation, IClasspathEntry referencingEntry, boolean isExported, IAccessRule[] accessRules, boolean combineAccessRules, IClasspathAttribute[] extraAttributes)
Creates a class path entry of the specified kind with the given path. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns whether the access rules of the project's exported entries should be combined with this entry's access rules.combineWith(ClasspathEntry referringEntry)
Used to perform export/restriction propagation across referring projects/containers.static IClasspathEntry
elementDecode(Element element, IJavaProject project, Map unknownElements)
void
elementEncode(org.aspectj.org.eclipse.jdt.internal.core.XMLWriter writer, org.eclipse.core.runtime.IPath projectPath, boolean indent, boolean newLine, Map unknownElements, boolean isReferencedEntry)
Returns the XML encoding of the class path.boolean
Returns true if the given object is a classpath entry with equivalent attributes.char[][]
char[][]
Returns the possibly empty list of access rules for this entry.static IAccessRule[]
getAccessRules(org.eclipse.core.runtime.IPath[] accessibleFiles, org.eclipse.core.runtime.IPath[] nonAccessibleFiles)
static NodeList
getChildAttributes(String childName, NodeList children, boolean[] foundChildren)
int
Returns the kind of files found in the package fragments identified by this classpath entry.int
Returns the kind of this classpath entry.org.eclipse.core.runtime.IPath[]
Returns the set of patterns used to exclude resources or classes associated with this classpath entry.static org.eclipse.core.runtime.IPath
getExternalAnnotationPath(IClasspathEntry entry, org.eclipse.core.resources.IProject project, boolean resolve)
Internal API: answer the path for external annotations (for null analysis) associated with the given classpath entry.static String
getExtraAttribute(IClasspathEntry entry, String attributeName)
Returns the extra classpath attributes for this classpath entry.org.eclipse.core.runtime.IPath[]
Returns the set of patterns used to explicitly define resources or classes to be included with this classpath entry.This function computes the URL of the index location for this classpath entry.org.eclipse.core.runtime.IPath
Returns the full path to the specific location where the builder writes.class
files generated for this source entry (entry kindIClasspathEntry.CPE_SOURCE
).org.eclipse.core.runtime.IPath
getPath()
Returns the path of this classpath entry.Returns the classpath entry that is making a reference to this classpath entry.Deprecated.org.eclipse.core.runtime.IPath
Returns the path to the source archive or folder associated with this classpath entry, ornull
if this classpath entry has no source attachment.org.eclipse.core.runtime.IPath
Returns the path within the source archive or folder where package fragments are located.static boolean
hasDotDot(org.eclipse.core.runtime.IPath path)
int
hashCode()
Returns the hash code for this classpath entryboolean
boolean
Returns whether this entry is exported to dependent projects.boolean
boolean
static org.eclipse.core.runtime.IPath[]
resolvedChainedLibraries(org.eclipse.core.runtime.IPath jarPath)
resolvedDotDot(org.eclipse.core.runtime.IPath reference)
static org.eclipse.core.runtime.IPath
resolveDotDot(org.eclipse.core.runtime.IPath reference, org.eclipse.core.runtime.IPath path)
rootID()
Answers an ID which is used to distinguish entries during package fragment root computationsstatic void
setSharedIndexLocation(String value, Class<?> clazz)
toString()
Returns a printable representation of this classpath entry.static IJavaModelStatus
validateClasspath(IJavaProject javaProject, IClasspathEntry[] rawClasspath, org.eclipse.core.runtime.IPath projectOutputLocation)
Validate a given classpath and output location for a project, using the following rules: Classpath entries cannot collide with each other; that is, all entry paths must be unique.static IJavaModelStatus
validateClasspathEntry(IJavaProject project, IClasspathEntry entry, boolean checkSourceAttachment, boolean referredByContainer)
Returns a Java model status describing the problem related to this classpath entry if any, a status object with codeIStatus.OK
if the entry is fine (that is, if the given classpath entry denotes a valid element to be referenced onto a classpath).withExtraAttributeRemoved(String attrName)
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.aspectj.org.eclipse.jdt.core.IClasspathEntry
isTest, isWithoutTestCode
-
Field Details
-
TAG_CLASSPATH
- See Also:
- Constant Field Values
-
TAG_CLASSPATHENTRY
- See Also:
- Constant Field Values
-
TAG_REFERENCED_ENTRY
- See Also:
- Constant Field Values
-
TAG_OUTPUT
- See Also:
- Constant Field Values
-
TAG_KIND
- See Also:
- Constant Field Values
-
TAG_PATH
- See Also:
- Constant Field Values
-
TAG_SOURCEPATH
- See Also:
- Constant Field Values
-
TAG_ROOTPATH
- See Also:
- Constant Field Values
-
TAG_EXPORTED
- See Also:
- Constant Field Values
-
TAG_INCLUDING
- See Also:
- Constant Field Values
-
TAG_EXCLUDING
- See Also:
- Constant Field Values
-
TAG_ATTRIBUTES
- See Also:
- Constant Field Values
-
TAG_ATTRIBUTE
- See Also:
- Constant Field Values
-
TAG_ATTRIBUTE_NAME
- See Also:
- Constant Field Values
-
TAG_ATTRIBUTE_VALUE
- See Also:
- Constant Field Values
-
TAG_COMBINE_ACCESS_RULES
- See Also:
- Constant Field Values
-
TAG_ACCESS_RULES
- See Also:
- Constant Field Values
-
TAG_ACCESS_RULE
- See Also:
- Constant Field Values
-
TAG_PATTERN
- See Also:
- Constant Field Values
-
TAG_ACCESSIBLE
- See Also:
- Constant Field Values
-
TAG_NON_ACCESSIBLE
- See Also:
- Constant Field Values
-
TAG_DISCOURAGED
- See Also:
- Constant Field Values
-
TAG_IGNORE_IF_BETTER
- See Also:
- Constant Field Values
-
entryKind
public int entryKindDescribes the kind of classpath entry - one of CPE_PROJECT, CPE_LIBRARY, CPE_SOURCE, CPE_VARIABLE or CPE_CONTAINER -
contentKind
public int contentKindDescribes the kind of package fragment roots found on this classpath entry - either K_BINARY or K_SOURCE or K_OUTPUT. -
path
public org.eclipse.core.runtime.IPath pathThe meaning of the path of a classpath entry depends on its entry kind:- Source code in the current project (
CPE_SOURCE
) - The path associated with this entry is the absolute path to the root folder. - A binary library in the current project (
CPE_LIBRARY
) - the path associated with this entry is the absolute path to the JAR (or root folder), and in case it refers to an external JAR, then there is no associated resource in the workbench. - A required project (
CPE_PROJECT
) - the path of the entry denotes the path to the corresponding project resource. - A variable entry (
CPE_VARIABLE
) - the first segment of the path is the name of a classpath variable. If this classpath variable is bound to the pathP , the path of the corresponding classpath entry is computed by appending toP the segments of the returned path without the variable. - A container entry (
CPE_CONTAINER
) - the first segment of the path is denoting the unique container identifier (for which aClasspathContainerInitializer
could be registered), and the remaining segments are used as additional hints for resolving the container entry to an actualIClasspathContainer
.
- Source code in the current project (
-
NO_ENTRIES
-
INCLUDE_ALL
public static final org.eclipse.core.runtime.IPath[] INCLUDE_ALL -
EXCLUDE_NONE
public static final org.eclipse.core.runtime.IPath[] EXCLUDE_NONE -
NO_EXTRA_ATTRIBUTES
-
NO_ACCESS_RULES
-
sourceAttachmentPath
public org.eclipse.core.runtime.IPath sourceAttachmentPathDescribes the path to the source archive associated with this classpath entry, ornull
if this classpath entry has no source attachment.Only library and variable classpath entries may have source attachments. For library classpath entries, the result path (if present) locates a source archive. For variable classpath entries, the result path (if present) has an analogous form and meaning as the variable path, namely the first segment is the name of a classpath variable.
-
sourceAttachmentRootPath
public org.eclipse.core.runtime.IPath sourceAttachmentRootPathDescribes the path within the source archive where package fragments are located. An empty path indicates that packages are located at the root of the source archive. Returns a non-null
value if and only ifgetSourceAttachmentPath
returns a non-null
value. -
referencingEntry
-
specificOutputLocation
public org.eclipse.core.runtime.IPath specificOutputLocationSpecific output location (for this source entry) -
K_OUTPUT
public static final int K_OUTPUTA constant indicating an output location.- See Also:
- Constant Field Values
-
DOT_DOT
- See Also:
- Constant Field Values
-
isExported
public boolean isExportedThe export flag -
extraAttributes
The extra attributes
-
-
Constructor Details
-
ClasspathEntry
public ClasspathEntry(int contentKind, int entryKind, org.eclipse.core.runtime.IPath path, org.eclipse.core.runtime.IPath[] inclusionPatterns, org.eclipse.core.runtime.IPath[] exclusionPatterns, org.eclipse.core.runtime.IPath sourceAttachmentPath, org.eclipse.core.runtime.IPath sourceAttachmentRootPath, org.eclipse.core.runtime.IPath specificOutputLocation, boolean isExported, IAccessRule[] accessRules, boolean combineAccessRules, IClasspathAttribute[] extraAttributes) -
ClasspathEntry
public ClasspathEntry(int contentKind, int entryKind, org.eclipse.core.runtime.IPath path, org.eclipse.core.runtime.IPath[] inclusionPatterns, org.eclipse.core.runtime.IPath[] exclusionPatterns, org.eclipse.core.runtime.IPath sourceAttachmentPath, org.eclipse.core.runtime.IPath sourceAttachmentRootPath, org.eclipse.core.runtime.IPath specificOutputLocation, IClasspathEntry referencingEntry, boolean isExported, IAccessRule[] accessRules, boolean combineAccessRules, IClasspathAttribute[] extraAttributes)Creates a class path entry of the specified kind with the given path.
-
-
Method Details
-
combineAccessRules
public boolean combineAccessRules()Description copied from interface:IClasspathEntry
Returns whether the access rules of the project's exported entries should be combined with this entry's access rules. Returns true for container entries. Returns false otherwise.- Specified by:
combineAccessRules
in interfaceIClasspathEntry
- Returns:
- whether the access rules of the project's exported entries should be combined with this entry's access rules
-
combineWith
Used to perform export/restriction propagation across referring projects/containers. Also: propagating extraAttributes. -
withExtraAttributeRemoved
-
fullExclusionPatternChars
public char[][] fullExclusionPatternChars() -
fullInclusionPatternChars
public char[][] fullInclusionPatternChars() -
elementEncode
public void elementEncode(org.aspectj.org.eclipse.jdt.internal.core.XMLWriter writer, org.eclipse.core.runtime.IPath projectPath, boolean indent, boolean newLine, Map unknownElements, boolean isReferencedEntry)Returns the XML encoding of the class path. -
elementDecode
public static IClasspathEntry elementDecode(Element element, IJavaProject project, Map unknownElements) -
hasDotDot
public static boolean hasDotDot(org.eclipse.core.runtime.IPath path) -
getChildAttributes
-
resolvedChainedLibraries
public static org.eclipse.core.runtime.IPath[] resolvedChainedLibraries(org.eclipse.core.runtime.IPath jarPath) -
resolveDotDot
public static org.eclipse.core.runtime.IPath resolveDotDot(org.eclipse.core.runtime.IPath reference, org.eclipse.core.runtime.IPath path) -
equals
Returns true if the given object is a classpath entry with equivalent attributes. -
getAccessRules
Description copied from interface:IClasspathEntry
Returns the possibly empty list of access rules for this entry.- Specified by:
getAccessRules
in interfaceIClasspathEntry
- Returns:
- the possibly empty list of access rules for this entry
- See Also:
IClasspathEntry.getAccessRules()
-
getAccessRuleSet
-
getContentKind
public int getContentKind()Description copied from interface:IClasspathEntry
Returns the kind of files found in the package fragments identified by this classpath entry.- Specified by:
getContentKind
in interfaceIClasspathEntry
- Returns:
IPackageFragmentRoot.K_SOURCE
for files containing source code, andIPackageFragmentRoot.K_BINARY
for binary class files. There is no specified value for an entry denoting a variable (IClasspathEntry.CPE_VARIABLE
) or a classpath container (IClasspathEntry.CPE_CONTAINER
).- See Also:
IClasspathEntry
-
getEntryKind
public int getEntryKind()Description copied from interface:IClasspathEntry
Returns the kind of this classpath entry.- Specified by:
getEntryKind
in interfaceIClasspathEntry
- Returns:
- one of:
IClasspathEntry.CPE_SOURCE
- this entry describes a source root in its projectIClasspathEntry.CPE_LIBRARY
- this entry describes a folder or JAR containing binariesIClasspathEntry.CPE_PROJECT
- this entry describes another projectIClasspathEntry.CPE_VARIABLE
- this entry describes a project or library indirectly via a classpath variable in the first segment of the path *IClasspathEntry.CPE_CONTAINER
- this entry describes set of entries referenced indirectly via a classpath container
- See Also:
IClasspathEntry
-
getExclusionPatterns
public org.eclipse.core.runtime.IPath[] getExclusionPatterns()Description copied from interface:IClasspathEntry
Returns the set of patterns used to exclude resources or classes associated with this classpath entry.For source classpath entries, exclusion patterns allow specified portions of the resource tree rooted at this source entry's path to be filtered out. If no exclusion patterns are specified, this source entry includes all relevent files. Each path specified must be a relative path, and will be interpreted relative to this source entry's path. File patterns are case-sensitive. A file matched by one or more of these patterns is excluded from the corresponding package fragment root. Exclusion patterns have higher precedence than inclusion patterns; in other words, exclusion patterns can remove files for the ones that are to be included, not the other way around.
Note that there is no need to supply a pattern to exclude ".class" files because a source entry filters these out automatically.
The pattern mechanism is similar to Ant's. Each pattern is represented as a relative path. The path segments can be regular file or folder names or simple patterns involving standard wildcard characters.
'*' matches 0 or more characters within a segment. So
*.java
matches.java
,a.java
andFoo.java
, but notFoo.properties
(does not end with.java
).'?' matches 1 character within a segment. So
?.java
matchesa.java
,A.java
, but not.java
orxyz.java
(neither have just one character before.java
).Combinations of *'s and ?'s are allowed.
The special pattern '**' matches zero or more segments. In a source entry, a path like
tests/
that ends in a trailing separator is interpreted astests/**
, and would match everything under the folder namedtests
.Example patterns in source entries (assuming that "java" is the only
Java-like extension
):-
tests/**
(or simplytests/
) matches all files under a root folder namedtests
. This includestests/Foo.java
andtests/com/example/Foo.java
, but notcom/example/tests/Foo.java
(not under a root folder namedtests
). -
tests/*
matches all files directly below a root folder namedtests
. This includestests/Foo.java
andtests/FooHelp.java
but nottests/com/example/Foo.java
(not directly under a folder namedtests
) orcom/Foo.java
(not under a folder namedtests
). -
**/tests/**
matches all files under any folder namedtests
. This includestests/Foo.java
,com/examples/tests/Foo.java
, andcom/examples/tests/unit/Foo.java
, but notcom/example/Foo.java
(not under a folder namedtests
).
- Specified by:
getExclusionPatterns
in interfaceIClasspathEntry
- Returns:
- the possibly empty list of resource exclusion patterns
associated with this classpath entry, or
null
if this kind of classpath entry does not support exclusion patterns - See Also:
IClasspathEntry.getExclusionPatterns()
-
-
getExtraAttributes
Description copied from interface:IClasspathEntry
Returns the extra classpath attributes for this classpath entry. Returns an empty array if this entry has no extra attributes.- Specified by:
getExtraAttributes
in interfaceIClasspathEntry
- Returns:
- the possibly empty list of extra classpath attributes for this classpath entry
-
getInclusionPatterns
public org.eclipse.core.runtime.IPath[] getInclusionPatterns()Description copied from interface:IClasspathEntry
Returns the set of patterns used to explicitly define resources or classes to be included with this classpath entry.For source classpath entries, when no inclusion patterns are specified, the source entry includes all relevent files in the resource tree rooted at this source entry's path. Specifying one or more inclusion patterns means that only the specified portions of the resource tree are to be included. Each path specified must be a relative path, and will be interpreted relative to this source entry's path. File patterns are case-sensitive. A file matched by one or more of these patterns is included in the corresponding package fragment root unless it is excluded by one or more of this entrie's exclusion patterns. Exclusion patterns have higher precedence than inclusion patterns; in other words, exclusion patterns can remove files for the ones that are to be included, not the other way around.
See
IClasspathEntry.getExclusionPatterns()
for a discussion of the syntax and semantics of path patterns. The absence of any inclusion patterns is semantically equivalent to the explicit inclusion pattern**
.Example patterns in source entries:
-
The inclusion pattern
src/**
by itself includes all files under a root folder namedsrc
. -
The inclusion patterns
src/**
andtests/**
includes all files under the root folders namedsrc
andtests
. -
The inclusion pattern
src/**
together with the exclusion patternsrc/**/Foo.java
includes all files under a root folder namedsrc
except for ones namedFoo.java
.
- Specified by:
getInclusionPatterns
in interfaceIClasspathEntry
- Returns:
- the possibly empty list of resource inclusion patterns
associated with this classpath entry, or
null
if this kind of classpath entry does not support inclusion patterns - See Also:
IClasspathEntry.getExclusionPatterns()
-
The inclusion pattern
-
getOutputLocation
public org.eclipse.core.runtime.IPath getOutputLocation()Description copied from interface:IClasspathEntry
Returns the full path to the specific location where the builder writes.class
files generated for this source entry (entry kindIClasspathEntry.CPE_SOURCE
).Source entries can optionally be associated with a specific output location. If none is provided, the source entry will be implicitly associated with its project default output location (see
IJavaProject.getOutputLocation()
).NOTE: A specific output location cannot coincidate with another source/library entry.
- Specified by:
getOutputLocation
in interfaceIClasspathEntry
- Returns:
- the full path to the specific location where the builder writes
.class
files for this source entry, ornull
if using default output folder - See Also:
IClasspathEntry.getOutputLocation()
-
getPath
public org.eclipse.core.runtime.IPath getPath()Description copied from interface:IClasspathEntry
Returns the path of this classpath entry. The meaning of the path of a classpath entry depends on its entry kind:- Source code in the current project (
IClasspathEntry.CPE_SOURCE
) - The path associated with this entry is the absolute path to the root folder. - A binary library in the current project (
IClasspathEntry.CPE_LIBRARY
) - the path associated with this entry is the absolute path to the JAR (or root folder), and in case it refers to an external library, then there is no associated resource in the workbench. - A required project (
IClasspathEntry.CPE_PROJECT
) - the path of the entry denotes the path to the corresponding project resource. - A variable entry (
IClasspathEntry.CPE_VARIABLE
) - the first segment of the path is the name of a classpath variable. If this classpath variable is bound to the path P, the path of the corresponding classpath entry is computed by appending to P the segments of the returned path without the variable. - A container entry (
IClasspathEntry.CPE_CONTAINER
) - the path of the entry is the name of the classpath container, which can be bound indirectly to a set of classpath entries after resolution. The containerPath is a formed by a first ID segment followed with extra segments that can be used as additional hints for resolving this container reference (also seeIClasspathContainer
).
- Specified by:
getPath
in interfaceIClasspathEntry
- Returns:
- the path of this classpath entry
- See Also:
IClasspathEntry
- Source code in the current project (
-
getSourceAttachmentPath
public org.eclipse.core.runtime.IPath getSourceAttachmentPath()Description copied from interface:IClasspathEntry
Returns the path to the source archive or folder associated with this classpath entry, ornull
if this classpath entry has no source attachment.Only library and variable classpath entries may have source attachments. For library classpath entries, the result path (if present) locates a source archive or folder. This archive or folder can be located in a project of the workspace or outside the workspace. For variable classpath entries, the result path (if present) has an analogous form and meaning as the variable path, namely the first segment is the name of a classpath variable.
- Specified by:
getSourceAttachmentPath
in interfaceIClasspathEntry
- Returns:
- the path to the source archive or folder, or
null
if none - See Also:
IClasspathEntry
-
getSourceAttachmentRootPath
public org.eclipse.core.runtime.IPath getSourceAttachmentRootPath()Description copied from interface:IClasspathEntry
Returns the path within the source archive or folder where package fragments are located. An empty path indicates that packages are located at the root of the source archive or folder. Returns a non-null
value if and only ifIClasspathEntry.getSourceAttachmentPath()
returns a non-null
value.- Specified by:
getSourceAttachmentRootPath
in interfaceIClasspathEntry
- Returns:
- the path within the source archive or folder, or
null
if not applicable - See Also:
IClasspathEntry
-
getExternalAnnotationPath
public static org.eclipse.core.runtime.IPath getExternalAnnotationPath(IClasspathEntry entry, org.eclipse.core.resources.IProject project, boolean resolve)Internal API: answer the path for external annotations (for null analysis) associated with the given classpath entry. Four shapes of paths are supported:- relative, variable (VAR/relpath): resolve classpath variable VAR and append relpath
- relative, project (relpath): interpret relpath as a relative path within the given project
- absolute, workspace (/Proj/relpath): an absolute path in the workspace
- absolute, filesystem (/abspath): an absolute path in the filesystem
- Parameters:
entry
- classpath entry to work onproject
- project whose classpath we are analysingresolve
- if true, any workspace-relative paths will be resolved to filesystem paths.- Returns:
- a path (in the workspace or filesystem-absolute) or null
-
getExtraAttribute
-
getReferencingEntry
Description copied from interface:IClasspathEntry
Returns the classpath entry that is making a reference to this classpath entry. For entry kindsIClasspathEntry.CPE_LIBRARY
, the return value is the entry that is representing the JAR that includesthis
in the MANIFEST.MF file's Class-Path section. For entry kinds other thanIClasspathEntry.CPE_LIBRARY
, this returnsnull
. For those entries that are on the raw classpath already, this returnsnull
.It is possible that multiple library entries refer to the same entry via the MANIFEST.MF file. In those cases, this method returns the first classpath entry that appears in the raw classpath. However, this does not mean that the other referencing entries do not relate to their referenced entries. See
JavaCore.getReferencedClasspathEntries(IClasspathEntry, IJavaProject)
for more details.- Specified by:
getReferencingEntry
in interfaceIClasspathEntry
- Returns:
- the classpath entry that is referencing this entry or
null
if not applicable.
-
hashCode
public int hashCode()Returns the hash code for this classpath entry -
isExported
public boolean isExported()Description copied from interface:IClasspathEntry
Returns whether this entry is exported to dependent projects. Always returnsfalse
for source entries (kindIClasspathEntry.CPE_SOURCE
), which cannot be exported.- Specified by:
isExported
in interfaceIClasspathEntry
- Returns:
true
if exported, andfalse
otherwise- See Also:
IClasspathEntry.isExported()
-
isOptional
public boolean isOptional() -
isModular
public boolean isModular() -
getSourceAttachmentEncoding
-
getAccessRules
public static IAccessRule[] getAccessRules(org.eclipse.core.runtime.IPath[] accessibleFiles, org.eclipse.core.runtime.IPath[] nonAccessibleFiles) -
toString
Returns a printable representation of this classpath entry. -
resolvedDotDot
-
resolvedChainedLibraries
-
rootID
Answers an ID which is used to distinguish entries during package fragment root computations -
getResolvedEntry
Deprecated.Description copied from interface:IClasspathEntry
This is a helper method, which returns the resolved classpath entry denoted by an entry (if it is a variable entry). It is obtained by resolving the variable reference in the first segment. Returnsnull
if unable to resolve using the following algorithm:- if variable segment cannot be resolved, returns
null
- finds a project, JAR or binary folder in the workspace at the resolved path location
- if none finds an external JAR file or folder outside the workspace at the resolved path location
- if none returns
null
Variable source attachment is also resolved and recorded in the resulting classpath entry.
- Specified by:
getResolvedEntry
in interfaceIClasspathEntry
- Returns:
- the resolved library or project classpath entry, or
null
if the given path could not be resolved to a classpath entryNote that this deprecated API doesn't handle CPE_CONTAINER entries.
- See Also:
IClasspathEntry
- if variable segment cannot be resolved, returns
-
getLibraryIndexLocation
This function computes the URL of the index location for this classpath entry. It returns null if the URL is invalid. -
ignoreOptionalProblems
public boolean ignoreOptionalProblems() -
validateClasspath
public static IJavaModelStatus validateClasspath(IJavaProject javaProject, IClasspathEntry[] rawClasspath, org.eclipse.core.runtime.IPath projectOutputLocation)Validate a given classpath and output location for a project, using the following rules:- Classpath entries cannot collide with each other; that is, all entry paths must be unique.
- The project output location path cannot be null, must be absolute and located inside the project.
- Specific output locations (specified on source entries) can be null, if not they must be located inside the project,
- A project entry cannot refer to itself directly (that is, a project cannot prerequisite itself).
- Classpath entries or output locations cannot coincidate or be nested in each other, except for the following scenario listed below:
- A source folder can coincidate with its own output location, in which case this output can then contain library archives. However, a specific output location cannot coincidate with any library or a distinct source folder than the one referring to it.
- A source/library folder can be nested in any source folder as long as the nested folder is excluded from the enclosing one.
- An output location can be nested in a source folder, if the source folder coincidates with the project itself, or if the output location is excluded from the source folder.
This validation is intended to anticipate classpath issues prior to assigning it to a project. In particular, it will automatically be performed during the classpath setting operation (if validation fails, the classpath setting will not complete).
- Parameters:
javaProject
- the given java projectrawClasspath
- a given classpathprojectOutputLocation
- a given output location- Returns:
- a status object with code
IStatus.OK
if the given classpath and output location are compatible, otherwise a status object indicating what is wrong with the classpath or output location
-
validateClasspathEntry
public static IJavaModelStatus validateClasspathEntry(IJavaProject project, IClasspathEntry entry, boolean checkSourceAttachment, boolean referredByContainer)Returns a Java model status describing the problem related to this classpath entry if any, a status object with codeIStatus.OK
if the entry is fine (that is, if the given classpath entry denotes a valid element to be referenced onto a classpath).- Parameters:
project
- the given java projectentry
- the given classpath entrycheckSourceAttachment
- a flag to determine if source attachment should be checkedreferredByContainer
- flag indicating whether the given entry is referred by a classpath container- Returns:
- a java model status describing the problem related to this classpath entry if any, a status object with code
IStatus.OK
if the entry is fine
-