From 279239d196c0fc29152832956d54e38e79ead40a Mon Sep 17 00:00:00 2001 From: aclement Date: Fri, 23 Apr 2010 00:10:18 +0000 Subject: [PATCH] 307120: more damn fixes --- .../org/aspectj/weaver/CrosscuttingMembers.java | 9 ++++++++- .../aspectj/weaver/PrivilegedAccessMunger.java | 17 +++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembers.java b/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembers.java index 5ada3efc9..97d42e7fa 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembers.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembers.java @@ -206,7 +206,14 @@ public class CrosscuttingMembers { public void addPrivilegedAccesses(Collection 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); diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/PrivilegedAccessMunger.java b/org.aspectj.matcher/src/org/aspectj/weaver/PrivilegedAccessMunger.java index 5083a304b..3e5a3be50 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/PrivilegedAccessMunger.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/PrivilegedAccessMunger.java @@ -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; } -- 2.39.5