8253751: Dependencies of automatic modules are not propagated through module layers

Reviewed-by: mchung
This commit is contained in:
Alan Bateman 2020-12-01 15:40:10 +00:00
parent e3d0f27031
commit 1433bafb33
2 changed files with 80 additions and 10 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2020, 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
@ -560,7 +560,7 @@ final class Resolver {
for (ModuleDescriptor.Requires requires : descriptor.requires()) {
String dn = requires.name();
ResolvedModule m2 = null;
ResolvedModule m2;
ModuleReference mref2 = nameToReference.get(dn);
if (mref2 != null) {
// same configuration
@ -572,6 +572,14 @@ final class Resolver {
assert requires.modifiers().contains(Modifier.STATIC);
continue;
}
// m2 is automatic module in parent configuration => m1 reads
// all automatic modules that m2 reads.
if (m2.descriptor().isAutomatic()) {
m2.reads().stream()
.filter(d -> d.descriptor().isAutomatic())
.forEach(reads::add);
}
}
// m1 requires m2 => m1 reads m2
@ -838,9 +846,7 @@ final class Resolver {
* Invokes the beforeFinder to find method to find the given module.
*/
private ModuleReference findWithBeforeFinder(String mn) {
return beforeFinder.find(mn).orElse(null);
}
/**