< prev index next >
src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 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 >