Project: AspectJ
Bug 48091 Lazy instantiation of thisJoinPoint
Reported: 2003-12-04 12:18:33 | Status: resolved fixed

In cases where the body of advice refers to a non-statically evaluable portion of thisJoinPoint (so that it can't be optimized by the compiler to thisJoinPointStaticPart), the JoinPoint object is currently always created before entering the advice body - even if the JoinPoint object would never actually be accessed (because of a test within the advice for example). Since a) thisJoinPoint is often used in tracing applications b) tracing applications tend to be very pervasive, c) they must have low overhead when tracing is disabled, and d) creation of thisJoinPoint objects is expensive (v. expensive compared to just testing a flag) it would be nice if there was a way to create JoinPoint objects lazily on first actual reference within the advice body.

Files changed in fix:
org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/AjdtBatchTests.java org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/PerformanceTestCase.java runtime/src/org/aspectj/runtime/reflect/Factory.java weaver/src/org/aspectj/weaver/Lint.java weaver/src/org/aspectj/weaver/World.java weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java weaver/src/org/aspectj/weaver/bcel/BcelShadow.java