|
7 | 7 | import java.util.Collection; |
8 | 8 | import java.util.Set; |
9 | 9 |
|
| 10 | +import javax.annotation.processing.FilerException; |
10 | 11 | import javax.annotation.processing.RoundEnvironment; |
11 | 12 | import javax.lang.model.element.TypeElement; |
12 | 13 | import javax.lang.model.util.Elements; |
13 | 14 | import javax.tools.FileObject; |
14 | 15 |
|
15 | 16 | /** Write the source code for the factory. */ |
16 | | -class LookupWriter { |
| 17 | +final class LookupWriter { |
17 | 18 | private LookupWriter() {} |
18 | 19 |
|
19 | 20 | private static final String METAINF_SERVICES_LOOKUP = |
@@ -58,21 +59,20 @@ static void write( |
58 | 59 | String fqn = pkg + ".EbeanMethodLookup"; |
59 | 60 | try { |
60 | 61 | var javaFileObject = processingContext.createWriter(fqn); |
61 | | - |
62 | 62 | var writer = new Append(javaFileObject.openWriter()); |
63 | 63 |
|
64 | 64 | writer.append(FILE_STRING, pkg); |
65 | 65 | writer.close(); |
66 | 66 | writeServicesFile(processingContext, fqn); |
| 67 | + } catch (FilerException e) { |
| 68 | + processingContext.logWarn(null, "FilerException writing Lookup " + e.getMessage()); |
67 | 69 | } catch (IOException e) { |
68 | 70 | processingContext.logError(null, "Failed to write lookup class " + e.getMessage()); |
69 | 71 | } |
70 | 72 | } |
71 | 73 | } |
72 | 74 |
|
73 | | - private static void writeServicesFile(ProcessingContext processingContext, String fqn) |
74 | | - throws IOException { |
75 | | - |
| 75 | + private static void writeServicesFile(ProcessingContext processingContext, String fqn) throws IOException { |
76 | 76 | FileObject jfo = processingContext.createMetaInfWriter(METAINF_SERVICES_LOOKUP); |
77 | 77 | if (jfo != null) { |
78 | 78 | Writer writer = jfo.openWriter(); |
|
0 commit comments