mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
removed cacheOrGet
This commit is contained in:
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -30,6 +30,7 @@ import com.intellij.psi.impl.file.PsiPackageImpl;
|
||||
import com.intellij.psi.impl.java.stubs.index.JavaFullClassNameIndex;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import com.intellij.util.ConcurrencyUtil;
|
||||
import com.intellij.util.Query;
|
||||
import com.intellij.util.containers.ConcurrentHashMap;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -127,7 +128,7 @@ public class JavaFileManagerImpl implements JavaFileManager, Disposable {
|
||||
if (cached == null) {
|
||||
cached = findClassInIndex(qName, scope);
|
||||
if (cached != null) {
|
||||
cached = myCachedObjectClassMap.cacheOrGet(scope, cached);
|
||||
cached = ConcurrencyUtil.cacheOrGet(myCachedObjectClassMap, scope, cached);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ import com.intellij.psi.javadoc.PsiDocTag;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.util.ConcurrencyUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.containers.ConcurrentHashMap;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
@@ -408,7 +409,7 @@ public class PsiElementFactoryImpl extends PsiJavaParserFacadeImpl implements Ps
|
||||
PsiClass aClass = JavaPsiFacade.getInstance(myManager.getProject()).findClass(CommonClassNames.JAVA_LANG_OBJECT, resolveScope);
|
||||
if (aClass != null) {
|
||||
cachedObjectType = new PsiImmediateClassType(aClass, PsiSubstitutor.EMPTY);
|
||||
cachedObjectType = myCachedObjectType.cacheOrGet(resolveScope, cachedObjectType);
|
||||
cachedObjectType = ConcurrencyUtil.cacheOrGet(myCachedObjectType, resolveScope, cachedObjectType);
|
||||
return cachedObjectType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.intellij.util.containers;
|
||||
|
||||
import com.intellij.util.ConcurrencyUtil;
|
||||
import com.intellij.util.concurrency.AtomicFieldUpdater;
|
||||
import gnu.trove.TObjectHashingStrategy;
|
||||
import jsr166e.ForkJoinPool;
|
||||
@@ -3826,13 +3825,6 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> implements Concur
|
||||
return o1.equals(o2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return value if there is no entry in the map, or corresponding value if entry already exists
|
||||
*/
|
||||
public V cacheOrGet(final K key, final V value) {
|
||||
return ConcurrencyUtil.cacheOrGet(this, key, value);
|
||||
}
|
||||
|
||||
private int hash(K key) {
|
||||
return spread(myHashingStrategy.computeHashCode(key));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user