GH-802 - Allow transitive application module dependency resolution.

ApplicationModule now exposes both getDirectDependencies(…) and getAllDependencies(…), the former as alias for the now deprecated getDependencies(…) for symmetry reasons. The latter recursively resolves transitive dependencies.

We now optimize the dependency analysis by skipping types residing java and javax packages as they're not relevant to our dependency arrangement model. A few additional optimizations in ApplicationModuleDependencies to avoid iterating over each establishing dependency if all we need to look at is the general module dependency arrangement.

Improve performance of ApplicationModule.contains(…) checks by checking whether the given type can even live inside the package space of the module.
This commit is contained in:
Oliver Drotbohm
2024-09-05 20:55:11 +02:00
parent d5ab8b65cf
commit f09f3aa827
11 changed files with 295 additions and 121 deletions

View File

@@ -44,4 +44,15 @@ class PackageNameUnitTests {
.map(it -> it.getLocalName("com")))
.containsExactly("acme.b", "acme.a.second", "acme.a.first.one", "acme.a.first", "acme.a", "acme");
}
@Test // GH-802
void caculatesNestingCorrectly() {
var comAcme = new PackageName("com.acme");
var comAcmeA = new PackageName("com.acme.a");
assertThat(comAcme.contains(comAcme)).isTrue();
assertThat(comAcme.contains(comAcmeA)).isTrue();
assertThat(comAcmeA.contains(comAcme)).isFalse();
}
}