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

项目:consulo-java    文件:PsiMethodReferenceHighlightingUtil.java   
static HighlightInfo checkRawConstructorReference(@NotNull PsiMethodReferenceExpression expression)
{
    if(expression.isConstructor())
    {
        PsiType[] typeParameters = expression.getTypeParameters();
        if(typeParameters.length > 0)
        {
            PsiElement qualifier = expression.getQualifier();
            if(qualifier instanceof PsiReferenceExpression)
            {
                PsiElement resolve = ((PsiReferenceExpression) qualifier).resolve();
                if(resolve instanceof PsiClass && ((PsiClass) resolve).hasTypeParameters())
                {
                    return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression)
                            .descriptionAndTooltip("Raw constructor reference with explicit type parameters for " +
                                    "constructor").create();
                }
            }
        }
    }
    return null;
}
项目:consulo-java    文件:CallMapper.java   
public T mapFirst(PsiMethodReferenceExpression methodRef)
{
    if(methodRef == null)
    {
        return null;
    }
    List<CallHandler<T>> functions = myMap.get(methodRef.getReferenceName());
    if(functions == null)
    {
        return null;
    }
    for(CallHandler<T> function : functions)
    {
        T t = function.applyMethodReference(methodRef);
        if(t != null)
        {
            return t;
        }
    }
    return null;
}
项目:consulo-java    文件:ReplaceWithTrivialLambdaFix.java   
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor)
{
    PsiMethodReferenceExpression methodRef = ObjectUtils.tryCast(descriptor.getStartElement(), PsiMethodReferenceExpression.class);
    if(methodRef == null)
    {
        return;
    }
    PsiLambdaExpression lambdaExpression = LambdaRefactoringUtil.convertMethodReferenceToLambda(methodRef, true, true);
    if(lambdaExpression == null)
    {
        return;
    }
    PsiElement body = lambdaExpression.getBody();
    if(body == null)
    {
        return;
    }
    body.replace(JavaPsiFacade.getElementFactory(project).createExpressionFromText(myValue, lambdaExpression));
}
项目:consulo-java    文件:CustomMethodHandlers.java   
public static CustomMethodHandler find(MethodCallInstruction instruction)
{
    PsiElement context = instruction.getContext();
    if(context instanceof PsiMethodCallExpression)
    {
        return CUSTOM_METHOD_HANDLERS.mapFirst((PsiMethodCallExpression) context);
    }
    else if(context instanceof PsiMethodReferenceExpression)
    {
        return CUSTOM_METHOD_HANDLERS.mapFirst((PsiMethodReferenceExpression) context);
    }
    return null;
}
项目:Android_Lint_SRP_Practice_Example    文件:PsiClassStructureDetector.java   
@Override
public void visitMethodReferenceExpression(PsiMethodReferenceExpression expression) {
    mVisitor.report("PsiMethodReferenceExpression", expression.getText(), expression);
    super.visitReferenceExpression(expression);
}
项目:intellij-ce-playground    文件:MethodCallUsageInfo.java   
public MethodCallUsageInfo(final PsiReferenceExpression referenceExpression, final boolean internal) {
  super(referenceExpression);
  myIsInternal = internal;
  myMethodCallExpression = referenceExpression instanceof PsiMethodReferenceExpression ? referenceExpression : referenceExpression.getParent();
}
项目:tools-idea    文件:MethodCallUsageInfo.java   
public MethodCallUsageInfo(final PsiReferenceExpression referenceExpression, final boolean internal) {
  super(referenceExpression);
  myIsInternal = internal;
  myMethodCallExpression = referenceExpression instanceof PsiMethodReferenceExpression ? referenceExpression : referenceExpression.getParent();
}
项目:consulo-java    文件:MethodReferenceElementType.java   
@Override
public PsiMethodReferenceExpression createPsi(@NotNull ASTNode node)
{
    return new PsiMethodReferenceExpressionImpl(node);
}
项目:consulo-java    文件:MethodReferenceElementType.java   
@Override
public PsiMethodReferenceExpression createPsi(@NotNull FunctionalExpressionStub<PsiMethodReferenceExpression> stub)
{
    return new PsiMethodReferenceExpressionImpl(stub);
}
项目:consulo-java    文件:CallHandler.java   
public T applyMethodReference(PsiMethodReferenceExpression ref)
{
    return matcher().methodReferenceMatches(ref) ? myTransformer.apply(null) : null;
}
项目:consulo-java    文件:MethodCallUsageInfo.java   
public MethodCallUsageInfo(final PsiReferenceExpression referenceExpression, final boolean internal) {
  super(referenceExpression);
  myIsInternal = internal;
  myMethodCallExpression = referenceExpression instanceof PsiMethodReferenceExpression ? referenceExpression : referenceExpression.getParent();
}