コード例 #1
0
 public MostlySingularMultiMap<String, AnnotationData> getResult() {
   if (data.isEmpty()) {
     return MostlySingularMultiMap.emptyMap();
   }
   data.compact();
   return data;
 }
コード例 #2
0
  @NotNull
  private List<AnnotationData> doCollect(
      @NotNull PsiModifierListOwner listOwner, boolean onlyWritable) {
    final List<PsiFile> files = findExternalAnnotationsFiles(listOwner);
    if (files == null) {
      return NO_DATA;
    }
    SmartList<AnnotationData> result = new SmartList<AnnotationData>();
    String externalName = getExternalName(listOwner, false);
    if (externalName == null) return NO_DATA;

    for (PsiFile file : files) {
      if (!file.isValid()) continue;
      if (onlyWritable && !file.isWritable()) continue;

      MostlySingularMultiMap<String, AnnotationData> fileData = getDataFromFile(file);

      ContainerUtil.addAll(result, fileData.get(externalName));
    }
    if (result.isEmpty()) {
      return NO_DATA;
    }
    result.trimToSize();
    return result;
  }
コード例 #3
0
 @Override
 public void endElement(String uri, String localName, String qName) throws SAXException {
   if ("item".equals(qName)) {
     externalName = null;
   } else if ("annotation".equals(qName)) {
     if (externalName != null && annotationFQN != null) {
       String argumentsString = arguments.length() == 0 ? "" : intern(arguments.toString());
       for (AnnotationData existingData : data.get(externalName)) {
         if (existingData.annotationClassFqName.equals(annotationFQN)) {
           duplicateError(file, externalName, "Duplicate annotation '" + annotationFQN + "' ");
         }
       }
       AnnotationData annData =
           internAnnotationData(new AnnotationData(annotationFQN, argumentsString));
       data.add(externalName, annData);
       annotationFQN = null;
       arguments = null;
     }
   }
 }