X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2Futil%2FReflection.java;h=ab77c921cea1396b77419d72adec327eddf68426;hb=476b0f25eb4554febad2bbed314bb48a888400c5;hp=da16336265460f02540e50e264483187e6927fe9;hpb=eec21f64634c3a76436a263254fc890b56b5b34d;p=sbp.git diff --git a/src/edu/berkeley/sbp/util/Reflection.java b/src/edu/berkeley/sbp/util/Reflection.java index da16336..ab77c92 100644 --- a/src/edu/berkeley/sbp/util/Reflection.java +++ b/src/edu/berkeley/sbp/util/Reflection.java @@ -1,7 +1,11 @@ +// Copyright 2006-2007 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 { @@ -53,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(); @@ -93,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