# Interface IClasspathAttribute

public interface IClasspathAttribute
A classpath attribute defines a name/value pair that can be persisted with a classpath entry. Such an attribute can be created using the factory method `newClasspathAttribute(String name, String value)`.

Since:
  3.1
See Also:
  - `JavaCore.newContainerEntry(org.eclipse.core.runtime.IPath containerPath, IAccessRule[] accessRules, IClasspathAttribute[] extraAttributes, boolean isExported)`
  - `JavaCore.newLibraryEntry(org.eclipse.core.runtime.IPath path, org.eclipse.core.runtime.IPath sourceAttachmentPath, org.eclipse.core.runtime.IPath sourceAttachmentRootPath, IAccessRule[] accessRules, IClasspathAttribute[] extraAttributes, boolean isExported)`
  - `JavaCore.newProjectEntry(org.eclipse.core.runtime.IPath path, IAccessRule[] accessRules, boolean combineAccessRestrictions, IClasspathAttribute[] extraAttributes, boolean isExported)`
  - `JavaCore.newSourceEntry(org.eclipse.core.runtime.IPath path, org.eclipse.core.runtime.IPath[] inclusionPatterns, org.eclipse.core.runtime.IPath[] exclusionPatterns, org.eclipse.core.runtime.IPath specificOutputLocation, IClasspathAttribute[] extraAttributes)`
  - `JavaCore.newVariableEntry(org.eclipse.core.runtime.IPath variablePath, org.eclipse.core.runtime.IPath variableSourceAttachmentPath, org.eclipse.core.runtime.IPath variableSourceAttachmentRootPath, IAccessRule[] accessRules, IClasspathAttribute[] extraAttributes, boolean isExported)`
Restriction:
  This interface is not intended to be implemented by clients.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`ADD_EXPORTS`
Constant for the name of the add-exports attribute.
`static final String`
`ADD_OPENS`
Constant for the name of the add-opens attribute.
`static final String`
`ADD_READS`
Constant for the name of the add-reads attribute.
`static final String`
`EXTERNAL_ANNOTATION_PATH`
Constant for the name of the external annotation path attribute.
`static final String`
`IGNORE_OPTIONAL_PROBLEMS`
Constant for the name of the ignore optional compile problems attribute.
`static final String`
`INDEX_LOCATION_ATTRIBUTE_NAME`
Constant for the name of the index location attribute.
`static final String`
`JAVADOC_LOCATION_ATTRIBUTE_NAME`
Constant for the name of the javadoc location attribute.
`static final String`
`LIMIT_MODULES`
Constant for the name of the limit-modules attribute.
`static final String`
`MODULE`
Constant for the name of the module attribute.
`static final String`
`MODULE_MAIN_CLASS`
Constant of the name of the module-main-class attribute.
`static final String`
`OPTIONAL`
Constant for the name of the optional attribute.
`static final String`
`PATCH_MODULE`
Constant for the name of the patch-module attribute.
`static final String`
`RELEASE`
Constant for the name of the release attribute.
`static final String`
`SOURCE_ATTACHMENT_ENCODING`
Constant for the name of the encoding to be used for source attachments.
`static final String`
`TEST`
Constant for the name of the test attribute.
`static final String`
`WITHOUT_TEST_CODE`
Constant for the name of the without_test_code attribute.

## Method Summary

Modifier and Type
Method
Description
`String`
`getName()`
Returns the name of this classpath attribute.
`String`
`getValue()`
Returns the value of this classpath attribute.

## Field Details

### JAVADOC_LOCATION_ATTRIBUTE_NAME

static final String JAVADOC_LOCATION_ATTRIBUTE_NAME
Constant for the name of the javadoc location attribute.

The value for this attribute has to be the string representation of a URL.

Since:
  3.1
See Also:
  - Constant Field Values

### INDEX_LOCATION_ATTRIBUTE_NAME

static final String INDEX_LOCATION_ATTRIBUTE_NAME
Constant for the name of the index location attribute.

The value for this attribute has to be the string representation of a URL. It should point to an existing index file in a folder or a jar. The URL can also be of platform protocol.

Since:
  3.8
See Also:
  - Constant Field Values

### SOURCE_ATTACHMENT_ENCODING

static final String SOURCE_ATTACHMENT_ENCODING
Constant for the name of the encoding to be used for source attachments.

The value of this attribute has to be a string representation of a valid encoding. The encoding for a source attachment is determined in the following order:

- Encoding explicitly set on the source file (java or zip), i.e. `org.eclipse.core.resources.IFile#getCharset(false)`
- Encoding set on the corresponding classpath entry
- If the source attachment is a folder, then the encoding determined by the file content if detectable
- If the source attachment is in the workspace, then the encoding of the enclosing resources

Since:
  3.8
See Also:
  - `IFile.getCharset()`
  - Constant Field Values

### IGNORE_OPTIONAL_PROBLEMS

static final String IGNORE_OPTIONAL_PROBLEMS
Constant for the name of the ignore optional compile problems attribute. This attribute is valid only for classpath entries describing source folders. The possible values for this attribute are `"true"` or `"false"`. When not present, `"false"` is assumed. If the value of this attribute is `"true"`, all optional problems from the source folder described by this classpath entry will not be reported by the compiler.

Since:
  3.8
See Also:
  - Constant Field Values

### OPTIONAL

static final String OPTIONAL
Constant for the name of the optional attribute. The possible values for this attribute are `"true"` or `"false"`. When not present, `"false"` is assumed. If the value of this attribute is `"true"`, the classpath entry is optional. If the underlying resource or jar file doesn't exist, no error is reported and the classpath entry is ignored.

Since:
  3.2
See Also:
  - Constant Field Values

### MODULE

static final String MODULE
Constant for the name of the module attribute. The possible values for this attribute are `"true"` or `"false"`. When not present, `"false"` is assumed. If the value of this attribute is `"true"`, the classpath entry is considered to be on the module path and will be treated as a regular named module or as an automatic module.

Since:
  3.14
See Also:
  - Constant Field Values

### ADD_EXPORTS

static final String ADD_EXPORTS
Constant for the name of the add-exports attribute.

The value of this attribute must adhere to the syntax of `javac's` `--add-exports` command line option: `<source-module>/<package>=<target-module>(,<target-module>)*`. Multiple such options are packed as a ':' separated list into a single classpath attribute. The given exports will be added at compile time.

Classpath entries with this attribute should also have a `MODULE` attribute with value `"true"`.

Since:
  3.14
See Also:
  - Constant Field Values

### ADD_OPENS

static final String ADD_OPENS
Constant for the name of the add-opens attribute.

The value of this attribute must adhere to the syntax of `javac's` `--add-opens` command line option: `<source-module>/<package>=<target-module>(,<target-module>)*`. Multiple such options are packed as a ':' separated list into a single classpath attribute. The given opens will be added at launch time.

Classpath entries with this attribute should also have a `MODULE` attribute with value `"true"`.

Since:
  3.18
See Also:
  - Constant Field Values

### ADD_READS

static final String ADD_READS
Constant for the name of the add-reads attribute.

The value of this attribute must adhere to the syntax of `javac's` `--add-reads` command line option: `<source-module>=<target-module>`. Multiple such options are packed as a ':' separated list into a single classpath attribute. The given reads edge will be added at compile time.

Since:
  3.14
See Also:
  - Constant Field Values

### PATCH_MODULE

static final String PATCH_MODULE
Constant for the name of the patch-module attribute.

The value of this attribute must adhere to the syntax of `javac's` `--patch-module` command line option: `<module>=<file>(<pathsep><file>)*`. All compilation units found in the locations specified as `<file>` will be associated with the module specified using its name.

The specified module must be defined by the container, library or project referenced by the current classpath entry.

Each `<file>` location is the workspace path of either a Java project, or a source folder. Specifying a Java project is a shorthand for listing all source folders of that project.

The attribute value can be further shortened to just the module name, in which case the `file` locations will be assumed as all source folders of the current Java project. This short format is still understood to maintain compatibility with versions prior to 3.18, but it is discouraged moving forward.

If this attributes is attached to a multi-module container, multiple attribute values of the format defined above are concatenated into one attribute, using `"::"` as the separator.

This attribute is supported for classpath entries of kind `IClasspathEntry.CPE_CONTAINER`, `IClasspathEntry.CPE_LIBRARY` and `IClasspathEntry.CPE_PROJECT`. A classpath entry having this attribute must also have the `MODULE` attribute with value `"true"`.

Since:
  3.14
See Also:
  - Constant Field Values

### LIMIT_MODULES

static final String LIMIT_MODULES
Constant for the name of the limit-modules attribute.

The value of this attribute must be a comma-separated list of names of modules defined in the classpath entry, to which this attribute is attached. The set of modules observable through this entry will be limited to the transitive closure of modules in this list.

This attribute is supported for classpath entries of kind `IClasspathEntry.CPE_CONTAINER`. A classpath entry having this attribute must also have the `MODULE` attribute with value `"true"`.

Since:
  3.14
See Also:
  - Constant Field Values

### MODULE_MAIN_CLASS

static final String MODULE_MAIN_CLASS
Constant of the name of the module-main-class attribute. The classpath entry holding this attribute must refer to a source folder containing the implementation of a module.

The value of this attribute must be the name of a class defined in this module. It will be used for generating the `ModuleMainClass` attribute in `module-info.class`.

Since:
  3.14
See Also:
  - Constant Field Values

### EXTERNAL_ANNOTATION_PATH

static final String EXTERNAL_ANNOTATION_PATH
Constant for the name of the external annotation path attribute.

The value for this attribute has to be the string representation of a path. It should point to an existing directory where external annotations can be found to support annotation based null analysis involving 3rd party libraries.

Since:
  3.11
See Also:
  - Constant Field Values

### TEST

static final String TEST
Constant for the name of the test attribute.

The possible values for this attribute are `"true"` or `"false"`. When not present, `"false"` is assumed. If the value of this attribute is `"true"`, and the classpath entry is a source folder, it is assumed to contain test sources, otherwise main sources.

During the compilation of main sources, only code is visible, that is reachable via classpath entries which do not have the test attribute set to to "true". During the compilation of test sources, all code is visible as if this attribute didn't exist at all.

Since:
  3.14
See Also:
  - Constant Field Values

### WITHOUT_TEST_CODE

static final String WITHOUT_TEST_CODE
Constant for the name of the without_test_code attribute.

The possible values for this attribute are `"true"` or `"false"`. When not present, `"false"` is assumed. If the value of this attribute is `"true"`, and the classpath entry is a project, any test code reachable via that classpath entry will not be visible even to test sources.

Since:
  3.14
See Also:
  - Constant Field Values

### RELEASE

static final String RELEASE
Constant for the name of the release attribute.

The possible values for this attribute are numbers > 8. If the value of this attribute is provided, and the classpath entry is a source folder, this will enable Multi-Release compilation for this source folder for the given java release.

Since:
  3.43
See Also:
  - Constant Field Values

## Method Details

### getName

String getName()
Returns the name of this classpath attribute.

Returns:
  the name of this classpath attribute.
Since:
  3.1

### getValue

String getValue()
Returns the value of this classpath attribute.

Returns:
  the value of this classpath attribute.
Since:
  3.1