RFR: 8065773: JDI: UOE is not thrown, when redefineClasses changes a class modifier [v2]
Coleen Phillimore
coleenp at openjdk.java.net
Fri Jan 29 20:27:42 UTC 2021
On Thu, 28 Jan 2021 18:18:57 GMT, Leonid Mesnik <lmesnik at openjdk.org> wrote:
>> The test failed because it expects that public/protected/default/private and static modifiers differ on the JVM level like in Java source code. However, only the ACC_PUBLIC modifier has an effect on interfaces.
>>
>> Here is my proposal from bug comments:
>>
>> I looked at the test and checked bytecode and spec.
>>
>> Indeed, the bytecode of all redefineclasses021bi redefined classes differs only by ACC_PUBLIC attribute. So there is no sense to test other access levels even they exist in JLS.
>>
>> The last redefinition adds 'static' modifier and verifies that there is no UOE is thrown. However static modifiers are also not set for interfaces because according to JLS it is set implicitly.
>> https://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-8.5.1
>> "A member interface is implicitly static (§9.1.1). It is permitted for the declaration of a member interface to redundantly specify the static modifier."
>> The test already has been fixed to verify that UOE is not thrown but it just doesn't do anything, assuming that bytecode is the same. So I believe this test case might safely be deleted.
>>
>>
>> It is also InnerClasses_attribute in redefineclasses021b which points to attributes of the inner class. However, the spec says that it used by the compiler only. Also, the test doesn't redefine this class but interface only.
>> See https://docs.oracle.com/javase/specs/jvms/se13/html/jvms-4.html:
>> "inner_class_access_flags
>> The value of the inner_class_access_flags item is a mask of flags used to denote access permissions to and properties of the class or interface C as declared in the source code from which this class file was compiled. It is used by a compiler to recover the original information when the source code is not available. The flags are specified in Table 4.7.6-A."
>>
>> So I think it is enough just to check public vs not public access modifiers.
>
> Leonid Mesnik has updated the pull request incrementally with one additional commit since the last revision:
>
> updated comments.
Thank you for fixing this!!
test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021.java line 52:
> 50: * This test performs the following cases: <br>
> 51: * 1. newclass01 - adding <code>public</code> interface-modifier <br>
> 52: * 1. newclass02 - removing <code>public</code> interface-modifier <br>
Should this be 2. not 1.? you have two 1.
-------------
Marked as reviewed by coleenp (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/2093
More information about the serviceability-dev
mailing list