Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8218731

SA: Use concrete class as the return type of VMObjectFactory.newObject

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 13
    • None
    • hotspot
    • None
    • b09

    Description

      I propose that we change newObject to use concrete type of the created object as the return type.

       public class VMObjectFactory {
      - public static Object newObject(Class clazz, Address addr)
      + public static <T> T newObject(Class<T> clazz, Address addr)

      This way we wouldn't have to duplicate the type in lines like this:
             return (ZPhysicalMemoryManager)VMObjectFactory.newObject(ZPhysicalMemoryManager.class, physicalAddr);

      Instead this could be written as:
             return VMObjectFactory.newObject(ZPhysicalMemoryManager.class, physicalAddr);

      Attachments

        Activity

          People

            stefank Stefan Karlsson
            stefank Stefan Karlsson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: