mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
[codeInsight] IDEA-236735 Java enum constant is called "Anonymous inner class"
There used to be a vague error message for enum constants that don't implement methods from an interface which refers to them as 'Anonymous class deriving from *Enum'. This patch makes the message clear displaying the real names of the enum constants in the error message. Signed-off-by: Nikita Eshkeev <nikita.eshkeev@jetbrains.com> GitOrigin-RevId: 700bc2b579e0c8552858ab881d9a3e4e8d81b1f8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f2f17b8e14
commit
61712f77ac
+41
@@ -0,0 +1,41 @@
|
||||
interface MyInterface {
|
||||
void method1();
|
||||
}
|
||||
|
||||
<error descr="Class 'SampleEnum1' must either be declared abstract or implement abstract method 'method1()' in 'MyInterface'">enum SampleEnum1 implements MyInterface</error> {
|
||||
ONE;
|
||||
}
|
||||
|
||||
enum SampleEnum2 implements MyInterface {
|
||||
<error descr="Enum constant 'ONE' must implement abstract method 'method1()' in 'MyInterface'">ONE</error>{};
|
||||
}
|
||||
|
||||
enum SampleEnum3 implements MyInterface {
|
||||
ONE;
|
||||
|
||||
@Override
|
||||
public void method1() { }
|
||||
}
|
||||
|
||||
enum SampleEnum4 implements MyInterface {
|
||||
ONE {
|
||||
@Override
|
||||
public void method1() { }
|
||||
};
|
||||
}
|
||||
|
||||
enum SampleEnum5 implements MyInterface {
|
||||
<error descr="Enum constant 'ONE' must implement abstract method 'method1()' in 'MyInterface'">ONE</error>("one") {};
|
||||
|
||||
SampleEnum5(final String name) {}
|
||||
}
|
||||
|
||||
|
||||
enum SampleEnum6 implements MyInterface {
|
||||
ONE("one") {
|
||||
@Override
|
||||
public void method1() {}
|
||||
};
|
||||
|
||||
SampleEnum6(final String name) {}
|
||||
}
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
<error descr="Modifier 'abstract' not allowed here">abstract</error> enum OurEnum {
|
||||
<error descr="Class 'Anonymous class derived from OurEnum' must implement abstract method 'foo()' in 'OurEnum'">A</error> {
|
||||
<error descr="Enum constant 'A' must implement abstract method 'foo()' in 'OurEnum'">A</error> {
|
||||
},
|
||||
<error descr="'OurEnum' is abstract; cannot be instantiated">B</error>,
|
||||
C {
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
enum xxx {
|
||||
<error descr="'xxx' is abstract; cannot be instantiated">X</error>,
|
||||
<error descr="Class 'Anonymous class derived from xxx' must implement abstract method 'f()' in 'xxx'">Y</error> {
|
||||
<error descr="Enum constant 'Y' must implement abstract method 'f()' in 'xxx'">Y</error> {
|
||||
};
|
||||
|
||||
abstract void f();
|
||||
|
||||
Reference in New Issue
Block a user