mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java] forbid receiver parameters in annotation methods (IDEA-280218)
GitOrigin-RevId: befe655ef06c47f48e8de5c696bbd8ae28b4f7be
This commit is contained in:
committed by
intellij-monorepo-bot
parent
df4439ba6c
commit
575105fada
+2
-1
@@ -3248,7 +3248,8 @@ public final class HighlightUtil {
|
||||
|
||||
static HighlightInfo checkAnnotationMethodParameters(@NotNull PsiParameterList list) {
|
||||
final PsiElement parent = list.getParent();
|
||||
if (PsiUtil.isAnnotationMethod(parent) && !list.isEmpty()) {
|
||||
if (PsiUtil.isAnnotationMethod(parent) &&
|
||||
(!list.isEmpty() || PsiTreeUtil.getChildOfType(list, PsiReceiverParameter.class) != null)) {
|
||||
final String message = JavaErrorBundle.message("annotation.interface.members.may.not.have.parameters");
|
||||
final HighlightInfo highlightInfo =
|
||||
HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(list).descriptionAndTooltip(message).create();
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ class C {
|
||||
@Override
|
||||
public boolean equals(@TA C this, @TA Object other) { return false; }
|
||||
|
||||
@interface Anno { String f(Anno this); }
|
||||
@interface Anno { String f<error descr="@interface members may not have parameters">(Anno this)</error>; }
|
||||
|
||||
void m0() {
|
||||
Runnable r = (C <error descr="Receivers are not allowed outside of method parameter list">C.this</error>) -> { };
|
||||
|
||||
Reference in New Issue
Block a user