Bug 269562 - [plan] Compiler/LookupEnvironment reset too frequently
Summary: [plan] Compiler/LookupEnvironment reset too frequently
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows NT
: P2 critical (vote)
Target Milestone: 1.6.6   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 269605
  Show dependency tree
 
Reported: 2009-03-20 14:40 EDT by Andrew Clement CLA
Modified: 2009-07-23 15:48 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Clement CLA 2009-03-20 14:40:40 EDT
Unconvered by bug 269555.  If a package is split across source folders and a duplicate type is defined in one of the source folders then a full build will recognize the problem but an incremental build wont.  This appears to be due to tidying up the lookupenvironment (which maintains package bindings) after every compile - when it is recreated for the incremental build it does not hold a reference to any existing (clashing) type and so no error gets reported.  Modifying this is likely to need changes to the CompilerAdapter aspects in shadows (urgh).
Comment 1 Andrew Clement CLA 2009-07-23 12:14:18 EDT
this is as tricky as I imagined it would be.

it appears the entire lifecycle of the compiler isn't managed correctly by AspectJ really - we constantly create new ones when we should be reusing one over and over.  This hurts performance (as we continually discover information we previously knew) and causes problems like the one here where package bindings are forgotten due to a new LookupEnvironment (actually AjLookupEnvironment) being constructed for each build.
Comment 2 Andrew Clement CLA 2009-07-23 15:48:01 EDT
Fixed!!!

The problem is actually our StatefulNameEnvironment - a subtype of NameEnvironment that knows about stuff in the State instance maintained for a project.  Some changes earlier this year to avoid rebuilding the StatefulNameEnvironment unless necessary failed to take into account that it still needed prodding about what the state object knew from the previous build.  The fix here is to prod it even if we don't rebuild it.  In this way on the incremental build we know about f.AClass and the method StatefulNameEnvironment.isPackage() can find it.  This could well be the source of endless wierdness in Roo incremental builds.

I don't know if this fix will address bugs dependent on this one as this one turned out to be something I didn't expect.

This fix *may* affect incremental build times, hmmm.  It isn't a delta update to the nameenvironment, it is a complete update from the state object.

Ok, changed the fix - it is now delta processing so incremental builds won't be affected (I assert).