diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java index c7fce35cb72e..a6a5391db832 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java @@ -230,12 +230,10 @@ public abstract class EntryPointsManagerBase extends EntryPointsManager implemen } else { List children = refClass.getChildren(); - if (children != null) { - for (RefEntity entity : children) { - if (entity instanceof RefMethodImpl && entity.getName().startsWith(pattern.method + "(")) { - ((RefMethodImpl)entity).setEntry(true); - ((RefMethodImpl)entity).setPermanentEntry(true); - } + for (RefEntity entity : children) { + if (entity instanceof RefMethodImpl && entity.getName().startsWith(pattern.method + "(")) { + ((RefMethodImpl)entity).setEntry(true); + ((RefMethodImpl)entity).setPermanentEntry(true); } } } diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefMethodImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefMethodImpl.java index b05d9fe0c1fb..441b6b8399c8 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefMethodImpl.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefMethodImpl.java @@ -83,11 +83,12 @@ public class RefMethodImpl extends RefJavaElementImpl implements RefMethod { super.add(child); } + @NotNull @Override public List getChildren() { List superChildren = super.getChildren(); if (myParameters == null) return superChildren; - if (superChildren == null || superChildren.isEmpty()) return Arrays.asList(myParameters); + if (superChildren.isEmpty()) return Arrays.asList(myParameters); List allChildren = new ArrayList<>(superChildren.size() + myParameters.length); allChildren.addAll(superChildren); diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/visibility/VisibilityInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/visibility/VisibilityInspection.java index e50580d7f983..5a5f3a488bcd 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/visibility/VisibilityInspection.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/visibility/VisibilityInspection.java @@ -38,7 +38,6 @@ import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.project.Project; import com.intellij.psi.*; import com.intellij.psi.search.GlobalSearchScope; -import com.intellij.psi.search.PsiNonJavaFileReferenceProcessor; import com.intellij.psi.search.PsiSearchHelper; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiUtil; @@ -50,8 +49,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import java.awt.*; import java.util.List; @@ -82,24 +79,16 @@ public class VisibilityInspection extends GlobalJavaBatchInspectionTool { myPackageLocalForMembersCheckbox = new JCheckBox(InspectionsBundle.message("inspection.visibility.option")); myPackageLocalForMembersCheckbox.setSelected(SUGGEST_PACKAGE_LOCAL_FOR_MEMBERS); - myPackageLocalForMembersCheckbox.getModel().addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - SUGGEST_PACKAGE_LOCAL_FOR_MEMBERS = myPackageLocalForMembersCheckbox.isSelected(); - } - }); + myPackageLocalForMembersCheckbox.getModel().addChangeListener( + e -> SUGGEST_PACKAGE_LOCAL_FOR_MEMBERS = myPackageLocalForMembersCheckbox.isSelected()); gc.gridy = 0; add(myPackageLocalForMembersCheckbox, gc); myPackageLocalForTopClassesCheckbox = new JCheckBox(InspectionsBundle.message("inspection.visibility.option1")); myPackageLocalForTopClassesCheckbox.setSelected(SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES); - myPackageLocalForTopClassesCheckbox.getModel().addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES = myPackageLocalForTopClassesCheckbox.isSelected(); - } - }); + myPackageLocalForTopClassesCheckbox.getModel().addChangeListener( + e -> SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES = myPackageLocalForTopClassesCheckbox.isSelected()); gc.gridy = 1; add(myPackageLocalForTopClassesCheckbox, gc); @@ -107,12 +96,7 @@ public class VisibilityInspection extends GlobalJavaBatchInspectionTool { myPrivateForInnersCheckbox = new JCheckBox(InspectionsBundle.message("inspection.visibility.option2")); myPrivateForInnersCheckbox.setSelected(SUGGEST_PRIVATE_FOR_INNERS); - myPrivateForInnersCheckbox.getModel().addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - SUGGEST_PRIVATE_FOR_INNERS = myPrivateForInnersCheckbox.isSelected(); - } - }); + myPrivateForInnersCheckbox.getModel().addChangeListener(e -> SUGGEST_PRIVATE_FOR_INNERS = myPrivateForInnersCheckbox.isSelected()); gc.gridy = 2; gc.weighty = 1; @@ -311,10 +295,8 @@ public class VisibilityInspection extends GlobalJavaBatchInspectionTool { } List children = refClass.getChildren(); - if (children != null) { - for (Object refElement : children) { - if (!isAccessible((RefJavaElement)refElement, accessModifier)) return false; - } + for (Object refElement : children) { + if (!isAccessible((RefJavaElement)refElement, accessModifier)) return false; } for (final RefElement refElement : refClass.getInTypeReferences()) { @@ -395,7 +377,7 @@ public class VisibilityInspection extends GlobalJavaBatchInspectionTool { if (modifierList == null) return false; final PsiElement toElement = to.getElement(); - final boolean [] resolved = new boolean[] {false}; + final boolean [] resolved = {false}; modifierList.accept(new JavaRecursiveElementWalkingVisitor() { @Override public void visitReferenceExpression(PsiReferenceExpression expression) { @@ -447,12 +429,9 @@ public class VisibilityInspection extends GlobalJavaBatchInspectionTool { refEntity.accept(new RefJavaVisitor() { @Override public void visitField(@NotNull final RefField refField) { if (refField.getAccessModifier() != PsiModifier.PRIVATE) { - globalContext.enqueueFieldUsagesProcessor(refField, new GlobalJavaInspectionContext.UsagesProcessor() { - @Override - public boolean process(PsiReference psiReference) { - ignoreElement(processor, refField); - return false; - } + globalContext.enqueueFieldUsagesProcessor(refField, psiReference -> { + ignoreElement(processor, refField); + return false; }); } } @@ -460,40 +439,28 @@ public class VisibilityInspection extends GlobalJavaBatchInspectionTool { @Override public void visitMethod(@NotNull final RefMethod refMethod) { if (!refMethod.isExternalOverride() && refMethod.getAccessModifier() != PsiModifier.PRIVATE && !(refMethod instanceof RefImplicitConstructor)) { - globalContext.enqueueDerivedMethodsProcessor(refMethod, new GlobalJavaInspectionContext.DerivedMethodsProcessor() { - @Override - public boolean process(PsiMethod derivedMethod) { - ignoreElement(processor, refMethod); - return false; - } + globalContext.enqueueDerivedMethodsProcessor(refMethod, derivedMethod -> { + ignoreElement(processor, refMethod); + return false; }); - globalContext.enqueueMethodUsagesProcessor(refMethod, new GlobalJavaInspectionContext.UsagesProcessor() { - @Override - public boolean process(PsiReference psiReference) { - ignoreElement(processor, refMethod); - return false; - } + globalContext.enqueueMethodUsagesProcessor(refMethod, psiReference -> { + ignoreElement(processor, refMethod); + return false; }); } } @Override public void visitClass(@NotNull final RefClass refClass) { if (!refClass.isAnonymous()) { - globalContext.enqueueDerivedClassesProcessor(refClass, new GlobalJavaInspectionContext.DerivedClassesProcessor() { - @Override - public boolean process(PsiClass inheritor) { - ignoreElement(processor, refClass); - return false; - } + globalContext.enqueueDerivedClassesProcessor(refClass, inheritor -> { + ignoreElement(processor, refClass); + return false; }); - globalContext.enqueueClassUsagesProcessor(refClass, new GlobalJavaInspectionContext.UsagesProcessor() { - @Override - public boolean process(PsiReference psiReference) { - ignoreElement(processor, refClass); - return false; - } + globalContext.enqueueClassUsagesProcessor(refClass, psiReference -> { + ignoreElement(processor, refClass); + return false; }); final RefMethod defaultConstructor = refClass.getDefaultConstructor(); @@ -503,13 +470,10 @@ public class VisibilityInspection extends GlobalJavaBatchInspectionTool { if (qualifiedName != null) { final Project project = manager.getProject(); PsiSearchHelper.SERVICE.getInstance(project) - .processUsagesInNonJavaFiles(qualifiedName, new PsiNonJavaFileReferenceProcessor() { - @Override - public boolean process(PsiFile file, int startOffset, int endOffset) { - entryPointsManager.addEntryPoint(defaultConstructor, false); - ignoreElement(processor, defaultConstructor); - return false; - } + .processUsagesInNonJavaFiles(qualifiedName, (file, startOffset, endOffset) -> { + entryPointsManager.addEntryPoint(defaultConstructor, false); + ignoreElement(processor, defaultConstructor); + return false; }, GlobalSearchScope.projectScope(project)); } } diff --git a/platform/analysis-api/src/com/intellij/codeInspection/reference/RefEntity.java b/platform/analysis-api/src/com/intellij/codeInspection/reference/RefEntity.java index fab170c4cae7..8c592aa3e427 100644 --- a/platform/analysis-api/src/com/intellij/codeInspection/reference/RefEntity.java +++ b/platform/analysis-api/src/com/intellij/codeInspection/reference/RefEntity.java @@ -48,7 +48,7 @@ public interface RefEntity extends UserDataHolder { * * @return the list of children. */ - @Nullable + @NotNull List getChildren(); /** diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefEntityImpl.java b/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefEntityImpl.java index 86e850e9370d..d6c5e7b1ce3a 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefEntityImpl.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefEntityImpl.java @@ -27,6 +27,8 @@ package com.intellij.codeInspection.reference; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.util.Key; import com.intellij.util.BitUtil; +import com.intellij.util.ObjectUtils; +import com.intellij.util.containers.ContainerUtil; import gnu.trove.THashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -60,9 +62,10 @@ abstract class RefEntityImpl implements RefEntity { return myName; } + @NotNull @Override public synchronized List getChildren() { - return myChildren; + return ObjectUtils.notNull(myChildren, ContainerUtil.emptyList()); } @Override diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefManagerImpl.java b/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefManagerImpl.java index fa8e4aa6405e..d6758d53bfd5 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefManagerImpl.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefManagerImpl.java @@ -659,11 +659,9 @@ public class RefManagerImpl extends RefManager { @Override public void removeRefElement(@NotNull RefElement refElement, @NotNull List deletedRefs) { List children = refElement.getChildren(); - if (children != null) { - RefElement[] refElements = children.toArray(new RefElement[children.size()]); - for (RefElement refChild : refElements) { - removeRefElement(refChild, deletedRefs); - } + RefElement[] refElements = children.toArray(new RefElement[children.size()]); + for (RefElement refChild : refElements) { + removeRefElement(refChild, deletedRefs); } ((RefManagerImpl)refElement.getRefManager()).removeReference(refElement); diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java index d5c8f9ee95fb..1c763dffea98 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java @@ -305,10 +305,8 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp InspectionToolPresentation presentation = getPresentation(toolWrapper); presentation.ignoreCurrentElement(refElement); final List children = refElement.getChildren(); - if (children != null) { - for (RefEntity child : children) { - ignoreElementRecursively(toolWrapper, child); - } + for (RefEntity child : children) { + ignoreElementRecursively(toolWrapper, child); } } } diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/suppress/SuppressActionSequentialTask.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/suppress/SuppressActionSequentialTask.java index 87345182ad62..5af3513f488d 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/suppress/SuppressActionSequentialTask.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/suppress/SuppressActionSequentialTask.java @@ -150,10 +150,8 @@ public class SuppressActionSequentialTask implements SequentialTask { suppressedNodes.add(entity); } final List children = entity.getChildren(); - if (children != null) { - for (RefEntity child : children) { - toIgnoreInView.addLast(child); - } + for (RefEntity child : children) { + toIgnoreInView.addLast(child); } } } diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dependency/DependencyUtils.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dependency/DependencyUtils.java index c539cd96b92d..ab453e42ee08 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dependency/DependencyUtils.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dependency/DependencyUtils.java @@ -59,9 +59,6 @@ public class DependencyUtils { addOwnerClassesToSet(element.getOutReferences(), dependencies); addOwnerClassesToSet(element.getOutTypeReferences(), dependencies); final List children = element.getChildren(); - if (children == null) { - return; - } for (RefEntity child : children) { if (child instanceof RefJavaElement && !(child instanceof RefClass)) { tabulateDependencyClasses((RefJavaElement)child, dependencies); @@ -72,14 +69,14 @@ public class DependencyUtils { private static void addOwnerClassesToSet(Collection references, Set set) { final RefJavaUtil refUtil = RefJavaUtil.getInstance(); for (RefElement reference : references) { - final RefClass refClass = (reference instanceof RefClass) ? (RefClass)reference : refUtil.getOwnerClass(reference); + final RefClass refClass = reference instanceof RefClass ? (RefClass)reference : refUtil.getOwnerClass(reference); if (refClass != null && !refClass.isAnonymous() && !refClass.isLocalClass()) { set.add(refClass); } } } - public static Set calculateTransitiveDependenciesForClass(RefClass refClass) { + static Set calculateTransitiveDependenciesForClass(RefClass refClass) { final Set dependencies = refClass.getUserData(TRANSITIVE_DEPENDENCY_CLASSES_KEY); if (dependencies != null) { return dependencies; @@ -93,8 +90,8 @@ public class DependencyUtils { private static void tabulateTransitiveDependencyClasses( RefClass refClass, Set newDependencies) { final LinkedList pendingClasses = new LinkedList<>(); - final Set processedClasses = new HashSet<>(); pendingClasses.addLast(refClass); + final Set processedClasses = new HashSet<>(); while (!pendingClasses.isEmpty()) { final RefClass classToProcess = pendingClasses.removeFirst(); newDependencies.add(classToProcess); @@ -130,9 +127,6 @@ public class DependencyUtils { addOwnerClassesToSet(refClass.getInTypeReferences(), dependents); } final List children = element.getChildren(); - if (children == null) { - return; - } for (RefEntity child : children) { if (child instanceof RefElement && !(child instanceof RefClass)) { tabulateDependentClasses((RefElement)child, dependents); @@ -140,7 +134,7 @@ public class DependencyUtils { } } - public static Set calculateTransitiveDependentsForClass(RefClass refClass) { + static Set calculateTransitiveDependentsForClass(RefClass refClass) { final Set dependents = refClass.getUserData(TRANSITIVE_DEPENDENT_CLASSES_KEY); if (dependents != null) { return dependents; @@ -154,8 +148,8 @@ public class DependencyUtils { private static void tabulateTransitiveDependentClasses( RefClass refClass, Set newDependents) { final LinkedList pendingClasses = new LinkedList<>(); - final Set processedClasses = new HashSet<>(); pendingClasses.addLast(refClass); + final Set processedClasses = new HashSet<>(); while (!pendingClasses.isEmpty()) { final RefClass classToProcess = pendingClasses.removeFirst(); newDependents.add(classToProcess); @@ -172,7 +166,7 @@ public class DependencyUtils { newDependents.remove(refClass); } - public static Set calculateDependenciesForPackage( + private static Set calculateDependenciesForPackage( RefPackage refPackage) { final Set dependencies = refPackage.getUserData(DEPENDENCY_PACKAGES_KEY); @@ -198,9 +192,6 @@ public class DependencyUtils { } } final List children = entity.getChildren(); - if (children == null) { - return; - } for (RefEntity child : children) { if (!(child instanceof RefPackage)) { tabulateDependencyPackages(child, dependencies); @@ -208,7 +199,7 @@ public class DependencyUtils { } } - public static Set calculateDependentsForPackage( + private static Set calculateDependentsForPackage( RefPackage refPackage) { final Set dependents = refPackage.getUserData(DEPENDENT_PACKAGES_KEY); @@ -234,9 +225,6 @@ public class DependencyUtils { } } final List children = entity.getChildren(); - if (children == null) { - return; - } for (RefEntity child : children) { if (!(child instanceof RefPackage)) { tabulateDependentPackages(child, dependents); @@ -244,7 +232,7 @@ public class DependencyUtils { } } - public static Set calculateTransitiveDependentsForPackage( + static Set calculateTransitiveDependentsForPackage( RefPackage refPackage) { final Set dependents = refPackage.getUserData(TRANSITIVE_DEPENDENT_PACKAGES_KEY); @@ -261,8 +249,8 @@ public class DependencyUtils { RefPackage refPackage, Set newDependents) { final LinkedList pendingPackages = new LinkedList<>(); - final Set processedPackages = new HashSet<>(); pendingPackages.addLast(refPackage); + final Set processedPackages = new HashSet<>(); while (!pendingPackages.isEmpty()) { final RefPackage packageToProcess = pendingPackages.removeFirst(); newDependents.add(packageToProcess); @@ -279,7 +267,7 @@ public class DependencyUtils { newDependents.remove(refPackage); } - public static Set calculateTransitiveDependenciesForPackage( + static Set calculateTransitiveDependenciesForPackage( RefPackage refPackage) { final Set dependencies = refPackage.getUserData(TRANSITIVE_DEPENDENCY_PACKAGES_KEY); @@ -297,8 +285,8 @@ public class DependencyUtils { RefPackage refPackage, Set newDependencies) { final LinkedList pendingPackages = new LinkedList<>(); - final Set processedPackages = new HashSet<>(); pendingPackages.addLast(refPackage); + final Set processedPackages = new HashSet<>(); while (!pendingPackages.isEmpty()) { final RefPackage packageToProcess = pendingPackages.removeFirst(); newDependencies.add(packageToProcess); diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dependency/InitializationDependencyUtils.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dependency/InitializationDependencyUtils.java index c62a006ea01c..95d66fea2c08 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dependency/InitializationDependencyUtils.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/dependency/InitializationDependencyUtils.java @@ -64,9 +64,6 @@ class InitializationDependencyUtils { } } final List children = element.getChildren(); - if (children == null) { - return; - } for (RefEntity child : children) { if (child instanceof RefElement) { tabulateInitializationDependencyClasses((RefElement)child, @@ -138,9 +135,6 @@ class InitializationDependencyUtils { } } final List children = element.getChildren(); - if (children == null) { - return; - } for (RefEntity child : children) { if (child instanceof RefElement) { tabulateInitializationDependentClasses((RefElement)child, diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/modularization/ModuleWithTooFewClassesInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/modularization/ModuleWithTooFewClassesInspection.java index a57772568e9a..8be048320991 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/modularization/ModuleWithTooFewClassesInspection.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/modularization/ModuleWithTooFewClassesInspection.java @@ -54,9 +54,6 @@ public class ModuleWithTooFewClassesInspection extends BaseGlobalInspection { } final RefModule refModule = (RefModule)refEntity; final List children = refModule.getChildren(); - if (children == null) { - return null; - } int numClasses = 0; for (RefEntity child : children) { if (child instanceof RefClass) { diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/modularization/ModuleWithTooManyClassesInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/modularization/ModuleWithTooManyClassesInspection.java index b868b431a410..1b8f0c5356fc 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/modularization/ModuleWithTooManyClassesInspection.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/modularization/ModuleWithTooManyClassesInspection.java @@ -54,9 +54,6 @@ public class ModuleWithTooManyClassesInspection extends BaseGlobalInspection { return null; } final List children = refEntity.getChildren(); - if (children == null) { - return null; - } int numClasses = 0; for (RefEntity child : children) { if (child instanceof RefClass) { diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/packaging/DisjointPackageInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/packaging/DisjointPackageInspection.java index a98f88854e2d..e5f1e1516692 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/packaging/DisjointPackageInspection.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/packaging/DisjointPackageInspection.java @@ -55,9 +55,6 @@ public class DisjointPackageInspection extends BaseGlobalInspection { } final RefPackage refPackage = (RefPackage)refEntity; final List children = refPackage.getChildren(); - if (children == null) { - return null; - } final Set childClasses = new HashSet<>(); for (RefEntity child : children) { if (!(child instanceof RefClass)) { diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/packaging/PackageInMultipleModulesInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/packaging/PackageInMultipleModulesInspection.java index 161614ac218a..9d8fc3dc037b 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/packaging/PackageInMultipleModulesInspection.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/packaging/PackageInMultipleModulesInspection.java @@ -51,9 +51,6 @@ public class PackageInMultipleModulesInspection extends BaseGlobalInspection { return null; } final List children = refEntity.getChildren(); - if (children == null) { - return null; - } final Set modules = new HashSet<>(); for (RefEntity child : children) { if (!(child instanceof RefClass)) { diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/packaging/PackageWithTooFewClassesInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/packaging/PackageWithTooFewClassesInspection.java index 1143a9681bd2..aa42263d0775 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/packaging/PackageWithTooFewClassesInspection.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/packaging/PackageWithTooFewClassesInspection.java @@ -54,9 +54,6 @@ public class PackageWithTooFewClassesInspection extends BaseGlobalInspection { return null; } final List children = refEntity.getChildren(); - if (children == null) { - return null; - } int numClasses = 0; boolean subpackage = false; for (RefEntity child : children) { diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/packaging/PackageWithTooManyClassesInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/packaging/PackageWithTooManyClassesInspection.java index 1ee6d9755317..b62f40d5cd0b 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/packaging/PackageWithTooManyClassesInspection.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/packaging/PackageWithTooManyClassesInspection.java @@ -54,9 +54,6 @@ public class PackageWithTooManyClassesInspection extends BaseGlobalInspection { return null; } final List children = refEntity.getChildren(); - if (children == null) { - return null; - } int numClasses = 0; for (RefEntity child : children) { if (child instanceof RefClass) {