Commit Graph
6 Commits
Author SHA1 Message Date
Nikita Eshkeevandintellij-monorepo-bot 1789438a05 [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
2020-07-13 11:58:43 +00:00
Nikita Eshkeevandintellij-monorepo-bot 4d0743574a [codeInsight] IDEA-244252 IDEA shows no error for @PreviewFeature
This patch fixes the problems with reporting errors when:

- a class that is annotated with PreviewFeature instantiated;
- a method that is annotated with PreviewFeature used in a method reference;
- a class or an interface that is annotated with PreviewFeature is inherited

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

GitOrigin-RevId: 586caeddae4446ad398878e0bd4bf66858e4518c
2020-06-30 17:07:59 +00:00
Nikita Eshkeevandintellij-monorepo-bot 85c3473223 [codeInsight] IDEA-238740 Support the jdk.internal.PreviewFeature annotation
This patch adds check for of PreviewFeature for anonymous classes.

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

GitOrigin-RevId: db5fe980e3f83e0df05bd21ab063d2a2c2862d6b
2020-06-22 22:00:03 +03:00
Nikita Eshkeevandintellij-monorepo-bot 5e222f56a9 [codeInsight] IDEA-238740 Support the jdk.internal.PreviewFeature annotation
This patch fixes the problems according to the code review, it includes:

- inlining the trivial wrapper methods checkConstructorPreviewFeature, checkMethodCallPreviewFeatureAnnotation, checkTypePreviewFeatureAnnotation
- applying ObjectUtils#tryCast in HighlightUtil#checkPackagePreviewFeatureAnnotation
- simplifying HighlightVisitorImpl#visitImportStaticStatement by calling directly HighlightUtil#checkPreviewFeatureElement
- generalizing HighlightVisitorImpl#visitReferenceExpression's check if the element is annotated with PreviewFeature

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

GitOrigin-RevId: 954ad1bbb26352d7d98581b3ad95a360569b0636
2020-06-19 14:20:28 +03:00
Nikita Eshkeevandintellij-monorepo-bot ef90c9f857 [codeInsight] IDEA-238740 Support the jdk.internal.PreviewFeature annotation
This patch fixes the problems according to the code review, it includes:

- moving extractHighlightingFeature to HighlightingFeature and renaming it to fromPreviewFeatureAnnotation
- assuring the PreviewFeature annotation name by calling PsiAnnotation#hasQualifiedName instead of comparing the name by equals
- moving JDK_INTERNAL_PREVIEW_FEATURE to HighlightingFeature
- extracting repeating part of checking the language level to HighlightUtil#checkPreviewFeatureElement
- adding a new case "SEALED_CLASSES" to HighlightFeature#fromPreviewAnnotationName

In addition to that there is also more robust solution to detect invalid contexts in references and static imports. The test data updated accordingly.

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

GitOrigin-RevId: 999d43ec5d9315d0881d08ce9341433707de96a0
2020-06-18 23:18:40 +03:00
Nikita Eshkeevandintellij-monorepo-bot 6cdf8f6eef [codeInsight] IDEA-238740 Support the jdk.internal.PreviewFeature annotation
This patch adds support of the jdk.internal.PreviewFeature annotation

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

GitOrigin-RevId: b2f56d62c3b12475690f667628811e5345b1d1cf
2020-06-18 01:19:37 +03:00