Skip to content

Commit

Permalink
common添加kotlin支持库,删除多余代码
Browse files Browse the repository at this point in the history
  • Loading branch information
K0170016 authored and K0170016 committed May 17, 2019
1 parent 3cd90dc commit 680833c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.huyingbao.core.processor;

import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.TypeSpec;

import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

Expand Down Expand Up @@ -50,25 +48,6 @@ final class ProcessorUtil {
*/
private static final String COMPILER_PACKAGE_NAME =
RxArchProcessor.class.getPackage().getName();
/**
* 非空注解
*/
private static final ClassName NONNULL_ANNOTATION =
ClassName.get("android.support.annotation", "NonNull");
/**
* 非空注解
*/
private static final ClassName JETBRAINS_NOTNULL_ANNOTATION =
ClassName.get("org.jetbrains.annotations", "NotNull");
/**
* 非空注解
*/
private static final ClassName ANDROIDX_NONNULL_ANNOTATION =
ClassName.get("androidx.annotation", "NonNull");
private static final ClassName CHECK_RESULT_ANNOTATION =
ClassName.get("android.support.annotation", "CheckResult");
private static final ClassName ANDROIDX_CHECK_RESULT_ANNOTATION =
ClassName.get("androidx.annotation", "CheckResult");

private final ProcessingEnvironment mProcessingEnv;
/**
Expand Down Expand Up @@ -142,27 +121,4 @@ void debugLog(String toLog) {
void infoLog(String toLog) {
mProcessingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "[" + mRound + "] " + toLog);
}

static ClassName nonNull() {
try {
Class.forName(ANDROIDX_NONNULL_ANNOTATION.reflectionName());
return ANDROIDX_NONNULL_ANNOTATION;
} catch (ClassNotFoundException e) {
return NONNULL_ANNOTATION;
}
}

static ClassName checkResult() {
try {
Class.forName(ANDROIDX_CHECK_RESULT_ANNOTATION.reflectionName());
return ANDROIDX_CHECK_RESULT_ANNOTATION;
} catch (ClassNotFoundException e) {
return CHECK_RESULT_ANNOTATION;
}
}

static List<ClassName> nonNulls() {
return Arrays.asList(NONNULL_ANNOTATION, JETBRAINS_NOTNULL_ANNOTATION,
ANDROIDX_NONNULL_ANNOTATION);
}
}
2 changes: 2 additions & 0 deletions core-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ dependencies {
api "com.jakewharton:butterknife:${BUTTER_KNIFE}"
//Arouter
api "com.alibaba:arouter-api:${AROUTER_API}"
//Kotlin支持
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${KOTLIN_VERSION}"
//RecyclerView适配器
api "com.github.CymChad:BaseRecyclerViewAdapterHelper:${BASE_RECYCLERVIEW_ADAPTER_HELPER}"
//Dagger编译时生成
Expand Down
1 change: 0 additions & 1 deletion depend_kotlin.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${KOTLIN_VERSION}"
//通用库
if (isUseMaven.toBoolean()) {
implementation "com.github.coolfire2015.RxFluxArchitecture:core-common:${RX_FLUX_ARCHITECTURE}"
Expand Down

0 comments on commit 680833c

Please sign in to comment.