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

(reflect) invoke() may fail even for public method on IllegalAccessException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.3.1
    • core-libs
    • None

      http://openide.netbeans.org/issues/show_bug.cgi?id=11679

      A public method is defined in package private class. The package private class is then extended by a public class ni the same package. So:

        Method theMethod = publicIntance.getClass().getMethod("theMethod");

      returns proper method (quering it for accessibility returns true). And it is possible to call the method without reflection:

        publicInstance.theMethod();

      but reflection invocation

        theMethod.invoke(publicInstance, new Object[0])

      throws the exception.

            iris Iris Clark
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: