Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Errors in AOPMetrics

Hi !! All

When i tries to run aopmetrics.sh , i am geting the following errors. Any one who is good at java and AspectJ , please temm me , what must be the problem.

skotrappa@skotrappa-G31M-ES2L:~/AJHotDraw$ sh aopmetrics.sh
Exception in thread "main" java.lang.NoClassDefFoundError: org/tigris/aopmetrics/AopMetricsCLI
Caused by: java.lang.ClassNotFoundException: org.tigris.aopmetrics.AopMetricsCLI
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: org.tigris.aopmetrics.AopMetricsCLI. Program will exit.
skotrappa@skotrappa-G31M-ES2L:~/AJHotDraw$

Thanks

Regards

s kotrappa



On Fri, Dec 16, 2011 at 4:01 AM, <aspectj-users-request@xxxxxxxxxxx> wrote:
Send aspectj-users mailing list submissions to
       aspectj-users@xxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
       https://dev.eclipse.org/mailman/listinfo/aspectj-users
or, via email, send a message with subject or body 'help' to
       aspectj-users-request@xxxxxxxxxxx

You can reach the person managing the list at
       aspectj-users-owner@xxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of aspectj-users digest..."


Today's Topics:

  1. Re: Is it possible to define a scope of methods accepting at
     least one non primitive argument? (Mark)
  2. Re: Is it possible to define a scope of methods accepting at
     least one non primitive argument? (Andy Clement)
  3. Re: Why annotations are not exposed through
     JoinPoint.StaticPart? (Mark)
  4. Re: Is it possible to define a scope of methods accepting at
     least one non primitive argument? (Mark)
  5. I have changed my logger aspect and not it displays some
     messages twice, how come? (Mark)
  6. Re: I have changed my logger aspect and not it displays some
     messages twice, how come? (Mark)
  7. Re: Is it possible to define a scope of methods accepting at
     least one non primitive argument? (Andy Clement)


----------------------------------------------------------------------

Message: 1
Date: Thu, 15 Dec 2011 10:54:01 -0800 (PST)
From: Mark <mark.kharitonov@xxxxxxxxx>
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] Is it possible to define a scope of
       methods accepting at least one non primitive argument?
Message-ID: <1323975241209-4201202.post@xxxxxxxxxxxxx>
Content-Type: text/plain; charset=us-ascii

Thanks for the reply. Unfortunately, something is wrong with your example. I
am trying to implement it, but it does not work.

Given the following declarations:
==============================================
package com.shunra.poc;

import java.lang.annotation.ElementType;
import java.lang.annotation.Target;

@Target({ ElementType.PARAMETER })
public @interface NotNull {
}
==============================================
package com.shunra.poc;

public aspect NotNullAspect {
 pointcut first(Object o): execution(* *((@NotNull *),..)) && args(o,..);
// line 4
 pointcut second(Object o): execution(* *(*,(@NotNull *),..)) &&
args(*,o,..);          // line 5
 pointcut third(Object o): execution(* *(*,*,(@NotNull *),..)) &&
args(*,*,o,..);        // line 6

 before(Object o): first(o) {
   checkNotNull(o);
 }

 private void checkNotNull(Object o) {
   // TODO Auto-generated method stub

 }
}
==============================================

I get the following warnings for the lines 4,5 and 6 respectively:
==============================================
does not match because annotation @com.shunra.poc.NotNull has
@Target{ElementType.PARAMETER} [Xlint:unmatchedTargetKind]      NotNullAspect.aj
/Server/src/com/shunra/poc      line 4  Java Problem
does not match because annotation @com.shunra.poc.NotNull has
@Target{ElementType.PARAMETER} [Xlint:unmatchedTargetKind]      NotNullAspect.aj
/Server/src/com/shunra/poc      line 5  Java Problem
does not match because annotation @com.shunra.poc.NotNull has
@Target{ElementType.PARAMETER} [Xlint:unmatchedTargetKind]      NotNullAspect.aj
/Server/src/com/shunra/poc      line 6  Java Problem
==============================================

What is wrong?

Thanks.

--
View this message in context: http://aspectj.2085585.n4.nabble.com/Is-it-possible-to-define-a-scope-of-methods-accepting-at-least-one-non-primitive-argument-tp4195341p4201202.html
Sent from the AspectJ - users mailing list archive at Nabble.com.


------------------------------

Message: 2
Date: Thu, 15 Dec 2011 11:29:12 -0800
From: Andy Clement <andrew.clement@xxxxxxxxx>
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] Is it possible to define a scope of
       methods accepting at least one non primitive argument?
Message-ID:
       <CAAu=NOkArESp3NJfm_jqUCbxBUJT2i9Lbd-mpqYFmHRn4F4LeQ@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1

oops, sorry, I missed some key pairs of parens about.  Parameter
annotations being included in the  method signatures really pushed the
syntax to the limits.  There is discussion here:
http://andrewclement.blogspot.com/2009/02/aspectj-advising-methods-with-parameter.html

but the problem is that

pointcut first(Object o): execution(* *((@NotNull *),..)) && args(o,..);

means when the parameter is of a type annotated with @NotNull.  Whilst
this means a parameter annotated with @NotNull:

pointcut first(Object o): execution(* *((@NotNull (*)),..)) && args(o,..);

Notice extra parens around the '*' to disassociate the annotation from
being attached to the type.

my fault, shouldn't write code purely in my email client :)

cheers,
Andy

On 15 December 2011 10:54, Mark <mark.kharitonov@xxxxxxxxx> wrote:
> Thanks for the reply. Unfortunately, something is wrong with your example. I
> am trying to implement it, but it does not work.
>
> Given the following declarations:
> ==============================================
> package com.shunra.poc;
>
> import java.lang.annotation.ElementType;
> import java.lang.annotation.Target;
>
> @Target({ ElementType.PARAMETER })
> public @interface NotNull {
> }
> ==============================================
> package com.shunra.poc;
>
> public aspect NotNullAspect {
> ?pointcut first(Object o): execution(* *((@NotNull *),..)) && args(o,..);
> // line 4
> ?pointcut second(Object o): execution(* *(*,(@NotNull *),..)) &&
> args(*,o,..); ? ? ? ? ?// line 5
> ?pointcut third(Object o): execution(* *(*,*,(@NotNull *),..)) &&
> args(*,*,o,..); ? ? ? ?// line 6
>
> ?before(Object o): first(o) {
> ? ?checkNotNull(o);
> ?}
>
> ?private void checkNotNull(Object o) {
> ? ?// TODO Auto-generated method stub
>
> ?}
> }
> ==============================================
>
> I get the following warnings for the lines 4,5 and 6 respectively:
> ==============================================
> does not match because annotation @com.shunra.poc.NotNull has
> @Target{ElementType.PARAMETER} [Xlint:unmatchedTargetKind] ? ? ?NotNullAspect.aj
> /Server/src/com/shunra/poc ? ? ?line 4 ?Java Problem
> does not match because annotation @com.shunra.poc.NotNull has
> @Target{ElementType.PARAMETER} [Xlint:unmatchedTargetKind] ? ? ?NotNullAspect.aj
> /Server/src/com/shunra/poc ? ? ?line 5 ?Java Problem
> does not match because annotation @com.shunra.poc.NotNull has
> @Target{ElementType.PARAMETER} [Xlint:unmatchedTargetKind] ? ? ?NotNullAspect.aj
> /Server/src/com/shunra/poc ? ? ?line 6 ?Java Problem
> ==============================================
>
> What is wrong?
>
> Thanks.
>
> --
> View this message in context: http://aspectj.2085585.n4.nabble.com/Is-it-possible-to-define-a-scope-of-methods-accepting-at-least-one-non-primitive-argument-tp4195341p4201202.html
> Sent from the AspectJ - users mailing list archive at Nabble.com.
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users


------------------------------

Message: 3
Date: Thu, 15 Dec 2011 11:53:21 -0800 (PST)
From: Mark <mark.kharitonov@xxxxxxxxx>
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] Why annotations are not exposed through
       JoinPoint.StaticPart?
Message-ID: <1323978801552-4201678.post@xxxxxxxxxxxxx>
Content-Type: text/plain; charset=us-ascii

Interesting, I have not seen such usage before. But your blog does not
explain which scenarios are supported.

For instance, I have the following annotation:
==================================================
package com.shunra.poc.security;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({ ElementType.METHOD, ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface Authorize {
 KnownRole[] allow();
}
==================================================
package com.shunra.poc.security;

import org.restlet.security.Role;

public enum KnownRole {
 USER("user", "A limited user."), ADMINISTRATOR("admin", "The system
administrator."), GUEST("guest", "A guest user.");

 public final Role Value;
 private KnownRole(String name, String description) {
   Value = new Role(name, description);
 }
}
==================================================

So, how can I use it? The following pointcut does not compile:
==================================================
 // Bind just the part of the annotation of interest:
 pointcut colouredMethods(KnownRole role):
   execution(public @Authorize * *(..)) &&
   @annotation(Authorize(allow = { role }));
==================================================

It does not compile.


--
View this message in context: http://aspectj.2085585.n4.nabble.com/Why-annotations-are-not-exposed-through-JoinPoint-StaticPart-tp4196637p4201678.html
Sent from the AspectJ - users mailing list archive at Nabble.com.


------------------------------

Message: 4
Date: Thu, 15 Dec 2011 12:52:03 -0800 (PST)
From: Mark <mark.kharitonov@xxxxxxxxx>
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] Is it possible to define a scope of
       methods accepting at least one non primitive argument?
Message-ID: <1323982323684-4201936.post@xxxxxxxxxxxxx>
Content-Type: text/plain; charset=us-ascii

Thanks, it works. Here is the aspect code:
=======================================================
package com.shunra.poc;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.reflect.MethodSignature;
import com.shunra.poc.logging.LoggerAspect;

public aspect NotNullAspect {
 pointcut nullArg0(Object o): execution(* *(@NotNull (*),..)) &&
args(o,..);
 pointcut nullArg1(Object o): execution(* *(*,@NotNull (*),..)) &&
args(o,..);
 pointcut nullArg2(Object o): execution(* *(*,*,@NotNull (*),..)) &&
args(o,..);
 pointcut nullArg3(Object o): execution(* *(*,*,*,@NotNull (*),..)) &&
args(o,..);
 pointcut nullArg4(Object o): execution(* *(*,*,*,*,@NotNull (*),..)) &&
args(o,..);
 pointcut nullArg5(Object o): execution(* *(*,*,*,*,*,@NotNull (*),..)) &&
args(o,..);

 before(Object o): nullArg0(o) { assertNotNull(o, 0,
thisJoinPointStaticPart); }
 before(Object o): nullArg1(o) { assertNotNull(o, 1,
thisJoinPointStaticPart); }
 before(Object o): nullArg2(o) { assertNotNull(o, 2,
thisJoinPointStaticPart); }
 before(Object o): nullArg3(o) { assertNotNull(o, 3,
thisJoinPointStaticPart); }
 before(Object o): nullArg4(o) { assertNotNull(o, 4,
thisJoinPointStaticPart); }
 before(Object o): nullArg5(o) { assertNotNull(o, 5,
thisJoinPointStaticPart); }

 protected void assertNotNull(Object o, int index, JoinPoint.StaticPart jp)
{
   if (o == null) {
     MethodSignature ms = (MethodSignature)jp.getSignature();
     throw new IllegalArgumentException("The '" +
ms.getParameterNames()[index] + "' parameter of the method '" + ms + "'
cannot be null (" + jp.getSourceLocation() + ").");
   }
 }
}
=======================================================

Is it indeed the most compact way to write such an aspect?

Thanks.

--
View this message in context: http://aspectj.2085585.n4.nabble.com/Is-it-possible-to-define-a-scope-of-methods-accepting-at-least-one-non-primitive-argument-tp4195341p4201936.html
Sent from the AspectJ - users mailing list archive at Nabble.com.


------------------------------

Message: 5
Date: Thu, 15 Dec 2011 13:11:56 -0800 (PST)
From: Mark <mark.kharitonov@xxxxxxxxx>
To: aspectj-users@xxxxxxxxxxx
Subject: [aspectj-users] I have changed my logger aspect and not it
       displays some messages twice, how come?
Message-ID: <1323983516717-4202008.post@xxxxxxxxxxxxx>
Content-Type: text/plain; charset=us-ascii

Hi,
These are my logger aspects, the working edition:

LoggerAspect:
==================================================
public abstract aspect LoggerAspect {
 // This declaration is never used by the aspect itself. It simply provides
the default implementation
 // of the ILoggable.getLogger() method.
 public Logger ILoggable.getLogger() {
   return LoggerAspect.getLogger(this.getClass());
 }

 public static Logger getLogger(@SuppressWarnings("rawtypes") Class clazz)
{
   LoggerHolderAspect holder = LoggerHolderAspect.aspectOf(clazz);
   return holder.getLogger();
 }

 public abstract pointcut loggedScope();
 public abstract pointcut loggedMethodScope();
 public abstract pointcut loggedMethods();
 pointcut caughtException(Exception e) : handler(Exception+) && args(e);

 private static Logger getLogger(JoinPoint.StaticPart jp) {
   return getLoggerHolder(jp).getLogger();
 }

 private static LoggerHolderAspect getLoggerHolder(JoinPoint.StaticPart jp)
{
   return
LoggerHolderAspect.aspectOf(jp.getSignature().getDeclaringType());
 }

 before(): staticinitialization(!LoggerAspect+) && loggedScope() {
   getLoggerHolder(thisJoinPointStaticPart).initLogger();
 }

 before(): loggedScope() && loggedMethods() {
   logBefore(getLogger(thisJoinPointStaticPart), thisJoinPoint);
 }

 after() returning (Object result): loggedScope() && loggedMethods() {
   logAfterReturning(getLogger(thisJoinPointStaticPart), thisJoinPoint,
result);
 }

 after() throwing (Exception e): loggedScope() && loggedMethods() &&
!cflowbelow(loggedMethods()) {
   logAfterThrowing(getLogger(thisJoinPointStaticPart), thisJoinPoint, e);
 }

 before(Exception e) : caughtException(e) && loggedScope() &&
loggedMethodScope() {
   logCaughtException(getLogger(thisJoinPointStaticPart),
thisEnclosingJoinPointStaticPart, thisJoinPoint, e);
 }
 ...
}
==================================================

ResourceHandlerLoggerAspect:
==================================================
public aspect ResourceHandlerLoggerAspect extends LoggerAspect {
 declare @type : @Path * : @LogMe;
 declare parents: (@Path *) implements ILoggable;

 public pointcut loggedScope() : within(@Path *);
 public pointcut loggedMethodScope() : withincode(@(GET || PUT || POST ||
DELETE) public * *.*(..));
 public pointcut loggedMethods() : execution(@(GET || PUT || POST ||
DELETE) public * *.*(..));
}
==================================================

ServiceLoggerAspect:
==================================================
public aspect ServiceLoggerAspect extends LoggerAspect {
 declare @type : com.shunra.poc..*Service : @LogMe;
 declare parents: com.shunra.poc..*Service implements ILoggable;

 public pointcut loggedScope() : within(com.shunra.poc..*Service);
 public pointcut loggedMethodScope() : withincode(public * *.*(..));
 public pointcut loggedMethods() : execution(public * *.*(..));
}
==================================================

Now, these work fine. When I execute a post request, I get the following
output:
==================================================
2011-12-15 20:59:23,297 null[Dispatcher-0] DEBUG
com.shunra.poc.handlers.UserHandler - postUser(entity: User [Id=1,
FirstName=Maayan, LastName=Kharitonov, Age=6])
2011-12-15 20:59:24,104 null[Dispatcher-0] DEBUG com.shunra.poc.UserService
- post(entity: User [Id=0, FirstName=Maayan, LastName=Kharitonov, Age=6])
2011-12-15 20:59:24,108 null[Dispatcher-0] TRACE com.shunra.poc.UserService
- post(entity: User [Id=3, FirstName=Maayan, LastName=Kharitonov, Age=6])
DONE
2011-12-15 20:59:24,120 null[Dispatcher-0] TRACE
com.shunra.poc.handlers.UserHandler - postUser(entity: User [Id=3,
FirstName=Maayan, LastName=Kharitonov, Age=6]) = EntityPostResult [Id=3]
==================================================


Now, I decided that the loggedScope pointcut does not have to be abstract
and so I made several changes:

LoggerAspect patch:
==================================================
@@ -20,7 +20,7 @@
    return holder.getLogger();
  }

-  public abstract pointcut loggedScope();
+  public pointcut loggedScope() : within(@LogMe *);
  public abstract pointcut loggedMethodScope();
  public abstract pointcut loggedMethods();
  public pointcut methodWoutArgs() : execution(* *.*());
@@ -39,7 +39,7 @@
  //pointcut staticContext() : !this(Object);
  //pointcut nonStaticContext(Object obj) : this(obj);
  //pointcut excluded() : within(LoggerAspect+);
-  pointcut caughtException(Exception e) : handler(Exception+) && args(e);
+  public pointcut caughtException(Exception e) : handler(Exception+) &&
args(e);

  private static Logger getLogger(JoinPoint.StaticPart jp) {
    return getLoggerHolder(jp).getLogger();
==================================================

ResourceHandlerLoggerAspect patch:
==================================================
@@ -18,7 +18,6 @@
  // In any case, the logger is available from the static
LoggerAspect.getLogger(Class) method.
  declare parents: (@Path *) implements ILoggable;

-  public pointcut loggedScope() : within(@Path *);
  public pointcut loggedMethodScope() : withincode(@(GET || PUT || POST ||
DELETE) public * *.*(..));
  public pointcut loggedMethods() : execution(@(GET || PUT || POST ||
DELETE) public * *.*(..));
==================================================

ServiceLoggerAspect patch:
==================================================
@@ -6,7 +6,6 @@
  declare @type : com.shunra.poc..*Service : @LogMe;
  declare parents: com.shunra.poc..*Service implements ILoggable;

-  public pointcut loggedScope() : within(com.shunra.poc..*Service);
  public pointcut loggedMethodScope() : withincode(public * *.*(..));
  public pointcut loggedMethods() : execution(public * *.*(..));
 }
=================================================

Innocent, right? But observe what outputs:
=================================================
2011-12-15 21:09:51,814 null[Dispatcher-0] DEBUG
com.shunra.poc.handlers.UserHandler - postUser(entity: User [Id=1,
FirstName=Maayan, LastName=Kharitonov, Age=6])
2011-12-15 21:09:52,926 null[Dispatcher-0] DEBUG
com.shunra.poc.handlers.UserHandler - postUser(entity: User [Id=1,
FirstName=Maayan, LastName=Kharitonov, Age=6])
2011-12-15 21:10:00,373 null[Dispatcher-0] DEBUG com.shunra.poc.UserService
- post(entity: User [Id=0, FirstName=Maayan, LastName=Kharitonov, Age=6])
2011-12-15 21:10:00,375 null[Dispatcher-0] TRACE com.shunra.poc.UserService
- post(entity: User [Id=3, FirstName=Maayan, LastName=Kharitonov, Age=6])
DONE
2011-12-15 21:10:00,386 null[Dispatcher-0] TRACE
com.shunra.poc.handlers.UserHandler - postUser(entity: User [Id=3,
FirstName=Maayan, LastName=Kharitonov, Age=6]) = EntityPostResult [Id=3]
2011-12-15 21:10:00,386 null[Dispatcher-0] TRACE
com.shunra.poc.handlers.UserHandler - postUser(entity: User [Id=3,
FirstName=Maayan, LastName=Kharitonov, Age=6]) = EntityPostResult [Id=3]
=================================================

Note how every UserHandler log message appears twice, while those of
UserService show up just once. How is it possible?

Thanks.

--
View this message in context: http://aspectj.2085585.n4.nabble.com/I-have-changed-my-logger-aspect-and-not-it-displays-some-messages-twice-how-come-tp4202008p4202008.html
Sent from the AspectJ - users mailing list archive at Nabble.com.


------------------------------

Message: 6
Date: Thu, 15 Dec 2011 14:07:05 -0800 (PST)
From: Mark <mark.kharitonov@xxxxxxxxx>
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] I have changed my logger aspect and not
       it displays some messages twice, how come?
Message-ID: <1323986825830-4202235.post@xxxxxxxxxxxxx>
Content-Type: text/plain; charset=us-ascii

If it is of any help, I have opened the UserHandler.class file in JD-GUI
(which does quite a bad job decompiling the woven code). I have noticed that
both ResourceHandlerLoggerAspect and ServiceLoggerAspect contribute advices
to the methods on that type.

But, how is it possible that the changes I did caused the
ServiceLoggerAspect to weave the UserHandler type in addition to the
ResourceHandlerLoggerAspect ?

--
View this message in context: http://aspectj.2085585.n4.nabble.com/I-have-changed-my-logger-aspect-and-not-it-displays-some-messages-twice-how-come-tp4202008p4202235.html
Sent from the AspectJ - users mailing list archive at Nabble.com.


------------------------------

Message: 7
Date: Thu, 15 Dec 2011 14:31:23 -0800
From: Andy Clement <andrew.clement@xxxxxxxxx>
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] Is it possible to define a scope of
       methods accepting at least one non primitive argument?
Message-ID:
       <CAAu=NO=UVEdGvAKaL9R8Q71Z+=-5auHhEruE0LptfQDM6ORqnA@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1

Yes, I'm afraid so. Glad you got it working.

Andy

On 15 December 2011 12:52, Mark <mark.kharitonov@xxxxxxxxx> wrote:
> Thanks, it works. Here is the aspect code:
> =======================================================
> package com.shunra.poc;
>
> import org.aspectj.lang.JoinPoint;
> import org.aspectj.lang.reflect.MethodSignature;
> import com.shunra.poc.logging.LoggerAspect;
>
> public aspect NotNullAspect {
> ?pointcut nullArg0(Object o): execution(* *(@NotNull (*),..)) &&
> args(o,..);
> ?pointcut nullArg1(Object o): execution(* *(*,@NotNull (*),..)) &&
> args(o,..);
> ?pointcut nullArg2(Object o): execution(* *(*,*,@NotNull (*),..)) &&
> args(o,..);
> ?pointcut nullArg3(Object o): execution(* *(*,*,*,@NotNull (*),..)) &&
> args(o,..);
> ?pointcut nullArg4(Object o): execution(* *(*,*,*,*,@NotNull (*),..)) &&
> args(o,..);
> ?pointcut nullArg5(Object o): execution(* *(*,*,*,*,*,@NotNull (*),..)) &&
> args(o,..);
>
> ?before(Object o): nullArg0(o) { assertNotNull(o, 0,
> thisJoinPointStaticPart); }
> ?before(Object o): nullArg1(o) { assertNotNull(o, 1,
> thisJoinPointStaticPart); }
> ?before(Object o): nullArg2(o) { assertNotNull(o, 2,
> thisJoinPointStaticPart); }
> ?before(Object o): nullArg3(o) { assertNotNull(o, 3,
> thisJoinPointStaticPart); }
> ?before(Object o): nullArg4(o) { assertNotNull(o, 4,
> thisJoinPointStaticPart); }
> ?before(Object o): nullArg5(o) { assertNotNull(o, 5,
> thisJoinPointStaticPart); }
>
> ?protected void assertNotNull(Object o, int index, JoinPoint.StaticPart jp)
> {
> ? ?if (o == null) {
> ? ? ?MethodSignature ms = (MethodSignature)jp.getSignature();
> ? ? ?throw new IllegalArgumentException("The '" +
> ms.getParameterNames()[index] + "' parameter of the method '" + ms + "'
> cannot be null (" + jp.getSourceLocation() + ").");
> ? ?}
> ?}
> }
> =======================================================
>
> Is it indeed the most compact way to write such an aspect?
>
> Thanks.
>
> --
> View this message in context: http://aspectj.2085585.n4.nabble.com/Is-it-possible-to-define-a-scope-of-methods-accepting-at-least-one-non-primitive-argument-tp4195341p4201936.html
> Sent from the AspectJ - users mailing list archive at Nabble.com.
> _______________________________________________
> 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


End of aspectj-users Digest, Vol 82, Issue 21
*********************************************


Back to the top