// http://gafter.blogspot.com/2006/12/super-type-tokens.html
package cucumber.table;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

public abstract class TypeReference<T> {

    private final Type type;
    private volatile Constructor<?> constructor;

    protected TypeReference() {
        Type superclass = getClass().getGenericSuperclass();
        if (superclass instanceof Class) {
            throw new RuntimeException("Missing type parameter.");
        }
        this.type = ((ParameterizedType) superclass).getActualTypeArguments()[0];
    }

    /**
     * Instantiates a new instance of {@code T} using the default, no-arg
     * constructor.
     */
    @SuppressWarnings("unchecked")
    public T newInstance()
            throws NoSuchMethodException, IllegalAccessException,
            InvocationTargetException, InstantiationException {
        if (constructor == null) {
            Class<?> rawType = type instanceof Class<?>
                    ? (Class<?>) type
                    : (Class<?>) ((ParameterizedType) type).getRawType();
            constructor = rawType.getConstructor();
        }
        return (T) constructor.newInstance();
    }

    /**
     * Gets the referenced type.
     */
    public Type getType() {
        return this.type;
    }
}

@@ -83,98 +83,8 @@
 e;%0A%0A
-import java.lang.reflect.Constructor;%0Aimport java.lang.reflect.InvocationTargetException;%0A
 impo
@@ -123,16 +123,16 @@
 edType;%0A
+
 import j
@@ -196,17 +196,16 @@
 ce%3CT%3E %7B%0A
-%0A
     priv
@@ -228,57 +228,8 @@
 ype;
-%0A    private volatile Constructor%3C?%3E constructor;
 %0A%0A  
@@ -532,677 +532,8 @@
  %7D%0A%0A
-    /**%0A     * Instantiates a new instance of %7B@code T%7D using the default, no-arg%0A     * constructor.%0A     */%0A    @SuppressWarnings(%22unchecked%22)%0A    public T newInstance()%0A            throws NoSuchMethodException, IllegalAccessException,%0A            InvocationTargetException, InstantiationException %7B%0A        if (constructor == null) %7B%0A            Class%3C?%3E rawType = type instanceof Class%3C?%3E%0A                    ? (Class%3C?%3E) type%0A                    : (Class%3C?%3E) ((ParameterizedType) type).getRawType();%0A            constructor = rawType.getConstructor();%0A        %7D%0A        return (T) constructor.newInstance();%0A    %7D%0A%0A    /**%0A     * Gets the referenced type.%0A     */%0A
     

Remove unused code