mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't warn about final enum when it is not (IDEA-181211)
This commit is contained in:
+3
-2
@@ -479,8 +479,9 @@ public class HighlightClassUtil {
|
||||
@Nullable
|
||||
static HighlightInfo checkCannotInheritFromFinal(PsiClass superClass, PsiElement elementToHighlight) {
|
||||
HighlightInfo errorResult = null;
|
||||
if (superClass.hasModifierProperty(PsiModifier.FINAL) || superClass.isEnum()) {
|
||||
String message = JavaErrorMessages.message("inheritance.from.final.class", superClass.getQualifiedName());
|
||||
boolean isFinal = superClass.hasModifierProperty(PsiModifier.FINAL);
|
||||
if (isFinal || superClass.isEnum()) {
|
||||
String message = JavaErrorMessages.message("inheritance.from.final.class", superClass.getQualifiedName(), isFinal ? PsiKeyword.FINAL : PsiKeyword.ENUM);
|
||||
errorResult =
|
||||
HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(elementToHighlight).descriptionAndTooltip(message).create();
|
||||
QuickFixAction.registerQuickFixAction(errorResult,
|
||||
|
||||
@@ -122,7 +122,7 @@ abstract.cannot.be.instantiated=''{0}'' is abstract; cannot be instantiated
|
||||
duplicate.class.in.other.file=Duplicate class found in the file ''{0}''
|
||||
duplicate.class=Duplicate class: ''{0}''
|
||||
public.class.should.be.named.after.file=Class ''{0}'' is public, should be declared in a file named ''{0}.java''
|
||||
inheritance.from.final.class=Cannot inherit from final ''{0}''
|
||||
inheritance.from.final.class=Cannot inherit from {1} ''{0}''
|
||||
package.name.file.path.mismatch=Package name ''{0}'' does not correspond to the file path ''{1}''
|
||||
missing.package.statement=Missing package statement: ''{0}''
|
||||
interface.cannot.be.local=Interface not allowed here
|
||||
|
||||
@@ -41,6 +41,12 @@ enum Operation {
|
||||
<error descr="There is no default constructor available in 'Operation'">class exte extends <error descr="Cannot inherit from final 'Operation'">Operation</error></error> {
|
||||
}
|
||||
|
||||
enum withConstant {
|
||||
A() {};
|
||||
}
|
||||
|
||||
class extwithConstant extends <error descr="Cannot inherit from enum 'withConstant'">withConstant</error> {}
|
||||
|
||||
class use {
|
||||
void f(Operation op) {
|
||||
switch(op) {
|
||||
|
||||
Reference in New Issue
Block a user