aboutsummaryrefslogtreecommitdiff
path: root/android/guava/src/com/google/common/base/Enums.java
diff options
context:
space:
mode:
Diffstat (limited to 'android/guava/src/com/google/common/base/Enums.java')
-rw-r--r--android/guava/src/com/google/common/base/Enums.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/android/guava/src/com/google/common/base/Enums.java b/android/guava/src/com/google/common/base/Enums.java
index 5c55b6594..d1749f016 100644
--- a/android/guava/src/com/google/common/base/Enums.java
+++ b/android/guava/src/com/google/common/base/Enums.java
@@ -16,8 +16,8 @@ package com.google.common.base;
import static com.google.common.base.Preconditions.checkNotNull;
-import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.GwtIncompatible;
+import com.google.common.annotations.J2ktIncompatible;
import java.io.Serializable;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
@@ -33,7 +33,8 @@ import javax.annotation.CheckForNull;
* @author Steve McKay
* @since 9.0
*/
-@GwtCompatible(emulated = true)
+@GwtIncompatible
+@J2ktIncompatible
@ElementTypesAreNonnullByDefault
public final class Enums {
@@ -48,7 +49,8 @@ public final class Enums {
*/
@GwtIncompatible // reflection
public static Field getField(Enum<?> enumValue) {
- Class<?> clazz = enumValue.getDeclaringClass();
+ Class<?>
+ clazz = enumValue.getDeclaringClass();
try {
return clazz.getDeclaredField(enumValue.name());
} catch (NoSuchFieldException impossible) {
@@ -98,17 +100,19 @@ public final class Enums {
}
/**
- * Returns a converter that converts between strings and {@code enum} values of type {@code
- * enumClass} using {@link Enum#valueOf(Class, String)} and {@link Enum#name()}. The converter
- * will throw an {@code IllegalArgumentException} if the argument is not the name of any enum
- * constant in the specified enum.
+ * Returns a serializable converter that converts between strings and {@code enum} values of type
+ * {@code enumClass} using {@link Enum#valueOf(Class, String)} and {@link Enum#name()}. The
+ * converter will throw an {@code IllegalArgumentException} if the argument is not the name of any
+ * enum constant in the specified enum.
*
* @since 16.0
*/
+ @GwtIncompatible
public static <T extends Enum<T>> Converter<String, T> stringConverter(Class<T> enumClass) {
return new StringConverter<>(enumClass);
}
+ @GwtIncompatible
private static final class StringConverter<T extends Enum<T>> extends Converter<String, T>
implements Serializable {