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> 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
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to