Skip to content

Commit

Permalink
Update archunit/src/main/java/com/tngtech/archunit/core/domain/Revers…
Browse files Browse the repository at this point in the history
…eDependencies.java

Co-authored-by: Manfred Hanke <Manfred.Hanke@tngtech.com>
  • Loading branch information
codecholeric and hankem authored Dec 15, 2020
1 parent 4b6c645 commit 82701fa
Showing 1 changed file with 14 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,34 +46,20 @@ final class ReverseDependencies {
private final SetMultimap<JavaClass, InstanceofCheck> instanceofCheckDependencies;
private final Supplier<SetMultimap<JavaClass, Dependency>> directDependenciesToClass;

private ReverseDependencies(
ImmutableSetMultimap<JavaClass, JavaFieldAccess> fieldAccessDependencies,
ImmutableSetMultimap<JavaClass, JavaMethodCall> methodCallDependencies,
ImmutableSetMultimap<String, JavaConstructorCall> constructorCallDependencies,
SetMultimap<JavaClass, JavaField> fieldTypeDependencies,
SetMultimap<JavaClass, JavaMethod> methodParameterTypeDependencies,
SetMultimap<JavaClass, JavaMethod> methodReturnTypeDependencies,
SetMultimap<JavaClass, ThrowsDeclaration<JavaMethod>> methodsThrowsDeclarationDependencies,
SetMultimap<JavaClass, JavaConstructor> constructorParameterTypeDependencies,
SetMultimap<JavaClass, ThrowsDeclaration<JavaConstructor>> constructorThrowsDeclarationDependencies,
SetMultimap<JavaClass, JavaAnnotation<?>> annotationTypeDependencies,
SetMultimap<JavaClass, JavaAnnotation<?>> annotationParameterTypeDependencies,
SetMultimap<JavaClass, InstanceofCheck> instanceofCheckDependencies,
List<JavaClassDependencies> allDependencies) {

accessToFieldCache = CacheBuilder.newBuilder().build(new ResolvingAccessLoader<>(fieldAccessDependencies));
callToMethodCache = CacheBuilder.newBuilder().build(new ResolvingAccessLoader<>(methodCallDependencies));
callToConstructorCache = CacheBuilder.newBuilder().build(new ConstructorCallLoader(constructorCallDependencies));
this.fieldTypeDependencies = fieldTypeDependencies;
this.methodParameterTypeDependencies = methodParameterTypeDependencies;
this.methodReturnTypeDependencies = methodReturnTypeDependencies;
this.methodsThrowsDeclarationDependencies = methodsThrowsDeclarationDependencies;
this.constructorParameterTypeDependencies = constructorParameterTypeDependencies;
this.constructorThrowsDeclarationDependencies = constructorThrowsDeclarationDependencies;
this.annotationTypeDependencies = annotationTypeDependencies;
this.annotationParameterTypeDependencies = annotationParameterTypeDependencies;
this.instanceofCheckDependencies = instanceofCheckDependencies;
this.directDependenciesToClass = createDirectDependenciesToClassSupplier(allDependencies);
private ReverseDependencies(ReverseDependencies.Creation creation) {
accessToFieldCache = CacheBuilder.newBuilder().build(new ResolvingAccessLoader<>(creation.fieldAccessDependencies.build()));
callToMethodCache = CacheBuilder.newBuilder().build(new ResolvingAccessLoader<>(creation.methodCallDependencies.build()));
callToConstructorCache = CacheBuilder.newBuilder().build(new ConstructorCallLoader(creation.constructorCallDependencies.build()));
this.fieldTypeDependencies = creation.fieldTypeDependencies.build();
this.methodParameterTypeDependencies = creation.methodParameterTypeDependencies.build();
this.methodReturnTypeDependencies = creation.methodReturnTypeDependencies.build();
this.methodsThrowsDeclarationDependencies = creation.methodsThrowsDeclarationDependencies.build();
this.constructorParameterTypeDependencies = creation.constructorParameterTypeDependencies.build();
this.constructorThrowsDeclarationDependencies = creation.constructorThrowsDeclarationDependencies.build();
this.annotationTypeDependencies = creation.annotationTypeDependencies.build();
this.annotationParameterTypeDependencies = creation.annotationParameterTypeDependencies.build();
this.instanceofCheckDependencies = creation.instanceofCheckDependencies.build();
this.directDependenciesToClass = createDirectDependenciesToClassSupplier(creation.allDependencies);
}

private static Supplier<SetMultimap<JavaClass, Dependency>> createDirectDependenciesToClassSupplier(final List<JavaClassDependencies> allDependencies) {
Expand Down

0 comments on commit 82701fa

Please sign in to comment.