Re: aw does not work on jdk 1.5?
"Alex" <alex-he/e8N7AIe/[email protected]>
| Newsgroups | gmane.comp.java.aspectwerkz.devel |
|---|---|
| Message-ID | <006b01c4009b$eda28b00$0201a8c0@maison> |
Hi
I have not tested yet the Java 1.5 support for online mode (you are obviously using online mode).
There are much better API that will make online mode even more seamless in Java 1.5.
May be you can for now give a try with offline mode.
Then what seems to occurs here is a VM freeze. Strange is that there are 2 JDWP messages. You could try a thread dump (kill -3 or CTRL BREAK) to see what s going on.
Else go with "online mode thru prepared way" with "Plug". This should be documented in the site (this mode generates a jar that you then put in bootclasspath/p to ovverride some JRE classes).
Alex
----- Original Message -----
From: nielinjie
To: aspectwerkz-devel-81qHHgoATdGxIXFVlbCvtR2eb7JE58TQ@public.gmane.org
Sent: Monday, March 01, 2004 4:19 AM
Subject: [aspectwerkz-devel] aw does not work on jdk 1.5?
I wrote an simple Advice to print a hello world message, and use xml model to bind it to a pointcut.
<aspectwerkz>
<system id="examples">
<!-- ============================================= -->
<!-- Advices -->
<!-- ============================================= -->
<advice-def name="hello"
class="HelloAdvice"
deployment-model="perJVM"/>
<!-- ============================================= -->
<!-- Concrete aspects -->
<!-- ============================================= -->
<aspect name="Hello">
<pointcut-def name="hello" type="method"
pattern="int Hello.hello(int)"/>
<bind-advice pointcut="hello">
<advice-ref name="hello"/>
</bind-advice>
</aspect>
</system>
</aspectwerkz>
It works well when I use jdk 1.4
C:\j2sdk1.4.1_05\jre\bin\java -Xrunjdwp:transport=dt_socket,suspend=y,address=93
00,server=y -Xdebug -Xbootclasspath/p:"E:\aspectwerkz\lib\bcel-patch.jar;E:\aspe
ctwerkz\lib\bcel.jar;E:\aspectwerkz\lib\aspectwerkz-core-0.9.jar" -Daspectwerkz.
home="E:\aspectwerkz" -Daspectwerkz.definition.file=test.xml -cp ".;E:\aspectwe
rkz\lib\aspectwerkz-0.9.jar;E:\aspectwerkz\lib\dom4j-1.4.jar;E:\aspectwerkz\lib\
qdox-1.3.jar;E:\aspectwerkz\lib\concurrent-1.3.1.jar;E:\aspectwerkz\lib\trove-1.
0.2.jar;E:\aspectwerkz\lib\piccolo-1.03.jar;E:\aspectwerkz\lib\jrexx-1.1.1.jar;.
\classes" Test
AspectWerkz - INFO - Pre-processor org.codehaus.aspectwerkz.transform.AspectWerk
zPreProcessor loaded and initialized
hello xml aop
But when I use jdk 1.5 to compile and run the code, it doesn’t work, and there is no error message.
D:\Program Files\Java\j2sdk1.5.0\jre\bin\java -Xrunjdwp:transport=dt_socket,susp
end=y,address=9300,server=y -Xdebug -Xbootclasspath/p:"E:\aspectwerkz\lib\bcel-p
atch.jar;E:\aspectwerkz\lib\bcel.jar;E:\aspectwerkz\lib\aspectwerkz-core-0.9.jar
" -Daspectwerkz.home="E:\aspectwerkz" -Daspectwerkz.definition.file=test.xml -c
p ".;E:\aspectwerkz\lib\aspectwerkz-0.9.jar;E:\aspectwerkz\lib\dom4j-1.4.jar;E:\
aspectwerkz\lib\qdox-1.3.jar;E:\aspectwerkz\lib\concurrent-1.3.1.jar;E:\aspectwe
rkz\lib\trove-1.0.2.jar;E:\aspectwerkz\lib\piccolo-1.03.jar;E:\aspectwerkz\lib\j
rexx-1.1.1.jar;.\classes" Test
Listening for transport dt_socket at address: 9300
Listening for transport dt_socket at address: 9300
------------------------------------------------------------------------------
发件人: Alex [mailto:alex-he/e8N7AIe/[email protected]]
发送时间: 2004年2月29日 21:33
收件人: nielinjie
主题: Re: I used jdk 1.5 to compile a simple aspect like this......
If you want to access Java 1.5 metadata, use Java 1.5 API and class retention policy for your metadata.
This issue does not relates to how AspectWerkz currently handles doclets for self defined Aspects.
The only restriction for now is that AspectWerkz does not support yet Java 1.5 metadata *to define its own aspects*.
Alex
PS: could you subscribe to the project mailing list so that everyone can share the discussion
http://aspectwerkz.codehaus.org
(follow project info / mailing list)
----- Original Message -----
From: nielinjie
To: 'Alex'
Sent: Sunday, February 29, 2004 1:40 PM
Subject: re: I used jdk 1.5 to compile a simple aspect like this......
Thank you for your answer.
I want read some metadata in some Advice classes. Since this aop framework do not support java 1.5 metadata, would you tell me if there is another way to write and read some metadata from the class? Or if there is any other aop framework support java 1.5 metadata.
Thanks
----------------------------------------------------------------------------
发件人: Alex [mailto:alex-he/e8N7AIe/[email protected]]
发送时间: 2004年2月27日 3:29
收件人: nielinjie
主题: Re: I used jdk 1.5 to compile a simple aspect like this......
I forgot to mention we will have "Java 1.5 metadata" (and not doclet) support for Aspect development in around october 2004 at latest.
Alex
----- Original Message -----
From: nielinjie
To: avasseur-yCVjj/[email protected]
Sent: Thursday, February 26, 2004 12:42 PM
Subject: I used jdk 1.5 to compile a simple aspect like this......
I used jdk 1.5 to compile a simple aspect like this
import org.codehaus.aspectwerkz.attribdef.aspect.Aspect;
import org.codehaus.aspectwerkz.attribdef.Pointcut;
import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
import org.codehaus.aspectwerkz.joinpoint.CallerSideJoinPoint;
import org.codehaus.aspectwerkz.joinpoint.MethodJoinPoint;
import java.util.Map;
import java.util.HashMap;
@Aspect("perInstance")
public class CachingAspect extends Aspect {
// ============ Pointcuts ============
@Call("*->int Pi.getPiDecimal(int)")
Pointcut invocationCount;
@Before("invocationCount")
public void invocationCounter(final JoinPoint joinPoint) throws Throwable {
CallerSideJoinPoint jp = (CallerSideJoinPoint)joinPoint;
System.out.println("invocation me");
joinPoint.proceed();
}
protected Map m_cache = new HashMap();
}
But I got some compile errs.
compile:
[javac] Compiling 1 source file to E:\NieLinJie\working\testaspectw\classes
[javac] E:\NieLinJie\working\testaspectw\src\CachingAspect.java:17: cannot find symbol
[javac] symbol : class Call
[javac] location: class CachingAspect
[javac] @Call("*->int Pi.getPiDecimal(int)")
[javac] ^
[javac] E:\NieLinJie\working\testaspectw\src\CachingAspect.java:20: cannot find symbol
[javac] symbol : class Before
[javac] location: class CachingAspect
[javac] @Before("invocationCount")
[javac] ^
[javac] 2 errors
Would you pls tell me where to find the declarations of the annotation types (such as @Aspect, @Call, @Before).
Thanks.