Java 类com.intellij.psi.PsiReferenceParameterList 实例源码

项目:consulo-java    文件:PsiReferenceExpressionBase.java   
@NotNull
@Override
public PsiType[] getTypeParameters()
{
    final PsiReferenceParameterList parameterList = getParameterList();
    return parameterList != null ? parameterList.getTypeArguments() : PsiType.EMPTY_ARRAY;
}
项目:consulo-java    文件:ChangeTypeSignatureAction.java   
@Override
protected boolean isAvailableOnElementInEditorAndFile(@NotNull final PsiElement element, @NotNull final Editor editor, @NotNull PsiFile file, @NotNull DataContext context)
{
    final int offset = TargetElementUtil.adjustOffset(file, editor.getDocument(), editor.getCaretModel().getOffset());
    final PsiElement psiElement = file.findElementAt(offset);
    final PsiReferenceParameterList referenceParameterList = PsiTreeUtil.getParentOfType(psiElement, PsiReferenceParameterList.class);
    if(referenceParameterList != null)
    {
        return referenceParameterList.getTypeArguments().length > 0;
    }
    return PsiTreeUtil.getParentOfType(psiElement, PsiTypeElement.class) != null;
}
项目:manifold-ij    文件:VarHandler.java   
private PsiType processLocalVariableInitializer( final PsiExpression psiExpression )
{
  PsiType result = null;
  if( null != psiExpression && !(psiExpression instanceof PsiArrayInitializerExpression) )
  {

    if( psiExpression instanceof PsiConditionalExpression )
    {
      result = RecursionManager.doPreventingRecursion( psiExpression, true, () ->
      {
        final PsiExpression thenExpression = ((PsiConditionalExpression)psiExpression).getThenExpression();
        final PsiExpression elseExpression = ((PsiConditionalExpression)psiExpression).getElseExpression();

        final PsiType thenType = null != thenExpression ? thenExpression.getType() : null;
        final PsiType elseType = null != elseExpression ? elseExpression.getType() : null;

        if( thenType == null )
        {
          return elseType;
        }
        if( elseType == null )
        {
          return thenType;
        }

        if( TypeConversionUtil.isAssignable( thenType, elseType, false ) )
        {
          return thenType;
        }
        if( TypeConversionUtil.isAssignable( elseType, thenType, false ) )
        {
          return elseType;
        }
        return thenType;
      } );
    }
    else
    {
      result = RecursionManager.doPreventingRecursion( psiExpression, true, psiExpression::getType );
    }

    if( psiExpression instanceof PsiNewExpression )
    {
      final PsiJavaCodeReferenceElement reference = ((PsiNewExpression)psiExpression).getClassOrAnonymousClassReference();
      if( reference != null )
      {
        final PsiReferenceParameterList parameterList = reference.getParameterList();
        if( parameterList != null )
        {
          final PsiTypeElement[] elements = parameterList.getTypeParameterElements();
          if( elements.length == 1 && elements[0].getType() instanceof PsiDiamondType )
          {
            result = TypeConversionUtil.erasure( result );
          }
        }
      }
    }
  }

  return result;
}
项目:Android_Lint_SRP_Practice_Example    文件:PsiClassStructureDetector.java   
@Override
public void visitReferenceParameterList(PsiReferenceParameterList list) {
    mVisitor.report("PsiReferenceParameterList", list.getText(), list);
    super.visitElement(list);
}
项目:lombok-intellij-plugin    文件:ValProcessor.java   
private PsiType processLocalVariableInitializer(final PsiExpression psiExpression) {
  PsiType result = null;
  if (null != psiExpression && !(psiExpression instanceof PsiArrayInitializerExpression)) {

    if (psiExpression instanceof PsiConditionalExpression) {
      result = RecursionManager.doPreventingRecursion(psiExpression, true, new Computable<PsiType>() {
        @Override
        public PsiType compute() {
          final PsiExpression thenExpression = ((PsiConditionalExpression) psiExpression).getThenExpression();
          final PsiExpression elseExpression = ((PsiConditionalExpression) psiExpression).getElseExpression();

          final PsiType thenType = null != thenExpression ? thenExpression.getType() : null;
          final PsiType elseType = null != elseExpression ? elseExpression.getType() : null;

          if (thenType == null) {
            return elseType;
          }
          if (elseType == null) {
            return thenType;
          }

          if (TypeConversionUtil.isAssignable(thenType, elseType, false)) {
            return thenType;
          }
          if (TypeConversionUtil.isAssignable(elseType, thenType, false)) {
            return elseType;
          }
          return thenType;
        }
      });
    } else {
      result = RecursionManager.doPreventingRecursion(psiExpression, true, new Computable<PsiType>() {
        @Override
        public PsiType compute() {
          return psiExpression.getType();
        }
      });
    }

    if (psiExpression instanceof PsiNewExpression) {
      final PsiJavaCodeReferenceElement reference = ((PsiNewExpression) psiExpression).getClassOrAnonymousClassReference();
      if (reference != null) {
        final PsiReferenceParameterList parameterList = reference.getParameterList();
        if (parameterList != null) {
          final PsiTypeElement[] elements = parameterList.getTypeParameterElements();
          if (elements.length == 1 && elements[0].getType() instanceof PsiDiamondType) {
            result = TypeConversionUtil.erasure(result);
          }
        }
      }
    }
  }

  return result;
}
项目:consulo-java    文件:PsiReferenceExpressionBase.java   
@Override
public PsiReferenceParameterList getParameterList()
{
    return PsiTreeUtil.getChildOfType(this, PsiReferenceParameterList.class);
}