Bug 269555 - AspectJ compiler recreates more class files than necessary
Summary: AspectJ compiler recreates more class files than necessary
Status: RESOLVED WORKSFORME
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 1.6.4   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 268827
  Show dependency tree
 
Reported: 2009-03-20 13:33 EDT by Andrew Eisenberg CLA
Modified: 2009-03-20 19:53 EDT (History)
1 user (show)

See Also:


Attachments
Project that exhibits this behavior (9.50 KB, application/octet-stream)
2009-03-20 13:37 EDT, Andrew Eisenberg CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Eisenberg CLA 2009-03-20 13:33:42 EDT
After a file has been created or deleted, ajc seems to call the method CoreOutputLocationManager.reportClassFileWrite too many times (once for each class file).

The AJDT Event Trace shows that only a single source file was affected and that the build was incremental.

Getting this right is important for AJDT because AJDT is using the reportClassFileWrite method to keep track of what has changed.  This gets passed to dependent projects (specificall Java Projects, not AJ projects) and they perform a rebuild based on this delta.

Attaching a project.
Comment 1 Andrew Eisenberg CLA 2009-03-20 13:37:19 EDT
Created attachment 129482 [details]
Project that exhibits this behavior

Create a new class in the default directory, say  Nothing4.  The incremental build that occurs after creation will call "reportClassFileWrite" for each class file.  Shouldn't it only be for the single class file that has been created (ie- Nothing4.class)?
Comment 2 Andrew Clement CLA 2009-03-20 13:45:49 EDT
marked 1.6.4 but unlikely to make it unless everything else goes well.

Surprised to see it blocking 268827 as I plan to close that bug when we have the mainline path working (edit/save of existing files gives fast builds)...
Comment 3 Andrew Clement CLA 2009-03-20 14:07:32 EDT
i imported that project but it is broken - is that intentional?  The type Nothing4 is defined twice... once in the src2 default package and once in the src default package?

So I deleted it from the src package.  On recreating it in the src default package I don't get an error (which I should) - this is a bug, but not the one raised.

However, I can add new files that don't clash with existing and I don't see reportClassFileWrite() called more than once for what I just added.  If the type I add defines two classes, then I just see reportClassFileWrite() for the two new classes.

If the project is in an incorrect state (which would be revealed by a fullbuild) then I do see reportClassFileWrite called more than once on an incremental build, but it is not called for all types in the project, just the one I've just defined and the one added during the previous build.
Comment 4 Andrew Clement CLA 2009-03-20 14:38:41 EDT
the bug in here that i am able to recreate - to do with split packages (across source folders) and defining the same type twice appears to be related to clearing up the compiler/lookupenvironment too frequently (after every build).  If it were reused rather than recreated the build performance will increase and these duplicate type problems will appear.  I'll raise this as a separate bug.
Comment 5 Andrew Clement CLA 2009-03-20 19:53:23 EDT
behaving as expected.  The issues that fell out of this were:

- a source folder that is also an output folder can have problems with resource deletions (now covered by another bug)
- split packages (across source folders) with duplicate types is not detected on incremental builds (now covered by another bug)
- deleting an aspect causes a full build (now covered by an enhancement request)

the latter two are scheduled for 1.6.5