diff options
author | aclement <aclement> | 2005-01-18 14:27:09 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-01-18 14:27:09 +0000 |
commit | 634e6c66aaf6c12b0af7a0b2439ed4d19f61eaba (patch) | |
tree | 6568779e62a68c8b9b8072bb3ad989a935afbe91 /docs/adk15ProgGuideDB | |
parent | 00b76289a20e67377b15a544ccaad117bc123048 (diff) | |
download | aspectj-634e6c66aaf6c12b0af7a0b2439ed4d19f61eaba.tar.gz aspectj-634e6c66aaf6c12b0af7a0b2439ed4d19f61eaba.zip |
first example now works!
Diffstat (limited to 'docs/adk15ProgGuideDB')
-rw-r--r-- | docs/adk15ProgGuideDB/pertypewithin.xml | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/docs/adk15ProgGuideDB/pertypewithin.xml b/docs/adk15ProgGuideDB/pertypewithin.xml index ec099c1fd..b8da82f46 100644 --- a/docs/adk15ProgGuideDB/pertypewithin.xml +++ b/docs/adk15ProgGuideDB/pertypewithin.xml @@ -53,19 +53,22 @@ </para> <programlisting><![CDATA[ - public aspect InstanceTracking pertypewithin(org.xyz..*) { + import java.util.*; + + public aspect InstanceTracking pertypewithin(org.xyz..*) { + + // use WeakHashMap for auto-garbage collection of keys + private Map<Object,Boolean> instances = new WeakHashMap<Object,Boolean>(); - // use WeakHashMap for auto-garbage collection of keys - private Map<?,Boolean> instances = new WeakHashMap<?,Boolean>(); - - after(Object o) returning : execution(new(..)) { - instances.put(o,true); - } - - public Set<?> getInstances() { - return instances.keySet(); - } - } + after(Object o) returning() : execution(new(..)) && this(o) { + instances.put(o,true); + } + + public Set<?> getInstances() { + return instances.keySet(); + } + + } ]]></programlisting> <para> @@ -93,7 +96,7 @@ // use WeakHashMap for auto-garbage collection of keys private Map<T, Boolean> instances = new WeakHashMap<T, Boolean>(); - after(T t) returning : execution(new(..)) { + after(T t) returning : execution(new(..)) && this(t) { instances.put(t, true); } |