Hello.
I am writing a series
of small POC Aspects which revolve around various annotations. I just noticed
while debugging that classes not annotated with the designated annotations have
some extraneous fields/interfaces injected during the weaving process.
I was hoping
someone could explain what it is, why they are there and how I can trim the
resulting class files during weaving to be as nimble as possible – i.e. remove
all the extra fields / interfaces from classes which *SHOULD* not be effected by aspects in the
first place. Don’t
get me wrong – I understand the need for injecting fields, methods and such to support the
runtime – but why on classes which have explicitly not been targeted with
an aspect. Looking at the name (interface FairLockAspect$ajcMightHaveAspect ) implies this is a forward
compatibility feature. Is there a quick way to turn this off? I tried the “not
reweavable” option in eclipse preferences – but that did not help J (I am grabbing at
straws)
My fear is that –
if as a team we introduce 100 aspects (annotation driven) – the memory
for classes / instances across the board will grow dramatically. In our system,
we are already pushing memory requirements into multiple gigs – if every
object we have has a placeholders for every potential (pertarget assoc.) aspect in our system, I think
this will be a show stopper for using AspectJ in production.
Here is an example a
class used in unit-testing which IMO should have no references or knowledge of
aspects period.
Thanks for the Help!!!!
Sorry if I am on crack and have missed something real obvious J
Jody
// class version 49.0 [49] (Java 1.5)
// compiled from TestPersistentObject.java
// access flags 33
public class
com/q1labs/frameworks/naming/testcomps/TestPersistentObject extends com/q1labs/frameworks/comp/BasePersistentComponent implements
com/q1labs/frameworks/comp/FairLockAspect$ajcMightHaveAspect com/q1labs/frameworks/comp/UnfairLockAspect$ajcMightHaveAspect
com/q1labs/frameworks/performance/TimeCriticalAspect$ajcMightHaveAspect {
// access
flags 130
private
transient FairLockAspect ajc$com_q1labs_frameworks_comp_FairLockAspect$perObjectField
// access
flags 130
private
transient UnfairLockAspect ajc$com_q1labs_frameworks_comp_UnfairLockAspect$perObjectField
// access
flags 130
private
transient TimeCriticalAspect ajc$com_q1labs_frameworks_performance_TimeCriticalAspect$perObjectField
....
// access
flags 1
public ajc$com_q1labs_frameworks_comp_FairLockAspect$perObjectGet
(): FairLockAspect
L0 (1)
ALOAD 0
GETFIELD TestPersistentObject.ajc$com_q1labs_frameworks_comp_FairLockAspect$perObjectField:
FairLockAspect
ARETURN
// access
flags 1
public ajc$com_q1labs_frameworks_comp_FairLockAspect$perObjectSet
(FairLockAspect): void
L0 (1)
ALOAD 0
ALOAD 1
PUTFIELD TestPersistentObject.ajc$com_q1labs_frameworks_comp_FairLockAspect$perObjectField:
FairLockAspect
RETURN
// access
flags 1
public ajc$com_q1labs_frameworks_comp_UnfairLockAspect$perObjectGet
(): UnfairLockAspect
L0 (1)
ALOAD 0
GETFIELD TestPersistentObject.ajc$com_q1labs_frameworks_comp_UnfairLockAspect$perObjectField:
UnfairLockAspect
ARETURN
// access
flags 1
public ajc$com_q1labs_frameworks_comp_UnfairLockAspect$perObjectSet
(UnfairLockAspect): void
L0 (1)
ALOAD 0
ALOAD 1
PUTFIELD TestPersistentObject.ajc$com_q1labs_frameworks_comp_UnfairLockAspect$perObjectField:
UnfairLockAspect
RETURN
// access
flags 1
public ajc$com_q1labs_frameworks_performance_TimeCriticalAspect$perObjectGet
(): TimeCriticalAspect
L0 (1)
ALOAD 0
GETFIELD TestPersistentObject.ajc$com_q1labs_frameworks_performance_TimeCriticalAspect$perObjectField:
TimeCriticalAspect
ARETURN
// access
flags 1
public ajc$com_q1labs_frameworks_performance_TimeCriticalAspect$perObjectSet
(TimeCriticalAspect): void
L0 (1)
ALOAD 0
ALOAD 1
PUTFIELD TestPersistentObject.ajc$com_q1labs_frameworks_performance_TimeCriticalAspect$perObjectField:
TimeCriticalAspect
RETURN
}
------------------------------------------
Jody
Brownell
Software
Developer
Q1
Labs Inc –
Network Security Enforcement for the Enterprise
Office:
506-462-9117 ext 109
jody.brownell@xxxxxxxxxx | www.q1labs.com