< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/modifiers/modifiers001.java

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.
--- 1,7 ---
  /*
!  * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

*** 186,13 ***
              }
              int expected_modifiers = class_obj.getModifiers();
              String s_type = classes_for_check[i][2];
              String s_modifiers = classes_for_check[i][1];
              int got_modifiers = refType.modifiers();
!             // Class.getModifiers() will never return ACC_SUPER
!             // but Accessible.modifers() can, so ignore this bit
!             got_modifiers &= ~0x20; // 0x20 == ACC_SUPER
              logHandler.display("");
              if ( got_modifiers != expected_modifiers ) {
                  logHandler.complain("##> modifiers001: UNEXPECTED modifiers() method result ("
                                      + "0x" + Integer.toHexString(got_modifiers) + ") for " + s_type + ": " + className
                                      + "(" +  s_modifiers + ")");
--- 186,20 ---
              }
              int expected_modifiers = class_obj.getModifiers();
              String s_type = classes_for_check[i][2];
              String s_modifiers = classes_for_check[i][1];
              int got_modifiers = refType.modifiers();
!             boolean previewEnabled =
!                 System.getProperty("test.java.opts", "").contains("--enable-preview") ||
!                 System.getProperty("test.vm.opts", "").contains("--enable-preview");
+             if (!previewEnabled) {
+                 // With preview enabled 0x20 is ACC_IDENTITY.
+                 // When not enabled 0x20 is ACC_SUPER.
+                 // Class.getModifiers() will never return ACC_SUPER
+                 // but Accessible.modifers() can, so ignore this bit.
+                 got_modifiers &= ~0x20; // 0x20 == ACC_SUPER
+             }
              logHandler.display("");
              if ( got_modifiers != expected_modifiers ) {
                  logHandler.complain("##> modifiers001: UNEXPECTED modifiers() method result ("
                                      + "0x" + Integer.toHexString(got_modifiers) + ") for " + s_type + ": " + className
                                      + "(" +  s_modifiers + ")");
< prev index next >