mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
[java-highlighting] IDEA-362977 Incorrectly check hierarchy for permitted classes
GitOrigin-RevId: 2657b06d91569f31b08eb82c14a9340b7b0ca56c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
be1000d644
commit
fe129bc95c
+1
-1
@@ -1056,7 +1056,7 @@ public class PatternsInSwitchBlockHighlightingModel extends SwitchBlockHighlight
|
||||
PsiClass notVisitedClass = notVisitedClasses.poll();
|
||||
if (!isAbstractSealed(notVisitedClass) || visitedClasses.contains(notVisitedClass)) continue;
|
||||
visitedClasses.add(notVisitedClass);
|
||||
Collection<PsiClass> permittedClasses = getPermittedClasses(psiClass);
|
||||
Collection<PsiClass> permittedClasses = getPermittedClasses(notVisitedClass);
|
||||
result.addAll(permittedClasses);
|
||||
notVisitedClasses.addAll(permittedClasses);
|
||||
}
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package org;
|
||||
|
||||
public class DoubleInnerPermitClass {
|
||||
//
|
||||
// Root
|
||||
// ^
|
||||
// |
|
||||
// +---+----+
|
||||
// | |
|
||||
// Left1 |
|
||||
// ^ |
|
||||
// | Right
|
||||
// Left2 ^
|
||||
// ^ |
|
||||
// | |
|
||||
// +--+-----+
|
||||
// |
|
||||
// Impl
|
||||
//
|
||||
|
||||
public sealed interface Root {}
|
||||
|
||||
public sealed interface Left1 extends Root {}
|
||||
public sealed interface Left2 extends Left1 {}
|
||||
|
||||
public sealed interface Right extends Root {}
|
||||
|
||||
public record Impl() implements Left2, Right {}
|
||||
|
||||
|
||||
public static void tryArrayComponentType(Root vt) {
|
||||
switch (vt) {
|
||||
case Left1 _ -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
@@ -202,6 +202,10 @@ public class LightPatternsForSwitchHighlightingTest extends LightJavaCodeInsight
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testDoubleInnerPermitClass() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSwitchWithPrimitivesNotAllowed() {
|
||||
IdeaTestUtil.withLevel(getModule(), LanguageLevel.JDK_22, this::doTest);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user