Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 499336 - [9] Switch ASTs to JLS9
Summary: [9] Switch ASTs to JLS9
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: BETA J9   Edit
Assignee: Noopur Gupta CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 509579
  Show dependency tree
 
Reported: 2016-08-07 23:15 EDT by Manoj N Palat CLA
Modified: 2017-07-04 11:31 EDT (History)
4 users (show)

See Also:


Attachments
jdt.ui patch to start with - used for testing jdt.core (1.17 KB, application/octet-stream)
2016-08-07 23:15 EDT, Manoj N Palat CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Manoj N Palat CLA 2016-08-07 23:15:25 EDT
Created attachment 263499 [details]
jdt.ui patch to start with - used for testing jdt.core

Try Statement now supports variable references (effectively final vars) in addition to LocalVariableDeclaration - see bug 497719 for details

Attached is the jdt.ui patch used for testing jdt.core (if it helps)
Comment 1 Noopur Gupta CLA 2016-08-12 02:16:53 EDT
Manoj, please provide more details on what jdt.ui support is expected here to support final / effectively final variables in try-with-resources.
Comment 2 Manoj N Palat CLA 2016-08-16 04:22:49 EDT
(In reply to Noopur Gupta from comment #1)
> Manoj, please provide more details on what jdt.ui support is expected here
> to support final / effectively final variables in try-with-resources.

Please see the attachment for the change - the level change is required (this is a generic change when you move to 9 - not specific to twr).
Comment 3 Noopur Gupta CLA 2016-08-16 04:55:50 EDT
(In reply to Manoj Palat from comment #2)
> (In reply to Noopur Gupta from comment #1)
> > Manoj, please provide more details on what jdt.ui support is expected here
> > to support final / effectively final variables in try-with-resources.
> 
> Please see the attachment for the change - the level change is required
> (this is a generic change when you move to 9 - not specific to twr).

The attachment updates the following:
- ASTProvider#SHARED_AST_LEVEL to AST.JLS9
- ASTView#JLS_LATEST to AST.JLS9

We will move to AST.JLS9 after adapting the jdt.ui code to relevant changes in the new AST level.

This should not block support for final / effectively final variables in try-with-resources. 

Updating the bug summary to reflect the same.
Comment 4 Noopur Gupta CLA 2016-12-21 05:42:02 EST
See bug 496123 comment #8 also.
Comment 5 Noopur Gupta CLA 2016-12-21 14:41:16 EST
The following commit updated ASTView#JLS_LATEST to AST.JLS9:

http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?h=BETA_JAVA9&id=54e95829ba25f3e8f8db347f33f9b866f03debae

Markus, are you planning to provide the fix for moving ASTProvider#SHARED_AST_LEVEL to AST.JLS9 also?
Comment 6 Markus Keller CLA 2016-12-21 16:17:38 EST
Sorry, I won't get to this in 2016.

Noopur, feel free to work on this, but remember that throwing the switch makes you responsible for fixing all client code and tests that will be affected by the change. Client code is currently a bit hard to find, because a search for references to ASTNode#unsupportedBelow9() doesn't find all new APIs (bug 496123 comment 10).

We usually only commit the switch once the AST is near-final form, since every further change in the AST will immediately break JDT UI.
Comment 7 Noopur Gupta CLA 2016-12-23 06:29:10 EST
I'll wait for the near-final form of AST before starting any work on this.
Comment 8 Markus Keller CLA 2017-06-22 08:37:45 EDT
Pushed a first change in preparation for this bug: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=117f612d080d828a1c80929ac797661b0556b99a

See https://wiki.eclipse.org/JDT_UI/Java8#Things_to_remember.2Fcaveats ff. for a list of things we did for Java 8.
Comment 9 Eclipse Genie CLA 2017-06-27 14:16:35 EDT
New Gerrit change created: https://git.eclipse.org/r/100173
Comment 11 Noopur Gupta CLA 2017-07-03 10:03:33 EDT
Updated references to resources in TryStatement and released:

http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?h=BETA_JAVA9&id=b80c9b62a1467f54883084da2325f6b52db0943c
Comment 12 Markus Keller CLA 2017-07-03 13:23:54 EDT
(In reply to Noopur Gupta from comment #11)
> Updated references to resources in TryStatement and released:

Note that many of those changes break functionality as long as IASTSharedValues#SHARED_AST_LEVEL is still at JLS8.

The changes I pushed before were all safe for JLS8 and JLS9 ASTs. If you think we're ready to throw the global switch to JLS9, then please throw it.