From fce08dd006303bf40eed83016eb3f3b82d0418d7 Mon Sep 17 00:00:00 2001 From: Anton Keks Date: Sat, 16 May 2020 13:37:00 +0300 Subject: [PATCH] rename method --- .idea/inspectionProfiles/Project_Default.xml | 6 ++++++ src/net/azib/ipscan/di/Injector.java | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .idea/inspectionProfiles/Project_Default.xml diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 00000000..4591acd9 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/src/net/azib/ipscan/di/Injector.java b/src/net/azib/ipscan/di/Injector.java index 991f8b2e..f83388d1 100644 --- a/src/net/azib/ipscan/di/Injector.java +++ b/src/net/azib/ipscan/di/Injector.java @@ -46,14 +46,14 @@ public class Injector { .filter(c -> c.isAnnotationPresent(Inject.class)).findAny() .orElseThrow(() -> new InjectException(type.getName() + " has no constructors annotated with @Inject")); try { - return constructor.newInstance(deps(constructor)); + return constructor.newInstance(resolveDeps(constructor)); } catch (Exception e) { throw new InjectException("Cannot create " + type.getName() + ", deps: " + Arrays.toString(constructor.getGenericParameterTypes()), e); } } - private Object[] deps(Constructor constructor) { + private Object[] resolveDeps(Constructor constructor) { Type[] types = constructor.getGenericParameterTypes(); Annotation[][] ans = constructor.getParameterAnnotations(); return range(0, types.length).mapToObj(i -> isCollection(types[i]) ?