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[]
);
}
}
[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)]