Lines 23-32
Link Here
|
23 |
public final static int UNREACHABLE = 1; |
23 |
public final static int UNREACHABLE = 1; |
24 |
public final static int NULL_FLAG_MASK = 2; |
24 |
public final static int NULL_FLAG_MASK = 2; |
25 |
|
25 |
|
26 |
public final static int UNKNOWN = 0; |
26 |
public final static int UNKNOWN = 1; |
27 |
public final static int NULL = 1; |
27 |
public final static int NULL = 2; |
28 |
public final static int NON_NULL = -1; |
28 |
public final static int NON_NULL = 4; |
29 |
public final static int POTENTIALLY_NULL = 2; |
29 |
public final static int POTENTIALLY_UNKNOWN = 8; |
|
|
30 |
public final static int POTENTIALLY_NULL = 16; |
31 |
public final static int POTENTIALLY_NON_NULL = 32; |
30 |
|
32 |
|
31 |
public static final UnconditionalFlowInfo DEAD_END; // Represents a dead branch status of initialization |
33 |
public static final UnconditionalFlowInfo DEAD_END; // Represents a dead branch status of initialization |
32 |
static { |
34 |
static { |
Lines 255-260
Link Here
|
255 |
abstract public void markAsPotentiallyNull(LocalVariableBinding local); |
257 |
abstract public void markAsPotentiallyNull(LocalVariableBinding local); |
256 |
|
258 |
|
257 |
/** |
259 |
/** |
|
|
260 |
* Record a local may have got assigned to non-null. |
261 |
*/ |
262 |
abstract public void markAsPotentiallyNonNull(LocalVariableBinding local); |
263 |
|
264 |
/** |
265 |
* Record a local may have got assigned to null or to non-null. |
266 |
*/ |
267 |
abstract public void markAsPotentiallyNullOrNonNull(LocalVariableBinding local); |
268 |
|
269 |
/** |
270 |
* Add the marker bit for potentially unknown. |
271 |
* Assumes that at most pot.null and pot.non-null have been set for 'local'. |
272 |
*/ |
273 |
abstract public void addPotentiallyUnknownMark(LocalVariableBinding local); |
274 |
|
275 |
/** |
258 |
* Record a local got definitely assigned. |
276 |
* Record a local got definitely assigned. |
259 |
*/ |
277 |
*/ |
260 |
abstract public void markAsDefinitelyAssigned(LocalVariableBinding local); |
278 |
abstract public void markAsDefinitelyAssigned(LocalVariableBinding local); |
Lines 265-270
Link Here
|
265 |
abstract public void markAsDefinitelyUnknown(LocalVariableBinding local); |
283 |
abstract public void markAsDefinitelyUnknown(LocalVariableBinding local); |
266 |
|
284 |
|
267 |
/** |
285 |
/** |
|
|
286 |
* Mark the null status of the given local according to the given status |
287 |
* @param local |
288 |
* @param nullStatus bitset of FLowInfo.UNKNOWN ... FlowInfo.POTENTIALLY_NON_NULL |
289 |
*/ |
290 |
public void markNullStatus(LocalVariableBinding local, int nullStatus) { |
291 |
switch(nullStatus) { |
292 |
case NULL : |
293 |
markAsDefinitelyNull(local); |
294 |
break; |
295 |
case NON_NULL : |
296 |
markAsDefinitelyNonNull(local); |
297 |
break; |
298 |
default: |
299 |
switch (nullStatus & (POTENTIALLY_NULL|POTENTIALLY_NON_NULL)) { |
300 |
case POTENTIALLY_NULL: |
301 |
markAsPotentiallyNull(local); |
302 |
break; |
303 |
case POTENTIALLY_NON_NULL: |
304 |
markAsPotentiallyNonNull(local); |
305 |
break; |
306 |
case POTENTIALLY_NULL|POTENTIALLY_NON_NULL: |
307 |
markAsPotentiallyNullOrNonNull(local); |
308 |
break; |
309 |
default: |
310 |
markAsDefinitelyUnknown(local); |
311 |
return; |
312 |
} |
313 |
if ((nullStatus & POTENTIALLY_UNKNOWN) != 0) |
314 |
// add this point only null and non-null bits can be set |
315 |
addPotentiallyUnknownMark(local); |
316 |
} |
317 |
} |
318 |
|
319 |
/** |
320 |
* Answer the null status of the given local |
321 |
* @param local |
322 |
* @return bitset of FLowInfo.UNKNOWN ... FlowInfo.POTENTIALLY_NON_NULL |
323 |
*/ |
324 |
public int nullStatus(LocalVariableBinding local) { |
325 |
if (isDefinitelyNull(local)) |
326 |
return NULL; |
327 |
if (isDefinitelyNonNull(local)) |
328 |
return NON_NULL; |
329 |
int status = 0; |
330 |
if (isPotentiallyNull(local)) |
331 |
status |= POTENTIALLY_NULL; |
332 |
if (isPotentiallyNonNull(local)) |
333 |
status |= POTENTIALLY_NON_NULL; |
334 |
if (isPotentiallyUnknown(local)) |
335 |
status |= POTENTIALLY_UNKNOWN; |
336 |
if (status > 0) |
337 |
return status; |
338 |
return UNKNOWN; |
339 |
} |
340 |
|
341 |
/** |
268 |
* Merge branches using optimized boolean conditions |
342 |
* Merge branches using optimized boolean conditions |
269 |
*/ |
343 |
*/ |
270 |
public static UnconditionalFlowInfo mergedOptimizedBranches( |
344 |
public static UnconditionalFlowInfo mergedOptimizedBranches( |
Lines 482-485
Link Here
|
482 |
*/ |
556 |
*/ |
483 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=303448 |
557 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=303448 |
484 |
abstract public boolean isMarkedAsNullOrNonNullInAssertExpression(LocalVariableBinding local); |
558 |
abstract public boolean isMarkedAsNullOrNonNullInAssertExpression(LocalVariableBinding local); |
|
|
559 |
|
485 |
} |
560 |
} |