当前位置: 首页>>代码示例>>Java>>正文


Java PsiTypeVariableFactory类代码示例

本文整理汇总了Java中com.intellij.refactoring.typeCook.deductive.PsiTypeVariableFactory的典型用法代码示例。如果您正苦于以下问题:Java PsiTypeVariableFactory类的具体用法?Java PsiTypeVariableFactory怎么用?Java PsiTypeVariableFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PsiTypeVariableFactory类属于com.intellij.refactoring.typeCook.deductive包,在下文中一共展示了PsiTypeVariableFactory类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createParameterizedType

import com.intellij.refactoring.typeCook.deductive.PsiTypeVariableFactory; //导入依赖的package包/类
private static PsiType createParameterizedType(final PsiType t,
                                               final PsiTypeVariableFactory factory,
                                               final boolean upper,
                                               final PsiElement context) {
  if (t == null || (upper && t.getCanonicalText().equals(CommonClassNames.JAVA_LANG_OBJECT))) {
    return factory.create(context);
  }

  if (t instanceof PsiClassType) {
    final PsiClassType.ClassResolveResult result = resolveType(t);
    final PsiSubstitutor aSubst = result.getSubstitutor();
    final PsiClass aClass = result.getElement();

    PsiSubstitutor theSubst = PsiSubstitutor.EMPTY;

    final Set<PsiTypeVariable> cluster = new HashSet<PsiTypeVariable>();

    for (final PsiTypeParameter parm : aSubst.getSubstitutionMap().keySet()) {
      final PsiType type = createParameterizedType(aSubst.substitute(parm), factory, false, context);

      if (type instanceof PsiTypeVariable) {
        cluster.add((PsiTypeVariable)type);
      }

      theSubst = theSubst.put(parm, type);
    }

    if (cluster.size() > 1) {
      factory.registerCluster(cluster);
    }

    return JavaPsiFacade.getInstance(aClass.getProject()).getElementFactory().createType(aClass, theSubst);
  }
  else if (t instanceof PsiArrayType) {
    return createParameterizedType(((PsiArrayType)t).getComponentType(), factory, upper, context).createArrayType();
  }

  return t;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:Util.java

示例2: ReductionSystem

import com.intellij.refactoring.typeCook.deductive.PsiTypeVariableFactory; //导入依赖的package包/类
public ReductionSystem(final Project project,
                       final Set<PsiElement> elements,
                       final Map<PsiElement, PsiType> types,
                       final PsiTypeVariableFactory factory,
                       final Settings settings) {
  myProject = project;
  myElements = elements;
  myTypes = types;
  myTypeVariableFactory = factory;
  myBoundVariables = null;
  mySettings = settings;
  myCastToOperandType = new HashMap<PsiTypeCastExpression, PsiType>();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ReductionSystem.java

示例3: SystemBuilder

import com.intellij.refactoring.typeCook.deductive.PsiTypeVariableFactory; //导入依赖的package包/类
public SystemBuilder(final Project project, final Settings settings) {
  myProject = project;
  myManager = PsiManager.getInstance(myProject);
  mySettings = settings;
  myMethodCache = new HashMap<PsiElement, Boolean>();
  myParameters = new HashMap<PsiParameter, PsiParameter>();
  myMethods = new HashMap<PsiMethod, PsiMethod>();
  myTypes = new HashMap<PsiElement, PsiType>();
  myVisitedConstructions = new HashSet<PsiAnchor>();
  myTypeVariableFactory = new PsiTypeVariableFactory();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:SystemBuilder.java

示例4: createParameterizedType

import com.intellij.refactoring.typeCook.deductive.PsiTypeVariableFactory; //导入依赖的package包/类
private static PsiType createParameterizedType(final PsiType t,
                                               final PsiTypeVariableFactory factory,
                                               final boolean upper,
                                               final PsiElement context) {
  if (t == null || (upper && t.getCanonicalText().equals(CommonClassNames.JAVA_LANG_OBJECT))) {
    return factory.create(context);
  }

  if (t instanceof PsiClassType) {
    final PsiClassType.ClassResolveResult result = resolveType(t);
    final PsiSubstitutor aSubst = result.getSubstitutor();
    final PsiClass aClass = result.getElement();

    PsiSubstitutor theSubst = PsiSubstitutor.EMPTY;

    final HashSet<PsiTypeVariable> cluster = new HashSet<PsiTypeVariable>();

    for (final PsiTypeParameter parm : aSubst.getSubstitutionMap().keySet()) {
      final PsiType type = createParameterizedType(aSubst.substitute(parm), factory, false, context);

      if (type instanceof PsiTypeVariable) {
        cluster.add((PsiTypeVariable)type);
      }

      theSubst = theSubst.put(parm, type);
    }

    if (cluster.size() > 1) {
      factory.registerCluster(cluster);
    }

    return JavaPsiFacade.getInstance(aClass.getProject()).getElementFactory().createType(aClass, theSubst);
  }
  else if (t instanceof PsiArrayType) {
    return createParameterizedType(((PsiArrayType)t).getComponentType(), factory, upper, context).createArrayType();
  }

  return t;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:40,代码来源:Util.java

示例5: ReductionSystem

import com.intellij.refactoring.typeCook.deductive.PsiTypeVariableFactory; //导入依赖的package包/类
public ReductionSystem(final Project project,
                       final HashSet<PsiElement> elements,
                       final HashMap<PsiElement, PsiType> types,
                       final PsiTypeVariableFactory factory,
                       final Settings settings) {
  myProject = project;
  myElements = elements;
  myTypes = types;
  myTypeVariableFactory = factory;
  myBoundVariables = null;
  mySettings = settings;
  myCastToOperandType = new HashMap<PsiTypeCastExpression, PsiType>();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:ReductionSystem.java

示例6: getVariableFactory

import com.intellij.refactoring.typeCook.deductive.PsiTypeVariableFactory; //导入依赖的package包/类
public PsiTypeVariableFactory getVariableFactory() {
  return myTypeVariableFactory;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:ReductionSystem.java


注:本文中的com.intellij.refactoring.typeCook.deductive.PsiTypeVariableFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。