Discussion:
[aspectj-users] Help with at aspect declare error stack overflow
Jean-Nicolas
2011-11-20 17:38:00 UTC
Permalink
Hi,

I am getting this weird bug when trying to define an error with
@DeclareError on a method. When compiling, the first time i'm getting a
stack overflow error from aspectj and the second time everything
compiles just fine. We are in LTW. For example, if I do

$ mvn clean
$ mvn jetty:run <---- this will fail and create an ajcore (stack overflow)
$ mvn jetty:run <---- now it works fine

Now, here is the bug I found and how I fixed it... although I don't
understand why it didn't work in the first place.

Here is the NOT-working aspect :

#########################
public class OwnershipSecurityAspect {

@Pointcut("call(public void ca..setOwner(..)) &&
!within(ca..OwnershipSecurityAspect) && !within(ca..*Test)")
public void myPcut() {};

@DeclareError("myPcut()")
public static final String securityError = "An advice already
exists for setting an owner";
}
########################

So that creates the error, but if i put the PC declaration inside the
declareError like so :

#########################
public class OwnershipSecurityAspect {

@DeclareError("call(public void ca..setOwner(..)) &&
!within(ca..OwnershipSecurityAspect) && !within(ca..*Test)")
public static final String securityError = "An advice already
exists for setting an owner";
}
##########################

Now everything works fine.

However, the first method should work too, it's even the example in the
doc :
http://www.eclipse.org/aspectj/doc/next/aspectj5rt-api/org/aspectj/lang/annotation/DeclareError.html

Also note that the setOwner() method IS called inside this aspect... so
I thought it was infinite recursion... but I didn't even change the
pointcut definition, so I don't think this is the issue at hand here...

Thanks in advance for the help,
Jni
Andy Clement
2011-11-21 16:22:11 UTC
Permalink
Hi,

Please raise a bugzilla for this:
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ
Jean-Nicolas
2011-11-21 16:46:56 UTC
Permalink
Hi,

Thought this would need a bug report, just wasn't sure if I was missing
something stupid instead.

Here is the bug report :
https://bugs.eclipse.org/bugs/show_bug.cgi?id=364380

Thanks,
Jni
Post by Andy Clement
Hi,
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ
Thomas Hofmann
2011-11-22 08:59:04 UTC
Permalink
Hi Andy,

I was looking at the source of org.eclipse.contribution.weaving.jdt to see how the automatic installation of the necessary hooks for Equinox Weaving were implemented.

org.eclipse.contribution.weaving.jdt is pretty much AJDT specfic. Wouldn't it make sense to separate the preferences and the installation / configuration parts into the Equinox Weaving feature itself?

The problem with Equinox weaving is that if you want to use it you need to make sure that it is installed and installation is a PITA right now and not really feasable to deploy to users that are not into all of this.

Are there any other efforts to do something similar to what you have implemented to configure JDT weaving for pure Equinox weaving that you are aware of.? I wasn't able to find something.

Regards, Thomas

-----Original Message-----
From: aspectj-users-***@eclipse.org [mailto:aspectj-users-***@eclipse.org] On Behalf Of Jean-Nicolas
Sent: Montag, 21. November 2011 17:47
To: aspectj-***@eclipse.org
Subject: Re: [aspectj-users] Help with at aspect declare error stack overflow

Hi,

Thought this would need a bug report, just wasn't sure if I was missing something stupid instead.

Here is the bug report :
https://bugs.eclipse.org/bugs/show_bug.cgi?id=364380

Thanks,
Jni
Post by Andy Clement
Hi,
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ
Andrew Eisenberg
2011-11-22 16:12:38 UTC
Permalink
Hi Thomas,

There are some pieces of the JDT weaving plugin that are AJDT
specific, but those pieces are optional (meaning that if AJDT is not
installed, that part of the functionality is not invoked). JDT
Weaving is used by ScalaIDE as well as the Gosu plugin and they are
able to avoid the AJDT specific pieces.

I have been considering a refactoring of JDT weaving for a long time,
but it would be a very complicated job that provides very little
benefit since all clients of JDT Weaving are able to use it
successfully.

It would not be possible to move some of JDT weaving into Equinox
weaving since Equinox weaving is an equinox project and must work in
OSGi environments that do not have any eclipse-specific bundles
installed.

Can you be more specific as to what you are trying to do and what
exactly is the problem? Why is it difficult to install Equinox/JDT
weaving? You should be able to install from the update site.

On Tue, Nov 22, 2011 at 12:59 AM, Thomas Hofmann
Post by Thomas Hofmann
Hi Andy,
I was looking at the source of org.eclipse.contribution.weaving.jdt to see how the automatic installation of the necessary hooks for Equinox Weaving were implemented.
org.eclipse.contribution.weaving.jdt is pretty much AJDT specfic. Wouldn't it make sense to separate the preferences and the installation / configuration parts into the Equinox Weaving feature itself?
The problem with Equinox weaving is that if you want to use it you need to make sure that it is installed and installation is a PITA right now and not really feasable to deploy to users that are not into all of this.
Are there any other efforts to do something similar to what you have implemented to configure JDT weaving for pure Equinox weaving that you are aware of.? I wasn't able to find something.
Regards, Thomas
-----Original Message-----
Sent: Montag, 21. November 2011 17:47
Subject: Re: [aspectj-users] Help with at aspect declare error stack overflow
Hi,
Thought this would need a bug report, just wasn't sure if I was missing something stupid instead.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=364380
Thanks,
Jni
Post by Andy Clement
Hi,
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ
 
Thomas Hofmann
2011-11-23 10:51:36 UTC
Permalink
Hi Andy,

what I basically want to do is install equinox weaving and configure it so that some other plug-in I wrote can use it and weave into a third plug-in.

I want to bundle all the necessary plug-ins and features to do so into a p2 repository.

Currently, I use AJDT update site to only install org.eclipse.contribution.weaving.jdt. This work without problems.

I was just wondering if this part of AJDT is available somewhere else to consume. If I am not mistaken it is not separated from AJDT sources. I also don't need to weave into the JDT but it doesn't hurt.

So what I could do is build org.eclipse.contribution.weaving.jdt myself and bundle it in one of my features. Since you are saying it is optional in a sense that AJDT code won't be invoked I guess that there will be references to AJDT that I need at build time but I can have a look at this myself.

I just want to avoid for consumers of my plug-ins that use equinox weaving that they will need to install and configure the weaving bundles and hooks.

Thomas

-----Original Message-----
From: aspectj-users-***@eclipse.org [mailto:aspectj-users-***@eclipse.org] On Behalf Of Andrew Eisenberg
Sent: Dienstag, 22. November 2011 17:13
To: aspectj-***@eclipse.org
Subject: Re: [aspectj-users] Equinox waeving

Hi Thomas,

There are some pieces of the JDT weaving plugin that are AJDT specific, but those pieces are optional (meaning that if AJDT is not installed, that part of the functionality is not invoked). JDT Weaving is used by ScalaIDE as well as the Gosu plugin and they are able to avoid the AJDT specific pieces.

I have been considering a refactoring of JDT weaving for a long time, but it would be a very complicated job that provides very little benefit since all clients of JDT Weaving are able to use it successfully.

It would not be possible to move some of JDT weaving into Equinox weaving since Equinox weaving is an equinox project and must work in OSGi environments that do not have any eclipse-specific bundles installed.

Can you be more specific as to what you are trying to do and what exactly is the problem? Why is it difficult to install Equinox/JDT weaving? You should be able to install from the update site.
Post by Thomas Hofmann
Hi Andy,
I was looking at the source of org.eclipse.contribution.weaving.jdt to see how the automatic installation of the necessary hooks for Equinox Weaving were implemented.
org.eclipse.contribution.weaving.jdt is pretty much AJDT specfic. Wouldn't it make sense to separate the preferences and the installation / configuration parts into the Equinox Weaving feature itself?
The problem with Equinox weaving is that if you want to use it you need to make sure that it is installed and installation is a PITA right now and not really feasable to deploy to users that are not into all of this.
Are there any other efforts to do something similar to what you have implemented to configure JDT weaving for pure Equinox weaving that you are aware of.? I wasn't able to find something.
Regards, Thomas
-----Original Message-----
Sent: Montag, 21. November 2011 17:47
Subject: Re: [aspectj-users] Help with at aspect declare error stack overflow
Hi,
Thought this would need a bug report, just wasn't sure if I was missing something stupid instead.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=364380
Thanks,
Jni
Post by Andy Clement
Hi,
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ
 
Andrew Eisenberg
2011-11-23 16:28:32 UTC
Permalink
Is there any reason why you are not installing just the equinox
weaving feature? The IU id is
org.eclipse.equinox.weaving.sdk.feature.group and it is available from
the ajdt update sites.
Post by Thomas Hofmann
Hi Andy,
what I basically want to do is install equinox weaving and configure it so that some other plug-in I wrote can use it and weave into a third plug-in.
I want to bundle all the necessary plug-ins and features to do so into a p2 repository.
Currently, I use AJDT update site to only install org.eclipse.contribution.weaving.jdt. This work without problems.
I was just wondering if this part of AJDT is available somewhere else to consume. If I am not mistaken it is not separated from AJDT sources. I also don't need to weave into the JDT but it doesn't hurt.
So what I could do is build org.eclipse.contribution.weaving.jdt myself and bundle it in one of my features. Since you are saying it is optional in a sense that AJDT code won't be invoked I guess that there will be references to AJDT that I need at build time but I can have a look at this myself.
I just want to avoid for consumers of my plug-ins that use equinox weaving that they will need to install and configure the weaving bundles and hooks.
Thomas
-----Original Message-----
Sent: Dienstag, 22. November 2011 17:13
Subject: Re: [aspectj-users] Equinox waeving
Hi Thomas,
There are some pieces of the JDT weaving plugin that are AJDT specific, but those pieces are optional (meaning that if AJDT is not installed, that part of the functionality is not invoked).  JDT Weaving is used by ScalaIDE as well as the Gosu plugin and they are able to avoid the AJDT specific pieces.
I have been considering a refactoring of JDT weaving for a long time, but it would be a very complicated job that provides very little benefit since all clients of JDT Weaving are able to use it successfully.
It would not be possible to move some of JDT weaving into Equinox weaving since Equinox weaving is an equinox project and must work in OSGi environments that do not have any eclipse-specific bundles installed.
Can you be more specific as to what you are trying to do and what exactly is the problem?  Why is it difficult to install Equinox/JDT weaving?  You should be able to install from the update site.
Post by Thomas Hofmann
Hi Andy,
I was looking at the source of org.eclipse.contribution.weaving.jdt to see how the automatic installation of the necessary hooks for Equinox Weaving were implemented.
org.eclipse.contribution.weaving.jdt is pretty much AJDT specfic. Wouldn't it make sense to separate the preferences and the installation / configuration parts into the Equinox Weaving feature itself?
The problem with Equinox weaving is that if you want to use it you need to make sure that it is installed and installation is a PITA right now and not really feasable to deploy to users that are not into all of this.
Are there any other efforts to do something similar to what you have implemented to configure JDT weaving for pure Equinox weaving that you are aware of.? I wasn't able to find something.
Regards, Thomas
-----Original Message-----
Sent: Montag, 21. November 2011 17:47
Subject: Re: [aspectj-users] Help with at aspect declare error stack overflow
Hi,
Thought this would need a bug report, just wasn't sure if I was missing something stupid instead.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=364380
Thanks,
Jni
Post by Andy Clement
Hi,
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ
 
Continue reading on narkive:
Loading...