You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val executableType = (element.asType() asExecutableType)
107
116
108
117
var startingPosition =0
109
118
val viewBindingParamName = executableType.viewBindingParamNameAtPosition(startingPosition)
110
119
if (viewBindingParamName !=null) {
111
120
if (viewBindingParamName != bindingType)
112
-
throwVelocidapterException("@Bind method $viewHolderName.${element.simpleName} viewBinding type was $viewBindingParamName but should be $bindingType. $VIEW_HOLDER_BIND_INSTRUCTION")
121
+
kotlin.run {
122
+
errors.add("@Bind method $viewHolderName.${element.simpleName} viewBinding type was $viewBindingParamName but should be $bindingType. $VIEW_HOLDER_BIND_INSTRUCTION")
123
+
returnnull
124
+
}
113
125
startingPosition++
114
126
}
115
127
116
128
val dataParamName = executableType.paramNameAtPosition(startingPosition++)
117
-
?:throwVelocidapterException("@Bind method $viewHolderName.${element.simpleName} data param is required. $VIEW_HOLDER_BIND_INSTRUCTION")
129
+
?: kotlin.run {
130
+
errors.add("@Bind method $viewHolderName.${element.simpleName} data param is required. $VIEW_HOLDER_BIND_INSTRUCTION")
131
+
returnnull
132
+
}
118
133
119
134
val hasPositionParam = executableType.parameterTypes
120
135
.getOrNull(startingPosition++)
121
136
?.let {
122
137
if (it !isPrimitiveType|| it.kind !=TypeKind.INT)
123
-
throwVelocidapterException("@Bind method $viewHolderName.${element.simpleName} second parameter is not an Int. $VIEW_HOLDER_BIND_INSTRUCTION")
138
+
kotlin.run {
139
+
errors.add("@Bind method $viewHolderName.${element.simpleName} second parameter is not an Int. $VIEW_HOLDER_BIND_INSTRUCTION")
throwVelocidapterException("@Bind method $viewHolderName.${element.simpleName}$executableType has too many params = ${executableType.parameterTypes.size}. $VIEW_HOLDER_BIND_INSTRUCTION")
146
+
errors.add("@Bind method $viewHolderName.${element.simpleName}$executableType has too many params = ${executableType.parameterTypes.size}. $VIEW_HOLDER_BIND_INSTRUCTION")
bindFunctionList?.find { it == enclosedElement }?.let { bindElement ->
54
59
if (bindFunction !=null) {
55
-
throwVelocidapterException("${viewHolderElement.simpleName} has multiple @Bind annotated methods. $VIEW_HOLDER_BIND_INSTRUCTION")
60
+
errors.add("${viewHolderElement.simpleName} has multiple @Bind annotated methods. $VIEW_HOLDER_BIND_INSTRUCTION")
56
61
}
57
62
bindFunction =ViewHolderBindFunction.from(
58
63
bindElement,
@@ -63,29 +68,29 @@ class VelocidapterProcessor : AbstractProcessor() {
63
68
64
69
unbindFunctionList?.find { it == enclosedElement }?.let { bindElement ->
65
70
if (unbindFunction !=null) {
66
-
throwVelocidapterException("${viewHolderElement.simpleName} has more than one @Unbind annotated method.")
71
+
errors.add("${viewHolderElement.simpleName} has more than one @Unbind annotated method.")
67
72
}
68
73
unbindFunction =FunctionName.from(bindElement)
69
74
}
70
75
71
76
attachFunctionList?.find { it == enclosedElement }?.let { attachElement ->
72
77
if (attachFunction !=null) {
73
-
throwVelocidapterException("${viewHolderElement.simpleName} has multiple @OnAttachToWindow annotated methods.")
78
+
errors.add("${viewHolderElement.simpleName} has multiple @OnAttachToWindow annotated methods.")
74
79
}
75
80
attachFunction =FunctionName.from(attachElement)
76
81
}
77
82
78
83
detatchFunctionList?.find { it == enclosedElement }?.let { detachElement ->
79
84
if (detachFunction !=null) {
80
-
throwVelocidapterException("${viewHolderElement.simpleName} has multiple @OnDetachFromWindow annotated methods.")
85
+
errors.add("${viewHolderElement.simpleName} has multiple @OnDetachFromWindow annotated methods.")
81
86
}
82
87
detachFunction =FunctionName.from(detachElement)
83
88
}
84
89
}
85
90
91
+
86
92
callback(
87
-
bindFunction
88
-
?:throwVelocidapterException("${viewHolderElement.simpleName} is missing an @Bind method. $VIEW_HOLDER_BIND_INSTRUCTION"),
93
+
bindFunction,
89
94
unbindFunction,
90
95
attachFunction,
91
96
detachFunction
@@ -121,11 +126,19 @@ class VelocidapterProcessor : AbstractProcessor() {
121
126
viewBindingTypeElement
122
127
}
123
128
.firstOrNull()
124
-
?:throwVelocidapterException("@ViewHolder for class ${viewHolderElement.simpleName} must have a constructor with a single param that is of type ViewBinding")
129
+
?: kotlin.run {
130
+
errors.add("@ViewHolder for class ${viewHolderElement.simpleName} must have a constructor with a single param that is of type ViewBinding")
0 commit comments