JDK 13 RFR of JDK-8042748: Clarify exception thrown by ParameterizedTypeImpl.validateConstructorArguments()
Joe Darcy
joe.darcy at oracle.com
Fri Jun 7 01:58:37 UTC 2019
Hello,
Please review the patch below to address
JDK-8042748: Clarify exception thrown by
ParameterizedTypeImpl.validateConstructorArguments()
Thanks,
-Joe
diff -r 0a7af38ef32a
src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java
---
a/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java
Thu Jun 06 17:48:06 2019 -0700
+++
b/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java
Thu Jun 06 18:52:14 2019 -0700
@@ -56,7 +56,14 @@
TypeVariable<?>[] formals = rawType.getTypeParameters();
// check correct arity of actual type args
if (formals.length != actualTypeArguments.length){
- throw new MalformedParameterizedTypeException();
+ throw new
MalformedParameterizedTypeException(String.format("Mismatch of count of " +
+ "formal and actual type " +
+ "arguments in constructor " +
+ "of %s: %d formal argument(s) "+
+ "%d actual argument(s)",
+ rawType.getName(),
+ formals.length,
+ actualTypeArguments.length));
}
for (int i = 0; i < actualTypeArguments.length; i++) {
// check actuals against formals' bounds
More information about the core-libs-dev
mailing list