< prev index next >

test/hotspot/jtreg/runtime/modules/CCE_module_msg.java

Print this page
*** 57,21 ***
          // Should display customer class loader
          invalidClassToStringCustomLoader();
      }
  
      public static void invalidObjectToDerived() {
!         java.lang.Object instance = new java.lang.Object();
          int left = 23;
          int right = 42;
          try {
              for (int i = 0; i < 1; i += 1) {
                  left = ((Derived) instance).method(left, right);
              }
              throw new RuntimeException("ClassCastException wasn't thrown, test failed.");
          } catch (ClassCastException cce) {
              System.out.println(cce.toString());
!             if (!cce.getMessage().contains("class java.lang.Object cannot be cast to class Derived (java.lang.Object is in module java.base of loader 'bootstrap'; Derived is in unnamed module of loader 'app')")) {
                  throw new RuntimeException("Wrong message: " + cce.getMessage());
              }
          }
      }
  
--- 57,21 ---
          // Should display customer class loader
          invalidClassToStringCustomLoader();
      }
  
      public static void invalidObjectToDerived() {
!         java.lang.Object instance = java.util.Objects.newIdentity();
          int left = 23;
          int right = 42;
          try {
              for (int i = 0; i < 1; i += 1) {
                  left = ((Derived) instance).method(left, right);
              }
              throw new RuntimeException("ClassCastException wasn't thrown, test failed.");
          } catch (ClassCastException cce) {
              System.out.println(cce.toString());
!             if (!cce.getMessage().contains("class java.util.Objects$1 cannot be cast to class Derived (java.util.Objects$1 is in module java.base of loader 'bootstrap'; Derived is in unnamed module of loader 'app')")) {
                  throw new RuntimeException("Wrong message: " + cce.getMessage());
              }
          }
      }
  
< prev index next >