Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-6077

[eut][drlvm] Class.getMethod may return method of subtype

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • 5.0M8
    • None
    • DRLVM
    • None

    Description

      test case:

      X.java:

      import java.lang.reflect.*;
      import p.*;

      public class X {
      static public void main(String args[]) {
      Y y = new Y();
      try

      { Method foo = Y.class.getMethod("foo", (Class[]) null); y.foo(); foo.invoke(y, (Object[]) null); }

      catch (NoSuchMethodException e)

      { // ignore } catch (InvocationTargetException e) { // ignore }

      catch (IllegalAccessException e)

      { System.out.print("FAILURE: IllegalAccessException"); }

      }
      }

      Y.java

      package p;

      public class Y extends Z {
      /* empty */
      }

      Z.java

      package p;

      class Z {
      public void foo()

      { System.out.println("SUCCESS"); //$NON-NLS-1$ }

      }

      run class X, RI and classlib with IBM VME has the same output:
      SUCCESS
      FAILURE: IllegalAccessException

      while drlvm output:
      SUCCESS
      SUCCESS

      after debugging, I found foo is public void p.Z.foo()

      Attachments

        Activity

          People

            Unassigned Unassigned
            regis_xu Regis Xu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: