X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2Futil%2FReflection.java;h=a1c1dde8a0a759707504a24d256af9a85e16d6f1;hp=05de7dc44fbd588dee65af80acfa587599188e1e;hb=e014c992f89fea2185be2d249d894e588524daad;hpb=0bf2fced924400a496fb154be71188864296564c diff --git a/src/edu/berkeley/sbp/util/Reflection.java b/src/edu/berkeley/sbp/util/Reflection.java index 05de7dc..a1c1dde 100644 --- a/src/edu/berkeley/sbp/util/Reflection.java +++ b/src/edu/berkeley/sbp/util/Reflection.java @@ -1,8 +1,11 @@ +// Copyright 2006 all rights reserved; see LICENSE file for BSD-style license + package edu.berkeley.sbp.util; import java.io.*; import java.lang.reflect.*; import java.lang.annotation.*; +// FIXME: decent error reporting /** Random reflection-related utilities */ public final class Reflection { @@ -54,7 +57,7 @@ public final class Reflection { public static String show(Object o) { if (o==null) return "null"; - if (o instanceof Show) return ((Show)o).toString(); + if (o instanceof Show) return show((Show)o); if (! (o instanceof Object[])) return o.toString() + " : " + o.getClass().getName(); Object[] arr = (Object[])o; StringBuffer ret = new StringBuffer(); @@ -94,6 +97,8 @@ public final class Reflection { if (c==null) c = Object.class; Object[] ret = Reflection.newArray(c, argo.length); System.arraycopy(argo, 0, ret, 0, argo.length); + for(int i=0; i