mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#2398 - Fix compiler warning for annotation processing query bean generators
This commit is contained in:
@@ -16,6 +16,7 @@ import java.util.Set;
|
||||
public class Processor extends AbstractProcessor implements Constants {
|
||||
|
||||
private ProcessingContext processingContext;
|
||||
private SimpleModuleInfoWriter moduleWriter;
|
||||
|
||||
public Processor() {
|
||||
}
|
||||
@@ -48,6 +49,7 @@ public class Processor extends AbstractProcessor implements Constants {
|
||||
int count = processEntities(roundEnv);
|
||||
processOthers(roundEnv);
|
||||
final int loaded = processingContext.complete();
|
||||
initModuleInfoBean();
|
||||
if (roundEnv.processingOver()) {
|
||||
writeModuleInfoBean();
|
||||
}
|
||||
@@ -84,10 +86,24 @@ public class Processor extends AbstractProcessor implements Constants {
|
||||
}
|
||||
}
|
||||
|
||||
private void initModuleInfoBean() {
|
||||
try {
|
||||
if (moduleWriter == null) {
|
||||
moduleWriter = new SimpleModuleInfoWriter(processingContext);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
processingContext.logError(null, "Failed to initialise ModuleInfoLoader error:" + e + " stack:" + Arrays.toString(e.getStackTrace()));
|
||||
}
|
||||
}
|
||||
|
||||
private void writeModuleInfoBean() {
|
||||
try {
|
||||
SimpleModuleInfoWriter writer = new SimpleModuleInfoWriter(processingContext);
|
||||
writer.write();
|
||||
if (moduleWriter == null) {
|
||||
processingContext.logError(null, "ModuleInfoLoader was not initialised and not written");
|
||||
} else {
|
||||
moduleWriter.write();
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
processingContext.logError(null, "Failed to write ModuleInfoLoader error:" + e + " stack:" + Arrays.toString(e.getStackTrace()));
|
||||
|
||||
+4
-3
@@ -18,14 +18,16 @@ class SimpleModuleInfoWriter {
|
||||
private final String factoryPackage;
|
||||
private final String factoryShortName;
|
||||
private final String factoryFullName;
|
||||
private final JavaFileObject javaFileObject;
|
||||
|
||||
private Append writer;
|
||||
|
||||
SimpleModuleInfoWriter(ProcessingContext processingContext) {
|
||||
SimpleModuleInfoWriter(ProcessingContext processingContext) throws IOException {
|
||||
this.processingContext = processingContext;
|
||||
this.factoryPackage = processingContext.getFactoryPackage();
|
||||
this.factoryShortName = "_Ebean$ModuleInfo";
|
||||
this.factoryFullName = factoryPackage + "." + factoryShortName;
|
||||
this.javaFileObject = processingContext.createWriter(factoryFullName);
|
||||
}
|
||||
|
||||
void write() throws IOException {
|
||||
@@ -208,7 +210,6 @@ class SimpleModuleInfoWriter {
|
||||
}
|
||||
|
||||
private Writer createFileWriter() throws IOException {
|
||||
JavaFileObject jfo = processingContext.createWriter(factoryFullName);
|
||||
return jfo.openWriter();
|
||||
return javaFileObject.openWriter();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user