Example usage for org.eclipse.jdt.internal.compiler.flow FlowInfo NON_NULL

List of usage examples for org.eclipse.jdt.internal.compiler.flow FlowInfo NON_NULL

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.flow FlowInfo NON_NULL.

Prototype

int NON_NULL

To view the source code for org.eclipse.jdt.internal.compiler.flow FlowInfo NON_NULL.

Click Source Link

Usage

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.util.AstGenerator.java

License:Open Source License

public Expression nullCheck(Expression value) {
    EqualExpression result = new EqualExpression(value, nullLiteral(), OperatorIds.EQUAL_EQUAL) {
        protected void checkVariableComparison(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo,
                FlowInfo initsWhenTrue, FlowInfo initsWhenFalse, LocalVariableBinding local, int nullStatus,
                Expression reference) {
            // similar to super version: do mark flowInfo but avoid reporting any problems
            switch (nullStatus) {
            case FlowInfo.NULL:
                if (((this.bits & OperatorMASK) >> OperatorSHIFT) == EQUAL_EQUAL) {
                    initsWhenTrue.markAsComparedEqualToNull(local); // from thereon it is set
                    initsWhenFalse.markAsComparedEqualToNonNull(local); // from thereon it is set
                } else {
                    initsWhenTrue.markAsComparedEqualToNonNull(local); // from thereon it is set
                    initsWhenFalse.markAsComparedEqualToNull(local); // from thereon it is set
                }//from  w  w  w .java 2  s  .c  om
                break;
            case FlowInfo.NON_NULL:
                if (((this.bits & OperatorMASK) >> OperatorSHIFT) == EQUAL_EQUAL) {
                    initsWhenTrue.markAsComparedEqualToNonNull(local); // from thereon it is set
                }
                break;
            }
        }
    };
    result.sourceStart = this.sourceStart;
    result.sourceEnd = this.sourceEnd;
    result.constant = Constant.NotAConstant;
    result.isGenerated = true;
    return result;
}