]> source.dussan.org Git - aspectj.git/commitdiff
tests and fix for pr107858, inline field access in argument to proceed with too many...
authoracolyer <acolyer>
Wed, 31 Aug 2005 14:24:14 +0000 (14:24 +0000)
committeracolyer <acolyer>
Wed, 31 Aug 2005 14:24:14 +0000 (14:24 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java
tests/bugs150/pr107858.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml

index 779dc9ee43804f4f5fddf30adc2a777c59bf6a99..1a310d980f51323997887873a059dc9d07e33f1d 100644 (file)
@@ -142,7 +142,7 @@ public class AccessForInlineVisitor extends ASTVisitor {
        
        private FieldBinding getAccessibleField(FieldBinding binding, TypeBinding receiverType) {
                //System.err.println("checking field: " + binding);
-               if (!binding.isValidBinding()) return binding;
+               if (binding == null || !binding.isValidBinding()) return binding;
                
                makePublic(receiverType);
                if (isPublic(binding)) return binding;
diff --git a/tests/bugs150/pr107858.aj b/tests/bugs150/pr107858.aj
new file mode 100644 (file)
index 0000000..2b107e4
--- /dev/null
@@ -0,0 +1,12 @@
+class Foo {
+  Foo field;
+  void test() {}
+}
+
+public aspect pr107858 {
+  void around() : call(void Foo.test()) {
+    Foo foo = new Foo().field;
+    proceed(foo); // caught at compile time
+    proceed(new Foo().field); // crashes
+  }
+}
\ No newline at end of file
index 21ee9ab7af4fa4f34e54cab36ed58c80288ea223..864acd2332a79f73d50aecea061687b6ccdca642 100644 (file)
@@ -330,6 +330,10 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
          runTest("inner class passed as argument to varargs method");
   }
   
+  public void testInlinedFieldAccessInProceedCall() {
+         runTest("inlined field access in proceed call");
+  }
+  
   // helper methods.....
   
   public SyntheticRepository createRepos(File cpentry) {
index acd56fa82caf630c0ca49887a3e73e885671c06a..a5cdcfdc1492f7662cb3f0984afe81c0e2052a60 100644 (file)
         <compile files="pr104024.aj" options="-1.5"/>
     </ajc-test>  
     
+    <ajc-test dir="bugs150" pr="107858" title="inlined field access in proceed call">
+        <compile files="pr107858.aj" options="-1.5">
+            <message kind="error" line="9" text="too many arguments to proceed, expected 0"></message>
+            <message kind="error" line="10" text="too many arguments to proceed, expected 0"></message>
+        </compile>
+    </ajc-test>  
     <!-- ============================================================================ -->
     <!-- ============================================================================ -->