On Fri, 15 Jan 2021 07:07:30 GMT, Leonid Mesnik <[email protected]> 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. This pull request has now been integrated. Changeset: f5ca8385 Author: Leonid Mesnik <[email protected]> URL: https://git.openjdk.java.net/jdk/commit/f5ca8385 Stats: 702 lines in 13 files changed: 31 ins; 636 del; 35 mod 8065773: JDI: UOE is not thrown, when redefineClasses changes a class modifier Reviewed-by: sspitsyn, coleenp ------------- PR: https://git.openjdk.java.net/jdk/pull/2093
