Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] questions after looking at decompiled code.

Hi Trishan,

I can only offer some advice on the first question. To my knowledge it is common practice to package the AspectJ runtime with an application that uses aspects. The code as shown by your decompiler IS plain Java code, but according to the mechanisms by which AspectJ weaves, so it doesn't make sense to replace the calls using other mechanisms. I think your question mainly pertains to the dependency on the aspectJ runtime. I am not aware of any ways around this, and even if those mechanisms did exist I am not sure that they would be totally desirable.

However I have had some concerns on this in terms of if the code is to be deployed as an applet with the relative size of the runtime library (even if using the Java Web Start mechanisms that cache those libraries), but in the past this has been a cost that has had to be accepted with any reliance on third party libraries. Otherwise, packaging the AspectJ runtime has not been a problem when deploying Java applications.

Anybody got any strategies out there for applying aspects in AspectJ without deploying with the AspectJ runtime library (just sounds wrong to me? :)?

Cheers

Russ

On Thursday, November 20, 2003, at 11:14AM, Trishan de Lanerolle <tlanerolle@xxxxxxxxxxx> wrote:

Hi,
Below is a copy of some weaved code. I hope someone would have some answers for the following questions which have been raised after viewing the decompiled code.
The code was written and compiled using the Eclipse plug-in for AspectJ. It was decompiled using JAD decompiler.
1.Does the import statements to aspectj libraries mean the weaved code includes the runtime libraries of AspectJ as shown in the decompiled code below.Is there any way where we can have the aspect replace the point cuts with pure java code and refrain from keeping aspect specific code within the final byte code. As this may mean we would have to include the runtime libraries in a final product release that uses aspects.
2.Based on the decompiled code ,when we have to replace a method but still keep the parameters, does aspectJ first create objects for the parameters and assign the values and then pass them into the new method weaved in by aspectJ.
3.Are there any known memory leaks and performance issues induced by aspects.
Any comments would be appreciated.
Trishan
 
<<<code>>>
import com.edocs.core.logging.Loggers;
import java.io.PrintStream;
import org.apache.log4j.Category;
import org.aspectj.runtime.internal.AroundClosure;
import org.aspectj.runtime.reflect.Factory;
 
public class AspectLoggerTestbed
{
 
    public static final org.aspectj.lang.JoinPoint.StaticPart ajc$tjp_0;
    public static final org.aspectj.lang.JoinPoint.StaticPart ajc$tjp_1;
 
    public AspectLoggerTestbed()
    {
    }
 
    public static void someMethod2()
    {
        System.out.println("some Method 2 Executed");
    }
 
    public static void someMethod()
    {
        int dummyO;
        SimpleExampleLogging.aspectOf().ajc$before$SimpleExampleLogging$3ee(ajc$tjp_1);
        String s = "Old Logger Argument";
        FakeLogCall_aroundBody1$advice(s, InterceptingArgs.aspectOf(), s, null);
        System.out.println("Some method running");
        dummyO = 10;
        System.out.println("DummyO:" + dummyO);
        dummyO /= 0;
          goto _L1
        SimpleExampleLogging.aspectOf().ajc$before$SimpleExampleLogging$531(ajc$tjp_0);
        Exception exception;
        exception;
_L1:
    }
 
    static final void FakeLogCall_aroundBody0(String s)
    {
        TestCalls.FakeLogCall(s);
    }
 
    static final void FakeLogCall_aroundBody1$advice(InterceptingArgs this, String LogText, AroundClosure ajc_aroundClosure, AroundClosure aroundclosure)
    {
        Loggers.assessLogger(LogText.getClass()).info("from replaced method ::" + ajc_aroundClosure);
    }
 
    static
    {
        Factory factory = new Factory("AspectLoggerTestbed.java", Class.forName("AspectLoggerTestbed"));
        ajc$tjp_0 = factory.makeSJP("exception-handler", factory.makeCatchClauseSig("0--AspectLoggerTestbed-java.lang.Exception-<missing>-"), 69);
        ajc$tjp_1 = factory.makeSJP("method-execution", factory.makeMethodSig("9-someMethod-AspectLoggerTestbed----void-"), 49);
    }
}
 
<<<<<code>>>>>
------------------------------------------------------------------------------------
Trishan de Lanerolle
R&D
AOP Research Group
SL ATC, Virtusa
www.virtusa.com
tlanerolle@xxxxxxxxxxx
 

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If the reader of this message is not the intended recipient, you are hereby notified that your access is unauthorized, and any review, dissemination, distribution or copying of this message including any attachments is strictly prohibited. If you are not the intended recipient, please contact the sender and delete the material from any computer.



Back to the top