IDEA-106556 (index access under mirror lock eliminated)

This commit is contained in:
Roman Shevchenko
2013-05-02 14:35:28 +02:00
parent f8c5a660f9
commit 448d708281
2 changed files with 22 additions and 15 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -406,9 +406,17 @@ public class ClsClassImpl extends ClsMemberImpl<PsiClassStub<?>> implements PsiE
setMirror(getExtendsList(), mirror.getExtendsList());
setMirror(getImplementsList(), mirror.getImplementsList());
setMirrors(getOwnFields(), mirror.getFields());
setMirrors(getOwnMethods(), mirror.getMethods());
setMirrors(getOwnInnerClasses(), mirror.getInnerClasses());
if (mirror instanceof PsiExtensibleClass) {
PsiExtensibleClass extMirror = (PsiExtensibleClass)mirror;
setMirrors(getOwnFields(), extMirror.getOwnFields());
setMirrors(getOwnMethods(), extMirror.getOwnMethods());
setMirrors(getOwnInnerClasses(), extMirror.getOwnInnerClasses());
}
else {
setMirrors(getOwnFields(), mirror.getFields());
setMirrors(getOwnMethods(), mirror.getMethods());
setMirrors(getOwnInnerClasses(), mirror.getInnerClasses());
}
}
@Override
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -310,20 +310,19 @@ public abstract class ClsElementImpl extends PsiElementBase implements PsiCompil
}
protected static <T extends PsiElement> void setMirrors(@NotNull T[] stubs, @NotNull T[] mirrors) throws InvalidMirrorException {
if (stubs.length != mirrors.length) {
throw new InvalidMirrorException(stubs, mirrors);
}
for (int i = 0; i < stubs.length; i++) {
setMirror(stubs[i], mirrors[i]);
}
setMirrors(Arrays.asList(stubs), Arrays.asList(mirrors));
}
protected static <T extends PsiElement> void setMirrors(@NotNull List<T> stubs, @NotNull T[] mirrors) throws InvalidMirrorException {
if (stubs.size() != mirrors.length) {
setMirrors(stubs, Arrays.asList(mirrors));
}
protected static <T extends PsiElement> void setMirrors(@NotNull List<T> stubs, @NotNull List<T> mirrors) throws InvalidMirrorException {
if (stubs.size() != mirrors.size()) {
throw new InvalidMirrorException(stubs, mirrors);
}
for (int i = 0; i < stubs.size(); i++) {
setMirror(stubs.get(i), mirrors[i]);
setMirror(stubs.get(i), mirrors.get(i));
}
}
@@ -340,8 +339,8 @@ public abstract class ClsElementImpl extends PsiElementBase implements PsiCompil
this("stub:" + Arrays.toString(stubElements) + "; mirror:" + Arrays.toString(mirrorElements));
}
public InvalidMirrorException(@NotNull List<? extends PsiElement> stubElements, @NotNull PsiElement[] mirrorElements) {
this("stub:" + stubElements + "; mirror:" + Arrays.toString(mirrorElements));
public InvalidMirrorException(@NotNull List<? extends PsiElement> stubElements, @NotNull List<? extends PsiElement> mirrorElements) {
this("stub:" + stubElements + "; mirror:" + mirrorElements);
}
}
}