mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 13:31:28 +07:00
[java-highlighting] IDEA-246970 Local annotations should not be allowed in Java15-preview
GitOrigin-RevId: 1a1de1372304095197fdecf0c7b10bd8e9780442
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5aeac35507
commit
4242b62d14
@@ -618,7 +618,7 @@ public final class HighlightClassUtil {
|
||||
}
|
||||
else if (aClass.isInterface()) {
|
||||
token = JavaTokenType.INTERFACE_KEYWORD;
|
||||
feature = HighlightingFeature.LOCAL_INTERFACES;
|
||||
feature = aClass.isAnnotationType() ? null : HighlightingFeature.LOCAL_INTERFACES;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
@@ -628,6 +628,12 @@ public final class HighlightClassUtil {
|
||||
.findFirst(e -> e instanceof PsiKeyword && ((PsiKeyword)e).getTokenType().equals(token))
|
||||
.orElseThrow(NoSuchElementException::new);
|
||||
PsiFile file = aClass.getContainingFile();
|
||||
if (feature == null) {
|
||||
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR)
|
||||
.range(anchor)
|
||||
.descriptionAndTooltip(JavaErrorBundle.message("annotation.cannot.be.local"))
|
||||
.create();
|
||||
}
|
||||
return HighlightUtil.checkFeature(anchor, feature, PsiUtil.getLanguageLevel(file), file);
|
||||
}
|
||||
|
||||
|
||||
@@ -494,3 +494,4 @@ local.classes.must.not.extend.sealed.classes=Local classes must not extend seale
|
||||
anonymous.classes.must.not.extend.sealed.classes=Anonymous classes must not extend sealed classes
|
||||
class.not.allowed.to.extend.sealed.class.from.another.package=Class is not allowed to extend sealed class from another package
|
||||
class.not.allowed.to.extend.sealed.class.from.another.module=Class is not allowed to extend sealed class from another module
|
||||
annotation.cannot.be.local=Local annotations are not allowed
|
||||
@@ -8,6 +8,10 @@ class X {
|
||||
Foo foo = () -> {};
|
||||
}
|
||||
|
||||
void annotation() {
|
||||
@<error descr="Local annotations are not allowed">interface</error> Anno {}
|
||||
}
|
||||
|
||||
void modifiers() {
|
||||
<error descr="Modifier 'static' not allowed here">static</error> interface Intf1 {}
|
||||
<error descr="Modifier 'private' not allowed here">private</error> interface Intf2 {}
|
||||
|
||||
Reference in New Issue
Block a user