[PATCH] 8188240: Reflection Proxy should skip static methods

David Lloyd david.lloyd at redhat.com
Wed Mar 14 21:43:47 UTC 2018


On Wed, Mar 14, 2018 at 4:31 PM, Aleksey Shipilev <shade at redhat.com> wrote:
> On 03/14/2018 07:09 PM, David Lloyd wrote:
>> On Wed, Mar 14, 2018 at 1:00 PM, mandy chung <mandy.chung at oracle.com> wrote:
>>> Thanks for adding the new test.   Looks okay and some minor comment.
>>>
>>> +        try {
>>>    :
>>> +        } catch (Throwable e) {
>>> +            System.err.println("\nTEST FAILED:");
>>> +            e.printStackTrace();
>>> +            throw new RuntimeException("TEST FAILED: " + e.toString());
>>> +        }
>>>
>>>
>>> You can take out this try-catch (Basic1.java isn't be the best example to
>>> reference that is old and needs update).
>>
>> Fixed & attached.
>
> Have you tried to run the test?
>
> Because it fails:
>
> $ make images run-test TEST=jdk/java/lang/reflect/Proxy/ProxyClashTest.java
>
> Dynamic proxy API static method clash test
>
> java.lang.IllegalArgumentException: ProxyClashTest$ClashWithRunnable referenced from a method is not
> visible from class loader
>         at java.base/java.lang.reflect.Proxy$ProxyBuilder.ensureVisible(Proxy.java:851)
>         at java.base/java.lang.reflect.Proxy$ProxyBuilder.validateProxyInterfaces(Proxy.java:682)
>         at java.base/java.lang.reflect.Proxy$ProxyBuilder.<init>(Proxy.java:628)
>         at java.base/java.lang.reflect.Proxy.lambda$getProxyConstructor$1(Proxy.java:426)
>         at
> java.base/jdk.internal.loader.AbstractClassLoaderValue$Memoizer.get(AbstractClassLoaderValue.java:329)
>         at
> java.base/jdk.internal.loader.AbstractClassLoaderValue.computeIfAbsent(AbstractClassLoaderValue.java:205)
>         at java.base/java.lang.reflect.Proxy.getProxyConstructor(Proxy.java:424)
>         at java.base/java.lang.reflect.Proxy.getProxyClass(Proxy.java:384)
>         at ProxyClashTest.main(ProxyClashTest.java:56)
>         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.base/java.lang.reflect.Method.invoke(Method.java:564)
>         at com.sun.javatest.regtest.agent.MainActionHelper$SameVMRunnable.run(MainActionHelper.java:229)
>         at java.base/java.lang.Thread.run(Thread.java:841)
>
> JavaTest Message: Test threw exception: java.lang.IllegalArgumentException
> JavaTest Message: shutting down test

I did not run it with jtreg, just on the class path after compiling by
hand.  I guess it is failing because the nested class is not visible
from the system class loader when running within JTReg; maybe the fix
would be to use the class loader of the test class or the nested
class?

-- 
- DML


More information about the core-libs-dev mailing list