|
Lines 5891-5909
Link Here
|
| 5891 |
break; |
5891 |
break; |
| 5892 |
|
5892 |
|
| 5893 |
case 327 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catches"); } //$NON-NLS-1$ |
5893 |
case 327 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catches"); } //$NON-NLS-1$ |
| 5894 |
consumeStatementTry(false); |
5894 |
consumeStatementTry(false, false); |
| 5895 |
break; |
5895 |
break; |
| 5896 |
|
5896 |
|
| 5897 |
case 328 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catchesopt Finally"); } //$NON-NLS-1$ |
5897 |
case 328 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catchesopt Finally"); } //$NON-NLS-1$ |
| 5898 |
consumeStatementTry(true); |
5898 |
consumeStatementTry(true, false); |
| 5899 |
break; |
5899 |
break; |
| 5900 |
|
5900 |
|
| 5901 |
case 329 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$ |
5901 |
case 329 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$ |
| 5902 |
consumeStatementTryWithResources(false); |
5902 |
consumeStatementTry(false, true); |
| 5903 |
break; |
5903 |
break; |
| 5904 |
|
5904 |
|
| 5905 |
case 330 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$ |
5905 |
case 330 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$ |
| 5906 |
consumeStatementTryWithResources(true); |
5906 |
consumeStatementTry(true, true); |
| 5907 |
break; |
5907 |
break; |
| 5908 |
|
5908 |
|
| 5909 |
case 331 : if (DEBUG) { System.out.println("ResourceSpecification ::= LPAREN Resources ;opt RPAREN"); } //$NON-NLS-1$ |
5909 |
case 331 : if (DEBUG) { System.out.println("ResourceSpecification ::= LPAREN Resources ;opt RPAREN"); } //$NON-NLS-1$ |
|
Lines 7382-7424
Link Here
|
| 7382 |
this.expressionLengthPtr--; |
7382 |
this.expressionLengthPtr--; |
| 7383 |
pushOnAstStack(new ThrowStatement(this.expressionStack[this.expressionPtr--], this.intStack[this.intPtr--], this.endStatementPosition)); |
7383 |
pushOnAstStack(new ThrowStatement(this.expressionStack[this.expressionPtr--], this.intStack[this.intPtr--], this.endStatementPosition)); |
| 7384 |
} |
7384 |
} |
| 7385 |
protected void consumeStatementTry(boolean withFinally) { |
7385 |
protected void consumeStatementTry(boolean withFinally, boolean hasResources) { |
| 7386 |
//TryStatement ::= 'try' Block Catches |
7386 |
// TryStatement ::= 'try' Block Catches |
| 7387 |
//TryStatement ::= 'try' Block Catchesopt Finally |
7387 |
// TryStatement ::= 'try' Block Catchesopt Finally |
| 7388 |
|
|
|
| 7389 |
int length; |
| 7390 |
TryStatement tryStmt = new TryStatement(); |
| 7391 |
//finally |
| 7392 |
if (withFinally) { |
| 7393 |
this.astLengthPtr--; |
| 7394 |
tryStmt.finallyBlock = (Block) this.astStack[this.astPtr--]; |
| 7395 |
} |
| 7396 |
//catches are handle by two <argument-block> [see statementCatch] |
| 7397 |
if ((length = this.astLengthStack[this.astLengthPtr--]) != 0) { |
| 7398 |
if (length == 1) { |
| 7399 |
tryStmt.catchBlocks = new Block[] {(Block) this.astStack[this.astPtr--]}; |
| 7400 |
tryStmt.catchArguments = new Argument[] {(Argument) this.astStack[this.astPtr--]}; |
| 7401 |
} else { |
| 7402 |
Block[] bks = (tryStmt.catchBlocks = new Block[length]); |
| 7403 |
Argument[] args = (tryStmt.catchArguments = new Argument[length]); |
| 7404 |
while (length-- > 0) { |
| 7405 |
bks[length] = (Block) this.astStack[this.astPtr--]; |
| 7406 |
args[length] = (Argument) this.astStack[this.astPtr--]; |
| 7407 |
} |
| 7408 |
} |
| 7409 |
} |
| 7410 |
//try |
| 7411 |
this.astLengthPtr--; |
| 7412 |
tryStmt.tryBlock = (Block) this.astStack[this.astPtr--]; |
| 7413 |
|
| 7414 |
//positions |
| 7415 |
tryStmt.sourceEnd = this.endStatementPosition; |
| 7416 |
tryStmt.sourceStart = this.intStack[this.intPtr--]; |
| 7417 |
pushOnAstStack(tryStmt); |
| 7418 |
} |
| 7419 |
protected void consumeStatementTryWithResources(boolean withFinally) { |
| 7420 |
// TryStatementWithResources ::= 'try' ResourceSpecification TryBlock Catchesopt |
7388 |
// TryStatementWithResources ::= 'try' ResourceSpecification TryBlock Catchesopt |
| 7421 |
// TryStatementWithResources ::= 'try' ResourceSpecification TryBlock Catchesopt Finally |
7389 |
// TryStatementWithResources ::= 'try' ResourceSpecification TryBlock Catchesopt Finally |
|
|
7390 |
|
| 7422 |
int length; |
7391 |
int length; |
| 7423 |
TryStatement tryStmt = new TryStatement(); |
7392 |
TryStatement tryStmt = new TryStatement(); |
| 7424 |
//finally |
7393 |
//finally |
|
Lines 7444-7462
Link Here
|
| 7444 |
this.astLengthPtr--; |
7413 |
this.astLengthPtr--; |
| 7445 |
tryStmt.tryBlock = (Block) this.astStack[this.astPtr--]; |
7414 |
tryStmt.tryBlock = (Block) this.astStack[this.astPtr--]; |
| 7446 |
|
7415 |
|
| 7447 |
// get the resources |
7416 |
if (hasResources) { |
| 7448 |
length = this.astLengthStack[this.astLengthPtr--]; |
7417 |
// get the resources |
| 7449 |
LocalDeclaration[] resources = new LocalDeclaration[length]; |
7418 |
length = this.astLengthStack[this.astLengthPtr--]; |
| 7450 |
System.arraycopy( |
7419 |
LocalDeclaration[] resources = new LocalDeclaration[length]; |
| 7451 |
this.astStack, |
7420 |
System.arraycopy( |
| 7452 |
(this.astPtr -= length) + 1, |
7421 |
this.astStack, |
| 7453 |
resources, |
7422 |
(this.astPtr -= length) + 1, |
| 7454 |
0, |
7423 |
resources, |
| 7455 |
length); |
7424 |
0, |
| 7456 |
if (this.options.sourceLevel < ClassFileConstants.JDK1_7) { |
7425 |
length); |
| 7457 |
problemReporter().autoManagedResourcesNotBelow17(resources); |
7426 |
if (this.options.sourceLevel < ClassFileConstants.JDK1_7) { |
| 7458 |
} else { |
7427 |
problemReporter().autoManagedResourcesNotBelow17(resources); |
| 7459 |
tryStmt.resources = resources; |
7428 |
} else { |
|
|
7429 |
tryStmt.resources = resources; |
| 7430 |
} |
| 7460 |
} |
7431 |
} |
| 7461 |
//positions |
7432 |
//positions |
| 7462 |
tryStmt.sourceEnd = this.endStatementPosition; |
7433 |
tryStmt.sourceEnd = this.endStatementPosition; |