Hi,
One thing that would be wonderful is if I could add an annotation say
@logthis
public void doSomething() {
int i=0;
i=10;
}
which inserted code into the beginning and end of the method such as
public void doSomething() {
startLogging("doSomething");
int i=0;
i=10;
stopLoggin("doSomething":);
}
Do annotations come close to providing that?
thanks
andrewmcdonagh - 29 Nov 2006 19:31 GMT
> Hi,
>
[quoted text clipped - 16 lines]
>
> thanks
No
Wesley Hall - 29 Nov 2006 19:46 GMT
> Hi,
>
[quoted text clipped - 16 lines]
>
> Do annotations come close to providing that?
No, but AOP does.
Daniel Dyer - 29 Nov 2006 19:49 GMT
> Hi,
>
[quoted text clipped - 16 lines]
>
> Do annotations come close to providing that?
You might want to look into Aspect Oriented Programming (AOP).
Dan.

Signature
Daniel Dyer
http://www.uncommons.org
hiwa - 29 Nov 2006 23:27 GMT
> Do annotations come close to providing that?
Yes. You must be an apt expert to do that.
Thomas Hawtin - 30 Nov 2006 00:02 GMT
>> Do annotations come close to providing that?
> Yes. You must be an apt expert to do that.
APT can be used to generate new code. It does not alter existing code.
I'm sure there are plenty of AOP-style tools that will help, either
modifying the byte code of the .class files, modifying classes in a
custom class loader or using instrumentation APIs on loading the code.
Tom Hawtin
Timasmith - 30 Nov 2006 03:30 GMT
> >> Do annotations come close to providing that?
> > Yes. You must be an apt expert to do that.
[quoted text clipped - 6 lines]
>
> Tom Hawtin
Ok, I guess ideally the annotation would drive the AOP- tool, I'll look
into that.
hiwa - 30 Nov 2006 05:50 GMT
> > >> Do annotations come close to providing that?
> > > Yes. You must be an apt expert to do that.
[quoted text clipped - 9 lines]
> Ok, I guess ideally the annotation would drive the AOP- tool, I'll look
> into that.
Some 'experts' on Java annotation are talking about ....
http://forum.java.sun.com/thread.jspa?threadID=739960&start=0&tstart=20
http://forum.java.sun.com/thread.jspa?threadID=735736&messageID=4227834#4227834
Robert Klemme - 30 Nov 2006 13:47 GMT
> Hi,
>
[quoted text clipped - 16 lines]
>
> Do annotations come close to providing that?
Others have answered that already. However, if you just want to trace
execution then there are plenty tools out there. These work either on
VM level or inside (limpy log or so).
robert