]> source.dussan.org Git - aspectj.git/commitdiff
fix for Bugzilla Bug 36673
authorjhugunin <jhugunin>
Tue, 22 Apr 2003 17:31:26 +0000 (17:31 +0000)
committerjhugunin <jhugunin>
Tue, 22 Apr 2003 17:31:26 +0000 (17:31 +0000)
   VerifyError in privileged aspect

org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedFieldBinding.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedHandler.java

index a2bfe7d7723584678171a470bee2830e15a1c4d0..c053cab0880e44bff3bdf09d08623189e24c91af 100644 (file)
@@ -54,6 +54,9 @@ public class PrivilegedFieldBinding extends FieldBinding {
 
 
        public SyntheticAccessMethodBinding getAccessMethod(boolean isReadAccess) {
+               if (baseField.alwaysNeedsAccessMethod(isReadAccess)) {
+                       return baseField.getAccessMethod(isReadAccess);
+               }
                if (isReadAccess) return reader;
                else return writer;
        }
index f6b482b68e4bd7da13892c731f67d092bb4f8cff..3343e063458d7dc1be27aa4ce88889ebe44affb1 100644 (file)
@@ -43,16 +43,18 @@ public class PrivilegedHandler implements IPrivilegedHandler {
                this.inAspect = inAspect;
        }
 
-       public FieldBinding getPrivilegedAccessField(FieldBinding baseField, AstNode location) {
+       public FieldBinding getPrivilegedAccessField(FieldBinding baseField, AstNode location) {                
                ResolvedMember key = inAspect.factory.makeResolvedMember(baseField);
                if (accessors.containsKey(key)) return (FieldBinding)accessors.get(key);
                FieldBinding ret = new PrivilegedFieldBinding(inAspect, baseField);
                checkWeaveAccess(key.getDeclaringType(), location);
-               accessors.put(key, ret);
+               if (!baseField.alwaysNeedsAccessMethod(true)) accessors.put(key, ret);
                return ret;
        }
 
        public MethodBinding getPrivilegedAccessMethod(MethodBinding baseMethod, AstNode location) {
+               if (baseMethod.alwaysNeedsAccessMethod()) return baseMethod;
+               
                ResolvedMember key = inAspect.factory.makeResolvedMember(baseMethod);
                if (accessors.containsKey(key)) return (MethodBinding)accessors.get(key);