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

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 13
    • Affects Version/s: None
    • Component/s: hotspot
    • None
    • b09

      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);

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

              Created:
              Updated:
              Resolved: