Lines 12-20
Link Here
|
12 |
package org.eclipse.jdt.internal.compiler.flow; |
12 |
package org.eclipse.jdt.internal.compiler.flow; |
13 |
|
13 |
|
14 |
import java.util.ArrayList; |
14 |
import java.util.ArrayList; |
|
|
15 |
|
15 |
import org.eclipse.jdt.core.compiler.CharOperation; |
16 |
import org.eclipse.jdt.core.compiler.CharOperation; |
16 |
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; |
|
|
17 |
import org.eclipse.jdt.internal.compiler.ast.ASTNode; |
17 |
import org.eclipse.jdt.internal.compiler.ast.ASTNode; |
|
|
18 |
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; |
18 |
import org.eclipse.jdt.internal.compiler.ast.Expression; |
19 |
import org.eclipse.jdt.internal.compiler.ast.Expression; |
19 |
import org.eclipse.jdt.internal.compiler.ast.LabeledStatement; |
20 |
import org.eclipse.jdt.internal.compiler.ast.LabeledStatement; |
20 |
import org.eclipse.jdt.internal.compiler.ast.Reference; |
21 |
import org.eclipse.jdt.internal.compiler.ast.Reference; |
Lines 207-213
Link Here
|
207 |
} |
208 |
} |
208 |
} |
209 |
} |
209 |
} |
210 |
} |
210 |
traversedContext = traversedContext.parent; |
211 |
traversedContext = traversedContext.getLocalParent(); |
211 |
} |
212 |
} |
212 |
// if reaches this point, then there are some remaining unhandled exception types. |
213 |
// if reaches this point, then there are some remaining unhandled exception types. |
213 |
if (isExceptionOnAutoClose) { |
214 |
if (isExceptionOnAutoClose) { |
Lines 353-359
Link Here
|
353 |
flowInfo.addInitializationsFrom(tryStatement.subRoutineInits); // collect inits |
354 |
flowInfo.addInitializationsFrom(tryStatement.subRoutineInits); // collect inits |
354 |
} |
355 |
} |
355 |
} |
356 |
} |
356 |
traversedContext = traversedContext.parent; |
357 |
traversedContext = traversedContext.getLocalParent(); |
357 |
} |
358 |
} |
358 |
// if reaches this point, then there are some remaining unhandled exception types. |
359 |
// if reaches this point, then there are some remaining unhandled exception types. |
359 |
nextReport: for (int i = 0; i < raisedCount; i++) { |
360 |
nextReport: for (int i = 0; i < raisedCount; i++) { |
Lines 385-393
Link Here
|
385 |
current = initializationContext.initializationParent; |
386 |
current = initializationContext.initializationParent; |
386 |
} else if (current instanceof ExceptionHandlingFlowContext) { |
387 |
} else if (current instanceof ExceptionHandlingFlowContext) { |
387 |
ExceptionHandlingFlowContext exceptionContext = (ExceptionHandlingFlowContext) current; |
388 |
ExceptionHandlingFlowContext exceptionContext = (ExceptionHandlingFlowContext) current; |
388 |
current = exceptionContext.initializationParent == null ? exceptionContext.parent : exceptionContext.initializationParent; |
389 |
current = exceptionContext.initializationParent == null ? exceptionContext.getLocalParent() : exceptionContext.initializationParent; |
389 |
} else { |
390 |
} else { |
390 |
current = current.parent; |
391 |
current = current.getLocalParent(); |
391 |
} |
392 |
} |
392 |
} while (current != null); |
393 |
} while (current != null); |
393 |
// not found |
394 |
// not found |
Lines 411-417
Link Here
|
411 |
return current; |
412 |
return current; |
412 |
return lastNonReturningSubRoutine; |
413 |
return lastNonReturningSubRoutine; |
413 |
} |
414 |
} |
414 |
current = current.parent; |
415 |
current = current.getLocalParent(); |
415 |
} |
416 |
} |
416 |
// not found |
417 |
// not found |
417 |
return null; |
418 |
return null; |
Lines 448-454
Link Here
|
448 |
// label is found, but not a continuable location |
449 |
// label is found, but not a continuable location |
449 |
return FlowContext.NotContinuableContext; |
450 |
return FlowContext.NotContinuableContext; |
450 |
} |
451 |
} |
451 |
current = current.parent; |
452 |
current = current.getLocalParent(); |
452 |
} |
453 |
} |
453 |
// not found |
454 |
// not found |
454 |
return null; |
455 |
return null; |
Lines 467-473
Link Here
|
467 |
if (lastNonReturningSubRoutine == null) return current; |
468 |
if (lastNonReturningSubRoutine == null) return current; |
468 |
return lastNonReturningSubRoutine; |
469 |
return lastNonReturningSubRoutine; |
469 |
} |
470 |
} |
470 |
current = current.parent; |
471 |
current = current.getLocalParent(); |
471 |
} |
472 |
} |
472 |
// not found |
473 |
// not found |
473 |
return null; |
474 |
return null; |
Lines 487-496
Link Here
|
487 |
return current; |
488 |
return current; |
488 |
return lastNonReturningSubRoutine; |
489 |
return lastNonReturningSubRoutine; |
489 |
} |
490 |
} |
490 |
current = current.parent; |
491 |
current = current.getLocalParent(); |
491 |
} |
492 |
} |
492 |
// not found |
493 |
// not found |
493 |
return null; |
494 |
return null; |
|
|
495 |
} |
496 |
|
497 |
/** |
498 |
* Answer the parent flow context but be careful not to cross the boundary of a nested type, |
499 |
* or null if no such parent exists. |
500 |
*/ |
501 |
public FlowContext getLocalParent() { |
502 |
if (this.associatedNode instanceof AbstractMethodDeclaration || this.associatedNode instanceof TypeDeclaration) |
503 |
return null; |
504 |
return this.parent; |
494 |
} |
505 |
} |
495 |
|
506 |
|
496 |
public String individualToString() { |
507 |
public String individualToString() { |
Lines 570-576
Link Here
|
570 |
if (!context.recordFinalAssignment(variable, finalReference)) { |
581 |
if (!context.recordFinalAssignment(variable, finalReference)) { |
571 |
break; // no need to keep going |
582 |
break; // no need to keep going |
572 |
} |
583 |
} |
573 |
context = context.parent; |
584 |
context = context.getLocalParent(); |
574 |
} |
585 |
} |
575 |
} |
586 |
} |
576 |
} |
587 |
} |