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

[classlib] [luni] java.lang.reflect.Proxy.getProxyClass(...) fails to create new proxy instance in default package

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 5.0M7
    • 5.0M7, 5.0M8
    • Classlib
    • None
    • Novice

    Description

      Given a test case [1] and two interfaces [2] [3] in default package.
      (1) Run test case [1] on [2], both of HY5's and RI's Proxy work well.
      (2) Run test case [1] on [3], HY5' Proxy fails [4] while RI works well.
      In conclusion, this is only a problem when the interfaces are undeclared "public" and located in the default package.
      Note: The reported defect only happened when the interface is undeclared "public" and located in default package. Thus please put this test case in the default package.

      Would you please help to review this patch?

      [1]. testcase
      public class ProxyTest extends TestCase {
      public void test_getProxyClass_DefaultPackage() {
      Class pc = Proxy.getProxyClass(DefaultPkgIntf.class.getClassLoader(),
      new Class[]

      { DefaultPkgIntf.class }

      );
      }
      }

      [2]. declared "public" DefaultPkgIntf in default package
      public interface DefaultPkgIntf {
      }

      [3] undeclared "public" DefaultPkgIntf in default package
      interface DefaultPkgIntf {
      }

      [4]
      java.lang.ClassFormatError: JVMCFRE068 invalid class class=/$Proxy0?offset=0
      at java.lang.reflect.Proxy.defineClassImpl(Native Method)
      at java.lang.reflect.Proxy.getProxyClass(Proxy.java:154)
      at ProxyTest.test_getProxyClass_DefaultPackage(Proxy2Test.java:9)
      at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:197)
      at java.lang.reflect.Method.invoke(Method.java:238)]

      Attachments

        1. HARMONY-6000.diff
          2 kB
          Kevin Zhou

        Activity

          People

            tellison Tim Ellison
            zhoukevin Kevin Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 24h
                24h
                Remaining:
                Remaining Estimate - 24h
                24h
                Logged:
                Time Spent - Not Specified
                Not Specified