@Nullable
 private static String[] getAnnotationDataForKotlinClass(@NotNull PsiClass psiClass) {
   VirtualFile virtualFile = getVirtualFileForPsiClass(psiClass);
   if (virtualFile != null) {
     KotlinJvmBinaryClass kotlinClass =
         VirtualFileFinder.SERVICE
             .getInstance(psiClass.getProject())
             .createKotlinClass(virtualFile);
     KotlinClassHeader header = kotlinClass.getClassHeader();
     if (header != null) {
       return header.getAnnotationData();
     }
   }
   return null;
 }
Exemplo n.º 2
0
 @NotNull
 @Override
 public Map<FqName, Void> map(FileContent inputData) {
   try {
     KotlinJvmBinaryClass kotlinClass =
         VirtualFileFinder.SERVICE
             .getInstance(inputData.getProject())
             .createKotlinClass(inputData.getFile());
     KotlinClassHeader header = kotlinClass.getClassHeader();
     if (header != null
         && header.getKind() != KotlinClassHeader.Kind.INCOMPATIBLE_ABI_VERSION) {
       return Collections.singletonMap(
           kotlinClass.getClassName().getFqNameForClassNameWithoutDollars(), null);
     }
   } catch (Throwable e) {
     LOG.warn("Error while indexing file " + inputData.getFileName(), e);
   }
   return Collections.emptyMap();
 }