Buggy code:
public class Compiler { public static Compiler . Builder builder ( ) { } public static class Builder { private ReadFileSystem < ? > sourcePath ; private ReadWriteFileSystem < ? > classOutput ; private ReadWriteFileSystem < ? > sourceOutput ; private List < SimpleFileSystem < ? > > classPaths ; private Processor processor ; private Builder ( ReadFileSystem < ? > sourcePath , ReadWriteFileSystem < ? > sourceOutput , ReadWriteFileSystem < ? > classOutput , List < SimpleFileSystem < ? > > classPaths ) { } public Compiler . Builder classOutput ( ReadWriteFileSystem < ? > classOutput ) { } public Compiler . Builder output ( ReadWriteFileSystem < ? > output ) { } public Compiler . Builder sourcePath ( ReadFileSystem < ? > sourcePath ) { } public Compiler . Builder sourceOutput ( ReadWriteFileSystem < ? > sourceOutput ) { } public Compiler . Builder addClassPath ( ReadFileSystem < ? > classPath ) { } public Compiler . Builder addClassPath ( Class < ? > type ) throws IOException , URISyntaxException { } public Compiler . Builder processor ( Processor processor ) { } public Compiler build ( ) { } } static final Pattern PATTERN = Pattern . compile ( ( "\\[" + ( ( ( "([^\\]]+)" + "\\]\\(" ) + "([^\\)]*)" ) + "\\)" ) ) ) ; private JavaCompiler compiler ; private VirtualFileManager fileManager ; private Set < Processor > processors ; public Compiler ( ReadFileSystem < ? > sourcePath , ReadWriteFileSystem < ? > output ) { } public Compiler ( ReadFileSystem < ? > sourcePath , ReadWriteFileSystem < ? > sourceOutput , ReadWriteFileSystem < ? > classOutput ) { } public Compiler ( ReadFileSystem < ? > sourcePath , SimpleFileSystem < ? > classPath , ReadWriteFileSystem < ? > sourceOutput , ReadWriteFileSystem < ? > classOutput ) { } public Compiler ( ReadFileSystem < ? > sourcePath , Collection < SimpleFileSystem < ? > > classPath , ReadWriteFileSystem < ? > sourceOutput , ReadWriteFileSystem < ? > classOutput ) { } public void addAnnotationProcessor ( Processor annotationProcessorType ) { } public ReadWriteFileSystem < Object > getSourceOutput ( ) { } public ReadWriteFileSystem < Object > getClassOutput ( ) { } public List < CompilationError > compile ( String ... compilationUnits ) throws IOException { } public List < CompilationError > compile ( ) throws IOException { } private < P > Iterable < JavaFileObject > getFromSourcePath ( SimpleFileManager < P > manager , String ... compilationUnits ) throws IOException { } private < P > Iterable < JavaFileObject > getFromSourcePath ( final SimpleFileManager < P > fileManager ) throws IOException { } private List < CompilationError > compile ( Iterable < JavaFileObject > compilationUnits ) throws IOException { final List < CompilationError > errors = new ArrayList < CompilationError > ( ) ; DiagnosticListener < JavaFileObject > listener = new DiagnosticListener < JavaFileObject > ( ) { public void report ( Diagnostic < ? extends JavaFileObject > diagnostic ) { if ( ( diagnostic . getKind ( ) ) == ( Diagnostic . Kind . ERROR ) ) { int columnNumber = ( ( int ) ( diagnostic . getColumnNumber ( ) ) ) ; int lineNumber = ( ( int ) ( diagnostic . getLineNumber ( ) ) ) ; Location location = ( ( columnNumber > 0 ) && ( lineNumber > 0 ) ) ? new Location ( columnNumber , lineNumber ) : null ; String message = diagnostic . getMessage ( null ) ; ErrorCode code = null ; List < String > arguments = Collections . emptyList ( ) ; Matcher matcher = Compiler . PATTERN . matcher ( message ) ; if ( matcher . find ( ) ) { String codeKey = matcher . group ( 1 ) ; for ( Processor processor : processors ) { if ( processor instanceof BaseProcessor ) { BaseProcessor baseProcessor = ( ( BaseProcessor ) ( processor ) ) ; code = baseProcessor . decode ( codeKey ) ; if ( code != null ) { break ; } } } if ( ( matcher . group ( 2 ) . length ( ) ) > 0 ) { arguments = new ArrayList < String > ( ) ; for ( String argument : Spliterator . split ( matcher . group ( 2 ) , ',' ) ) { arguments . add ( argument . trim ( ) ) ; } } } JavaFileObject obj = diagnostic . getSource ( ) ; String source = null ; File resolvedFile = null ; if ( obj != null ) { <START_BUG> source = obj . getName ( ) ; <END_BUG> if ( obj instanceof JavaFileObjectImpl ) { JavaFileObjectImpl foo = ( ( JavaFileObjectImpl ) ( obj ) ) ; try { resolvedFile = foo . getFile ( ) ; } catch ( Exception ignore ) { } } } errors . add ( new CompilationError ( code , arguments , source , resolvedFile , location , message ) ) ; } } } ; JavaCompiler . CompilationTask task = compiler . getTask ( null , fileManager , listener , Collections . < String > emptyList ( ) , null , compilationUnits ) ; task . setProcessors ( processors ) ; boolean ok = task . call ( ) ; fileManager . sourceOutput . clearCache ( ) ; fileManager . classOutput . clearCache ( ) ; fileManager . sourceOutput . clearCache ( ) ; if ( ( fileManager . classPath ) != null ) { fileManager . classPath . clearCache ( ) ; } processors . clear ( ) ; return ok ? Collections . < CompilationError > emptyList ( ) : errors ; } }

Fix:
source = obj . toUri ( ) . getPath ( ) ;