[codeInsight] IDEA-244252 IDEA shows no error for @PreviewFeature

This patch applies more robust approach to check if an enclosing class of a class member contains the PreviewFeature annotation by checking if the owner is instance of PsiMember or not. Such check is ignored for static members because they are ignored by javac too.

Signed-off-by: Nikita Eshkeev <nikita.eshkeev@jetbrains.com>

GitOrigin-RevId: da2d4341fc734f97535c1baf575b6a95a1350d6c
This commit is contained in:
Nikita Eshkeev
2020-07-13 11:58:43 +00:00
committed by intellij-monorepo-bot
parent 0d5bdbaa0e
commit 1789438a05
2 changed files with 11 additions and 3 deletions
@@ -1,10 +1,18 @@
import <error descr="Patterns in 'instanceof' are not supported at language level '9'">org.myorg.preview.FromPreview</error>;
import static <error descr="Patterns in 'instanceof' are not supported at language level '9'">org.myorg.preview.FromPreview</error>.f;
import static <error descr="Patterns in 'instanceof' are not supported at language level '9'">org.myorg.preview.FromPreview</error>.*;
import static <error descr="Class 'B' is in the default package">B</error>.g;
class Main {
static {
<error descr="Patterns in 'instanceof' are not supported at language level '9'">org.myorg.preview.FromPreview</error>.f();
<error descr="Patterns in 'instanceof' are not supported at language level '9'">f</error>();
<error descr="Text block literals are not supported at language level '9'">B</error>.g();
g();
}
}
@jdk.internal.PreviewFeature(feature = jdk.internal.PreviewFeature.Feature.TEXT_BLOCKS)
class B {
static void g() {}
}