mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
unused declaration: simplify clients
This commit is contained in:
+2
-2
@@ -379,7 +379,7 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
|
||||
}
|
||||
if (element != null) {
|
||||
for (EntryPoint extension : myExtensions) {
|
||||
if (extension.isEntryPoint(owner, element)) {
|
||||
if (extension.isSelected() && extension.isEntryPoint(owner, element)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -416,7 +416,7 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
|
||||
if (entryPointsManager.isEntryPoint(element)) return true;
|
||||
}
|
||||
for (EntryPoint extension : myExtensions) {
|
||||
if (extension.isEntryPoint(element)) {
|
||||
if (extension.isSelected() && extension.isEntryPoint(element)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ public abstract class InspectionTestCase extends PsiTestCase {
|
||||
|
||||
@Override
|
||||
public boolean isSelected() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,19 +47,17 @@ public class JavaFxEntryPoint extends EntryPoint {
|
||||
|
||||
@Override
|
||||
public boolean isEntryPoint(@NotNull PsiElement psiElement) {
|
||||
if (ADD_JAVAFX_TO_ENTRIES) {
|
||||
if (psiElement instanceof PsiMethod) {
|
||||
final PsiMethod method = (PsiMethod)psiElement;
|
||||
if (method.getParameterList().getParameters().length == 1 &&
|
||||
PsiType.VOID.equals(method.getReturnType()) &&
|
||||
"start".equals(method.getName())) {
|
||||
return InheritanceUtil.isInheritor(method.getContainingClass(), true, JavaFxCommonNames.JAVAFX_APPLICATION_APPLICATION);
|
||||
}
|
||||
}
|
||||
else if (psiElement instanceof PsiClass) {
|
||||
return InheritanceUtil.isInheritor((PsiClass)psiElement, true, JavaFxCommonNames.JAVAFX_APPLICATION_APPLICATION);
|
||||
if (psiElement instanceof PsiMethod) {
|
||||
final PsiMethod method = (PsiMethod)psiElement;
|
||||
if (method.getParameterList().getParameters().length == 1 &&
|
||||
PsiType.VOID.equals(method.getReturnType()) &&
|
||||
"start".equals(method.getName())) {
|
||||
return InheritanceUtil.isInheritor(method.getContainingClass(), true, JavaFxCommonNames.JAVAFX_APPLICATION_APPLICATION);
|
||||
}
|
||||
}
|
||||
else if (psiElement instanceof PsiClass) {
|
||||
return InheritanceUtil.isInheritor((PsiClass)psiElement, true, JavaFxCommonNames.JAVAFX_APPLICATION_APPLICATION);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,34 +51,32 @@ public class JUnitEntryPoint extends EntryPoint {
|
||||
|
||||
@Override
|
||||
public boolean isEntryPoint(@NotNull PsiElement psiElement) {
|
||||
if (ADD_JUNIT_TO_ENTRIES) {
|
||||
if (psiElement instanceof PsiClass) {
|
||||
final PsiClass aClass = (PsiClass)psiElement;
|
||||
if (JUnitUtil.isTestClass(aClass, false, true)) {
|
||||
final boolean isJUnit5 = JUnitUtil.isJUnit5(aClass);
|
||||
if (!PsiClassUtil.isRunnableClass(aClass, !isJUnit5, true)) {
|
||||
final PsiClass topLevelClass = PsiTreeUtil.getTopmostParentOfType(aClass, PsiClass.class);
|
||||
if (topLevelClass != null && PsiClassUtil.isRunnableClass(topLevelClass, !isJUnit5, true)) {
|
||||
return true;
|
||||
}
|
||||
final CommonProcessors.FindProcessor<PsiClass> findProcessor = new CommonProcessors.FindProcessor<PsiClass>() {
|
||||
@Override
|
||||
protected boolean accept(PsiClass psiClass) {
|
||||
return !psiClass.hasModifierProperty(PsiModifier.ABSTRACT);
|
||||
}
|
||||
};
|
||||
return !ClassInheritorsSearch.search(aClass).forEach(findProcessor) && findProcessor.isFound();
|
||||
if (psiElement instanceof PsiClass) {
|
||||
final PsiClass aClass = (PsiClass)psiElement;
|
||||
if (JUnitUtil.isTestClass(aClass, false, true)) {
|
||||
final boolean isJUnit5 = JUnitUtil.isJUnit5(aClass);
|
||||
if (!PsiClassUtil.isRunnableClass(aClass, !isJUnit5, true)) {
|
||||
final PsiClass topLevelClass = PsiTreeUtil.getTopmostParentOfType(aClass, PsiClass.class);
|
||||
if (topLevelClass != null && PsiClassUtil.isRunnableClass(topLevelClass, !isJUnit5, true)) {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
final CommonProcessors.FindProcessor<PsiClass> findProcessor = new CommonProcessors.FindProcessor<PsiClass>() {
|
||||
@Override
|
||||
protected boolean accept(PsiClass psiClass) {
|
||||
return !psiClass.hasModifierProperty(PsiModifier.ABSTRACT);
|
||||
}
|
||||
};
|
||||
return !ClassInheritorsSearch.search(aClass).forEach(findProcessor) && findProcessor.isFound();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (psiElement instanceof PsiMethod) {
|
||||
final PsiMethod method = (PsiMethod)psiElement;
|
||||
if (method.isConstructor() && method.getParameterList().getParametersCount() == 0) {
|
||||
return JUnitUtil.isTestClass(method.getContainingClass());
|
||||
}
|
||||
if (JUnitUtil.isTestMethodOrConfig(method)) return true;
|
||||
}
|
||||
else if (psiElement instanceof PsiMethod) {
|
||||
final PsiMethod method = (PsiMethod)psiElement;
|
||||
if (method.isConstructor() && method.getParameterList().getParametersCount() == 0) {
|
||||
return JUnitUtil.isTestClass(method.getContainingClass());
|
||||
}
|
||||
if (JUnitUtil.isTestMethodOrConfig(method)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -54,11 +54,9 @@ public class TestNGEntryPoint extends EntryPoint {
|
||||
|
||||
@Override
|
||||
public boolean isEntryPoint(@NotNull PsiElement psiElement) {
|
||||
if (ADD_TESTNG_TO_ENTRIES) {
|
||||
if (psiElement instanceof PsiModifierListOwner) {
|
||||
if (TestNGUtil.hasTest((PsiModifierListOwner)psiElement, false, false, TestNGUtil.hasDocTagsSupport)) return true;
|
||||
return TestNGUtil.hasConfig((PsiModifierListOwner)psiElement);
|
||||
}
|
||||
if (psiElement instanceof PsiModifierListOwner) {
|
||||
if (TestNGUtil.hasTest((PsiModifierListOwner)psiElement, false, false, TestNGUtil.hasDocTagsSupport)) return true;
|
||||
return TestNGUtil.hasConfig((PsiModifierListOwner)psiElement);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user