From e91fcabde7a38787ac03b5f98c6588aa8b3e411c Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Thu, 30 Oct 2014 14:33:12 -0700 Subject: Fix 449401: thisAspectInstance compile problem with -1.8 --- build/usedForMavenUpload/aspectjrt.pom | 2 +- build/usedForMavenUpload/aspectjtools.pom | 2 +- build/usedForMavenUpload/aspectjweaver.pom | 2 +- .../compiler/problem/AjProblemReporter.java | 2 + tests/src/org/aspectj/systemtest/AllTests18.java | 2 + .../org/aspectj/systemtest/ajc184/Ajc184Tests.java | 111 +++++++++++++ .../systemtest/ajc184/AllTestsAspectJ184.java | 27 ++++ tests/src/org/aspectj/systemtest/ajc184/ajc184.xml | 180 +++++++++++++++++++++ 8 files changed, 325 insertions(+), 3 deletions(-) create mode 100644 tests/src/org/aspectj/systemtest/ajc184/Ajc184Tests.java create mode 100644 tests/src/org/aspectj/systemtest/ajc184/AllTestsAspectJ184.java create mode 100644 tests/src/org/aspectj/systemtest/ajc184/ajc184.xml diff --git a/build/usedForMavenUpload/aspectjrt.pom b/build/usedForMavenUpload/aspectjrt.pom index b8c2b9344..25c6146d7 100644 --- a/build/usedForMavenUpload/aspectjrt.pom +++ b/build/usedForMavenUpload/aspectjrt.pom @@ -5,7 +5,7 @@ org.aspectj aspectjrt jar - 1.8.3.BUILD-SNAPSHOT + 1.8.4.BUILD-SNAPSHOT AspectJ runtime The runtime needed to execute a program using AspectJ http://www.aspectj.org diff --git a/build/usedForMavenUpload/aspectjtools.pom b/build/usedForMavenUpload/aspectjtools.pom index 9febb6265..defa88acf 100644 --- a/build/usedForMavenUpload/aspectjtools.pom +++ b/build/usedForMavenUpload/aspectjtools.pom @@ -5,7 +5,7 @@ org.aspectj aspectjtools jar - 1.8.3.BUILD-SNAPSHOT + 1.8.4.BUILD-SNAPSHOT AspectJ tools Tools from the AspectJ project http://www.aspectj.org diff --git a/build/usedForMavenUpload/aspectjweaver.pom b/build/usedForMavenUpload/aspectjweaver.pom index 314de8063..ad82e4093 100644 --- a/build/usedForMavenUpload/aspectjweaver.pom +++ b/build/usedForMavenUpload/aspectjweaver.pom @@ -5,7 +5,7 @@ org.aspectj aspectjweaver jar - 1.8.3.BUILD-SNAPSHOT + 1.8.4.BUILD-SNAPSHOT AspectJ weaver The AspectJ weaver introduces advices to java classes http://www.aspectj.org diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java index f9b26b59a..88556fccf 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java @@ -513,10 +513,12 @@ public class AjProblemReporter extends ProblemReporter { private final static char[] thisJoinPointName = "thisJoinPoint".toCharArray(); private final static char[] thisJoinPointStaticPartName = "thisJoinPointStaticPart".toCharArray(); private final static char[] thisEnclosingJoinPointStaticPartName = "thisEnclosingJoinPointStaticPart".toCharArray(); + private final static char[] thisAspectInstanceName = "thisAspectInstance".toCharArray(); public void uninitializedLocalVariable(LocalVariableBinding binding, ASTNode location) { if (CharOperation.equals(binding.name, thisJoinPointName) || CharOperation.equals(binding.name, thisJoinPointStaticPartName) || + CharOperation.equals(binding.name, thisAspectInstanceName) || CharOperation.equals(binding.name, thisEnclosingJoinPointStaticPartName)) { // If in advice, this is not a problem if (binding.declaringScope!=null && (binding.declaringScope.referenceContext() instanceof AdviceDeclaration || diff --git a/tests/src/org/aspectj/systemtest/AllTests18.java b/tests/src/org/aspectj/systemtest/AllTests18.java index 547a17817..aecbe05ab 100644 --- a/tests/src/org/aspectj/systemtest/AllTests18.java +++ b/tests/src/org/aspectj/systemtest/AllTests18.java @@ -17,12 +17,14 @@ import org.aspectj.systemtest.ajc180.AllTestsAspectJ180; import org.aspectj.systemtest.ajc181.AllTestsAspectJ181; import org.aspectj.systemtest.ajc182.AllTestsAspectJ182; import org.aspectj.systemtest.ajc183.AllTestsAspectJ183; +import org.aspectj.systemtest.ajc184.AllTestsAspectJ184; public class AllTests18 { public static Test suite() { TestSuite suite = new TestSuite("AspectJ System Test Suite - 1.8"); // $JUnit-BEGIN$ + suite.addTest(AllTestsAspectJ184.suite()); suite.addTest(AllTestsAspectJ183.suite()); suite.addTest(AllTestsAspectJ182.suite()); suite.addTest(AllTestsAspectJ181.suite()); diff --git a/tests/src/org/aspectj/systemtest/ajc184/Ajc184Tests.java b/tests/src/org/aspectj/systemtest/ajc184/Ajc184Tests.java new file mode 100644 index 000000000..7ba5654ab --- /dev/null +++ b/tests/src/org/aspectj/systemtest/ajc184/Ajc184Tests.java @@ -0,0 +1,111 @@ +/******************************************************************************* + * Copyright (c) 2014 Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc184; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Andy Clement + */ +public class Ajc184Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + // The thisAspectInstance tests here are a copy from Ajc1612Tests but we are compiling with -1.8 and not -1.5 + + public void testThisAspectInstance_239649_1() throws Exception { + // simple case + runTest("thisAspectInstance - 1"); + } + + public void testThisAspectInstance_239649_2() throws Exception { + // before advice toggling on/off through if called method + runTest("thisAspectInstance - 2"); + } + + public void testThisAspectInstance_239649_3() throws Exception { + // after advice toggling on/off through if called method + runTest("thisAspectInstance - 3"); + } + + public void testThisAspectInstance_239649_4() throws Exception { + // before advice, also using thisJoinPointStaticPart + runTest("thisAspectInstance - 4"); + } + + public void testThisAspectInstance_239649_5() throws Exception { + // before advice, also using thisJoinPoint + runTest("thisAspectInstance - 5"); + } + + public void testThisAspectInstance_239649_6() throws Exception { + // before advice, also using thisEnclosingJoinPointStaticPart + runTest("thisAspectInstance - 6"); + } + + public void testThisAspectInstance_239649_7() throws Exception { + // before advice, also using thisJoinPoint and thisJoinPointStaticPart + runTest("thisAspectInstance - 7"); + } + + public void testThisAspectInstance_239649_8() throws Exception { + // before advice, also using abstract aspects + runTest("thisAspectInstance - 8"); + } + + public void testThisAspectInstance_239649_9() throws Exception { + // before advice, also using abstract aspects 2 + runTest("thisAspectInstance - 9"); + } + + public void testThisAspectInstance_239649_10() throws Exception { + // aspects in a package + runTest("thisAspectInstance - 10"); + } + + public void testThisAspectInstance_239649_11() throws Exception { + // non-singleton aspect - should be an error for now + runTest("thisAspectInstance - 11"); + } + + public void testThisAspectInstance_239649_12() throws Exception { + // arg binding and tjpsp + runTest("thisAspectInstance - 12"); + } + + public void testThisAspectInstance_239649_13() throws Exception { + // pass instance + runTest("thisAspectInstance - 13"); + } + + public void testThisAspectInstance_239649_14() throws Exception { + // multiple ifs + runTest("thisAspectInstance - 14"); + } + + public void testThisAspectInstance_239649_15() throws Exception { + // abstract aspects + runTest("thisAspectInstance - 15"); + } + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc184Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc184.xml"); + } + +} diff --git a/tests/src/org/aspectj/systemtest/ajc184/AllTestsAspectJ184.java b/tests/src/org/aspectj/systemtest/ajc184/AllTestsAspectJ184.java new file mode 100644 index 000000000..1c1c61a98 --- /dev/null +++ b/tests/src/org/aspectj/systemtest/ajc184/AllTestsAspectJ184.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2014 Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc184; + +import junit.framework.Test; +import junit.framework.TestSuite; +import org.aspectj.systemtest.apt.AptTests; + +public class AllTestsAspectJ184 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.8.4 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc184Tests.suite()); + suite.addTest(AptTests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/org/aspectj/systemtest/ajc184/ajc184.xml b/tests/src/org/aspectj/systemtest/ajc184/ajc184.xml new file mode 100644 index 000000000..01d4d2312 --- /dev/null +++ b/tests/src/org/aspectj/systemtest/ajc184/ajc184.xml @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3