Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/AccessRule.java4
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathAccessRule.java10
2 files changed, 11 insertions, 3 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/AccessRule.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/AccessRule.java
index d421d2e714..647bc48582 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/AccessRule.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/AccessRule.java
@@ -20,8 +20,8 @@ public class AccessRule {
public static final int IgnoreIfBetter = 0x02000000; // value must be greater than IProblem#ForbiddenReference and DiscouragedReference
- public char[] pattern;
- public int problemId;
+ public final char[] pattern;
+ public final int problemId;
public AccessRule(char[] pattern, int problemId) {
this(pattern, problemId, false);
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathAccessRule.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathAccessRule.java
index 50dcdbb386..d4cb0faae8 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathAccessRule.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathAccessRule.java
@@ -21,8 +21,12 @@ import org.eclipse.jdt.internal.compiler.env.AccessRule;
public class ClasspathAccessRule extends AccessRule implements IAccessRule {
+ private IPath path;
+
public ClasspathAccessRule(IPath pattern, int kind) {
this(pattern.toString().toCharArray(), toProblemId(kind));
+ // avoid IPath creation (Bug 571159):
+ this.path = pattern;
}
public ClasspathAccessRule(char[] pattern, int problemId) {
@@ -43,7 +47,11 @@ public class ClasspathAccessRule extends AccessRule implements IAccessRule {
@Override
public IPath getPattern() {
- return new Path(new String(this.pattern));
+ if (this.path == null) {
+ // cache the IPath (Bug 571159):
+ this.path = new Path(new String(this.pattern));
+ }
+ return this.path;
}
@Override

Back to the top