< prev index next >

src/java.base/share/classes/java/lang/Class.java

Print this page

        

*** 275,285 **** sb.append(Arrays.stream(typeparms) .map(Class::typeVarBounds) .collect(Collectors.joining(",", "<", ">"))); } ! if (arrayDepth > 0) sb.append("[]".repeat(arrayDepth)); return sb.toString(); } } --- 275,286 ---- sb.append(Arrays.stream(typeparms) .map(Class::typeVarBounds) .collect(Collectors.joining(",", "<", ">"))); } ! for (int i = 0; i < arrayDepth; i++) ! sb.append("[]"); return sb.toString(); } }
*** 997,1007 **** * * @return the fully qualified package name * * @since 9 * @spec JPMS ! * @jls 6.7 Fully Qualified Names */ public String getPackageName() { String pn = this.packageName; if (pn == null) { Class<?> c = this; --- 998,1008 ---- * * @return the fully qualified package name * * @since 9 * @spec JPMS ! * @jls 6.7 Fully Qualified Names */ public String getPackageName() { String pn = this.packageName; if (pn == null) { Class<?> c = this;
*** 1586,1596 **** int dimensions = 0; do { dimensions++; cl = cl.getComponentType(); } while (cl.isArray()); ! return cl.getName() + "[]".repeat(dimensions); } catch (Throwable e) { /*FALLTHRU*/ } } return getName(); } --- 1587,1602 ---- int dimensions = 0; do { dimensions++; cl = cl.getComponentType(); } while (cl.isArray()); ! StringBuilder sb = new StringBuilder(); ! sb.append(cl.getName()); ! for (int i = 0; i < dimensions; i++) { ! sb.append("[]"); ! } ! return sb.toString(); } catch (Throwable e) { /*FALLTHRU*/ } } return getName(); }
*** 3410,3425 **** /** * Helper method to get the method name from arguments. */ private String methodToString(String name, Class<?>[] argTypes) { ! return getName() + '.' + name + ! ((argTypes == null || argTypes.length == 0) ? ! "()" : ! Arrays.stream(argTypes) ! .map(c -> c == null ? "null" : c.getName()) ! .collect(Collectors.joining(",", "(", ")"))); } /** use serialVersionUID from JDK 1.1 for interoperability */ private static final long serialVersionUID = 3206093459760846163L; --- 3416,3434 ---- /** * Helper method to get the method name from arguments. */ private String methodToString(String name, Class<?>[] argTypes) { ! StringBuilder sb = new StringBuilder(); ! sb.append(getName() + "." + name + "("); ! if (argTypes != null) { ! sb.append(Arrays.stream(argTypes) ! .map(c -> (c == null) ? "null" : c.getName()) ! .collect(Collectors.joining(","))); ! } ! sb.append(")"); ! return sb.toString(); } /** use serialVersionUID from JDK 1.1 for interoperability */ private static final long serialVersionUID = 3206093459760846163L;
*** 3908,3919 **** * class loader is not the same as or an ancestor of the class * loader for the returned class and invocation of {@link * SecurityManager#checkPackageAccess s.checkPackageAccess()} * denies access to the package of the returned class * @since 11 ! * @jvms 4.7.28 The {@code NestHost} Attribute ! * @jvms 4.7.29 The {@code NestMembers} Attribute * @jvms 5.4.4 Access Control */ @CallerSensitive public Class<?> getNestHost() { if (isPrimitive() || isArray()) { --- 3917,3927 ---- * class loader is not the same as or an ancestor of the class * loader for the returned class and invocation of {@link * SecurityManager#checkPackageAccess s.checkPackageAccess()} * denies access to the package of the returned class * @since 11 ! * @jvms 4.7.28 and 4.7.29 NestHost and NestMembers attributes * @jvms 5.4.4 Access Control */ @CallerSensitive public Class<?> getNestHost() { if (isPrimitive() || isArray()) {
< prev index next >