RFR 8251414: Add test that invokeinterface of a protected method in java.lang.Object throws NoSuchMethodError
David Holmes
david.holmes at oracle.com
Thu Aug 27 02:22:12 UTC 2020
Hi Harold,
On 19/08/2020 3:36 am, Harold Seigel wrote:
> Hi David,
>
> The test was adapted from an existing test that used reflection. It
> probably doesn't need to use it.
Okay ...
> If test file InterfaceObj.jasm is written in java, as described in the
> file's comments, then its compilation fails with the following errors:
>
> javac I.java InterfaceObj.java InterfaceObjectTest.java
> InterfaceObj.java:3: error: cannot find symbol
> I.finalize();
> ^
> symbol: method finalize()
> location: interface I
> InterfaceObj.java:9: error: cannot find symbol
> I.clone();
> ^
> symbol: method clone()
> location: interface I
Yes I expect it would as those are not static methods. :) The comment
block itself is incorrect:
29 static void f(I intf) throws Throwable {
30 I.finalize();
31 }
Should be intf.finalize()
35 static void c(I intf) throws Throwable {
36 I.clone();
37 }
Should be intf.clone()
Of course after that change it still won't compile as finalize/clone are
not defined in I and are non-public in Object - hence the need for jasm.
Cheers,
David
> Thanks, Harold
>
>
> On 8/17/2020 5:53 PM, David Holmes wrote:
>> Hi Harold,
>>
>> On 18/08/2020 12:26 am, Harold Seigel wrote:
>>> Hi David,
>>>
>>> This change got pushed before I saw your comments. Let me know if I
>>> should enter a new RFE to add the comments that you request below.
>>
>> No that's okay. But can you tell me why it needed to use jasm and
>> reflection? :)
>>
>> Thanks,
>> David
>>
>>> Thanks, Harold
>>>
>>> On 8/16/2020 10:06 PM, David Holmes wrote:
>>>> Hi Harold,
>>>>
>>>> On 13/08/2020 4:14 am, Harold Seigel wrote:
>>>>> Hi,
>>>>>
>>>>> Please review this change to add test cases to test
>>>>> hotspot/jtreg/runtime/8026394/InterfaceObjectTest.java to check for
>>>>> NoSuchMethodError exceptions when calling Object protected methods
>>>>> clone() and finalize() using invokeinterface.
>>>>>
>>>>> Open Webrev:
>>>>> http://cr.openjdk.java.net/~hseigel/bug_8251414/webrev/index.html
>>>>
>>>> Can you add a comment explaining why we need to use jasm and
>>>> reflection in this new case.
>>>>
>>>> Thanks,
>>>> David
>>>>
>>>>> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8251414
>>>>>
>>>>> The fix was tested by running the modified test on multiple
>>>>> platforms, including Mac OS, Windows, and Linux.
>>>>>
>>>>> Thanks, Harold
More information about the hotspot-runtime-dev
mailing list