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

(proxy) Suggest more type-safe overload of Proxy.newProxyInstance

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 5.0
    • core-libs
    • None

      Proxy.newProxyInstance is a little cumbersome to use because

      1. Most of the time, you are only proxying to one interface, so you need to construct a one-element Class[].

      2. You need to then cast the result.

      Suggest a simple overload which would handle the common cases in a more type-safe way:

      public static <T> T newProxyInstance(ClassLoader, Class<T>, InvocationHandler)

            peterjones Peter Jones (Inactive)
            jglick Jesse Glick (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: