Program: 59645
Project: 59645
Buggy source:
private static CommonExpression readExpression(List<Token> tokens){
  CommonExpression rt=null;
  tokens=trimWhitespace(tokens);
  Token lastToken=tokens.get(tokens.size() - 1);
  if (lastToken.type == TokenType.WORD && (lastToken.value.equals("String_Node_Str") || lastToken.value.equals("String_Node_Str"))) {
    return Expression.orderBy(readExpression(tokens.subList(0,tokens.size() - 1)),lastToken.value.equals("String_Node_Str"));
  }
  tokens=processParentheses(tokens);
  if (tokens.size() == 2 && tokens.get(0).type == TokenType.WORD && tokens.get(1).type == TokenType.QUOTED_STRING) {
    String word=tokens.get(0).value;
    String value=unquote(tokens.get(1).value);
    if (word.equals("String_Node_Str")) {
      DateTime dt=DATETIME_FORMATTER.parseDateTime(value);
      return Expression.dateTime(new LocalDateTime(dt));
    }
 else     if (word.equals("String_Node_Str")) {
      DateTime dt=TIME_FORMATTER.parseDateTime(value);
      return Expression.time(new LocalTime(dt));
    }
 else     if (word.equals("String_Node_Str")) {
      DateTime dt=DATETIMEOFFSET_FORMATTER.parseDateTime(value);
      return Expression.dateTimeOffset(dt);
    }
 else     if (word.equals("String_Node_Str")) {
      return Expression.guid(Guid.fromString(value));
    }
 else     if (word.equals("String_Node_Str")) {
      return Expression.decimal(new BigDecimal(value));
    }
 else     if (word.equals("String_Node_Str") || word.equals("String_Node_Str")) {
      try {
        byte[] bValue=Hex.decodeHex(value.toCharArray());
        return Expression.binary(bValue);
      }
 catch (      DecoderException e) {
        throw new RuntimeException(e);
      }
    }
  }
  if (tokens.size() == 2 && tokens.get(0).type == TokenType.NUMBER && tokens.get(1).type == TokenType.WORD && tokens.get(1).value.equals("String_Node_Str")) {
    long longValue=Long.parseLong(tokens.get(0).value);
    return Expression.int64(longValue);
  }
  if (tokens.size() == 2 && tokens.get(0).type == TokenType.NUMBER && tokens.get(1).type == TokenType.WORD && tokens.get(1).value.equals("String_Node_Str")) {
    float floatValue=Float.parseFloat(tokens.get(0).value);
    return Expression.single(floatValue);
  }
  if (tokens.size() == 4 && tokens.get(0).type == TokenType.NUMBER && tokens.get(1).type == TokenType.SYMBOL && tokens.get(1).value.equals("String_Node_Str") && tokens.get(2).type == TokenType.NUMBER && tokens.get(3).value.equals("String_Node_Str")) {
    float floatValue=Float.parseFloat(tokens.get(0).value + "String_Node_Str" + tokens.get(2).value);
    return Expression.single(floatValue);
  }
  if (tokens.size() == 3 && tokens.get(0).type == TokenType.NUMBER && tokens.get(1).type == TokenType.SYMBOL && tokens.get(1).value.equals("String_Node_Str") && tokens.get(2).type == TokenType.NUMBER) {
    double doubleValue=Double.parseDouble(tokens.get(0).value + "String_Node_Str" + tokens.get(2).value);
    return Expression.double_(doubleValue);
  }
  if (tokens.size() == 4 && tokens.get(0).type == TokenType.NUMBER && tokens.get(1).type == TokenType.WORD && tokens.get(1).value.equals("String_Node_Str") && tokens.get(2).type == TokenType.SYMBOL && tokens.get(2).value.equals("String_Node_Str") && tokens.get(3).type == TokenType.NUMBER) {
    double doubleValue=Double.parseDouble(tokens.get(0).value + "String_Node_Str" + tokens.get(3).value);
    return Expression.double_(doubleValue);
  }
  if (tokens.size() == 3 && tokens.get(0).type == TokenType.NUMBER && tokens.get(1).type == TokenType.WORD && tokens.get(1).value.equals("String_Node_Str") && tokens.get(2).type == TokenType.NUMBER) {
    int e=Integer.parseInt(tokens.get(2).value);
    if (e < 1) {
      double doubleValue=Double.parseDouble(tokens.get(0).value + "String_Node_Str" + tokens.get(2).value);
      return Expression.double_(doubleValue);
    }
  }
  if (tokens.size() == 6 && tokens.get(0).type == TokenType.NUMBER && tokens.get(1).type == TokenType.SYMBOL && tokens.get(1).value.equals("String_Node_Str") && tokens.get(2).type == TokenType.NUMBER && tokens.get(3).type == TokenType.WORD && tokens.get(3).value.equals("String_Node_Str") && tokens.get(4).type == TokenType.SYMBOL && tokens.get(4).value.equals("String_Node_Str") && tokens.get(5).type == TokenType.NUMBER) {
    double doubleValue=Double.parseDouble(tokens.get(0).value + "String_Node_Str" + tokens.get(2).value+ "String_Node_Str"+ tokens.get(5).value);
    return Expression.double_(doubleValue);
  }
  if (tokens.size() == 5 && tokens.get(0).type == TokenType.NUMBER && tokens.get(1).type == TokenType.SYMBOL && tokens.get(1).value.equals("String_Node_Str") && tokens.get(2).type == TokenType.NUMBER && tokens.get(3).type == TokenType.WORD && tokens.get(3).value.equals("String_Node_Str") && tokens.get(4).type == TokenType.NUMBER) {
    int e=Integer.parseInt(tokens.get(4).value);
    if (e < 1) {
      double doubleValue=Double.parseDouble(tokens.get(0).value + "String_Node_Str" + tokens.get(2).value+ "String_Node_Str"+ tokens.get(4).value);
      return Expression.double_(doubleValue);
    }
  }
  if (tokens.size() == 1) {
    final Token token=tokens.get(0);
    if (token.type == TokenType.QUOTED_STRING) {
      return Expression.string(unquote(token.value));
    }
 else     if (token.type == TokenType.WORD) {
      if (token.value.equals("String_Node_Str")) {
        return Expression.null_();
      }
      if (token.value.equals("String_Node_Str")) {
        return Expression.boolean_(true);
      }
      if (token.value.equals("String_Node_Str")) {
        return Expression.boolean_(false);
      }
      return Expression.simpleProperty(token.value);
    }
 else     if (token.type == TokenType.NUMBER) {
      int value=Integer.parseInt(token.value);
      return Expression.integral(value);
    }
 else     if (token.type == TokenType.EXPRESSION) {
      return ((ExpressionToken)token).expression;
    }
 else {
      throw new RuntimeException("String_Node_Str");
    }
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      assertType(lhs,BoolCommonExpression.class);
      assertType(rhs,BoolCommonExpression.class);
      return Expression.or((BoolCommonExpression)lhs,(BoolCommonExpression)rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      assertType(lhs,BoolCommonExpression.class);
      assertType(rhs,BoolCommonExpression.class);
      return Expression.and((BoolCommonExpression)lhs,(BoolCommonExpression)rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.eq(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.ne(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.lt(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.gt(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.le(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.ge(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.add(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.sub(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.mul(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.div(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.mod(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processUnaryExpression(tokens,"String_Node_Str",true,new Func1<CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression expression){
      return Expression.not(expression);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processUnaryExpression(tokens,"String_Node_Str",false,new Func1<CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression expression){
      return Expression.negate(expression);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  throw new RuntimeException("String_Node_Str");
}

Fixed version (ground truth):
private static CommonExpression readExpression(List<Token> tokens){
  CommonExpression rt=null;
  tokens=trimWhitespace(tokens);
  Token lastToken=tokens.get(tokens.size() - 1);
  if (lastToken.type == TokenType.WORD && (lastToken.value.equals("String_Node_Str") || lastToken.value.equals("String_Node_Str"))) {
    return Expression.orderBy(readExpression(tokens.subList(0,tokens.size() - 1)),lastToken.value.equals("String_Node_Str"));
  }
  tokens=processParentheses(tokens);
  if (tokens.size() == 2 && tokens.get(0).type == TokenType.WORD && tokens.get(1).type == TokenType.QUOTED_STRING) {
    String word=tokens.get(0).value;
    String value=unquote(tokens.get(1).value);
    if (word.equals("String_Node_Str")) {
      DateTime dt=DATETIME_FORMATTER.parseDateTime(value);
      return Expression.dateTime(new LocalDateTime(dt));
    }
 else     if (word.equals("String_Node_Str")) {
      DateTime dt=TIME_FORMATTER.parseDateTime(value);
      return Expression.time(new LocalTime(dt));
    }
 else     if (word.equals("String_Node_Str")) {
      DateTime dt=DATETIMEOFFSET_FORMATTER.parseDateTime(value);
      return Expression.dateTimeOffset(dt);
    }
 else     if (word.equals("String_Node_Str")) {
      return Expression.guid(Guid.fromString(value));
    }
 else     if (word.equals("String_Node_Str")) {
      return Expression.decimal(new BigDecimal(value));
    }
 else     if (word.equals("String_Node_Str") || word.equals("String_Node_Str")) {
      try {
        byte[] bValue=Hex.decodeHex(value.toCharArray());
        return Expression.binary(bValue);
      }
 catch (      DecoderException e) {
        throw new RuntimeException(e);
      }
    }
  }
  if (tokens.size() == 2 && tokens.get(0).type == TokenType.NUMBER && tokens.get(1).type == TokenType.WORD && tokens.get(1).value.equals("String_Node_Str")) {
    long longValue=Long.parseLong(tokens.get(0).value);
    return Expression.int64(longValue);
  }
  if (tokens.size() == 2 && tokens.get(0).type == TokenType.NUMBER && tokens.get(1).type == TokenType.WORD && tokens.get(1).value.equals("String_Node_Str")) {
    float floatValue=Float.parseFloat(tokens.get(0).value);
    return Expression.single(floatValue);
  }
  if (tokens.size() == 4 && tokens.get(0).type == TokenType.NUMBER && tokens.get(1).type == TokenType.SYMBOL && tokens.get(1).value.equals("String_Node_Str") && tokens.get(2).type == TokenType.NUMBER && tokens.get(3).value.equals("String_Node_Str")) {
    float floatValue=Float.parseFloat(tokens.get(0).value + "String_Node_Str" + tokens.get(2).value);
    return Expression.single(floatValue);
  }
  if (tokens.size() == 3 && tokens.get(0).type == TokenType.NUMBER && tokens.get(1).type == TokenType.SYMBOL && tokens.get(1).value.equals("String_Node_Str") && tokens.get(2).type == TokenType.NUMBER) {
    double doubleValue=Double.parseDouble(tokens.get(0).value + "String_Node_Str" + tokens.get(2).value);
    return Expression.double_(doubleValue);
  }
  if (tokens.size() == 4 && tokens.get(0).type == TokenType.NUMBER && tokens.get(1).type == TokenType.WORD && tokens.get(1).value.equals("String_Node_Str") && tokens.get(2).type == TokenType.SYMBOL && tokens.get(2).value.equals("String_Node_Str") && tokens.get(3).type == TokenType.NUMBER) {
    double doubleValue=Double.parseDouble(tokens.get(0).value + "String_Node_Str" + tokens.get(3).value);
    return Expression.double_(doubleValue);
  }
  if (tokens.size() == 3 && tokens.get(0).type == TokenType.NUMBER && tokens.get(1).type == TokenType.WORD && tokens.get(1).value.equals("String_Node_Str") && tokens.get(2).type == TokenType.NUMBER) {
    int e=Integer.parseInt(tokens.get(2).value);
    if (e < 1) {
      double doubleValue=Double.parseDouble(tokens.get(0).value + "String_Node_Str" + tokens.get(2).value);
      return Expression.double_(doubleValue);
    }
  }
  if (tokens.size() == 6 && tokens.get(0).type == TokenType.NUMBER && tokens.get(1).type == TokenType.SYMBOL && tokens.get(1).value.equals("String_Node_Str") && tokens.get(2).type == TokenType.NUMBER && tokens.get(3).type == TokenType.WORD && tokens.get(3).value.equals("String_Node_Str") && tokens.get(4).type == TokenType.SYMBOL && tokens.get(4).value.equals("String_Node_Str") && tokens.get(5).type == TokenType.NUMBER) {
    double doubleValue=Double.parseDouble(tokens.get(0).value + "String_Node_Str" + tokens.get(2).value+ "String_Node_Str"+ tokens.get(5).value);
    return Expression.double_(doubleValue);
  }
  if (tokens.size() == 5 && tokens.get(0).type == TokenType.NUMBER && tokens.get(1).type == TokenType.SYMBOL && tokens.get(1).value.equals("String_Node_Str") && tokens.get(2).type == TokenType.NUMBER && tokens.get(3).type == TokenType.WORD && tokens.get(3).value.equals("String_Node_Str") && tokens.get(4).type == TokenType.NUMBER) {
    int e=Integer.parseInt(tokens.get(4).value);
    if (e < 1) {
      double doubleValue=Double.parseDouble(tokens.get(0).value + "String_Node_Str" + tokens.get(2).value+ "String_Node_Str"+ tokens.get(4).value);
      return Expression.double_(doubleValue);
    }
  }
  if (tokens.size() == 1) {
    final Token token=tokens.get(0);
    if (token.type == TokenType.QUOTED_STRING) {
      return Expression.string(unquote(token.value));
    }
 else     if (token.type == TokenType.WORD) {
      if (token.value.equals("String_Node_Str")) {
        return Expression.null_();
      }
      if (token.value.equals("String_Node_Str")) {
        return Expression.boolean_(true);
      }
      if (token.value.equals("String_Node_Str")) {
        return Expression.boolean_(false);
      }
      return Expression.simpleProperty(token.value);
    }
 else     if (token.type == TokenType.NUMBER) {
      try {
        int value=Integer.parseInt(token.value);
        return Expression.integral(value);
      }
 catch (      NumberFormatException e) {
        long value=Long.parseLong(token.value);
        return Expression.int64(value);
      }
    }
 else     if (token.type == TokenType.EXPRESSION) {
      return ((ExpressionToken)token).expression;
    }
 else {
      throw new RuntimeException("String_Node_Str");
    }
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      assertType(lhs,BoolCommonExpression.class);
      assertType(rhs,BoolCommonExpression.class);
      return Expression.or((BoolCommonExpression)lhs,(BoolCommonExpression)rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      assertType(lhs,BoolCommonExpression.class);
      assertType(rhs,BoolCommonExpression.class);
      return Expression.and((BoolCommonExpression)lhs,(BoolCommonExpression)rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.eq(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.ne(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.lt(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.gt(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.le(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.ge(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.add(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.sub(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.mul(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.div(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processBinaryExpression(tokens,"String_Node_Str",new Func2<CommonExpression,CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression lhs,    CommonExpression rhs){
      return Expression.mod(lhs,rhs);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processUnaryExpression(tokens,"String_Node_Str",true,new Func1<CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression expression){
      return Expression.not(expression);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  rt=processUnaryExpression(tokens,"String_Node_Str",false,new Func1<CommonExpression,CommonExpression>(){
    public CommonExpression apply(    CommonExpression expression){
      return Expression.negate(expression);
    }
  }
);
  if (rt != null) {
    return rt;
  }
  throw new RuntimeException("String_Node_Str");
}