I found a bug related to JavaParserMethodMetadata addMethod.
When I use JavaParserMethodMetadata.addMethod(..) to create a method with the same number, type and name of parameters and return type the method is created. This is not the correct behaviour, the method has to warn me that the method is duplicated.
When I debugged the code I found taht the problem is: after creating the annotation for input parameters in the method inside the 'for' in *line 225*:
The problem is that the variable index never is reset and only compares the method type of the first parameter (of hte method we are creating) with the method type of the last parameter of the method in the class and never matches, never find a duplicated method with parameters because of this.
When the method tries to locate where to add the method and also verify if this method already exists, always adds the method to the class because the order of the parameters to compare never is correct (if (!existingParameter.getJavaType().equals(method.getParameterTypes().get(index)))):