Schnittstelle IAccessRule
- Alle bekannten Implementierungsklassen:
ClasspathAccessRule
On a given classpath entry, the access rules are considered in the order given
when the entry was created. When a source or class file matches an access
rule's pattern, the access rule's kind defines whether the file is considered
accessible, non-accessible, or whether its access is discouraged. If the source or class
file doesn't match any access rule, it is considered accessible. A source or class
file that is not accessible or discouraged can still be referred to, but it is tagged as being not
accessible - the Java builder will create a problem marker, for example.
The severity of the marker created from a non-accessible rule is controlled through
the JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE
compiler option.
The severity of the marker created from a discouraged rule is controlled through
the JavaCore.COMPILER_PB_DISCOURAGED_REFERENCE
compiler option.
Note this is different from inclusion and exclusion patterns on source classpath entries,
where a source file that is excluded is not even compiled.
Files patterns look like relative file paths with wildcards and are interpreted relative
to each entry's path.
File patterns are case-sensitive and they can contain '**', '*' or '?' wildcards (see
IClasspathEntry.getExclusionPatterns()
for the full description
of their syntax and semantics).
Note that file patterns must not include the file extension.
com/xyz/tests/MyClass
is a valid file pattern, whereas
com/xyz/tests/MyClass.class
is not valid.
For example, if a classpath entry path is /Project/someLib.jar
,
there are no accessible rules, and there is one non-accessible rule with pattern
com/xyz/tests/**
, then class files
like /Project/someLib.jar/com/xyz/Foo.class
and /Project/someLib.jar/com/xyz/utils/Bar.class
would be accessible,
whereas /Project/someLib.jar/com/xyz/tests/T1.class
and /Project/someLib.jar/com/xyz/tests/quick/T2.class
would not be
accessible.
- Seit:
- 3.1
- Siehe auch:
-
Feldübersicht
Modifizierer und TypFeldBeschreibungstatic final int
Flag indicating that whether a type matching this rule should be ignored iff a type with the same qualified name can be found on a later classpath entry with a better accessibility.static final int
Constant indicating that files matching the rule's pattern are accessible.static final int
Constant indicating that access to the files matching the rule's pattern is discouraged.static final int
Constant indicating that files matching the rule's pattern are non-accessible. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungint
getKind()
org.eclipse.core.runtime.IPath
Returns the file pattern for this access rule.boolean
Returns whether a type matching this rule should be ignored iff a type with the same qualified name can be found on a later classpath entry with a better accessibility.
-
Felddetails
-
K_ACCESSIBLE
static final int K_ACCESSIBLEConstant indicating that files matching the rule's pattern are accessible.- Siehe auch:
-
K_NON_ACCESSIBLE
static final int K_NON_ACCESSIBLEConstant indicating that files matching the rule's pattern are non-accessible.- Siehe auch:
-
K_DISCOURAGED
static final int K_DISCOURAGEDConstant indicating that access to the files matching the rule's pattern is discouraged.- Siehe auch:
-
IGNORE_IF_BETTER
static final int IGNORE_IF_BETTERFlag indicating that whether a type matching this rule should be ignored iff a type with the same qualified name can be found on a later classpath entry with a better accessibility.
E.g. if a type p.X matches a rule K_NON_ACCESSIBLE | IGNORE_IF_BETTER on a library entry 'lib1' and another type p.X also matches a rule K_DISCOURAGED on library entry 'lib2' ('lib2' being after 'lib1' on the classpath), then p.X from 'lib2' will be used and reported as discouraged.
- Seit:
- 3.2
- Siehe auch:
-
-
Methodendetails
-
getPattern
org.eclipse.core.runtime.IPath getPattern()Returns the file pattern for this access rule.- Gibt zurück:
- the file pattern for this access rule
- Siehe auch:
-
getKind
int getKind()- Gibt zurück:
- the kind of this access rule
-
ignoreIfBetter
boolean ignoreIfBetter()Returns whether a type matching this rule should be ignored iff a type with the same qualified name can be found on a later classpath entry with a better accessibility.
E.g. if a type p.X matches a rule K_NON_ACCESSIBLE | IGNORE_IF_BETTER on a library entry 'lib1' and another type p.X also matches a rule K_DISCOURAGED on library entry 'lib2' ('lib2' being after 'lib1' on the classpath), then p.X from 'lib2' will be used and reported as discouraged.
- Gibt zurück:
- whether a type matching this rule should be ignored iff a type with the same qualified name can be found on a later classpath entry with a better accessibility
- Seit:
- 3.2
-