|
|
Subject: Re: Xlint:adviceDidNotMatch with iajc source at 1.5 - msg#00087
I've dug out the bit in the doc
---
AspectJ 5 supports a new XLint warning, "the pointcut associated with
this advice does not match any join points". The warning is enabled by
default and will be emitted by the compiler if the pointcut expression
associated with an advice statement can be statically determined to
not match any join points.
---
It does mean the advice in your aspect will not execute as we couldn't
find anywhere to apply it.
cheers,
Andy
On 26/11/2007, Hartrey, Edel <Edel.Hartrey@xxxxxxx> wrote:
> Hi Andy,
>
> Thank you for your response. From what you have said it does sound
> feasible that the advice never matched and the new compiler setting is
> only showing it up now, although the code did execute as expected
> previously. Does the "adviceDidNotMatch" warning indicate that the
> aspect code will not execute as expected? What is this message really
> telling us?
>
> I've looked at the pointcuts in the code and there are no object
> parameters that have primitive equivelents, nor vice versa, so from your
> explanation I'm guessing that this means autoboxing could not be
> occurring? Please correct if I'm wrong with this.
>
> Thanks!
> -Edel
>
>
>
> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx
> [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Andy Clement
> Sent: Monday, November 26, 2007 4:17 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: Re: [aspectj-users] Xlint:adviceDidNotMatch with iajc source at
> 1.5
>
> Hi,
>
> The adviceDidNotMatch warning is an Xlint that is only produced when
> compiling in 'java5 mode' - and that is because when it gets
> irritating we provide an easy way to suppress it. The following
> annotation can be attached to advice to stop it coming out.
>
> @SuppressAjWarnings({"adviceDidNotMatch"})
>
> The warning is indicating that you have some advice that does not
> match and probably has never matched, you just never knew at Java1.4
> level.
>
> If it really did match at Java1.4 but is not at Java1.5 then the only
> thing that can affect a match is auto-boxing. Is it possible the
> joinpoints that are selected by your pointcuts could be getting
> autoboxing behaviour applied? ie. the auto promotion/demotion of
> primitive types to their object equivalents? (int<>Integer, etc).
>
> cheers,
> Andy.
>
> On 26/11/2007, Hartrey, Edel <Edel.Hartrey@xxxxxxx> wrote:
> > Hi there,
> >
> > I'm an AspectJ novice that has inherited some AspectJ code, and in the
> > process of an upgrade to Java 1.5 I've run into a problem that I would
> > greatly appreciate some insight into.
> >
> > The AspectJ code is only a small part of a larger codebase but it is
> > being moved from Java 1.4 to Java 1.5. When I compiled the code with
> > iajc (AspectJ 1.5.3), with source attribute set to 1.5, I got the
> > following error for each location where around advice is being applied
> > in the code:
> >
> > [warning] advice defined in com.xxx.xxx.StrutsInterceptor has not been
> > applied [Xlint:adviceDidNotMatch]
> >
> > The code compiles without error or warning on iajc with source level
> set
> > to 1.4.
> >
> > The ant task that runs this compile is defined as follows:
> > <iajc fork="true"
> > source="1.5"
> > deprecation="@{deprecation}"
> > debug="@{debug}"
> > X="noInline"
> > destdir="@{destdir}"
> > classpathref="@{classpathref}"
> > forkclasspathref="aspectj.classpath">
> > <sourceroots>
> > <pathelement location="${iajc.src.dir1}"/>
> > </sourceroots>
> > </iajc>
> >
> > Any insight is appreciated,
> > Kind regards,
> > - Edel
> >
> >
> >
> >
> > _______________________________________________
> > 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
>
Thread at a glance:
Previous Message by Date:
RE: Xlint:adviceDidNotMatch with iajc source at 1.5
Hi Andy,
Thank you for your response. From what you have said it does sound
feasible that the advice never matched and the new compiler setting is
only showing it up now, although the code did execute as expected
previously. Does the "adviceDidNotMatch" warning indicate that the
aspect code will not execute as expected? What is this message really
telling us?
I've looked at the pointcuts in the code and there are no object
parameters that have primitive equivelents, nor vice versa, so from your
explanation I'm guessing that this means autoboxing could not be
occurring? Please correct if I'm wrong with this.
Thanks!
-Edel
-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Andy Clement
Sent: Monday, November 26, 2007 4:17 PM
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] Xlint:adviceDidNotMatch with iajc source at
1.5
Hi,
The adviceDidNotMatch warning is an Xlint that is only produced when
compiling in 'java5 mode' - and that is because when it gets
irritating we provide an easy way to suppress it. The following
annotation can be attached to advice to stop it coming out.
@SuppressAjWarnings({"adviceDidNotMatch"})
The warning is indicating that you have some advice that does not
match and probably has never matched, you just never knew at Java1.4
level.
If it really did match at Java1.4 but is not at Java1.5 then the only
thing that can affect a match is auto-boxing. Is it possible the
joinpoints that are selected by your pointcuts could be getting
autoboxing behaviour applied? ie. the auto promotion/demotion of
primitive types to their object equivalents? (int<>Integer, etc).
cheers,
Andy.
On 26/11/2007, Hartrey, Edel <Edel.Hartrey@xxxxxxx> wrote:
> Hi there,
>
> I'm an AspectJ novice that has inherited some AspectJ code, and in the
> process of an upgrade to Java 1.5 I've run into a problem that I would
> greatly appreciate some insight into.
>
> The AspectJ code is only a small part of a larger codebase but it is
> being moved from Java 1.4 to Java 1.5. When I compiled the code with
> iajc (AspectJ 1.5.3), with source attribute set to 1.5, I got the
> following error for each location where around advice is being applied
> in the code:
>
> [warning] advice defined in com.xxx.xxx.StrutsInterceptor has not been
> applied [Xlint:adviceDidNotMatch]
>
> The code compiles without error or warning on iajc with source level
set
> to 1.4.
>
> The ant task that runs this compile is defined as follows:
> <iajc fork="true"
> source="1.5"
> deprecation="@{deprecation}"
> debug="@{debug}"
> X="noInline"
> destdir="@{destdir}"
> classpathref="@{classpathref}"
> forkclasspathref="aspectj.classpath">
> <sourceroots>
> <pathelement location="${iajc.src.dir1}"/>
> </sourceroots>
> </iajc>
>
> Any insight is appreciated,
> Kind regards,
> - Edel
>
>
>
>
> _______________________________________________
> 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
Next Message by Date:
Re: problem with declare annotation
The error would appear to be a real bug, I put everything into one file:
aspect ConfigureTracing {
declare @type : MyPojo : @Tracing(level = LoggingLevel.DEBUG);
// compile error!!!
declare @method : * MyPojo.calculate() : @TestAnnotation;
}
@interface Tracing { LoggingLevel level(); }
@interface TestAnnotation {}
class Level {
Level(int i) {}
public final static Level ALL = new Level(1);
public final static Level DEBUG = new Level(2);
public final static Level ERROR = new Level(3);
public final static Level FATAL = new Level(4);
public final static Level INFO = new Level(5);
public final static Level OFF = new Level(6);
public final static Level WARN = new Level(7);
}
enum LoggingLevel {
ALL(Level.ALL), DEBUG(Level.DEBUG), ERROR(Level.ERROR),
FATAL(Level.FATAL), INFO(
Level.INFO), OFF(Level.OFF), WARN(Level.WARN);
private final Level level;
private LoggingLevel(Level level) {
this.level = level;
}
public Level getLevel() {
return level;
}
}
class MyPojo {
public static void calculate() {
}
}
and it still fails with the error you describe. I have raised it on
bugzilla: https://bugs.eclipse.org/bugs/show_bug.cgi?id=211052
On the second situation, I don't think you can do what you want. You
can raise an enhancement request and we can look at implementing
something.
Andy.
On 26/11/2007, Ashley Williams <ashley.williams@xxxxxx> wrote:
>
> Hi,
>
> I'm trying to write a simple tracing annotation but have problems declaring
> it against a type due to compile errors. Basically I get the error depending
> on which combination of @Target annotation attributes I specify. For example
> TYPE and CONSTRUCTOR work together but not TYPE and METHOD as shown below. I
> would eventually like to apply the Tracing annotation to all ElementTypes.
>
> 1. The pojo I would like to declare the annotations against
>
> public class MyPojo {
> public static void calculate() {
> }
> }
>
>
> 2. The annotation I would like to apply is as follows:
>
> @Retention(RetentionPolicy.RUNTIME)
> @Target( { ElementType.TYPE, ElementType.METHOD})
> public @interface Tracing {
> LoggingLevel level() default LoggingLevel.DEBUG;
> }
>
>
> 3. The aspect that applies the annotation to MyPojo and MyPojo.calculate()
>
> public aspect ConfigureTracing {
> declare @type : MyPojo : @Tracing(level = LoggingLevel.DEBUG); //
> compile error!!!
> declare @method : * MyPojo.calculate() : @TestAnnotation;
> }
>
>
> 4. Here is the LoggingLevel enumeration I wrote, since I couldn't find one
> in log4j:
>
> public enum LoggingLevel {
> ALL(Level.ALL), DEBUG(Level.DEBUG), ERROR(Level.ERROR),
> FATAL(Level.FATAL), INFO(
> Level.INFO), OFF(Level.OFF), WARN(Level.WARN);
> private final Level level;
> private LoggingLevel(Level level) {
> this.level = level;
> }
> public Level getLevel() {
> return level;
> }
> }
>
> However when I compile it using aspectj tools 1.5.3 I get the following
> error message: "[ERROR] DEBUG cannot be resolved", which refers to my
> LoggingLevel.DEBUG enum constant. Could it be some sort of class loader
> issue where only some of my enumeration constants aren't yet available?
>
> As a bonus question, I would like to specify something like the
> ConfigureTracing aspect above in an aop.xml file for runtime weaving, this
> way I don't have to hard code the annotations at build time. However in the
> docs for aop.xml I couldn't find any way to declare annotations, so is there
> some other strategy I can use to achive this?
>
> Thanks for any help
> - Ashley
> ---
>
> This e-mail may contain confidential and/or privileged information. If you
> are not the intended recipient (or have received this e-mail in error)
> please notify the sender immediately and delete this e-mail. Any
> unauthorized copying, disclosure or distribution of the material in this
> e-mail is strictly forbidden.
>
> Please refer to
> http://www.db.com/en/content/eu_disclosures.htm for
> additional EU corporate and regulatory disclosures.
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
Previous Message by Thread:
RE: Xlint:adviceDidNotMatch with iajc source at 1.5
Hi Andy,
Thank you for your response. From what you have said it does sound
feasible that the advice never matched and the new compiler setting is
only showing it up now, although the code did execute as expected
previously. Does the "adviceDidNotMatch" warning indicate that the
aspect code will not execute as expected? What is this message really
telling us?
I've looked at the pointcuts in the code and there are no object
parameters that have primitive equivelents, nor vice versa, so from your
explanation I'm guessing that this means autoboxing could not be
occurring? Please correct if I'm wrong with this.
Thanks!
-Edel
-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Andy Clement
Sent: Monday, November 26, 2007 4:17 PM
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] Xlint:adviceDidNotMatch with iajc source at
1.5
Hi,
The adviceDidNotMatch warning is an Xlint that is only produced when
compiling in 'java5 mode' - and that is because when it gets
irritating we provide an easy way to suppress it. The following
annotation can be attached to advice to stop it coming out.
@SuppressAjWarnings({"adviceDidNotMatch"})
The warning is indicating that you have some advice that does not
match and probably has never matched, you just never knew at Java1.4
level.
If it really did match at Java1.4 but is not at Java1.5 then the only
thing that can affect a match is auto-boxing. Is it possible the
joinpoints that are selected by your pointcuts could be getting
autoboxing behaviour applied? ie. the auto promotion/demotion of
primitive types to their object equivalents? (int<>Integer, etc).
cheers,
Andy.
On 26/11/2007, Hartrey, Edel <Edel.Hartrey@xxxxxxx> wrote:
> Hi there,
>
> I'm an AspectJ novice that has inherited some AspectJ code, and in the
> process of an upgrade to Java 1.5 I've run into a problem that I would
> greatly appreciate some insight into.
>
> The AspectJ code is only a small part of a larger codebase but it is
> being moved from Java 1.4 to Java 1.5. When I compiled the code with
> iajc (AspectJ 1.5.3), with source attribute set to 1.5, I got the
> following error for each location where around advice is being applied
> in the code:
>
> [warning] advice defined in com.xxx.xxx.StrutsInterceptor has not been
> applied [Xlint:adviceDidNotMatch]
>
> The code compiles without error or warning on iajc with source level
set
> to 1.4.
>
> The ant task that runs this compile is defined as follows:
> <iajc fork="true"
> source="1.5"
> deprecation="@{deprecation}"
> debug="@{debug}"
> X="noInline"
> destdir="@{destdir}"
> classpathref="@{classpathref}"
> forkclasspathref="aspectj.classpath">
> <sourceroots>
> <pathelement location="${iajc.src.dir1}"/>
> </sourceroots>
> </iajc>
>
> Any insight is appreciated,
> Kind regards,
> - Edel
>
>
>
>
> _______________________________________________
> 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
Next Message by Thread:
How can I exclude class's in aspectJ pointcuts
Hello all
I like to advice all the class's under :
com.foo.test.* but NOT the classes under com.fo.test.security.*
How can I represent that with aspectJ pointcuts ?
|
|