JDK-5026430 : ParameterizedTypeImpl should override toString
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2004-04-04
  • Updated: 2004-04-05
  • Resolved: 2004-04-05
Related Reports
Duplicate :  
Description
The ParameterizedType implementation returned by getGenericParameterTypes does not override toString, so printing out one these beasts yields no useful information.  The following program illustrates the problem:

import java.util.*;
import java.lang.reflect.*;

public class Junk {
    public static void main(String[] args) throws Exception {
        System.out.println(Junk.class.getMethod("foo", List.class).
                           getGenericParameterTypes()[0]);
    }

    public void foo(List<String> dogs) {}
}

Running this program prints:

sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl@1a758cb

Comments
EVALUATION Dup of 5015676. ###@###.### 2004-04-05
05-04-2004