Bug 129998 - Remove ReconcileContext#getASTLevel() and rename getAST3() to getAST()
Summary: Remove ReconcileContext#getASTLevel() and rename getAST3() to getAST()
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-01 12:43 EST by Martin Aeschlimann CLA
Modified: 2007-06-22 10:05 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2006-03-01 12:43:20 EST
20060301

The API of ReconcileContext contains:

- getASTLevel
and
- getAST3

As getAST3 says, the only ast you get is always of level 3. So why is there a method 'getASTLevel' then?

And why are we forcing ourselves to only return AST level 3? What if we do an AST level 4 one time?

A much better API would have been to have a getAST() and spec'ing that the level will be the 'latest'level and all participants have to first check if they can deal with this level, or not participate otherwise.
That way a API 'getASTLevel' makes sense again so that clients can first ask what the 'latest' level is without potentially creating any AST.
Comment 1 Jerome Lanneluc CLA 2006-03-01 12:55:26 EST
Questions about the design of JDT Core should be asked on jdt-core-dev@eclipse.org . If the resulting discussion leads to a problem, only then a bug should be entered. In the case of this bug report, it is unclear if this is a design problem or a question about the API.
Comment 2 Martin Aeschlimann CLA 2006-03-01 13:17:10 EST
I am pointing to a design problem, yes! And I'm suggesting a better API, anticipate new AST levels in the future.

I think a bug is a good place to discuss such an API. 

The you can decide if you want to fix this, or not. This isn't as easy on a mailing list.
Comment 3 Jerome Lanneluc CLA 2006-03-01 13:22:36 EST
Sorry but the summary "ReconcileContext API: why both getASTLevel and getAST3?" suggested otherwise. Reopening and changing it to "Remove ReconcileContext#getASTLevel() and rename getAST3() to getAST()". Feel free to change it if it doesn't reflect your request.
Comment 4 Martin Aeschlimann CLA 2006-03-02 03:21:48 EST
That's better, you're right.
Comment 5 Olivier Thomann CLA 2006-10-10 16:49:01 EDT
Martin, is this still accurate?
Do we want to change this post 3.2?
Comment 6 Martin Aeschlimann CLA 2006-10-11 04:28:02 EDT
I would still suggest to add a method getAST and spec that it returns the 'latest' level and all participants have to first check if they can deal with this level, or not participate otherwise.

But this is lower priority, as long as the reconcile participation story isn't really ready to used by clients.
Comment 7 Martin Aeschlimann CLA 2006-10-11 05:22:02 EDT
After thinking again I think the way to go is with bug 124662, where the working copy owner can specify what kind of AST are to be created on reconcile. The ReconcileContext.getAST just specifies that the AST returned is created using the options (AST kind/recovered/bindings) in the working copy owner, and if a client doesn't want/doesn't understand this kind, he should not participate.