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

Reflective function pointers

    XMLWordPrintable

    Details

      Description

      A DESCRIPTION OF THE REQUEST :
      For late binding and other cases, where I don't have the concrete class at hand, but have reflective access to it, I would like the ability to convert a java.lang.reflect.Method or java.lang.reflect.Constructor to a function pointer.

      If I successfully got a pointer to a Method or Constructor through reflections and it is accessible, there should be a method on that Method and Constructor object like this:

      Provider< String > p = constructor.toFunctionPointer( Provider.class, String.class );
      Provider< String > p = meth.toFunctionPointer( Provider.class, String.class );
      Function< Integer, ? extends Object > p = meth.toFunctionPointer( Function.class, Integer.class, Object.class );

      etc.

      JUSTIFICATION :
      The object is known to the JVM, the method is, too. There is no reason, why this should not work. And it is a lot more high performance than (repeatedly) calling the method reflectively.


      CUSTOMER SUBMITTED WORKAROUND :
      There is nothing, but a completely reflective workaround.

      If the class is completely under my control, I could add a method to extract the function pointer reflectively. But this is ugly and in many cases I don't have control over that class.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: