451 } 452 453 PrivilegedAction<ClassLoader> pa = module::getClassLoader; 454 ClassLoader cl = AccessController.doPrivileged(pa); 455 Class<?> c; 456 if (cl != null) { 457 c = cl.loadClass(module, name); 458 } else { 459 c = BootLoader.loadClass(module, name); 460 } 461 462 return c != null && !c.isValueClass() ? c : null; 463 } 464 465 boolean isValueClass() { 466 Class<?> c = this; 467 while (c.isArray()) { 468 c = c.getComponentType(); 469 } 470 471 // Check ACC_VALUE for now to workaround the issue in C2 intrinsic 472 // for isAssignableFrom that does not work with value type 473 return (c.getModifiers() & ACC_VALUE) != 0 && c != __Value.class; 474 } 475 476 private void ensureNotValueClass() { 477 // temporary workaround until compiler/valhalla/valuetypes/ValueTypeBenchTest.java 478 // is updated to do reflection on VCC instead of VVT declared with __ByValue 479 if (this.isValueClass() && !Boolean.parseBoolean(VM.getSavedProperty("jdk.lang.reflect.DVT"))) { 480 throw new UnsupportedOperationException("cannot reflect on derived value type " 481 + this.getName()); 482 } 483 } 484 485 /** 486 * Creates a new instance of the class represented by this {@code Class} 487 * object. The class is instantiated as if by a {@code new} 488 * expression with an empty argument list. The class is initialized if it 489 * has not already been initialized. 490 * 491 * @deprecated This method propagates any exception thrown by the 492 * nullary constructor, including a checked exception. Use of 493 * this method effectively bypasses the compile-time exception | 451 } 452 453 PrivilegedAction<ClassLoader> pa = module::getClassLoader; 454 ClassLoader cl = AccessController.doPrivileged(pa); 455 Class<?> c; 456 if (cl != null) { 457 c = cl.loadClass(module, name); 458 } else { 459 c = BootLoader.loadClass(module, name); 460 } 461 462 return c != null && !c.isValueClass() ? c : null; 463 } 464 465 boolean isValueClass() { 466 Class<?> c = this; 467 while (c.isArray()) { 468 c = c.getComponentType(); 469 } 470 471 // For now, check if it is a subtype of __Value 472 return __Value.class.isAssignableFrom(c) && c != __Value.class; 473 } 474 475 private void ensureNotValueClass() { 476 // temporary workaround until compiler/valhalla/valuetypes/ValueTypeBenchTest.java 477 // is updated to do reflection on VCC instead of VVT declared with __ByValue 478 if (this.isValueClass() && !Boolean.parseBoolean(VM.getSavedProperty("jdk.lang.reflect.DVT"))) { 479 throw new UnsupportedOperationException("cannot reflect on derived value type " 480 + this.getName()); 481 } 482 } 483 484 /** 485 * Creates a new instance of the class represented by this {@code Class} 486 * object. The class is instantiated as if by a {@code new} 487 * expression with an empty argument list. The class is initialized if it 488 * has not already been initialized. 489 * 490 * @deprecated This method propagates any exception thrown by the 491 * nullary constructor, including a checked exception. Use of 492 * this method effectively bypasses the compile-time exception |