Search in sources :

Example 1 with PsiExpressionListImpl

use of com.intellij.psi.impl.source.tree.java.PsiExpressionListImpl in project intellij-community by JetBrains.

the class JavaResolveUtil method resolveImaginarySuperCallInThisPlace.

/**
   * @return the constructor (or a class if there are none)
   * which the "{@code super();}" no-args call resolves to if inserted in the {@code place} (typically it would be inserted in the sub class constructor)
   * No code modifications happen in this method; it's used for resolving multiple overloaded constructors.
   */
public static PsiElement resolveImaginarySuperCallInThisPlace(@NotNull PsiMember place, @NotNull Project project, @NotNull PsiClass superClassWhichTheSuperCallMustResolveTo) {
    PsiExpressionListImpl expressionList = new PsiExpressionListImpl();
    final DummyHolder result = DummyHolderFactory.createHolder(PsiManager.getInstance(project), place);
    final FileElement holder = result.getTreeElement();
    holder.rawAddChildren((TreeElement) expressionList.getNode());
    return PsiResolveHelper.SERVICE.getInstance(project).resolveConstructor(PsiTypesUtil.getClassType(superClassWhichTheSuperCallMustResolveTo), expressionList, place).getElement();
}
Also used : DummyHolder(com.intellij.psi.impl.source.DummyHolder) PsiExpressionListImpl(com.intellij.psi.impl.source.tree.java.PsiExpressionListImpl) FileElement(com.intellij.psi.impl.source.tree.FileElement)

Aggregations

DummyHolder (com.intellij.psi.impl.source.DummyHolder)1 FileElement (com.intellij.psi.impl.source.tree.FileElement)1 PsiExpressionListImpl (com.intellij.psi.impl.source.tree.java.PsiExpressionListImpl)1