[java-highlighting] Unrelated defaults checks moved to MethodChecker

GenericsHighlightUtil.java is removed completely
Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only)

GitOrigin-RevId: de2bddb49469c21efe1088e86f6a1ec5b9d35b4a
This commit is contained in:
Tagir Valeev
2025-02-20 15:21:52 +01:00
committed by intellij-monorepo-bot
parent 5014925e91
commit 96bc4480b1
15 changed files with 67 additions and 99 deletions

View File

@@ -22,8 +22,8 @@ class AnonymousExtendsJLR {
<error descr="Class 'SuperInterface' must implement abstract method 'run()' in 'Runnable'">record SuperInterface() implements Runnable</error> {}
interface I1 { default void run() {}}
interface I2 { void run();}
record <error descr="Class 'UnrelatedDefaults' must implement abstract method 'run()' in 'I2'">UnrelatedDefaults</error>() implements I1, I2 {}
enum <error descr="Class 'UnrelatedDefaults2' must implement abstract method 'run()' in 'I2'">UnrelatedDefaults2</error> implements I1, I2 {}
<error descr="Class 'UnrelatedDefaults' must implement abstract method 'run()' in 'I2'">record UnrelatedDefaults() implements I1, I2</error> {}
<error descr="Class 'UnrelatedDefaults2' must implement abstract method 'run()' in 'I2'">enum UnrelatedDefaults2 implements I1, I2</error> {}
record ComponentModifiers(
<error descr="Modifier 'public' not allowed here">public</error> int x,

View File

@@ -5,7 +5,7 @@ class Test1 {
default void foo(String x) { }
}
class <error descr="Class 'C' must either be declared abstract or implement abstract method 'foo(T)' in 'A'">C</error> implements A<String> { }
<error descr="Class 'C' must either be declared abstract or implement abstract method 'foo(T)' in 'A'">class C implements A<String></error> { }
abstract class <error descr="Test1.D inherits abstract and default for foo(String) from types Test1.A and Test1.A">D</error> implements A<String> {}
interface <error descr="Test1.E inherits abstract and default for foo(String) from types Test1.A and Test1.A">E</error> extends A<String> {}
}
@@ -19,7 +19,7 @@ class Test2 {
void foo(T x);
}
<error descr="Class 'C' must either be declared abstract or implement abstract method 'foo(T)' in 'B'">class <error descr="Class 'C' must either be declared abstract or implement abstract method 'foo(T)' in 'B'">C</error> implements B<String></error> { }
<error descr="Class 'C' must either be declared abstract or implement abstract method 'foo(T)' in 'B'">class C implements B<String></error> { }
abstract class D implements B<String> {}
interface E extends B<String> {}
}

View File

@@ -49,7 +49,7 @@ class Test4 {
void accept();
}
<error descr="Class 'D' must either be declared abstract or implement abstract method 'accept()' in 'C'">class <error descr="Class 'D' must either be declared abstract or implement abstract method 'accept()' in 'C'">D</error> implements B, C</error> {}
<error descr="Class 'D' must either be declared abstract or implement abstract method 'accept()' in 'C'">class D implements B, C</error> {}
abstract class E implements B, C {}
}

View File

@@ -10,9 +10,9 @@ interface SecondParent {
int doSomething();
}
class <error descr="Class 'FirstSon' must either be declared abstract or implement abstract method 'doSomething()' in 'SecondParent'">FirstSon</error> implements FirstParent, SecondParent {}
<error descr="Class 'FirstSon' must either be declared abstract or implement abstract method 'doSomething()' in 'SecondParent'">class FirstSon implements FirstParent, SecondParent</error> {}
<error descr="Class 'SecondSon' must either be declared abstract or implement abstract method 'doSomething()' in 'SecondParent'">class <error descr="Class 'SecondSon' must either be declared abstract or implement abstract method 'doSomething()' in 'SecondParent'">SecondSon</error> implements SecondParent, FirstParent</error> {}
<error descr="Class 'SecondSon' must either be declared abstract or implement abstract method 'doSomething()' in 'SecondParent'">class SecondSon implements SecondParent, FirstParent</error> {}
interface A {
default int foo() {

View File

@@ -10,4 +10,4 @@ interface C {
void m();
}
class <error descr="Class 'D' must either be declared abstract or implement abstract method 'm()' in 'C'">D</error> implements A, B, C { }
<error descr="Class 'D' must either be declared abstract or implement abstract method 'm()' in 'C'">class D implements A, B, C</error> { }

View File

@@ -9,7 +9,7 @@ class Test1 {
default void foo(T x) { }
}
class <error descr="Class 'D' must either be declared abstract or implement abstract method 'foo(String)' in 'A'">D</error> implements C<String> { }
<error descr="Class 'D' must either be declared abstract or implement abstract method 'foo(String)' in 'A'">class D implements C<String></error> { }
interface E extends C<String> { }
}
@@ -23,7 +23,7 @@ class Test2 {
void foo(T x);
}
<error descr="Class 'D' must either be declared abstract or implement abstract method 'foo(T)' in 'C'">class <error descr="Class 'D' must either be declared abstract or implement abstract method 'foo(T)' in 'C'">D</error> implements C<String></error> {}
<error descr="Class 'D' must either be declared abstract or implement abstract method 'foo(T)' in 'C'">class D implements C<String></error> {}
interface E extends C<String> {}
}
@@ -66,7 +66,7 @@ class Test5 {
default void foo(T x) { }
}
class <error descr="Class 'D' must either be declared abstract or implement abstract method 'foo(String)' in 'A'">D</error> extends B implements C<String> { }
<error descr="Class 'D' must either be declared abstract or implement abstract method 'foo(String)' in 'A'">class D extends B implements C<String></error> { }
}

View File

@@ -13,4 +13,4 @@ class C<K> extends AC<K> implements B<K> {
public void replace(K k) {}
}
<error descr="Class 'D' must either be declared abstract or implement abstract method 'replace(K)' in 'B'">class <error descr="Class 'D' must either be declared abstract or implement abstract method 'replace(K)' in 'B'">D</error><K> extends AC<K> implements B<K></error> {}
<error descr="Class 'D' must either be declared abstract or implement abstract method 'replace(K)' in 'B'">class D<K> extends AC<K> implements B<K></error> {}