Bug 225916 - weaving is sensitive to order of input files
Summary: weaving is sensitive to order of input files
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P1 blocker (vote)
Target Milestone: 1.6.0 RC1   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-06 20:28 EDT by Vincenz Braun CLA
Modified: 2008-04-21 11:22 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vincenz Braun CLA 2008-04-06 20:28:21 EDT
Take this three little files:

// file 1
package test.aspects;

public aspect TestAspect {

	pointcut boundaries(): execution (public * *..*MBean+.*(..));
	
	Object around(): boundaries() {
		return proceed();
	}
}

// file 2
package test.jmx;

public class Test implements TestMBean {

	public String test() {
		return "test";
	}
}

// file 3
package test.jmx;

public interface TestMBean {

	String test();
}

ajc -showWeaveInfo test/jmx/Test.java test/jmx/TestMBean.java test/aspects/TestAspect.aj 

shows nothing

ajc -showWeaveInfo test/jmx/TestMBean.java test/jmx/Test.java test/aspects/TestAspect.aj 

results in Join point 'method-execution(java.lang.String test.jmx.Test.test())' in Type 'test.jmx.Test' (Test.java:5) advised by around advice from 'test.aspects.TestAspect' (TestAspect.aj:7)

I noticed this migrating a aspectj 1.5.0 project to 1.5.4.
1.5.0 does not show this behaviour.
I also tested the current developer version of 1.6 (20080404223500) which fails, too.

I hope the filx to this will make it in 1.6.0.

In eclipse (current stable ajdt for 3.3) weaving is done correctly. I never noticed this
bug in eclipse (neve saw missing weaving annotations on joinpoints that should have one.).
Comment 1 Andrew Clement CLA 2008-04-07 01:12:38 EDT
As with the previous occurence of this same issue, it is the pipeline compilation introduced in 1.5.3 that causes it.  A simple workaround is to switch off pipeline compilation (whilst i work on a fix):

ajc -showWeaveInfo "-Xset:pipelineCompilation=false" Test.java TestMBean.java TestAspect.java

produces the output as expected.
Comment 2 Andrew Clement CLA 2008-04-07 11:53:47 EDT
fixed in latest dev build.  The problem is during pipeline processing some types are still in their eclipse representation (have not yet been transformed to their bcel form) in this case one of the methods on the eclipse representation (isAnonymous()) was incorrect.
Comment 3 Vincenz Braun CLA 2008-04-07 13:08:04 EDT
Thank you very much!
Can you be so kind and point me to the original bug report
that deals with the "previous occurence of this same issue"?

I only found 171953, which is fixed.
Comment 4 Andrew Clement CLA 2008-04-07 13:21:36 EDT
sorry, I did a quick search and can't find it.  But I just remember we have had a problem before with order of files being important and it being due to the pipeline compiler feature.
Comment 5 Vincenz Braun CLA 2008-04-21 05:40:56 EDT
Could you please be so kind and give me some details about how much
these two compiler methods differ? Does the aspectj test suite run against
both compiler settings? What compilation method uses ajdt in eclipse?

Can bug 226567 and 227540 also be targeted for 1.6.0? 
Or does it even make sense to have pipelineCompilation=false as default?
I would suggest to make it at least a standard X switch that shows up in ajc -X.
Comment 6 Andrew Clement CLA 2008-04-21 11:22:37 EDT
> Could you please be so kind and give me some details about how much
> these two compiler methods differ? 

There are two classes we choose between for sorting/ordering compilation and weaving.  A pipeline one and a non-pipeline one.  

> Does the aspectj test suite run against both compiler settings? 

Our build machine does not run the test suite against non-pipeline compilation as it is deprecated, only left in as a temporary workaround for users that hit issues that turn out to be pipelining.  I haven't manually tried running it against non-pipeline compilation for a long time.

> What compilation method uses ajdt in eclipse?

AJDT uses pipeline compilation, otherwise there are terrible memory problems, as used to get reported pre 1.5.3

> Can bug 226567 and 227540 also be targeted for 1.6.0? 
> Or does it even make sense to have pipelineCompilation=false as default?
> I would suggest to make it at least a standard X switch that shows up in ajc -X.

227540 may make 1.6.0 if it can be addressed in the next two days.  226567 will not - if it were a regression, I might, but it did not work in 1.5 either.

1.6.1 development will start straight after 1.6.0 ships so I don't see a need to hold it up.

I would rather not make non-pipeline compilation easier to use as it is not meant to be the way to run things. non-pipeline compilation has a terrible memory usage profile which is what led to creation of pipeline compilation.  As I say, it is only in as a temporary fix I offer people whilst their pipeline issues are addressed.