return null;
}
@Override
public Void visitExecutable(ExecutableElement e, ElementModel p) {
MethodModel exec = null;
String name = e.getSimpleName().toString();
/*
* For enum types, synthesized methods values() and
* valueOf(String) are reflected by the API but must not be
* reproduced in the mock.
*/
if (p.getKind() == ElementKind.ENUM) {
ExecutableType t = (ExecutableType) e.asType();
if (name.equals("values")) {
if (t.getParameterTypes().isEmpty()) {
return null;
}
} else if (name.equals("valueOf")) {
List<TypeMirror> valueOfParameterTypes =
Collections.singletonList(
utils.elementUtils
.getTypeElement("java.lang.String").asType());
if (t.getParameterTypes().equals(valueOfParameterTypes)) {
return null;
}
}
}
/* Create element; decide if constructor or not. */
if (name.toString().equals("<init>")) {
exec = new MethodModel();
} else {
exec = new MethodModel(ElementKind.METHOD, name,
utils.getTypeNameForType(e.getReturnType()));
}
utils.copyModifiers(e, exec);
/* Add generic signature. */
List<? extends TypeParameterElement> genericTypes = e.getTypeParameters();
for (TypeParameterElement tp : genericTypes) {
exec.addTypeParameter(utils.getGenericTypeName(tp));
}
/* Add parameters. */
scan(e.getParameters(), exec);
exec.setVariadic(e.isVarArgs());
/* Add throws list. */
for (TypeMirror tt : e.getThrownTypes()) {
exec.addException(utils.getTypeNameForType(tt));
}
/* Add annotations. */
scanAnnotations(e, true, type.getName(), exec);