~ubuntu-branches/ubuntu/natty/aspectj/natty

« back to all changes in this revision

Viewing changes to org.aspectj/modules/aspectj5rt/java5-src/org/aspectj/lang/reflect/AjTypeSystem.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2009-10-04 16:37:23 UTC
  • mfrom: (1.1.3 upstream) (3.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20091004163723-ck4y7j7fhjxskkie
Tags: 1.6.6+dfsg-1
* New upstream release.
  - Update 02_use_gjdoc.diff patch
* Update my email address

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
package org.aspectj.lang.reflect;
13
13
 
14
14
import java.lang.ref.WeakReference;
 
15
import java.util.Collections;
15
16
import java.util.Map;
16
17
import java.util.WeakHashMap;
17
18
 
24
25
 */
25
26
public class AjTypeSystem {
26
27
        
27
 
                private static Map<Class, WeakReference<AjType>> ajTypes = new WeakHashMap<Class,WeakReference<AjType>>();
 
28
                private static Map<Class, WeakReference<AjType>> ajTypes = 
 
29
                        Collections.synchronizedMap(new WeakHashMap<Class,WeakReference<AjType>>());
28
30
 
29
31
                /**
30
32
                 * Return the AspectJ runtime type representation of the given Java type.
34
36
                 * AspectJ-awareness on top.
35
37
                 */
36
38
                public static <T> AjType<T> getAjType(Class<T> fromClass) {
37
 
                        if (ajTypes.containsKey(fromClass)) {
38
 
                                WeakReference<AjType> weakRefToAjType =  ajTypes.get(fromClass);
 
39
                        WeakReference<AjType> weakRefToAjType =  ajTypes.get(fromClass);
 
40
                        if (weakRefToAjType!=null) {
39
41
                                AjType<T> theAjType = weakRefToAjType.get();
40
42
                                if (theAjType != null) {
41
43
                                        return theAjType;