Skip to content

Commit

Permalink
Merge branch 'master' into master-androidx
Browse files Browse the repository at this point in the history
  • Loading branch information
keepactive committed Dec 5, 2020
2 parents b606411 + da34b00 commit 7256033
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,10 @@ public synchronized void init(ProcessingEnvironment processingEnvironment) {

mTypeNameString = TypeName.get(mTypeElementString.asType());

// androidx 和 非 androidx 的两个注解
mClassNameKeep = ClassName.get(mElements.getTypeElement(ComponentConstants.ANDROID_ANNOTATION_KEEP));
mClassNameNonNull = ClassName.get(mElements.getTypeElement(ComponentConstants.ANDROID_ANNOTATION_NONNULL));
TypeElement keepTypeElement = mElements.getTypeElement(ComponentConstants.ANDROID_ANNOTATION_KEEP);
TypeElement nonNullTypeElement = mElements.getTypeElement(ComponentConstants.ANDROID_ANNOTATION_NONNULL);

if (mClassNameKeep == null || mClassNameNonNull == null) {
if (keepTypeElement == null || nonNullTypeElement == null) {
String addDependencyTip = getAddDependencyTip(Arrays.asList(
ComponentConstants.ANDROID_ANNOTATION_KEEP,
ComponentConstants.ANDROID_ANNOTATION_NONNULL
Expand All @@ -136,6 +135,10 @@ public synchronized void init(ProcessingEnvironment processingEnvironment) {
"\n else see https://github.com/xiaojinzi123/Component/wiki/%E4%BE%9D%E8%B5%96%E5%92%8C%E9%85%8D%E7%BD%AE");
}

// androidx 和 非 androidx 的两个注解
mClassNameKeep = ClassName.get(keepTypeElement);
mClassNameNonNull = ClassName.get(nonNullTypeElement);

}

protected String getAddDependencyTip(List<String> classPathList, boolean isOr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,9 @@ public void unregister(@NonNull String host) {
public IComponentHostRouter findUiRouter(String host) {
try {
if (Component.getConfig().isOptimizeInit()) {
return ASMUtil.findModuleRouterAsmImpl(host);
return ASMUtil.findModuleRouterAsmImpl(
ComponentUtil.transformHostForClass(host)
);
} else {
Class<? extends IComponentHostRouter> clazz = null;
String className = ComponentUtil.genHostRouterClassName(host);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ public void unregister(@NonNull String host) {
public IComponentHostRouterDegrade findModuleRouterDegrade(String host) {
try {
if (Component.getConfig().isOptimizeInit()) {
return ASMUtil.findModuleRouterDegradeAsmImpl(host);
return ASMUtil.findModuleRouterDegradeAsmImpl(
ComponentUtil.transformHostForClass(host)
);
} else {
Class<? extends IComponentHostRouterDegrade> clazz = null;
String className = ComponentUtil.genHostRouterDegradeClassName(host);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ public static IComponentHostApplication findModuleApplication(@NonNull String ho
IComponentHostApplication result = null;
if (Component.getConfig().isOptimizeInit()) {
LogUtil.log("\"" + host + "\" will try to load by bytecode");
result = ASMUtil.findModuleApplicationAsmImpl(host);
result = ASMUtil.findModuleApplicationAsmImpl(
ComponentUtil.transformHostForClass(host)
);
} else {
LogUtil.log("\"" + host + "\" will try to load by reflection");
if (result == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ public void unregister(@NonNull String host) {
public IComponentHostFragment findModuleService(String host) {
try {
if (Component.getConfig().isOptimizeInit()) {
return ASMUtil.findModuleFragmentAsmImpl(host);
return ASMUtil.findModuleFragmentAsmImpl(
ComponentUtil.transformHostForClass(host)
);
} else {
Class<? extends IComponentHostFragment> clazz = null;
String className = ComponentUtil.genHostFragmentClassName(host);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ public IComponentHostInterceptor findModuleInterceptor(String host) {
Utils.checkMainThread();
try {
if (Component.getConfig().isOptimizeInit()) {
return ASMUtil.findModuleInterceptorAsmImpl(host);
return ASMUtil.findModuleInterceptorAsmImpl(
ComponentUtil.transformHostForClass(host)
);
} else {
Class<? extends IComponentHostInterceptor> clazz = null;
String className = ComponentUtil.genHostInterceptorClassName(host);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ public void unregister(@NonNull String host) {
public IComponentHostService findModuleService(@NonNull String host) {
try {
if (Component.getConfig().isOptimizeInit()) {
return ASMUtil.findModuleServiceAsmImpl(host);
return ASMUtil.findModuleServiceAsmImpl(
ComponentUtil.transformHostForClass(host)
);
} else {
Class<? extends IComponentHostService> clazz = null;
String className = ComponentUtil.genHostServiceClassName(host);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static List<String> getModuleNames() {
* @return 返回对应模块的 Application {@link IComponentHostApplication}
*/
@Nullable
public static IComponentHostApplication findModuleApplicationAsmImpl(String host) {
public static IComponentHostApplication findModuleApplicationAsmImpl(@NonNull String host) {
return null;
}

Expand All @@ -98,7 +98,7 @@ public static IComponentHostApplication findModuleApplicationAsmImpl(String host
* @return 返回对应模块的 Application {@link IComponentHostInterceptor}
*/
@Nullable
public static IComponentHostInterceptor findModuleInterceptorAsmImpl(String host) {
public static IComponentHostInterceptor findModuleInterceptorAsmImpl(@NonNull String host) {
return null;
}

Expand All @@ -109,7 +109,7 @@ public static IComponentHostInterceptor findModuleInterceptorAsmImpl(String host
* @return 返回对应模块的 {@link IComponentHostRouter}
*/
@Nullable
public static IComponentHostRouter findModuleRouterAsmImpl(String host) {
public static IComponentHostRouter findModuleRouterAsmImpl(@NonNull String host) {
return null;
}

Expand All @@ -120,7 +120,7 @@ public static IComponentHostRouter findModuleRouterAsmImpl(String host) {
* @return 返回对应模块的 {@link IComponentHostRouterDegrade}
*/
@Nullable
public static IComponentHostRouterDegrade findModuleRouterDegradeAsmImpl(String host) {
public static IComponentHostRouterDegrade findModuleRouterDegradeAsmImpl(@NonNull String host) {
return null;
}

Expand All @@ -131,7 +131,7 @@ public static IComponentHostRouterDegrade findModuleRouterDegradeAsmImpl(String
* @return 返回对应模块的 {@link IComponentHostService}
*/
@Nullable
public static IComponentHostService findModuleServiceAsmImpl(String host) {
public static IComponentHostService findModuleServiceAsmImpl(@NonNull String host) {
return null;
}

Expand All @@ -142,7 +142,7 @@ public static IComponentHostService findModuleServiceAsmImpl(String host) {
* @return 返回对应模块的 {@link IComponentHostFragment}
*/
@Nullable
public static IComponentHostFragment findModuleFragmentAsmImpl(String host) {
public static IComponentHostFragment findModuleFragmentAsmImpl(@NonNull String host) {
return null;
}

Expand Down

0 comments on commit 7256033

Please sign in to comment.