
package kalang.core;
import java.util.HashMap;
import java.util.Map;
import kalang.ast.ClassNode;
/**
 *
 * @author Kason Yang
 */
public class ParameterizedType extends ClassType {
    
    Type[] parameterTypes;
    private final ClassType rawType;
    
    public ParameterizedType(ClassType rawType,Type... parameterTypes ) {
        super(rawType.getClassNode());
        this.rawType = rawType;
        this.parameterTypes = parameterTypes;
        //TODO check parameterTypes.length
    }

    public Type[] getParameterTypes() {
        return parameterTypes;
    }
    
    public Map<GenericType,Type> getParameterTypesMap(){
        ClassNode clz = getClassNode();
        GenericType[] gts = clz.getGenericTypes();
        Map<GenericType,Type> ret = new HashMap();
        for(int i=0;i<gts.length;i++){
            ret.put(gts[i], parameterTypes[i]);
        }
        return ret;
    }

    public ClassType getRawType() {
        return rawType;
    }

    @Override
    public String getDeclarationKey() {
        return rawType.getDeclarationKey();
    }
    
    

}

@@ -36,37 +36,139 @@
 til.
-HashMap;%0Aimport java.util.Map
+ArrayList;%0Aimport java.util.Arrays;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0Aimport java.util.Objects
 ;%0Aim
@@ -1164,24 +1164,871 @@
 Key();%0A    %7D
+%0A%0A    @Override%0A    public String getName() %7B%0A        List%3CString%3E paramTypes = new ArrayList(parameterTypes.length);%0A        for(Type t:parameterTypes)%7B%0A            paramTypes.add(t.getName());%0A        %7D%0A        return rawType.getName() + %22%3C%22 + String.join(%22,%22,paramTypes) + %22%3E%22;%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object obj) %7B%0A        if (this == obj) %7B%0A            return true;%0A        %7D%0A        if (obj == null) %7B%0A            return false;%0A        %7D%0A        if (getClass() != obj.getClass()) %7B%0A            return false;%0A        %7D%0A        final ParameterizedType other = (ParameterizedType) obj;%0A        if (!Arrays.deepEquals(this.parameterTypes, other.parameterTypes)) %7B%0A            return false;%0A        %7D%0A        if (!Objects.equals(this.rawType, other.rawType)) %7B%0A            return false;%0A        %7D%0A        return true;%0A    %7D
 %0A    %0A    %0A%0A

implement equals and change getName