add
private TypeMirror eraseGeneric(TypeMirror tm) {
if(tm instanceof TypeVariable){
TypeVariable tv = (TypeVariable)tm;
return tv.getUpperBound();
}
return tm;
}
in FluentExpecterGenerator and change get method
.addParameter(TypeName.get(eraseGeneric(element.getReturnType())), "y")
update in FluentSenderGeneratorBase
protected MethodSpec getMethod(Element element, ClassName className, Collection<TypeMirror> nesting) {
if (element.getModifiers().contains(Modifier.NATIVE) || !element.getModifiers().contains(Modifier.PUBLIC) )
return null;
if (element.getKind() == ElementKind.METHOD) {
ExecutableElement ex = (ExecutableElement)element;
if (ex.getReturnType().getKind() == TypeKind.BOOLEAN) {
return null;
} else {
return getMethod(ex, className, nesting);
}
} else if (element.getKind() == ElementKind.FIELD
&& !element.getModifiers().contains(Modifier.FINAL)
&& !element.getModifiers().contains(Modifier.STATIC))
return getMethod((VariableElement)element, className);
else
return null;
}
and don't forget to diable equals
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.