Or you could use com.nested.my.concurrent.*.* (depending on your needs - Alexanders will choose everything below the prefix, the .*.* is more selective). If you want to you can also combine it with the type category type pattern:
"com.nested.my.concurrent.*.* && is(InnerType)" "com.nested.my.concurrent..* && is(InnerType)" cheers, Andy On 2 April 2013 07:51, Alexander Kriegisch <alexan...@kriegisch.name> wrote: > com.nested.my.concurrent.* > > > No, this does neither capture inner classes nor classes in subpackages. > You can capture both with > > com.nested.my.concurrent..* > > If you need to be more specific, you can still concatenate subconditions > with "||". > > > Alexander Kriegisch > > Am 02.04.2013 um 16:23 schrieb Jean Andre <jean.an...@intact.net>: > > Hello Andy, > > Thank you very much for your answer. I've studied your code. It does not > work from our side because we do not specify a particular class but all > classes from a specific packages. We use "com.nested.my.concurrent.*"which > means for us, If I do not make a mistake, all classes from this > package ? and then also the inner classes. But it seems it does not work > like this. > > So the other question, does it mean we have to declare in a separate > aspect (physical file) to avoid such duplicate mixin because in the code > below, the class CiaWebThreadFactory has 2 mixins - One from the > "com.nested.my.concurrent.*" and the second from > "com.nested.my.concurrent.CiaWebThreadFactory.*" > > Then does it means there is no syntax to targeted class and inner class > at the same time by specifying only "all.classes.from.this.package.*" ? > > > @Aspect > *public* *class* LoggingConcurrentBehavior *extends* LoggingBaseBehavior { > > @DeclareMixin("com.nested.my.concurrent.*") > *public* *static* Loggable createLoggerDelegate(Object o) { > *return* *new* ServantLogger(o.getClass()); > } > > @DeclareMixin("com.nested.my.concurrent.CiaWebThreadFactory.*") > *public* *static* Loggable createLoggerDelegate2(Object o) { > *return* *new* ServantLogger(o.getClass()); > } > > > Regards, > > Jean ANDRÉ > > > > > > De : Andy Clement <andrew.clem...@gmail.com> > A : aspectj-users@eclipse.org, > Date : 2013-04-01 11:05 > Objet : Re: [aspectj-users] @DeclareMixin with inner class - > Syntax ? > Envoyé par : aspectj-users-boun...@eclipse.org > ------------------------------ > > > > Sorry I didn't reply earlier, I was at eclipsecon. I tried to scaffold > your situation but it just works for me. Are you loadtime weaving or > compile time weaving? Here is my complete code: > > === CiaWebThreadFactory.java > package com.foo.bar; > > public class CiaWebThreadFactory { > public static void main(String []argv) { > new CiaWebThreadGroup().foo(); > System.out.println("works"); > } > > static class CiaWebThreadGroup { > public void foo() { > Loggable cwtg = ((Loggable)new CiaWebThreadGroup()); > cwtg.log("hello"); > } > } > } > === Loggable.java > package com.foo.bar; > interface Loggable { > void log(String msg); > } > === ServantLogger.java > package com.foo.bar; > > class ServantLogger implements Loggable { > public ServantLogger(Class clazz) { > System.out.println("ServantLogger for "+clazz.getName()); > } > public void log(String message) { System.out.println(message);} > } > === LoggingConcurrentBehaviour.java > package com.foo.bar; > import org.aspectj.lang.annotation.*; > > @Aspect > class LoggingConcurrentBehaviour { > //works: > @DeclareMixin("com.foo.bar.CiaWebThreadFactory.CiaWebThreadGroup") > @DeclareMixin("com.foo.bar.CiaWebThreadFactory.*") > public static Loggable createLoggerDelegate(Object o) { > return new ServantLogger(o.getClass()); > } > } > === > > > ajc -1.5 *.java -d . -showWeaveInfo > Mixing interface 'com.foo.bar.Loggable' (LoggingConcurrentBehaviour.java) > into type 'com.foo.bar.CiaWebThreadFactory$CiaWebThreadGroup' > (CiaWebThreadFactory.java) > Type 'com.foo.bar.CiaWebThreadFactory$CiaWebThreadGroup' > (CiaWebThreadFactory.java) has intertyped method from > 'com.foo.bar.LoggingConcurrentBehaviour' > (LoggingConcurrentBehaviour.java:'void > com.foo.bar.Loggable.log(java.lang.String)') > > and then when I run it: > > java com.foo.bar.CiaWebThreadFactory > ServantLogger for com.foo.bar.CiaWebThreadFactory$CiaWebThreadGroup > hello > works > > In terms of mixin pattern matching I was using: > @DeclareMixin("com.foo.bar.CiaWebThreadFactory.*") > > and that was fine (as you can see from the weave info messages). > > I tried AspectJ 1.7.2 and 1.6.12 - worked on both. > > If you can perhaps edit my code to be more representative of your failing > sample, I could investigate further. I wouldn't be surprised if there were > inner class problems (I half expected my code to fail) but at the moment > I'm not having luck finding problems. > > cheers > Andy > > > On 25 March 2013 10:07, Jean Andre > <*jean.an...@intact.net*<jean.an...@intact.net>> > wrote: > Hello, > > A quick question, is it possible to declare Mixin (@DeclareMixin) in > order to have it in inner class ? If yes, we have difficulty to find the > right syntax. > We use aspectJ 1.6.12 under WAS 8.0.0.3 > > Here is our stuff - The mixin is perform well for the class > *CiaWebThreadFactory > but *not for the inner class. We have tried different syntax without any > success. > > Any help ? - and if we have several inner class, is there a shortcu to > catch all of them in a single syntax ? > > Thank you very much. > > > JA > > =========================================== > THE ANNOTATED ASPECT > =========================================== > @Aspect * > public* *class* LoggingConcurrentBehavior *extends* LoggingBaseBehavior { > > @DeclareMixin("com.intact.my.concurrent.*") > *public* *static* Loggable createLoggerDelegate(Object o) { > *return* *new* ServantLogger(o.getClass()); > } > > ..... > > } > > * > package* com.intact.my.concurrent; > > ==================================================== > THE INNER CLASS TO CATCH WITH ASPECT > ==================================================== > * > public* *final* *class* CiaWebThreadFactory *implements* ThreadFactory { > /** > * The name of the thread group. e.g: CiaWebGroup > * *@see* java.lang.ThreadGroup > */ > *private* *final* ThreadGroup threadGroup; > > /** > > > ..... > > } > > *public* *static* *final class* CiaWebThreadGroup > *extends*ThreadGroup { > *public* *void* uncaughtException(Thread t, Throwable e) { > // AspectJ point cut - Please, do not remove - > Log4J here. > } > } > } > > _______________________________________________ > aspectj-users mailing list* > **aspectj-users@eclipse.org* <aspectj-users@eclipse.org>* > **https://dev.eclipse.org/mailman/listinfo/aspectj-users*<https://dev.eclipse.org/mailman/listinfo/aspectj-users> > > _______________________________________________ > aspectj-users mailing list > aspectj-users@eclipse.org > https://dev.eclipse.org/mailman/listinfo/aspectj-users > > _______________________________________________ > aspectj-users mailing list > aspectj-users@eclipse.org > https://dev.eclipse.org/mailman/listinfo/aspectj-users > > > _______________________________________________ > aspectj-users mailing list > aspectj-users@eclipse.org > https://dev.eclipse.org/mailman/listinfo/aspectj-users > >
_______________________________________________ aspectj-users mailing list aspectj-users@eclipse.org https://dev.eclipse.org/mailman/listinfo/aspectj-users