Skip to content
This repository has been archived by the owner on Feb 26, 2023. It is now read-only.

Commit

Permalink
Silence the JavacFiler warning 'compiler.warn.proc.unclosed.type.files'
Browse files Browse the repository at this point in the history
This prevents warnings like:

   warning: Unclosed files for the types '[dummy1407426008266]'; these types will not undergo annotation processing

Files created via the createResource method are not registered for annotation
processing (as opposed to files created by the createSourceFile method), so we
avoid the JavacFiler warning and we don't have to open/close a stream.
  • Loading branch information
JessThrysoee committed Aug 14, 2014
1 parent f820f5f commit b909651
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

import javax.annotation.processing.Filer;
import javax.annotation.processing.ProcessingEnvironment;
import javax.tools.JavaFileObject;
import javax.tools.FileObject;
import javax.tools.StandardLocation;

public class FileHelper {

Expand All @@ -45,9 +46,9 @@ public static Option<File> findRootProject(ProcessingEnvironment processingEnv)
public static Option<FileHolder> findRootProjectHolder(ProcessingEnvironment processingEnv) {
Filer filer = processingEnv.getFiler();

JavaFileObject dummySourceFile;
FileObject dummySourceFile;
try {
dummySourceFile = filer.createSourceFile("dummy" + System.currentTimeMillis());
dummySourceFile = filer.createResource(StandardLocation.SOURCE_OUTPUT, "", "dummy" + System.currentTimeMillis());
} catch (IOException ignored) {
return Option.absent();
}
Expand Down

0 comments on commit b909651

Please sign in to comment.