mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
good code red: leave empty subst when processing type params supers (IDEA-67680)
This commit is contained in:
@@ -675,6 +675,9 @@ public class PsiClassImplUtil {
|
||||
if (superClass == null) continue;
|
||||
PsiSubstitutor finalSubstitutor = obtainFinalSubstitutor(superClass, superTypeResolveResult.getSubstitutor(), aClass,
|
||||
state.get(PsiSubstitutor.KEY), factory, languageLevel);
|
||||
if (aClass instanceof PsiTypeParameter && PsiUtil.isRawSubstitutor(superClass, finalSubstitutor)) {
|
||||
finalSubstitutor = PsiSubstitutor.EMPTY;
|
||||
}
|
||||
if (!processDeclarationsInClass(superClass, processor, state.put(PsiSubstitutor.KEY, finalSubstitutor), visited, last, place, isRaw)) {
|
||||
resolved = true;
|
||||
}
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
class A<D> {
|
||||
abstract class C<S> {
|
||||
<T extends A> void foo(T.C<Integer> x) {
|
||||
Integer bar = x.bar();
|
||||
}
|
||||
|
||||
<T extends A> void foo1(A.C<error descr="Type arguments given on a raw type"><Integer></error> x) {
|
||||
<error descr="Incompatible types. Found: 'java.lang.Object', required: 'java.lang.Integer'">Integer bar = x.bar();</error>
|
||||
}
|
||||
|
||||
<T extends A> void foo2(A<String>.C<Integer> x) {
|
||||
Integer bar = x.bar();
|
||||
}
|
||||
|
||||
abstract S bar();
|
||||
}
|
||||
}
|
||||
|
||||
class A1 {
|
||||
abstract class C<S> {
|
||||
<T extends A1> void foo(T.C<Integer> x) {
|
||||
Integer bar = x.bar();
|
||||
}
|
||||
|
||||
<T extends A1> void foo1(A1.C<Integer> x) {
|
||||
Integer bar = x.bar();
|
||||
}
|
||||
|
||||
abstract S bar();
|
||||
}
|
||||
}
|
||||
@@ -151,6 +151,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIncompatibleReturnType() throws Exception { doTest(false); }
|
||||
public void testContinueInferenceAfterFirstRawResult() throws Exception { doTest(false); }
|
||||
public void testStaticOverride() throws Exception { doTest(false); }
|
||||
public void testTypeArgumentsGivenOnRawType() throws Exception { doTest(false); }
|
||||
|
||||
public void testJavaUtilCollections_NoVerify() throws Exception {
|
||||
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));
|
||||
|
||||
Reference in New Issue
Block a user