Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 190751 Details for
Bug 338402
[1.7][compiler][enh] Open issues in try with resources implementation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch - Part 6
patch.txt (text/plain), 7.33 KB, created by
Srikanth Sankaran
on 2011-03-09 08:28:34 EST
(
hide
)
Description:
Patch - Part 6
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2011-03-09 08:28:34 EST
Size:
7.33 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java,v >retrieving revision 1.422.2.12 >diff -u -r1.422.2.12 Parser.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 1 Mar 2011 13:27:51 -0000 1.422.2.12 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 9 Mar 2011 13:24:13 -0000 >@@ -5891,19 +5891,19 @@ > break; > > case 327 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catches"); } //$NON-NLS-1$ >- consumeStatementTry(false); >+ consumeStatementTry(false, false); > break; > > case 328 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catchesopt Finally"); } //$NON-NLS-1$ >- consumeStatementTry(true); >+ consumeStatementTry(true, false); > break; > > case 329 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$ >- consumeStatementTryWithResources(false); >+ consumeStatementTry(false, true); > break; > > case 330 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$ >- consumeStatementTryWithResources(true); >+ consumeStatementTry(true, true); > break; > > case 331 : if (DEBUG) { System.out.println("ResourceSpecification ::= LPAREN Resources ;opt RPAREN"); } //$NON-NLS-1$ >@@ -7382,43 +7382,12 @@ > this.expressionLengthPtr--; > pushOnAstStack(new ThrowStatement(this.expressionStack[this.expressionPtr--], this.intStack[this.intPtr--], this.endStatementPosition)); > } >-protected void consumeStatementTry(boolean withFinally) { >- //TryStatement ::= 'try' Block Catches >- //TryStatement ::= 'try' Block Catchesopt Finally >- >- int length; >- TryStatement tryStmt = new TryStatement(); >- //finally >- if (withFinally) { >- this.astLengthPtr--; >- tryStmt.finallyBlock = (Block) this.astStack[this.astPtr--]; >- } >- //catches are handle by two <argument-block> [see statementCatch] >- if ((length = this.astLengthStack[this.astLengthPtr--]) != 0) { >- if (length == 1) { >- tryStmt.catchBlocks = new Block[] {(Block) this.astStack[this.astPtr--]}; >- tryStmt.catchArguments = new Argument[] {(Argument) this.astStack[this.astPtr--]}; >- } else { >- Block[] bks = (tryStmt.catchBlocks = new Block[length]); >- Argument[] args = (tryStmt.catchArguments = new Argument[length]); >- while (length-- > 0) { >- bks[length] = (Block) this.astStack[this.astPtr--]; >- args[length] = (Argument) this.astStack[this.astPtr--]; >- } >- } >- } >- //try >- this.astLengthPtr--; >- tryStmt.tryBlock = (Block) this.astStack[this.astPtr--]; >- >- //positions >- tryStmt.sourceEnd = this.endStatementPosition; >- tryStmt.sourceStart = this.intStack[this.intPtr--]; >- pushOnAstStack(tryStmt); >-} >-protected void consumeStatementTryWithResources(boolean withFinally) { >+protected void consumeStatementTry(boolean withFinally, boolean hasResources) { >+ // TryStatement ::= 'try' Block Catches >+ // TryStatement ::= 'try' Block Catchesopt Finally > // TryStatementWithResources ::= 'try' ResourceSpecification TryBlock Catchesopt > // TryStatementWithResources ::= 'try' ResourceSpecification TryBlock Catchesopt Finally >+ > int length; > TryStatement tryStmt = new TryStatement(); > //finally >@@ -7444,19 +7413,21 @@ > this.astLengthPtr--; > tryStmt.tryBlock = (Block) this.astStack[this.astPtr--]; > >- // get the resources >- length = this.astLengthStack[this.astLengthPtr--]; >- LocalDeclaration[] resources = new LocalDeclaration[length]; >- System.arraycopy( >- this.astStack, >- (this.astPtr -= length) + 1, >- resources, >- 0, >- length); >- if (this.options.sourceLevel < ClassFileConstants.JDK1_7) { >- problemReporter().autoManagedResourcesNotBelow17(resources); >- } else { >- tryStmt.resources = resources; >+ if (hasResources) { >+ // get the resources >+ length = this.astLengthStack[this.astLengthPtr--]; >+ LocalDeclaration[] resources = new LocalDeclaration[length]; >+ System.arraycopy( >+ this.astStack, >+ (this.astPtr -= length) + 1, >+ resources, >+ 0, >+ length); >+ if (this.options.sourceLevel < ClassFileConstants.JDK1_7) { >+ problemReporter().autoManagedResourcesNotBelow17(resources); >+ } else { >+ tryStmt.resources = resources; >+ } > } > //positions > tryStmt.sourceEnd = this.endStatementPosition; >Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java,v >retrieving revision 1.72 >diff -u -r1.72 CodeSnippetParser.java >--- eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java 29 Jan 2010 15:51:49 -0000 1.72 >+++ eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java 9 Mar 2011 13:24:14 -0000 >@@ -1,9 +1,13 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. > * > * Contributors: > * IBM Corporation - initial API and implementation >@@ -535,8 +539,8 @@ > /* recovery */ > recordLastStatementIfNeeded(); > } >-protected void consumeStatementTry(boolean arg_0) { >- super.consumeStatementTry(arg_0); >+protected void consumeStatementTry(boolean arg_0, boolean arg_1) { >+ super.consumeStatementTry(arg_0, arg_1); > /* recovery */ > recordLastStatementIfNeeded(); > } >Index: grammar/java.g >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/grammar/java.g,v >retrieving revision 1.11.2.7 >diff -u -r1.11.2.7 java.g >--- grammar/java.g 18 Feb 2011 09:54:05 -0000 1.11.2.7 >+++ grammar/java.g 9 Mar 2011 13:24:17 -0000 >@@ -1107,15 +1107,15 @@ > /:$readableName OnlySynchronized:/ > > TryStatement ::= 'try' TryBlock Catches >-/.$putCase consumeStatementTry(false); $break ./ >+/.$putCase consumeStatementTry(false, false); $break ./ > TryStatement ::= 'try' TryBlock Catchesopt Finally >-/.$putCase consumeStatementTry(true); $break ./ >+/.$putCase consumeStatementTry(true, false); $break ./ > /:$readableName TryStatement:/ > > TryStatementWithResources ::= 'try' ResourceSpecification TryBlock Catchesopt >-/.$putCase consumeStatementTryWithResources(false); $break ./ >+/.$putCase consumeStatementTry(false, true); $break ./ > TryStatementWithResources ::= 'try' ResourceSpecification TryBlock Catchesopt Finally >-/.$putCase consumeStatementTryWithResources(true); $break ./ >+/.$putCase consumeStatementTry(true, true); $break ./ > /:$readableName TryStatementWithResources:/ > /:$compliance 1.7:/ >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 338402
:
190016
|
190034
|
190131
|
190659
|
190744
| 190751