Java Code Examples for com.intellij.codeInspection.ProblemDescriptor#EMPTY_ARRAY

The following examples show how to use com.intellij.codeInspection.ProblemDescriptor#EMPTY_ARRAY . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UppercaseStatePropInspection.java    From litho with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public ProblemDescriptor[] checkMethod(
    @NotNull PsiMethod method, @NotNull InspectionManager manager, boolean isOnTheFly) {
  if (!LithoPluginUtils.isLithoSpec(method.getContainingClass())) {
    return ProblemDescriptor.EMPTY_ARRAY;
  }
  return Optional.of(method)
      .map(PsiMethod::getParameterList)
      .map(PsiParameterList::getParameters)
      .map(
          psiParameters ->
              Stream.of(psiParameters)
                  .filter(LithoPluginUtils::isPropOrState)
                  .filter(UppercaseStatePropInspection::isFirstLetterCapital)
                  .map(PsiParameter::getNameIdentifier)
                  .filter(Objects::nonNull)
                  .map(identifier -> createWarning(identifier, manager, isOnTheFly))
                  .toArray(ProblemDescriptor[]::new))
      .orElse(ProblemDescriptor.EMPTY_ARRAY);
}
 
Example 2
Source File: InspectionTree.java    From consulo with Apache License 2.0 5 votes vote down vote up
public CommonProblemDescriptor[] getSelectedDescriptors() {
  final InspectionToolWrapper toolWrapper = getSelectedToolWrapper();
  if (getSelectionCount() == 0) return ProblemDescriptor.EMPTY_ARRAY;
  final TreePath[] paths = getSelectionPaths();
  final LinkedHashSet<CommonProblemDescriptor> descriptors = new LinkedHashSet<CommonProblemDescriptor>();
  for (TreePath path : paths) {
    Object node = path.getLastPathComponent();
    traverseDescriptors((InspectionTreeNode)node, descriptors);
  }
  return descriptors.toArray(new CommonProblemDescriptor[descriptors.size()]);
}