Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2000, 2009 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2010 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 556-567
Link Here
|
556 |
case CAN_ONLY_NULL | IN_COMPARISON_NON_NULL: |
556 |
case CAN_ONLY_NULL | IN_COMPARISON_NON_NULL: |
557 |
case CAN_ONLY_NULL | IN_ASSIGNMENT: |
557 |
case CAN_ONLY_NULL | IN_ASSIGNMENT: |
558 |
case CAN_ONLY_NULL | IN_INSTANCEOF: |
558 |
case CAN_ONLY_NULL | IN_INSTANCEOF: |
|
|
559 |
TypeBinding compileTimeType = reference.resolvedType; |
559 |
if (flowInfo.isDefinitelyNull(local)) { |
560 |
if (flowInfo.isDefinitelyNull(local)) { |
560 |
switch(checkType & CONTEXT_MASK) { |
561 |
switch(checkType & CONTEXT_MASK) { |
561 |
case FlowContext.IN_COMPARISON_NULL: |
562 |
case FlowContext.IN_COMPARISON_NULL: |
|
|
563 |
if (!compileTimeType.isBaseType() && ((checkType & CHECK_MASK) == CAN_ONLY_NULL)) { // check for auto-unboxing first and report appropriate warning |
564 |
TypeBinding unboxedType = scope.environment().computeBoxingType(compileTimeType); |
565 |
if (unboxedType != null && unboxedType != compileTimeType) { |
566 |
scope.problemReporter().localVariableNullReference(local, reference); |
567 |
return; |
568 |
} |
569 |
} |
562 |
scope.problemReporter().localVariableRedundantCheckOnNull(local, reference); |
570 |
scope.problemReporter().localVariableRedundantCheckOnNull(local, reference); |
563 |
return; |
571 |
return; |
564 |
case FlowContext.IN_COMPARISON_NON_NULL: |
572 |
case FlowContext.IN_COMPARISON_NON_NULL: |
|
|
573 |
if (!compileTimeType.isBaseType() && ((checkType & CHECK_MASK) == CAN_ONLY_NULL)) { // check for auto-unboxing first and report appropriate warning |
574 |
TypeBinding unboxedType = scope.environment().computeBoxingType(compileTimeType); |
575 |
if (unboxedType != null && unboxedType != compileTimeType) { |
576 |
scope.problemReporter().localVariableNullReference(local, reference); |
577 |
return; |
578 |
} |
579 |
} |
565 |
scope.problemReporter().localVariableNullComparedToNonNull(local, reference); |
580 |
scope.problemReporter().localVariableNullComparedToNonNull(local, reference); |
566 |
return; |
581 |
return; |
567 |
case FlowContext.IN_ASSIGNMENT: |
582 |
case FlowContext.IN_ASSIGNMENT: |
Lines 571-576
Link Here
|
571 |
scope.problemReporter().localVariableNullInstanceof(local, reference); |
586 |
scope.problemReporter().localVariableNullInstanceof(local, reference); |
572 |
return; |
587 |
return; |
573 |
} |
588 |
} |
|
|
589 |
} else if (flowInfo.isPotentiallyNull(local)) { |
590 |
switch(checkType & CONTEXT_MASK) { |
591 |
case FlowContext.IN_COMPARISON_NULL: |
592 |
if (!compileTimeType.isBaseType() && ((checkType & CHECK_MASK) == CAN_ONLY_NULL)) { // check for auto-unboxing first and report appropriate warning |
593 |
TypeBinding unboxedType = scope.environment().computeBoxingType(compileTimeType); |
594 |
if (unboxedType != null && unboxedType != compileTimeType) { |
595 |
scope.problemReporter().localVariablePotentialNullReference(local, reference); |
596 |
return; |
597 |
} |
598 |
} |
599 |
break; |
600 |
case FlowContext.IN_COMPARISON_NON_NULL: |
601 |
if (!compileTimeType.isBaseType() && ((checkType & CHECK_MASK) == CAN_ONLY_NULL)) { // check for auto-unboxing first and report appropriate warning |
602 |
TypeBinding unboxedType = scope.environment().computeBoxingType(compileTimeType); |
603 |
if (unboxedType != null && unboxedType != compileTimeType) { |
604 |
scope.problemReporter().localVariablePotentialNullReference(local, reference); |
605 |
return; |
606 |
} |
607 |
} |
608 |
break; |
609 |
} |
574 |
} else if (flowInfo.cannotBeDefinitelyNullOrNonNull(local)) { |
610 |
} else if (flowInfo.cannotBeDefinitelyNullOrNonNull(local)) { |
575 |
return; |
611 |
return; |
576 |
} |
612 |
} |