IG: don't ignore abstract classes (IDEA-191097)

This commit is contained in:
Bas Leijdekkers
2018-05-01 22:33:04 +02:00
parent d0efb432d2
commit e6be10e780
2 changed files with 8 additions and 6 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2003-2015 Dave Griffith, Bas Leijdekkers
* Copyright 2003-2018 Dave Griffith, Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,17 +61,13 @@ public class AbstractMethodWithMissingImplementationsInspection
@Override
public void visitMethod(PsiMethod method) {
super.visitMethod(method);
if (method.getNameIdentifier() == null) {
if (method.getNameIdentifier() == null || !method.hasModifierProperty(PsiModifier.ABSTRACT)) {
return;
}
final PsiClass containingClass = method.getContainingClass();
if (containingClass == null) {
return;
}
if (!containingClass.isInterface() ||
!method.hasModifierProperty(PsiModifier.ABSTRACT)) {
return;
}
final InheritorFinder inheritorFinder = new InheritorFinder(containingClass);
for (final PsiClass inheritor : inheritorFinder.getInheritors()) {
if (hasMatchingImplementation(inheritor, method, containingClass)) {
@@ -55,4 +55,10 @@ interface I2 {
}
<error descr="Class 'E2' must either be declared abstract or implement abstract method 'method()' in 'I2'">enum E2 implements I2</error> {
A
}
abstract class Perspicacious {
abstract void <warning descr="Abstract method 'insightAndUnderstanding()' is not implemented in every subclass">insightAndUnderstanding</warning>();
}
<error descr="Class 'HighlyPerspicacious' must either be declared abstract or implement abstract method 'insightAndUnderstanding()' in 'Perspicacious'">class HighlyPerspicacious extends Perspicacious</error> {
}