diff --git a/ComponentCompiler/build.gradle b/ComponentCompiler/build.gradle index b396ddf4..a36ffe18 100644 --- a/ComponentCompiler/build.gradle +++ b/ComponentCompiler/build.gradle @@ -36,7 +36,7 @@ dependencies { implementation 'com.squareup:javapoet:1.13.0' implementation 'org.apache.commons:commons-lang3:3.14.0' implementation 'org.apache.commons:commons-collections4:4.4' - implementation 'com.google.code.gson:gson:2.10.1' + implementation 'com.google.code.gson:gson:2.11.0' implementation project(':ComponentApi') } diff --git a/ComponentCompiler/src/main/java/com/xiaojinzi/component/ModuleAppProcessor.java b/ComponentCompiler/src/main/java/com/xiaojinzi/component/ModuleAppProcessor.java index a80a001a..69652b85 100644 --- a/ComponentCompiler/src/main/java/com/xiaojinzi/component/ModuleAppProcessor.java +++ b/ComponentCompiler/src/main/java/com/xiaojinzi/component/ModuleAppProcessor.java @@ -5,7 +5,6 @@ import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.ParameterSpec; -import com.squareup.javapoet.ParameterizedTypeName; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; import com.xiaojinzi.component.anno.ModuleAppAnno; @@ -65,7 +64,7 @@ public synchronized void init(ProcessingEnvironment processingEnvironment) { centerServiceTypeElement = mElements.getTypeElement(ComponentConstants.CENTERSERVICE_CLASS_NAME); routerCenterTypeElement = mElements.getTypeElement(ComponentConstants.ROUTERCENTER_CLASS_NAME); classCacheTypeElement = mElements.getTypeElement(ComponentConstants.CLASSCACHE_CLASS_NAME); - createImpl(true); + // createImpl(true); } @Override @@ -139,17 +138,23 @@ private void createImpl(boolean isDefault) { .addMethod(initMapMethod) .addJavadoc(classJavaDoc) .build(); + + if (mFiler == null) { + throw new ProcessException("mFiler is null"); + } + try { - JavaFile + JavaFile javaFile = JavaFile .builder(pkg, typeSpec) .indent(" ") - .build() - .writeTo(mFiler); + .build(); + javaFile.writeTo(mFiler); } catch (IOException e) { throw new ProcessException(e); } catch (Exception e) { // ignore } + } private MethodSpec generateInitMapMethod() {