]> source.dussan.org Git - aspectj.git/commitdiff
307120: more damn fixes
authoraclement <aclement>
Fri, 23 Apr 2010 00:10:18 +0000 (00:10 +0000)
committeraclement <aclement>
Fri, 23 Apr 2010 00:10:18 +0000 (00:10 +0000)
org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembers.java
org.aspectj.matcher/src/org/aspectj/weaver/PrivilegedAccessMunger.java

index 5ada3efc9aff37789b3eb08cbb6ca5855b0e7323..97d42e7faf8e78f29d2d05acecb28cd190d8a4a3 100644 (file)
@@ -206,7 +206,14 @@ public class CrosscuttingMembers {
        public void addPrivilegedAccesses(Collection<ResolvedMember> accessedMembers) {
                int version = inAspect.getCompilerVersion();
                for (ResolvedMember member : accessedMembers) {
-                       PrivilegedAccessMunger privilegedAccessMunger = new PrivilegedAccessMunger(member,
+                       // Looking it up ensures we get the annotations - the accessedMembers are just retrieved from the attribute and
+                       // don't have that information
+                       ResolvedMember resolvedMember = world.resolve(member);
+                       if (resolvedMember == null) {
+                               // can happen for ITDs - are there many privileged access ITDs??
+                               resolvedMember = member;
+                       }
+                       PrivilegedAccessMunger privilegedAccessMunger = new PrivilegedAccessMunger(resolvedMember,
                                        version >= WeaverVersionInfo.WEAVER_VERSION_AJ169);
                        ConcreteTypeMunger concreteTypeMunger = world.getWeavingSupport().concreteTypeMunger(privilegedAccessMunger, inAspect);
                        addTypeMunger(concreteTypeMunger);
index 5083a304bc19f61881dc80852af5f033eaf79cab..3e5a3be502dd6651b22c52732203651991d8326f 100644 (file)
@@ -33,6 +33,7 @@ public class PrivilegedAccessMunger extends ResolvedTypeMunger {
                this.shortSyntax = shortSyntax;
        }
 
+       @Override
        public void write(DataOutputStream s) throws IOException {
                throw new RuntimeException("should not be serialized");
        }
@@ -41,28 +42,34 @@ public class PrivilegedAccessMunger extends ResolvedTypeMunger {
                return getSignature();
        }
 
+       @Override
        public ResolvedMember getMatchingSyntheticMember(Member member, ResolvedType aspectType) {
                ResolvedMember ret;
                // assert if shortSyntax then aspectType.getCompilerVersion()>=169
                if (getSignature().getKind() == Member.FIELD) {
                        ret = AjcMemberMaker.privilegedAccessMethodForFieldGet(aspectType, getSignature(), shortSyntax);
-                       if (ResolvedType.matches(ret, member))
+                       if (ResolvedType.matches(ret, member)) {
                                return getSignature();
+                       }
                        ret = AjcMemberMaker.privilegedAccessMethodForFieldSet(aspectType, getSignature(), shortSyntax);
-                       if (ResolvedType.matches(ret, member))
+                       if (ResolvedType.matches(ret, member)) {
                                return getSignature();
+                       }
                } else {
                        // System.err.println("sig: " + getSignature());
                        ret = AjcMemberMaker.privilegedAccessMethodForMethod(aspectType, getSignature());
-                       if (ResolvedType.matches(ret, member))
+                       if (ResolvedType.matches(ret, member)) {
                                return getSignature();
+                       }
                }
                return null;
        }
 
+       @Override
        public boolean equals(Object other) {
-               if (!(other instanceof PrivilegedAccessMunger))
+               if (!(other instanceof PrivilegedAccessMunger)) {
                        return false;
+               }
                PrivilegedAccessMunger o = (PrivilegedAccessMunger) other;
                return kind.equals(o.kind)
                                && ((o.signature == null) ? (signature == null) : signature.equals(o.signature))
@@ -71,6 +78,7 @@ public class PrivilegedAccessMunger extends ResolvedTypeMunger {
                                                .equals(o.typeVariableAliases));
        }
 
+       @Override
        public int hashCode() {
                int result = 17;
                result = 37 * result + kind.hashCode();
@@ -80,6 +88,7 @@ public class PrivilegedAccessMunger extends ResolvedTypeMunger {
                return result;
        }
 
+       @Override
        public boolean existsToSupportShadowMunging() {
                return true;
        }