mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-11 11:36:59 +07:00
This patch encapsulates the logic that checks if a used feature is annotated with PreviewFeature in its own visitor. The visitor now checks both PreviewFeature annotations with old and new packages. GitOrigin-RevId: f3ddc2a840b8c3a8bb4e1a731e2c208002a29fd4
34 lines
1.3 KiB
Java
34 lines
1.3 KiB
Java
import jdk.internal.javac.PreviewFeature;
|
|
import jdk.internal.javac.PreviewFeature.Feature;
|
|
|
|
class Main {
|
|
@PreviewFeature(feature=Feature.PATTERN_MATCHING_IN_INSTANCEOF)
|
|
Main(){}
|
|
@PreviewFeature(feature=Feature.RECORDS)
|
|
Main(long i){}
|
|
@PreviewFeature(feature=Feature.TEXT_BLOCKS)
|
|
Main(String s){}
|
|
Main(int i){}
|
|
|
|
static {
|
|
<error descr="Patterns in 'instanceof' are not supported at language level '9'">new Main()</error>;
|
|
<error descr="Records are not supported at language level '9'">new Main(42l)</error>;
|
|
<error descr="Text block literals are not supported at language level '9'">new Main("42")</error>;
|
|
new Main(42);
|
|
new <error descr="Patterns in 'instanceof' are not supported at language level '9'">org.myorg.jdk.internal.javac.preview.FromPreview</error>() {
|
|
public void g(){}
|
|
};
|
|
new <error descr="Text block literals are not supported at language level '9'">NotDirectlyAnnotatedConstructor</error>();
|
|
<error descr="Text block literals are not supported at language level '9'">new DirectlyAnnotatedConstructor()</error>;
|
|
}
|
|
|
|
}
|
|
|
|
@PreviewFeature(feature=Feature.TEXT_BLOCKS)
|
|
class NotDirectlyAnnotatedConstructor { }
|
|
|
|
class DirectlyAnnotatedConstructor {
|
|
@PreviewFeature(feature=Feature.TEXT_BLOCKS)
|
|
DirectlyAnnotatedConstructor() {}
|
|
}
|