Problem:
Assume that s is a string.
expression : s.contains("a") && s.contains("b")
The result is always false.
The "toBoolean" method of class "com.greenpineyu.fel.function.operator.And" need some improvement.
public String toBoolean(FelNode node, FelContext ctx, int index) {
List<FelNode> children = node.getChildren();
FelNode child = children.get(index);
SourceBuilder method = child.toMethod(ctx);
Class<?> type = method.returnType(ctx, child);
//problem is here,primitive type boolean is not included.
if (Boolean.class.isAssignableFrom(type) || boolean.class.isAssignableFrom(type)) {
return "(" + method.source(ctx, child) + ")";
}
if (String.class.isAssignableFrom(type)) {
return "Boolean.valueOf(" + method.source(ctx, child) + ")";
}
if (Null.class.isAssignableFrom(type)) {
return "false";
}
return "false";
}