package openperipheral.converter;

import java.lang.reflect.Type;

import openperipheral.api.converter.IConverter;
import openperipheral.api.converter.IGenericTypeConverter;

public abstract class GenericConverterAdapter implements IGenericTypeConverter {

	@Override
	public Object fromLua(IConverter registry, Object obj, Type expected) {
		if (expected instanceof Class) return fromLua(registry, obj, (Class<?>)expected);

		return null;
	}

	protected abstract Object fromLua(IConverter registry, Object obj, Class<?> expected);
}

@@ -168,16 +168,61 @@
 erter;%0A%0A
+import com.google.common.reflect.TypeToken;%0A%0A
 public a
@@ -385,104 +385,102 @@
 %7B%0A%09%09
-if (expected instanceof Class) return fromLua(registry, obj, (Class%3C?%3E)expected);%0A%0A%09%09return null
+TypeToken%3C?%3E type = TypeToken.of(expected);%0A%09%09return fromLua(registry, obj, type.getRawType())
 ;%0A%09%7D

Fix generic type adapter