From 58b93a22f9899c7b79da905b5d32a94c886a3549 Mon Sep 17 00:00:00 2001 From: aclement Date: Fri, 22 Jan 2010 22:46:18 +0000 Subject: [PATCH] 299552: private ITD fields stay private in target (with unmangled name): all of it --- .../src/org/aspectj/weaver/bcel/BcelObjectType.java | 8 +++++++- .../src/org/aspectj/weaver/bcel/BcelTypeMunger.java | 11 ++++++++--- weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java | 6 +++--- weaver/src/org/aspectj/weaver/bcel/BcelWorld.java | 4 ++-- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java index 80811d291..055acc41d 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java @@ -427,7 +427,8 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { } else if (a instanceof AjAttribute.DeclareAttribute) { declares.add(((AjAttribute.DeclareAttribute) a).getDeclare()); } else if (a instanceof AjAttribute.PrivilegedAttribute) { - privilegedAccess = ((AjAttribute.PrivilegedAttribute) a).getAccessedMembers(); + AjAttribute.PrivilegedAttribute privAttribute = (AjAttribute.PrivilegedAttribute) a; + privilegedAccess = privAttribute.getAccessedMembers(); } else if (a instanceof AjAttribute.SourceContextAttribute) { if (getResolvedTypeX().getSourceContext() instanceof SourceContextImpl) { AjAttribute.SourceContextAttribute sca = (AjAttribute.SourceContextAttribute) a; @@ -972,4 +973,9 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { public void setExposedToWeaver(boolean b) { exposedToWeaver = b; } + + @Override + public int getCompilerVersion() { + return wvInfo.getMajorVersion(); + } } diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java index d5fa8c882..2f1c8d2d8 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java @@ -63,6 +63,7 @@ import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.WeaverMessages; import org.aspectj.weaver.WeaverStateInfo; import org.aspectj.weaver.World; +import org.aspectj.weaver.AjAttribute.WeaverVersionInfo; import org.aspectj.weaver.model.AsmRelationshipProvider; import org.aspectj.weaver.patterns.DeclareAnnotation; import org.aspectj.weaver.patterns.Pointcut; @@ -567,8 +568,10 @@ public class BcelTypeMunger extends ConcreteTypeMunger { if (onType.equals(gen.getType())) { if (member.getKind() == Member.FIELD) { // System.out.println("matched: " + gen); - addFieldGetter(gen, member, AjcMemberMaker.privilegedAccessMethodForFieldGet(aspectType, member)); - addFieldSetter(gen, member, AjcMemberMaker.privilegedAccessMethodForFieldSet(aspectType, member)); + addFieldGetter(gen, member, AjcMemberMaker + .privilegedAccessMethodForFieldGet(aspectType, member, munger.shortSyntax)); + addFieldSetter(gen, member, AjcMemberMaker + .privilegedAccessMethodForFieldSet(aspectType, member, munger.shortSyntax)); return true; } else if (member.getKind() == Member.METHOD) { addMethodDispatch(gen, member, AjcMemberMaker.privilegedAccessMethodForMethod(aspectType, member)); @@ -1764,7 +1767,9 @@ public class BcelTypeMunger extends ConcreteTypeMunger { gen.addMethodGen(mg1); } else { weaver.addInitializer(this); - FieldGen fg = makeFieldGen(gen, AjcMemberMaker.interFieldClassField(field, aspectType)); + ResolvedMember newField = AjcMemberMaker.interFieldClassField(field, aspectType, + munger.version == NewFieldTypeMunger.VersionTwo); + FieldGen fg = makeFieldGen(gen, newField); if (annotationsOnRealMember != null) { for (int i = 0; i < annotationsOnRealMember.length; i++) { diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java index d21a2157f..c030e779e 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java @@ -1689,7 +1689,7 @@ public class BcelWeaver { didSomething = true; ResolvedTypeMunger newAnnotationTM = new AnnotationOnTypeMunger(annoX); newAnnotationTM.setSourceLocation(decA.getSourceLocation()); - onType.addInterTypeMunger(new BcelTypeMunger(newAnnotationTM, decA.getAspect().resolve(world))); + onType.addInterTypeMunger(new BcelTypeMunger(newAnnotationTM, decA.getAspect().resolve(world)), false); decA.copyAnnotationTo(onType); } } @@ -1749,7 +1749,7 @@ public class BcelWeaver { newParentMunger.setIsMixin(true); } newParentMunger.setSourceLocation(p.getSourceLocation()); - onType.addInterTypeMunger(new BcelTypeMunger(newParentMunger, xcutSet.findAspectDeclaringParents(p))); + onType.addInterTypeMunger(new BcelTypeMunger(newParentMunger, xcutSet.findAspectDeclaringParents(p)), false); } } return didSomething; @@ -1764,7 +1764,7 @@ public class BcelWeaver { for (Iterator i = typeMungerList.iterator(); i.hasNext();) { ConcreteTypeMunger m = (ConcreteTypeMunger) i.next(); if (!m.isLateMunger() && m.matches(onType)) { - onType.addInterTypeMunger(m); + onType.addInterTypeMunger(m, false); } } CompilationAndWeavingContext.leavingPhase(tok); diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java index 756f33dcc..4842315ae 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java @@ -748,7 +748,7 @@ public class BcelWorld extends World implements Repository { ResolvedTypeMunger newParentMunger = new NewParentTypeMunger(newParent); newParentMunger.setSourceLocation(p.getSourceLocation()); onType.addInterTypeMunger(new BcelTypeMunger(newParentMunger, getCrosscuttingMembersSet() - .findAspectDeclaringParents(p))); + .findAspectDeclaringParents(p)), false); } } return didSomething; @@ -775,7 +775,7 @@ public class BcelWorld extends World implements Repository { didSomething = true; ResolvedTypeMunger newAnnotationTM = new AnnotationOnTypeMunger(annoX); newAnnotationTM.setSourceLocation(decA.getSourceLocation()); - onType.addInterTypeMunger(new BcelTypeMunger(newAnnotationTM, decA.getAspect().resolve(this))); + onType.addInterTypeMunger(new BcelTypeMunger(newAnnotationTM, decA.getAspect().resolve(this)), false); decA.copyAnnotationTo(onType); } } -- 2.39.5