Guard against bad annotation paths.
Reviewers: schroederc, #core_team, fromberger
Subscribers: #core_team
@@ -93,11 +93,15 @@ public class ProcessAnnotation extends AbstractProcessor {
generated.comments().substring(Metadata.ANNOTATION_COMMENT_PREFIX.length());
if (ae instanceof ClassSymbol) {
ClassSymbol cs = (ClassSymbol) ae;
+ try {
String annotationPath = cs.sourcefile.toUri().resolve(annotationFile).getPath();
for (JavaFileObject file :
fileManager.getJavaFileForSources(Arrays.asList(annotationPath))) {
((UsageAsInputReportingJavaFileObject) file).markUsed();
}
+ } catch (IllegalArgumentException ex) {
+ logger.warningfmt("Bad annotationFile (%s): %s", ex.getMessage(), annotationFile);
+ }
}
}
// We must return false so normal processors run after us.
