Annotation proxy toString shouldn't cast primitive array to Object[]
This patch brings AnnotationProxyInvocationHandler.toString in line with
the same pattern used in the hashCode and equals earlier in the class.
Bug: #9615
Change-Id: Ib1fd0903ea8cabf8792143a5d2d4f5db29b7f452
Bug-Link: https://github.com/gwtproject/gwt/issues/9615
diff --git a/dev/core/src/com/google/gwt/dev/javac/AnnotationProxyFactory.java b/dev/core/src/com/google/gwt/dev/javac/AnnotationProxyFactory.java
index 24d60e0..d8b0285 100644
--- a/dev/core/src/com/google/gwt/dev/javac/AnnotationProxyFactory.java
+++ b/dev/core/src/com/google/gwt/dev/javac/AnnotationProxyFactory.java
@@ -267,8 +267,24 @@
}
msg.append(method.getName()).append('=');
Object myVal = method.invoke(proxy);
- if (myVal.getClass().isArray()) {
- msg.append(java.util.Arrays.deepToString((Object[]) myVal));
+ if (myVal instanceof Object[]) {
+ msg.append(Arrays.deepToString((Object[]) myVal));
+ } else if (myVal instanceof boolean[]) {
+ msg.append(Arrays.toString((boolean[]) myVal));
+ } else if (myVal instanceof byte[]) {
+ msg.append(Arrays.toString((byte[]) myVal));
+ } else if (myVal instanceof char[]) {
+ msg.append(Arrays.toString((char[]) myVal));
+ } else if (myVal instanceof short[]) {
+ msg.append(Arrays.toString((short[]) myVal));
+ } else if (myVal instanceof int[]) {
+ msg.append(Arrays.toString((int[]) myVal));
+ } else if (myVal instanceof long[]) {
+ msg.append(Arrays.toString((long[]) myVal));
+ } else if (myVal instanceof float[]) {
+ msg.append(Arrays.toString((float[]) myVal));
+ } else if (myVal instanceof double[]) {
+ msg.append(Arrays.toString((double[]) myVal));
} else {
msg.append(myVal);
}