< prev index next >

src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java

Print this page

        

*** 31,40 **** --- 31,41 ---- import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; import java.util.Arrays; + import java.util.StringJoiner; import java.util.Objects; /** Implementing class for ParameterizedType interface. */ public class ParameterizedTypeImpl implements ParameterizedType {
*** 205,218 **** public String toString() { StringBuilder sb = new StringBuilder(); if (ownerType != null) { ! if (ownerType instanceof Class) ! sb.append(((Class)ownerType).getName()); ! else ! sb.append(ownerType.toString()); sb.append("."); if (ownerType instanceof ParameterizedTypeImpl) { // Find simple name of nested type by removing the --- 206,216 ---- public String toString() { StringBuilder sb = new StringBuilder(); if (ownerType != null) { ! sb.append(ownerType.getTypeName()); sb.append("."); if (ownerType instanceof ParameterizedTypeImpl) { // Find simple name of nested type by removing the
*** 222,242 **** } else sb.append(rawType.getName()); } else sb.append(rawType.getName()); ! if (actualTypeArguments != null && ! actualTypeArguments.length > 0) { ! sb.append("<"); ! boolean first = true; for(Type t: actualTypeArguments) { ! if (!first) ! sb.append(", "); ! sb.append(t.getTypeName()); ! first = false; } ! sb.append(">"); } return sb.toString(); } } --- 220,236 ---- } else sb.append(rawType.getName()); } else sb.append(rawType.getName()); ! if (actualTypeArguments != null) { ! StringJoiner sj = new StringJoiner(", ", "<", ">"); ! sj.setEmptyValue(""); for(Type t: actualTypeArguments) { ! sj.add(t.getTypeName()); } ! sb.append(sj.toString()); } return sb.toString(); } }
< prev index next >