]> source.dussan.org Git - aspectj.git/commitdiff
307120: field accesses in itds of private fields
authoraclement <aclement>
Thu, 25 Mar 2010 22:01:17 +0000 (22:01 +0000)
committeraclement <aclement>
Thu, 25 Mar 2010 22:01:17 +0000 (22:01 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedHandler.java

index 1e4e3c355e6077eb7a2643aaf34dd0b22595d9fd..62ea86f055588c0630416fbd2aee41d6453c4954 100644 (file)
@@ -30,6 +30,9 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
 import org.aspectj.weaver.AjcMemberMaker;
 import org.aspectj.weaver.Lint;
 import org.aspectj.weaver.Member;
+import org.aspectj.weaver.PrivilegedAccessMunger;
+import org.aspectj.weaver.ReferenceType;
+import org.aspectj.weaver.ReferenceTypeDelegate;
 import org.aspectj.weaver.ResolvedMember;
 import org.aspectj.weaver.ResolvedMemberImpl;
 import org.aspectj.weaver.ResolvedType;
@@ -63,6 +66,14 @@ public class PrivilegedHandler implements IPrivilegedHandler {
                checkWeaveAccess(key.getDeclaringType(), location);
                if (!baseField.alwaysNeedsAccessMethod(true))
                        accessors.put(key, ret);
+               // 307120
+               ResolvedType rt = inAspect.factory.fromEclipse(baseField.declaringClass);
+               if (rt!=null) {
+                       ReferenceTypeDelegate rtd = ((ReferenceType)rt).getDelegate();
+                       if (rtd instanceof EclipseSourceType) {
+                               rt.addInterTypeMunger(new EclipseTypeMunger(inAspect.factory,new PrivilegedAccessMunger(key, true),inAspect.typeX,null), true);
+                       }
+               }
                return ret;
        }
 
@@ -89,9 +100,16 @@ public class PrivilegedHandler implements IPrivilegedHandler {
                        ret = inAspect.factory.makeMethodBinding(AjcMemberMaker.privilegedAccessMethodForMethod(inAspect.typeX, key));
                }
                checkWeaveAccess(key.getDeclaringType(), location);
-               // System.err.println(ret);
-               // Thread.dumpStack();
                accessors.put(key, ret);
+//             if (!baseMethod.isConstructor()) {
+//                     ResolvedType rt = inAspect.factory.fromEclipse(baseMethod.declaringClass);
+//                     if (rt!=null) {
+//                             ReferenceTypeDelegate rtd = ((ReferenceType)rt).getDelegate();
+//                             if (rtd instanceof EclipseSourceType) {
+//                                     rt.addInterTypeMunger(new EclipseTypeMunger(inAspect.factory,new PrivilegedAccessMunger(key, true),inAspect.typeX,null), true);
+//                             }
+//                     }
+//             }
                return ret;
        }