mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-psi] Do not resolve super() call to Object() constructor when superclass is not resolved
Needed for incomplete project model. GitOrigin-RevId: 2acbba54f4fd50fb3261601f1cb66175d7f19da6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5218db2d69
commit
7fe1b165a4
@@ -2,6 +2,7 @@
|
||||
|
||||
package com.intellij.psi.scope.util;
|
||||
|
||||
import com.intellij.lang.jvm.types.JvmReferenceType;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProgressIndicatorProvider;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
@@ -21,6 +22,7 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.psi.util.TypeConversionUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -247,7 +249,8 @@ public final class PsiScopesUtil {
|
||||
throw new MethodProcessorSetupFailedException("Can't resolve class for super expression");
|
||||
}
|
||||
|
||||
final PsiClass superClass = aClass.getSuperClass();
|
||||
JvmReferenceType type = aClass.getSuperClassType();
|
||||
final PsiClass superClass = type == null ? null : ObjectUtils.tryCast(type.resolve(), PsiClass.class);
|
||||
if (superClass != null) {
|
||||
PsiSubstitutor substitutor = PsiSubstitutor.EMPTY;
|
||||
PsiClass runSuper = superClass;
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
|
||||
import <info descr="Not resolved until the project is fully loaded">com</info>.<info descr="Not resolved until the project is fully loaded">example</info>.<info descr="Not resolved until the project is fully loaded">Super</info>;
|
||||
|
||||
class Sub extends <info descr="Not resolved until the project is fully loaded">Super</info> {
|
||||
Sub() {
|
||||
<info descr="Not resolved until the project is fully loaded">super</info>(123);
|
||||
}
|
||||
}
|
||||
+2
@@ -37,4 +37,6 @@ public final class IncompleteModelHighlightingTest extends LightDaemonAnalyzerTe
|
||||
public void testInferenceFailure() { doTest(); }
|
||||
|
||||
public void testIncompleteRecursiveParameters() { doTest(); }
|
||||
|
||||
public void testSuperCall() { doTest(); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user