diff --git a/java/java-impl/src/com/intellij/codeInspection/defaultFileTemplateUsage/MethodBodyChecker.java b/java/java-impl/src/com/intellij/codeInspection/defaultFileTemplateUsage/MethodBodyChecker.java index 5ee8cadb7ffd..d379a9f8e079 100644 --- a/java/java-impl/src/com/intellij/codeInspection/defaultFileTemplateUsage/MethodBodyChecker.java +++ b/java/java-impl/src/com/intellij/codeInspection/defaultFileTemplateUsage/MethodBodyChecker.java @@ -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> ref = aClass.getUserData(CACHE_KEY); Map cache = ref == null ? null : ref.get(); if (cache == null) { - aClass.putUserData(CACHE_KEY, new PatchedSoftReference>(cache = new ConcurrentHashMap())); + aClass.putUserData(CACHE_KEY, new SoftReference>(cache = new ConcurrentHashMap())); } return cache; } @@ -107,7 +106,7 @@ public class MethodBodyChecker { if (PsiEquivalenceUtil.areElementsEquivalent(body, templateBody, new Comparator(){ 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; } diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/impl/PsiAnnotationStubImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/impl/PsiAnnotationStubImpl.java index ed0b25bf2dbc..0f677e127aee 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/impl/PsiAnnotationStubImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/impl/PsiAnnotationStubImpl.java @@ -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 implements Ps private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.java.stubs.impl.PsiAnnotationStubImpl"); private final String myText; - private PatchedSoftReference myParsedFromRepository; + private SoftReference myParsedFromRepository; public PsiAnnotationStubImpl(final StubElement parent, final String text) { this(parent, text, null); @@ -73,8 +73,7 @@ public class PsiAnnotationStubImpl extends StubBase implements Ps try { PsiJavaParserFacade facade = JavaPsiFacade.getInstance(getProject()).getParserFacade(); PsiAnnotation annotation = facade.createAnnotationFromText(text, getPsi()); - myParsedFromRepository = new PatchedSoftReference(annotation); - assert annotation != null : text; + myParsedFromRepository = new SoftReference(annotation); return annotation; } catch (IncorrectOperationException e) { diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/impl/PsiImportStatementStubImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/impl/PsiImportStatementStubImpl.java index 995aafcc66dc..6a217d3466c0 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/impl/PsiImportStatementStubImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/impl/PsiImportStatementStubImpl.java @@ -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 implements PsiImportStatementStub { private final byte myFlags; private final StringRef myText; - private PatchedSoftReference myReference = null; + private SoftReference myReference = null; private final static int ON_DEMAND = 0x01; private final static int STATIC = 0x02; @@ -80,7 +80,7 @@ public class PsiImportStatementStubImpl extends StubBase PsiJavaCodeReferenceElement ref = myReference != null ? myReference.get() : null; if (ref == null) { ref = isStatic() ? getStaticReference() : getRegularReference(); - myReference = new PatchedSoftReference(ref); + myReference = new SoftReference(ref); } return ref; } diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiAnnotationMethodImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiAnnotationMethodImpl.java index 0dcef9eefd57..70229d13e67b 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiAnnotationMethodImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiAnnotationMethodImpl.java @@ -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 myCachedDefaultValue = null; + private SoftReference 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(value); + myCachedDefaultValue = new SoftReference(value); return value; } diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiAnonymousClassImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiAnonymousClassImpl.java index 8038317d6c61..9d14b52babb6 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiAnonymousClassImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiAnonymousClassImpl.java @@ -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 myCachedBaseType = null; + private SoftReference 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(type); + myCachedBaseType = new SoftReference(type); return type; } else { diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiFieldImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiFieldImpl.java index c426d1a07a42..2d3d4356babe 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiFieldImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiFieldImpl.java @@ -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 implements PsiField, PsiVariableEx, Queryable { private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.PsiFieldImpl"); - private volatile PatchedSoftReference myCachedType = null; + private volatile SoftReference 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 implements Ps String typeText = TypeInfo.createTypeText(stub.getType(false)); try { final PsiType type = JavaPsiFacade.getInstance(getProject()).getParserFacade().createTypeFromText(typeText, this); - myCachedType = new PatchedSoftReference(type); + myCachedType = new SoftReference(type); return type; } catch (IncorrectOperationException e) { @@ -148,7 +148,7 @@ public class PsiFieldImpl extends JavaStubPsiElement implements Ps public PsiType getType(){ final PsiFieldStub stub = getStub(); if (stub != null) { - PatchedSoftReference cachedType = myCachedType; + SoftReference cachedType = myCachedType; if (cachedType != null) { PsiType type = cachedType.get(); if (type != null) return type; @@ -157,7 +157,7 @@ public class PsiFieldImpl extends JavaStubPsiElement implements Ps String typeText = TypeInfo.createTypeText(stub.getType(true)); try { final PsiType type = JavaPsiFacade.getInstance(getProject()).getParserFacade().createTypeFromText(typeText, this); - myCachedType = new PatchedSoftReference(type); + myCachedType = new SoftReference(type); return type; } catch (IncorrectOperationException e) { diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiMethodImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiMethodImpl.java index 06280bcce954..ee0cc0149ee0 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiMethodImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiMethodImpl.java @@ -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 implements PsiMethod, Queryable { private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.PsiMethodImpl"); - private PatchedSoftReference myCachedType = null; + private SoftReference myCachedType = null; public PsiMethodImpl(final PsiMethodStub stub) { this(stub, JavaStubElementTypes.METHOD); @@ -220,7 +220,7 @@ public class PsiMethodImpl extends JavaStubPsiElement implements final String typeText = TypeInfo.createTypeText(stub.getReturnTypeText(true)); if (typeText == null) return null; - PatchedSoftReference cachedType = myCachedType; + SoftReference cachedType = myCachedType; if (cachedType != null) { PsiType type = cachedType.get(); if (type != null) return type; @@ -228,7 +228,7 @@ public class PsiMethodImpl extends JavaStubPsiElement implements try { final PsiType type = JavaPsiFacade.getInstance(getProject()).getElementFactory().createTypeFromText(typeText, this); - myCachedType = new PatchedSoftReference(type); + myCachedType = new SoftReference(type); return type; } catch (IncorrectOperationException e) { diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiParameterImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiParameterImpl.java index 446f4ce06f6d..3635752250cf 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiParameterImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiParameterImpl.java @@ -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 implements PsiParameter { private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.PsiParameterImpl"); - private volatile PatchedSoftReference myCachedType = null; + private volatile SoftReference myCachedType = null; public PsiParameterImpl(@NotNull PsiParameterStub stub) { this(stub, JavaStubElementTypes.PARAMETER); @@ -116,7 +116,7 @@ public class PsiParameterImpl extends JavaStubPsiElement imple public PsiType getType() { PsiParameterStub stub = getStub(); if (stub != null) { - PatchedSoftReference cachedType = myCachedType; + SoftReference cachedType = myCachedType; if (cachedType != null) { PsiType type = cachedType.get(); if (type != null) return type; @@ -126,7 +126,7 @@ public class PsiParameterImpl extends JavaStubPsiElement imple assert typeText != null : stub; try { PsiType type = JavaPsiFacade.getInstance(getProject()).getParserFacade().createTypeFromText(typeText, this); - myCachedType = new PatchedSoftReference(type); + myCachedType = new SoftReference(type); return type; } catch (IncorrectOperationException e) { diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiTypeElementImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiTypeElementImpl.java index 517ea3197037..b4086db18569 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiTypeElementImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiTypeElementImpl.java @@ -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 myCachedDetachedType = null; + private volatile SoftReference myCachedDetachedType = null; @SuppressWarnings({"UnusedDeclaration"}) public PsiTypeElementImpl() { @@ -110,8 +110,8 @@ public class PsiTypeElementImpl extends CompositePsiElement implements PsiTypeEl final List types = ContainerUtil.map(typeElements, new Function() { @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 cached = myCachedDetachedType; + SoftReference 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(type); + myCachedDetachedType = new SoftReference(type); } catch (IncorrectOperationException e) { return getType(); diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/PsiFileImpl.java b/platform/core-impl/src/com/intellij/psi/impl/source/PsiFileImpl.java index 746e229bc258..7a2ba7eda4bd 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/PsiFileImpl.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/PsiFileImpl.java @@ -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(treeElement) - : new PatchedSoftReference(treeElement); + : new SoftReference(treeElement); } @Override diff --git a/platform/core-impl/src/com/intellij/util/PatchedSoftReference.java b/platform/core-impl/src/com/intellij/util/PatchedSoftReference.java index 61308bb38633..578f5c66f42b 100644 --- a/platform/core-impl/src/com/intellij/util/PatchedSoftReference.java +++ b/platform/core-impl/src/com/intellij/util/PatchedSoftReference.java @@ -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 extends SoftReference { public PatchedSoftReference(final T referent) { super(referent);