@@ -11,9 +11,7 @@ import java.lang.reflect.WildcardType
11
11
abstract class ServiceRegistration <T > {
12
12
val services: MutableSet <Class <* >> = mutableSetOf ()
13
13
14
- inline fun <reified TService : Any > provides (): ServiceRegistration <T > {
15
- return provides(TService ::class .java)
16
- }
14
+ inline fun <reified TService : Any > provides (): ServiceRegistration <T > = provides(TService ::class .java)
17
15
18
16
/* *
19
17
* Indicate this registration wants to provide the provided class as
@@ -53,14 +51,12 @@ class ServiceRegistrationReflection<T>(
53
51
54
52
override fun resolve (provider : IServiceProvider ): Any? {
55
53
if (obj != null ) {
56
- Logging .debug(" ${ServiceProvider .indent} Already instantiated: $obj " )
57
54
return obj
58
55
}
59
56
60
57
// use reflection to try to instantiate the thing
61
58
for (constructor in clazz.constructors) {
62
59
if (doesHaveAllParameters(constructor , provider)) {
63
- Logging .debug(" ${ServiceProvider .indent} Found constructor: $constructor " )
64
60
var paramList: MutableList <Any ?> = mutableListOf ()
65
61
66
62
for (param in constructor .genericParameterTypes) {
@@ -106,25 +102,25 @@ class ServiceRegistrationReflection<T>(
106
102
val clazz = argType.upperBounds.first()
107
103
if (clazz is Class <* >) {
108
104
if (! provider.hasService(clazz)) {
109
- Logging .debug (" Constructor $constructor could not find service: $clazz " )
105
+ Logging .error (" Constructor $constructor could not find service: $clazz " )
110
106
return false
111
107
}
112
108
}
113
109
} else if (argType is Class <* >) {
114
110
if (! provider.hasService(argType)) {
115
- Logging .debug (" Constructor $constructor could not find service: $argType " )
111
+ Logging .error (" Constructor $constructor could not find service: $argType " )
116
112
return false
117
113
}
118
114
} else {
119
115
return false
120
116
}
121
117
} else if (param is Class <* >) {
122
118
if (! provider.hasService(param)) {
123
- Logging .debug (" Constructor $constructor could not find service: $param " )
119
+ Logging .error (" Constructor $constructor could not find service: $param " )
124
120
return false
125
121
}
126
122
} else {
127
- Logging .debug (" Constructor $constructor could not identify param type: $param " )
123
+ Logging .error (" Constructor $constructor could not identify param type: $param " )
128
124
return false
129
125
}
130
126
}
0 commit comments