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);
this.shortSyntax = shortSyntax;
}
+ @Override
public void write(DataOutputStream s) throws IOException {
throw new RuntimeException("should not be serialized");
}
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))
.equals(o.typeVariableAliases));
}
+ @Override
public int hashCode() {
int result = 17;
result = 37 * result + kind.hashCode();
return result;
}
+ @Override
public boolean existsToSupportShadowMunging() {
return true;
}