Re: [aspectj-users] AspectJ 1.8.0.M1 now available !

2013-07-31 Thread Ramnivas Laddad
Really nice! Thanks, Andy. On Mon, Jul 29, 2013 at 5:40 PM, Matthew Adams matt...@matthewadams.mewrote: Wow. Congrats, Andy. Nice work. I hope to play as soon as I can. :) -matthew On Mon, Jul 29, 2013 at 7:24 PM, Andy Clement andrew.clem...@gmail.comwrote: Hi, I'm pleased to

Re: [aspectj-users] ITD constructor access methods defined in super class

2013-07-17 Thread Ramnivas Laddad
There seems to be a bug in the AspectJ compiler. With your code as is, I see the same error, but there is also a warning (- inter-type constructor does not contain explicit constructor call: field initializers in the target type will not be executed [Xlint:noExplicitConstructorCall]. Then I

Re: [aspectj-users] Behaviours of new constructor added by AspectJ ITD

2013-07-16 Thread Ramnivas Laddad
For Q1: AspectJ compiler (and AJDT) will issue - inter-type constructor does not contain explicit constructor call: field initializers in the target type will not be executed [Xlint:noExplicitConstructorCall] when you don't have explicit constructor call. Can you post Q2 freshly in a separate

Re: [aspectj-users] Invoking proceed() from an inner class

2013-07-16 Thread Ramnivas Laddad
See worker object pattern described in http://stackoverflow.com/questions/12018585/how-to-intercept-proceed-in-another-aspectj-aspect On Tue, Jul 16, 2013 at 3:59 PM, Archie Cobbs arc...@dellroad.org wrote: Is it possible to invoke proceed() in an aspect from an inner class? I have a need to

Re: [aspectj-users] Behaviours of new constructor added by AspectJ ITD

2013-07-15 Thread Ramnivas Laddad
Replied on stackoverflow. On Mon, Jul 15, 2013 at 8:03 AM, pai pika...@gmail.com wrote: Hi! folk~ I have a question about behaviours of new constructor added by AspectJ ITD I am currently applying AspectJ to our project, and I found a behavior which is a bit strange to me. **Q1:** I

Re: [aspectj-users] Behaviours of new constructor added by AspectJ ITD

2013-07-15 Thread Ramnivas Laddad
Replied again (appended to original answer). Hopefully, this resolves your issue. On Mon, Jul 15, 2013 at 12:27 PM, pai pika...@gmail.com wrote: Hi Alex! I'm sorry that you think I don't appreciate his answer. But actually, I do appreciate for your kind response. That's why I think I

Re: [aspectj-users] How to compile interfaces with default implementations

2011-12-20 Thread Ramnivas Laddad
Hi, I can reproduce the issue. It seems something changed in the way maven3 interacts with the AspectJ plugin. I will look into this later today. -Ramnivas On Tue, Dec 20, 2011 at 7:45 AM, Jean-Pierre Bergamin jpberga...@gmail.com wrote: Hello everyone I'm reading AspectJ in Action (2nd

Re: [aspectj-users] How to compile interfaces with default implementations

2011-12-20 Thread Ramnivas Laddad
executions ... Hope this helps. -Ramnivas On Tue, Dec 20, 2011 at 1:09 PM, Ramnivas Laddad ramni...@ramnivas.com wrote: Hi, I can reproduce the issue. It seems something changed in the way maven3 interacts with the AspectJ plugin. I will look into this later today

Re: [aspectj-users] Spring AOP AspectJ: Help reducing startup time

2011-08-24 Thread Ramnivas Laddad
A bit short on time... but wanted to make some quick comments. If you switch to AspectJ weaving, you should see substantial improvement in startup times. Build time will go up, but most likely not too substantially (depends on how widely your pointcuts apply). In any case, incremental compilation

Re: [aspectj-users] Examining a destructive read in an aspect

2011-01-31 Thread Ramnivas Laddad
You could do something along the following lines: 1. In your before advice read destructively as needed and store away the result 'env' in a ThreadLocal. 2. Advise ctx.getNextIncoming() with an around advice to return the stored result (and don't call proceed() in it). -Ramnivas On Mon, Jan 31,

Re: [aspectj-users] Finding nested method calls within the same class

2011-01-31 Thread Ramnivas Laddad
I replied to your question on SO. Check if that works for you: http://stackoverflow.com/questions/4850182/aspectj-how-to-find-a-method-of-an-annotated-class-is-calling-another-method-of -Ramnivas On Mon, Jan 31, 2011 at 6:48 AM, menacher abrahammenache...@gmail.comwrote: Hi Simone, Thanks for

Re: [aspectj-users] How to turn of optimized matching?

2011-01-07 Thread Ramnivas Laddad
Hi, It has been a very long time since I dealt with an ear! The apo.xml file needs to be on classpath element META-INF. For a war file, it need to be in either classes/META-INF/aop.xml or in a jar under META-INF. You will need to place apo.xml for ear under an equivalent location. Can you try

Re: [aspectj-users] AspectJ advising with generic pointcuts

2011-01-04 Thread Ramnivas Laddad
@Pointcut(execution(public * *(Vehicle+, ..)) args(myarg, ..) ) public void myMethod(Vehicle myarg) {} On Mon, Jan 3, 2011 at 8:38 AM, Srinivas tssrini...@yahoo.com wrote: This seems like compile error. What is the correct syntax ? @Pointcut(execution(public * *(..)) args(myarg ) )

Re: [aspectj-users] With @Aspect syntax @annotation, @Pointcut does not compile

2010-11-12 Thread Ramnivas Laddad
Amit, Your before advice isn't written correctly. It should look like (remove type from the expression): @*Before* (*permissionMethod(permission)*) *public* *void* permissionCheck(PermissionNeeded permission) { -Ramnivas On Thu, Nov 11, 2010 at 4:16 PM, Amit Chaudhary ami...@rajgad.com

Re: [aspectj-users] how to find the end-of-method line number?

2010-09-07 Thread Ramnivas Laddad
You should probably use thisJoinPointStaticPart.getSourceLocation(). -Ramnivas On Sun, Sep 5, 2010 at 11:58 PM, Hagai Cibulski hag...@gmail.com wrote: The following turns out to be too slow: (and probably might be incorrect with certain compiler optimizations) *after*():

Re: [aspectj-users] Re: another newbie question: avoid constructor calls .. !initialize ?

2010-07-14 Thread Ramnivas Laddad
using the AspectJ weaver (in Intellij) -- so I *think *that means it should be supported .. ? 2010/7/13 Ramnivas Laddad ramni...@aspectivity.com Are you using Spring AOP (i.e. proxy-based AOP) or AspectJ (i.e. byte-code weaving based AOP)? -Ramnivas On Tue, Jul 13, 2010 at 5:20 PM, Stephen

Re: [aspectj-users] Re: Verbose mode on ajc / aspectj compiler output?

2010-07-14 Thread Ramnivas Laddad
Well, a tool won't tell you what is wrong with the code, since it doesn't know what you intend to express. If you can show example code of what you intend to advise, perhaps someone can help you (it is really difficult to know what you want from the email). For you earlier question, the fact that

Re: [aspectj-users] Re: Verbose mode on ajc / aspectj compiler output?

2010-07-14 Thread Ramnivas Laddad
Indeed, PointcutDoctor could be of help--especially to flag errors based on heuristics. -Ramnivas On Wed, Jul 14, 2010 at 9:18 AM, Johan Fabry jfa...@dcc.uchile.cl wrote: That would be cool, I hope it works out ! :-) On 14 Jul 2010, at 11:28, Andy Clement wrote: Ramnivas is aware of the

Re: [aspectj-users] Re: Verbose mode on ajc / aspectj compiler output?

2010-07-14 Thread Ramnivas Laddad
Stephen, I don't believe PointcutDoctor works with current AJDT (as Andy mentions, it may be revived soon). Just to clarify: The kind of snippet Andy included is what I was looking for (not just aspect, but also a representative target Java class). That way it is easy to understand your

Re: [aspectj-users] newbie question on within pointcut

2010-07-13 Thread Ramnivas Laddad
You will need to exclude *getStatisticsSource() *from being advised (or add !cflowbelow(within(ApplyStatisticsDaoAllPublicMethodsAspect)) The reason you get infinite recursion is the following call sequence: 1. A method executed on dao 2. Advice executes 3. Advice calls *getStatisticsSource* 4.

Re: [aspectj-users] newbie question on within pointcut

2010-07-13 Thread Ramnivas Laddad
(AspectClass). So I coded !within(ApplyStatisicsDaoAllPublicMethodsAspect). Is the !clowbelow(withinAspectClass)) required then? I wonder why those other examples worked in that case. 2010/7/13 Ramnivas Laddad ramni...@aspectivity.com You will need to exclude *getStatisticsSource() *from being

Re: [aspectj-users] Re: another newbie question: avoid constructor calls .. !initialize ?

2010-07-13 Thread Ramnivas Laddad
Are you using Spring AOP (i.e. proxy-based AOP) or AspectJ (i.e. byte-code weaving based AOP)? -Ramnivas On Tue, Jul 13, 2010 at 5:20 PM, Stephen Boesch java...@gmail.com wrote: I am getting a warning/error from my IDE that Spring does not support initialization pointcuts (among others) -

Re: [aspectj-users] Question about @AspectJ and what it can do

2010-07-01 Thread Ramnivas Laddad
? From: aspectj-users-boun...@eclipse.org [aspectj-users-boun...@eclipse.org] On Behalf Of Ramnivas Laddad [ramni...@aspectivity.com] Sent: Wednesday, June 30, 2010 9:48 PM To: aspectj-users@eclipse.org Subject: Re: [aspectj-users] Question about @AspectJ and what

Re: [aspectj-users] Re: Dynamically disable a pointcut

2010-07-01 Thread Ramnivas Laddad
The if() pointcut is a evaluated dynamic (i.e. at runtime). That allows runtime control over aspect. The initial value has no influence over weaving. So in this case, AspectJ will weave in the aspect, but at runtime check the variable and not execute the advice. -Ramnivas On Thu, Jul 1, 2010 at

Re: [aspectj-users] basic question regarding 'after throwing' advice

2010-06-30 Thread Ramnivas Laddad
Take a look at section 10.6 from AspectJ in Action (if you don't have the book, you can download sources from manning.com/laddad2). It users a thread-local for the same purpose. -Ramnivas On Wed, Jun 30, 2010 at 2:04 AM, Ashank k_arvind_shan...@yahoo.com wrote: Hello All, I have a simple

Re: [aspectj-users] Question about @AspectJ and what it can do

2010-06-30 Thread Ramnivas Laddad
[aspectj-users-boun...@eclipse.org] On Behalf Of Ramnivas Laddad [ramni...@aspectivity.com] Sent: Wednesday, June 30, 2010 5:30 PM To: aspectj-users@eclipse.org Subject: Re: [aspectj-users] Question about @AspectJ and what it can do Can you show what you intent to do with the traditional syntax

Re: [aspectj-users] Dynamically disable a pointcut

2010-06-29 Thread Ramnivas Laddad
If indeed isTraceEnabled is set to 'false', your pointcut will not select anything and you shouldn't get any tracing. Try printing isTraceEnabled in your advice to see if it has been set to 'true'. -Ramnivas On Tue, Jun 29, 2010 at 8:37 AM, rampaadh rampa...@lavabit.com wrote: I am new user

Re: [aspectj-users] aspectJ big example!!

2010-06-29 Thread Ramnivas Laddad
If you are looking for bigger aspects, take a look at examples from the second edition of AspectJ in Action (http://manning.com/laddad2). Also take a look at the Spring project (its transaction management and domain-object dependency injection aspects are fairly involved). If you are looking at

Re: Re : [aspectj-users] Re: [groovy-user] AspectG?

2010-06-17 Thread Ramnivas Laddad
Indeed, that will be an interesting multi-paradigm language: functional object aspect oriented :-) -Ramnivas On Thu, Jun 17, 2010 at 1:36 AM, Miles Sabin mi...@milessabin.com wrote: On Wed, Jun 16, 2010 at 4:49 PM, Matthew Adams matt...@matthewadams.me wrote: If you want this support, make

Re: [aspectj-users] getting varargs to work in args and advise

2010-03-22 Thread Ramnivas Laddad
call(* myTestClass.setStrFld(String,int...)) will select the following method class myTestClass { ANY TYPE setStrFld(String a, int... b) { } } You probably want to use thisJoinPoint.getArgs() in the advice to access all arguments. -Ramnivas On Mon, Mar 22, 2010 at 3:31 AM, Ashank

Re: [aspectj-users] Can we access any static join point information in declare error/warning?

2010-03-17 Thread Ramnivas Laddad
Very nice, indeed! -Ramnivas On Wed, Mar 17, 2010 at 9:19 AM, Simone Gianni simo...@apache.org wrote: Very very nice!!! Simone 2010/3/13 Andy Clement andrew.clem...@gmail.com This idea of mirroring the API usage is mentioned in bug 48080 (see the first comment by Jim). I have just

Re: [aspectj-users] LTW with WebSphere message broker

2010-03-08 Thread Ramnivas Laddad
I haven't used WebSphere ESB, so can't say if/how well LTW will work with it. For WebSphere itself, there is a classloader implementation (search bugzilla) that implements LTW. However, I don't know how well it works with the latest version of AspectJ. Is there a reason why build-time weaving

Re: [aspectj-users] Four Approaches of Mixins in Java with AspectJ

2010-02-17 Thread Ramnivas Laddad
+1 for a good blog (and +2 for mentioning my book!). I think static crosscutting is a critical component of AOP, but dynamic crosscutting usually steals the show! As shown in Spring Roo, when used correctly, static crosscutting can really help boost productivity and create clean code. -Ramnivas

Re: [aspectj-users] Are static initializers of an aspect guaranteed to be called?

2010-02-16 Thread Ramnivas Laddad
In this regard, aspects behave just like classes. When an aspect type is referenced for the first time, its static initializer will be called just as for a class. -Ramnivas On Tue, Feb 16, 2010 at 10:33 AM, Gary Bisaga gbis...@gmail.com wrote: I read (for example in AspectJ in Action) it

Re: [aspectj-users] Simplest way to advice around java.sql.Statement.executeQuery?

2010-02-16 Thread Ramnivas Laddad
In case of JDBC objects (statements, connection etc.), if you use an execution pointcut such as: execution(* java.sql.Statement.*(..)) and you weave in the JDBC driver (the jar), you should be good to go. We use this approach in Spring Insight (

Re: [aspectj-users] Problem converting to annotation style

2010-02-11 Thread Ramnivas Laddad
In annotation-style, pointcut expressions must use fully-qualified type names. So you will need to change your pointcut to something like: @Pointcut(execution(* packageof.A.*(..)) || execution(* packageof.C.*(..))) Also, can you switch to the latest version AspectJ? A lot of bugs have been

Re: [aspectj-users] not able to hook individual class - proxy aspectj

2010-01-12 Thread Ramnivas Laddad
Hi Priya, eclipse.org/aspectj itself should be a good starting point. -Ramnivas On Mon, Jan 11, 2010 at 2:03 AM, priya j jagapriy...@gmail.com wrote: Hi Ramnivas, Thanks for your reply. Can you give me some suggestion or site to refer? Regards, Priya Ramnivas Laddad wrote: Priya

Re: [aspectj-users] not able to hook individual class - proxy aspectj

2010-01-10 Thread Ramnivas Laddad
Priya, I assume that by proxy you mean proxies created by Spring AOP. In that case, Controllertest isn't probably a Spring bean. In Spring, only beans may be advised by aspects. If you must advise non-beans, you will need to use the AspectJ weaver. -Ramnivas On Sun, Jan 10, 2010 at 6:16 PM,

Re: [aspectj-users] overridden method not caught

2010-01-06 Thread Ramnivas Laddad
I am guessing that you are using the AspectJ's byte code weaving (and not Spring's proxy-based). Right? If so, I just tried your example and it works fine for me (I removed Spring related code as that is not significant here). -Ramnivas On Wed, Jan 6, 2010 at 12:40 AM, adrian.p.sm...@bt.com

Re: [aspectj-users] Aspectj scope Singleton, moitoring ?

2009-12-29 Thread Ramnivas Laddad
On Tue, Dec 29, 2009 at 9:40 AM, p...@ichthyostega.de p...@ichthyostega.dewrote: ... Regarding Aspects, there is only one general advice I can give, based on my experience: You should be reluctant to do implementation-level stuff from Advice. It is always better to invoke an API or an

Re: [aspectj-users] Aspectj scope Singleton, moitoring ?

2009-12-28 Thread Ramnivas Laddad
It certainly can be useful. It really depends on if the aspect contains shared state that can be used concurrently. In other words, the situation in an advice isn't much different than a regular method. -Ramnivas On Mon, Dec 28, 2009 at 10:12 AM, Jean-Louis.Pasturel

Re: [aspectj-users] priviledged aspect

2009-12-02 Thread Ramnivas Laddad
This is really a Java reflection API question. Check http://java.sun.com/javase/6/docs/api/java/lang/reflect/AccessibleObject.html#setAccessible(boolean)to access non-public members. Also, if you go that route, you don't need your aspect to be marked at privileged. -Ramnivas On Wed, Dec 2, 2009

Re: [aspectj-users] Spring Advice Not getting applied

2009-11-24 Thread Ramnivas Laddad
Hi Ron, I don't see any beans to which the aspect should be applied. Have you declared those somewhere else? -Ramnivas On Tue, Nov 24, 2009 at 7:04 AM, Ron DiFrango rdifra...@captechventures.com wrote: It has been a while since I applied AspectJ to Spring beans. I have the following code:

Re: [aspectj-users] New intertype syntax ...new meaning?

2009-11-24 Thread Ramnivas Laddad
Andy, I haven't used the 'declare warning' pattern with ITDs you showed in a while. But you are right that there are use cases where the distinction between the lexical scope of the introduced members matters. I guess one if the question to ponder: what is the interaction between within() and

Re: [aspectj-users] Intertype declaration name mangling - for or against?

2009-11-20 Thread Ramnivas Laddad
I am all for this. Mangled names create problems with JPA and such. I guess one issue to consider is what happens when two aspects want to introduce a same-named field with a directive to not mangle, especially if both aspects are from third-party libraries. This is quite unlikely to occur in

Re: [aspectj-users] AspectJ run-time licensing

2009-10-05 Thread Ramnivas Laddad
the EPL? - Jacob 2009/7/13 Ramnivas Laddad ramni...@xxx mailto:ramni...@xxx I am not a lawyer, but I do not think there are any restrictions on redistributing aspectjrt.jar (or any of the the AspectJ jars). For example, aspectjrt.jar

Re: [aspectj-users] Method return value in case of exception

2009-09-23 Thread Ramnivas Laddad
You need to keep track of the logged exception and make sure that you don't log it again. For an example, see source code of AspectJ in Action (specifically exception logging example in chapter 10); you can download code from http://manning.com/laddad2. -Ramnivas On Wed, Sep 23, 2009 at 2:59 AM,

Re: [aspectj-users] selecting join points using annotations

2009-09-20 Thread Ramnivas Laddad
. Thank you Ramnivas /robert - Original Message - *From:* Ramnivas Laddad ramni...@aspectivity.com *To:* aspectj-users@eclipse.org *Sent:* Friday, September 18, 2009 11:51 PM *Subject:* Re: [aspectj-users] selecting join points using annotations This is easily possible: pointcut

Re: [aspectj-users] selecting join points using annotations

2009-09-18 Thread Ramnivas Laddad
This is easily possible: pointcut encryptionOp(String data) : execution(@Encrypt void *(String)) args(data); void around(String data) : encryption(data) { proceed(encrypt(data)); } pointcut decryptionOp() : execution(@Decrypt String *(..)); String around() : decryptionOp() { String

[aspectj-users] AspectJ in Action, second edition published

2009-09-09 Thread Ramnivas Laddad
Hi, It gives me immense pleasure to announce that AspectJ in Action, 2nd edition is now published (http://manning.com/laddad2/). This is a totally revised edition that covers all AspectJ 6 features including annotation-based @AspectJ syntax, load-time weaver, annotation-based crosscutting. It

Re: [aspectj-users] Is it possible to declare new constructors with @DeclareParens/@DeclareMixins?

2009-09-04 Thread Ramnivas Laddad
Yes, you can. For example, this is how you will introduce a no-arg constructor to the Account type. public Account.new() { ... } -Ramnivas 2009/9/4 João Gonçalves jocolimon...@gmail.com In traditional syntax, it is possible to declare members (fields, methods, and constructors) via

Re: [aspectj-users] Is @DeclareParents the only way to make inter-type field declaration in @AspectJ notation

2009-08-31 Thread Ramnivas Laddad
Due to the constraint that code must be compilable with 'javac', @DeclareMixin/@DeclareParents in the only way. -Ramnivas 2009/8/31 João Gonçalves jocolimon...@gmail.com Greetings, I have a small doubt. In AspectJ's traditional notation, it is possible to declare a new field for a type this

Re: [aspectj-users] adding advice to 3rd party code

2009-08-05 Thread Ramnivas Laddad
You can use binary weaving to weave into third-party jars. Take a look at the -inpath option to ajc. -Ramnivas On Wed, Aug 5, 2009 at 3:18 PM, dan.lipof...@wellsfargo.com wrote: Is there a way I can put advice on code that is not mine (3rd party code already compiled in a JAR)? Use case:

Re: [aspectj-users] How to create conditional ITDs?

2009-08-04 Thread Ramnivas Laddad
Take a look at -Xhasmember option to ajc. You should be able to do something along the following lines: interface NeedsPrePersist { } declare parents: !hasfield(@PrePersist * *) (@Entity *) extends NeedPrePersist; Then introduce fields and methods to only types that implement NeedPrePersist.

Re: [aspectj-users] AspectJ runtime weaving aspects not declared in aop.xml

2009-07-29 Thread Ramnivas Laddad
I agree that the error message from Spring about the treatment of aspects compiled with 'ajc' could be improved. If you can file a JIRA issue (for Spring), that will be great. As for LTW picking up @Aspect aspects, it shouldn't really happen; only aspects that are declared in aop,xml (and

Re: [aspectj-users] Misunderstanding : execution pointcut with thisJoinPointStaticPart and thisEnclosingJoinPointStaticPart

2009-07-21 Thread Ramnivas Laddad
This is the expected behavior. For an execution join point, there is no lexical enclosing join point, hence it is the same as thisJoinPointStaticPart. -Ramnivas On Tue, Jul 21, 2009 at 1:11 AM, jeanlouis.pastu...@orange-ftgroup.comwrote: I misunderstand the returns of ( I construct a

Re: [aspectj-users] Softened exceptions

2009-07-21 Thread Ramnivas Laddad
You should be able to do the following: declare soft : Exception ! InterruptedException: pointcut; -Ramnivas On Tue, Jul 21, 2009 at 7:55 AM, Ashley Williams ashpub...@mac.com wrote: Hi, When using the declare soft feature, is it possible to exclude certain exceptions? I would like to

Re: [aspectj-users] JBOSS, LTW and SDK1.4.2

2009-07-16 Thread Ramnivas Laddad
using Java 4? Thanks. J.Lu *From:* aspectj-users-boun...@eclipse.org [mailto: aspectj-users-boun...@eclipse.org] *On Behalf Of *Ramnivas Laddad *Sent:* Wednesday, July 15, 2009 7:44 PM *To:* aspectj-users@eclipse.org *Subject:* Re: [aspectj-users] JBOSS, LTW and SDK1.4.2

Re: [aspectj-users] JBOSS, LTW and SDK1.4.2

2009-07-15 Thread Ramnivas Laddad
This looks like a classloader issue. The aj.bat approach was meant mainly for standalone applications and hasn't worked well with app/web servers due to the classloading schemes they employ. Can you try running the same server on Java 5 or 6 and pass it the -javaagent:/path/to/aspectjweaver.jar.

Re: [aspectj-users] AspectJ run-time licensing

2009-07-13 Thread Ramnivas Laddad
I am not a lawyer, but I do not think there are any restrictions on redistributing aspectjrt.jar (or any of the the AspectJ jars). For example, aspectjrt.jar is distributed with many SpringSource products (open source as well as commercial). -Ramnivas On Mon, Jul 13, 2009 at 1:59 PM, Jacob Bower

Re: [aspectj-users] is the source and target properties mandatory on the iajc task

2009-06-25 Thread Ramnivas Laddad
This is a manifestation of another underlying issue outlined in https://bugs.eclipse.org/bugs/show_bug.cgi?id=129989. For now, you need to specify target and sources. As an aside, I think specifying an explicit target and source level is a good idea in any case. Even

Re: [aspectj-users] is the source and target properties mandatory on the iajc task

2009-06-25 Thread Ramnivas Laddad
I agree that the default iajc behavior should match that of javac (although, we will need to be careful here, since this will break existing builds). I was just pointing that relying on default behavior isn't a best practice. For example, when we build the Spring Framework, we explicitly set the

Re: [aspectj-users] Intercepting constructors that handle exceptions

2009-06-12 Thread Ramnivas Laddad
I am not entirely sure about the question, but I think you need something along the following lines: void around(Object uc, File f) throws Exception : Test(uc,f) { try { proceed(uc, f); } catch (Exception ex) { ... your exception processing logic } }

Re: [aspectj-users] AspectJ compile-time weaving in Maven not working

2009-05-25 Thread Ramnivas Laddad
Nothing jumps out from your Maven snippet. I am not a Maven expert, but the following snippet works for me: build plugins plugin groupIdorg.codehaus.mojo/groupId artifactIdaspectj-maven-plugin/artifactId executions

Re: [aspectj-users] AspectJ 1.6.4 released

2009-05-10 Thread Ramnivas Laddad
I now see it in the Maven central repository. Thanks Andy, Simone, and Calros for taking care of this. -Ramnivas On Sat, May 9, 2009 at 5:11 PM, Ramnivas Laddad ramni...@aspectivity.com wrote: Looks like Carlos Sanchez just fixed this (thanks, Carlos). -Ramnivas On Sat, May 9, 2009 at 5:04

Re: [aspectj-users] AspectJ 1.6.4 released

2009-05-09 Thread Ramnivas Laddad
Can everyone on the list (especially those who want to/may want to use Maven with AspectJ) please vote for the bug that Simone has added (http://jira.codehaus.org/browse/MAVENUPLOAD-2433). Hopefully, it will help in getting attention and a quicker resolution. Thanks. -Ramnivas On Wed, Apr 22,

Re: [aspectj-users] pertarget instantiation within

2009-04-19 Thread Ramnivas Laddad
I am not sure if I understand the question. What is the use case you are trying to implement? -Ramnivas 2009/4/18 Adam Przybylek a...@univ.gda.pl: aspect XYZ pertarget(target(SomeClass) !within(XYZ)) {  protected SomeClass sm;  public XYZ() {    sm = new SomeClass();  } } I would like

Re: [aspectj-users] Type introspection using joinpoints

2009-03-22 Thread Ramnivas Laddad
Take a look at how the Spring framework uses classpath scanning to implement a similar idea. In its case, it uses classpath scanning along with autowiring to compose the application. -Ramnivas On Sun, Mar 22, 2009 at 4:38 AM, Ruben Vermeersch ru...@savanne.be wrote: Hi, I am currently working

Re: [aspectj-users] How to delete a method

2009-03-16 Thread Ramnivas Laddad
You can't delete method, but advise it to bypass the original code: void around() : execution(* MyClass.finalize()) { ... no proceed() here } -Ramnivas On Mon, Mar 16, 2009 at 9:16 PM, gpa...@tsys.com wrote: Hi I am working with a third party jar that seems to have classes that override

Re: [aspectj-users] Does target() work when calling static methods

2009-03-09 Thread Ramnivas Laddad
That is correct interpretation. target() and this() work only for non-static methods. -Ramnivas On Mon, Mar 9, 2009 at 4:16 AM, Jochen Wuttke jochen.wut...@gmx.de wrote: Hi, I have an aspect that does not do what I expect. The pointcut looks like this:    pointcut initMethod():

Re: [aspectj-users] Exceptions

2009-03-05 Thread Ramnivas Laddad
See another email thread for a solution. In future, AspectJ may offer a better solution. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=240608 -Ramnivas On Thu, Mar 5, 2009 at 5:01 PM, Andrica Silviu silviu.andr...@epfl.ch wrote: Hello,  I was hoping you could help me with a problem I

Re: [aspectj-users] within aspect or class

2009-02-18 Thread Ramnivas Laddad
You may do something like: set(* *) this(BaseClass) -Ramnivas On Wed, Feb 18, 2009 at 8:53 AM, Michael McCray m...@objectnirvana.com wrote: Hi All, When I use within(...), for an aspect that is introducing a method to another class, it seems that the within applies to the aspect as opposed

Re: [aspectj-users] Re: Why are you using LTW?

2009-02-14 Thread Ramnivas Laddad
PM, Ramnivas Laddad wrote: Most use LTW as an easy way to get started with AspectJ (no build script modifications). A few also need to weave into container classes and LTW seems easier than performing offline binary weaving and replacing original jars with woven jars. If that is not required

Re: [aspectj-users] Why are you using LTW?

2009-02-10 Thread Ramnivas Laddad
Most use LTW as an easy way to get started with AspectJ (no build script modifications). A few also need to weave into container classes and LTW seems easier than performing offline binary weaving and replacing original jars with woven jars. If that is not required, many eventually move over to

Re: [aspectj-users] WebLogic 9.2 + AspectJ = boom?

2009-02-06 Thread Ramnivas Laddad
The reason I am curious is the fact that the EAR deploys perfectly on one 9.2 cluster, but not another. I am perhaps stating the oblivious, but there must be some difference between the two clusters. That difference seems to be coming into the play. -Ramnivas On Fri, Feb 6, 2009 at 1:36 PM,

Re: [aspectj-users] advices for methods from packaged classes

2008-12-11 Thread Ramnivas Laddad
Yes, you can use binary weaving to weave into third-party jars. Check documentation for ajc, particularly around the -injar option. -Ramnivas On Thu, Dec 11, 2008 at 9:19 PM, miro miroconn...@yahoo.com wrote: Is it possible to advice on a method call of a class which is packged in a jar

Re: [aspectj-users] using @declaredParents for annotations

2008-12-11 Thread Ramnivas Laddad
On Thu, Dec 11, 2008 at 10:12 PM, miro miroconn...@yahoo.com wrote: I want to use @decalredParents for an annotation my aspect @DeclareParents(@annotation(gov.hhs.acf.aop.aspects.WorkflowAware), defaultImpl=DefaultWorkflowMetaData.class) public static

Re: [aspectj-users] using @declaredParents for annotations

2008-12-11 Thread Ramnivas Laddad
tell me how to use an annotation as a jointpoint Ramnivas Laddad wrote: On Thu, Dec 11, 2008 at 10:12 PM, miro miroconn...@yahoo.com wrote: I want to use @decalredParents for an annotation my aspect @DeclareParents(@annotation(gov.hhs.acf.aop.aspects.WorkflowAware

Re: R: Re: [aspectj-users] ITD syntax

2008-12-08 Thread Ramnivas Laddad
On Mon, Dec 8, 2008 at 2:30 PM, Andy Clement [EMAIL PROTECTED] wrote: I like the idea of simplifying the syntax but I keep changing my mind over the syntax I most prefer. It is probably this actually: intertype(AnotherClass){ public String someVar; public String

Re: R: Re: [aspectj-users] ITD syntax

2008-12-08 Thread Ramnivas Laddad
On second thought, I think option 1 is not good. It is very likely to confuse users: besides confusion bought by two usage of within(), the within(AnotherClass) pointcut won't select bulk ITDs introduced through within(AnotherClass) {...}. -Ramnivas On Mon, Dec 8, 2008 at 3:03 PM, Ramnivas

Re: R: Re: [aspectj-users] ITD syntax

2008-12-05 Thread Ramnivas Laddad
That's quite a good discussion we've had! There are indeed two different model for implementation for ITDs as Herman distilled well: the classic member introduction (the current code-style AspectJ model and Dave's original proposal) and delegation model (the one implemented in @AspectJ's

Re: R: Re: [aspectj-users] ITD syntax

2008-12-05 Thread Ramnivas Laddad
, Ramnivas Laddad wrote: That's quite a good discussion we've had! There are indeed two different model for implementation for ITDs as Herman distilled well: the classic member introduction (the current code-style AspectJ model and Dave's original proposal) and delegation model (the one

Re: [aspectj-users] ITD syntax

2008-12-04 Thread Ramnivas Laddad
I like this proposal. Here is an alternative syntax suggestion that - addresses Dave's use case - addresses a use case that is easy to implement in @AspectJ but not in code style - avoids new keywords public aspect ITDAspect{ /* don't have define the class here, don't need to make it

Re: [aspectj-users] Basic AspectJ question

2008-12-04 Thread Ramnivas Laddad
You need to modify your aspect : aspect PathChannelHack { after(PathChanInst pathchannel) : set(private CircPathInst parentPathInst) this(pathchannel) { pathchannel.setParentPathHumid(pathchannel.getParentPathInst().getPathHumId()); } } I suggest that you get this

Re: [aspectj-users] Introducing JDT Weaving

2008-12-03 Thread Ramnivas Laddad
This is wonderful! Updating as I write. -Ramnivas On Wed, Dec 3, 2008 at 9:58 AM, Simone Gianni [EMAIL PROTECTED] wrote: Andrew Eisenberg wrote: Hi all, We would like to introduce the latest developments for AJDT. We will be release some exciting new features including Java searches that

Re: [aspectj-users] Problem with annotation pointcut in WebSpere

2008-11-26 Thread Ramnivas Laddad
WebSphere ships with an older version of aspectjrt.jar (in the lib directory). I wonder if that is causing the problem. You may want to try replacing it with a newer version. -Ramnivas On Wed, Nov 26, 2008 at 2:47 AM, [EMAIL PROTECTED] wrote: Hi I have an aspect that works just fine when run

Re: [aspectj-users] can arg names be accessed at a joinpoint?

2008-11-12 Thread Ramnivas Laddad
You get get the associated CodeSignature object as follows: CodeSignature codeSignature = (CodedSignature) thisJoinPoint.getSignature(); String[] argNames = codeSignature.getParameterNames(); -Ramnivas On Wed, Nov 12, 2008 at 10:48 PM, Owen Corpening [EMAIL PROTECTED]wrote: I am using a

Re: [aspectj-users] newbie question about @target

2008-11-04 Thread Ramnivas Laddad
You probably need to use the following pointcut: execution(@Loggable * *.*(..)) || execution(* (@Loggable *).*(..)) -Ramnivas On Tue, Nov 4, 2008 at 8:06 AM, Miguel Alcalde [EMAIL PROTECTED]wrote: Hi all. I'm trying to implement a declarative logging system. For that I have created

Re: [aspectj-users] Pointcuts as a type?

2008-11-01 Thread Ramnivas Laddad
A pointcut serves as an intermediate program construct so that AspectJ can weave crosscutting action at join points selected by it. Can you provide a use case that will benefit from implementing pointcuts as a Java type? -Ramnivas On Sat, Nov 1, 2008 at 10:18 AM, Piers Powlesland [EMAIL

Re: [aspectj-users] How can you access an aspect from a normal java class

2008-10-31 Thread Ramnivas Laddad
The code seems right. Check your import statements and/or your Eclipse setting (AspectJ nature, inclusion of TestAspect on source path, etc.) You may define pointcuts in a class (just as you would do in an aspect). Then you may refer to those pointcuts as MyClass.myPointcut(). -Ramnivas On Fri,

Re: [aspectj-users] Another ITD question

2008-10-31 Thread Ramnivas Laddad
:22 PDT From: Ramnivas Laddad [EMAIL PROTECTED] Subject: Behavior of super.method() w.r.t. introduced method in an interface To: [EMAIL PROTECTED] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: [EMAIL PROTECTED] Errors-To: [EMAIL PROTECTED] X-BeenThere: [EMAIL PROTECTED] X

Re: [aspectj-users] Method not visible using this in pointcut

2008-10-22 Thread Ramnivas Laddad
You may mark the aspect as 'privileged'. public privileged aspect ... { ... } Alternatively, you may use reflection along with the AccessibleObject.setAccessible() method. -Ramnivas On Wed, Oct 22, 2008 at 4:45 PM, Luiz Antonio Soares Filho [EMAIL PROTECTED] wrote: Hello, I have a join

Re: [aspectj-users] LTW and [Xlint:unmatchedSuperTypeInCall]

2008-10-19 Thread Ramnivas Laddad
You will need to specify the -nowarn option in the weaver section in aop.xml as follows: weaver option=-nowarn ... -Ramnivas On Sun, Oct 19, 2008 at 11:59 AM, Mauro Baluda [EMAIL PROTECTED] wrote: On Sun, Oct 19, 2008 at 5:04 PM, Andrew Eisenberg [EMAIL PROTECTED] wrote: Yes. Go into the

Re: [aspectj-users] question on ajlib:

2008-10-16 Thread Ramnivas Laddad
It looks like there is a bug in Log4jExecutionTracing. You need to change pertypewithin(Traced) to pettypewithin(Traced+) in Log4jExecutionTracing. Once I do that, I get the following output: trace enter: com.AjlibTest.DummyObject() , this: [EMAIL PROTECTED] trace exit:

Re: [aspectj-users] LTW and annotations

2008-10-02 Thread Ramnivas Laddad
I agree with Simone. There isn't a good way to effectively find out all aspects using some classpath scanning mechanism. Note, however, that there is an -outxml (or -outxmlfile file) option to 'ajc' that will create aop.xml with an entry for all aspects. -Ramnivas 2008/10/2 Simone Gianni [EMAIL

Re: [aspectj-users] Aspect Weaving GlassFish and Errors

2008-09-24 Thread Ramnivas Laddad
Indeed, either replace the first '*' with 'public' or remove the first '*' altogether (reason: constructor pattern should not specify a return type). -Ramnivas On Wed, Sep 24, 2008 at 8:27 AM, Dean Wampler [EMAIL PROTECTED]wrote: Try replacing the first '*' in each expression with public. It's

Re: [aspectj-users] Pointcut based on field annotation

2008-08-05 Thread Ramnivas Laddad
or feedback on this idea. Without this type of behavior, I cannot implement my thesis using aspectj entirely, much to my dismay :) Thanks, Mike Ramnivas Laddad wrote: It is not currently possible with AspectJ. One problem with such potential pointcut is difficulty in supporting

Re: [aspectj-users] Pointcut based on field annotation

2008-08-04 Thread Ramnivas Laddad
It is not currently possible with AspectJ. One problem with such potential pointcut is difficulty in supporting correct semantics. For example, consider what should happen in the following cases: 1. item.values.add(foo); // should this be advised? 2. CollectionString values =

Re: [aspectj-users] Bug: Internal error in aspectj

2008-07-25 Thread Ramnivas Laddad
As a first step, you might want to try 1.6.1 (final, you seem to be using the rc release). If you still see the problem, it is best to open a bug. -Ramnivas On Fri, Jul 25, 2008 at 4:41 PM, 100ji [EMAIL PROTECTED] wrote: Hi all, I am instrumenting java.io.PrintWriter.println() call in an

Re: [aspectj-users] LTW+cflow+after/arround advice

2008-07-24 Thread Ramnivas Laddad
It is a known weaver limitation (there is a bug report with full details). You will need to add something like: ' execution(* *(..))' to your pointcut to select method execution join points (and avoid selecting handler join points). In any case, your description specifies that you need to profile

  1   2   >