Program: 111835
Project: 111835
Buggy source:
private CallImplementor createImplementor(final NotNullImplementor implementor,final NullPolicy nullPolicy,final boolean harmonize){
switch (nullPolicy) {
case ANY:
case STRICT:
    return new CallImplementor(){
      public Expression implement(      RexToLixTranslator translator,      RexCall call,      NullAs nullAs){
        return implementNullSemantics0(translator,call,nullAs,nullPolicy,harmonize,implementor);
      }
    }
;
case AND:
  return new CallImplementor(){
    public Expression implement(    RexToLixTranslator translator,    RexCall call,    NullAs nullAs){
      final RexCall call2=call2(false,translator,call);
      final List<Expression> expressions=translator.translateList(call2.getOperands(),nullAs);
      return Expressions.foldAnd(expressions);
    }
  }
;
case OR:
return new CallImplementor(){
  public Expression implement(  RexToLixTranslator translator,  RexCall call,  NullAs nullAs){
    final RexCall call2=call2(harmonize,translator,call);
    final NullAs nullAs2=nullAs == NullAs.TRUE ? NullAs.NULL : nullAs;
    final List<Expression> expressions=translator.translateList(call2.getOperands(),nullAs2);
switch (nullAs) {
case NOT_POSSIBLE:
case FALSE:
      return Expressions.foldOr(expressions);
  }
  final Expression t0=expressions.get(0);
  final Expression t1=expressions.get(1);
  if (!nullable(call2,0) && !nullable(call2,1)) {
    return Expressions.orElse(t0,t1);
  }
  return optimize(Expressions.condition(Expressions.equal(t0,NULL_EXPR),Expressions.condition(Expressions.orElse(Expressions.equal(t1,NULL_EXPR),Expressions.not(t1)),NULL_EXPR,BOXED_TRUE_EXPR),Expressions.condition(Expressions.not(t0),t1,BOXED_TRUE_EXPR)));
}
}
;
case NOT:
return new CallImplementor(){
public Expression implement(RexToLixTranslator translator,RexCall call,NullAs nullAs){
NullAs nullAs2;
switch (nullAs) {
case FALSE:
  nullAs2=NullAs.TRUE;
break;
case TRUE:
nullAs2=NullAs.FALSE;
break;
default :
nullAs2=nullAs;
}
return implementNullSemantics0(translator,call,nullAs2,nullPolicy,harmonize,implementor);
}
}
;
case NONE:
return new CallImplementor(){
public Expression implement(RexToLixTranslator translator,RexCall call,NullAs nullAs){
final RexCall call2=call2(false,translator,call);
return implementCall(translator,call2,implementor,nullAs);
}
}
;
default :
throw new AssertionError(nullPolicy);
}
}

Fixed version (ground truth):
private CallImplementor createImplementor(final NotNullImplementor implementor,final NullPolicy nullPolicy,final boolean harmonize){
switch (nullPolicy) {
case ANY:
case STRICT:
    return new CallImplementor(){
      public Expression implement(      RexToLixTranslator translator,      RexCall call,      NullAs nullAs){
        return implementNullSemantics0(translator,call,nullAs,nullPolicy,harmonize,implementor);
      }
    }
;
case AND:
  return new CallImplementor(){
    public Expression implement(    RexToLixTranslator translator,    RexCall call,    NullAs nullAs){
      final RexCall call2=call2(false,translator,call);
      final NullAs nullAs2=nullAs == NullAs.FALSE ? NullAs.NULL : nullAs;
      final List<Expression> expressions=translator.translateList(call2.getOperands(),nullAs2);
switch (nullAs) {
case NOT_POSSIBLE:
case TRUE:
        return Expressions.foldAnd(expressions);
    }
    final Expression t0=expressions.get(0);
    final Expression t1=expressions.get(1);
    if (!nullable(call2,0) && !nullable(call2,1)) {
      return Expressions.andAlso(t0,t1);
    }
    return optimize(Expressions.condition(optimize(Expressions.equal(t0,NULL_EXPR)),Expressions.condition(optimize(Expressions.orElse(Expressions.equal(t1,NULL_EXPR),t1)),NULL_EXPR,BOXED_FALSE_EXPR),Expressions.condition(Expressions.unbox(t0),Expressions.box(t1),BOXED_FALSE_EXPR)));
  }
}
;
case OR:
return new CallImplementor(){
public Expression implement(RexToLixTranslator translator,RexCall call,NullAs nullAs){
  final RexCall call2=call2(harmonize,translator,call);
  final NullAs nullAs2=nullAs == NullAs.TRUE ? NullAs.NULL : nullAs;
  final List<Expression> expressions=translator.translateList(call2.getOperands(),nullAs2);
switch (nullAs) {
case NOT_POSSIBLE:
case FALSE:
    return Expressions.foldOr(expressions);
}
final Expression t0=expressions.get(0);
final Expression t1=expressions.get(1);
if (!nullable(call2,0) && !nullable(call2,1)) {
  return Expressions.orElse(t0,t1);
}
return optimize(Expressions.condition(Expressions.equal(t0,NULL_EXPR),Expressions.condition(Expressions.orElse(Expressions.equal(t1,NULL_EXPR),Expressions.not(t1)),NULL_EXPR,BOXED_TRUE_EXPR),Expressions.condition(Expressions.not(t0),t1,BOXED_TRUE_EXPR)));
}
}
;
case NOT:
return new CallImplementor(){
public Expression implement(RexToLixTranslator translator,RexCall call,NullAs nullAs){
NullAs nullAs2;
switch (nullAs) {
case FALSE:
nullAs2=NullAs.TRUE;
break;
case TRUE:
nullAs2=NullAs.FALSE;
break;
default :
nullAs2=nullAs;
}
return implementNullSemantics0(translator,call,nullAs2,nullPolicy,harmonize,implementor);
}
}
;
case NONE:
return new CallImplementor(){
public Expression implement(RexToLixTranslator translator,RexCall call,NullAs nullAs){
final RexCall call2=call2(false,translator,call);
return implementCall(translator,call2,implementor,nullAs);
}
}
;
default :
throw new AssertionError(nullPolicy);
}
}