Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/previewfeature/CallMethodsWithPreviewFeature.java
Nikita Eshkeev 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

31 lines
1.4 KiB
Java

import jdk.internal.PreviewFeature;
import jdk.internal.PreviewFeature.Feature;
import <error descr="Patterns in 'instanceof' are not supported at language level '9'">org.myorg.preview.FromPreview</error>;
class Main {
static {
<error descr="Patterns in 'instanceof' are not supported at language level '9'">requirePatternMatching</error>();
<error descr="Text block literals are not supported at language level '9'">Main.requireTextBlocks</error>();
<error descr="Records are not supported at language level '9'">new Main().requireRecords</error>();
final <error descr="Text block literals are not supported at language level '9'">NotDirectlyAnnotatedMethod</error> a = new <error descr="Text block literals are not supported at language level '9'">NotDirectlyAnnotatedMethod</error>();
<error descr="Text block literals are not supported at language level '9'">a.f</error>();
<error descr="Text block literals are not supported at language level '9'">NotDirectlyAnnotatedMethod</error>.g();
}
@PreviewFeature(feature=Feature.PATTERN_MATCHING_IN_INSTANCEOF)
static void requirePatternMatching(){}
@PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.TEXT_BLOCKS)
static void requireTextBlocks(){}
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS)
void requireRecords(){}
}
@PreviewFeature(feature=Feature.TEXT_BLOCKS)
class NotDirectlyAnnotatedMethod {
void f(){}
static void g(){}
}