本文整理匯總了Java中com.intellij.psi.impl.PsiSubstitutorImpl類的典型用法代碼示例。如果您正苦於以下問題:Java PsiSubstitutorImpl類的具體用法?Java PsiSubstitutorImpl怎麽用?Java PsiSubstitutorImpl使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PsiSubstitutorImpl類屬於com.intellij.psi.impl包,在下文中一共展示了PsiSubstitutorImpl類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: calcType
import com.intellij.psi.impl.PsiSubstitutorImpl; //導入依賴的package包/類
@Override
protected PsiClassType calcType() {
final PsiElement classElement = myClass.getElement();
if (!(classElement instanceof PsiClass)) return null;
Map<PsiTypeParameter, PsiType> resurrected = new HashMap<PsiTypeParameter, PsiType>();
final Set<Map.Entry<SmartPsiElementPointer, SmartTypePointer>> set = myMap.entrySet();
for (Map.Entry<SmartPsiElementPointer, SmartTypePointer> entry : set) {
PsiElement element = entry.getKey().getElement();
if (element instanceof PsiTypeParameter) {
SmartTypePointer typePointer = entry.getValue();
resurrected.put((PsiTypeParameter)element, typePointer == null ? null : typePointer.getType());
}
}
for (PsiTypeParameter typeParameter : PsiUtil.typeParametersIterable((PsiClass)classElement)) {
if (!resurrected.containsKey(typeParameter)) {
resurrected.put(typeParameter, null);
}
}
final PsiSubstitutor resurrectedSubstitutor = PsiSubstitutorImpl.createSubstitutor(resurrected);
return new PsiImmediateClassType((PsiClass)classElement, resurrectedSubstitutor);
}
示例2: findRawMethodSignatures
import com.intellij.psi.impl.PsiSubstitutorImpl; //導入依賴的package包/類
@NotNull
public static MultiMap<MethodSignature, PsiMethod> findRawMethodSignatures(@NotNull PsiMethod[] methods, @NotNull PsiClass clazz) {
Map<PsiTypeParameter, PsiType> initialMap = ContainerUtil.newHashMap();
for (PsiTypeParameter parameter : clazz.getTypeParameters()) {
initialMap.put(parameter, null);
}
final PsiSubstitutor initialSubstitutor = PsiSubstitutorImpl.createSubstitutor(initialMap);
MultiMap<MethodSignature, PsiMethod> result = new MultiMap<MethodSignature, PsiMethod>();
for (PsiMethod method : methods) {
final PsiMethod actual = method instanceof GrReflectedMethod ? ((GrReflectedMethod)method).getBaseMethod() : method;
PsiSubstitutor substitutor = calcRawSubstitutor(initialMap, initialSubstitutor, actual);
result.putValue(method.getSignature(substitutor), actual);
}
return result;
}
示例3: removeRawMappingsLeftFromResolve
import com.intellij.psi.impl.PsiSubstitutorImpl; //導入依賴的package包/類
@NotNull
private static PsiSubstitutor removeRawMappingsLeftFromResolve(@NotNull PsiSubstitutor substitutor)
{
Map<PsiTypeParameter, PsiType> map = null;
for(Map.Entry<PsiTypeParameter, PsiType> entry : substitutor.getSubstitutionMap().entrySet())
{
if(entry.getValue() == null)
{
if(map == null)
{
map = new THashMap<PsiTypeParameter, PsiType>();
}
map.put(entry.getKey(), entry.getValue());
}
}
if(map == null)
{
return substitutor;
}
Map<PsiTypeParameter, PsiType> newMap = new THashMap<PsiTypeParameter, PsiType>(substitutor.getSubstitutionMap());
newMap.keySet().removeAll(map.keySet());
return PsiSubstitutorImpl.createSubstitutor(newMap);
}
示例4: TypeView
import com.intellij.psi.impl.PsiSubstitutorImpl; //導入依賴的package包/類
public TypeView(PsiVariable var, PsiSubstitutor varSubstitutor, PsiSubstitutor evalSubstitutor)
{
myOriginType = varSubstitutor != null ? varSubstitutor.substitute(var.getType()) : var.getType();
Map<PsiTypeParameter, PsiType> realMap = new HashMap<>();
if(varSubstitutor != null)
{
realMap.putAll(varSubstitutor.getSubstitutionMap());
}
if(evalSubstitutor != null)
{
realMap.putAll(evalSubstitutor.getSubstitutionMap());
}
myType = PsiSubstitutorImpl.createSubstitutor(realMap).substitute(myTypeEvaluator.getType(var));
myChanged = !(myOriginType == null || myType == null) && !myType.equals(myOriginType);
}
示例5: composeIfNotAssignable
import com.intellij.psi.impl.PsiSubstitutorImpl; //導入依賴的package包/類
private static PsiSubstitutor composeIfNotAssignable(PsiSubstitutor actual, PsiSubstitutor required)
{
if(actual == PsiSubstitutor.EMPTY)
{
return required;
}
if(required == PsiSubstitutor.EMPTY)
{
return actual;
}
PsiSubstitutor result = PsiSubstitutorImpl.createSubstitutor(actual.getSubstitutionMap());
for(Map.Entry<PsiTypeParameter, PsiType> e : required.getSubstitutionMap().entrySet())
{
final PsiTypeParameter typeParameter = e.getKey();
final PsiType requiredType = e.getValue();
final PsiType actualType = result.getSubstitutionMap().get(typeParameter);
if(requiredType != null && (actualType == null || !TypeConversionUtil.isAssignable(actualType, requiredType)))
{
result = result.put(typeParameter, requiredType);
}
}
return result;
}
示例6: advancedResolveImpl
import com.intellij.psi.impl.PsiSubstitutorImpl; //導入依賴的package包/類
private JavaResolveResult advancedResolveImpl(@NotNull PsiFile containingFile) {
PsiTypeElement[] typeElements = myRefParameterList == null ? PsiTypeElement.EMPTY_ARRAY : myRefParameterList.getTypeParameterElements();
PsiElement resolve = resolveElement(containingFile);
if (resolve == null) return null;
if (resolve instanceof PsiClass) {
Map<PsiTypeParameter, PsiType> substitutionMap = new HashMap<PsiTypeParameter, PsiType>();
int index = 0;
for (PsiTypeParameter parameter : PsiUtil.typeParametersIterable((PsiClass)resolve)) {
if (index >= typeElements.length) {
PsiTypeParameterListOwner parameterOwner = parameter.getOwner();
if (parameterOwner == resolve) {
substitutionMap.put(parameter, null);
}
else if (parameterOwner instanceof PsiClass) {
PsiElement containingClass = myParent;
while ((containingClass = PsiTreeUtil.getParentOfType(containingClass, PsiClass.class, true)) != null) {
PsiSubstitutor superClassSubstitutor =
TypeConversionUtil.getClassSubstitutor((PsiClass)parameterOwner, (PsiClass)containingClass, PsiSubstitutor.EMPTY);
if (superClassSubstitutor != null) {
substitutionMap.put(parameter, superClassSubstitutor.substitute(parameter));
break;
}
}
}
}
else {
substitutionMap.put(parameter, typeElements[index].getType());
}
index++;
}
collectOuterClassTypeArgs((PsiClass)resolve, myCanonicalText, substitutionMap);
return new CandidateInfo(resolve, PsiSubstitutorImpl.createSubstitutor(substitutionMap));
}
else {
return new CandidateInfo(resolve, PsiSubstitutor.EMPTY);
}
}
示例7: removeRawMappingsLeftFromResolve
import com.intellij.psi.impl.PsiSubstitutorImpl; //導入依賴的package包/類
@NotNull
private static PsiSubstitutor removeRawMappingsLeftFromResolve(@NotNull PsiSubstitutor substitutor) {
Map<PsiTypeParameter, PsiType> map = null;
for (Map.Entry<PsiTypeParameter, PsiType> entry : substitutor.getSubstitutionMap().entrySet()) {
if (entry.getValue() == null) {
if (map == null) map = new THashMap<PsiTypeParameter, PsiType>();
map.put(entry.getKey(), entry.getValue());
}
}
if (map == null) return substitutor;
Map<PsiTypeParameter, PsiType> newMap = new THashMap<PsiTypeParameter, PsiType>(substitutor.getSubstitutionMap());
newMap.keySet().removeAll(map.keySet());
return PsiSubstitutorImpl.createSubstitutor(newMap);
}
示例8: calcRawSubstitutor
import com.intellij.psi.impl.PsiSubstitutorImpl; //導入依賴的package包/類
@NotNull
private static PsiSubstitutor calcRawSubstitutor(@NotNull Map<PsiTypeParameter, PsiType> initialMap,
@NotNull PsiSubstitutor initialSubstitutor,
@NotNull PsiMethod actual) {
if (actual.hasTypeParameters()) {
final HashMap<PsiTypeParameter, PsiType> map1 = ContainerUtil.newHashMap(initialMap);
for (PsiTypeParameter parameter : actual.getTypeParameters()) {
map1.put(parameter, null);
}
return PsiSubstitutorImpl.createSubstitutor(map1);
}
else {
return initialSubstitutor;
}
}
示例9: advancedResolveImpl
import com.intellij.psi.impl.PsiSubstitutorImpl; //導入依賴的package包/類
private JavaResolveResult advancedResolveImpl() {
PsiTypeElement[] typeElements = myRefParameterList == null ? PsiTypeElement.EMPTY_ARRAY : myRefParameterList.getTypeParameterElements();
PsiElement resolve = resolveElement();
if (resolve instanceof PsiClass) {
Map<PsiTypeParameter, PsiType> substitutionMap = new HashMap<PsiTypeParameter, PsiType>();
int index = 0;
for (PsiTypeParameter parameter : PsiUtil.typeParametersIterable((PsiClass)resolve)) {
if (index >= typeElements.length) {
PsiTypeParameterListOwner parameterOwner = parameter.getOwner();
if (parameterOwner == resolve) {
substitutionMap.put(parameter, null);
}
else if (parameterOwner instanceof PsiClass) {
PsiElement containingClass = myParent;
while ((containingClass = PsiTreeUtil.getParentOfType(containingClass, PsiClass.class, true)) != null) {
PsiSubstitutor superClassSubstitutor =
TypeConversionUtil.getClassSubstitutor((PsiClass)parameterOwner, (PsiClass)containingClass, PsiSubstitutor.EMPTY);
if (superClassSubstitutor != null) {
substitutionMap.put(parameter, superClassSubstitutor.substitute(parameter));
break;
}
}
}
}
else {
substitutionMap.put(parameter, typeElements[index].getType());
}
index++;
}
return new CandidateInfo(resolve, PsiSubstitutorImpl.createSubstitutor(substitutionMap));
}
else {
return new CandidateInfo(resolve, PsiSubstitutor.EMPTY);
}
}
示例10: removeRawMappingsLeftFromResolve
import com.intellij.psi.impl.PsiSubstitutorImpl; //導入依賴的package包/類
@NotNull
private static PsiSubstitutor removeRawMappingsLeftFromResolve(@NotNull PsiSubstitutor substitutor) {
Map<PsiTypeParameter, PsiType> map = null;
for (Map.Entry<PsiTypeParameter, PsiType> entry : substitutor.getSubstitutionMap().entrySet()) {
if (entry.getValue() == null) {
if (map == null) map = new THashMap<PsiTypeParameter, PsiType>();
map.put(entry.getKey(), entry.getValue());
}
}
if (map == null) return substitutor;
Map<PsiTypeParameter, PsiType> newmap = new THashMap<PsiTypeParameter, PsiType>(substitutor.getSubstitutionMap());
newmap.keySet().removeAll(map.keySet());
return PsiSubstitutorImpl.createSubstitutor(newmap);
}
示例11: calcType
import com.intellij.psi.impl.PsiSubstitutorImpl; //導入依賴的package包/類
@Override
protected PsiClassType calcType()
{
final PsiElement classElement = myClass.getElement();
if(!(classElement instanceof PsiClass))
{
return null;
}
Map<PsiTypeParameter, PsiType> resurrected = new HashMap<PsiTypeParameter, PsiType>();
final Set<Map.Entry<SmartPsiElementPointer, SmartTypePointer>> set = myMap.entrySet();
for(Map.Entry<SmartPsiElementPointer, SmartTypePointer> entry : set)
{
PsiElement element = entry.getKey().getElement();
if(element instanceof PsiTypeParameter)
{
SmartTypePointer typePointer = entry.getValue();
resurrected.put((PsiTypeParameter) element, typePointer == null ? null : typePointer.getType());
}
}
for(PsiTypeParameter typeParameter : PsiUtil.typeParametersIterable((PsiClass) classElement))
{
if(!resurrected.containsKey(typeParameter))
{
resurrected.put(typeParameter, null);
}
}
final PsiSubstitutor resurrectedSubstitutor = PsiSubstitutorImpl.createSubstitutor(resurrected);
return new PsiImmediateClassType((PsiClass) classElement, resurrectedSubstitutor);
}
示例12: advancedResolveImpl
import com.intellij.psi.impl.PsiSubstitutorImpl; //導入依賴的package包/類
private JavaResolveResult advancedResolveImpl(@NotNull PsiFile containingFile)
{
PsiTypeElement[] typeElements = myRefParameterList == null ? PsiTypeElement.EMPTY_ARRAY : myRefParameterList.getTypeParameterElements();
PsiElement resolve = resolveElement(containingFile);
if(resolve == null)
{
return null;
}
if(resolve instanceof PsiClass)
{
Map<PsiTypeParameter, PsiType> substitutionMap = new HashMap<>();
int index = 0;
for(PsiTypeParameter parameter : PsiUtil.typeParametersIterable((PsiClass) resolve))
{
if(index >= typeElements.length)
{
PsiTypeParameterListOwner parameterOwner = parameter.getOwner();
if(parameterOwner == resolve)
{
substitutionMap.put(parameter, null);
}
else if(parameterOwner instanceof PsiClass)
{
PsiElement containingClass = myParent;
while((containingClass = PsiTreeUtil.getParentOfType(containingClass, PsiClass.class, true)) != null)
{
PsiSubstitutor superClassSubstitutor = TypeConversionUtil.getClassSubstitutor((PsiClass) parameterOwner, (PsiClass) containingClass, PsiSubstitutor.EMPTY);
if(superClassSubstitutor != null)
{
substitutionMap.put(parameter, superClassSubstitutor.substitute(parameter));
break;
}
}
}
}
else
{
substitutionMap.put(parameter, typeElements[index].getType());
}
index++;
}
collectOuterClassTypeArgs((PsiClass) resolve, myCanonicalText, substitutionMap);
return new CandidateInfo(resolve, PsiSubstitutorImpl.createSubstitutor(substitutionMap));
}
else
{
return new CandidateInfo(resolve, PsiSubstitutor.EMPTY);
}
}