From 6c8747b590e9e9092ae256f2c7af0db169a6e2e4 Mon Sep 17 00:00:00 2001 From: acolyer Date: Wed, 31 Aug 2005 14:24:14 +0000 Subject: [PATCH] tests and fix for pr107858, inline field access in argument to proceed with too many arguments --- .../compiler/ast/AccessForInlineVisitor.java | 2 +- tests/bugs150/pr107858.aj | 12 ++++++++++++ .../org/aspectj/systemtest/ajc150/Ajc150Tests.java | 4 ++++ tests/src/org/aspectj/systemtest/ajc150/ajc150.xml | 7 +++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 tests/bugs150/pr107858.aj 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 @@ + + + + + + + -- 2.39.5