Bug 320331 - AJDT incremental compile does not update other Java Projects when project is converted to AspectJ project
Summary: AJDT incremental compile does not update other Java Projects when project is ...
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: IDE (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 major with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-19 17:34 EDT by Peter Hendriks CLA
Modified: 2010-08-05 18:40 EDT (History)
2 users (show)

See Also:


Attachments
Original test projects for reproduce scenarios (do not correctly reproduce when imported into workspace) (8.04 KB, application/octet-stream)
2010-07-19 17:35 EDT, Peter Hendriks CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Hendriks CLA 2010-07-19 17:34:45 EDT
Build Identifier: M20100211-1343 (AJDT: 2.1.0.e35x-release-20100630-1500)

When a Java Eclipse plug-in project is AspectJ enabled, dependent projects are not updated by the incremental AspectJ Java compiler. This means compile errors are not detected and incremental compilation can not be trusted for this scenario.

Files inside the Eclipse plug-in are updated correctly. Both other Eclipse plug-in projects and plain Java projects that depend on the plug-in are not updated.

This is found as a result of retesting bug 318884. I've marked this major as this cripples incremental compilation when doing aspectj with Eclipse plug-ins, under even more circumstances than 318884 does.

Reproducible: Always

Steps to Reproduce:
See example projects in attachment. Test1 is aspectj enabled plug-in project. Test2 is Java plug-in project, depends on test1. Test3 is plain Java project, depends on both Test1 and test2.

1. Make sure "Build automatically" is enabled.
2. Open the "Test1" class and comment out the "foo()" method. Note that test2 and test3 projects are not showing compile errors. Open the Test2 and Test3 class and notice the compile error is only highlighted in editor. Notice that "InternalTest" (inside test1) is updated correctly.
3. Comment out foo() in Test2 (the plain Java Eclipse plug-in project). Notice that Test3 is updated correctly.
Comment 1 Peter Hendriks CLA 2010-07-19 17:35:47 EDT
Created attachment 174679 [details]
Original test projects for reproduce scenarios (do not correctly reproduce when imported into workspace)
Comment 2 Andrew Clement CLA 2010-07-19 18:43:19 EDT
Not sure if this will be AJDT or AspectJ that is at fault, probably AspectJ.
Comment 3 Andrew Eisenberg CLA 2010-07-20 11:02:48 EDT
(In reply to comment #2)
> Not sure if this will be AJDT or AspectJ that is at fault, probably AspectJ.

I go have a peek.
Comment 4 Andrew Eisenberg CLA 2010-07-20 11:18:32 EDT
Peter, 

I tried following the steps exactly as you describe, but it looks like incremental compilation is working for me.  Three differences, though:

1. I am on 3.6
2. I am using the latest dev build
3. I am on mac

I'll try using 3.5 and seeing if I can reproduce there.
Comment 5 Andrew Eisenberg CLA 2010-07-20 11:28:28 EDT
Nope.  Can't reproduce on 3.5 either.

Perhaps there is some setting that you have differently in your workspace.  Can you try going into your workspace AspectJ Compiler settings and clicking "Restore Defaults"?  There are a couple of settings there that may affect incremental compilation.
Comment 6 Peter Hendriks CLA 2010-07-20 14:21:27 EDT
(In reply to comment #5)
> Nope.  Can't reproduce on 3.5 either.
> 
> Perhaps there is some setting that you have differently in your workspace.  Can
> you try going into your workspace AspectJ Compiler settings and clicking
> "Restore Defaults"?  There are a couple of settings there that may affect
> incremental compilation.

When I import the test projects into the workspace, this works for me too (on Eclipse 3.6, both latest dev and stable AJDT). I did not recheck that. The problem is more subtle than I originally described. I am sorry about the confusion. The problem seems to be in a totally different area.

When I import the projects, everything works. When I create a project using the wizard "New > Project... > AspectJ project", everything works.

However, when I create a Java project/plug-in project first using "New > Java Project", and then right click on it and select "Configure > Convert to AspectJ project", then it breaks in the way described (dependent projects are not updated). This problem persists if I restart Eclipse, but if I export and import the projects, the problem goes away.

So, to reproduce (with default settings on AspectJ compiler, JDT weaving enabled):

1. Create a Java Project called Test1.
2. Create another Java Project called Test2.
3. Update the build path of Test2 to make it depend on Test1.
4. Create a class in Test1 called "test1.Test1" with a single method "public void foo() {}"
5. Create a class in Test2 called "test2.Test2" with a single method that calls Test1.foo(), e.g. "public void foo() { new Test1().foo(); }"
6. In Test1, remove the foo() method. Note that the compile error in Test is reported. Undo the operation so the foo method is back and everyhing compiles.
7. Convert the Java Project to an AspectJ enabled project by right clicking on the project and select "Configure > Convert to AspectJ project".
8. In Test1, remove the foo() method. Note that the compile error in Test2 is not reported, unless the project is cleaned or Test2 is manually altered.

This scenario failed for me both in AJDT dev and AJDT 2.1.0. I will try tomorrow in my production workspace if the problem goes away when I re-import all the projects.
Comment 7 Andrew Eisenberg CLA 2010-07-21 00:02:25 EDT
Thanks for the detailed steps to reproduce.  I can see the problem now.

Just to be clear...Test1 must be converted into an AJ project, not Test2.  If they are both AJ projects, or only Test2 is an AJ project this problem does not appear.

It seems like the state file for the AspectJ project is not being properly read by the Java project.
Comment 8 Andrew Clement CLA 2010-07-21 00:18:43 EDT
sounds like it should be transferred to AspectJ
Comment 9 Peter Hendriks CLA 2010-07-21 04:28:42 EDT
(In reply to comment #7)
> Thanks for the detailed steps to reproduce.  I can see the problem now.
> 
> Just to be clear...Test1 must be converted into an AJ project, not Test2.  If
> they are both AJ projects, or only Test2 is an AJ project this problem does not
> appear.
> 
> It seems like the state file for the AspectJ project is not being properly read
> by the Java project.

Yes, step 7 should read: "Convert the "Test1" Java Project to an AspectJ enabled project by right clicking on
the project and select "Configure > Convert to AspectJ project"."

If "Test1" is created as a new AspectJ project immediately, or if test1 is deleted from the workspace (without deleting files) and then reimported, the problem does no longer occur.

I checked on my production workspace (Eclipse 3.5, AJDT dev 20100715), and the problem goes away there as well when I delete, re-import.
Comment 10 Andrew Eisenberg CLA 2010-08-05 18:40:29 EDT
Transferring to AspectJ project since problem appears to lie there.