Skip to content

Commit

Permalink
Fix for 'Cannot invoke ... because "classPath" is null.'
Browse files Browse the repository at this point in the history
Compiler output can contain non-class files like files generated by annotation processing. These cannot be "hotswapped" and don't have a classname, so have to be filtered out.
  • Loading branch information
jonasPoehler committed Apr 19, 2023
1 parent 5d42c64 commit 2df9bd0
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ public List<ClassFile> compile(Module module, VirtualFile sourceFile, ClassFile
File compiledFile = new File(classObject.getPath());
FileUtil.writeToFile(compiledFile, bytes);

// Add class file to list
classFiles.add(ClassFile.fromClassObject(project, classObject));
// filter out any non-class-objects generated (e. g. files from annotation processing)
if (classObject.getClassName() != null) {
// Add class file to list
classFiles.add(ClassFile.fromClassObject(project, classObject));
}
}
return classFiles;
}
Expand Down

0 comments on commit 2df9bd0

Please sign in to comment.