Exemplo n.º 1
0
 @NotNull
 public static VirtualFile getVirtualFileForCallable(
     @NotNull ClassId containerClassId, @NotNull GenerationState state) {
   JvmVirtualFileFinder fileFinder = JvmVirtualFileFinder.SERVICE.getInstance(state.getProject());
   VirtualFile file = fileFinder.findVirtualFileWithHeader(containerClassId);
   if (file == null) {
     throw new IllegalStateException("Couldn't find declaration file for " + containerClassId);
   }
   return file;
 }
Exemplo n.º 2
0
 @Nullable
 public static VirtualFile findVirtualFile(
     @NotNull Project project, @NotNull String internalClassName) {
   FqName packageFqName = JvmClassName.byInternalName(internalClassName).getPackageFqName();
   String classNameWithDollars =
       StringsKt.substringAfterLast(internalClassName, "/", internalClassName);
   JvmVirtualFileFinder fileFinder = JvmVirtualFileFinder.SERVICE.getInstance(project);
   // TODO: we cannot construct proper classId at this point, we need to read InnerClasses info
   // from class file
   // we construct valid.package.name/RelativeClassNameAsSingleName that should work in compiler,
   // but fails for inner classes in IDE
   return fileFinder.findVirtualFileWithHeader(
       new ClassId(packageFqName, Name.identifier(classNameWithDollars)));
 }