Skip to content

Commit 6383fb8

Browse files
committed
Fix compilation with Java 9 and 10
The annotation processor does something evil: it catches FileNotFoundException to detect when a file does not exist. But in Java 9, the relevant code changed internally to use java.nio, which throws NoSuchFileException instead in this circumstance. For now, we do a "quick fix" and simply catch either exception. Closes imagej/ImageJ#199.
1 parent b6e16a2 commit 6383fb8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/org/scijava/annotations/AnnotationProcessor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import java.io.InputStream;
4141
import java.io.OutputStream;
4242
import java.io.PrintStream;
43+
import java.nio.file.NoSuchFileException;
4344
import java.util.ArrayList;
4445
import java.util.HashMap;
4546
import java.util.List;
@@ -234,7 +235,7 @@ public InputStream openInput(final String annotationName)
234235
return filer.getResource(StandardLocation.CLASS_OUTPUT, "",
235236
Index.INDEX_PREFIX + annotationName).openInputStream();
236237
}
237-
catch (final FileNotFoundException e) {
238+
catch (final FileNotFoundException | NoSuchFileException e) {
238239
return null;
239240
}
240241
}

0 commit comments

Comments
 (0)