Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » Problem with AspectJ syntax: "no match for this type name"
Problem with AspectJ syntax: "no match for this type name" [message #41787] Mon, 04 October 2004 10:09 Go to next message
Michael Moser is currently offline Michael MoserFriend
Messages: 914
Registered: July 2009
Senior Member
Hi all,
sorry for this probably stupid append, but occasionally I still have a
hard time to master the AspectJ syntax and run into weird problems:

I am trying to specify a very simple log-aspect:

For this I defined:
-----------------
....
pointcut loggedMethods():
(execution(* package1.*.*(..))
||
execution(* package2.*.*(..))
||
execution(* package3.SpecificClassNameHere.*(..))
);
....
-----------------

i.e. I want to log ALL methods from ALL classes in package1 and
package2 and I want log ALL methods from just a SPECIFIC class in
package3.

I always get a "no match for this type name" on the last line (the
"execution(* package3.SpecificClassNameHere.*(..))") even though by
now I checked and double-checked and tripple-checked and
quadruple-checked ... the package and class name and I am 100% sure
that they are correct and the same in the aspect as well as in the
java source file.

According to "AspectJ in Action" page 71, chapter 3, table 3.3
[Examples of method signatures] this should be the correct syntax to
match all methods within a specific class. What am I doing wrong???
Why does this not match my class?

Michael
Re: Problem with AspectJ syntax: "no match for this type name" [message #41843 is a reply to message #41787] Mon, 04 October 2004 10:41 Go to previous messageGo to next message
Michael Moser is currently offline Michael MoserFriend
Messages: 914
Registered: July 2009
Senior Member
BTW: I just noticed, that adding a "*" makes the problem go away:

i.e. if I instead of
-----------------
....
execution(* package3.SpecificClassNameHere.*(..))
....
-----------------

write:
-----------------
....
execution(* package3.SpecificClassNameHere*.*(..))
....
-----------------

then my class finally matches. But IMHO this is of course NOT, what
one wants, since this could potentially also match other classes.

Appears to be a bug in the pattern matching to me...

Michael
Re: Problem with AspectJ syntax: "no match for this type name" [message #41875 is a reply to message #41843] Mon, 04 October 2004 12:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mchapman.uk.ibm.com

Hi Michael,

If you match against "Hello*.*" then you don't get a warning, but
if you do "Hello.*" you get the "no match for this type name"
warning, if the aspect cannot resolve the "Hello" type. So wildcards
are treated differently to absolute type names. In this case you
would need to tell the compiler which Hello you are referring so,
with something like "import foo.Hello;"

That doesn't however seem to completely explain the problem you are
seeing. The compiler is telling you it cannot resolve the
package3.SpecificClassNameHere class, despite it being qualified with
the package name. Could there perhaps be something unusual with your
project setup or layout? What happens if you refer to that class
from elsewhere in the aspect (from advice or a method)?

Regards,

Matt.

On Mon, 04 Oct 2004 12:41:12 +0200, Michael Moser wrote:
> BTW: I just noticed, that adding a "*" makes the problem go away:
>
> i.e. if I instead of
> -----------------
> ...
> execution(* package3.SpecificClassNameHere.*(..))
> ...
> -----------------
>
> write:
> -----------------
> ...
> execution(* package3.SpecificClassNameHere*.*(..))
> ...
> -----------------
>
> then my class finally matches. But IMHO this is of course NOT, what one
> wants, since this could potentially also match other classes.
>
> Appears to be a bug in the pattern matching to me...
>
> Michael
Re: Problem with AspectJ syntax: "no match for this type name" [message #41904 is a reply to message #41875] Mon, 04 October 2004 14:38 Go to previous messageGo to next message
Michael Moser is currently offline Michael MoserFriend
Messages: 914
Registered: July 2009
Senior Member
Hi Matt,

I'm afraid, I have modified a different major "parameter" in the
meantime (i.e. I installed 1.2M1 instead of 1.1.11) and in this
version I don't see these problems any more. I hope that is "good
news" for you even though we now haven't really nailed down that
bug...

Michael

"Matt Chapman" <mchapman@uk.ibm.com> wrote in message
news:pan.2004.10.04.12.42.44.93531@uk.ibm.com...
> ...
> That doesn't however seem to completely explain the problem you are
> seeing. The compiler is telling you it cannot resolve the
> package3.SpecificClassNameHere class, despite it being qualified
with
> the package name. Could there perhaps be something unusual with your
> project setup or layout? What happens if you refer to that class
> from elsewhere in the aspect (from advice or a method)?
>
> Regards,
>
> Matt.
> ...
Re: Problem with AspectJ syntax: "no match for this type name" [message #41935 is a reply to message #41904] Mon, 04 October 2004 15:08 Go to previous message
Eclipse UserFriend
Originally posted by: mchapman.uk.ibm.com

On Mon, 04 Oct 2004 16:38:44 +0200, Michael Moser wrote:
> I'm afraid, I have modified a different major "parameter" in the meantime
> (i.e. I installed 1.2M1 instead of 1.1.11) and in this version I don't see
> these problems any more. I hope that is "good news" for you even though we
> now haven't really nailed down that bug...

Hi Michael,

I guess it's good news, at least your upgrade made things better! We'll
have to see if anyone else encounters the problem on 1.1.11/1.1.12.

I will just add a note of caution - we haven't declared 1.2M1 as yet, as
we still have some fixes to make and testing to complete. You are running
a development build, which is hopefully close to the final 1.2M1 version.
Please still report any problems you find, but make sure you give the full
build identifier.

Regards,

Matt.
Re: Problem with AspectJ syntax: "no match for this type name" [message #583665 is a reply to message #41787] Mon, 04 October 2004 10:41 Go to previous message
Michael Moser is currently offline Michael MoserFriend
Messages: 914
Registered: July 2009
Senior Member
BTW: I just noticed, that adding a "*" makes the problem go away:

i.e. if I instead of
-----------------
....
execution(* package3.SpecificClassNameHere.*(..))
....
-----------------

write:
-----------------
....
execution(* package3.SpecificClassNameHere*.*(..))
....
-----------------

then my class finally matches. But IMHO this is of course NOT, what
one wants, since this could potentially also match other classes.

Appears to be a bug in the pattern matching to me...

Michael
Re: Problem with AspectJ syntax: "no match for this type name" [message #583684 is a reply to message #41843] Mon, 04 October 2004 12:42 Go to previous message
Matt Chapman is currently offline Matt ChapmanFriend
Messages: 429
Registered: July 2009
Senior Member
Hi Michael,

If you match against "Hello*.*" then you don't get a warning, but
if you do "Hello.*" you get the "no match for this type name"
warning, if the aspect cannot resolve the "Hello" type. So wildcards
are treated differently to absolute type names. In this case you
would need to tell the compiler which Hello you are referring so,
with something like "import foo.Hello;"

That doesn't however seem to completely explain the problem you are
seeing. The compiler is telling you it cannot resolve the
package3.SpecificClassNameHere class, despite it being qualified with
the package name. Could there perhaps be something unusual with your
project setup or layout? What happens if you refer to that class
from elsewhere in the aspect (from advice or a method)?

Regards,

Matt.

On Mon, 04 Oct 2004 12:41:12 +0200, Michael Moser wrote:
> BTW: I just noticed, that adding a "*" makes the problem go away:
>
> i.e. if I instead of
> -----------------
> ...
> execution(* package3.SpecificClassNameHere.*(..))
> ...
> -----------------
>
> write:
> -----------------
> ...
> execution(* package3.SpecificClassNameHere*.*(..))
> ...
> -----------------
>
> then my class finally matches. But IMHO this is of course NOT, what one
> wants, since this could potentially also match other classes.
>
> Appears to be a bug in the pattern matching to me...
>
> Michael
Re: Problem with AspectJ syntax: "no match for this type name" [message #583696 is a reply to message #41875] Mon, 04 October 2004 14:38 Go to previous message
Michael Moser is currently offline Michael MoserFriend
Messages: 914
Registered: July 2009
Senior Member
Hi Matt,

I'm afraid, I have modified a different major "parameter" in the
meantime (i.e. I installed 1.2M1 instead of 1.1.11) and in this
version I don't see these problems any more. I hope that is "good
news" for you even though we now haven't really nailed down that
bug...

Michael

"Matt Chapman" <mchapman@uk.ibm.com> wrote in message
news:pan.2004.10.04.12.42.44.93531@uk.ibm.com...
> ...
> That doesn't however seem to completely explain the problem you are
> seeing. The compiler is telling you it cannot resolve the
> package3.SpecificClassNameHere class, despite it being qualified
with
> the package name. Could there perhaps be something unusual with your
> project setup or layout? What happens if you refer to that class
> from elsewhere in the aspect (from advice or a method)?
>
> Regards,
>
> Matt.
> ...
Re: Problem with AspectJ syntax: "no match for this type name" [message #583707 is a reply to message #41904] Mon, 04 October 2004 15:08 Go to previous message
Matt Chapman is currently offline Matt ChapmanFriend
Messages: 429
Registered: July 2009
Senior Member
On Mon, 04 Oct 2004 16:38:44 +0200, Michael Moser wrote:
> I'm afraid, I have modified a different major "parameter" in the meantime
> (i.e. I installed 1.2M1 instead of 1.1.11) and in this version I don't see
> these problems any more. I hope that is "good news" for you even though we
> now haven't really nailed down that bug...

Hi Michael,

I guess it's good news, at least your upgrade made things better! We'll
have to see if anyone else encounters the problem on 1.1.11/1.1.12.

I will just add a note of caution - we haven't declared 1.2M1 as yet, as
we still have some fixes to make and testing to complete. You are running
a development build, which is hopefully close to the final 1.2M1 version.
Please still report any problems you find, but make sure you give the full
build identifier.

Regards,

Matt.
Previous Topic:AJDT fiddling with the Java Build path?
Next Topic:type is not exposed to the weaver???
Goto Forum:
  


Current Time: Tue Mar 19 04:31:33 GMT 2024

Powered by FUDForum. Page generated in 0.02458 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top