Bug 125515 - API: Provide ASTs for compilation participants
Summary: API: Provide ASTs for compilation participants
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-27 12:46 EST by Martin Aeschlimann CLA
Modified: 2009-08-30 02:37 EDT (History)
4 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-01-27 12:46:20 EST
20060127

A compilation participant should be able to introspect the Java code using DOM/AST API, so it can perform semantic analysis and issue some markers.

This AST is currenty provided for reconcile. But not yet for compile.

It is to be expected that every participant implementing e.g. a code style checker will need an AST. Needless to say that if each participant would create one by itself, this would result in very bad compilation performance.

Bug 122316 comment 4 expressed the hope that everybody can go through APT. This is unlikely as APT has a 1.5 requirement and currently doesn't mirror anything below declaration nodes.
Comment 1 Philipe Mulet CLA 2006-02-03 04:13:59 EST
Kent - pls have a look at this. In theory, a compiler participant should be allowed to reach a DOM AST, independantly from APT. 
Comment 2 Kent Johnson CLA 2006-02-03 10:26:26 EST
The builder is only notified about compilation units before or after the compile loop (depending on annotation support). The builder does not have access to an AST for the CU and would have to create it even tho we don't know if any of the participants actually want it.

So what proof do we have that numerous participants are going to be attached that want an AST for the same CU?

As of now - none.

If we get to the point that there are 4-5 attached participants that want to examine EVERY single compilation unit about to be compiled - then creating ASTs will not be the only performance problem.

Philippe - this is why we should have never released the participant support for anything but annotations...
Comment 3 Philipe Mulet CLA 2006-02-10 10:42:16 EST
I know we don't have the compiler AST handy in those stages, but still we could provide a mechanism for participants to reuse the same AST if they ask for some.
Comment 4 Philipe Mulet CLA 2006-02-10 10:43:18 EST
Creation should be lazy; i.e. until a participant asks for AST, none is created.
Like we do when reconciling.

Comment 5 Philipe Mulet CLA 2006-02-10 11:07:11 EST
Reassigning to Jerome who did the reconcile side.
Comment 6 Jerome Lanneluc CLA 2006-02-10 12:26:23 EST
The problem is that for each participant we notify all compilation units. So if a participant was to request an AST for each compilation units, we would keep all these AST in memory until we finished to notify participants. This would not scale.
Comment 7 Markus Keller CLA 2006-02-10 12:54:45 EST
So you would have to add a per-CU notification of compilation participant results and tell compilation participants that they are not allowed to retain links to the AST after the callback returns.
Comment 8 Kent Johnson CLA 2006-02-14 08:45:57 EST
I have a better idea - REMOVE the support for compilation participants to get units before the compile loop!

We know performance will be pathetic and its a waste of time trying to improve it.
Comment 9 Jerome Lanneluc CLA 2006-03-31 06:24:02 EST
Post 3.2
Comment 10 Eclipse Webmaster CLA 2009-08-30 02:37:33 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.