public static Expr binaryOp ( BinaryOpExprBase binary , Expr left , Expr right ) { try { return binary . getClass ( ) . getDeclaredConstructor ( String . class , Expr . class , Expr . class ) . newInstance ( binary . op , left , right ) ; } catch ( Exception e ) { log . warn ( e , "failed to rewrite expression " + binary ) ; return binary ; // best effort.. keep it working } }
you should create it explicitly in here