401 private void implAddReads(Module other, boolean syncVM) {
402 Objects.requireNonNull(other);
403 if (!canRead(other)) {
404 // update VM first, just in case it fails
405 if (syncVM) {
406 if (other == ALL_UNNAMED_MODULE) {
407 addReads0(this, null);
408 } else {
409 addReads0(this, other);
410 }
411 }
412
413 // add reflective read
414 ReflectionData.reads.putIfAbsent(this, other, Boolean.TRUE);
415 }
416 }
417
418
419 // -- exported and open packages --
420
421 // the packages are open to other modules, can be null
422 // if the value contains EVERYONE_MODULE then the package is open to all
423 private volatile Map<String, Set<Module>> openPackages;
424
425 // the packages that are exported, can be null
426 // if the value contains EVERYONE_MODULE then the package is exported to all
427 private volatile Map<String, Set<Module>> exportedPackages;
428
429 /**
430 * Returns {@code true} if this module exports the given package to at
431 * least the given module.
432 *
433 * <p> This method returns {@code true} if invoked to test if a package in
434 * this module is exported to itself. It always returns {@code true} when
435 * invoked on an unnamed module. A package that is {@link #isOpen open} to
436 * the given module is considered exported to that module at run-time and
437 * so this method returns {@code true} if the package is open to the given
438 * module. </p>
439 *
440 * <p> This method does not check if the given module reads this module. </p>
441 *
442 * @param pn
443 * The package name
444 * @param other
445 * The other module
446 *
|
401 private void implAddReads(Module other, boolean syncVM) {
402 Objects.requireNonNull(other);
403 if (!canRead(other)) {
404 // update VM first, just in case it fails
405 if (syncVM) {
406 if (other == ALL_UNNAMED_MODULE) {
407 addReads0(this, null);
408 } else {
409 addReads0(this, other);
410 }
411 }
412
413 // add reflective read
414 ReflectionData.reads.putIfAbsent(this, other, Boolean.TRUE);
415 }
416 }
417
418
419 // -- exported and open packages --
420
421 // the packages that are open to other modules, can be null
422 // if a value contains EVERYONE_MODULE then the package is open to all
423 private volatile Map<String, Set<Module>> openPackages;
424
425 // the packages that are exported to other modules, can be null
426 // if a value contains EVERYONE_MODULE then the package is exported to all
427 private volatile Map<String, Set<Module>> exportedPackages;
428
429 /**
430 * Returns {@code true} if this module exports the given package to at
431 * least the given module.
432 *
433 * <p> This method returns {@code true} if invoked to test if a package in
434 * this module is exported to itself. It always returns {@code true} when
435 * invoked on an unnamed module. A package that is {@link #isOpen open} to
436 * the given module is considered exported to that module at run-time and
437 * so this method returns {@code true} if the package is open to the given
438 * module. </p>
439 *
440 * <p> This method does not check if the given module reads this module. </p>
441 *
442 * @param pn
443 * The package name
444 * @param other
445 * The other module
446 *
|