diff --git a/settings.gradle b/settings.gradle index 646352970c1..52833b51f8a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,3 @@ -include ':stripe-common' include ':stripe' include ':example' include ':samplestore' diff --git a/stripe-common/build.gradle b/stripe-common/build.gradle deleted file mode 100644 index 1252fac41ca..00000000000 --- a/stripe-common/build.gradle +++ /dev/null @@ -1,10 +0,0 @@ -apply plugin: 'java-library' -apply plugin: 'idea' -apply plugin: 'checkstyle' - -check.dependsOn('checkstyle') - -dependencies { - implementation 'org.jetbrains:annotations:17.0.0' - testImplementation 'junit:junit:4.13-beta-3' -} diff --git a/stripe/build.gradle b/stripe/build.gradle index b0acb47f5dd..dc537e7715e 100644 --- a/stripe/build.gradle +++ b/stripe/build.gradle @@ -11,8 +11,6 @@ configurations { } dependencies { - implementation project(':stripe-common') - implementation "com.android.support:support-annotations:28.0.0" implementation "com.android.support:appcompat-v7:28.0.0" implementation "com.android.support:recyclerview-v7:28.0.0" diff --git a/stripe-common/src/main/java/com/stripe/android/model/ModelUtils.java b/stripe/src/main/java/com/stripe/android/model/ModelUtils.java similarity index 86% rename from stripe-common/src/main/java/com/stripe/android/model/ModelUtils.java rename to stripe/src/main/java/com/stripe/android/model/ModelUtils.java index e0e897e71c7..97c1716488c 100644 --- a/stripe-common/src/main/java/com/stripe/android/model/ModelUtils.java +++ b/stripe/src/main/java/com/stripe/android/model/ModelUtils.java @@ -1,7 +1,7 @@ package com.stripe.android.model; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import java.util.Calendar; import java.util.Locale; @@ -24,7 +24,7 @@ static boolean isWholePositiveNumber(@Nullable String value) { /** * Returns whether the given CharSequence contains only digits. */ - private static boolean isDigitsOnly(@NotNull CharSequence str) { + private static boolean isDigitsOnly(@NonNull CharSequence str) { final int len = str.length(); for (int cp, i = 0; i < len; i += Character.charCount(cp)) { cp = Character.codePointAt(str, i); @@ -44,7 +44,7 @@ private static boolean isDigitsOnly(@NotNull CharSequence str) { * @return {@code true} if the input time has passed the specified current time, * {@code false} otherwise. */ - static boolean hasMonthPassed(int year, int month, @NotNull Calendar now) { + static boolean hasMonthPassed(int year, int month, @NonNull Calendar now) { if (hasYearPassed(year, now)) { return true; } @@ -62,12 +62,12 @@ static boolean hasMonthPassed(int year, int month, @NotNull Calendar now) { * @return {@code true} if the input year has passed the year of the specified current time * {@code false} otherwise. */ - static boolean hasYearPassed(int year, @NotNull Calendar now) { + static boolean hasYearPassed(int year, @NonNull Calendar now) { int normalized = normalizeYear(year, now); return normalized < now.get(Calendar.YEAR); } - static int normalizeYear(int year, @NotNull Calendar now) { + static int normalizeYear(int year, @NonNull Calendar now) { if (year < 100 && year >= 0) { String currentYear = String.valueOf(now.get(Calendar.YEAR)); String prefix = currentYear.substring(0, currentYear.length() - 2); diff --git a/stripe-common/src/main/java/com/stripe/android/utils/ClassUtils.java b/stripe/src/main/java/com/stripe/android/utils/ClassUtils.java similarity index 82% rename from stripe-common/src/main/java/com/stripe/android/utils/ClassUtils.java rename to stripe/src/main/java/com/stripe/android/utils/ClassUtils.java index 01a0f364909..d5e25500df8 100644 --- a/stripe-common/src/main/java/com/stripe/android/utils/ClassUtils.java +++ b/stripe/src/main/java/com/stripe/android/utils/ClassUtils.java @@ -1,7 +1,7 @@ package com.stripe.android.utils; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -18,8 +18,8 @@ private ClassUtils() {} * @return the value of the found field, if exists, on the target object, or null */ @Nullable - public static Object getInternalObject(@NotNull Class clazz, @NotNull Set whitelist, - @NotNull Object obj) { + public static Object getInternalObject(@NonNull Class clazz, @NonNull Set whitelist, + @NonNull Object obj) { final Field field = findField(clazz, whitelist); if (field == null) { return null; @@ -41,7 +41,7 @@ public static Object getInternalObject(@NotNull Class clazz, @NotNull Set whitelist) { + public static Field findField(@NonNull Class clazz, @NonNull Collection whitelist) { final Field[] fields = clazz.getDeclaredFields(); for (Field field : fields) { if (whitelist.contains(field.getName())) { @@ -58,7 +58,7 @@ public static Field findField(@NotNull Class clazz, @NotNull Collection * @return the {@link Method} if one is found, otherwise null */ @Nullable - public static Method findMethod(@NotNull Class clazz, @NotNull Collection whitelist) { + public static Method findMethod(@NonNull Class clazz, @NonNull Collection whitelist) { final Method[] methods = clazz.getDeclaredMethods(); for (Method method : methods) { if (whitelist.contains(method.getName())) { diff --git a/stripe-common/src/main/java/com/stripe/android/utils/ObjectUtils.java b/stripe/src/main/java/com/stripe/android/utils/ObjectUtils.java similarity index 89% rename from stripe-common/src/main/java/com/stripe/android/utils/ObjectUtils.java rename to stripe/src/main/java/com/stripe/android/utils/ObjectUtils.java index fdf9bb0e94a..3ad57bc9b1d 100644 --- a/stripe-common/src/main/java/com/stripe/android/utils/ObjectUtils.java +++ b/stripe/src/main/java/com/stripe/android/utils/ObjectUtils.java @@ -1,6 +1,6 @@ package com.stripe.android.utils; -import org.jetbrains.annotations.Nullable; +import android.support.annotation.Nullable; import java.util.Arrays; diff --git a/stripe-common/src/test/java/com/stripe/android/model/ModelUtilsTest.java b/stripe/src/test/java/com/stripe/android/model/ModelUtilsTest.java similarity index 100% rename from stripe-common/src/test/java/com/stripe/android/model/ModelUtilsTest.java rename to stripe/src/test/java/com/stripe/android/model/ModelUtilsTest.java diff --git a/stripe-common/src/test/java/com/stripe/android/utils/ClassUtilsTest.java b/stripe/src/test/java/com/stripe/android/utils/ClassUtilsTest.java similarity index 98% rename from stripe-common/src/test/java/com/stripe/android/utils/ClassUtilsTest.java rename to stripe/src/test/java/com/stripe/android/utils/ClassUtilsTest.java index b5f9a0af93b..19e2da90add 100644 --- a/stripe-common/src/test/java/com/stripe/android/utils/ClassUtilsTest.java +++ b/stripe/src/test/java/com/stripe/android/utils/ClassUtilsTest.java @@ -26,7 +26,7 @@ public void testfindField_withValidWhitelist_shouldReturnField() { @Test public void testfindField_withEmptyWhitelist_shouldReturnNull() { - final Field nameField = ClassUtils.findField(FakeClass.class, new HashSet<>()); + final Field nameField = ClassUtils.findField(FakeClass.class, new HashSet()); assertNull(nameField); }