[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] set() capture oldvalue
|
It's true in this particular application, the performance of reflection
won't
kill the application.
But it's just something that I feel is missing from the language.
I wanted to see what other use cases might exist.
Performance could be a problem in some cases.
Tim Schafer
tschafer@xxxxxxxxxxx
----Original Message Follows----
From: Matthew Webster <matthew_webster@xxxxxxxxxx>
Reply-To: aspectj-users@xxxxxxxxxxx
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] set() capture oldvalue
Date: Mon, 16 May 2005 07:50:11 +0100
MIME-Version: 1.0
Received: from mail.eclipse.org ([206.191.52.53]) by mc4-f24.hotmail.com
with Microsoft SMTPSVC(6.0.3790.211); Sun, 15 May 2005 23:50:49 -0700
Received: from node3.eclipse.org (localhost [127.0.0.1])by mail.eclipse.org
(Postfix) with ESMTP id E1D40CB4D;Mon, 16 May 2005 02:52:44 -0400 (EDT)
Received: from mtagate2.uk.ibm.com (mtagate2.uk.ibm.com [195.212.29.135])by
mail.eclipse.org (Postfix) with SMTP id E5C276AC0Ffor
<aspectj-users@xxxxxxxxxxx>; Mon, 16 May 2005 02:51:44 -0400 (EDT)
Received: from
d06nrmr1407.portsmouth.uk.ibm.com(d06nrmr1407.portsmouth.uk.ibm.com
[9.149.38.185])by mtagate2.uk.ibm.com (8.12.10/8.12.10) with ESMTP id
j4G6oD4G320918for <aspectj-users@xxxxxxxxxxx>; Mon, 16 May 2005 06:50:13 GMT
Received: from d06av04.portsmouth.uk.ibm.com
(d06av04.portsmouth.uk.ibm.com[9.149.37.216])by
d06nrmr1407.portsmouth.uk.ibm.com (8.12.10/NCO/VER6.6) with ESMTP
idj4G6oDhG282280for <aspectj-users@xxxxxxxxxxx>; Mon, 16 May 2005 07:50:13
+0100
Received: from d06av04.portsmouth.uk.ibm.com (loopback [127.0.0.1])by
d06av04.portsmouth.uk.ibm.com (8.12.11/8.13.3) with ESMTP
idj4G6oDPY003034for <aspectj-users@xxxxxxxxxxx>; Mon, 16 May 2005 07:50:13
+0100
Received: from d06ml067.portsmouth.uk.ibm.com
(d06ml067.portsmouth.uk.ibm.com[9.149.38.140])by
d06av04.portsmouth.uk.ibm.com (8.12.11/8.12.11) with ESMTP
idj4G6oCZe003029for <aspectj-users@xxxxxxxxxxx>; Mon, 16 May 2005 07:50:12
+0100
X-Message-Info: GQXpnklFM/ejFGBEcP5COAwEw6lHHLtKPmpYmPhOgiU=
X-Original-To: aspectj-users@xxxxxxxxxxx
Delivered-To: aspectj-users@xxxxxxxxxxx
Sensitivity:
X-Mailer: Lotus Notes Release 6.5.3 September 14, 2004
X-MIMETrack: Serialize by Router on D06ML067/06/M/IBM(Release 6.53HF247
|January 6, 2005) at 16/05/2005 07:50:12
X-BeenThere: aspectj-users@xxxxxxxxxxx
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: aspectj-users.eclipse.org
List-Unsubscribe:
<https://dev.eclipse.org/mailman/listinfo/aspectj-users>,<mailto:aspectj-users-request@xxxxxxxxxxx?subject=unsubscribe>
List-Archive: <http://eclipse.org/pipermail/aspectj-users>
List-Post: <mailto:aspectj-users@xxxxxxxxxxx>
List-Help: <mailto:aspectj-users-request@xxxxxxxxxxx?subject=help>
List-Subscribe:
<https://dev.eclipse.org/mailman/listinfo/aspectj-users>,<mailto:aspectj-users-request@xxxxxxxxxxx?subject=subscribe>
Errors-To: aspectj-users-bounces@xxxxxxxxxxx
Return-Path: aspectj-users-bounces@xxxxxxxxxxx
X-OriginalArrivalTime: 16 May 2005 06:50:50.0047 (UTC)
FILETIME=[98796CF0:01C559E3]
Tim,
If you have a concern about the performance of something measure it. Many
frameworks use performance. I don't believe it's impact on overall
application performance will be as bad as you think.
Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester, SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/
"Tim Schafer" <tschafer@xxxxxxxxxxx>@eclipse.org on 13/05/2005 19:11:36
Please respond to aspectj-users@xxxxxxxxxxx
Sent by: aspectj-users-bounces@xxxxxxxxxxx
To: aspectj-users@xxxxxxxxxxx
cc:
Subject: Re: [aspectj-users] set() capture oldvalue
That's exactly what I'm doing.
Using reflection.
I'm concerned about performance.
If I were using aspects I wouldn't use refelection in each setter to get
the
old value.
The aspect compiler should be able to do this work for me.
I believe it's a major defeciency that this isn't avaiblable.
Are there already plans to fix this?
Should I file a bug?
Tim Schafer
tschafer@xxxxxxxxxxx
----Original Message Follows----
From: Matthew Webster <matthew_webster@xxxxxxxxxx>
Reply-To: aspectj-users@xxxxxxxxxxx
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] set() capture oldvalue
Date: Fri, 13 May 2005 16:14:30 +0100
MIME-Version: 1.0
Received: from mail.eclipse.org ([206.191.52.53]) by mc7-f35.hotmail.com
with Microsoft SMTPSVC(6.0.3790.211); Fri, 13 May 2005 08:15:02 -0700
Received: from node3.eclipse.org (localhost [127.0.0.1])by mail.eclipse.org
(Postfix) with ESMTP id 1DAB9E70F;Fri, 13 May 2005 11:17:14 -0400 (EDT)
Received: from mtagate4.uk.ibm.com (mtagate4.uk.ibm.com [195.212.29.137])by
mail.eclipse.org (Postfix) with SMTP id 6D0276ABD5for
<aspectj-users@xxxxxxxxxxx>; Fri, 13 May 2005 11:16:05 -0400 (EDT)
Received: from
d06nrmr1407.portsmouth.uk.ibm.com(d06nrmr1407.portsmouth.uk.ibm.com
[9.149.38.185])by mtagate4.uk.ibm.com (8.12.10/8.12.10) with ESMTP id
j4DFEc78328870for <aspectj-users@xxxxxxxxxxx>; Fri, 13 May 2005 15:14:38
GMT
Received: from d06av02.portsmouth.uk.ibm.com
(d06av02.portsmouth.uk.ibm.com[9.149.37.228])by
d06nrmr1407.portsmouth.uk.ibm.com (8.12.10/NCO/VER6.6) with ESMTP
idj4DFEbN9284252for <aspectj-users@xxxxxxxxxxx>; Fri, 13 May 2005 16:14:37
+0100
Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1])by
d06av02.portsmouth.uk.ibm.com (8.12.11/8.13.3) with ESMTP
idj4DFEb7M026517for <aspectj-users@xxxxxxxxxxx>; Fri, 13 May 2005 16:14:37
+0100
Received: from d06ml067.portsmouth.uk.ibm.com
(d06ml067.portsmouth.uk.ibm.com[9.149.38.140])by
d06av02.portsmouth.uk.ibm.com (8.12.11/8.12.11) with ESMTP
idj4DFEbFm026512for <aspectj-users@xxxxxxxxxxx>; Fri, 13 May 2005 16:14:37
+0100
X-Message-Info: GQXpnklFM/deOXuyugSvCR2mxkvbZGrT7xa62XqVDbE=
X-Original-To: aspectj-users@xxxxxxxxxxx
Delivered-To: aspectj-users@xxxxxxxxxxx
Sensitivity:
X-Mailer: Lotus Notes Release 6.5.3 September 14, 2004
X-MIMETrack: Serialize by Router on D06ML067/06/M/IBM(Release 6.53HF247
|January 6, 2005) at 13/05/2005 16:14:37
X-BeenThere: aspectj-users@xxxxxxxxxxx
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: aspectj-users.eclipse.org
List-Unsubscribe:
<https://dev.eclipse.org/mailman/listinfo/aspectj-users>,<
mailto:aspectj-users-request@xxxxxxxxxxx?subject=unsubscribe>
List-Archive: <http://eclipse.org/pipermail/aspectj-users>
List-Post: <mailto:aspectj-users@xxxxxxxxxxx>
List-Help: <mailto:aspectj-users-request@xxxxxxxxxxx?subject=help>
List-Subscribe:
<https://dev.eclipse.org/mailman/listinfo/aspectj-users>,<
mailto:aspectj-users-request@xxxxxxxxxxx?subject=subscribe>
Errors-To: aspectj-users-bounces@xxxxxxxxxxx
Return-Path: aspectj-users-bounces@xxxxxxxxxxx
X-OriginalArrivalTime: 13 May 2005 15:15:03.0565 (UTC)
FILETIME=[89BCABD0:01C557CE]
Tim,
I'm sure there was a thread on either aspectj-users or aspectj-dev but I
can't find it. Bottom line is the existing field value is not a property of
the join point so you must get it directly. The simple examples below shows
you how to use reflection or direct access:
public class SomeClass {
private int intField;
public void setInt (int i) {
intField = i;
}
}
public aspect Aspect {
pointcut fieldSet(int newValue) :
set(* SomeClass+.*) && args(newValue)
&& withincode(* SomeClass+.set*(..))
;
before (int newValue) : fieldSet (newValue) {
Object oldValue = null;
try {
Class clazz =
thisJoinPoint.getSignature().getDeclaringType();
String fieldName =
thisJoinPoint.getSignature().getName();
Field field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
oldValue = field.get(thisJoinPoint.getThis());
}
catch (Exception ex) {
ex.printStackTrace();
}
System.out.println("? beforeFieldSet() oldVaue=" + oldValue +
", newValue=" + newValue);
}
}
public privileged aspect PrivilegedAspect {
pointcut intFieldSet(SomeClass obj, int newValue) :
set(* intField) && target(obj) && args(newValue)
&& withincode(* SomeClass+.set*(..))
;
before (SomeClass obj, int newValue) : intFieldSet (obj,newValue) {
int oldValue = obj.intField;
System.out.println("? beforeIntFieldSet() oldVaue=" + oldValue
+ ", newValue=" + newValue);
}
}
Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester, SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/
"Tim Schafer" <tschafer@xxxxxxxxxxx>@eclipse.org on 11/05/2005 21:47:44
Please respond to aspectj-users@xxxxxxxxxxx
Sent by: aspectj-users-bounces@xxxxxxxxxxx
To: aspectj-users@xxxxxxxxxxx
cc:
Subject: [aspectj-users] set() capture oldvalue
I've used the following pointcut to capture all field modifications that
occur within a setter method.
pointcut fieldSet(Object newValue) : set(* SomeClass+.*) && args(newValue)
&& withincode(* SomeClass+.set*(..));
I can capture the new value, but I can't capture the old value without
resorting to reflection.
In theory aspectJ could provide access to the old value more statically.
But aspectJ doesn't seem to support this.
Or am I missing something?
Tim Schafer
tschafer@xxxxxxxxxxx
_______________________________________________
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