|
36 | 36 | import static org.eclipse.jdt.internal.compiler.lookup.MethodBinding.PARAM_NULLITY; |
37 | 37 | import static org.eclipse.jdt.internal.compiler.lookup.MethodBinding.PARAM_OWNING; |
38 | 38 |
|
39 | | -import java.util.ArrayList; |
40 | 39 | import java.util.List; |
41 | 40 | import org.eclipse.jdt.core.compiler.CategorizedProblem; |
42 | 41 | import org.eclipse.jdt.core.compiler.CharOperation; |
@@ -173,44 +172,25 @@ public void bindArguments() { |
173 | 172 | } |
174 | 173 | return; |
175 | 174 | } |
176 | | - } |
177 | | - |
178 | | - boolean used = this.binding == null || this.binding.isAbstract() || this.binding.isNative(); |
179 | | - AnnotationBinding[][] paramAnnotations = null; |
180 | | - AbstractVariableDeclaration [] methodArguments = this.arguments != null ? this.arguments : this.isCompactConstructor() ? this.scope.referenceType().recordComponents : NO_ARGUMENTS; |
181 | | - for (int i = 0, length = methodArguments.length; i < length; i++) { |
182 | | - AbstractVariableDeclaration methodArgument = methodArguments[i]; |
183 | | - AnnotationBinding [] param_i_Annotations; |
184 | | - if (methodArgument instanceof Argument argument) { |
| 175 | + boolean used = this.binding.isAbstract() || this.binding.isNative(); |
| 176 | + AnnotationBinding[][] paramAnnotations = null; |
| 177 | + for (int i = 0, length = this.arguments.length; i < length; i++) { |
| 178 | + Argument argument = this.arguments[i]; |
185 | 179 | this.binding.parameters[i] = argument.bind(this.scope, this.binding.parameters[i], used); |
186 | | - param_i_Annotations = argument.annotations != null ? argument.binding.getAnnotations() : null; |
187 | | - } else { |
188 | | - final LocalVariableBinding implicitArgument = new LocalVariableBinding(methodArgument.name, methodArgument.type.resolvedType, methodArgument.modifiers, true); |
189 | | - this.scope.addLocalVariable(implicitArgument); |
190 | | - List<AnnotationBinding> relevantAnnotationBindings = new ArrayList<>(); |
191 | | - ASTNode.getRelevantAnnotations(methodArgument.annotations, TagBits.AnnotationForParameter, relevantAnnotationBindings); |
192 | | - param_i_Annotations = relevantAnnotationBindings.toArray(new AnnotationBinding[0]); |
193 | | - if (param_i_Annotations != null && param_i_Annotations.length > 0) { |
194 | | - implicitArgument.setAnnotations(param_i_Annotations, this.scope, true); |
195 | | - implicitArgument.extendedTagBits |= ExtendedTagBits.AllAnnotationsResolved; |
196 | | - } |
197 | | - } |
198 | | - |
199 | | - if (param_i_Annotations != null && param_i_Annotations.length > 0) { |
200 | | - if (paramAnnotations == null) { |
201 | | - paramAnnotations = new AnnotationBinding[length][]; |
202 | | - for (int j=0; j<i; j++) { |
203 | | - paramAnnotations[j] = Binding.NO_ANNOTATIONS; |
| 180 | + if (argument.annotations != null) { |
| 181 | + if (paramAnnotations == null) { |
| 182 | + paramAnnotations = new AnnotationBinding[length][]; |
| 183 | + for (int j=0; j<i; j++) { |
| 184 | + paramAnnotations[j] = Binding.NO_ANNOTATIONS; |
| 185 | + } |
204 | 186 | } |
| 187 | + paramAnnotations[i] = argument.binding.getAnnotations(); |
| 188 | + } else if (paramAnnotations != null) { |
| 189 | + paramAnnotations[i] = Binding.NO_ANNOTATIONS; |
205 | 190 | } |
206 | | - paramAnnotations[i] = param_i_Annotations; |
207 | | - } else if (paramAnnotations != null) { |
208 | | - paramAnnotations[i] = Binding.NO_ANNOTATIONS; |
209 | 191 | } |
210 | | - } |
211 | | - if (paramAnnotations != null) { |
212 | | - this.binding.tagBits |= TagBits.HasParameterAnnotations; |
213 | | - this.binding.setParameterAnnotations(paramAnnotations); |
| 192 | + if (paramAnnotations != null) |
| 193 | + this.binding.setParameterAnnotations(paramAnnotations); |
214 | 194 | } |
215 | 195 | } |
216 | 196 |
|
|
0 commit comments