[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: UnwrapValueUnitTestCase.testCollectionUnwrap failure on

adrian@jboss.org do-not-reply at jboss.com
Thu Nov 20 09:28:58 EST 2008


"alesj" wrote : What about if we built our own String key?

The toString() in openjdk looks like this:

  |     public String toString() {
  |         StringBuilder sb = new StringBuilder();
  | 
  |         if (ownerType != null) {
  |             if (ownerType instanceof Class)
  |                 sb.append(((Class)ownerType).getName());
  |             else
  |                 sb.append(ownerType.toString()); // HERE!
  | 
  |             sb.append(".");
  | 
  |             if (ownerType instanceof ParameterizedTypeImpl) {
  |                 // Find simple name of nested type by removing the
  |                 // shared prefix with owner.
  |                 sb.append(rawType.getName().replace( ((ParameterizedTypeImpl)ownerType).rawType.getName() + "$",
  |                                          ""));
  |             } else
  |                 sb.append(rawType.getName());
  |         } else
  |             sb.append(rawType.getName());
  | 
  |         if (actualTypeArguments != null && 
  |             actualTypeArguments.length > 0) {
  |             sb.append("<");
  |             boolean first = true;
  |             for(Type t: actualTypeArguments) {
  |                 if (!first)
  |                     sb.append(", ");
  |                 if (t instanceof Class)
  |                     sb.append(((Class)t).getName());
  |                 else
  |                     sb.append(t.toString()); // HERE!
  |                 first = false;
  |             }
  |             sb.append(">");
  |         }
  | 
  |         return sb.toString();
  | 

But note the the code I've marked HERE! which in turn would also need fixing
if we assume these reflective objects don't have valid toString()s

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4190901#4190901

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4190901



More information about the jboss-dev-forums mailing list