java: highlight enum constant name if empty arguments are not applicable to the constructor (IDEA-243927)

GitOrigin-RevId: 495516860c1d26dc090aa2f2ca4f8c2397fcb177
This commit is contained in:
Anna Kozlova
2020-06-22 12:35:57 +03:00
committed by intellij-monorepo-bot
parent fd1444f322
commit 6472c347db
2 changed files with 13 additions and 0 deletions
@@ -508,6 +508,12 @@ public class HighlightMethodUtil {
}
if (mismatchedExpressions.size() == list.getExpressions().length || mismatchedExpressions.isEmpty()) {
if (list.getTextRange().isEmpty()) {
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR)
.range(ObjectUtils.notNull(list.getPrevSibling(), list))
.description(description)
.escapedToolTip(toolTip).create();
}
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(list).description(description).escapedToolTip(toolTip).navigationShift(1).create();
}
else {
@@ -217,3 +217,10 @@ class NestedEnums {
};
}
}
enum EnumWithoutExpectedArguments {
<error descr="'EnumWithoutExpectedArguments(int)' in 'EnumWithoutExpectedArguments' cannot be applied to '()'">ONE</error>, //comment
<error descr="'EnumWithoutExpectedArguments(int)' in 'EnumWithoutExpectedArguments' cannot be applied to '()'">TWO</error>
;
EnumWithoutExpectedArguments(int a) {}
}