コード例 #1
0
 public Collection<String> getAdditionalAnnotations() {
   List<String> annos = ADDITIONAL_ANNOS;
   if (annos == null) {
     annos = new ArrayList<String>();
     Collections.addAll(annos, STANDARD_ANNOS);
     final EntryPoint[] extensions =
         Extensions.getExtensions(ToolExtensionPoints.DEAD_CODE_TOOL, null);
     for (EntryPoint extension : extensions) {
       final String[] ignoredAnnotations = extension.getIgnoreAnnotations();
       if (ignoredAnnotations != null) {
         ContainerUtil.addAll(annos, ignoredAnnotations);
       }
     }
     ADDITIONAL_ANNOS = annos = Collections.unmodifiableList(annos);
   }
   return annos;
 }
コード例 #2
0
 @NotNull
 public static List<Pair<PsiMethod, PsiSubstitutor>> findMethodsAndTheirSubstitutorsByName(
     @NotNull PsiClass psiClass, String name, boolean checkBases) {
   if (!checkBases) {
     final PsiMethod[] methodsByName = psiClass.findMethodsByName(name, false);
     final List<Pair<PsiMethod, PsiSubstitutor>> ret =
         new ArrayList<Pair<PsiMethod, PsiSubstitutor>>(methodsByName.length);
     for (final PsiMethod method : methodsByName) {
       ret.add(new Pair<PsiMethod, PsiSubstitutor>(method, PsiSubstitutor.EMPTY));
     }
     return ret;
   }
   Map<String, List<Pair<PsiMember, PsiSubstitutor>>> map = getMap(psiClass, MemberType.METHOD);
   @SuppressWarnings("unchecked")
   List<Pair<PsiMethod, PsiSubstitutor>> list = (List) map.get(name);
   return list == null
       ? Collections.<Pair<PsiMethod, PsiSubstitutor>>emptyList()
       : Collections.unmodifiableList(list);
 }
コード例 #3
0
  @NotNull
  public List<RefElement> getSortedElements() {
    List<RefElement> answer;
    synchronized (myRefTable) {
      if (mySortedRefs != null) return mySortedRefs;

      answer = new ArrayList<>(myRefTable.values());
    }
    ReadAction.run(
        () ->
            ContainerUtil.quickSort(
                answer,
                (o1, o2) -> {
                  VirtualFile v1 = ((RefElementImpl) o1).getVirtualFile();
                  VirtualFile v2 = ((RefElementImpl) o2).getVirtualFile();
                  return (v1 != null ? v1.hashCode() : 0) - (v2 != null ? v2.hashCode() : 0);
                }));
    synchronized (myRefTable) {
      return mySortedRefs = Collections.unmodifiableList(answer);
    }
  }