TypeToken is not available on old Guava.

This commit is contained in:
sk89q 2015-01-17 19:26:33 -08:00
parent 520f9e3fcf
commit fdddb17d2f

View File

@ -70,10 +70,10 @@ public SchedulerReport() {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Nullable @Nullable
private Class<?> getTaskClass(BukkitTask task) { private Class<?> getTaskClass(BukkitTask task) {
Class<?> clazz = task.getClass();
Set<Class<?>> classes = (Set) TypeToken.of(clazz).getTypes().rawTypes();
try { try {
Class<?> clazz = task.getClass();
Set<Class<?>> classes = (Set) TypeToken.of(clazz).getTypes().rawTypes();
for (Class<?> type : classes) { for (Class<?> type : classes) {
Optional<Field> field = taskFieldCache.getUnchecked(type); Optional<Field> field = taskFieldCache.getUnchecked(type);
if (field.isPresent()) { if (field.isPresent()) {
@ -81,6 +81,7 @@ private Class<?> getTaskClass(BukkitTask task) {
} }
} }
} catch (IllegalAccessException ignored) { } catch (IllegalAccessException ignored) {
} catch (NoClassDefFoundError ignored) {
} }
return null; return null;