~ubuntu-branches/ubuntu/wily/aspectj/wily-proposed

« back to all changes in this revision

Viewing changes to org.aspectj/modules/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2011-03-15 23:54:31 UTC
  • mfrom: (1.2.5 upstream)
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20110315235431-iq2gxbsx08kpwuiw
* New upstream release.
* Updated Standards-Version to 3.9.1 (no changes needed).
* Fix local Javadoc links:
  - d/patches/07_javadoc_links.diff: Use locally installed
   javadoc packages and hyperlink with them.
  - d/control: Add B-D on default-java-doc and libasm3-java-doc.
* d/control: Drop B-D on itself (our new bootstrap infrastructure doesn't need
  that anymore).
* Split packages into :
  - aspectj: only contains CLI tools.
  - libaspectj-java: JAR librairies for /usr/share/java.
  - libaspectj-java-doc: 4 API's Javadoc.
  - aspectj-doc: Programming Guides and SDK Documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
import java.lang.ref.WeakReference;
16
16
import java.util.ArrayList;
17
17
import java.util.Collection;
18
 
import java.util.Iterator;
19
18
import java.util.List;
20
19
import java.util.Map;
21
20
 
37
36
         * For generic types, this list holds references to all the derived raw and parameterized versions. We need this so that if the
38
37
         * generic delegate is swapped during incremental compilation, the delegate of the derivatives is swapped also.
39
38
         */
40
 
        private final List/* ReferenceType */derivativeTypes = new ArrayList();
 
39
        private final List<ReferenceType> derivativeTypes = new ArrayList<ReferenceType>();
41
40
 
42
41
        /**
43
42
         * For parameterized types (or the raw type) - this field points to the actual reference type from which they are derived.
54
53
        ResolvedMember[] parameterizedPointcuts = null;
55
54
        WeakReference<ResolvedType[]> parameterizedInterfaces = new WeakReference<ResolvedType[]>(null);
56
55
        Collection<Declare> parameterizedDeclares = null;
57
 
        Collection parameterizedTypeMungers = null;
 
56
        // Collection parameterizedTypeMungers = null;
58
57
 
59
58
        // During matching it can be necessary to temporary mark types as annotated. For example
60
59
        // a declare @type may trigger a separate declare parents to match, and so the annotation
112
111
        // this.delegate = genericReferenceType.getDelegate();
113
112
        // genericReferenceType.addDependentType(this);
114
113
        // }
115
 
        private void addDependentType(ReferenceType dependent) {
 
114
        private synchronized void addDependentType(ReferenceType dependent) {
116
115
                this.derivativeTypes.add(dependent);
117
116
        }
118
117
 
531
530
                if (other.isTypeVariableReference()) {
532
531
                        TypeVariableReferenceType otherType = (TypeVariableReferenceType) other;
533
532
                        if (this instanceof TypeVariableReference) {
534
 
                                return ((TypeVariableReference) this).getTypeVariable().resolve(world).canBeBoundTo(
535
 
                                                otherType.getTypeVariable().getFirstBound().resolve(world));// pr171952
 
533
                                return ((TypeVariableReference) this).getTypeVariable().resolve(world)
 
534
                                                .canBeBoundTo(otherType.getTypeVariable().getFirstBound().resolve(world));// pr171952
536
535
                                // return
537
536
                                // ((TypeVariableReference)this).getTypeVariable()==otherType
538
537
                                // .getTypeVariable();
672
671
                return delegateInterfaces;
673
672
        }
674
673
 
675
 
        private String toString(ResolvedType[] delegateInterfaces) {
676
 
                StringBuffer sb = new StringBuffer();
677
 
                if (delegateInterfaces != null) {
678
 
                        for (ResolvedType rt : delegateInterfaces) {
679
 
                                sb.append(rt).append(" ");
680
 
                        }
681
 
                }
682
 
                return sb.toString();
683
 
        }
 
674
        // private String toString(ResolvedType[] delegateInterfaces) {
 
675
        // StringBuffer sb = new StringBuffer();
 
676
        // if (delegateInterfaces != null) {
 
677
        // for (ResolvedType rt : delegateInterfaces) {
 
678
        // sb.append(rt).append(" ");
 
679
        // }
 
680
        // }
 
681
        // return sb.toString();
 
682
        // }
684
683
 
685
684
        /**
686
685
         * Locates the named type variable in the list of those on this generic type and returns the type parameter from the second list
703
702
         * class Foo<T extends String,E extends Number> implements SuperInterface<T> {}
704
703
         * </code> where <code>
705
704
         * interface SuperInterface<Z> {}
706
 
         * </code> In that
707
 
         * example, a use of the 'Foo' raw type should know that it implements the SuperInterface<String>.
 
705
         * </code> In that example, a use of the 'Foo' raw type should know that it implements the SuperInterface<String>.
708
706
         */
709
707
        private UnresolvedType[] determineThoseTypesToUse(ResolvedType parameterizedInterface, UnresolvedType[] paramTypes) {
710
708
                // What are the type parameters for the supertype?
820
818
        @Override
821
819
        public PerClause getPerClause() {
822
820
                PerClause pclause = getDelegate().getPerClause();
823
 
                if (isParameterizedType()) { // could cache the result here...
824
 
                        Map parameterizationMap = getAjMemberParameterizationMap();
 
821
                if (pclause != null && isParameterizedType()) { // could cache the result here...
 
822
                        Map<String, UnresolvedType> parameterizationMap = getAjMemberParameterizationMap();
825
823
                        pclause = (PerClause) pclause.parameterizeWith(parameterizationMap, world);
826
824
                }
827
825
                return pclause;
857
855
 
858
856
        // GENERICITDFIX
859
857
        // // Map parameterizationMap = getAjMemberParameterizationMap();
860
 
        //              
 
858
        //
861
859
        // // if (parameterizedTypeMungers != null) return parameterizedTypeMungers;
862
860
        // Collection ret = null;
863
861
        // if (ajMembersNeedParameterization()) {
877
875
        // }
878
876
 
879
877
        @Override
880
 
        public Collection getPrivilegedAccesses() {
 
878
        public Collection<ResolvedMember> getPrivilegedAccesses() {
881
879
                return getDelegate().getPrivilegedAccesses();
882
880
        }
883
881
 
891
889
        @Override
892
890
        public ResolvedType getSuperclass() {
893
891
                ResolvedType ret = null;// superclassReference.get();
894
 
                if (ret != null) {
895
 
                        return ret;
896
 
                }
 
892
                // if (ret != null) {
 
893
                // return ret;
 
894
                // }
897
895
                if (newSuperclass != null) {
898
896
                        if (this.isParameterizedType() && newSuperclass.isParameterizedType()) {
899
897
                                return newSuperclass.parameterize(getMemberParameterizationMap()).resolve(getWorld());
930
928
                        ((AbstractReferenceTypeDelegate) delegate).setSourceContext(this.delegate.getSourceContext());
931
929
                }
932
930
                this.delegate = delegate;
933
 
                for (Iterator it = this.derivativeTypes.iterator(); it.hasNext();) {
934
 
                        ReferenceType dependent = (ReferenceType) it.next();
 
931
                for (ReferenceType dependent : derivativeTypes) {
935
932
                        dependent.setDelegate(delegate);
936
933
                }
937
934
 
1042
1039
                annotationTypes = null;
1043
1040
                newSuperclass = null;
1044
1041
                newInterfaces = null;
 
1042
                typeVariables = null;
1045
1043
                parameterizedInterfaces.clear();
1046
1044
                superclassReference = new WeakReference<ResolvedType>(null);
1047
1045
                if (getDelegate() != null) {