summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-08-31 14:24:14 +0000
committeracolyer <acolyer>2005-08-31 14:24:14 +0000
commit6c8747b590e9e9092ae256f2c7af0db169a6e2e4 (patch)
tree35102a2c59e0abb70eded4e6500bf646010f1f60
parentf2af562611c7e060ebd71b9b29d6766ffcb9c727 (diff)
downloadaspectj-6c8747b590e9e9092ae256f2c7af0db169a6e2e4.tar.gz
aspectj-6c8747b590e9e9092ae256f2c7af0db169a6e2e4.zip
tests and fix for pr107858, inline field access in argument to proceed with too many arguments
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java2
-rw-r--r--tests/bugs150/pr107858.aj12
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java4
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ajc150.xml7
4 files changed, 24 insertions, 1 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java
index 779dc9ee4..1a310d980 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java
@@ -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
index 000000000..2b107e4dd
--- /dev/null
+++ b/tests/bugs150/pr107858.aj
@@ -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
diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
index 21ee9ab7a..864acd233 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
@@ -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) {
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
index acd56fa82..a5cdcfdc1 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
@@ -390,6 +390,13 @@
<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>
+
<!-- ============================================================================ -->
<!-- ============================================================================ -->