Obsolete class deprecated

This commit is contained in:
Roman Shevchenko
2013-02-26 13:59:27 +01:00
parent 357ef16a64
commit 5c9c590d06
11 changed files with 45 additions and 46 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 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.
@@ -33,7 +33,6 @@ import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.reference.SoftReference;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.PatchedSoftReference;
import com.intellij.util.containers.ConcurrentHashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -82,7 +81,7 @@ public class MethodBodyChecker {
SoftReference<Map<String, PsiMethod>> ref = aClass.getUserData(CACHE_KEY);
Map<String, PsiMethod> cache = ref == null ? null : ref.get();
if (cache == null) {
aClass.putUserData(CACHE_KEY, new PatchedSoftReference<Map<String, PsiMethod>>(cache = new ConcurrentHashMap<String, PsiMethod>()));
aClass.putUserData(CACHE_KEY, new SoftReference<Map<String, PsiMethod>>(cache = new ConcurrentHashMap<String, PsiMethod>()));
}
return cache;
}
@@ -107,7 +106,7 @@ public class MethodBodyChecker {
if (PsiEquivalenceUtil.areElementsEquivalent(body, templateBody, new Comparator<PsiElement>(){
public int compare(final PsiElement element1, final PsiElement element2) {
// templates may be different on super method name
// templates may be different on super method name
if (element1 == superMethod && (element2 == templateMethod || element2 == null)) return 0;
return 1;
}
@@ -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.
@@ -24,8 +24,8 @@ import com.intellij.psi.impl.java.stubs.JavaStubElementTypes;
import com.intellij.psi.impl.java.stubs.PsiAnnotationStub;
import com.intellij.psi.stubs.StubBase;
import com.intellij.psi.stubs.StubElement;
import com.intellij.reference.SoftReference;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.PatchedSoftReference;
import com.intellij.util.io.StringRef;
import org.jetbrains.annotations.Nullable;
@@ -38,7 +38,7 @@ public class PsiAnnotationStubImpl extends StubBase<PsiAnnotation> implements Ps
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.java.stubs.impl.PsiAnnotationStubImpl");
private final String myText;
private PatchedSoftReference<PsiAnnotation> myParsedFromRepository;
private SoftReference<PsiAnnotation> myParsedFromRepository;
public PsiAnnotationStubImpl(final StubElement parent, final String text) {
this(parent, text, null);
@@ -73,8 +73,7 @@ public class PsiAnnotationStubImpl extends StubBase<PsiAnnotation> implements Ps
try {
PsiJavaParserFacade facade = JavaPsiFacade.getInstance(getProject()).getParserFacade();
PsiAnnotation annotation = facade.createAnnotationFromText(text, getPsi());
myParsedFromRepository = new PatchedSoftReference<PsiAnnotation>(annotation);
assert annotation != null : text;
myParsedFromRepository = new SoftReference<PsiAnnotation>(annotation);
return annotation;
}
catch (IncorrectOperationException e) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 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.
@@ -28,15 +28,15 @@ import com.intellij.psi.impl.java.stubs.PsiImportStatementStub;
import com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl;
import com.intellij.psi.stubs.StubBase;
import com.intellij.psi.stubs.StubElement;
import com.intellij.reference.SoftReference;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.PatchedSoftReference;
import com.intellij.util.io.StringRef;
import org.jetbrains.annotations.Nullable;
public class PsiImportStatementStubImpl extends StubBase<PsiImportStatementBase> implements PsiImportStatementStub {
private final byte myFlags;
private final StringRef myText;
private PatchedSoftReference<PsiJavaCodeReferenceElement> myReference = null;
private SoftReference<PsiJavaCodeReferenceElement> myReference = null;
private final static int ON_DEMAND = 0x01;
private final static int STATIC = 0x02;
@@ -80,7 +80,7 @@ public class PsiImportStatementStubImpl extends StubBase<PsiImportStatementBase>
PsiJavaCodeReferenceElement ref = myReference != null ? myReference.get() : null;
if (ref == null) {
ref = isStatic() ? getStaticReference() : getRegularReference();
myReference = new PatchedSoftReference<PsiJavaCodeReferenceElement>(ref);
myReference = new SoftReference<PsiJavaCodeReferenceElement>(ref);
}
return ref;
}
@@ -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.
@@ -22,7 +22,7 @@ import com.intellij.psi.*;
import com.intellij.psi.impl.java.stubs.JavaStubElementTypes;
import com.intellij.psi.impl.java.stubs.PsiMethodStub;
import com.intellij.psi.impl.source.tree.ChildRole;
import com.intellij.util.PatchedSoftReference;
import com.intellij.reference.SoftReference;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -30,7 +30,7 @@ import org.jetbrains.annotations.NotNull;
* @author ven
*/
public class PsiAnnotationMethodImpl extends PsiMethodImpl implements PsiAnnotationMethod {
private PatchedSoftReference<PsiAnnotationMemberValue> myCachedDefaultValue = null;
private SoftReference<PsiAnnotationMemberValue> myCachedDefaultValue = null;
public PsiAnnotationMethodImpl(final PsiMethodStub stub) {
super(stub, JavaStubElementTypes.ANNOTATION_METHOD);
@@ -68,7 +68,7 @@ public class PsiAnnotationMethodImpl extends PsiMethodImpl implements PsiAnnotat
final PsiFileFactory factory = PsiFileFactory.getInstance(getProject());
final PsiJavaFile file = (PsiJavaFile)factory.createFileFromText("a.java", JavaFileType.INSTANCE, annoText);
final PsiAnnotationMemberValue value = ((PsiAnnotationMethod)file.getClasses()[0].getMethods()[0]).getDefaultValue();
myCachedDefaultValue = new PatchedSoftReference<PsiAnnotationMemberValue>(value);
myCachedDefaultValue = new SoftReference<PsiAnnotationMemberValue>(value);
return value;
}
@@ -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.
@@ -22,12 +22,12 @@ import com.intellij.psi.impl.java.stubs.PsiClassStub;
import com.intellij.psi.impl.source.tree.ChildRole;
import com.intellij.psi.impl.source.tree.SharedImplUtil;
import com.intellij.psi.scope.PsiScopeProcessor;
import com.intellij.reference.SoftReference;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.PatchedSoftReference;
import org.jetbrains.annotations.NotNull;
public class PsiAnonymousClassImpl extends PsiClassImpl implements PsiAnonymousClass {
private PatchedSoftReference<PsiClassType> myCachedBaseType = null;
private SoftReference<PsiClassType> myCachedBaseType = null;
public PsiAnonymousClassImpl(final PsiClassStub stub) {
super(stub, JavaStubElementTypes.ANONYMOUS_CLASS);
@@ -92,7 +92,7 @@ public class PsiAnonymousClassImpl extends PsiClassImpl implements PsiAnonymousC
type = PsiType.getJavaLangObject(getManager(), getResolveScope());
}
myCachedBaseType = new PatchedSoftReference<PsiClassType>(type);
myCachedBaseType = new SoftReference<PsiClassType>(type);
return type;
}
else {
@@ -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.
@@ -33,9 +33,9 @@ import com.intellij.psi.scope.PsiScopeProcessor;
import com.intellij.psi.search.SearchScope;
import com.intellij.psi.stubs.IStubElementType;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.reference.SoftReference;
import com.intellij.ui.RowIcon;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.PatchedSoftReference;
import com.intellij.util.PlatformIcons;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -49,7 +49,7 @@ import java.util.Set;
public class PsiFieldImpl extends JavaStubPsiElement<PsiFieldStub> implements PsiField, PsiVariableEx, Queryable {
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.PsiFieldImpl");
private volatile PatchedSoftReference<PsiType> myCachedType = null;
private volatile SoftReference<PsiType> myCachedType = null;
private volatile Object myCachedInitializerValue = null; // PsiExpression on constant value for literal
public PsiFieldImpl(final PsiFieldStub stub) {
@@ -129,7 +129,7 @@ public class PsiFieldImpl extends JavaStubPsiElement<PsiFieldStub> implements Ps
String typeText = TypeInfo.createTypeText(stub.getType(false));
try {
final PsiType type = JavaPsiFacade.getInstance(getProject()).getParserFacade().createTypeFromText(typeText, this);
myCachedType = new PatchedSoftReference<PsiType>(type);
myCachedType = new SoftReference<PsiType>(type);
return type;
}
catch (IncorrectOperationException e) {
@@ -148,7 +148,7 @@ public class PsiFieldImpl extends JavaStubPsiElement<PsiFieldStub> implements Ps
public PsiType getType(){
final PsiFieldStub stub = getStub();
if (stub != null) {
PatchedSoftReference<PsiType> cachedType = myCachedType;
SoftReference<PsiType> cachedType = myCachedType;
if (cachedType != null) {
PsiType type = cachedType.get();
if (type != null) return type;
@@ -157,7 +157,7 @@ public class PsiFieldImpl extends JavaStubPsiElement<PsiFieldStub> implements Ps
String typeText = TypeInfo.createTypeText(stub.getType(true));
try {
final PsiType type = JavaPsiFacade.getInstance(getProject()).getParserFacade().createTypeFromText(typeText, this);
myCachedType = new PatchedSoftReference<PsiType>(type);
myCachedType = new SoftReference<PsiType>(type);
return type;
}
catch (IncorrectOperationException e) {
@@ -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.
@@ -40,9 +40,9 @@ import com.intellij.psi.stubs.IStubElementType;
import com.intellij.psi.util.MethodSignature;
import com.intellij.psi.util.MethodSignatureBackedByPsiMethod;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.reference.SoftReference;
import com.intellij.ui.RowIcon;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.PatchedSoftReference;
import com.intellij.util.PlatformIcons;
import org.jetbrains.annotations.NotNull;
@@ -53,7 +53,7 @@ import java.util.Map;
public class PsiMethodImpl extends JavaStubPsiElement<PsiMethodStub> implements PsiMethod, Queryable {
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.PsiMethodImpl");
private PatchedSoftReference<PsiType> myCachedType = null;
private SoftReference<PsiType> myCachedType = null;
public PsiMethodImpl(final PsiMethodStub stub) {
this(stub, JavaStubElementTypes.METHOD);
@@ -220,7 +220,7 @@ public class PsiMethodImpl extends JavaStubPsiElement<PsiMethodStub> implements
final String typeText = TypeInfo.createTypeText(stub.getReturnTypeText(true));
if (typeText == null) return null;
PatchedSoftReference<PsiType> cachedType = myCachedType;
SoftReference<PsiType> cachedType = myCachedType;
if (cachedType != null) {
PsiType type = cachedType.get();
if (type != null) return type;
@@ -228,7 +228,7 @@ public class PsiMethodImpl extends JavaStubPsiElement<PsiMethodStub> implements
try {
final PsiType type = JavaPsiFacade.getInstance(getProject()).getElementFactory().createTypeFromText(typeText, this);
myCachedType = new PatchedSoftReference<PsiType>(type);
myCachedType = new SoftReference<PsiType>(type);
return type;
}
catch (IncorrectOperationException e) {
@@ -32,9 +32,9 @@ import com.intellij.psi.search.LocalSearchScope;
import com.intellij.psi.search.SearchScope;
import com.intellij.psi.stubs.IStubElementType;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.reference.SoftReference;
import com.intellij.ui.RowIcon;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.PatchedSoftReference;
import com.intellij.util.PlatformIcons;
import org.jetbrains.annotations.NotNull;
@@ -44,7 +44,7 @@ import java.util.Arrays;
public class PsiParameterImpl extends JavaStubPsiElement<PsiParameterStub> implements PsiParameter {
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.PsiParameterImpl");
private volatile PatchedSoftReference<PsiType> myCachedType = null;
private volatile SoftReference<PsiType> myCachedType = null;
public PsiParameterImpl(@NotNull PsiParameterStub stub) {
this(stub, JavaStubElementTypes.PARAMETER);
@@ -116,7 +116,7 @@ public class PsiParameterImpl extends JavaStubPsiElement<PsiParameterStub> imple
public PsiType getType() {
PsiParameterStub stub = getStub();
if (stub != null) {
PatchedSoftReference<PsiType> cachedType = myCachedType;
SoftReference<PsiType> cachedType = myCachedType;
if (cachedType != null) {
PsiType type = cachedType.get();
if (type != null) return type;
@@ -126,7 +126,7 @@ public class PsiParameterImpl extends JavaStubPsiElement<PsiParameterStub> imple
assert typeText != null : stub;
try {
PsiType type = JavaPsiFacade.getInstance(getProject()).getParserFacade().createTypeFromText(typeText, this);
myCachedType = new PatchedSoftReference<PsiType>(type);
myCachedType = new SoftReference<PsiType>(type);
return type;
}
catch (IncorrectOperationException e) {
@@ -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.
@@ -28,9 +28,9 @@ import com.intellij.psi.scope.PsiScopeProcessor;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.reference.SoftReference;
import com.intellij.util.Function;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.PatchedSoftReference;
import com.intellij.util.SmartList;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NonNls;
@@ -45,7 +45,7 @@ public class PsiTypeElementImpl extends CompositePsiElement implements PsiTypeEl
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.PsiTypeElementImpl");
private volatile PsiType myCachedType = null;
private volatile PatchedSoftReference<PsiType> myCachedDetachedType = null;
private volatile SoftReference<PsiType> myCachedDetachedType = null;
@SuppressWarnings({"UnusedDeclaration"})
public PsiTypeElementImpl() {
@@ -110,8 +110,8 @@ public class PsiTypeElementImpl extends CompositePsiElement implements PsiTypeEl
final List<PsiType> types = ContainerUtil.map(typeElements, new Function<PsiTypeElement, PsiType>() {
@Override public PsiType fun(final PsiTypeElement psiTypeElement) { return psiTypeElement.getType(); }
});
cachedType = opElement instanceof PsiJavaToken && ((PsiJavaToken)opElement).getTokenType() == JavaTokenType.AND
? PsiIntersectionType.createIntersection(types.toArray(new PsiType[types.size()]))
cachedType = opElement instanceof PsiJavaToken && ((PsiJavaToken)opElement).getTokenType() == JavaTokenType.AND
? PsiIntersectionType.createIntersection(types.toArray(new PsiType[types.size()]))
: new PsiDisjunctionType(types, getManager());
}
}
@@ -168,14 +168,14 @@ public class PsiTypeElementImpl extends CompositePsiElement implements PsiTypeEl
}
public PsiType getDetachedType(@NotNull PsiElement context) {
PatchedSoftReference<PsiType> cached = myCachedDetachedType;
SoftReference<PsiType> cached = myCachedDetachedType;
PsiType type = cached == null ? null : cached.get();
if (type != null) return type;
try {
String combinedAnnotations = getCombinedAnnotationsText();
String text = combinedAnnotations.isEmpty() ? getText().trim() : combinedAnnotations + " " + getText().trim();
type = JavaPsiFacade.getInstance(getProject()).getElementFactory().createTypeFromText(text, context);
myCachedDetachedType = new PatchedSoftReference<PsiType>(type);
myCachedDetachedType = new SoftReference<PsiType>(type);
}
catch (IncorrectOperationException e) {
return getType();
@@ -58,7 +58,6 @@ import com.intellij.psi.tree.TokenSet;
import com.intellij.reference.SoftReference;
import com.intellij.testFramework.LightVirtualFile;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.PatchedSoftReference;
import com.intellij.util.PatchedWeakReference;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.text.CharArrayUtil;
@@ -723,7 +722,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
}
return myManager.isBatchFilesProcessingMode()
? new PatchedWeakReference<ASTNode>(treeElement)
: new PatchedSoftReference<ASTNode>(treeElement);
: new SoftReference<ASTNode>(treeElement);
}
@Override
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 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.
@@ -19,6 +19,8 @@ import com.intellij.reference.SoftReference;
import java.lang.ref.ReferenceQueue;
/** @deprecated use {@link SoftReference} (to remove in IDEA 13) */
@SuppressWarnings("UnusedDeclaration")
public class PatchedSoftReference<T> extends SoftReference<T> {
public PatchedSoftReference(final T referent) {
super(referent);