Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Problems with a basic staticinitialization pointcut in AJDT and Maven

Hi,

I think you're probably right about the annotations. In the tests, I'm just mentioning them by name with their .class object, such as "myAnnotation.class". It's unfortunate the aspect doesn't trigger then, but I can work around it. There are hits on Google for 'is missing <clinit>', but only one for 'AspectJ "is missing <clinit>"'. I couldn't figure it out based on the hits. Yes, when I remove the staticinitialization aspect, it compiles. I'm compiling all the annotations from source, if that's what you mean.

Thanks,
Tim


On 10/25/2012 08:21 PM, Andy Clement wrote:
Hi,

You will only see your message when the static initializer runs. The
class may get loaded and used (to some degree) without that happening.
  For example, here are some simple types:

@Retention(RetentionPolicy.RUNTIME)
@interface Foo {
}

public class Code {
   @Foo
   public static void main(String []argv) throws Exception {
   }
}

I can compile that and run 'Code' without the Foo static initializer running.

But if I change Code to do something with it, then we will see the
initializer running:

public class Code {
   @Foo
   public static void main(String []argv) throws Exception {
     Foo f = Code.class.getDeclaredMethod("main",String[].class).getAnnotation(Foo.class);
   }
}

Can it be that some of your code just isn't exercising the annotations
enough to see their static initializers run?

I've never seen the "is missing <clinit>" message before, but I see it
is classified as a bit odd:
https://forums.oracle.com/forums/thread.jspa?messageID=4824974

I don't speak Maven very well - is AspectJ being used to build those
annotation types? (I'm not sure if you are building everything from
source or just weaving via a post compile step).

If you remove your aspect the "is missing" messages all disappear?

cheers,
Andy

On 25 October 2012 08:24, Timothy Armstrong <tim.armstrong@xxxxxxx> wrote:
Hello,

Thanks for your replies. Yes, I get the same behavior when I put version
1.6.11 in the POM, just without the "bad version number" warning. I should
have posted that version. I always get the "advice defined in ... has not
been applied" warnings for the other aspects, but they still work. It does
compile when I specify an annotation, such as
"staticinitialization(@OWLClass *)". I posted the only lines in the POM
having to do with AspectJ, so I don't know where else filters would be that
ignore the test tree.

Thanks,
Tim



On 10/25/2012 09:19 AM, Krzysztof Dębski wrote:
aspectj-maven-plugin doesn't support aspectj 1.7

see: http://jira.codehaus.org/browse/MASPECTJ-108

Krzysztof Debski

2012/10/24 Romain MULLER <romain.muller@xxxxxxxxx>:
I surely am no maven guru and I won't risk myself in trying to comment
your POM. That said, on the Maven error, I think the following line
could be of some relevance:

[WARNING] bad version number found in
/home/tim/.m2/repository/org/aspectj/aspectjrt/1.7.0/aspectjrt-1.7.0.jar
expected 1.6.11 found 1.7.0

This looks dodgy, I would try to arrange things so that this warning
isn't produced anymore before digging any further on the maven errors.

On the eclipse side, I'd recommend checking that your AspectJ compiler
options don't have filters that get your test tree ignored by the
compile-time weaver. I know it's kind of an "are you sure your
computer is plugged to a power socket" check, but they very often give
good results ;)

_________________________
Sent over RFC-1149 compliant transport - please excuse occasionnal packet
loss

Le 24 oct. 2012 à 22:08, Timothy Armstrong <tim.armstrong@xxxxxxx> a
écrit :

[WARNING] bad version number found in
/home/tim/.m2/repository/org/aspectj/aspectjrt/1.7.0/aspectjrt-1.7.0.jar
expected 1.6.11 found 1.7.0
_______________________________________________
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

_______________________________________________
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