Bug 160236 - Cross Reference view does not show binary aspects
Summary: Cross Reference view does not show binary aspects
Status: RESOLVED FIXED
Alias: None
Product: AJDT
Classification: Tools
Component: Core (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.4.1   Edit
Assignee: Matt Chapman CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 160469
Blocks:
  Show dependency tree
 
Reported: 2006-10-09 14:23 EDT by Eugene Kuleshov CLA
Modified: 2006-10-23 08:07 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 Eugene Kuleshov CLA 2006-10-09 14:23:19 EDT
I am using Eclipse 3.2 and the latest AJDT 1.4.1 dev build from the update site and it does not show binary aspects in the Cross Reference view even so they are woven into the bytecode.

These binary aspects came from Spring 2.0 and packaged in spring-aspects-2.0.jar, which I added into AspectJ Build / Aspect Path.

Spring advices are declared like this:

----
	private pointcut executionOfAnyPublicMethodInAtTransactionalType() :
		execution(public * ((@Transactional *)+).*(..)) && @this(Transactional);
	
	private pointcut executionOfTransactionalNonPrivateMethod() :
		execution(!private * *(..)) && @annotation(Transactional);

	protected pointcut transactionalMethodExecution(Object txObject) :
		(executionOfAnyPublicMethodInAtTransactionalType()
		 || executionOfTransactionalNonPrivateMethod() )
		 && this(txObject);
----
	protected pointcut beanCreation(Object beanInstance) :
		initialization((@Configurable *).new(..)) && this(beanInstance);
----

  My test class look like this:
  
@Configurable
public class Sample {

  public Sample() {
  }
  
  @Transactional
  public void main(String[] args) {
    System.err.println("Sample");
  }
  
}

---

The Cross References view shows the following for the above class:

Sample
+-- main(String[])
      +-- advised by  
            +-- {...} binary aspect: AnnotationTransactionAspect.class

As you can see it does not expand @Transactional aspect and does not show @Configurable aspect at all.

PS: Strange that @Transactional does not match on static methods, but it is a separate story...
Comment 1 Matt Chapman CLA 2006-10-10 06:12:02 EDT
Ah, the binary weaving support recently added to 1.4.1 dev builds only applies when the source code for the binary aspect is available in the workspace. Here, if you're just adding the spring aspects jar to the Aspect Path, there is no source, and AJDT is behaving as (currently) expected.

I see an "advised by binary aspect" marker in the editor, and a similar entry in the Cross References view.

So maybe this becomes an enhancement request. But what exactly do you expect it show when there is no source code for the aspect? We could look at making the binary aspect entry in the Cross References view a link to open the class in the class file editor (and support source attachments).
Comment 2 Eugene Kuleshov CLA 2006-10-10 09:15:23 EDT
That does not explain why advice on constructor is not shown at all.

BTW, I do have source for that jar in the workspace, but of course it is not attached/linked to spring-aspects.jar. You should allow to link th sources with aspect jars.
Comment 3 Matt Chapman CLA 2006-10-10 09:33:59 EDT
Good point. Let's make this bug for the missing advice marker on the constructor. 
Please raise an enhancement request for linking to attached source - we're aware of the need for this, but I don't think it's currently logged in bugzilla.
Comment 4 Eugene Kuleshov CLA 2006-10-10 18:08:07 EDT
Created two issues:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=160390
Allow to attach source to jars in inpath and aspectpath

https://bugs.eclipse.org/bugs/show_bug.cgi?id=160393
More open AJDT project configuration
Comment 5 Eugene Kuleshov CLA 2006-10-10 18:26:04 EDT
It is weird, but if I add default constructor, to the class with @Configurable it sometimes does show advice, but does not show the class for that advice:

ConfigurableBean
+-- ConfigurableBean()
|     +-- advised by  
|           +-- {...} binary aspect:    <--- no class name here
+-- setProperty1(String)
      +-- advised by  
            +-- {...} binary aspect: AnnotationTransactionAspect.class

I wonder if it is anyhow related to how advice is declared in these binary aspects. Spring is actually using abstract aspects that declare abstract pointcuts and concrete pointcuts declared in the concrete subclasses for these aspects.
Comment 6 Matt Chapman CLA 2006-10-11 09:04:25 EDT
Can you provide a testcase for the "binary aspect with no name" problem described above?

I can get AJDT to add the marker and cross reference entry for the advised constructor, but the information given to AJDT from AspectJ is incorrect - we're told that the constructor is advised by a pointcut! Therefore this bug can't be fixed until the AspectJ bug I've just raised for this has been fixed.
Comment 7 Eugene Kuleshov CLA 2006-10-11 09:13:31 EDT
It is pretty much the same as Sample class I showed before. For some reason advice for @Configurable is not being shown all the time. I still can't figure out why. Sometimes it is shown with no info about aspect (perhaps due to the issue you just found), but most of the time, even after rebuild it is not shown at all. No errors in Eclipse log either.
Comment 8 Matt Chapman CLA 2006-10-23 08:07:31 EDT
Fixed in:

1.4.1.200610230709 for Eclipse 3.2 (build.220)
1.5.0.200610230745 for Eclipse 3.3M2 (build.58)

AspectJ is now giving the correct information, and it is more detailed, so typically the links are now:
   advised by:
     "before" in binary aspect AbstractBeanConfigurerAspect.aj

instead of:
   advised by:
     binary aspect: AbstractBeanConfigurerAspect.class

I couldn't reproduce the "aspect with no name" issue, so please open a new bug if that still occurs now.