Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] How do we declare multilple class in @DeclareParents ?

I'm getting exception from compiler

org.aspectj.weaver.BCException
at org.aspectj.weaver.patterns.ExactTypePattern.resolveBindings(ExactTypePattern.java:312)
at org.aspectj.weaver.patterns.OrTypePattern.resolveBindings(OrTypePattern.java:121)
at org.aspectj.weaver.bcel.AtAjAttributes.handleDeclareParentsAnnotation(AtAjAttributes.java:746)
at org.aspectj.weaver.bcel.AtAjAttributes.readAj5ClassAttributes(AtAjAttributes.java:384)
at org.aspectj.weaver.bcel.BcelObjectType.ens ... xt\sunmscapi.jar;C:\Program Files\Java\jre6\lib\ext\sunpkcs11.jar;C:\zapps\Eclipse\eclipse\\plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar;

Regards,





De :        Andy Clement <andrew.clement@xxxxxxxxx>
A :        aspectj-users@xxxxxxxxxxx
Date :        2012-05-02 13:44
Objet :        Re: [aspectj-users] How do we declare multilple class in @DeclareParents ?
Envoyé par :        aspectj-users-bounces@xxxxxxxxxxx




Hi,

What version of AspectJ are you using?

I just tried this (basically the same as yours) on 1.7.0 dev builds
and it was OK:


===== 8<==== Code2.java ===
package com;
import org.aspectj.lang.annotation.*;


class B {}
class C {}

@Aspect
class MoodIndicator {
 interface Moody {
   String getMood();
 };

 static class MoodyImpl implements Moody {
   public String getMood() { return "happy"; }
 }

 @DeclareParents(value="com.B || com.C", defaultImpl = MoodyImpl.class)
 private Moody implementedInterface;
}
===== 8<==== Code2.java ===
ajc -1.5 Code2.java -showWeaveInfo
Extending interface set for type 'com.B' (Code2.java) to include
'com.MoodIndicator$Moody' (Code2.java)
               
Type 'com.B' (Code2.java) has intertyped method from
'com.MoodIndicator' (Code2.java:'java.lang.String
com.MoodIndicator$Moody.getMood()')
               
Extending interface set for type 'com.C' (Code2.java) to include
'com.MoodIndicator$Moody' (Code2.java)
               
Type 'com.C' (Code2.java) has intertyped method from
'com.MoodIndicator' (Code2.java:'java.lang.String
com.MoodIndicator$Moody.getMood()')

I got exceptions (unexpected) when using it on 1.6.12/1.7.0.M1.

Are you getting exceptions or is it just not working?

cheers,
Andy

On 2 May 2012 06:22, Jean Andre <Jean.Andre@xxxxxxxxxx> wrote:
> How do we declare multilple class in @DeclareParents ?
>
> This syntaxe does not work :  @DeclareParents(value="com.c1 ||
> com.c2",defaultImpl=Implclass.class)
>
> Thank you
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
>
https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top