462 ------------------------------------------------------------------------------------------------ |
462 ------------------------------------------------------------------------------------------------ |
463 |
463 |
464 Caller S in package If MS is loose: YES If same classloader/package (PS == PT): YES |
464 Caller S in package If MS is loose: YES If same classloader/package (PS == PT): YES |
465 PS, runtime module MS If MS can read T's If same runtime module: (MS == MT): YES |
465 PS, runtime module MS If MS can read T's If same runtime module: (MS == MT): YES |
466 unnamed module: YES |
466 unnamed module: YES |
467 Else if (MS can read MT (Establish readability) && |
467 Else if (MS can read MT (establish readability) && |
468 MT exports PT to MS or to all modules): YES |
468 ((MT exports PT to MS or to all modules) || |
|
469 (MT is open))): YES |
469 |
470 |
470 ------------------------------------------------------------------------------------------------ |
471 ------------------------------------------------------------------------------------------------ |
471 Caller S in unnamed YES Readability exists because unnamed module |
472 Caller S in unnamed YES Readability exists because unnamed module |
472 module UM "reads" all modules |
473 module UM "reads" all modules |
473 if (MT exports PT to UM or to all modules): YES |
474 if (MT exports PT to UM or to all modules): YES |
509 // both in same (possibly unnamed) module |
510 // both in same (possibly unnamed) module |
510 if (module_from == module_to) { |
511 if (module_from == module_to) { |
511 return ACCESS_OK; |
512 return ACCESS_OK; |
512 } |
513 } |
513 |
514 |
514 // Acceptable access to a type in an unamed module. Note that since |
515 // Acceptable access to a type in an unnamed module. Note that since |
515 // unnamed modules can read all unnamed modules, this also handles the |
516 // unnamed modules can read all unnamed modules, this also handles the |
516 // case where module_from is also unnamed but in a different class loader. |
517 // case where module_from is also unnamed but in a different class loader. |
517 if (!module_to->is_named() && |
518 if (!module_to->is_named() && |
518 (module_from->can_read_all_unnamed() || module_from->can_read(module_to))) { |
519 (module_from->can_read_all_unnamed() || module_from->can_read(module_to))) { |
519 return ACCESS_OK; |
520 return ACCESS_OK; |
520 } |
521 } |
521 |
522 |
522 // Establish readability, check if module_from is allowed to read module_to. |
523 // Establish readability, check if module_from is allowed to read module_to. |
523 if (!module_from->can_read(module_to)) { |
524 if (!module_from->can_read(module_to)) { |
524 return MODULE_NOT_READABLE; |
525 return MODULE_NOT_READABLE; |
|
526 } |
|
527 |
|
528 // Access is allowed if module_to is open, i.e. all its packages are unqualifiedly exported |
|
529 if (module_to->is_open()) { |
|
530 return ACCESS_OK; |
525 } |
531 } |
526 |
532 |
527 PackageEntry* package_to = new_class->package(); |
533 PackageEntry* package_to = new_class->package(); |
528 assert(package_to != NULL, "can not obtain new_class' package"); |
534 assert(package_to != NULL, "can not obtain new_class' package"); |
529 |
535 |