Bug 23162 - DOM: clients should be able to control if bindings are available even if AST is modified
Summary: DOM: clients should be able to control if bindings are available even if AST ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-04 12:26 EDT by Dirk Baeumer CLA
Modified: 2002-10-17 10:13 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Baeumer CLA 2002-09-04 12:26:12 EDT
2.x

Now that we have AST rewriting we more and more start to modify existing ASTs. 
After the first modification all bindings associated with nodes are null. Since 
we want to walk the tree and modifiy it in parallel clients should be able to 
create an AST that keeps bindings even if the AST gets modified. New nodes 
simply don't return bindings.
Comment 1 Olivier Thomann CLA 2002-09-06 14:44:00 EDT
Jim - any comment?

We added this considering that bindings are irrelevant as soon as the tree is
modified.
Comment 2 Jim des Rivieres CLA 2002-09-06 16:20:18 EDT
The original thinking was that we might want to compute IBindings lazily, and 
once the client starts editing the AST they would be no obvious way to do this.
As it turned out, we compute all IBindings eagerly, so this is no longer an
issue.

Keeping some binding info once modification begins should be possible (but 
keeping all binding info is likely too costly). The challenge is coming up 
with a story that is easy for clients to work with, and can be implemented 
without too much additional cost. It would be helpful to have usecases of 
where client would reasonably expect bindings to be preserved.  Example:
how important is it to be able to add/delete a statement in a block without
disrupting its siblings?
Comment 3 Dirk Baeumer CLA 2002-09-12 05:31:12 EDT
Why is keeping all binding infos to costly given the fact that we compute them 
eagerly anyway ?

One example is that we want to exchange one type with another type in a CU. In 
this call Type bindings should be kept.
Comment 4 Philipe Mulet CLA 2002-09-18 08:51:50 EDT
I'd vote to leave the bindings in, with a disclaimer indicating that a change 
is a non-returning point from where bindings may be stale.
Comment 5 Jim des Rivieres CLA 2002-09-19 18:04:56 EDT
Changed spec (for AST.parseCompilationUnit) to say that all bindings are 
computed at the time the AST is created. If you modify the AST, you get 
exactly the same bindings as you would have gotten had you not modified the 
AST. 
Comment 6 Olivier Thomann CLA 2002-09-20 10:11:49 EDT
First version released in 2.1 stream.
Regression test added (test0409).
Comment 7 David Audel CLA 2002-10-17 10:13:51 EDT
Verified.