Lines 18-23
Link Here
|
18 |
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; |
18 |
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; |
19 |
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; |
19 |
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; |
20 |
import org.eclipse.jdt.internal.compiler.lookup.Scope; |
20 |
import org.eclipse.jdt.internal.compiler.lookup.Scope; |
|
|
21 |
import org.eclipse.jdt.internal.compiler.lookup.TypeIds; |
21 |
import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; |
22 |
import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; |
22 |
|
23 |
|
23 |
/** |
24 |
/** |
Lines 163-171
Link Here
|
163 |
this.nullReferences[i] = null; |
164 |
this.nullReferences[i] = null; |
164 |
switch(this.nullCheckTypes[i] & CONTEXT_MASK) { |
165 |
switch(this.nullCheckTypes[i] & CONTEXT_MASK) { |
165 |
case FlowContext.IN_COMPARISON_NULL: |
166 |
case FlowContext.IN_COMPARISON_NULL: |
|
|
167 |
if (((this.nullCheckTypes[i] & CHECK_MASK) == CAN_ONLY_NULL) && (expression.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning |
168 |
scope.problemReporter().localVariableNullReference(local, expression); |
169 |
continue; |
170 |
} |
166 |
scope.problemReporter().localVariableRedundantCheckOnNull(local, expression); |
171 |
scope.problemReporter().localVariableRedundantCheckOnNull(local, expression); |
167 |
continue; |
172 |
continue; |
168 |
case FlowContext.IN_COMPARISON_NON_NULL: |
173 |
case FlowContext.IN_COMPARISON_NON_NULL: |
|
|
174 |
if (((this.nullCheckTypes[i] & CHECK_MASK) == CAN_ONLY_NULL) && (expression.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning |
175 |
scope.problemReporter().localVariableNullReference(local, expression); |
176 |
continue; |
177 |
} |
169 |
scope.problemReporter().localVariableNullComparedToNonNull(local, expression); |
178 |
scope.problemReporter().localVariableNullComparedToNonNull(local, expression); |
170 |
continue; |
179 |
continue; |
171 |
case FlowContext.IN_ASSIGNMENT: |
180 |
case FlowContext.IN_ASSIGNMENT: |
Lines 175-181
Link Here
|
175 |
scope.problemReporter().localVariableNullInstanceof(local, expression); |
184 |
scope.problemReporter().localVariableNullInstanceof(local, expression); |
176 |
continue; |
185 |
continue; |
177 |
} |
186 |
} |
178 |
} |
187 |
} else if (flowInfo.isPotentiallyNull(local)) { |
|
|
188 |
switch(this.nullCheckTypes[i] & CONTEXT_MASK) { |
189 |
case FlowContext.IN_COMPARISON_NULL: |
190 |
this.nullReferences[i] = null; |
191 |
if (((this.nullCheckTypes[i] & CHECK_MASK) == CAN_ONLY_NULL) && (expression.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning |
192 |
scope.problemReporter().localVariablePotentialNullReference(local, expression); |
193 |
continue; |
194 |
} |
195 |
break; |
196 |
case FlowContext.IN_COMPARISON_NON_NULL: |
197 |
this.nullReferences[i] = null; |
198 |
if (((this.nullCheckTypes[i] & CHECK_MASK) == CAN_ONLY_NULL) && (expression.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning |
199 |
scope.problemReporter().localVariablePotentialNullReference(local, expression); |
200 |
continue; |
201 |
} |
202 |
break; |
203 |
} |
204 |
} |
179 |
break; |
205 |
break; |
180 |
case MAY_NULL: |
206 |
case MAY_NULL: |
181 |
if (flowInfo.isDefinitelyNull(local)) { |
207 |
if (flowInfo.isDefinitelyNull(local)) { |
Lines 218-226
Link Here
|
218 |
this.nullReferences[i] = null; |
244 |
this.nullReferences[i] = null; |
219 |
switch(this.nullCheckTypes[i] & CONTEXT_MASK) { |
245 |
switch(this.nullCheckTypes[i] & CONTEXT_MASK) { |
220 |
case FlowContext.IN_COMPARISON_NULL: |
246 |
case FlowContext.IN_COMPARISON_NULL: |
|
|
247 |
if (((this.nullCheckTypes[i] & CHECK_MASK) == CAN_ONLY_NULL) && (expression.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning |
248 |
scope.problemReporter().localVariableNullReference(local, expression); |
249 |
continue; |
250 |
} |
221 |
scope.problemReporter().localVariableRedundantCheckOnNull(local, expression); |
251 |
scope.problemReporter().localVariableRedundantCheckOnNull(local, expression); |
222 |
continue; |
252 |
continue; |
223 |
case FlowContext.IN_COMPARISON_NON_NULL: |
253 |
case FlowContext.IN_COMPARISON_NON_NULL: |
|
|
254 |
if (((this.nullCheckTypes[i] & CHECK_MASK) == CAN_ONLY_NULL) && (expression.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning |
255 |
scope.problemReporter().localVariableNullReference(local, expression); |
256 |
continue; |
257 |
} |
224 |
scope.problemReporter().localVariableNullComparedToNonNull(local, expression); |
258 |
scope.problemReporter().localVariableNullComparedToNonNull(local, expression); |
225 |
continue; |
259 |
continue; |
226 |
case FlowContext.IN_ASSIGNMENT: |
260 |
case FlowContext.IN_ASSIGNMENT: |
Lines 230-235
Link Here
|
230 |
scope.problemReporter().localVariableNullInstanceof(local, expression); |
264 |
scope.problemReporter().localVariableNullInstanceof(local, expression); |
231 |
continue; |
265 |
continue; |
232 |
} |
266 |
} |
|
|
267 |
} else if (flowInfo.isPotentiallyNull(local)) { |
268 |
switch(this.nullCheckTypes[i] & CONTEXT_MASK) { |
269 |
case FlowContext.IN_COMPARISON_NULL: |
270 |
this.nullReferences[i] = null; |
271 |
if (((this.nullCheckTypes[i] & CHECK_MASK) == CAN_ONLY_NULL) && (expression.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning |
272 |
scope.problemReporter().localVariablePotentialNullReference(local, expression); |
273 |
continue; |
274 |
} |
275 |
break; |
276 |
case FlowContext.IN_COMPARISON_NON_NULL: |
277 |
this.nullReferences[i] = null; |
278 |
if (((this.nullCheckTypes[i] & CHECK_MASK) == CAN_ONLY_NULL) && (expression.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning |
279 |
scope.problemReporter().localVariablePotentialNullReference(local, expression); |
280 |
continue; |
281 |
} |
282 |
break; |
283 |
} |
233 |
} |
284 |
} |
234 |
break; |
285 |
break; |
235 |
case MAY_NULL: |
286 |
case MAY_NULL: |
Lines 431-440
Link Here
|
431 |
if (flowInfo.isDefinitelyNull(local)) { |
482 |
if (flowInfo.isDefinitelyNull(local)) { |
432 |
switch(checkType & CONTEXT_MASK) { |
483 |
switch(checkType & CONTEXT_MASK) { |
433 |
case FlowContext.IN_COMPARISON_NULL: |
484 |
case FlowContext.IN_COMPARISON_NULL: |
|
|
485 |
if (((checkType & CHECK_MASK) == CAN_ONLY_NULL) && (reference.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning |
486 |
scope.problemReporter().localVariableNullReference(local, reference); |
487 |
return; |
488 |
} |
434 |
scope.problemReporter().localVariableRedundantCheckOnNull(local, reference); |
489 |
scope.problemReporter().localVariableRedundantCheckOnNull(local, reference); |
435 |
flowInfo.initsWhenFalse().setReachMode(FlowInfo.UNREACHABLE); |
490 |
flowInfo.initsWhenFalse().setReachMode(FlowInfo.UNREACHABLE); |
436 |
return; |
491 |
return; |
437 |
case FlowContext.IN_COMPARISON_NON_NULL: |
492 |
case FlowContext.IN_COMPARISON_NON_NULL: |
|
|
493 |
if (((checkType & CHECK_MASK) == CAN_ONLY_NULL) && (reference.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning |
494 |
scope.problemReporter().localVariableNullReference(local, reference); |
495 |
return; |
496 |
} |
438 |
scope.problemReporter().localVariableNullComparedToNonNull(local, reference); |
497 |
scope.problemReporter().localVariableNullComparedToNonNull(local, reference); |
439 |
flowInfo.initsWhenTrue().setReachMode(FlowInfo.UNREACHABLE); |
498 |
flowInfo.initsWhenTrue().setReachMode(FlowInfo.UNREACHABLE); |
440 |
return; |
499 |
return; |
Lines 445-450
Link Here
|
445 |
scope.problemReporter().localVariableNullInstanceof(local, reference); |
504 |
scope.problemReporter().localVariableNullInstanceof(local, reference); |
446 |
return; |
505 |
return; |
447 |
} |
506 |
} |
|
|
507 |
} else if (flowInfo.isPotentiallyNull(local)) { |
508 |
switch(checkType & CONTEXT_MASK) { |
509 |
case FlowContext.IN_COMPARISON_NULL: |
510 |
if (((checkType & CHECK_MASK) == CAN_ONLY_NULL) && (reference.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning |
511 |
scope.problemReporter().localVariablePotentialNullReference(local, reference); |
512 |
return; |
513 |
} |
514 |
break; |
515 |
case FlowContext.IN_COMPARISON_NON_NULL: |
516 |
if (((checkType & CHECK_MASK) == CAN_ONLY_NULL) && (reference.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning |
517 |
scope.problemReporter().localVariablePotentialNullReference(local, reference); |
518 |
return; |
519 |
} |
520 |
break; |
521 |
} |
448 |
} |
522 |
} |
449 |
recordNullReference(local, reference, checkType); |
523 |
recordNullReference(local, reference, checkType); |
450 |
return; |
524 |
return; |