diff options
author | Andy Clement <aclement@pivotal.io> | 2019-01-30 16:55:38 -0800 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2019-01-30 16:55:38 -0800 |
commit | 2b24e7377da7c849fe7f9f4fa06a701664f9d27d (patch) | |
tree | 64c36c8fcf29633af7a5e2f7405b94cbec629ca8 /tests/src/test/java | |
parent | d60de8d0b3e62eb36b612a824bb9345d865c0155 (diff) | |
download | aspectj-2b24e7377da7c849fe7f9f4fa06a701664f9d27d.tar.gz aspectj-2b24e7377da7c849fe7f9f4fa06a701664f9d27d.zip |
mavenizing tests - wip
Diffstat (limited to 'tests/src/test/java')
303 files changed, 66435 insertions, 0 deletions
diff --git a/tests/src/test/java/org/aspectj/systemtest/AllTests.java b/tests/src/test/java/org/aspectj/systemtest/AllTests.java new file mode 100644 index 000000000..a4aec7d68 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/AllTests.java @@ -0,0 +1,61 @@ +/* + * Created on 03-Aug-2004 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.aspectj.systemtest; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.aspectj.systemtest.ajc10x.Ajc10xTests; +import org.aspectj.systemtest.ajc11.Ajc11Tests; +import org.aspectj.systemtest.ajc120.Ajc120Tests; +import org.aspectj.systemtest.ajc121.Ajc121Tests; +import org.aspectj.systemtest.aspectpath.AspectPathTests; +import org.aspectj.systemtest.base.BaseTests; +import org.aspectj.systemtest.design.DesignTests; +import org.aspectj.systemtest.incremental.IncrementalTests; +import org.aspectj.systemtest.incremental.model.IncrementalModelTests; +import org.aspectj.systemtest.incremental.tools.OutputLocationManagerTests; +import org.aspectj.systemtest.inpath.InPathTests; +import org.aspectj.systemtest.model.ModelTests; +import org.aspectj.systemtest.options.OptionsTests; +import org.aspectj.systemtest.pre10x.AjcPre10xTests; +import org.aspectj.systemtest.serialVerUID.SUIDTests; +import org.aspectj.systemtest.tracing.TracingTests; +import org.aspectj.systemtest.xlint.XLintTests; + +/** + * @author colyer + */ +public class AllTests { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ System Test Suite - JDK 1.3"); + //$JUnit-BEGIN$ + suite.addTest(Ajc121Tests.suite()); + suite.addTest(Ajc120Tests.suite()); + suite.addTest(Ajc11Tests.suite()); + suite.addTest(Ajc10xTests.suite()); + suite.addTest(AspectPathTests.suite()); + suite.addTest(InPathTests.suite()); + suite.addTest(BaseTests.suite()); + suite.addTest(DesignTests.suite()); + suite.addTest(IncrementalTests.suite()); + suite.addTestSuite(OutputLocationManagerTests.class); + suite.addTest(IncrementalModelTests.suite()); + //suite.addTest(KnownLimitationsTests.class); + suite.addTest(OptionsTests.suite()); + suite.addTest(AjcPre10xTests.suite()); + //suite.addTest(PureJavaTests.class); + suite.addTest(SUIDTests.suite()); + suite.addTest(XLintTests.suite()); + suite.addTest(TracingTests.suite()); + suite.addTest(ModelTests.suite()); + //$JUnit-END$ + + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/AllTests14.java b/tests/src/test/java/org/aspectj/systemtest/AllTests14.java new file mode 100644 index 000000000..da97c7337 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/AllTests14.java @@ -0,0 +1,30 @@ +/* + * Created on 03-Aug-2004 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.aspectj.systemtest; + +import org.aspectj.systemtest.java14.Java14Tests; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * @author colyer + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class AllTests14 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ System Test Suite - JDK 1.4"); + //$JUnit-BEGIN$ + suite.addTest(AllTests.suite()); + suite.addTest(Java14Tests.suite()); + //$JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/AllTests15.java b/tests/src/test/java/org/aspectj/systemtest/AllTests15.java new file mode 100644 index 000000000..8b19ef23b --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/AllTests15.java @@ -0,0 +1,49 @@ +/* + * Created on 19-01-2005 + */ +package org.aspectj.systemtest; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.aspectj.systemtest.ajc150.AllTestsAspectJ150; +import org.aspectj.systemtest.ajc150.ataspectj.AtAjAnnotationGenTests; +import org.aspectj.systemtest.ajc151.AllTestsAspectJ151; +import org.aspectj.systemtest.ajc152.AllTestsAspectJ152; +import org.aspectj.systemtest.ajc153.AllTestsAspectJ153; +import org.aspectj.systemtest.ajc154.AllTestsAspectJ154; +import org.aspectj.systemtest.incremental.tools.IncrementalCompilationTests; +import org.aspectj.systemtest.incremental.tools.IncrementalOutputLocationManagerTests; +import org.aspectj.systemtest.incremental.tools.IncrementalPerformanceTests; +import org.aspectj.systemtest.incremental.tools.MoreOutputLocationManagerTests; +import org.aspectj.systemtest.incremental.tools.MultiProjectIncrementalTests; +import org.aspectj.systemtest.model.Model5Tests; +import org.aspectj.systemtest.xlint.XLint5Tests; + +public class AllTests15 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ System Test Suite - JDK 1.5"); + // $JUnit-BEGIN$ + suite.addTest(AllTests14.suite()); + suite.addTest(AllTestsAspectJ150.suite()); + suite.addTest(AllTestsAspectJ151.suite()); + suite.addTest(AllTestsAspectJ152.suite()); + suite.addTest(AllTestsAspectJ153.suite()); + suite.addTest(AllTestsAspectJ154.suite()); + suite.addTest(AtAjAnnotationGenTests.suite()); + suite.addTest(Model5Tests.suite()); + /* + * FIXME maw Many of these tests do not depend on Java 5 but they cannot be executed in Eclipse with 1.3 because of XML + * issues and are excluded on the build machine so moving them here loses nothing for the moment. + */ + suite.addTestSuite(MultiProjectIncrementalTests.class); + suite.addTestSuite(IncrementalCompilationTests.class); + suite.addTestSuite(IncrementalPerformanceTests.class); + suite.addTestSuite(MoreOutputLocationManagerTests.class); + suite.addTestSuite(IncrementalOutputLocationManagerTests.class); + suite.addTest(XLint5Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/AllTests16.java b/tests/src/test/java/org/aspectj/systemtest/AllTests16.java new file mode 100644 index 000000000..f1f7b4a14 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/AllTests16.java @@ -0,0 +1,45 @@ +/* + * Created on 19-01-2005 + */ +package org.aspectj.systemtest; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.aspectj.systemtest.ajc160.AllTestsAspectJ160; +import org.aspectj.systemtest.ajc161.AllTestsAspectJ161; +import org.aspectj.systemtest.ajc1610.AllTestsAspectJ1610; +import org.aspectj.systemtest.ajc1611.AllTestsAspectJ1611; +import org.aspectj.systemtest.ajc1612.AllTestsAspectJ1612; +import org.aspectj.systemtest.ajc162.AllTestsAspectJ162; +import org.aspectj.systemtest.ajc163.AllTestsAspectJ163; +import org.aspectj.systemtest.ajc164.AllTestsAspectJ164; +import org.aspectj.systemtest.ajc165.AllTestsAspectJ165; +import org.aspectj.systemtest.ajc166.AllTestsAspectJ166; +import org.aspectj.systemtest.ajc167.AllTestsAspectJ167; +import org.aspectj.systemtest.ajc169.AllTestsAspectJ169; +import org.aspectj.systemtest.incremental.tools.AnnotationProcessingTests; + +public class AllTests16 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ System Test Suite - JDK 1.6"); + // $JUnit-BEGIN$ + // These 16X tests do not require 1.6 jre to run + suite.addTest(AllTestsAspectJ160.suite()); + suite.addTest(AllTestsAspectJ161.suite()); + suite.addTest(AllTestsAspectJ162.suite()); + suite.addTest(AllTestsAspectJ163.suite()); + suite.addTest(AllTestsAspectJ164.suite()); + suite.addTest(AllTestsAspectJ165.suite()); + suite.addTest(AllTestsAspectJ166.suite()); + suite.addTest(AllTestsAspectJ167.suite()); + suite.addTest(AllTestsAspectJ169.suite()); + suite.addTest(AllTestsAspectJ1610.suite()); + suite.addTest(AllTestsAspectJ1611.suite()); + suite.addTest(AllTestsAspectJ1612.suite()); + suite.addTestSuite(AnnotationProcessingTests.class); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/AllTests17.java b/tests/src/test/java/org/aspectj/systemtest/AllTests17.java new file mode 100644 index 000000000..9feebfb1e --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/AllTests17.java @@ -0,0 +1,32 @@ +/* + * Created on 19-01-2005 + */ +package org.aspectj.systemtest; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.aspectj.systemtest.ajc170.AllTestsAspectJ170; +import org.aspectj.systemtest.ajc171.AllTestsAspectJ171; +import org.aspectj.systemtest.ajc172.AllTestsAspectJ172; +import org.aspectj.systemtest.ajc173.AllTestsAspectJ173; +import org.aspectj.systemtest.ajc174.AllTestsAspectJ174; +import org.aspectj.systemtest.ajc175.AllTestsAspectJ175; + +public class AllTests17 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ System Test Suite - 1.7"); + // $JUnit-BEGIN$ + suite.addTest(AllTestsAspectJ175.suite()); + suite.addTest(AllTestsAspectJ174.suite()); + suite.addTest(AllTestsAspectJ173.suite()); + suite.addTest(AllTestsAspectJ172.suite()); + suite.addTest(AllTestsAspectJ171.suite()); + suite.addTest(AllTestsAspectJ170.suite()); + suite.addTest(AllTests16.suite()); + suite.addTest(AllTests15.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/AllTests18.java b/tests/src/test/java/org/aspectj/systemtest/AllTests18.java new file mode 100644 index 000000000..9c2387b0d --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/AllTests18.java @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2013, 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; + +import org.aspectj.systemtest.ajc180.AllTestsAspectJ180; +import org.aspectj.systemtest.ajc181.AllTestsAspectJ181; +import org.aspectj.systemtest.ajc1810.AllTestsAspectJ1810; +import org.aspectj.systemtest.ajc1811.AllTestsAspectJ1811; +import org.aspectj.systemtest.ajc182.AllTestsAspectJ182; +import org.aspectj.systemtest.ajc183.AllTestsAspectJ183; +import org.aspectj.systemtest.ajc184.AllTestsAspectJ184; +import org.aspectj.systemtest.ajc185.AllTestsAspectJ185; +import org.aspectj.systemtest.ajc186.AllTestsAspectJ186; +import org.aspectj.systemtest.ajc187.AllTestsAspectJ187; +import org.aspectj.systemtest.ajc188.AllTestsAspectJ188; +import org.aspectj.systemtest.ajc189.AllTestsAspectJ189; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTests18 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ System Test Suite - 1.8"); + // $JUnit-BEGIN$ + suite.addTest(AllTestsAspectJ1811.suite()); + suite.addTest(AllTestsAspectJ1810.suite()); + suite.addTest(AllTestsAspectJ189.suite()); + suite.addTest(AllTestsAspectJ188.suite()); + suite.addTest(AllTestsAspectJ187.suite()); + suite.addTest(AllTestsAspectJ186.suite()); + suite.addTest(AllTestsAspectJ185.suite()); + suite.addTest(AllTestsAspectJ184.suite()); + suite.addTest(AllTestsAspectJ183.suite()); + suite.addTest(AllTestsAspectJ182.suite()); + suite.addTest(AllTestsAspectJ181.suite()); + suite.addTest(AllTestsAspectJ180.suite()); + suite.addTest(AllTests17.suite()); +// suite.addTest(AllTests16.suite()); +// suite.addTest(AllTests15.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/AllTests19.java b/tests/src/test/java/org/aspectj/systemtest/AllTests19.java new file mode 100644 index 000000000..c2c798c32 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/AllTests19.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2013, 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; + +import org.aspectj.systemtest.ajc190.AllTestsAspectJ190; +import org.aspectj.systemtest.ajc191.AllTestsAspectJ191; +import org.aspectj.systemtest.ajc192.AllTestsAspectJ192; +import org.aspectj.systemtest.ajc193.AllTestsAspectJ193; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTests19 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ System Test Suite - 1.9"); + // $JUnit-BEGIN$ + suite.addTest(AllTestsAspectJ190.suite()); + suite.addTest(AllTestsAspectJ191.suite()); + suite.addTest(AllTestsAspectJ192.suite()); + suite.addTest(AllTestsAspectJ193.suite()); + suite.addTest(AllTests18.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc10x/Ajc10xTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc10x/Ajc10xTests.java new file mode 100644 index 000000000..1fb6b7045 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc10x/Ajc10xTests.java @@ -0,0 +1,1176 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM Corporation + * 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 + * + * ******************************************************************/ +package org.aspectj.systemtest.ajc10x; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class Ajc10xTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc10xTests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc10x.xml"); + } + + public void test001() { + runTest("properly make choice between cast and parenthesis in parser"); + } + + public void test002() { + runTest("field from implemented interface not found in advice"); + } + + public void test003() { + runTest("make sure advice affects introduced methods and constructors"); + } + + public void test004() { + runTest("new around construct"); + } + + public void test005() { + runTest("aspect redefines a parameter"); + } + + public void test006() { + runTest("introducing extends and implements"); + } + + public void test007() { + runTest("(related) aspect on interface"); + } + + public void test008() { + runTest("advice and package visibility"); + } + + public void test009() { + runTest("advice and package visibility"); + } + + public void test010() { + runTest("advice on implied empty constructor"); + } + + public void test011() { + runTest("advice on * *(..) not mapping to initializers"); + } + + public void test012() { + runTest("three type declarations in the scope of an advice"); + } + + public void test013() { + runTest("introduction fails on class with an inner class that extends or implements something"); + } + + public void test014() { + runTest("checks that methods are introduced on the topmost class implemented"); + } + + public void test015() { + runTest("a couple different returns from around advice"); + } + + public void test016() { + runTest("member finally advice paired with signature advice"); + } + + public void test017() { + runTest("aspect of eachobject(instanceof(Interface))"); + } + + public void test018() { + runTest("final member initialization broken with JDK before 1.1.8"); + } + + public void test019() { + runTest("same package and var name clash in preprocessed code when aspectOf is used"); + } + + public void test020() { + runTest("and PR#201 advice on static methods fails javac compile with this"); + } + + public void test021() { + runTest("non-static advice on inner class defined inside of method body"); + } + + public void test022() { + runTest("simple single-threaded eachcflow test (includes aspectOf)"); + } + + public void test023() { + runTest("bad type resolution when var reassigned in same scope"); + } + + public void test024() { + runTest("generating the right throws clause for call-site advice (and around)"); + } + + public void test025() { + runTest("advice on calls to static methods using several syntax"); + } + + public void test026() { + runTest(", PR#249, PR#250 advice on constructor sites"); + } + + public void test027() { + runTest("test after throwing advice in several ways"); + } + + public void test028() { + runTest("fancy name patterns for method names"); + } + + public void test029() { + runTest("calls: calls(...)"); + } + + public void test030() { + runTest("throws Exception clause is unnecessarily added to Driver.main method"); + } + + public void test031() { + runTest("javac fails when this is referenced in the static main method"); + } + + public void test032() { + runTest("and 276 cast error generated by ajc when type not in signature"); + } + + public void test033() { + runTest("calls to methods to which we don't have source"); + } + + public void test034() { + runTest("more aspect inheritance"); + } + + public void test035() { + runTest("around and calls with both calling and called this params"); + } + + public void test036() { + runTest("compiler crashes with eachobject and named pointcuts with parameters"); + } + + public void test037() { + runTest("lookup rules for unqualified pointcut names"); + } + + public void test038() { + runTest("eachcflow only instantiated if the aspect has some advice in it"); + } + + public void test039() { + runTest("(DESIGN QUESTION) aspect of eachJVM advising its own initializer"); + } + + public void test040() { + runTest("after returning advice on calls to constructors"); + } + + public void test041() { + runTest("Does annotating 'new' with a type work as desired?"); + } + + public void test042() { + runTest("Referring to inner classes as {super}.{inner} confused ajc."); + } + + public void test043() { + runTest("Advice on advice"); + } + + public void test044() { + runTest("Introductions on other introductions"); + } + + public void test045() { + runTest("Putting advice on array constructors."); + } + + public void test046() { + runTest("call points within block inner classes are doubled"); + } + + public void test047() { + runTest("Gets and sets with other advice"); + } + + public void test048() { + runTest("Compiler can compile correct strictfp modifiers"); + } + + public void test049() { + runTest("basic test of callsto pointcuts"); + } + + public void test050() { + runTest("package wildcards in packages"); + } + + public void test051() { + runTest("around advice on calls and receptions with lots of context"); + } + + public void test052() { + runTest("! modifier and char in pointcut (no longer an error)"); + } + + public void test053() { + runTest("right number of aspect instances per cflow"); + } + + public void test054() { + runTest("many this's into around advice on calls"); + } + + public void test055() { + runTest("Ensures introduction methods can have advice placed on them"); + } + + public void test056() { + runTest("No boolean appearing in the 'if' clause for around advice with eachJVM()"); + } + + public void test057() { + runTest("Order of super introductions."); + } + + public void test058() { + runTest("Ensuring backdoor methods are produced."); + } + + public void test059() { + runTest("no duplicate advice methods in abstract aspects"); + } + + public void test060() { + runTest("no duplicate advice methods in abstract aspects extended"); + } + + public void test061() { + runTest("Putting after-constructor advice on the wrong types implementing the same interface."); + } + + public void test062() { + runTest("Instantiating non-static inner classes in advice."); + } + + public void test063() { + runTest("Referring to pointcut in of clauses"); + } + + public void test064() { + runTest("Confused referring to instance variables and locals"); + } + + public void test065() { + runTest("Parsing C+ expressions without parens in super introductions."); + } + + public void test066() { + runTest("Introducing methods on classes that implements inner-interfaces with +implements."); + } + + public void test067() { + runTest("Methods with the same name are generated when abstract aspects extend another abstract aspect."); + } + + public void test068() { + runTest("Making sure final variables stay final."); + } + + public void test069() { + runTest("Problem resolving meta-joinpoint names with around advice on methods called from around advice."); + } + + public void test070() { + runTest("Make sure that names of lifted local classes are right when referenced in call-site advice"); + } + + public void test071() { + runTest("matching for throws clause"); + } + + public void test072() { + runTest("basic test of declare soft"); + } + + public void test073() { + runTest("advice on calls to constructors of anonymous inners and access to context"); + } + + public void test074() { + runTest("inner aspects can't access outer pointcuts"); + } + + public void test075() { + runTest("implements and extends are introduced before methods and fields"); + } + + public void test076() { + runTest("a static/inner aspect of a inner class of an aspect is pulled to the top level as static"); + } + + public void test077() { + runTest("Crashes with privileged aspect."); + } + + public void test078() { + runTest("join points exist in the execution of field initializers"); + } + + public void test079() { + try { + runTest("privileged aspects"); + } finally { + System.out.println(ajc.getLastCompilationResult().getStandardError()); + System.out.println(ajc.getLastCompilationResult().getStandardOutput()); + } + } + + public void test080() { + runTest("advice on field gets in privileged aspects"); + } + + public void test081() { + runTest("Two anonymous classes in the same scope"); + } + + public void test082() { + runTest("basic tests for initializer and staticinitializer PCDs"); + } + + public void test083() { + runTest("introduction of an initializer into a class"); + } + + public void test084() { + runTest("some method accessibility tests, particularly package-protected and inheritance"); + } + + public void test085() { + runTest("fairly monotonous (and non-covering) tests for expanded dot patterns"); + } + + public void test086() { + runTest("field patterns and subtyping"); + } + + public void test087() { + runTest("Checking formal matching as in Roeder's bug in 0.7b10"); + } + + public void test088() { + runTest("Introducing synchronized methods on interfaces."); + } + + public void test089() { + runTest("The pointcut params (..,int..) is not recognizing (Object,int,Object)."); + } + + public void test090() { + runTest("calls advice on array objects causes error in code generation"); + } + + public void test091() { + runTest("join points in field initializers aren't showing up."); + } + + public void test092() { + runTest("Handlers problem"); + } + + public void test093() { + runTest("work nicely with inner class method look-up rules and call-site advice"); + } + + public void test094() { + runTest("strictfp modifier allowed on advice"); + } + + public void test095() { + runTest("No argthis was being created for calls advice."); + } + + public void test096() { + runTest("Ensuring no advice with instanceof(..) is run on static methods."); + } + + public void test097() { + runTest("Null pointer on gets advice showing the case causing the error"); + } + + public void test098() { + runTest("try to make sure that dynamic JoinPoint objects aren't generated when used inside of if (false) { ... }"); + } + + public void test099() { + runTest("within and withincode (doesn't all work due to local class name issues)"); + } + + public void test100() { + runTest("around advice on calls within inner classes (including protected method calls)"); + } + + public void test101() { + runTest("around advice on calls within inner classes (including protected method calls)"); + } + + public void test102() { + runTest("Arguments to runNext should be final when needed"); + } + + public void test103() { + runTest("Method introductions"); + } + + public void test104() { + runTest("Putting an introduced method on each interface"); + } + + public void test105() { + runTest("Extending interfaces"); + } + + public void test106() { + runTest("Introducing private methods on interfaces"); + } + + public void test107() { + runTest("Issuing errors for assigning variables thisJoinPoint -- not assigning thisJoinPoint."); + } + + public void test108() { + runTest("Static references inside of introduced bodies get bound correctly."); + } + + public void test109() { + runTest("cflow and object creations [of eachcflow]"); + } + + public void test110() { + runTest("Doesn't import MightHaveAspect when compiling with more than 1 file. [eachobject]"); + } + + public void test111() { + runTest("test binding to formals in calls to constructors (binding to null) (eachobject !!! now misnamed)"); + } + + public void test112() { + runTest("After advice isn't being woven into after throwing advice"); + } + + public void test113() { + runTest("Throwing an EmptyStackException."); + } + + public void test114() { + runTest("check that MightHaveAspect interface is created correctly for an aspect in deep package"); + } + + public void test115() { + runTest("Defines clfow$ajc0 more once. [eachcflow]"); + } + + public void test116() { + runTest("Various calls, receptions, and callsto tests [callsto]"); + } + + public void test117() { + runTest("Was throwing exception, now just an error. [eachobject]"); + } + + public void test118() { + runTest("different version of aspect inheritance, particularly empty pointcuts and abstract cflows [eachcflow]"); + } + + public void test119() { + runTest("set advice on member initing throwing exception [eachobject]"); + } + + public void test120() { + runTest("Testing class names with same name's with difference case as package. [eachobject]"); + } + + public void test121() { + runTest("Null pointer on gets advice with coverage [painful]"); + } + + public void test122() { + runTest("Basic test for cflow pointcuts [eachcflow]"); + } + + public void test123() { + runTest("Crashing when looking up the type of array members."); + } + + public void test124() { + runTest("PostfixExprs to various synthetic things are fixed correctly [eachobject]"); + } + + public void test125() { + runTest("Dave Binkley's problem with eachcflowroot. [eachcflow]"); + } + + public void test126() { + runTest("advice on an inherited method"); + } + + public void test127() { + runTest(", PR#115 checks the ordering of catch clauses"); + } + + public void test128() { + runTest("various declared exception permutations"); + } + + public void test129() { + runTest("ordering of advice kinds as well as cflow and dominates"); + } + + public void test130() { + runTest("advice on default constructor for a class only referenced via reflection"); + } + + public void test131() { + runTest("calling and called this params in calls points"); + } + + public void test132() { + runTest("primitive parameters coercable to Object just like return values are"); + } + + public void test133() { + runTest("join points in static/dynamic initializers aren't showing up."); + } + + public void test134() { + runTest("Gets and sets on a number of variables (field access ???)"); + } + + public void test135() { + runTest("Joinpoints are showing up on intermediate call sites"); + } + + public void test136() { + runTest("Reception based on strictfp modifier"); + } + + public void test137() { + runTest("Subclasses that do not redefine a method are not being handled correctly"); + } + + public void test138() { + runTest("making sure that super calls are bound to the right methods"); + } + + public void test139() { + runTest("inheritance, around advice and abstract pointcuts [eachobject] (still)"); + } + + public void test140() { + runTest("Priviledged aspect methods are missing for privates. [eachobject]"); + } + + public void test141() { + runTest("exceptions thrown and caught in advice, particularly try+proceed"); + } + + public void test142() { + runTest("Not and And operators in pointcuts not working"); + } + + public void test143() { + runTest("Member initializers should run before the current class constructor"); + } + + public void test144() { + runTest("Coverage tests for Member initializers should run before the current class constructor and after super"); + } + + public void test145() { + runTest("thisJoinPoint{Static} not visible in if() pcd of named pointcut"); + } + + public void test146() { + runTest("pcd if() expression visibility at compile-time (minimal operation)"); + } + + public void test147() { + runTest("pcd if() NPE in compiler when unwinding assignment in pcd if(expr)"); + } + + public void test148() { + runTest("pcd if() dup methods produced when pointcut after advice etc (javac)"); + } + + public void test149() { + runTest("pcd if() variants: [anonymous, named] x [execution, call, callTyped, get, set, initializations] x [before, after, around]"); + } + + // moved to ajcTestsFailing.xml + // public void test150(){ + // runTest("advice on advice in usejavac mode"); + // } + + public void test151() { + runTest("initialization order with this"); + } + + public void test152() { + runTest("!within and !this handling for callee-side call points"); + } + + public void test153() { + runTest("private inner interfaces and bytecode visibility"); + } + + public void test154() { + runTest("elaborated into testing of around on all join points"); + } + + public void test155() { + runTest("type name hygiene when code comes from aspects in different packages"); + } + + public void test156() { + runTest("cflowbelow dependencies (from Chris Dutchyn)"); + } + + public void test157() { + runTest("Compiler incorrectly flagging *1 (non-alphabetic start to signature pattern)"); + } + + public void test158() { + runTest("Unable to bind privately-introduced field name from introduced method in the same aspect"); + } + + public void test159() { + runTest("anonymous inner class with aspect"); + } + + public void test160() { + runTest("Arguments are not being passed in to calls advice"); + } + + public void test161() { + runTest("interfaces as mixins with introduction"); + } + + public void test161b() { + runTest("interfaces as mixins with introduction b"); + } + + public void test162() { + runTest("functional modifiers work correctly with introduced members"); + } + + public void test163() { + runTest("ExceptionInInitializerError accessing cflow in aspect initialization - before variants"); + } + + public void test164() { + runTest("NoClassDefFoundError accessing cflow in aspect initialization - after variants"); + } + + public void test165() { + runTest("InternalCompilerError in JpPlan when args alone"); + } + + public void test166() { + runTest("compile error using pcd if() with advice on introduced methods."); + } + + public void test167() { + runTest("compile errors boolean using cflow and unimplemented method using around advice on methods introduced by interface"); + } + + public void test168() { + runTest("aspect as member of interface"); + } + + public void test169() { + runTest("missing method name to synthetic invocation"); + } + + public void test170() { + runTest("protected subclass impl of superclass method with default access and variants"); + } + + public void test171() { + runTest("Exception planning advice"); + } + + public void test172() { + runTest("unreproduced bug with advice - probably UTR"); + } + + public void test173() { + runTest("introduced inner interfaces accessible inside aspect"); + } + + public void test174() { + runTest("validate (enclosing) join point and source locations"); + } + + public void test175() { + runTest("advice formals are just like method formals"); + } + + public void test176() { + runTest("advice formals produce errors just like method formals"); + } + + public void test177() { + runTest("advice throws clauses must be compatible with joinpoints they apply to"); + } + + public void test178() { + runTest("potential method conflicts with introductions and interfaces and PR#561"); + } + + public void test179() { + runTest("illegal method conflicts with introductions and interfaces and PR#561"); + } + + public void test180() { + runTest("AspectOf available for different aspect types"); + } + + public void test181() { + runTest("access to all members of class and inner class from privileged aspect"); + } + + public void test182() { + runTest("cflow alone with around produces compiler bcg StackOverflowError"); + } + + public void test183() { + runTest("get/set join points run for complex assignment operators (+=, etc.) (working)"); + } + + public void test184() { + runTest("this available in introduced field initializers"); + } + + public void test185() { + runTest("Introduced type unavailable to cast expressions in introduced methods"); + } + + public void test186() { + runTest("Introduced type unavailable to qualified new expressions in introduced methods"); + } + + public void test187() { + runTest("Introduced type unavailable to cast expressions in introduced field initializers"); + } + + public void test188() { + runTest("Aspect type unavailable to qualified new expressions in body of introduced methods"); + } + + public void test189() { + runTest("Introduced type unavailable to qualified new expressions in introduced field initializers"); + } + + public void test190() { + runTest("variable slots and finally/catch causing verify errors"); + } + + public void test191() { + runTest("after advice on static method with pcd if() using result"); + } + + public void test192() { + runTest("after advice on static method with pcd if() using result through pointcut"); + } + + public void test193() { + runTest("AbstractMethodError for introduced methods (order 1)"); + } + + public void test194() { + runTest("AbstractMethodError for introduced methods (order 2)"); + } + + public void test195() { + runTest("AbstractMethodError for introduced methods (order 3)"); + } + + public void test196() { + runTest("AbstractMethodError for introduced methods (order 4)"); + } + + public void test197() { + runTest("AbstractMethodError for introduced methods (order 5)"); + } + + public void test198() { + runTest("declare error and abstract pointcuts"); + } + + public void test199() { + runTest("Exercise runtime classes (optionally in 1.1 VM)"); + } + + public void test200() { + runTest("VerifyError after around advice falls off end of tryCatch"); + } + + public void test201() { + runTest("Named within pointcuts failing"); + } + + public void test202() { + runTest("aspect with private abstract pointcut"); + } + + public void test203() { + runTest("concrete aspect unable to access abstract package-private pointcut in parent for overriding"); + } + + public void test204() { + runTest("inner, outer, and outside-package subaspects of an aspect with abstract protected-, public-, and default-access pointcuts"); + } + + public void test205() { + runTest("inner subaspects of an aspect with private pointcut"); + } + + public void test206() { + runTest("outer subaspects of an aspect with private pointcut"); + } + + public void test207() { + runTest("abstract aspect used statically should not cause instantiation of advice or pointcut"); + } + + public void test208() { + runTest("private inner interface accessible in scope when declared on outer class"); + } + + public void test209() { + runTest("accessing protected superclass members in and outside CCC from body of method introduction"); + } + + public void test210() { + runTest("accessing private superclass members from body of method introduction"); + } + + public void test211() { + runTest("simple test for around and casting"); + } + + public void test212() { + runTest("aroundInner 1 - around advice inner Thread subclass running proceed but not writing field"); + } + + public void test213() { + runTest("aroundInner 2 - around advice inner Runnable running proceed and writing method-final proxy"); + } + + public void test214() { + runTest("aroundInner 3 - around advice inner class running proceed and writing field"); + } + + public void test215() { + runTest("aroundInner 4 - around advice inner Thread subclass running proceed and writing field"); + } + + public void test216() { + runTest("aroundInner 5 - around advice inner Runnable (subinterface) running proceed and writing field introduced on subinterface"); + } + + public void test217() { + runTest("Named local class closing over proceed invocation"); + } + + public void test218() { + runTest("beautiful recursive computation of factorial with around is now supported"); + } + + public void test219() { + runTest("multi-dispatch not used for named pcd references"); + } + + public void test220() { + runTest("multi-dispatch implemented through around + args"); + } + + public void test221() { + runTest("unrecognized aspect should not net Cloneable and Serializable warnings"); + } + + public void test222() { + // FIXME AV - infinite loop on JRockit in m5 advice - don't know why + runTest("unreachable code generated by around advice on the execution of void methods"); + } + + public void test223() { + runTest("Overriding method implementations using introduction on interfaces"); + } + + public void test224() { + runTest("more coverage for around and concrete methods on interfaces"); + } + + public void test225() { + runTest("invalid number and type of proceed arguments"); + } + + public void test226() { + runTest("after returning advice order"); + } + + public void test227() { + runTest("after returning advice param"); + } + + public void test228() { + runTest("! and declaring types with callee-side call join points"); + } + + public void test229() { + runTest(". Binding the wrong arguments in withincode(..)."); + } + + public void test230() { + runTest(". Matching arguments in cflow correctly."); + } + + public void test231() { + runTest(". Binding variables with numbers in their name with pertarget(..)'s."); + } + + public void test232() { + runTest("second arg in formal on shared joinpoint with pcd if() causes verify error ??"); + } + + public void test233() { + runTest("access to private members from privileged aspect"); + } + + public void test234() { + runTest("inner classes of privileged aspects cannot see target class private members"); + } + + public void test235() { + runTest("aspects should get package access outside the file"); + } + + public void test236() { + runTest("subclass advice not run for join points selected by superclass cflow-based pointcuts"); + } + + public void test237() { + runTest("more issues with abstract aspects and cflow pointcuts"); + } + + public void test238() { + runTest("compile fails for aspect derived from percflow base aspect unless pointcut excludes base aspect and subaspects"); + } + + public void test239() { + runTest("pertarget stack overflow getting name of anonymous (Interface) class"); + } + + public void test240() { + runTest("pertarget stack overflow getting name of anonymous (Object) class"); + } + + public void test241() { + runTest("pertarget runtime stack overflow (getting name of anonymous (Object) class?)"); + } + + public void test242() { + runTest("subaspect method declaration on superaspect inner interface (names)"); + } + + public void test243() { + runTest("subaspect method declaration on superaspect inner interface (access)"); + } + + public void test244() { + runTest("subaspect method declaration on superaspect inner interface (types)"); + } + + public void test245() { + runTest("around AST type XXX"); + } + + public void test246() { + runTest("around all execution with double assignment in initializer (simple)"); + } + + public void test247() { + runTest("around all execution with double assignment in initializer (coverage)"); + } + + public void test248() { + runTest("changing this in around's proceed reported by Rich Price"); + } + + public void test249() { + runTest("default package for aspect introductions is not the current package"); + } + + public void test250() { + runTest("anon class written to wrong directory"); + } + + public void test251() { + runTest("unqualified transitive pointcut references not resolved"); + } + + public void test252() { + runTest("unqualified transitive pointcut references not resolved - 2"); + } + + public void test253() { + runTest("direct use outside aspect of defined abstract pointcut"); + } + + public void test254() { + runTest("direct use outside aspect of undefined abstract pointcut"); + } + + public void test255() { + runTest("indirect use outside aspect of undefined abstract pointcut"); + } + + public void test256() { + runTest("simple call join point tests for JoinPoint SourceLocation context"); + } + + public void test257() { + runTest("!target with second advice on casted call"); + } + + public void test258() { + runTest("name binding in around cflow"); + } + + public void test259() { + runTest("name binding in around cflow - 2"); + } + + public void test260() { + runTest("around name-binding in cflows using factorial"); + } + + public void test261() { + runTest("replacing this or target in around advice"); + } + + public void test262() { + runTest("after returning from initialization and after executing constructor"); + } + + public void test263() { + runTest("after returning from initialization causes ExceptionInInitializer in aspect"); + } + + public void test264() { + runTest("name binding in before cflow containing cflowbelow"); + } + + public void test265() { + runTest("file order in type searching"); + } + + public void test266() { + runTest("simple declare warning (NPE)"); + } + + public void test267() { + runTest("ajc dies on cflow into field init anon class see knownbugs.txt"); + } + + public void test268() { + runTest("Incrementing interface-introduced field"); + } + + public void test269() { + runTest("The dynamic type, not the static one, should be used in if pcds"); + } + + public void test270() { + runTest("bad interaction with after returning, around and void methods (from Rich Price)"); + } + + public void test271() { + runTest("type pattern matching for inner classes (from Ken Horn)"); + } + + public void test272() { + runTest("static initializer member name"); + } + + public void test273() { + runTest("cflow pcd syntax error"); + } + + public void test274() { + runTest("binding args with indeterminate prefix and suffix"); + } + + public void test275() { + runTest("check arg types with indeterminate prefix and suffix"); + } + + public void test276() { + runTest("testing and binding args with single indeterminate prefix and suffix"); + } + + public void test277() { + runTest("binding handler args with indeterminate prefix and suffix"); + } + + public void test278() { + runTest("Compiling java.lang.Object with ajc yields non-verifying bytecode"); + } + + public void test279() { + runTest("method-local class defined in around return statement"); + } + + public void test280() { + runTest("CE expected for assignment to arg in if pcd"); + } + + public void test281() { + runTest("advising field get/sets when accessing via super"); + } + + public void test282() { + runTest("accessing private members in outer types"); + } + + public void test283() { + runTest("can't apply around advice to the execution of around advice"); + } + + public void test284() { + runTest("incompatible advice throws clause are a compile-time error"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc10x/ajc10x-tests.xml b/tests/src/test/java/org/aspectj/systemtest/ajc10x/ajc10x-tests.xml new file mode 100644 index 000000000..56ee8f6e4 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc10x/ajc10x-tests.xml @@ -0,0 +1,2013 @@ +<!-- AspectJ v1.0.x Tests --> + + + <ajc-test dir="new" + title="properly make choice between cast and parenthesis in parser" + keywords="from-resolved_10x"> + <compile options="-1.4" files="JoinPointFields.java"/> + <run class="JoinPointFields"/> + </ajc-test> + + <ajc-test dir="new" pr="96" + title="field from implemented interface not found in advice" + keywords="from-resolved_10x"> + <compile options="-1.4" files="FieldFromImplementsNotFound.java"/> + <run class="FieldFromImplementsNotFound"/> + </ajc-test> + + <ajc-test dir="new" + title="make sure advice affects introduced methods and constructors" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AdviceOnIntroduced.java"/> + <run class="AdviceOnIntroduced"/> + </ajc-test> + + <ajc-test dir="new" title="new around construct" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AroundAdvice.java"/> + <run class="AroundAdvice"/> + </ajc-test> + + <ajc-test dir="new" pr="65" title="aspect redefines a parameter" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AspectRedefinesParam.java"/> + <run class="AspectRedefinesParam"/> + </ajc-test> + + <ajc-test dir="new" title="introducing extends and implements" + keywords="from-resolved_10x"> + <compile options="-1.4" files="HierarchyIntroductions.java"/> + <run class="HierarchyIntroductions"/> + </ajc-test> + + <ajc-test dir="new" pr="104" title="(related) aspect on interface" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AspectOnInterface.java"/> + <run class="AspectOnInterface"/> + </ajc-test> + + <ajc-test dir="new" pr="106" title="advice and package visibility" + keywords="from-resolved_10x"> + <compile + files="packagevisibility/PackagesAndAdvice.java,packagevisibility/testPackage/Class1.java,packagevisibility/testPackage/Class2.java" + options="-Xlint:ignore"/> + <run class="packagevisibility.PackagesAndAdvice"/> + </ajc-test> + + <ajc-test dir="new" pr="106" title="advice and package visibility" + keywords="from-resolved_10x"> + <compile + files="packagevisibility/PackagesAndAdviceCf.java,packagevisibility/testPackage/Class1.java,packagevisibility/testPackage/Class2.java" + options="-Xlint:error"> + <message kind="error" line="29"/> + </compile> + </ajc-test> + + <ajc-test dir="new" title="advice on implied empty constructor" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AdviceOnEmptyConstructor.java"/> + <run class="AdviceOnEmptyConstructor"/> + </ajc-test> + + <ajc-test dir="new" title="advice on * *(..) not mapping to initializers" + keywords="from-resolved_10x"> + <compile options="-1.4" files="InitializerAdvice.java"/> + <run class="InitializerAdvice"/> + </ajc-test> + + <ajc-test dir="new" + title="three type declarations in the scope of an advice" + keywords="from-resolved_10x"> + <compile options="-1.4" files="TypeDeclInAdvice.java"/> + <run class="TypeDeclInAdvice"/> + </ajc-test> + + <ajc-test dir="new" pr="129" + title="introduction fails on class with an inner class that extends or implements something" + keywords="from-resolved_10x"> + <compile options="-1.4" files="IntroductionFailsWithInnerClass.java"/> + <run class="IntroductionFailsWithInnerClass"/> + </ajc-test> + + <ajc-test dir="new" pr="126" + title="checks that methods are introduced on the topmost class implemented" + keywords="from-resolved_10x"> + <compile options="-1.4" files="TopmostImplements.java"/> + <run class="TopmostImplements"/> + </ajc-test> + + <ajc-test dir="new/arndAdvRet" pr="140" + title="a couple different returns from around advice" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="new" + title="member finally advice paired with signature advice" + keywords="from-resolved_10x"> + <compile options="-1.4" files="TryErrors.java"/> + <run class="TryErrors"/> + </ajc-test> + + <ajc-test dir="new" title="aspect of eachobject(instanceof(Interface))" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AspectOfInterface.java"/> + <run class="AspectOfInterface"/> + </ajc-test> + + <ajc-test dir="new/finalMemInit" pr="162" + title="final member initialization broken with JDK before 1.1.8" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="new/packageNameClash" pr="205" + title="same package and var name clash in preprocessed code when aspectOf is used" + keywords="from-resolved_10x"> + <compile options="-1.4" files="otherpkg/Driver.java,pkg/Aspect1.java,pkg/Class1.java"/> + <run class="otherpkg.Driver"/> + </ajc-test> + + <ajc-test dir="new/adviceOnStaticMeth" pr="221" + title="and PR#201 advice on static methods fails javac compile with this" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="new" + title="non-static advice on inner class defined inside of method body" + keywords="from-resolved_10x"> + <compile options="-1.4" files="MethodInner.java"/> + <run class="MethodInner"/> + </ajc-test> + + <ajc-test dir="new" + title="simple single-threaded eachcflow test (includes aspectOf)" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Client.java"/> + <run class="Client"/> + </ajc-test> + + <ajc-test dir="new/scopeTypingBug" pr="191" + title="bad type resolution when var reassigned in same scope" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="new" pr="242" + title="generating the right throws clause for call-site advice (and around)" + keywords="from-resolved_10x"> + <compile options="-1.4" files="ComputedThrows.java"/> + <run class="ComputedThrows"/> + </ajc-test> + + <ajc-test dir="new" pr="246" + title="advice on calls to static methods using several syntax" + keywords="from-resolved_10x"> + <compile options="-1.4" files="StaticCalls.java"/> + <run class="StaticCalls"/> + </ajc-test> + + <ajc-test dir="new" pr="248" + title=", PR#249, PR#250 advice on constructor sites" + keywords="from-resolved_10x"> + <compile files="NewSiteAdvice.java" options="-1.4 -Xlint:ignore"/> + <run class="NewSiteAdvice"/> + </ajc-test> + + <ajc-test dir="new" title="test after throwing advice in several ways" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AfterThrowing.java"/> + <run class="AfterThrowing"/> + </ajc-test> + + <ajc-test dir="new" title="fancy name patterns for method names" + keywords="from-resolved_10x"> + <compile options="-1.4" files="WildNames.java"/> + <run class="WildNames"/> + </ajc-test> + + <ajc-test dir="design/calls" title="calls: calls(...)" + keywords="from-resolved_10x"> + <compile files="Simple.java" options="-Xlint:ignore -1.4"/> + <run class="Simple"/> + </ajc-test> + + <ajc-test dir="new/extraThrows" pr="259" + title="throws Exception clause is unnecessarily added to Driver.main method" + keywords="from-resolved_10x"> + <compile files="Driver.java" options="-Xlint:ignore -1.4"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="new/thisUsedInMain" pr="262" + title="javac fails when this is referenced in the static main method" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="new/badCast" pr="275" + title="and 276 cast error generated by ajc when type not in signature" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="new" pr="285" + title="calls to methods to which we don't have source" + keywords="from-resolved_10x"> + <compile options="-1.4" files="ExternalCalls.java"/> + <run class="ExternalCalls"/> + </ajc-test> + + <ajc-test dir="new/beforeNotRun" pr="265" title="more aspect inheritance" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="new" pr="310" + title="around and calls with both calling and called this params" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AroundAndCalls.java"/> + <run class="AroundAndCalls"/> + </ajc-test> + + <ajc-test dir="new/pointcutParameter" pr="290" + title="compiler crashes with eachobject and named pointcuts with parameters" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="new/unqualifiedPointcutName" pr="304" + title="lookup rules for unqualified pointcut names" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="new" pr="321" + title="eachcflow only instantiated if the aspect has some advice in it" + keywords="from-resolved_10x"> + <compile options="-1.4" files="CFlowNoAdvice.java"/> + <run class="CFlowNoAdvice"/> + </ajc-test> + + <ajc-test dir="new" pr="309" + title="(DESIGN QUESTION) aspect of eachJVM advising its own initializer" + keywords="from-resolved_10x"> + <compile options="-1.4" files="EachJVMOnSelf.java"/> + <run class="EachJVMOnSelf"/> + </ajc-test> + + <ajc-test dir="new" pr="302" + title="after returning advice on calls to constructors" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AfterConstructorCalls.java"/> + <run class="AfterConstructorCalls"/> + </ajc-test> + + <ajc-test dir="new" + title="Does annotating 'new' with a type work as desired?" + keywords="from-resolved_10x"> + <compile options="-1.4" files="ConstructorSignatures.java"/> + <run class="ConstructorSignatures"/> + </ajc-test> + + <ajc-test dir="new" + title="Referring to inner classes as {super}.{inner} confused ajc." + keywords="from-resolved_10x"> + <compile options="-1.4" files="InnerClassNaming.java"/> + <run class="InnerClassNaming"/> + </ajc-test> + + <ajc-test dir="new" title="Advice on advice" keywords="from-resolved_10x"> + <compile options="-1.4" files="AdviceOnAdvice.java"/> + <run class="AdviceOnAdvice"/> + </ajc-test> + + <ajc-test dir="new" title="Introductions on other introductions" + keywords="from-resolved_10x"> + <compile options="-1.4" files="IntroOnIntro.java"/> + <run class="IntroOnIntro"/> + </ajc-test> + + <ajc-test dir="new" title="Putting advice on array constructors." + keywords="from-resolved_10x"> + <compile options="-1.4" files="Orleans.java"/> + <run class="Orleans"/> + </ajc-test> + + <ajc-test dir="new" + title="call points within block inner classes are doubled" + keywords="from-resolved_10x"> + <compile options="-1.4" files="DoubledCalls.java"/> + <run class="DoubledCalls"/> + </ajc-test> + + <ajc-test dir="new" title="Gets and sets with other advice" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Counting3.java"/> + <run class="Counting3"/> + </ajc-test> + + <ajc-test dir="new" title="Compiler can compile correct strictfp modifiers" + keywords="from-resolved_10x"> + <compile options="-1.4" files="StrictFpCompile.java"/> + <run class="StrictFpCompile"/> + </ajc-test> + + <ajc-test dir="new" title="basic test of callsto pointcuts" + keywords="from-resolved_10x"> + <compile options="-1.4" files="CallsTo.java"/> + <run class="CallsTo"/> + </ajc-test> + + <ajc-test dir="new" title="package wildcards in packages" + keywords="from-resolved_10x"> + <compile options="-1.4" files="pack/PackageWildcards.java"/> + <run class="pack.PackageWildcards"/> + </ajc-test> + + <ajc-test dir="new" + title="around advice on calls and receptions with lots of context" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AroundCalls.java"/> + <run class="AroundCalls"/> + </ajc-test> + + <ajc-test dir="new" pr="208" + title="! modifier and char in pointcut (no longer an error)" + keywords="from-resolved_10x"> + <compile options="-1.4" files="NotCharInPointcut.java"/> + <run class="NotCharInPointcut"/> + </ajc-test> + + <ajc-test dir="new" pr="308" + title="right number of aspect instances per cflow" + keywords="from-resolved_10x"> + <compile options="-1.4" files="CFlowObjects.java"/> + <run class="CFlowObjects"/> + </ajc-test> + + <ajc-test dir="new" pr="310" title="many this's into around advice on calls" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AroundCallsArgs.java"/> + <run class="AroundCallsArgs"/> + </ajc-test> + + <ajc-test dir="new" + title="Ensures introduction methods can have advice placed on them" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Dominates.java"/> + <run class="Dominates"/> + </ajc-test> + + <ajc-test dir="new" pr="355" + title="No boolean appearing in the 'if' clause for around advice with eachJVM()" + keywords="from-resolved_10x"> + <compile options="-1.4" files="PR355.java"/> + <run class="PR355"/> + </ajc-test> + + <ajc-test dir="new" title="Order of super introductions." + keywords="from-resolved_10x"> + <compile options="-1.4" files="OrderOfExtendsPlusAndImplementsPlus.java"/> + <run class="OrderOfExtendsPlusAndImplementsPlus"/> + </ajc-test> + + <ajc-test dir="new" title="Ensuring backdoor methods are produced." + keywords="from-resolved_10x"> + <compile options="-1.4" files="BackdoorMethods.java"/> + <run class="BackdoorMethods"/> + </ajc-test> + + <ajc-test dir="new" + title="no duplicate advice methods in abstract aspects" + keywords="from-resolved_10x"> + <compile + files="GeneratingDuplicateNamedAdviceMethodsInAbstractAspects.java"/> + <run class="GeneratingDuplicateNamedAdviceMethodsInAbstractAspects"/> + </ajc-test> + + <ajc-test dir="new" + title="no duplicate advice methods in abstract aspects extended" + keywords="from-resolved_10x"> + <compile + files="GeneratingDuplicateNamedAdviceMethodsInAbstractAspectsWithExtendedAspect.java"/> + <run class="GeneratingDuplicateNamedAdviceMethodsInAbstractAspectsWithExtendedAspect" + /> + </ajc-test> + + <ajc-test dir="new" + title="Putting after-constructor advice on the wrong types implementing the same interface." + keywords="from-resolved_10x"> + <compile options="-1.4" files="AfterAdviceOnConstructorsOnTheWrongType.java"/> + <run class="AfterAdviceOnConstructorsOnTheWrongType"/> + </ajc-test> + + <ajc-test dir="new" + title="Instantiating non-static inner classes in advice." + keywords="from-resolved_10x"> + <compile options="-1.4" files="NonstaticInnerClassesInAspects.java"/> + <run class="NonstaticInnerClassesInAspects"/> + </ajc-test> + + <ajc-test dir="new" pr="316" title="Referring to pointcut in of clauses" + keywords="from-resolved_10x"> + <compile options="-1.4" files="ReferringToPointcutsInAspect_PR316.java"/> + <run class="ReferringToPointcutsInAspect_PR316"/> + </ajc-test> + + <ajc-test dir="new" pr="191" + title="Confused referring to instance variables and locals" + keywords="from-resolved_10x"> + <compile options="-1.4" files="ScopesAndFields_PR191.java"/> + <run class="ScopesAndFields_PR191"/> + </ajc-test> + + <ajc-test dir="new" + title="Parsing C+ expressions without parens in super introductions." + keywords="from-resolved_10x"> + <compile options="-1.4" files="ParsingSubtypesIntroductions.java"/> + <run class="ParsingSubtypesIntroductions"/> + </ajc-test> + + <ajc-test dir="new" + title="Introducing methods on classes that implements inner-interfaces with +implements." + keywords="from-resolved_10x"> + <compile files="IntroducingMethodsOnPlusImplementedInterfaces.java" options="-Xlint:ignore -1.4"/> + <run class="IntroducingMethodsOnPlusImplementedInterfaces"/> + </ajc-test> + + <ajc-test dir="new" pr="464" + title="Methods with the same name are generated when abstract aspects extend another abstract aspect." + keywords="from-resolved_10x"> + <compile + files="AbstractAspectsExtendingAbstractAspectsGeneratesMethodsWithTheSameName_PR464.java"/> + <run class="AbstractAspectsExtendingAbstractAspectsGeneratesMethodsWithTheSameName_PR464" + /> + </ajc-test> + + <ajc-test dir="new" title="Making sure final variables stay final." + keywords="from-resolved_10x"> + <compile options="-1.4" files="RemovingFinals.java"/> + <run class="RemovingFinals"/> + </ajc-test> + + <ajc-test dir="new" + title="Problem resolving meta-joinpoint names with around advice on methods called from around advice." + keywords="from-resolved_10x"> + <compile options="-1.4" files="AroundAdviceOnMethodsCalledInAroundAdvice.java"/> + <run class="AroundAdviceOnMethodsCalledInAroundAdvice"/> + </ajc-test> + + <ajc-test dir="new" + title="Make sure that names of lifted local classes are right when referenced in call-site advice" + keywords="from-resolved_10x"> + <compile options="-1.4" files="CallsAndLocalClasses.java"/> + <run class="CallsAndLocalClasses"/> + </ajc-test> + + <ajc-test dir="new" title="matching for throws clause" + keywords="from-resolved_10x"> + <compile options="-1.4" files="ThrowsMatching.java"/> + <run class="ThrowsMatching"/> + </ajc-test> + + <ajc-test dir="new" title="basic test of declare soft" + keywords="from-resolved_10x"> + <compile options="-1.4" files="DeclareSoft.java"/> + <run class="DeclareSoft"/> + </ajc-test> + + <ajc-test dir="new" + title="advice on calls to constructors of anonymous inners and access to context" + keywords="from-resolved_10x"> + <compile options="-1.4" files="NewAnonymous.java"/> + <run class="NewAnonymous"/> + </ajc-test> + + <ajc-test dir="new/innerAspectAccess" pr="211" + title="inner aspects can't access outer pointcuts" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="new" + title="implements and extends are introduced before methods and fields" + keywords="from-resolved_10x"> + <compile options="-1.4" files="IntroOrder.java"/> + <run class="IntroOrder"/> + </ajc-test> + + <ajc-test dir="new" + title="a static/inner aspect of a inner class of an aspect is pulled to the top level as static" + keywords="from-resolved_10x"> + <compile options="-1.4" files="StaticInnerAspect.java"/> + <run class="StaticInnerAspect"/> + </ajc-test> + + <ajc-test dir="new" title="Crashes with privileged aspect." + keywords="from-resolved_10x"> + <compile options="-1.4" files="Privileged.java"/> + <run class="Privileged"/> + </ajc-test> + + <ajc-test dir="new" + title="join points exist in the execution of field initializers" + keywords="from-resolved_10x"> + <compile options="-1.4" files="FieldInitializerJoinPoints.java"/> + <run class="FieldInitializerJoinPoints"/> + </ajc-test> + + <ajc-test dir="new/privilegedAspects" title="privileged aspects" + keywords="from-resolved_10x"> + <compile + files="main/Main.java,fish/PrivateClass.java,fish/B.java,fowl/C.java,fowl/D.java"/> + <run class="main.Main"/> + </ajc-test> + + <ajc-test dir="new" title="advice on field gets in privileged aspects" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AdviceOnPrivileged.java"/> + <run class="AdviceOnPrivileged"/> + </ajc-test> + + <ajc-test dir="new" title="Two anonymous classes in the same scope" + keywords="from-resolved_10x"> + <compile options="-1.4" files="TwoAnonymous.java"/> + <run class="TwoAnonymous"/> + </ajc-test> + + <ajc-test dir="new" + title="basic tests for initializer and staticinitializer PCDs" + keywords="from-resolved_10x"> + <compile options="-1.4" files="InitializerTest.java"/> + <run class="InitializerTest"/> + </ajc-test> + + <ajc-test dir="new" pr="98" + title="introduction of an initializer into a class" + keywords="from-resolved_10x"> + <compile options="-1.4" files="IntroductionOfInitializer.java"/> + <run class="IntroductionOfInitializer"/> + </ajc-test> + + <ajc-test dir="new/access" + title="some method accessibility tests, particularly package-protected and inheritance" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Test1.java,pc/C.java,psub/SubC.java,psub/A.java"/> + <run class="Test1"/> + </ajc-test> + + <ajc-test dir="new" + title="fairly monotonous (and non-covering) tests for expanded dot patterns" + keywords="from-resolved_10x"> + <compile options="-1.4" files="ExpandedDotDotPattern.java"/> + <run class="ExpandedDotDotPattern"/> + </ajc-test> + + <ajc-test dir="new" title="field patterns and subtyping" + keywords="from-resolved_10x"> + <compile options="-1.4" files="FieldPatterns.java"/> + <run class="FieldPatterns"/> + </ajc-test> + + <ajc-test dir="new" + title="Checking formal matching as in Roeder's bug in 0.7b10" + keywords="from-resolved_10x"> + <compile options="-1.4" files="FormalMatching.java"/> + <run class="FormalMatching"/> + </ajc-test> + + <ajc-test dir="new" title="Introducing synchronized methods on interfaces." + keywords="from-resolved_10x"> + <compile options="-1.4" files="SynchronizedMethodsOnInterfaces.java"/> + <run class="SynchronizedMethodsOnInterfaces"/> + </ajc-test> + + <ajc-test dir="new" + title="The pointcut params (..,int..) is not recognizing (Object,int,Object)." + keywords="from-resolved_10x"> + <compile options="-1.4" files="Params.java"/> + <run class="Params"/> + </ajc-test> + + <ajc-test dir="new" + title="calls advice on array objects causes error in code generation" + keywords="from-resolved_10x"> + <compile options="-1.4" files="CallsToArray.java"/> + <run class="CallsToArray"/> + </ajc-test> + + <ajc-test dir="new" + title="join points in field initializers aren't showing up." + keywords="from-resolved_10x"> + <compile options="-1.4" files="NonexistentFieldInitializers.java"/> + <run class="NonexistentFieldInitializers"/> + </ajc-test> + + <ajc-test dir="new" pr="318" title="Handlers problem" + keywords="from-resolved_10x"> + <compile files="PR318.java" options="-Xlint:ignore -1.4"/> + <run class="PR318"/> + </ajc-test> + + <ajc-test dir="new" + title="work nicely with inner class method look-up rules and call-site advice" + keywords="from-resolved_10x"> + <compile options="-1.4" files="InnerMethods.java"/> + <run class="InnerMethods"/> + </ajc-test> + + <ajc-test dir="new" title="strictfp modifier allowed on advice" + keywords="from-resolved_10x"> + <compile options="-1.4" files="StrictFPAdvice.java"/> + <run class="StrictFPAdvice"/> + </ajc-test> + + <ajc-test dir="new" pr="415" + title="No argthis was being created for calls advice." + keywords="from-resolved_10x"> + <compile options="-1.4" files="PR415.java"/> + <run class="PR415"/> + </ajc-test> + + <ajc-test dir="new" + title="Ensuring no advice with instanceof(..) is run on static methods." + keywords="from-resolved_10x"> + <compile options="-1.4" files="StaticMethodsShouldNotReceiveInstanceofAdvice.java"/> + <run class="StaticMethodsShouldNotReceiveInstanceofAdvice"/> + </ajc-test> + + <ajc-test dir="new" + title="Null pointer on gets advice showing the case causing the error" + keywords="from-resolved_10x"> + <compile options="-1.4" files="NullPointerOnGetsSimple.java"/> + <run class="NullPointerOnGetsSimple"/> + </ajc-test> + + <ajc-test dir="new" + title="try to make sure that dynamic JoinPoint objects aren't generated when used inside of if (false) { ... }" + keywords="from-resolved_10x"> + <compile options="-1.4" files="IfdefsAndAdvice.java"/> + <run class="IfdefsAndAdvice"/> + </ajc-test> + + <ajc-test dir="new" + title="within and withincode (doesn't all work due to local class name issues)" + keywords="from-resolved_10x"> + <compile options="-1.4" files="WithinInners.java"/> + <run class="WithinInners"/> + </ajc-test> + + <ajc-test dir="new" + title="around advice on calls within inner classes (including protected method calls)" + keywords="from-resolved_10x"> + <compile files="AroundInnerCalls13.java" options="-1.3"/> + <run class="AroundInnerCalls13"/> + </ajc-test> + + <ajc-test dir="new" + title="around advice on calls within inner classes (including protected method calls)" + keywords="from-resolved_10x"> + <compile files="AroundInnerCalls.java" options="-1.4"/> + <run class="AroundInnerCalls"/> + </ajc-test> + + <ajc-test dir="new" title="Arguments to runNext should be final when needed" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Finals.java"/> + <run class="Finals"/> + </ajc-test> + + <ajc-test dir="new" title="Method introductions" + keywords="from-resolved_10x"> + <compile options="-1.4" files="MethodIntroductions.java"/> + <run class="MethodIntroductions"/> + </ajc-test> + + <ajc-test dir="new" title="Putting an introduced method on each interface" + keywords="from-resolved_10x"> + <compile options="-1.4" files="IntroducedMethodsOnEachInterface.java"/> + <run class="IntroducedMethodsOnEachInterface"/> + </ajc-test> + + <ajc-test dir="new" title="Extending interfaces" + keywords="from-resolved_10x"> + <compile options="-1.4" files="BindingInterfaces.java"/> + <run class="BindingInterfaces"/> + </ajc-test> + + <ajc-test dir="new" title="Introducing private methods on interfaces" + keywords="from-resolved_10x"> + <compile options="-1.4" files="IntroducingPrivateMethodsOnInterfaces.java"/> + <run class="IntroducingPrivateMethodsOnInterfaces"/> + </ajc-test> + + <ajc-test dir="new" + title="Issuing errors for assigning variables thisJoinPoint -- not assigning thisJoinPoint." + keywords="from-resolved_10x"> + <compile options="-1.4" files="ThisJoinPointAssignments.java"/> + <run class="ThisJoinPointAssignments"/> + </ajc-test> + + <ajc-test dir="new" + title="Static references inside of introduced bodies get bound correctly." + keywords="from-resolved_10x"> + <compile options="-1.4" files="StaticIntroducedReferences.java"/> + <run class="StaticIntroducedReferences"/> + </ajc-test> + + <ajc-test dir="new/cflowObjectCreations" pr="307" + title="cflow and object creations [of eachcflow]" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="new/twofiles" + title="Doesn't import MightHaveAspect when compiling with more than 1 file. [eachobject]" + keywords="from-resolved_10x"> + <compile options="-1.4" files="TheObject.java,TheAspect.java"/> + <run class="TheObject"/> + </ajc-test> + + <ajc-test dir="new" pr="436" + title="test binding to formals in calls to constructors (binding to null) (eachobject !!! now misnamed)" + keywords="from-resolved_10x"> + <compile options="-1.4" files="BindingThisInsteadOfFormal.java"/> + <run class="BindingThisInsteadOfFormal"/> + </ajc-test> + + <ajc-test dir="new" + title="After advice isn't being woven into after throwing advice" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AfterThrowingNotWoven.java"/> + <run class="AfterThrowingNotWoven"/> + </ajc-test> + + <ajc-test dir="new" title="Throwing an EmptyStackException." + keywords="from-resolved_10x"> + <compile options="-1.4" files="EmptyStack.java"/> + <run class="EmptyStack"/> + </ajc-test> + + <ajc-test dir="new/perThis" + title="check that MightHaveAspect interface is created correctly for an aspect in deep package" + keywords="from-resolved_10x"> + <compile options="-1.4" files="p/EachObjectTarget.java,the/deep/pkg/EachObjectInDeepPackage.java"/> + <run class="p.EachObjectTarget"/> + </ajc-test> + + <ajc-test dir="new" title="Defines clfow$ajc0 more once. [eachcflow]" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Binkley.java"/> + <run class="Binkley"/> + </ajc-test> + + <ajc-test dir="new" + title="Various calls, receptions, and callsto tests [callsto]" + keywords="from-resolved_10x"> + <compile options="-1.4" files="CallsReceptionsCallsto.java"/> + <run class="CallsReceptionsCallsto"/> + </ajc-test> + + <ajc-test dir="new" pr="320" + title="Was throwing exception, now just an error. [eachobject]" + keywords="from-resolved_10x"> + <compile options="-1.4" files="PR320.java"/> + <run class="PR320"/> + </ajc-test> + + <ajc-test dir="new" + title="different version of aspect inheritance, particularly empty pointcuts and abstract cflows [eachcflow]" + keywords="from-resolved_10x,fail-unimplemented"> + <compile options="-1.4" files="AspectInheritance.java"/> + <run class="AspectInheritance"/> + </ajc-test> + + <ajc-test dir="new" pr="339" + title="set advice on member initing throwing exception [eachobject]" + keywords="from-resolved_10x"> + <compile options="-1.4" files="PR339.java"/> + <run class="PR339"/> + </ajc-test> + + <ajc-test dir="new" pr="417" + title="Testing class names with same name's with difference case as package. [eachobject]" + keywords="from-resolved_10x"> + <compile options="-1.4" files="test/TraceAspect.java,test/Test.java"/> + <run class="test.Test"/> + </ajc-test> + + <ajc-test dir="new" + title="Null pointer on gets advice with coverage [painful]" + keywords="from-resolved_10x"> + <compile options="-1.4" files="NullPointerOnGets.java"/> + <run class="NullPointerOnGets"/> + </ajc-test> + + <ajc-test dir="new" title="Basic test for cflow pointcuts [eachcflow]" + keywords="from-resolved_10x"> + <compile files="CFlowPoints.java" options="-Xlint:ignore -1.4"/> + <run class="CFlowPoints"/> + </ajc-test> + + <ajc-test dir="new" + title="Crashing when looking up the type of array members." + keywords="from-resolved_10x"> + <compile options="-1.4" files="ArrayCasts.java"/> + <run class="ArrayCasts"/> + </ajc-test> + + <ajc-test dir="new" + title="PostfixExprs to various synthetic things are fixed correctly [eachobject]" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Fixes.java"/> + <run class="Fixes"/> + </ajc-test> + + <ajc-test dir="new" + title="Dave Binkley's problem with eachcflowroot. [eachcflow]" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Binkley2.java"/> + <run class="Binkley2"/> + </ajc-test> + + <ajc-test dir="new" pr="105" title="advice on an inherited method" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AdviceOnInheritedMethod.java"/> + <run class="AdviceOnInheritedMethod"/> + </ajc-test> + + <ajc-test dir="new" pr="114" + title=", PR#115 checks the ordering of catch clauses" + keywords="from-resolved_10x"> + <compile files="OrderOfCatches.java" options="-Xlint:ignore -1.4"/> + <run class="OrderOfCatches"/> + </ajc-test> + + <ajc-test dir="new" title="various declared exception permutations" + keywords="from-resolved_10x"> + <compile options="-1.4" files="DeclaredExcs.java"/> + <run class="DeclaredExcs"/> + </ajc-test> + + <ajc-test dir="new" + title="ordering of advice kinds as well as cflow and dominates" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AdviceOrdering.java"/> + <run class="AdviceOrdering"/> + </ajc-test> + + <ajc-test dir="new" pr="241" + title="advice on default constructor for a class only referenced via reflection" + keywords="from-resolved_10x"> + <compile options="-1.4" files="OddConstructors.java"/> + <run class="OddConstructors"/> + </ajc-test> + + <ajc-test dir="new" pr="289" + title="calling and called this params in calls points" + keywords="from-resolved_10x"> + <compile options="-1.4" files="CallsParams.java"/> + <run class="CallsParams"/> + </ajc-test> + + <ajc-test dir="new" pr="322" + title="primitive parameters coercable to Object just like return values are" + keywords="from-resolved_10x"> + <compile options="-1.4" files="ObjectForInt.java"/> + <run class="ObjectForInt"/> + </ajc-test> + + <ajc-test dir="new" + title="join points in static/dynamic initializers aren't showing up." + keywords="from-resolved_10x"> + <compile options="-1.4" files="NonexistentInitializers.java"/> + <run class="NonexistentInitializers"/> + </ajc-test> + + <ajc-test dir="new" + title="Gets and sets on a number of variables (field access ???)" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Gets.java"/> + <run class="Gets"/> + </ajc-test> + + <ajc-test dir="new" + title="Joinpoints are showing up on intermediate call sites" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Counting1.java"/> + <run class="Counting1"/> + </ajc-test> + + <ajc-test dir="new" title="Reception based on strictfp modifier" + keywords="from-resolved_10x"> + <compile options="-1.4" files="StrictFpReceptions.java"/> + <run class="StrictFpReceptions"/> + </ajc-test> + + <ajc-test dir="new" pr="353" + title="Subclasses that do not redefine a method are not being handled correctly" + keywords="from-resolved_10x"> + <compile options="-1.4" files="PR353b.java"/> + <run class="PR353b"/> + </ajc-test> + + <ajc-test dir="new" + title="making sure that super calls are bound to the right methods" + keywords="from-resolved_10x"> + <compile options="-1.4" files="SupersAndInterfaces.java"/> + <run class="SupersAndInterfaces"/> + </ajc-test> + + <ajc-test dir="new" pr="317" + title="inheritance, around advice and abstract pointcuts [eachobject] (still)" + keywords="from-resolved_10x"> + <compile options="-1.4" files="OverridingPointcuts.java"/> + <run class="OverridingPointcuts"/> + </ajc-test> + + <ajc-test dir="new/foemmel" + title="Priviledged aspect methods are missing for privates. [eachobject]" + keywords="from-resolved_10x"> + <compile options="-1.4" files="TheAspect.java,TheObject.java"> + </compile> + <run class="TheObject"/> + </ajc-test> + + <ajc-test dir="new" + title="exceptions thrown and caught in advice, particularly try+proceed" + keywords="from-resolved_10x"> + <compile files="TryAndProceed.java" options="-Xlint:ignore -1.4"/> + <run class="TryAndProceed"/> + </ajc-test> + + <ajc-test dir="new" title="Not and And operators in pointcuts not working" + keywords="from-resolved_10x"> + <compile options="-1.4" files="NotAndPointcut.java"/> + <run class="NotAndPointcut"/> + </ajc-test> + + <ajc-test dir="new" + title="Member initializers should run before the current class constructor" + keywords="from-resolved_10x"> + <compile options="-1.4" files="MemberInitializationsAfterExplicitConstructorCalls.java"/> + <run class="MemberInitializationsAfterExplicitConstructorCalls"/> + </ajc-test> + + <ajc-test dir="new" + title="Coverage tests for Member initializers should run before the current class constructor and after super" + keywords="from-resolved_10x"> + <compile + files="MemberInitializationsAfterExplicitConstructorCallsCoverage.java"/> + <run class="MemberInitializationsAfterExplicitConstructorCallsCoverage"/> + </ajc-test> + + <ajc-test dir="new" + title="thisJoinPoint{Static} not visible in if() pcd of named pointcut" + keywords="from-resolved_10x"> + <compile options="-1.4" files="IfPCDExprJoinPointVisibleCE.java"/> + <run class="IfPCDExprJoinPointVisibleCE"/> + </ajc-test> + + <ajc-test dir="new" + title="pcd if() expression visibility at compile-time (minimal operation)" + keywords="from-resolved_10x"> + <compile files="IfPCDExprVisibility.java" options="-Xlint:ignore -1.4"/> + <run class="IfPCDExprVisibility"/> + </ajc-test> + + <ajc-test dir="new" + title="pcd if() NPE in compiler when unwinding assignment in pcd if(expr)" + keywords="from-resolved_10x"> + <compile options="-1.4" files="IfPCDExprAssignUnparseFailure.java"/> + <run class="IfPCDExprAssignUnparseFailure"/> + </ajc-test> + + <ajc-test dir="new" + title="pcd if() dup methods produced when pointcut after advice etc (javac)" + keywords="from-resolved_10x"> + <compile options="-1.4" files="IfPCDDupMethod.java"/> + <run class="IfPCDDupMethod"/> + </ajc-test> + + <ajc-test dir="new" + title="pcd if() variants: [anonymous, named] x [execution, call, callTyped, get, set, initializations] x [before, after, around]" + keywords="from-resolved_10x"> + <compile options="-1.4" files="IfPCDAdviceMethods.java"/> + <run class="IfPCDAdviceMethods"/> + </ajc-test> + + <ajc-test dir="new" pr="476" title="initialization order with this" + keywords="from-resolved_10x"> + <compile options="-1.4" files="InitializationOrder.java"/> + <run class="InitializationOrder"/> + </ajc-test> + + <ajc-test dir="new" pr="496" + title="!within and !this handling for callee-side call points" + keywords="from-resolved_10x"> + <compile options="-1.4" files="NotThis.java"/> + <run class="NotThis"/> + </ajc-test> + + <ajc-test dir="new/innerInterfaces" pr="494" + title="private inner interfaces and bytecode visibility" + keywords="from-resolved_10x"> + <compile options="-1.4" files="p/Driver.java,p/InnerTest.java,other/Test.java"/> + <run class="p.Driver"/> + </ajc-test> + + <!-- This has a complicated set of expected join points. + This test should be borken up into more manageable chunks + and more carefully analyzed for correctness in the future. + --> + <ajc-test dir="new" pr="490" + title="elaborated into testing of around on all join points" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AroundAll.java"/> + <run class="AroundAll"/> + </ajc-test> + + <ajc-test dir="new" + title="type name hygiene when code comes from aspects in different packages" + keywords="from-resolved_10x"> + <compile options="-1.4" + files="typeNameConflicts/Driver.java,typeNameConflicts/p1/C.java,typeNameConflicts/aspects/A.java"/> + <run class="typeNameConflicts.Driver"/> + </ajc-test> + + <ajc-test dir="new" title="cflowbelow dependencies (from Chris Dutchyn)" + keywords="from-resolved_10x"> + <compile options="-1.4" files="CflowBelowTest.java"/> + <run class="CflowBelowTest"/> + </ajc-test> + + <ajc-test dir="new" pr="493" + title="Compiler incorrectly flagging *1 (non-alphabetic start to signature pattern)" + keywords="from-resolved_10x"> + <compile options="-1.4" files="NonAlphaSignaturePatternCE.java"/> + <run class="NonAlphaSignaturePatternCE"/> + </ajc-test> + + <ajc-test dir="new" + title="Unable to bind privately-introduced field name from introduced method in the same aspect" + keywords="from-resolved_10x"> + <compile options="-1.4" files="IntroducedFieldsNotBinding.java"/> + <run class="IntroducedFieldsNotBinding"/> + </ajc-test> + + <ajc-test dir="new/anonInnerClass" pr="297" + title="anonymous inner class with aspect" keywords="from-resolved_10x"> + <compile options="-1.4" files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="new" pr="335" + title="Arguments are not being passed in to calls advice" + keywords="from-resolved_10x"> + <compile options="-1.4" files="PR335.java"/> + <run class="PR335"/> + </ajc-test> + + <ajc-test dir="design/intro" title="interfaces as mixins with introduction" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Interfaces.java"> + <message kind="error" text="can't override java.lang.String SubI.instanceField with java.lang.String SubC.instanceField visibility is reduced"/> + <message kind="error" text="can't override java.lang.String I.instanceField with java.lang.String C.instanceField visibility is reduced"/> + </compile> + </ajc-test> + + <ajc-test dir="design/intro" title="interfaces as mixins with introduction b" + keywords="from-resolved_10x"> + <compile files="Interfaces.java" options="-Xset:itdVersion=1 -1.4"/> + <run class="Interfaces"/> + </ajc-test> + + <ajc-test dir="new" + title="functional modifiers work correctly with introduced members" + keywords="from-resolved_10x"> + <compile options="-1.4" files="IntroducedModifiers.java"/> + <run class="IntroducedModifiers"/> + </ajc-test> + + <ajc-test dir="new" + title="ExceptionInInitializerError accessing cflow in aspect initialization - before variants" + keywords="from-resolved_10x"> + <compile options="-1.4" files="CflowInitInAspectVariantsBefore.java"/> + <run class="CflowInitInAspectVariantsBefore"/> + </ajc-test> + + <ajc-test dir="new" + title="NoClassDefFoundError accessing cflow in aspect initialization - after variants" + keywords="from-resolved_10x"> + <compile options="-1.4" files="CflowInitInAspectVariantsAfter.java"/> + <run class="CflowInitInAspectVariantsAfter"/> + </ajc-test> + + <ajc-test dir="new" title="InternalCompilerError in JpPlan when args alone" + keywords="from-resolved_10x"> + <compile options="-1.4" files="ArgsAlone.java"/> + <run class="ArgsAlone"/> + </ajc-test> + + <ajc-test dir="new" pr="527" + title="compile error using pcd if() with advice on introduced methods." + keywords="from-resolved_10x"> + <compile options="-1.4" files="PR527.java"/> + <run class="PR527"/> + </ajc-test> + + <ajc-test dir="new" pr="528" + title="compile errors boolean using cflow and unimplemented method using around advice on methods introduced by interface" + keywords="from-resolved_10x"> + <compile options="-1.4" files="PR528.java"/> + <run class="PR528"/> + </ajc-test> + + <ajc-test dir="new" pr="534" title="aspect as member of interface" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AspectInInterfaceCP.java"/> + <run class="AspectInInterfaceCP"/> + </ajc-test> + + <ajc-test dir="new" pr="535" + title="missing method name to synthetic invocation" + keywords="from-resolved_10x,new-messages-vary"> + <compile options="-1.4" files="PR535.java"/> + <run class="PR535"/> + </ajc-test> + + <ajc-test dir="new" pr="536" + title="protected subclass impl of superclass method with default access and variants" + keywords="from-resolved_10x"> + <compile options="-1.4" files="RestrictingVisibilityCP.java"/> + <run class="RestrictingVisibilityCP"/> + </ajc-test> + + <ajc-test dir="new" pr="519" title="Exception planning advice" + keywords="from-resolved_10x"> + <compile files="PR519.java" options="-Xlint:ignore -1.4"/> + <run class="PR519"/> + </ajc-test> + + <ajc-test dir="new" pr="521" + title="unreproduced bug with advice - probably UTR" + keywords="from-resolved_10x"> + <compile options="-1.4" files="PR520.java"/> + <run class="PR520"/> + </ajc-test> + + <ajc-test dir="new" pr="494" + title="introduced inner interfaces accessible inside aspect" + keywords="from-resolved_10x"> + <compile options="-1.4" files="IntroduceInnerInterfaceCP.java"/> + <run class="IntroduceInnerInterfaceCP"/> + </ajc-test> + + <ajc-test dir="new" pr="525" + title="validate (enclosing) join point and source locations" + keywords="from-resolved_10x"> + <compile files="NegativeSourceLocation.java" options="-Xlint:ignore -1.4"/> + <run class="NegativeSourceLocation"/> + </ajc-test> + + <ajc-test dir="new" pr="544" + title="advice formals are just like method formals" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AdviceFormalsCp.java"/> + <run class="AdviceFormalsCp"/> + </ajc-test> + + <ajc-test dir="new" pr="544" + title="advice formals produce errors just like method formals" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AdviceFormalsCf.java"> + <message kind="error" line="28"/> + <message kind="error" line="29"/> + <message kind="error" line="36"/> + <message kind="error" line="37"/> + </compile> + </ajc-test> + + <ajc-test dir="new" + title="advice throws clauses must be compatible with joinpoints they apply to" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AdviceThrowsCp.java"/> + <run class="AdviceThrowsCp"/> + </ajc-test> + + <ajc-test dir="new" pr="570" + title="potential method conflicts with introductions and interfaces and PR#561" + keywords="from-resolved_10x"> + <compile options="-1.4" files="MethodConflictsCP.java"/> + <run class="MethodConflictsCP"/> + </ajc-test> + + <ajc-test dir="new" pr="570" + title="illegal method conflicts with introductions and interfaces and PR#561" + keywords="from-resolved_10x"> + <compile options="-1.4" files="MethodConflictsCF.java"> + <message kind="error" line="8"/> + <message kind="error" line="20"/> + <message kind="error" line="28"/> + </compile> + </ajc-test> + + <ajc-test dir="new" title="AspectOf available for different aspect types" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AspectOf.java"/> + <run class="AspectOf"/> + </ajc-test> + + <ajc-test dir="new/privilegedAspects" pr="35593" + title="access to all members of class and inner class from privileged aspect" + keywords="from-resolved_10x"> + <compile options="-1.4" + files="driver/PrivilegedAspect.java,util/Util.java,pack/DefaultTarget.java,pack/PublicTarget.java"/> + <run class="driver.PrivilegedAspect"/> + </ajc-test> + + <ajc-test dir="new" + title="cflow alone with around produces compiler bcg StackOverflowError" + keywords="from-resolved_10x"> + <compile options="-1.4" files="CflowAlone.java"/> + <run class="CflowAlone"/> + </ajc-test> + + <ajc-test dir="new" + title="get/set join points run for complex assignment operators (+=, etc.) (working)" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AssignOps.java"/> + <run class="AssignOps"/> + </ajc-test> + + <ajc-test dir="new/introTypeMissing" + title="this available in introduced field initializers" + keywords="from-resolved_10x"> + <compile options="-1.4" files="ThisInIntroFieldInit.java"/> + <run class="ThisInIntroFieldInit"/> + </ajc-test> + + <ajc-test dir="new/introTypeMissing" + title="Introduced type unavailable to cast expressions in introduced methods" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Cast.java,TargetClass.java,Util.java"/> + <run class="Cast"/> + </ajc-test> + + <ajc-test dir="new/introTypeMissing" + title="Introduced type unavailable to qualified new expressions in introduced methods" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Inner.java,TargetClass.java,Util.java"/> + <run class="Inner"/> + </ajc-test> + + <ajc-test dir="new/introTypeMissing" + title="Introduced type unavailable to cast expressions in introduced field initializers" + keywords="from-resolved_10x"> + <compile options="-1.4" files="CastInFieldInit.java,TargetClass.java,Util.java"/> + <run class="CastInFieldInit"/> + </ajc-test> + + <ajc-test dir="new/introTypeMissing" + title="Aspect type unavailable to qualified new expressions in body of introduced methods" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AspectInIntroducedMethod.java"/> + <run class="AspectInIntroducedMethod"/> + </ajc-test> + + + <ajc-test dir="new/introTypeMissing" + title="Introduced type unavailable to qualified new expressions in introduced field initializers" + keywords="from-resolved_10x"> + <compile options="-1.4" files="InnerInFieldInit.java,TargetClass.java,Util.java"/> + <run class="InnerInFieldInit"/> + </ajc-test> + + <ajc-test dir="new" pr="595" + title="variable slots and finally/catch causing verify errors" + keywords="from-resolved_10final,from-resolved_10x"> + <compile options="-1.4" files="AfterFinally.java"/> + <run class="AfterFinally"/> + </ajc-test> + + + <ajc-test dir="new" pr="590" + title="after advice on static method with pcd if() using result" + keywords="from-resolved_10x"> + <compile options="-1.4" files="PR590.java"> + <message kind="error" line="20"/> + <message kind="error" line="23"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="590" + title="after advice on static method with pcd if() using result through pointcut" + keywords="from-resolved_10x"> + <compile files="PR590a.java" options="-Xlint:ignore -1.4"> + <message kind="error" line="29"/> + <message kind="error" line="31"/> + </compile> + </ajc-test> + + <ajc-test dir="new/PR600" pr="600" + title="AbstractMethodError for introduced methods (order 1)" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Main.java,My_error.java,A.java,B.java,C.java"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="new/PR600" pr="600" + title="AbstractMethodError for introduced methods (order 2)" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Main.java,My_error.java,C.java,A.java,B.java"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="new/PR600" pr="600" + title="AbstractMethodError for introduced methods (order 3)" + keywords="from-resolved_10x"> + <compile options="-1.4" files="My_error.java,A.java,B.java,C.java,Main.java"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="new/PR600" pr="600" + title="AbstractMethodError for introduced methods (order 4)" + keywords="from-resolved_10x"> + <compile options="-1.4" files="A.java,B.java,C.java,Main.java,My_error.java"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="new/PR600" pr="600" + title="AbstractMethodError for introduced methods (order 5)" + keywords="from-resolved_10x"> + <compile options="-1.4" files="A.java,B.java,Main.java,C.java,My_error.java"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="new" title="declare error and abstract pointcuts" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AbstractDeclare.java"> + <message kind="error" line="3"/> + <message kind="error" line="4"/> + </compile> + </ajc-test> + + <ajc-test dir="new/runtime" + title="Exercise runtime classes (optionally in 1.1 VM)" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AllRuntime.java,TesterDriver.java"/> + <run class="TesterDriver"/> + </ajc-test> + + <ajc-test dir="new" + title="VerifyError after around advice falls off end of tryCatch" + keywords="from-resolved_10x"> + <compile options="-1.4" files="TryOffEnd.java"> + <message kind="warning" line="13"/> + <message kind="warning" line="21"/> + </compile> + <run class="TryOffEnd"/> + </ajc-test> + + <ajc-test dir="new" pr="635" title="Named within pointcuts failing" + keywords="from-resolved_10x"> + <compile options="-1.4" files="NamedWithinPointcuts.java"/> + <run class="NamedWithinPointcuts"/> + </ajc-test> + + <ajc-test dir="new/subaspects" pr="647" + title="aspect with private abstract pointcut" + keywords="from-resolved_10x,fail-unimplemented"> + <compile options="-1.4" files="PrivatePointcutCE.java"> + <message kind="error" line="5"/> + </compile> + </ajc-test> + + <ajc-test dir="new/subaspects" pr="647" + title="concrete aspect unable to access abstract package-private pointcut in parent for overriding" + keywords="from-resolved_10x" + comment="XXX getting error - confirm line numbers"> + <compile options="-1.4" files="parent/ParentCE.java,child/ChildCE.java"> + <message kind="error" file="child/ChildCE.java" line="32" text="pointcut 'parent.ParentCE.define()' is not visible"/> + <message kind="error" file="child/ChildCE.java" line="21"/> + <message kind="error" file="parent/ParentCE.java" line="10"/> + <message kind="error" file="parent/ParentCE.java" line="12"/> + <message kind="error" file="parent/ParentCE.java" line="22"/> + </compile> + </ajc-test> + + <ajc-test dir="new/subaspects" pr="647" + title="inner, outer, and outside-package subaspects of an aspect with abstract protected-, public-, and default-access pointcuts" + keywords="from-resolved_10x"> + <compile + files="parent/SubAspectVisibility.java,parent/ForeignChildHelper.java,child/ForeignChildAspect.java"/> + <run class="parent.SubAspectVisibility"/> + </ajc-test> + + <ajc-test dir="new/subaspects" pr="647" + title="inner subaspects of an aspect with private pointcut" + keywords="from-resolved_10x"> + <compile options="-1.4" files="parent/PrivatePointcut.java"/> + <run class="parent.PrivatePointcut"/> + </ajc-test> + + <ajc-test dir="new/subaspects" pr="647" + title="outer subaspects of an aspect with private pointcut" + keywords="from-resolved_10x"> + <compile options="-1.4" files="parent/PrivatePointcutOuterClass.java"/> + <run class="parent.PrivatePointcutOuterClass"/> + </ajc-test> + + <ajc-test dir="new/subaspects" pr="647" + title="abstract aspect used statically should not cause instantiation of advice or pointcut" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AbstractAspectUsedStatically.java"/> + <run class="AbstractAspectUsedStatically"/> + </ajc-test> + + <ajc-test dir="new" + title="private inner interface accessible in scope when declared on outer class" + keywords="from-resolved_10x"> + <compile options="-1.4" files="DeclareAccess.java"/> + <run class="DeclareAccess"/> + </ajc-test> + + <ajc-test dir="new" + title="accessing protected superclass members in and outside CCC from body of method introduction" + keywords="from-resolved_10x"> + <compile options="-1.4" files="SuperInIntroduction.java"/> + <run class="SuperInIntroduction"/> + </ajc-test> + + <ajc-test dir="new" + title="accessing private superclass members from body of method introduction" + keywords="from-resolved_10x"> + <compile options="-1.4" files="SuperInIntroductionCE.java"> + <message kind="error" line="25"/> + <message kind="error" line="26"/> + </compile> + </ajc-test> + + <ajc-test dir="new" title="simple test for around and casting" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AroundCasting.java"/> + <run class="AroundCasting"/> + </ajc-test> + + <ajc-test dir="new/aroundinner" pr="620" + title="aroundInner 1 - around advice inner Thread subclass running proceed but not writing field" + keywords="from-resolved_10x"> + <compile options="-1.4" files="ThreadNoField.java,Common.java"/> + <run class="ThreadNoField"/> + </ajc-test> + + <ajc-test dir="new/aroundinner" pr="620" + title="aroundInner 2 - around advice inner Runnable running proceed and writing method-final proxy" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Proxy.java,Common.java"/> + <run class="Proxy"/> + </ajc-test> + + <ajc-test dir="new/aroundinner" pr="620" + title="aroundInner 3 - around advice inner class running proceed and writing field" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Minimal.java,Common.java"/> + <run class="Minimal"/> + </ajc-test> + + <ajc-test dir="new/aroundinner" pr="620" + title="aroundInner 4 - around advice inner Thread subclass running proceed and writing field" + keywords="from-resolved_10x"> + <compile options="-1.4" files="ThreadSub.java,Common.java"/> + <run class="ThreadSub"/> + </ajc-test> + + <ajc-test dir="new/aroundinner" pr="620" + title="aroundInner 5 - around advice inner Runnable (subinterface) running proceed and writing field introduced on subinterface" + keywords="from-resolved_10x"> + <compile options="-1.4" files="RunnableSub.java,Common.java"/> + <run class="RunnableSub"/> + </ajc-test> + + <ajc-test dir="new" pr="636" + title="Named local class closing over proceed invocation" + keywords="from-resolved_10x"> + <compile options="-1.4" files="LocalClassClosingOverProceed.java"/> + <run class="LocalClassClosingOverProceed"/> + </ajc-test> + + <ajc-test dir="new" + title="beautiful recursive computation of factorial with around is now supported" + keywords="from-resolved_10x"> + <compile options="-1.4" files="CircularAdvice.java"/> + <run class="CircularAdvice"/> + </ajc-test> + + <ajc-test dir="new" pr="632" + title="multi-dispatch not used for named pcd references" + keywords="from-resolved_10x"> + <compile options="-1.4" files="MultiDispatchCf.java"> + <message kind="error" line="54"/> + <message kind="error" line="57"/> + <message kind="error" line="60"/> + <message kind="error" line="71"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="632" + title="multi-dispatch implemented through around + args" + keywords="from-resolved_10x"> + <compile options="-1.4" files="MultiDispatchCp.java"/> + <run class="MultiDispatchCp"/> + </ajc-test> + + <ajc-test dir="new" + title="unrecognized aspect should not net Cloneable and Serializable warnings" + keywords="from-resolved_10x"> + <compile options="-1.4" files="UnrecognizedAspectCE.java"> + <message kind="error" line="3"/> + </compile> + </ajc-test> + + <ajc-test dir="new" + title="unreachable code generated by around advice on the execution of void methods" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AroundVoid.java"/> + <run class="AroundVoid"/> + </ajc-test> + + <ajc-test dir="new" pr="654" + title="Overriding method implementations using introduction on interfaces" + keywords="from-resolved_10x,fail-unimplemented"> + <compile files="IntroductionsOverriding.java" options="-Xlint:ignore -1.4" /> + <run class="IntroductionsOverriding"/> + </ajc-test> + + <ajc-test dir="new" pr="654" + title="more coverage for around and concrete methods on interfaces" + keywords="from-resolved_10x"> + <compile files="MultiAndAround.java" options="-Xlint:ignore -1.4"/> + <run class="MultiAndAround"/> + </ajc-test> + + <ajc-test dir="new" title="invalid number and type of proceed arguments" + keywords="from-resolved_10x"> + <compile options="-1.4" files="InvalidProceedArgsCE.java"> + <message kind="error" line="10"/> + <message kind="error" line="15"/> + <message kind="error" line="17"/> + <message kind="error" line="20"/> + <message kind="error" line="22"/> + <message kind="error" line="27"/> + <message kind="error" line="29"/> + <message kind="error" line="31"/> + <message kind="error" line="37"/> + <message kind="error" line="39"/> + <message kind="error" line="43"/> + <message kind="error" line="46"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="694" title="after returning advice order" + keywords="from-resolved_10x"> + <compile options="-1.4" files="Cricket.java"/> + <run class="Cricket"/> + </ajc-test> + + <ajc-test dir="new" pr="694" title="after returning advice param" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AfterReturningParam.java"/> + <run class="AfterReturningParam"/> + </ajc-test> + + <ajc-test dir="new" pr="695" + title="! and declaring types with callee-side call join points" + keywords="from-resolved_10x"> + <compile files="NotAndDeclaringTypes.java" options="-Xlint:ignore -1.4"/> + <run class="NotAndDeclaringTypes"/> + </ajc-test> + + <ajc-test dir="new" pr="479" + title=". Binding the wrong arguments in withincode(..)." + keywords="from-resolved_10x"> + <compile options="-1.4" files="BindingArgumentsInWithincode.java"/> + <run class="BindingArgumentsInWithincode"/> + </ajc-test> + + <ajc-test dir="new" pr="479" + title=". Matching arguments in cflow correctly." + keywords="from-resolved_10x"> + <compile options="-1.4" files="MatchingArgumentsInCflow.java"/> + <run class="MatchingArgumentsInCflow"/> + </ajc-test> + + <ajc-test dir="new" pr="480" + title=". Binding variables with numbers in their name with pertarget(..)'s." + keywords="from-resolved_10x"> + <compile options="-1.4" files="PerTargetAndVariablesWithNumbersInTheirNames.java"/> + <run class="PerTargetAndVariablesWithNumbersInTheirNames"/> + </ajc-test> + + + <ajc-test dir="new" pr="554" + title="second arg in formal on shared joinpoint with pcd if() causes verify error ??" + keywords="from-resolved_10rc3"> + <compile options="-1.4" files="PR554.java"/> + <run class="PR554"/> + </ajc-test> + + <ajc-test dir="new/privilegedAspects" pr="555" + title="access to private members from privileged aspect" + keywords="from-resolved_10rc3"> + <compile + files="driver/PR555.java,util/Util.java,pack/DefaultTarget.java"/> + <run class="driver.PR555"/> + </ajc-test> + + <ajc-test dir="new" pr="555" + title="inner classes of privileged aspects cannot see target class private members" + keywords="from-resolved_10rc3"> + <compile options="-1.4" files="InnerClassInPrivilegedAspect.java"/> + <run class="InnerClassInPrivilegedAspect"/> + </ajc-test> + + <ajc-test dir="new/packageAccessPR556" pr="556" + title="aspects should get package access outside the file" + keywords="from-resolved_10rc3"> + <compile files="base1/p/C1.java,base2/p/C2.java" options="-Xlint:ignore -1.4"/> + <run class="p.C1"/> + </ajc-test> + + <ajc-test dir="new" pr="559" + title="subclass advice not run for join points selected by superclass cflow-based pointcuts" + keywords="from-resolved_10rc3"> + <compile options="-1.4" files="PR559.java"/> + <run class="PR559"/> + </ajc-test> + + <ajc-test dir="new" pr="559" + title="more issues with abstract aspects and cflow pointcuts" + keywords="from-resolved_10rc3,fail-unimplemented"> + <compile options="-1.4" files="AbstractCflows.java"/> + <run class="AbstractCflows"/> + </ajc-test> + + <ajc-test dir="new" pr="560" + title="compile fails for aspect derived from percflow base aspect unless pointcut excludes base aspect and subaspects" + keywords="from-resolved_10rc3"> + <compile options="-1.4" files="PR560.java"/> + <run class="PR560"/> + </ajc-test> + + + <ajc-test dir="new" pr="573" + title="pertarget stack overflow getting name of anonymous (Interface) class" + keywords="from-resolved_10rc3"> + <compile options="-1.4" files="PR573.java"/> + <run class="PR573"/> + </ajc-test> + + <ajc-test dir="new" pr="573" + title="pertarget stack overflow getting name of anonymous (Object) class" + keywords="from-resolved_10rc3"> + <compile options="-1.4" files="PR573_1.java"/> + <run class="PR573_1"/> + </ajc-test> + + <ajc-test dir="new" pr="573" + title="pertarget runtime stack overflow (getting name of anonymous (Object) class?)" + keywords="from-resolved_10rc3"> + <compile options="-1.4" files="PR573_2.java"/> + <run class="PR573_2"/> + </ajc-test> + + <ajc-test dir="new" pr="685" + title="subaspect method declaration on superaspect inner interface (names)" + keywords="from-resolved_104"> + <compile options="-1.4" files="InnerInterfaceNames.java"/> + <run class="InnerInterfaceNames"/> + </ajc-test> + + <ajc-test dir="new" pr="685" + title="subaspect method declaration on superaspect inner interface (access)" + keywords="from-resolved_104"> + <compile options="-1.4" files="InnerInterfaceAccess.java"/> + <run class="InnerInterfaceAccess"/> + </ajc-test> + + <ajc-test dir="new" pr="685" + title="subaspect method declaration on superaspect inner interface (types)" + keywords="from-resolved_104"> + <compile options="-1.4" files="InnerInterfaceTypes.java,InnerInterfaceTypesHelper.java"/> + <run class="InnerInterfaceTypes"/> + </ajc-test> + + <ajc-test dir="new" pr="691" title="around AST type XXX" + keywords="from-resolved_104"> + <compile options="-1.4" files="PR691.java"/> + <run class="PR691"/> + </ajc-test> + + <ajc-test dir="new" pr="687" + title="around all execution with double assignment in initializer (simple)" + keywords="from-resolved_104"> + <compile options="-1.4" files="AroundDoubleAssignment.java"/> + <run class="AroundDoubleAssignment"/> + </ajc-test> + + <ajc-test dir="new" pr="687" + title="around all execution with double assignment in initializer (coverage)" + keywords="from-resolved_104"> + <compile options="-1.4" files="AroundDoubleAssignmentC.java"/> + <run class="AroundDoubleAssignmentC"/> + </ajc-test> + + <ajc-test dir="new" + title="changing this in around's proceed reported by Rich Price" + keywords="from-resolved_104"> + <compile files="AroundChangeThis.java" options="-1.4 -Xlint:ignore"/> + <run class="AroundChangeThis"/> + </ajc-test> + + <ajc-test dir="new" pr="548" + title="default package for aspect introductions is not the current package" + keywords="from-resolved_10rc3,from-resolved_104"> + <compile + files="introductionPackage/two/C.java,introductionPackage/one/C.java,introductionPackage/one/Aspect.java,introductionPackage/one/TestAspect.java"/> + <run class="one.TestAspect"/> + </ajc-test> + + <ajc-test dir="new/PR569" pr="569" + title="anon class written to wrong directory" + keywords="from-resolved_104,from-resolved_104"> + <compile options="-1.4" files="a/IntroAnon.java,a/MyInterface.java,b/Dest.java"/> + <run class="a.IntroAnon"/> + </ajc-test> + + <ajc-test dir="new" pr="603" + title="unqualified transitive pointcut references not resolved" + keywords="from-resolved_104"> + <compile options="-1.4" files="PointcutQualification.java"/> + <run class="PointcutQualification"/> + </ajc-test> + + <ajc-test dir="new" pr="603" + title="unqualified transitive pointcut references not resolved - 2" + keywords="from-resolved_104"> + <compile options="-1.4" files="PointcutQualification2.java"/> + <run class="PointcutQualification2"/> + </ajc-test> + + <ajc-test dir="new" pr="619" + title="direct use outside aspect of defined abstract pointcut" + keywords="from-resolved_104"> + <compile options="-1.4" files="AbstractPointcutAccess.java"/> + <run class="AbstractPointcutAccess"/> + </ajc-test> + + <ajc-test dir="new" pr="619" + title="direct use outside aspect of undefined abstract pointcut" + keywords="from-resolved_104"> + <compile options="-1.4" files="AbstractPointcutAccessCE.java"> + <message kind="error" line="9"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="619" + title="indirect use outside aspect of undefined abstract pointcut" + keywords="from-resolved_104"> + <compile options="-1.4" files="AbstractPointcutIndirectCE.java"> + <message kind="error" line="9"/> + <message kind="error" line="5"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="658" + title="simple call join point tests for JoinPoint SourceLocation context" + keywords="from-resolved_104"> + <compile options="-1.4" files="SourceLocationCall.java"/> + <run class="SourceLocationCall"/> + </ajc-test> + + <ajc-test dir="new" pr="661" + title="!target with second advice on casted call" + keywords="from-resolved_104"> + <compile options="-1.4" files="CallNotTarget.java"/> + <run class="CallNotTarget"/> + </ajc-test> + + <ajc-test dir="new" pr="666" title="name binding in around cflow" + keywords="from-resolved_104"> + <compile options="-1.4" files="AroundCall.java"/> + <run class="AroundCall"/> + </ajc-test> + + <ajc-test dir="new" pr="660" title="name binding in around cflow - 2" + keywords="from-resolved_104"> + <compile options="-1.4" files="ArgsInCflow2.java"/> + <run class="ArgsInCflow2"/> + </ajc-test> + + <ajc-test dir="new" pr="677" + title="around name-binding in cflows using factorial" + keywords="from-resolved_104"> + <compile options="-1.4" files="FactorialCflow.java"/> + <run class="FactorialCflow"/> + </ajc-test> + + <ajc-test dir="new" title="replacing this or target in around advice" + keywords="from-resolved_104"> + <compile options="-1.4" files="TargetObjectReplacement.java"/> + <run class="TargetObjectReplacement"/> + </ajc-test> + + <ajc-test dir="new" + title="after returning from initialization and after executing constructor" + keywords="from-resolved_104"> + <compile options="-1.4" files="ConstructorExecInit.java"/> + <run class="ConstructorExecInit"/> + </ajc-test> + + <ajc-test dir="new" + title="after returning from initialization causes ExceptionInInitializer in aspect"> + <compile options="-1.4" files="ConstructorExecInitFails.java"/> + <run class="ConstructorExecInitFails"/> + </ajc-test> + + <ajc-test dir="new" pr="659" + title="name binding in before cflow containing cflowbelow" + keywords="from-resolved_104"> + <compile files="ArgsInCflow.java" options="!eclipse -1.4"> + <message kind="error" line="29"/> + <message kind="error" line="32"/> + </compile> + </ajc-test> + + + <ajc-test dir="new/pr728" pr="728" title="file order in type searching" + keywords="from-resolved_105"> + <compile options="-1.4" files="AnotherClass.java,Interface.java"/> + <run class="AnotherClass"/> + </ajc-test> + + + <ajc-test dir="new" title="simple declare warning (NPE)" + keywords="from-resolved_105"> + <compile options="-1.4" files="DeclareWarningMain.java"> + <message kind="warning" line="4"/> + </compile> + <run class="DeclareWarningMain"/> + </ajc-test> + + <ajc-test dir="new" pr="755" + title="ajc dies on cflow into field init anon class see knownbugs.txt" + keywords="from-resolved_105"> + <compile files="CflowOfFieldInitAnonMethods.java" options="!eclipse -1.4"> + </compile> + <run class="CflowOfFieldInitAnonMethods" options="!eclipse"/> + </ajc-test> + + + <ajc-test dir="new" pr="757" title="Incrementing interface-introduced field" + keywords="from-resolved_105"> + <compile options="-1.4" files="IntroducedFieldInc.java"/> + <run class="IntroducedFieldInc"/> + </ajc-test> + + <ajc-test dir="new" + title="The dynamic type, not the static one, should be used in if pcds" + keywords="from-resolved_105"> + <compile options="-1.4" files="StaticTypeInIf.java"/> + <run class="StaticTypeInIf"/> + </ajc-test> + + <ajc-test dir="new" + title="bad interaction with after returning, around and void methods (from Rich Price)" + keywords="from-resolved_105"> + <compile options="-1.4" files="AfterReturningResult.java"/> + <run class="AfterReturningResult"/> + </ajc-test> + + <ajc-test dir="new" + title="type pattern matching for inner classes (from Ken Horn)" + keywords="from-resolved_105"> + <compile options="-1.4" files="TypePat.java"/> + <run class="test.TypePat"/> + </ajc-test> + + <ajc-test dir="new" pr="771" title="static initializer member name" + keywords="from-resolved_105"> + <compile options="-1.4" files="StaticInitName.java"/> + <run class="StaticInitName"/> + </ajc-test> + + <ajc-test dir="new" pr="770" title="cflow pcd syntax error" + keywords="from-resolved_105"> + <compile options="-1.4" files="IllegalCflowCE.java"> + <message kind="error" line="4"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="764" + title="binding args with indeterminate prefix and suffix" + keywords="from-resolved_105"> + <compile options="-1.4" files="IndeterminateArgs.java"/> + <run class="IndeterminateArgs"/> + </ajc-test> + + <ajc-test dir="new" pr="764" + title="check arg types with indeterminate prefix and suffix" + keywords="from-resolved_105"> + <compile options="-1.4" files="IndeterminateArgType.java"/> + <run class="IndeterminateArgType"/> + </ajc-test> + + <ajc-test dir="new" pr="764" + title="testing and binding args with single indeterminate prefix and suffix" + keywords="from-resolved_105"> + <compile options="-1.4" files="IndeterminateArg.java"/> + <run class="IndeterminateArg"/> + </ajc-test> + + <ajc-test dir="new" pr="764" + title="binding handler args with indeterminate prefix and suffix" + keywords="from-resolved_105"> + <compile options="-1.4" files="IndeterminateHandlerArg.java"/> + <run class="IndeterminateHandlerArg"/> + </ajc-test> + + + <ajc-test dir="new/nolang" pr="762" + title="Compiling java.lang.Object with ajc yields non-verifying bytecode" + keywords="from-resolved_105" + comment="XXX weak/bad test"> + <compile options="-1.4" files="java/lang/Object.java,java/lang/String.java"> + </compile> + </ajc-test> + + <ajc-test dir="new" + title="method-local class defined in around return statement" + keywords="from-resolved_105"> + <compile options="-1.4" files="MethodLocalAroundReturns.java"/> + <run class="MethodLocalAroundReturns"/> + </ajc-test> + + <ajc-test dir="new" title="CE expected for assignment to arg in if pcd" + keywords="from-resolved_105"> + <compile options="-1.4" files="IfPCDAssignmentCE.java"> + <message kind="error" line="16"/> + <message kind="error" line="20"/> + </compile> + </ajc-test> + + <ajc-test dir="new" title="advising field get/sets when accessing via super" + keywords="from-resolved_105"> + <compile options="-1.4" files="SuperField.java"/> + <run class="SuperField"/> + </ajc-test> + + <ajc-test dir="new" title="accessing private members in outer types" + keywords="from-resolved_105"> + <compile options="-1.4" files="FieldInnerAccess.java"/> + <run class="FieldInnerAccess"/> + </ajc-test> + + <ajc-test dir="new" pr="29934" + title="can't apply around advice to the execution of around advice" + keywords="from-resolved_10x"> + <compile options="-1.4" files="CflowCycles.java"/> + <run class="CflowCycles"/> + </ajc-test> + + <ajc-test dir="new" + title="incompatible advice throws clause are a compile-time error" + keywords="from-resolved_10x"> + <compile options="-1.4" files="AdviceThrowsCf.java"> + <message kind="error" line="13"/> + <message kind="error" line="28"/> + <message kind="error" line="47"/> + <message kind="error" line="48"/> + <message kind="error" line="50"/> + + <message kind="error" line="70"/> + <message kind="error" line="74"/> + <message kind="error" line="76"/> + <message kind="error" line="78"/> + + <message kind="error" line="85"/> + </compile> + </ajc-test> + diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc10x/ajc10x.xml b/tests/src/test/java/org/aspectj/systemtest/ajc10x/ajc10x.xml new file mode 100644 index 000000000..90198331d --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc10x/ajc10x.xml @@ -0,0 +1,9 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[ +<!ENTITY tests SYSTEM "../tests/src/org/aspectj/systemtest/ajc10x/ajc10x-tests.xml"> +]> + +<!-- AspectJ v1.0.x Tests --> + +<suite> +&tests; +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc11/Ajc11Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc11/Ajc11Tests.java new file mode 100644 index 000000000..ff19e7954 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc11/Ajc11Tests.java @@ -0,0 +1,485 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM Corporation + * 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 + * + * ******************************************************************/ +package org.aspectj.systemtest.ajc11; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.util.LangUtil; + +public class Ajc11Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc11Tests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc11.xml"); + } + + public void test001() { + runTest("declare interface extends class"); + } + + public void test002() { + runTest("declare interface implements class"); + } + + public void test003() { + runTest("declaring a private method on an inner interface"); + } + + public void test004() { + runTest("CE expected when declaring fields on arrays"); + } + + public void test005() { + runTest("signature of handler join point"); + } + + public void test006() { + runTest("source locations within expressions"); + } + + public void test007() { + runTest("crashes given method in declared method"); + } + + public void test008() { + runTest("after returning advice on interface constructor"); + } + + public void test009() { + runTest("after returning advice on interface constructor - error"); + } + + public void test010() { + runTest("after advice on static call join point"); + } + + public void test011() { + runTest("incompatible class change error"); + } + + public void test012() { + runTest("simple cflow of method execution"); + } + + public void test013() { + runTest("using instance as class reference to constant field"); + } + + public void test014() { + runTest("interface self-reference in anonymous instance"); + } + + public void test015() { + runTest("self-reference from (aspect-declared) method-local class"); + } + + public void test016() { + runTest("expect CE for unterminated declare error"); + } + + public void test017() { + runTest("expect CE for declaration collision between subaspects instead of domination order"); + } + + public void test018() { + runTest("subtype pattern in dominates should pick out aspect subtypes"); + } + + public void test019() { + runTest("subtype pattern in dominates will conflict with type pattern"); + } + + public void test020() { + runTest("after returning advice on interface and implementation constructor"); + } + + public void test021() { + runTest("after throwing advice with non-throwable formal"); + } + + public void test022() { + runTest("declare array field using postfix"); + } + + public void test023() { + runTest("prohibit declaring new aspect constructor with arguments"); + } + + public void test024() { + runTest("prohibit declaring only aspect constructor with arguments"); + } + + public void test025() { + runTest("declare class extends interface"); + } + + public void test026() { + runTest("declare class implements class"); + } + + public void test027() { + runTest("declare interface implements interface"); + } + + public void test028() { + runTest("if and cflow arg binding"); + } + + public void test029() { + runTest("circularity in declare dominates"); + } + + public void test030() { + runTest("percflow code hangs compiler"); + } + + public void test031() { + runTest("Verification error tracing constructor that takes arguments"); + } + + public void test032() { + runTest("declared exceptions in inter-type decls"); + } + + public void test033() { + runTest("Verify error on non-Throwable in declare soft"); + } + + public void test034() { + runTest("inter-type fields with array types"); + } + + public void test035() { + runTest("checking around join point for advice return type - numeric"); + } + + public void test036() { + runTest("void around advice without proceed"); + } + + public void test037() { + runTest("declaring method on superclass and subclass"); + } + + public void test038() { + runTest("introducing final fields (simple)"); + } + + public void test039() { + runTest("introducing final fields and using as constants"); + } + + public void test040() { + runTest("introducing final fields and checking errors"); + } + + public void test041() { + runTest("Static inner aspects cannot reference user defined pointcuts"); + } + + public void test042() { + runTest("Static inner aspects cannot reference user defined pointcuts"); + } + + public void test043() { + runTest("Declare precedence should not allow multiple * patterns"); + } + + public void test044() { + runTest("VerifyError on accessing objects not accessible to the weaver"); + } + + public void test045() { + runTest("aspect static initializers should run before instance constructed"); + } + + public void test046() { + runTest("super call in intertype method declaration body causes VerifyError"); + } + + public void test047() { + runTest("Error with certain combination of advice"); + } + + public void test048() { + runTest("Pointcut adviceexecution() does not work"); + } + + public void test049() { + runTest("problems with finalize call"); + } + + public void test050() { + runTest("Negation of if pointcut does not work"); + } + + public void test051() { + runTest("ajc reports error when encountering static declaration of nested classes"); + } + + public void test052() { + runTest("can't use pointcuts defined in inner aspects "); + } + + public void test053() { + runTest("can't resolve nested public interfaces (also PR#32399)"); + } + + public void test054() { + runTest("thisJoinPoint.getArgs() causes IncompatibleClassChangeError"); + } + + public void test055() { + runTest("inter-type declaration of void field"); + } + + public void test056() { + runTest("no such constructor for proceed argument (error)"); + } + + public void test057() { + runTest("omnibus declare warning context with no initializer/constructor"); + } + + public void test058() { + runTest("omnibus declare warning context"); + } + + public void test059() { + runTest("cflow binding issues with ignoring state"); + } + + public void test060() { + runTest("cflow binding -- original weaver crash"); + } + + public void test061() { + runTest("type not imported in around advice"); + } + + public void test062() { + runTest("type not imported in aspect"); + } + + public void test063() { + runTest("class extending abstract aspect"); + } + + public void test064() { + runTest("declare soft and throw statements"); + } + + public void test065() { + runTest("inter-type declaration bug with abstract classes"); + } + + public void test066() { + runTest("Inter type declaration to base class not seen by derived class"); + } + + public void test067() { + runTest("Declare parents with intermediate ancestor"); + } + + public void test068() { + runTest("Declare parents removing ancestor"); + } + + public void test069() { + runTest("IllegalAccessError while accessing introduced variable / 1.1rc1"); + } + + public void test070() { + runTest("implemented abstract pointcut"); + } + + public void test071() { + runTest("privileged aspect main verify error"); + } + + public void test072() { + runTest("Internal compiler error with thisJoinPoint.getStaticPart()"); + } + + public void test073() { + runTest("Inconsistant stack height with around"); + } + + public void test074() { + runTest("Ajc 1.1 rc1 java.lang.VerifyError with messy arounds"); + } + + public void test075() { + runTest("try/finally in around advice (same as ...messy arounds?)"); + } + + public void test076() { + runTest("advise join points in subclass of empty interface"); + } + + public void test077() { + runTest("can't put around advice on interface static initializer"); + } + + public void test078() { + runTest("cflow concretization causing assertion failure"); + } + + public void test079() { + runTest("lame error message: negation doesn't allow binding"); + } + + public void test080() { + runTest("Error when introducing members of type Class"); + } + + // public void test081(){ + // runTest("arrays via Class.forName()"); + // } + + public void test082() { + runTest("perthis and inline arounds"); + } + + public void test083() { + runTest("Weaver fails with NPE for very large source files "); + } + + public void test084() { + runTest("CLE: no sources"); + } + + public void test085() { + runTest("CLE: bad filename"); + } + + public void test086() { + runTest("CLE: no dir specified for sourceroots"); + } + + public void test087() { + runTest("CLE: no sourceroot specified for incremental"); + } + + public void test088() { + runTest("CLE: file specified with incremental"); + } + + public void test089() { + runTest("public static fields being ignored"); + } + + public void test090() { + runTest("can not resolve this member warning"); + } + + public void test091() { + runTest("try switch VerifyError, InconsistentStackHeight"); + } + + public void test092() { + if (LangUtil.is17VMOrGreater()) { + runTest("Compiler crash in ajc 1.1 - terrible error for inaccessible constructor - 1.7"); + } else { + runTest("Compiler crash in ajc 1.1 - terrible error for inaccessible constructor"); + } + } + + public void test093() { + runTest("Missing import crashes compiler"); + } + + public void test094() { + runTest("NPE in bcel.LazyMethodGen when delegating from one ctor to a second that includes a switch"); + } + + public void test095() { + runTest("switch statement in aspects crashes weaving"); + } + + public void test096() { + runTest("ajc stack trace on declaring hashcode() method in aspect"); + } + + public void test097() { + runTest("using super in method introduced on interface with multiple supertypes"); + } + + public void test098() { + runTest("Compiler crashes in jar and cflow (with no .jar)"); + } + + public void test099() { + runTest("Compiler crashes in jar and cflow (with .jar)"); + } + + public void test100() { + runTest("Default method impl for interface causes internal exception."); + } + + public void test102() { + runTest("compile error expected for abstract pointcut outside abstract aspect"); + } + + public void test103() { + runTest("subtype-qualified pointcut reference"); + } + + public void test104() { + runTest("weaver trace on mis-qualified pointcut reference"); + } + + public void test105() { + runTest("compile error expected for interface pointcuts"); + } + + public void test106() { + runTest("interface call signatures when declaring method in aspect"); + } + + public void test107() { + runTest("reflective check of declared exceptions from aspect-declared methods"); + } + + public void test108() { + runTest("throw derivative pointcuts not advised"); + } + + public void test109() { + runTest("perthis and signature bad interaction"); + } + + public void test110() { + runTest("declare error fails on pointcuts composed from multiple classes"); + } + + public void test111() { + runTest("declare error fails on pointcuts composed from multiple classes"); + } + + public void test112() { + runTest("Interaction between pointcut binding and declare parents"); + } + + public void test113() { + runTest("Non-functional concretezation of ReferencePointcut"); + } + + public void test114() { + runTest("zip and jar suffixes for extdirs entries"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc11/ajc11-tests.xml b/tests/src/test/java/org/aspectj/systemtest/ajc11/ajc11-tests.xml new file mode 100644 index 000000000..02b422bb8 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc11/ajc11-tests.xml @@ -0,0 +1,850 @@ +<!-- AspectJ v1.1.x Tests --> + + <ajc-test dir="new" pr="853" + title="declare interface extends class"> + <compile files="DeclareInterfaceExtendsClass.java"> + <message kind="error" line="10"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="853" + title="declare interface implements class"> + <compile files="DeclareInterfaceImplementsClass.java"> + <message kind="error" line="10"/> + </compile> + </ajc-test> + + + + <ajc-test dir="new" pr="823" + title="declaring a private method on an inner interface" + keywords="tofix"> + <compile files="PrivateMethodOnInnerInterface.java"/> + <run class="PrivateMethodOnInnerInterface"/> + </ajc-test> + + <ajc-test dir="new" pr="829" + title="CE expected when declaring fields on arrays" keywords="tofix"> + <compile files="ArrayFieldDeclarationCE.java"> + <message kind="error" line="14"/> + </compile> + </ajc-test> + + + <ajc-test dir="new" pr="883" + title="signature of handler join point"> + <compile files="HandlerSignature.java"/> + <run class="HandlerSignature"/> + </ajc-test> + + <ajc-test dir="new" pr="885" + title="source locations within expressions"> + <compile files="SourceLocationWithinExpr.java"/> + <run class="SourceLocationWithinExpr"/> + </ajc-test> + + + + <ajc-test dir="new" pr="888" + title="crashes given method in declared method"> + <compile files="DeclareMethodCE.java"> + <message kind="error" line="8"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="889" + title="after returning advice on interface constructor"> + <compile files="AfterReturningInterfaceConstructor.java"/> + <run class="AfterReturningInterfaceConstructor"/> + </ajc-test> + + <ajc-test dir="new" pr="889" + title="after returning advice on interface constructor - error"> + <compile files="AfterReturningInterfaceConstructorCE.java"> + <message kind="error" line="26"/> + <message kind="warning" line="30"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="900" + title="after advice on static call join point"> + <compile files="AfterStaticCall.java"/> + <run class="AfterStaticCall"/> + </ajc-test> + + <ajc-test dir="bugs" pr="901" + title="incompatible class change error" + comment="XXX Jim and Erik found/fixed this - need basis"> + <compile files="IncompatibleClassChangeErrorBug.java"/> + <run class="IncompatibleClassChangeErrorBug"/> + </ajc-test> + + <ajc-test dir="bugs" pr="903" + title="simple cflow of method execution"> + <compile files="ExecutionCflow.java"/> + <run class="ExecutionCflow"/> + </ajc-test> + + <ajc-test dir="bugs" pr="909" + title="using instance as class reference to constant field" + comment="XXX need to verify run"> + <compile files="InstanceAsClassRefToConstant.java"/> + </ajc-test> + + <ajc-test dir="new" pr="774" + title="interface self-reference in anonymous instance"> + <compile files="AnonymousSelfReference.java"/> + <run class="AnonymousSelfReference"/> + </ajc-test> + + <ajc-test dir="new" pr="776" + title="self-reference from (aspect-declared) method-local class"> + <compile files="MethodSelfReference.java"/> + <run class="MethodSelfReference"/> + </ajc-test> + + <ajc-test dir="new" title="expect CE for unterminated declare error"> + <compile files="UnterminatedDeclareErrorCE.java"> + <message kind="error" line="4"/> + </compile> + </ajc-test> + + <ajc-test dir="new" + title="expect CE for declaration collision between subaspects instead of domination order"> + <compile files="DeclarationCollisionCE.java"> + <message kind="error" line="10"/> + <message kind="error" line="20"/> + <message kind="error" line="27"/> + </compile> + </ajc-test> + + <ajc-test dir="new" + title="subtype pattern in dominates should pick out aspect subtypes"> + <compile files="DominatesTypePattern.java"/> + <run class="DominatesTypePattern"/> + </ajc-test> + + <ajc-test dir="new" + title="subtype pattern in dominates will conflict with type pattern"> + <compile files="DominatesTypePatternCE.java"> + <message kind="error" line="15"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="827" + title="after returning advice on interface and implementation constructor" + keywords="tofix"> + <compile files="AfterReturningConstructor.java"/> + <run class="AfterReturningConstructor"/> + </ajc-test> + + <ajc-test dir="new" pr="832" + title="after throwing advice with non-throwable formal"> + <compile files="AfterThrowingNonThrowable.java"> + <message kind="error" line="41"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="829" title="declare array field using postfix" + keywords="tofix"> + <compile files="ArrayFieldDeclaration.java"> + <message kind="error" line="17"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="851" + title="prohibit declaring new aspect constructor with arguments"> + <compile files="DeclareAspectConstructorCE.java"> + <message kind="error" line="10"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="851" + title="prohibit declaring only aspect constructor with arguments"> + <compile files="DeclareOnlyAspectConstructorCE.java"> + <message kind="error" line="10"/> + </compile> + </ajc-test> + + <!-- The follwing three idioms are allowed. Within a declare parents, + implements and extends can be used interchangably. We could + provide -Xlint style warnings for misuse. + --> + + <ajc-test dir="new" pr="853" + title="declare class extends interface"> + <compile files="DeclareClassExtendsInterface.java"> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="853" + title="declare class implements class"> + <compile files="DeclareClassImplementsClass.java"> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="853" + title="declare interface implements interface"> + <compile files="DeclareInterfaceImplementsInterface.java"> + </compile> + </ajc-test> + + <ajc-test dir="new" + title="if and cflow arg binding"> + <compile files="CflowBinding.java"> + <message kind="error" line="13"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="902" + title="circularity in declare dominates"> + <compile files="CircularDominates.java"> + <message kind="error" line="18"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="28702" title="percflow code hangs compiler"> + <compile files="CloseConnectionsCflow.java" options="-1.4"> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="28852" + title="Verification error tracing constructor that takes arguments"> + <compile files="ConstructorArgTracing.java"/> + <run class="ConstructorArgTracing"/> + </ajc-test> + + <ajc-test dir="bugs" pr="29106" title="declared exceptions in inter-type decls"> + <compile files="ExceptionsOnInters.java"/> + <run class="ExceptionsOnInters"/> + </ajc-test> + + <ajc-test dir="bugs" pr="28921" + title="Verify error on non-Throwable in declare soft"> + <compile files="DeclareSoftCf.java" options="-Xlint:warning"> + <message kind="warning" line="28"/> + <message kind="error" line="29"/> + <!--message kind="warning"/--> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="29113" title="inter-type fields with array types"> + <compile files="InterFieldArrays.java"/> + <run class="InterFieldArrays"/> + </ajc-test> + + + <ajc-test dir="new" pr="838" + title="checking around join point for advice return type - numeric"> + <compile files="AroundNumericCastCE.java"> + <message kind="error" line="11"/> + <message kind="error" line="17"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="836" title="void around advice without proceed"> + <compile files="VoidAround.java"> + <message kind="error" line="11"/> + <message kind="error" line="29"/> + </compile> + </ajc-test> + + <ajc-test dir="new/PR852" pr="852" + title="declaring method on superclass and subclass"> + <compile files="aspectPack/Aspect.java,target/SubClass.java,target/SuperClass.java"> + <dir-changes added="target.SubClass,target.SuperClass"/> + </compile> + <run class="aspectPack.Aspect"/> + </ajc-test> + + <ajc-test dir="new/finalfield" pr="28974" + title="introducing final fields (simple)"> + <compile files="Introducer.java,Receiver.java,User1.java"/> + <run class="User1"/> + </ajc-test> + + <ajc-test dir="new/finalfield" pr="28974" + title="introducing final fields and using as constants"> + <compile files="Introducer.java,Receiver.java,User2.java"/> + <run class="User2"/> + </ajc-test> + + <ajc-test dir="new/finalfield" pr="28974" + title="introducing final fields and checking errors"> + <compile files="Introducer.java,Receiver.java,UserCf.java"> + <message kind="error" line="6"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="29691" + title="Static inner aspects cannot reference user defined pointcuts"> + <compile files="PcdLookup.java" /> + <run class="PcdLookup"/> + </ajc-test> + + <ajc-test dir="bugs" pr="29691" + title="Static inner aspects cannot reference user defined pointcuts"> + <compile files="SoftWithin.java" /> + <run class="SoftWithin"/> + </ajc-test> + + <ajc-test dir="bugs" pr="29689" + title="Declare precedence should not allow multiple * patterns"> + <compile files="CircularPrecedence.java"> + <message kind="error" line="14"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="29662" + title="VerifyError on accessing objects not accessible to the weaver"> + <compile files="AroundAccess.java"> + </compile> + <run class="AroundAccess"/> + </ajc-test> + + <ajc-test dir="new" pr="804" + title="aspect static initializers should run before instance constructed" + keywords="tofix"> + <compile files="AspectStaticInit.java"/> + <run class="AspectStaticInit"/> + </ajc-test> + + <ajc-test dir="bugs" pr="29959" + title="super call in intertype method declaration body causes VerifyError"> + <compile files="SuperToIntro.java"/> + <run class="SuperToIntro"/> + </ajc-test> + + <ajc-test dir="bugs/crashes" pr="30168" + title="Error with certain combination of advice"> + <compile files="test/Test3.java"/> + <run class="test.Test3"/> + </ajc-test> + + <ajc-test dir="bugs" pr="31423" + title="Pointcut adviceexecution() does not work"> + <compile files="AdviceExec.java"/> + <run class="AdviceExec"/> + </ajc-test> + + <ajc-test dir="bugs" pr="30026" + title="problems with finalize call"> + <compile files="Finalizer.java"> + <message kind="error" line="22"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="33635" + title="Negation of if pointcut does not work"> + <compile files="NotIf.java"/> + <run class="NotIf"/> + </ajc-test> + + + <ajc-test dir="bugs" pr="32463" + title="ajc reports error when encountering static declaration of nested classes"> + <compile files="WeaveLocal.java"/> + <run class="WeaveLocal"/> + </ajc-test> + + <ajc-test dir="bugs" pr="32428" + title="can't use pointcuts defined in inner aspects "> + <compile files="InnerPointcut.java"/> + <run class="InnerPointcut"/> + </ajc-test> + + <ajc-test dir="bugs/interfaceNames" pr="32421" + title="can't resolve nested public interfaces (also PR#32399)"> + <compile files="TransactionTest.java,sub/ExecutionMonitor.java,sub/ObserverProtocol.aj"/> + <run class="TransactionTest"/> + </ajc-test> + + <ajc-test dir="bugs" pr="34210" + title="thisJoinPoint.getArgs() causes IncompatibleClassChangeError"> + <compile files="ThisJoinPointAndVerifier.java"/> + <run class="ThisJoinPointAndVerifier"/> + </ajc-test> + + <ajc-test dir="errors" keywords="error" + title="inter-type declaration of void field"> + <compile files="VoidFieldDeclarationCE.java"> + <message kind="error" line="7"/> + </compile> + </ajc-test> + + <ajc-test dir="binding" + title="no such constructor for proceed argument (error)"> + <compile files="UnfoundConstructor.java"> + <message kind="error" line="25"/> + </compile> + </ajc-test> + + <ajc-test dir="new/declare" pr="31724" + title="omnibus declare warning context with no initializer/constructor"> + <compile files="DeclareWarningEmpty.java"> + <message kind="warning" line="3" text="2 - initialization(DeclareWarningEmpty)"/> + <message kind="warning" line="3" text="1 - staticinitialization(DeclareWarningEmpty)"/> + </compile> + </ajc-test> + + + <ajc-test dir="new/declare" pr="31724" + title="omnibus declare warning context"> + <compile files="DeclareWarning.java"> + <message kind="warning" line="3" text="staticinitialization(DeclareWarning)"/> + <message kind="warning" line="12" text="call(DeclareWarning.new())"/> + <message kind="warning" line="13" text="get staticInt"/> + <message kind="warning" line="14" text="get instanceInt"/> + <message kind="warning" line="15" text="set staticInt"/> + <message kind="warning" line="16" text="set instanceInt"/> + <message kind="warning" line="17" text="call(void run())"/> + <message kind="warning" line="18" text="call(void irun())"/> + <message kind="warning" line="21" text="execution(void run())"/> + <message kind="warning" line="22" text="execution(void irun())"/> + <message kind="warning" line="23" text="execution(DeclareWarning.new())"/> + <message kind="warning" line="23" text="initialization(DeclareWarning)"/> + <message kind="warning" line="33" text="handler(OutOfMemoryError) && within(DeclareWarning)"/> + <message kind="warning" line="36" text="handler(Error)"/> + <message kind="warning" line="39" text="handler(RuntimeException) && withincode(DeclareWarning.new())"/> + <message kind="warning" line="72" text="adviceExecution() && within(A)"/> + </compile> + </ajc-test> + + + <ajc-test dir="bugs" pr="34858" + title="cflow binding issues with ignoring state"> + <compile files="CflowBinding.java"/> + <run class="CflowBinding"/> + </ajc-test> + + <ajc-test dir="bugs" pr="34858" + title="cflow binding -- original weaver crash"> + <compile files="CflowBindingOrig.java"/> + <run class="CflowBindingOrig"/> + </ajc-test> + + <ajc-test dir="errors" + title="type not imported in around advice"> + <compile files="TypeNotImportedInAroundCE.java"> + <message kind="error" line="10"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="type not imported in aspect"> + <compile files="TypeInAspectNotImportedCE.java"> + <message kind="error" line="6"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" keywords="error" + title="class extending abstract aspect"> + <compile files="ClassExtendingAbstractAspectCE.java"> + <message kind="error" line="20"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="34925" + title="declare soft and throw statements"> + <compile files="ConvertToUnchecked.java" options="-Xlint:ignore"/> + <run class="ConvertToUnchecked"/> + </ajc-test> + + <ajc-test dir="bugs/interAbstract" + title="inter-type declaration bug with abstract classes" + pr="36046"> + <compile files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="bugs/interInherit" pr="35725" + title="Inter type declaration to base class not seen by derived class"> + <compile files="a_impl/AImpl.java,a_impl/Af.java,a_intf/A.java,b_impl/BImpl.java,b_intf/B.java"/> + <run class="b_impl.BImpl"/> + </ajc-test> + + <ajc-test dir="new/declareParents" + title="Declare parents with intermediate ancestor" + keywords="from-new"> + <compile files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="new/declareParents" + title="Declare parents removing ancestor" + keywords="from-new"> + <compile files="IllegalAdoption.java"> + <message kind="error" line="13"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/interSpecials" title="IllegalAccessError while accessing introduced variable / 1.1rc1" + pr="36110"> + <compile files="p1/C.java,p2/A1.java"/> + <run class="p2.A1"/> + </ajc-test> + + <ajc-test dir="new" pr="36736" + title="implemented abstract pointcut"> + <compile files="AbstractImplementedPointcut.java"> + <message kind="error" line="14"/> + </compile> + </ajc-test> + + <ajc-test dir="new/verifyError" pr="36673" + title="privileged aspect main verify error"> + <compile files="Privilege.java"/> + <run class="Privilege"/> + </ajc-test> + + <ajc-test dir="bugs" pr="36564" + title="Internal compiler error with thisJoinPoint.getStaticPart()"> + <compile files="tjpStaticPart/Test.java,tjpStaticPart/Exceptions.java" options="-Xlint:ignore"/> + <run class="tjpStaticPart.Test"/> + </ajc-test> + + <ajc-test dir="bugs" pr="29665" + title="Inconsistant stack height with around"> + <compile files="StackError.java" options="-Xlint:ignore"/> + <run class="StackError"/> + </ajc-test> + + + <ajc-test dir="bugs/messyAround" pr="36056" + title="Ajc 1.1 rc1 java.lang.VerifyError with messy arounds"> + <compile files="aspects/Trace.aj,cap/OptionList.java,DebugTrace.aj"> + <message kind="warning" line="102"/> + <message kind="warning" line="124"/> + <message kind="warning" line="138"/> + </compile> + <run class="cap.OptionList"/> + </ajc-test> + + <ajc-test dir="new" + title="try/finally in around advice (same as ...messy arounds?)"> + <compile files="TryFinallyInAround.java"/> + <run class="TryFinallyInAround"/> + </ajc-test> + + <ajc-test dir="new" pr="36778" + title="advise join points in subclass of empty interface"> + <compile files="EmptyInterface.java"/> + <run class="EmptyInterface"/> + </ajc-test> + + <ajc-test dir="new" pr="36778" + title="can't put around advice on interface static initializer" + comment="this tests for a nice message given a compiler limitation"> + <compile files="EmptyInterfaceCE.java" options="-1.4"> + <message kind="error" line="20"/> + <message kind="error" line="23"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="36803" + title="cflow concretization causing assertion failure"> + <compile files="CflowConcrete.java" options="-1.4"/> + <run class="CflowConcrete"/> + </ajc-test> + + <ajc-test dir="bugs" title="lame error message: negation doesn't allow binding" + pr="30663"> + <compile files="BadBindingError.java"> + <message kind="error" line="7"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/interSpecials" pr="36936" + title="Error when introducing members of type Class"> + <compile files="Trg.java,Asp.java"/> + <run class="Trg"/> + </ajc-test> + + <ajc-test dir="new" + comment="this is a pureJava test, but we always want to run it" + title="arrays via Class.forName()"> + <compile files="ClassForName.java"/> + <run class="ClassForName"/> + </ajc-test> + + <ajc-test dir="bugs/inlineAround" pr="37152" + title="perthis and inline arounds"> + <compile files="aspect1/Base.java,aspect2/Concrete.java,p1/Main.java"> + </compile> + <run class="p1.Main"/> + </ajc-test> + + <ajc-test dir="bugs" pr="37325" + title="Weaver fails with NPE for very large source files "> + <compile files="LongFile.java"/> + <run class="LongFile"/> + </ajc-test> + + <ajc-test dir="harness" keywords="command-line-error" + title="CLE: no sources"> + <compile badInput="true"> + <message kind="error" text="no sources"/> + <message kind="abort" text="Usage"/> + </compile> + </ajc-test> + + <ajc-test dir="harness" + keywords="command-line-error,knownLimitation-ajctaskCompiler,knownLimitation-ajdeCompiler" + comment="ajde omits usage" + title="CLE: bad filename"> + <compile badInput="true" files="NoSuchFile.java"> + <message kind="error" text="NoSuchFile.java"/> + <message kind="abort" text="Usage"/> + </compile> + </ajc-test> + + <ajc-test dir="harness" keywords="command-line-error" + comment="XXX test skipped - harness ignores -sourceroot option" + title="CLE: no dir specified for sourceroots"> + <compile badInput="true" files="ErrorTest.java" + options="-sourceroots"> + <message kind="error" text="no sources specified"/> + <message kind="error" text="bad sourceroot"/> + <message kind="abort" text="Usage"/> + </compile> + </ajc-test> + + <ajc-test dir="harness" keywords="command-line-error,knownLimitation-ajdeCompiler" + comment="ajde has same errors, different wording" + title="CLE: no sourceroot specified for incremental"> + <compile badInput="true" options="-incremental"> + <message kind="error" text="no sources specified"/> + <message kind="error" text="specify a source root"/> + <message kind="abort" text="Usage"/> + </compile> + </ajc-test> + + <ajc-test dir="harness" keywords="command-line-error,knownLimitation-ajdeCompiler" + comment="ajde has same errors, different wording" + title="CLE: file specified with incremental"> + <compile badInput="true" files="ErrorTest.java" + options="-incremental"> + <message kind="error" text="incremental mode only handles source files using -sourceroots"/> + <message kind="error" text="no sources specified"/> + <message kind="error" text="specify a source root"/> + <message kind="abort" text="Usage"/> + </compile> + </ajc-test> + + + <ajc-test dir="bugs" pr="37304" + title="public static fields being ignored"> + <compile files="FinalFields.java"/> + <run class="FinalFields"/> + </ajc-test> + + + <!-- This doesn't actually reproduce the bug, but no test case has been submitted + that does so this is here as a place-holder and to verify that we're mostly + working. + --> + <ajc-test dir="bugs/accessMethods" pr="38212" + title="can not resolve this member warning"> + <compile files="p1/Base.java,p2/Derived.java"/> + <run class="p2.Derived"/> + </ajc-test> + + <ajc-test dir="bugs" pr="38345" + title="try switch VerifyError, InconsistentStackHeight"> + <compile files="TrySwitch.java"/> + <run class="TrySwitch"/> + </ajc-test> + + <ajc-test dir="bugs" pr="39458" + title="Compiler crash in ajc 1.1 - terrible error for inaccessible constructor"> + <compile files="NewVoid.java"> + <message kind="error" line="17"/> + <message kind="error" line="20"/> + <message kind="error" line="21"/> + + <message kind="error" line="28"/> + <message kind="warning" line="29"/> + <message kind="warning" line="30"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="39458" + title="Compiler crash in ajc 1.1 - terrible error for inaccessible constructor - 1.7"> + <compile files="NewVoid.java"> + <message kind="error" line="17"/> + <message kind="error" line="20"/> + <message kind="error" line="21"/> + + <message kind="error" line="28"/> + <message kind="warning" line="29"/> + <message kind="error" line="30"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="39460" + title="Missing import crashes compiler"> + <compile files="MissingImport.java"> + <message kind="error" line="13" text="InvocationTargetException cannot be resolved to a type"/> +<!-- this error has 'gone' in e37 upgrade <message kind="error" line="14" text="e cannot be resolved"/> --> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="39479" + title="NPE in bcel.LazyMethodGen when delegating from one ctor to a second that includes a switch"> + <compile files="NewSwitch.java"/> + <run class="NewSwitch"/> + </ajc-test> + + <ajc-test dir="bugs" pr="40109" + title="switch statement in aspects crashes weaving"> + <compile files="SwitchInAround.java"/> + <run class="SwitchInAround"/> + </ajc-test> + + <ajc-test dir="bugs" pr="39993" + title="ajc stack trace on declaring hashcode() method in aspect"> + <compile files="OverridingInterfaceObjectMethod.java"/> + <run class="OverridingInterfaceObjectMethod"/> + </ajc-test> + + <ajc-test dir="bugs" + title="using super in method introduced on interface with multiple supertypes"> + <compile files="MultipleSuperCf.java"> + <message kind="error" line="14"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/cflowAndJar" pr="39462" + title="Compiler crashes in jar and cflow (with no .jar)"> + <compile files="TestAspect.aj,Test.java,AbstractAspect.aj"> + <message kind="warning" line="16"/> + </compile> + <run class="Test"/> + </ajc-test> + + <ajc-test dir="bugs/cflowAndJar" pr="39462" + title="Compiler crashes in jar and cflow (with .jar)" + comment="make lib.jar with ajc -outjar lib.jar AbstractAspect.aj"> + <compile files="TestAspect.aj,Test.java" aspectpath="lib.jar"> + <message kind="warning" line="16"/> + </compile> + <run class="Test"/> + </ajc-test> + + <ajc-test dir="bugs" pr="40589" + title="Default method impl for interface causes internal exception."> + <compile files="CloneMethod.java"/> + <run class="CloneMethod"/> + </ajc-test> + + <ajc-test dir="errors" + title="compile error expected for abstract pointcut outside abstract aspect"> + <compile files="AbstractPointcutCE.java"> + <message kind="error" line="4" text="The type C must be an abstract class to define abstract methods"/> + <message kind="error" line="5"/> + <message kind="error" line="10"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" + pr="40876" + title="subtype-qualified pointcut reference"> + <compile files="PointcutLibraryTest.java"/> + <run class="PointcutLibraryTest"/> + </ajc-test> + + <ajc-test dir="bugs" + pr="40858" + comment="super is not permitted in pointcuts in 1.1" + title="weaver trace on mis-qualified pointcut reference"> + <compile files="SuperPointcutCE.java"> + <message kind="error" line="23"/> + <message kind="error" line="26"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" + pr="40814" + title="compile error expected for interface pointcuts"> + <compile files="AbstractPointcutCE.java"> + <message kind="error" line="14" text="The type Concrete must be an abstract class to define abstract methods"/> + <message kind="error" line="7"/> + <message kind="error" line="11"/> + <message kind="error" line="15"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" + pr="40805" + title="interface call signatures when declaring method in aspect"> + <compile files="DeclareWarningAndInterfaceMethodCW.java"> + <message kind="warning" line="27" text="call getSomething"/> + <message kind="warning" line="27" text="call ICanGetSomething.getSomething"/> + <message kind="warning" line="31" text="call getSomething"/> + <message kind="warning" line="31" text="call ICanGetSomething.getSomething"/> + <message kind="warning" line="33" text="call getSomething"/> + <message kind="warning" line="33" text="call ICanGetSomething.getSomething"/> + <message kind="warning" line="35" text="call getSomething"/> + <message kind="warning" line="35" text="call ICanGetSomething.getSomething"/> + <message kind="warning" line="38" text="call getSomething"/> + <message kind="warning" line="38" text="call ICanGetSomething.getSomething"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" + pr="41175" + title="reflective check of declared exceptions from aspect-declared methods"> + <compile files="DeclaredExceptions.java"/> + <run class="DeclaredExceptions"/> + </ajc-test> + + <ajc-test dir="bugs/throwsSignature" + pr="42539" + title="throw derivative pointcuts not advised"> + <compile files="ExceptionBugTest.java,ExceptionAspect.java"> + <message line="5" kind="warning" text="throws both"/> + <message line="5" kind="error" text="throws Exception"/> + <message line="7" kind="warning" text="throws both"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="42652" + title="perthis and signature bad interaction"> + <compile files="InterPerCall.java" options="-1.4"/> + <run class="InterPerCall"/> + </ajc-test> + + <ajc-test dir="bugs/declareBinding" + pr="42740" + title="declare error fails on pointcuts composed from multiple classes"> + <compile files="SampleExceptionHandling1.java"> + <message line="2" kind="error" text="no checked exceptions"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/declareSoftWithin" + pr="42740" + title="declare error fails on pointcuts composed from multiple classes"> + <compile files="aspects/Softener.aj,test/NoSoftener.java"/> + <run class="test.NoSoftener"/> + </ajc-test> + + <ajc-test dir="bugs" pr="42993" + title="Interaction between pointcut binding and declare parents"> + <compile files="ParentsAndPointcuts.java"/> + <run class="ParentsAndPointcuts"/> + </ajc-test> + + <ajc-test dir="bugs" pr="43194" + title="Non-functional concretezation of ReferencePointcut"> + <compile files="AdviceInteraction.java"/> + <run class="AdviceInteraction"/> + </ajc-test> + + <ajc-test dir="bugs/extdirs" + pr="42574" + title="zip and jar suffixes for extdirs entries"> + <compile files="extdirs-src/main/Main.java" + extdirs="lib/lowercase"/> + </ajc-test> +
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc11/ajc11.xml b/tests/src/test/java/org/aspectj/systemtest/ajc11/ajc11.xml new file mode 100644 index 000000000..899dfe725 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc11/ajc11.xml @@ -0,0 +1,10 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[ +<!ENTITY tests SYSTEM "../tests/src/org/aspectj/systemtest/ajc11/ajc11-tests.xml"> +]> +<!-- AspectJ v1.1.x Tests --> + +<suite> + +&tests; + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc120/Ajc120Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc120/Ajc120Tests.java new file mode 100644 index 000000000..8e1ef8789 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc120/Ajc120Tests.java @@ -0,0 +1,252 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM Corporation + * 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 + * + * ******************************************************************/ +package org.aspectj.systemtest.ajc120; + +import java.io.File; +import junit.framework.Test; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class Ajc120Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc120Tests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc120.xml"); + } + + + public void test001(){ + runTest("NPE in concretization error path"); + } + + public void test002(){ + runTest("priviledged aspects calling methods from advice"); + } + + public void test003(){ + runTest("No error on overloaded pointcuts in class"); + } + + public void test004(){ + runTest("No error on overloaded pointcuts unless binding variables"); + } + + public void test005(){ + runTest("Declare soft softening other exception types"); + } + + public void test006(){ + runTest("static method introduction on interfaces, should not be allowed"); + } + + public void test007(){ + runTest("External pointcut refs not resolved if named pointcut used by declare"); + } + + public void test008(){ + runTest("Appropriate message for 'after() thowing(Throwable th)' syntax error"); + } + + public void test009(){ + runTest("Ensure we don't look for source on the classpath when binary not found"); + } + + public void test010(){ + runTest("inner aspect containing declare soft"); + } + + public void test011(){ + runTest("Bad parser error recovery in advice"); + } + + public void test012(){ + runTest("Bad parser error recovery in java source"); + } + + public void test013(){ + runTest("compiler issues error on inner aspects when privilieged"); + } + + public void test014(){ + runTest("After throwing advice on ctors doesn't execute for inter-type decl field inits"); + } + + public void test015(){ + runTest("Introduced abstract method on abstract class not implemented by subtype (single source file)"); + } + + public void test016(){ + runTest("Introduced abstract method on abstract class with introduced concrete method (single source file)"); + } + + public void test017(){ + runTest("Introduced abstract method on abstract class with existing concrete method (single source file)"); + } + + public void test018(){ + runTest("aspect declares interface method (no modifiers)"); + } + + public void test019(){ + runTest("aspect declares interface method (abstract)"); + } + + public void test020(){ + runTest("aspect declares interface method (public abstract)"); + } + + public void test021(){ + runTest("Use class implementing interface via aspect (not woven together)"); + } + + public void test022(){ + runTest("Use class implementing interface via aspect (weave all together)"); + } + + public void test023(){ + runTest("Use class implementing interface via aspect (only one implementer)"); + } + + public void test024(){ + runTest("Erroneous exception conversion"); + } + + public void test025(){ + runTest("before():execution(new(..)) does not throw NoAspectBoundException"); + } + + public void test026(){ + runTest("Anomalous handling of inter-type declarations to abstract base classes in aspectj 1.1"); + } + + public void test027(){ + runTest("NPE When compiling intertype declaration"); + } + + public void test028(){ + runTest("declare warning on subtype constructor"); + } + + public void test029(){ + runTest("CatchClauseSignature has broken operation"); + } + + public void test030(){ + runTest("after returning with parameter: matching rules"); + } + + public void test031(){ + runTest("binary compatibility of advice method names - expect no error"); + } + + public void test032(){ + runTest("binary compatibility of advice method names - expect error"); + } + + public void test033(){ + runTest("binary compatibility of advice method names - expect no error"); + } + + public void test034(){ + runTest("mail list VerifyError with protected access"); + } + + public void test035(){ + runTest("Polymorphic ITD fails in CVS HEAD (From ajdt 1.1.6)"); + } + + public void test036(){ + runTest("ClasscastException on concretization of if(false)"); + } + + public void test037(){ + runTest("ClasscastException on concretization of if(false)"); + } + + public void test038(){ + runTest("Introduced abstract method on interface not implemented by subtype (weave altogether)"); + } + + public void test039(){ + runTest("declare String field on interface"); + } + + public void test040(){ + runTest("declare int field on interface"); + } + + public void test041(){ + runTest("declare Object field on interface"); + } + + public void test042(){ + runTest("fail in compiling aspect with overriding method introduction with different throws clause "); + } + + public void test043(){ + runTest("super call in anonymous class created in around advice"); + } + + public void test044(){ + runTest("retitle warning to circular {advice} dependency at ..."); + } + + public void test045(){ + runTest("Introduce Unknown Type to class causes Null pointer exception"); + } + + public void test046(){ + runTest("Private members introduced via an interface are visible to the class"); + } + + public void test047(){ + runTest("declare precedence on a class should be a compile-time error"); + } + + public void test048(){ + runTest("declare precedence on a class should be a compile-time error"); + } + + public void test049(){ + runTest("NPE when binary weaving a ctor ITD"); + } + + public void test050(){ + runTest("NPE in compiler when using (an unusual) declare warning against a ctor ITD"); + } + + public void test051(){ + runTest("InterTypeMethodDeclaration.java:104"); + } + + public void test052(){ + runTest("nested uses of this() inside constructors not handled properly for initialization and preinitialization pointcuts"); + } + + public void test053(){ + runTest("wrong variable binding in || pointcuts"); + } + + public void test054(){ + runTest("error message for constructor-execution pcd"); + } + + public void test055(){ + runTest("weaving using an empty jar in -injars"); + } + + public void test056(){ + runTest("weaving using an empty jar in -aspectpath"); + } + +} + diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc120/ajc120-tests.xml b/tests/src/test/java/org/aspectj/systemtest/ajc120/ajc120-tests.xml new file mode 100644 index 000000000..4b51a98dd --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc120/ajc120-tests.xml @@ -0,0 +1,482 @@ +<!-- AspectJ v1.2.0 Tests --> + + <ajc-test dir="bugs/concretizeNpe" pr="43033" + title="NPE in concretization error path" + keywords="poorErrorMessages"> + <compile files="base/ExceptionHandling.java,model/ModelExceptionHandling.java"> + <!-- + <message line="5" kind="error" text="pointcut base.ExceptionHandling.scope() is abstract"/> + <message line="4" kind="error" text="inherited abstract pointcut base.ExceptionHandling.scope() is not made concrete"/> + <message line="8" kind="error" text="inherited abstract pointcut base.ExceptionHandling.scope() is not made concrete"/> + <message line="12" kind="error" /> + <message line="13" kind="error" /> + --> + <message line="12" kind="error" /> + <message line="13" kind="error" /> + </compile> + </ajc-test> + + <ajc-test dir="bugs/privilege/packageProtected" pr="42711" + title="priviledged aspects calling methods from advice"> + <compile files="concern/ContextUser.java,concern/BaseTarget.java,core/Base.java" /> + </ajc-test> + + <ajc-test dir="bugs" pr="49457" + title="No error on overloaded pointcuts in class"> + <compile files="OverloadedPointcutsInClass.java"> + <message kind="error" line="3" text="duplicate pointcut name: pc1"/> + <message kind="error" line="4" text="duplicate pointcut name: pc1"/> + <message kind="error" line="6" text="duplicate pointcut name: pc2"/> + <message kind="error" line="7" text="duplicate pointcut name: pc2"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="49457" + title="No error on overloaded pointcuts unless binding variables"> + <compile files="OverloadedPointcutsInAspect.java"> + <message kind="error" line="15" text="duplicate pointcut name: pc"/> + <message kind="error" line="16" text="duplicate pointcut name: pc"/> + <message kind="error" line="18" text="incompatible type"/> + <message kind="error" line="20" text="incompatible type"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="48522" + title="Declare soft softening other exception types"> + <compile files="SofteningTooMuch.java"> + <message kind="error" line="6" text="Unhandled exception"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="47754" + title="static method introduction on interfaces, should not be allowed"> + <compile files="StaticInterfaceMethods.java"> + <message kind="error" line="7" text="methods in interfaces cannot be declared static"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="45184" + title="External pointcut refs not resolved if named pointcut used by declare"> + <compile files="DeclareErrorNamedPointcutCE.java"> + <message kind="error" line="10" text="ref"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" + title="Appropriate message for 'after() thowing(Throwable th)' syntax error" + pr="49638" + > + <compile + files="AfterThrowingAdviceSyntaxError.java" > + <message kind="error" line="21" /> + <message kind="error" line="23" /> + </compile> + </ajc-test> + + <ajc-test dir="bugs/faultingInSource" pr="46671" + title="Ensure we don't look for source on the classpath when binary not found"> + <compile files="SimpleTracing.java" classpath="." options="-verbose -1.4"> + <message kind="warning" line="4" text="no match for this type name: SampleClass"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="46750" title="inner aspect containing declare soft"> + <compile files="TestSoftening.java"> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="45663" + title="Bad parser error recovery in advice"> + <compile files="ParserRecoveryTest.java"> + <message kind="error" line="7"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="45663" + title="Bad parser error recovery in java source"> + <compile files="ParserRecoveryTestPureJava.java"> + <message kind="error" line="6"/> + <message kind="error" line="8"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" + pr="46280" + title="compiler issues error on inner aspects when privilieged"> + <compile files="PrivilegedParsing.java"/> + <run class="PrivilegedParsing"/> + </ajc-test> + + <ajc-test dir="bugs" pr="44586" + title="After throwing advice on ctors doesn't execute for inter-type decl field inits"> + <compile files="AfterThrowingCtor.java" options="-Xlint:ignore"> + </compile> + <run class="AfterThrowingCtor"/> + </ajc-test> + + <ajc-test dir="bugs/abstractMethods" pr="49784" + title="Introduced abstract method on abstract class not implemented by subtype (single source file)"> + <compile files="singlesource/C.java"> + <message kind="error" line="9"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/abstractMethods" pr="49784" + title="Introduced abstract method on abstract class with introduced concrete method (single source file)"> + <compile files="singlesource/C1.java"/> + <run class="C1"/> + </ajc-test> + + <ajc-test dir="bugs/abstractMethods" pr="49784" + title="Introduced abstract method on abstract class with existing concrete method (single source file)"> + <compile files="singlesource/C2.java"/> + <run class="C2"/> + </ajc-test> + + <ajc-test dir="bugs/interAbstract" + pr="49784" + title="aspect declares interface method (no modifiers)"> + <compile files="InterfaceMethodDeclarationNone.java" > + <message kind="error" line="32" text="requires a body" /> + </compile> + </ajc-test> + + <ajc-test dir="bugs/interAbstract" + pr="49784" + title="aspect declares interface method (abstract)"> + <compile files="InterfaceMethodDeclarationAbstract.java"> + <message kind="error" line="40" text="abstract intertype method declaration 'int I.getInt()' on interface I must be declared public (compiler limitation)" /> + </compile> + </ajc-test> + + <ajc-test dir="bugs/interAbstract" + pr="49784" + comment="working in 1.1.1 - keep with others?" + title="aspect declares interface method (public abstract)"> + <compile files="InterfaceMethodDeclarationFull.java" /> + <run class="InterfaceMethodDeclarationFull"/> + </ajc-test> + + <ajc-test dir="bugs/interfaceDefinition" + pr="43972" + title="Use class implementing interface via aspect (not woven together)"> + <compile + files="pack/DefineInterface.java, + pack/InterfaceDefinition.java, + pack/MyInterface.java" options="-XnotReweavable"/> + <run class="pack.InterfaceDefinition"/> + <compile + includeClassesDir="true" + files="Main.java"> + <message kind="error" line="3"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/interfaceDefinition" + pr="43972" + title="Use class implementing interface via aspect (weave all together)"> + <compile + files="pack/DefineInterface.java, + pack/InterfaceDefinition.java, + pack/MyInterface.java, + Main.java"/> + <run class="pack.InterfaceDefinition"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="bugs/interfaceDefinition" + pr="43972" + title="Use class implementing interface via aspect (only one implementer)"> + <compile + files="pack/DefineInterface.java, + pack/InterfaceDefinition.java, + pack/MyInterface.java"/> + <run class="pack.InterfaceDefinition"/> + <compile + includeClassesDir="true" + files="Main1.java"/> + <run class="Main1"/> + </ajc-test> + + <ajc-test dir="bugs" pr="44587" + title="Erroneous exception conversion"> + <compile files="ErroneousExceptionConversion.java"> + </compile> + <run class="ErroneousExceptionConversion"/> + </ajc-test> + + <ajc-test dir="bugs" pr="34206" + title="before():execution(new(..)) does not throw NoAspectBoundException"> + <compile files="ErroneousExceptionConversion1.java" options="-Xlint:ignore"> + </compile> + <run class="ErroneousExceptionConversion1"/> + </ajc-test> + + <ajc-test dir="bugs" pr="38824" + title="Anomalous handling of inter-type declarations to abstract base classes in aspectj 1.1"> + <compile files="AbstractBaseAndInterTypeInterface.java"> + </compile> + </ajc-test> + + <ajc-test dir="bugs/caseSensitivity" pr="42515" + title="NPE When compiling intertype declaration"> + <compile files="uniqueId/Numbered.java,uniqueId/Bug.aj"> + <message kind="error" line="4"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" + pr="49295" + title="declare warning on subtype constructor"> + <compile files="SubtypeConstructorCW.java" > + <message kind="warning" line="5" text="String as first"/> + <message kind="warning" line="10" text="String as first"/> + </compile> + <run class="SubtypeConstructorCW"/> + </ajc-test> + + <ajc-test dir="bugs" pr="50570" + title="CatchClauseSignature has broken operation"> + <compile files="HandlerSig.java"/> + <run class="HandlerSig"/> + </ajc-test> + + + <ajc-test dir="new" pr="42668" + title="after returning with parameter: matching rules"> + <compile files="AfterReturningParamMatching.java" options="-1.4"/> + <run class="AfterReturningParamMatching"/> + </ajc-test> + + <ajc-test dir="bugs/binaryCompat" pr="50641" + title="binary compatibility of advice method names - expect no error"> + <compile files="Main.java,TraceV1.aj" options="-1.4"/> + <run class="Main"/> + <compile files="TraceV2.aj" options="-1.4"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="bugs/binaryCompat" pr="50641" + title="binary compatibility of advice method names - expect error"> + <compile files="Main.java,TraceV1.aj" options="-1.4"/> + <run class="Main"/> + <compile files="TraceRE.aj" options="-1.4"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="bugs/binaryCompat" pr="50641" + title="binary compatibility of advice method names - expect no error"> + <compile files="Main.java,TraceWithInnerV1.aj" options="-1.4"/> + <run class="Main"/> + <compile files="TraceWithInnerV2.aj" options="-1.4"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="bugs/protectedvf" + title="mail list VerifyError with protected access"> + <compile files="main/Driver.java,main/p2/AbstractTest.aj,main/p1/ConcreteTest.aj"/> + <run class="main.Driver"/> + </ajc-test> + + <ajc-test dir="bugs" pr="51919" + title="Polymorphic ITD fails in CVS HEAD (From ajdt 1.1.6)"> + <compile files="OverloadedITDNPE.java" /> + </ajc-test> + + <ajc-test dir="bugs" pr="51320" + title="ClasscastException on concretization of if(false)"> + <compile files="DecwClassCastException.java"> + + <!-- These are the illegal PCDs against a deow --> + <message kind="error" line="27" text="if() pointcut designator cannot be used"/> + <message kind="error" line="29" text="if() pointcut designator cannot be used"/> + + <message kind="error" line="31" text="cflow() pointcut designator cannot be used"/> + <message kind="error" line="33" text="cflow() pointcut designator cannot be used"/> + + <message kind="error" line="35" text="cflowbelow() pointcut designator cannot be used"/> + <message kind="error" line="37" text="cflowbelow() pointcut designator cannot be used"/> + + <message kind="error" line="39" text="this() pointcut designator cannot be used"/> + <message kind="error" line="41" text="this() pointcut designator cannot be used"/> + + <message kind="error" line="43" text="target() pointcut designator cannot be used"/> + <message kind="error" line="45" text="target() pointcut designator cannot be used"/> + + <message kind="error" line="47" text="args() pointcut designator cannot be used"/> + <message kind="error" line="49" text="args() pointcut designator cannot be used"/> + + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="51320" + title="ClasscastException on concretization of if(false)"> + <compile files="DeclareSoftDynamicPCDs.java"> + + <!-- These are the illegal PCDs against a deow --> + <message kind="error" line="27" text="if() pointcut designator cannot be used"/> + <message kind="error" line="29" text="if() pointcut designator cannot be used"/> + + <message kind="error" line="31" text="cflow() pointcut designator cannot be used"/> + <message kind="error" line="33" text="cflow() pointcut designator cannot be used"/> + + <message kind="error" line="35" text="cflowbelow() pointcut designator cannot be used"/> + <message kind="error" line="37" text="cflowbelow() pointcut designator cannot be used"/> + + <message kind="error" line="39" text="this() pointcut designator cannot be used"/> + <message kind="error" line="41" text="this() pointcut designator cannot be used"/> + + <message kind="error" line="43" text="target() pointcut designator cannot be used"/> + <message kind="error" line="45" text="target() pointcut designator cannot be used"/> + + <message kind="error" line="47" text="args() pointcut designator cannot be used"/> + <message kind="error" line="49" text="args() pointcut designator cannot be used"/> + + </compile> + </ajc-test> + + <ajc-test dir="bugs/abstractMethods" pr="49784" + title="Introduced abstract method on interface not implemented by subtype (weave altogether)"> + <compile files="interface/C.java,interface/A.java,interface/B.java" /> + <run class="C"/> + </ajc-test> + + + <ajc-test dir="bugs/fieldsOnInterfaces" + pr="52107" + title="declare String field on interface"> + <compile files="StringFieldOnInterface.java"> + <message kind="warning" line="16" text="this affected type is not exposed"/> + <message kind="warning" line="17" text="this affected type is not exposed"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/fieldsOnInterfaces" + pr="52107" + title="declare int field on interface"> + <compile files="IntFieldOnInterface.java"> + <message kind="warning" line="27" text="this affected type is not exposed"/> + <message kind="warning" line="28" text="this affected type is not exposed"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/fieldsOnInterfaces" + pr="52107" + title="declare Object field on interface"> + <compile files="ObjectFieldOnInterface.java"> + <message kind="warning" line="20" text="this affected type is not exposed"/> + <message kind="warning" line="21" text="this affected type is not exposed"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="50776" + title="fail in compiling aspect with overriding method introduction with different throws clause "> + <compile files="IntertypeDifferentThrows.java" /> + </ajc-test> + + <ajc-test dir="new" + comment="in ajc 1.1.1, VerifyError Illegal use of nonvirtual function call" + title="super call in anonymous class created in around advice"> + <compile files="SuperClosure.java" /> + <run class="SuperClosure" /> + </ajc-test> + + <ajc-test dir="bugs" pr="44272" + title="retitle warning to circular {advice} dependency at ..."> + <compile files="CircularAdvicePrecedence.java" options="-1.4"> + <message kind="error" line="4"/> + <message kind="error" line="5"/> + <message kind="error" line="6"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="51322" + title="Introduce Unknown Type to class causes Null pointer exception" > + <compile files="Pr51322.java"> + <message kind="error" line="5"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" + title="Private members introduced via an interface are visible to the class" + pr="52928"> + <compile + files="VisiblePrivateInterfaceITDs.java" > + <message kind="error" line="13"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/declarePrecedenceWithClasses" pr="53012" + title="declare precedence on a class should be a compile-time error"> + <compile files="DeclarePrecedenceTestClass.java" > + <message kind="error" line="10" text="Non-aspect types can only be specified"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/declarePrecedenceWithClasses" pr="53012" + title="declare precedence on a class should be a compile-time error"> + <compile files="Priority.aj" /> + </ajc-test> + + <ajc-test dir="bugs" + pr="59440" + title="NPE when binary weaving a ctor ITD"> + <compile files="CtorITD.aj"> + <message kind="error" line="2"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" + pr="59397" + title="NPE in compiler when using (an unusual) declare warning against a ctor ITD"> + <compile files="DecwInitializationITD.java"> + </compile> + </ajc-test> + + <ajc-test dir="bugs/compileOrdering" + pr="59778" + title="InterTypeMethodDeclaration.java:104"> + <compile files="B.java,D.java" > + <message kind="error" line="2" file="B.java"/> + </compile> + <compile files="D.java,B.java"> + <message kind="error" line="2" file="B.java"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" + pr="61538" title="nested uses of this() inside constructors not handled properly for initialization and preinitialization pointcuts"> + <compile files="ConstructorMain.java"/> + <run class="ConstructorMain"/> + </ajc-test> + + <ajc-test dir="bugs" + pr="61568" title="wrong variable binding in || pointcuts"> + <compile files="DisjunctVarBinding.java"> + <message kind="error" line="17" text="ambiguous binding of parameter(s) a, b across '||' in pointcut"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" + pr="60936" title="error message for constructor-execution pcd"> + <compile files="InterfaceConstructor.java" options="-1.4"> + <message kind="warning" line="10" text="no interface constructor-execution join point"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="43714" + title="weaving using an empty jar in -injars" > + <compile files="notAJar.jar" outjar="outJar.jar"> + <message kind="warning" text="build config error: skipping missing, empty or corrupt inpath entry"/> + <message kind="error" text="no sources specified"/> + <message kind="fail"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="43714" + title="weaving using an empty jar in -aspectpath" > + <compile files="WeaveLocal.java" aspectpath="notAJar.jar" outjar="outJar.jar" > + <message kind="warning" text="build config error: skipping missing, empty or corrupt aspectpath entry"/> + </compile> + </ajc-test> +
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc120/ajc120.xml b/tests/src/test/java/org/aspectj/systemtest/ajc120/ajc120.xml new file mode 100644 index 000000000..dade07154 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc120/ajc120.xml @@ -0,0 +1,11 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[ +<!ENTITY tests SYSTEM "../tests/src/org/aspectj/systemtest/ajc120/ajc120-tests.xml"> +]> + +<!-- AspectJ v1.2.0 Tests --> + +<suite> + +&tests; + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc121/Ajc121Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc121/Ajc121Tests.java new file mode 100644 index 000000000..e1ae534bf --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc121/Ajc121Tests.java @@ -0,0 +1,345 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM Corporation + * 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 + * + * ******************************************************************/ +package org.aspectj.systemtest.ajc121; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class Ajc121Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + + + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc121Tests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc121.xml"); + } + + + public void test001(){ + runTest("false ambiguous binding error (introduced in 1.2rc2)"); + } + + public void test002(){ + runTest("An if() pointcut inside a perthis() clauses an ABORT - null pointer exception in ajc"); + } + + public void test003(){ + runTest("An if() pointcut inside a perthis() clauses an ABORT - null pointer exception in ajc"); + } + + public void test004(){ + runTest("An if() pointcut inside a perthis() clauses an ABORT - null pointer exception in ajc"); + } + + public void test005(){ + runTest("compiler aborts with 'conflicting dominates orders' with circular declare precedences"); + } + + public void test006(){ + runTest("'can't bind type' message has $ for . in type name for declare soft"); + } + + public void test007(){ + runTest("Hiding of Instance Methods by static methods"); + } + + public void test008(){ + runTest("if(false) optimisation"); + } + + public void test009(){ + runTest("if(true) optimisation"); + } + + public void test010(){ + runTest("java.lang.NullPointerException in WeaverMessageHandler class"); + } + + public void test011(){ + runTest("ClassCastException at BcelRenderer.java:169"); + } + + public void test012(){ + runTest("Front-end bug, shouldn't allow patterns of the form foo.., should be foo..*"); + } + + public void test013() { + runTest("Nullpointer-Exception when defining a withincode() pointcut"); + } + + public void test014() { + runTest("NPE, Incorrect XLint:unmatchedSuperTypeInCall warning"); + } + + public void test015_invalidXlint() { // keywords: "laurie hendren" + runTest("invalid warning indicating no match when a match really occurs"); + } + + public void test016_ByteConversionInstructions() { + runTest("RuntimeException thrown: Could not find instruction: org.apache.bcel.generic.B2I"); + String output = getLastRunResult().getStdErr(); + assertTrue("Expected to find [b2] in this output but didn't:"+output,output.indexOf("[b2]")!=-1); + assertTrue("Expected to find [b127] in this output but didn't:"+output,output.indexOf("[b127]")!=-1); + assertTrue("Expected to find [b0] in this output but didn't:"+output,output.indexOf("[b0]")!=-1); + + assertTrue("Expected to find [c65] in this output but didn't:"+output,output.indexOf("[c65]")!=-1); + assertTrue("Expected to find [c66] in this output but didn't:"+output,output.indexOf("[c66]")!=-1); + assertTrue("Expected to find [c67] in this output but didn't:"+output,output.indexOf("[c67]")!=-1); + + assertTrue("Expected to find [s1] in this output but didn't:"+output,output.indexOf("[s1]")!=-1); + assertTrue("Expected to find [s32767] in this output but didn't:"+output,output.indexOf("[s32767]")!=-1); + assertTrue("Expected to find [b0] in this output but didn't:"+output,output.indexOf("[b0]")!=-1); + } + + public void test017_PrivateMethodCallsInAroundAdvice() { + runTest("Cannot advise private method call in around advice"); + System.err.println(getLastRunResult().getStdErr()); + } + + public void test018_PrivateFieldSetsInAroundAdvice() { + runTest("Cannot advise private field sets in around advice"); + System.err.println(getLastRunResult().getStdErr()); + } + + public void test019_PrivateFieldGetsInAroundAdvice() { + runTest("Cannot advise private field gets in around advice"); + System.err.println(getLastRunResult().getStdErr()); + } + +// test takes over 5 minutes to run, so not included in normal suite run +// public void test020_branchTargetOffsetTooLargeForShort() { +// runTest("Branch target offset too large for short"); +// } + +// public void test021_BcelFailureWithVeryLargeClasses() { +// runTest("Weaver fails in BCEL for large classes"); +// } +// +// public void test022_BcelFailureWithVeryLargeClasses_Binary() { +// runTest("Weaver fails in BCEL for large classes (binary)"); +// } + + public void test023_proceedInAround1() { + runTest("proceed used as method name in around advice (1)"); + } + + public void test024_proceedInAround2() { + runTest("proceed used as method name in around advice (2)"); + } + + public void test025_proceedInAround3() { + runTest("proceed used as method name in around advice (3)"); + } + + public void test026_bindingThisAndTargetToTheSameFormal() { + runTest("ajc crashes when compiling the following program (binding this() and target())"); + } + + public void test027_itdsOnInnerClassesAsStatic() { + runTest("ITDs on inner classes should be static context"); + } + + public void test028_itdsAndInitializers() { + runTest("resolution of IT field inits"); + } + + public void test029_falseInvalidAbsoluteTypeName() { + runTest("Valid but inaccessible type names should not be flagged by XLint:invalidAbsoluteTypeName"); + } + + public void test030_privateITDinitialisersBeingMatched() { + runTest("intertype initialisers should match field set pointcuts"); + } + + public void test031_privateITDinitialisersBeingMatched_OxfordTest() { + runTest("intertype initialisers should match field set pointcuts (oxford testcase)"); + //System.err.println(">"+getLastRunResult().getStdErr()); + String exp = ":set field set(int C.n):set field set(int C.m):get field get(int C.n):set field set(int C.n)"; + assertTrue("Expected output '"+exp+"' but got "+getLastRunResult().getStdErr(), + getLastRunResult().getStdErr().equals(exp)); + } + + public void test032_stringConcatForDEOW() { + runTest("Compile time declarations (warning and error) do not accept string concatenation (with +)"); + } + + public void test033_stringConcatForDEOWErrorCase() { + runTest("Compile time declarations (warning and error) do not accept string concatenation (with +) (2)"); + } + + public void test034_scopeForITDS_pr61768() { + runTest("scope for inter-type methods"); + } + + public void test035_innerAspectCallsPrivateMethod_pr71372() { + runTest("NoSuchMethodError calling private method from around advice in inner aspect"); + String s = getLastRunResult().getStdErr(); + assertTrue("Expected ':before:around' but got "+s, + s.equals(":before:around")); + } + + public void test036_innerAspectCallsPrivateMethod_pr71372_2() { + runTest("NoSuchMethodError calling private method from around advice in inner aspect (2)"); + String s = getLastRunResult().getStdErr(); + assertTrue("Expected ':before:around' but got "+s, + s.equals(":before:around")); + } + + public void test037_innerAspectCallsPrivateMethod_pr71372_3() { + runTest("NoSuchMethodError calling private method from around advice in inner aspect (3)"); + String s = getLastRunResult().getStdErr(); + assertTrue("Expected ':before:around' but got "+s, + s.equals(":before:around")); + } + + public void test038_innerAspectCallsPrivateMethod_pr71372_4() { + runTest("NoSuchMethodError calling private method from around advice in inner aspect (4)"); + String s = getLastRunResult().getStdErr(); + assertTrue("Expected ':before:around' but got "+s, + s.equals(":before:around")); + } + + public void test039_privilegedAspectAccessingPrivateMethods_pr67579() { + runTest("NPE on privileged aspect error"); + } + + public void test040_privilegedAspectAccessingPrivateMethods_pr67579_2() { + runTest("NPE on privileged aspect error (2)"); + } + + public void test041_ITDaccessingPrivateMethod_pr67578() { + runTest("Privileged Aspect Access Problem Across Packages"); + } + + public void test042_ITDaccessingPrivateMethod_pr67578_2() { + runTest("Privileged Aspect Access Problem Across Packages (2)"); + } + + public void test043_pr62642_ExceptionInInitializerError() { + runTest("proper handling of ExceptionInIntializer inside clinit in presence of after throwing advice"); + String s = getLastRunResult().getStdErr(); + assertTrue("Output should contain java.lang.ExceptionInInitializerError but is '"+s+"'", + s.indexOf("java.lang.ExceptionInInitializerError")!=-1); + // No getCause on 1.3 JVMs +// assertTrue("Output should contain 'CAUSE=org.aspectj.lang.NoAspectBoundException' but is '"+s+"'", +// s.indexOf("CAUSE=org.aspectj.lang.NoAspectBoundException")!=-1); + } + + public void test044_ITDnameClashes() { + runTest("ITD name clashes with private members"); + } + + public void test045_ITDprotectedVisibility() { + runTest("Inconsistency in scoping of protected members in ITDs"); + } + + public void test045_wrongLineForExecutionJoinPoint() { + runTest("wrong line for method execution join point"); + } + + public void test046_interfaceITD_pr70794_1() { + runTest("The introduction on interface causes the interface implementation class error (1)"); + } + + public void test047_interfaceITD_pr70794_2() { + runTest("The introduction on interface causes the interface implementation class error (2)"); + } + + public void test048_interfaceITD_pr70794_3() { + runTest("The introduction on interface causes the interface implementation class error (3)"); + } + + public void test049_interfaceITD_pr70794_4() { + runTest("The introduction on interface causes the interface implementation class error (4)"); + } + + public void test050_typePatternMatchingWithArrays() { + runTest("declare warning warns at wrong points"); + } + + public void test052_bogusMessage1() { + runTest("Bogus error message: The abstract method ajc$pointcut$$tracingScope$a2 in type Tracing can only be defined by an abstract class (1)"); + } + + public void test053_bogusMessage2() { + runTest("Bogus error message: The abstract method ajc$pointcut$$tracingScope$a2 in type Tracing can only be defined by an abstract class (2)"); + } + + public void test054_cnfe() { + runTest("passing null to array arguments confuzes static join point signature. (1)"); + } + + public void test055_cnfe() { + runTest("passing null to array arguments confuzes static join point signature. (2)"); + } + + public void test056_arrayCloning() { + runTest("around advice throws java.lang.VerifyError at runtime"); + } + + public void test057_decSoftWithSuper() { + runTest("declare soft can cause programs with invalid exception behaviour to be generated"); + } + + public void test058_npeOnTJPerror() { + runTest("NPE on thisJoinPoint mistake"); + } + + public void test059_cflowOptimization_counters() { + runTest("Optimization of cflow - counters (1)"); + } + + public void test060_cflowOptimization_counters() { + runTest("Optimization of cflow - shared counters (2)"); + } + + public void test061_cflowOptimization_counters() { + runTest("Optimization of cflow - shared stacks (3)"); + } + + public void test062_cflowOptimization_counters() { + runTest("Optimization of cflow - counters (4)"); + } + + public void test063_cflowOptimization_countersWithAbstractPcuts() { + runTest("Optimization of cflow - counters with abstract pointcuts (5)"); + } + + public void test064() { + runTest("Anonymous classes unaware of introductions into abstract classes"); + } + + private int countLines(String s) { + int lines = 0; + int idx = 0; + while (s.indexOf("\n",idx)!=-1) { + lines++; + idx = s.indexOf("\n",idx)+1; + } + return lines; + } + + public void test065() { + runTest("before,after not (cflow(within(Trace*))) prints nothing"); + String s = getLastRunResult().getStdErr(); + int lines = countLines(s); + assertTrue("The actual output does not match the expected output. Expected 102 lines but got "+ + lines+" lines. Actual output =\n"+s,lines==102); + // IF YOU WANT TO SEE THE EXPECTED OUTPUT, LOOK IN THE TEST PROGRAM bugs/WhatsGoingOn.java + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc121/ajc121-tests.xml b/tests/src/test/java/org/aspectj/systemtest/ajc121/ajc121-tests.xml new file mode 100644 index 000000000..1d65dc3e1 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc121/ajc121-tests.xml @@ -0,0 +1,494 @@ +<!-- AspectJ v1.2.1 Tests --> + + + <ajc-test dir="bugs" + pr="62073" title="false ambiguous binding error (introduced in 1.2rc2)"> + <compile files="DisjunctVarBinding_2.java,DisjunctVarBinding_3.java"> + <message kind="error" line="4" file="DisjunctVarBinding_3.java" text="ambiguous binding of parameter(s) a, b across '||' in pointcut"/> + </compile> + <compile files="DisjunctVarBinding_3.java,DisjunctVarBinding_2.java"> + <message kind="error" line="4" file="DisjunctVarBinding_3.java" text="ambiguous binding of parameter(s) a, b across '||' in pointcut"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/IfPerThis" + pr="62458" title="An if() pointcut inside a perthis() clauses an ABORT - null pointer exception in ajc"> + <compile files="Testcase1.java"> + <message kind="error" line="15" text="if() pointcut designator cannot be used directly in a per clause"/> + <message kind="error" line="23" text="if() pointcut designator cannot be used directly in a per clause"/> + <message kind="error" line="25" text="if() pointcut designator cannot be used directly in a per clause"/> + <message kind="error" line="27" text="if() pointcut designator cannot be used directly in a per clause"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/IfPerThis" + pr="62458" title="An if() pointcut inside a perthis() clauses an ABORT - null pointer exception in ajc"> + <compile files="Testcase2.java"/> + <run class="Testcase2"/> + </ajc-test> + + <ajc-test dir="bugs/IfPerThis" + pr="62458" title="An if() pointcut inside a perthis() clauses an ABORT - null pointer exception in ajc"> + <compile files="Testcase3.java"> + <message kind="error" line="2" text="if() pointcut designator cannot be used directly in a per clause"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/bug70619" + pr="70619" title="compiler aborts with 'conflicting dominates orders' with circular declare precedences"> + <compile files="Precedence.java"> + <message kind="error" line="0" text="conflicting declare precedence"/> + </compile> + <compile files="Conflict.java,Order2.aj,Order1.aj"> + <message kind="error" line="0" text="conflicting declare precedence"/> + </compile> + <compile files="Conflict.java,Order1.aj,Order2.aj"> + <message kind="error" line="0" text="conflicting declare precedence"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" + pr="53999" title="'can't bind type' message has $ for . in type name for declare soft"> + <compile files="Cosmetic.java"> + <message kind="error" line="9" text="can't bind type name 'unknown.Error'"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/intertypeOverrides" + pr="69459" title="Hiding of Instance Methods by static methods"> + <compile files="IntertypeOverrides.java"> + <message kind="error" line="8" text="void Sub.m() cannot override void Super.m(); overriding method is static"/> + </compile> + <compile files="IntertypeOverrides2.java"> + <message kind="error" line="8" text="void Sub.m() cannot override void Super.m(); overridden method is static"/> + </compile> + <compile files="Superclass.java,Subclass.java,Aspect1.java"> + <message file="Aspect1.java" kind="error" line="2" + text="void Subclass.staticMethod() cannot override void Superclass.staticMethod(); overridden method is static"/> + </compile> + <compile files="Superclass.java,Subclass.java,Aspect2.java"> + <message file="Aspect2.java" kind="error" line="2" + text="void Subclass.nonstaticMethod() cannot override void Superclass.nonstaticMethod(); overriding method is static"/> + </compile> + </ajc-test> + + <ajc-test dir="new" + title="if(false) optimisation" pr="48990"> + <compile files="IfFalse.aj" options="-1.4"/> + <run class="IfFalse"/> + </ajc-test> + + <ajc-test dir="new" + title="if(true) optimisation" pr="48990"> + <compile files="IfTrue.aj" options="-1.4"/> + <run class="IfTrue"/> + </ajc-test> + + <ajc-test dir="bugs/abstractITDs" + pr="64331" title="java.lang.NullPointerException in WeaverMessageHandler class"> + <compile files="A.java,C.java" aspectpath="B.jar"> + <message kind="error" line="1" text="must implement abstract inter-type declaration: void A.foo()"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/pr64262" + title="ClassCastException at BcelRenderer.java:169" pr="64262"> + <compile files="PrimitiveCoercionInExactTypePatternMatching.java"/> + </ajc-test> + + <ajc-test dir="bugs" + pr="61536" title="Front-end bug, shouldn't allow patterns of the form foo.., should be foo..*"> + <compile files="EllipsesStar.java"> + <message kind="error" line="3" text="Syntax error on token"/> + <message kind="error" line="4" text="Syntax error on token"/> + <message kind="error" line="5" text="Syntax error on token"/> + <message kind="error" line="6" text="Syntax error on token"/> + <message kind="error" line="8" text="Syntax error on token"/> + <message kind="error" line="10" text="Syntax error on token"/> + <message kind="error" line="12" text="Syntax error on token"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" + pr="67774" title="Nullpointer-Exception when defining a withincode() pointcut"> + <compile files="WithincodeNPE01.java"> + <!-- there are 3 join points that result in decw match, but 2 are on the same line! --> + <message kind="warning" line="2" text="In String ctor"/> + <message kind="warning" line="11" text="In String ctor"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="60015" + title="NPE, Incorrect XLint:unmatchedSuperTypeInCall warning"> + <compile files="IncorrectXlintOnInterface.java"> + </compile> + </ajc-test> + + <ajc-test dir="bugs/typeVisibilityProblem" pr="67591" + title="invalid warning indicating no match when a match really occurs"> + <compile files="Main.java"> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="71273" + title="RuntimeException thrown: Could not find instruction: org.apache.bcel.generic.B2I"> + <compile files="NoByteToInt.java"/> + <run class="NoByteToInt"/> + </ajc-test> + + <ajc-test dir="bugs/AroundAdviceJPs" pr="71377" + title="Cannot advise private method call in around advice"> + <compile files="JoinPointInAroundAdvice.java"/> + <run class="JoinPointInAroundAdvice"/> + </ajc-test> + + <ajc-test dir="bugs/AroundAdviceJPs" pr="71377" + title="Cannot advise private field sets in around advice"> + <compile files="FieldJoinPointsInAroundAdvice.java"/> + <run class="FieldJoinPointsInAroundAdvice"/> + </ajc-test> + + <ajc-test dir="bugs/AroundAdviceJPs" pr="71377" + title="Cannot advise private field gets in around advice"> + <compile files="FieldGetJoinPointsInAroundAdvice.java"/> + <run class="FieldGetJoinPointsInAroundAdvice"/> + </ajc-test> + +<!-- + commented out as test takes over 5 minutes to run - reinstate if you need to investigate 70201 for + any reason. + <ajc-test dir="bugs" pr="70201" + title="Branch target offset too large for short"> + <compile files="VeryLongBranch.java"/> + </ajc-test> +--> + +<!-- these next two tests commented out as they take minutes to run - reinstate if you need to + investigate 59208 for any reason + <ajc-test dir="bugs/pr59208" pr="59208" + title="Weaver fails in BCEL for large classes"> + <compile files="Foo.java, A.aj"> + <message kind="error" line="0" text="constant pool too big"></message> + </compile> + </ajc-test> + + + <ajc-test dir="bugs/pr59208" pr="59208" + title="Weaver fails in BCEL for large classes (binary)"> + <compile + aspectpath="test.jar" + inpath="classes"> + <message kind="error" line="0" text="constant pool too big"></message> + </compile> + </ajc-test> +--> + + <ajc-test dir="bugs/pr53981" pr="538981" + title="proceed used as method name in around advice (1)"> + <compile files="Proceeding1.aj"/> + <run class="Proceeding1"/> + </ajc-test> + + <ajc-test dir="bugs/pr53981" pr="538981" + title="proceed used as method name in around advice (2)"> + <compile files="Proceeding2.aj"/> + <run class="Proceeding2"/> + </ajc-test> + + <ajc-test dir="bugs/pr53981" pr="538981" + title="proceed used as method name in around advice (3)"> + <compile files="Proceeding3.aj"/> + <run class="Proceeding3"/> + </ajc-test> + + <ajc-test dir="bugs" pr="61572" + title="ITDs on inner classes should be static context"> + <compile files="PR61572.aj"> + <message kind="error" line="19" text="Cannot make a static reference to the non-static field zzz"></message> + </compile> + </ajc-test> + + <ajc-test dir="bugs/oxford" pr="65319" + title="ajc crashes when compiling the following program (binding this() and target())"> + <compile files="PR65319.java"> + <!-- target comes before this comes before args, and we only report one error --> + <message kind="error" line="23" text="ambiguous binding of parameter(s) x across '||' in pointcut"/> + <message kind="error" line="25" text="ambiguous binding of parameter(s) x across '||' in pointcut"/> + <message kind="error" line="27" text="ambiguous binding of parameter(s) x across '||' in pointcut"/> + <message kind="error" line="29" text="ambiguous binding of parameter(s) x across '||' in pointcut"/> + </compile> + </ajc-test> + +<!-- should NOT raise error, despite Oxford expectations to the contrary --> + <ajc-test dir="bugs/oxford" pr="62475" + title="resolution of IT field inits"> + <compile files="PR62475.java"> + </compile> + </ajc-test> + + + <ajc-test + dir="bugs/invalidAbsoluteTypeName" + pr="65925" + title="Valid but inaccessible type names should not be flagged by XLint:invalidAbsoluteTypeName"> + <compile files="False_InvalidAbsoluteTypeName.java"> + <message kind="warning" line="17"/> + </compile> + <run class="False_InvalidAbsoluteTypeName"/> + </ajc-test> + + <ajc-test dir="bugs/PR68991" pr="68991" + title="intertype initialisers should match field set pointcuts"> + <compile files="Simple.java"/> + <run class="Simple"/> + </ajc-test> + + <ajc-test dir="bugs/PR68991" pr="68991" + title="intertype initialisers should match field set pointcuts (oxford testcase)"> + <compile files="Oxford.java"/> + <run class="Oxford"/> + </ajc-test> + + <ajc-test dir="bugs" pr="54421" + title="Compile time declarations (warning and error) do not accept string concatenation (with +)"> + <compile files="decwStrings.java"> + <message kind="warning" line="5"/> + <message kind="warning" line="19" text="hello world"/> + <message kind="warning" line="22" text="hello world"/> + <message kind="warning" line="25" text="hello world"/> + <message kind="warning" line="30" text="hello world"/> + <message kind="warning" line="34" text="hello world"/> + <message kind="warning" line="39" text="abcdefghijklmnopqrstuvwxyz"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="54421" + title="Compile time declarations (warning and error) do not accept string concatenation (with +) (2)"> + <compile files="decwStringsErroneous.java"> + <message kind="error" line="22"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/oxford" pr="61768" + title="scope for inter-type methods"> + <compile files="PR61768.java"> + <message kind="error" line="37" text="No enclosing instance of type Aspect is accessible"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/doYouHaveVisiblePrivates" pr="71372" + title="NoSuchMethodError calling private method from around advice in inner aspect"> + <compile files="PrivateCall.java"/> + <run class="PrivateCall"/> + </ajc-test> + + <ajc-test dir="bugs/doYouHaveVisiblePrivates" pr="71372" + title="NoSuchMethodError calling private method from around advice in inner aspect (2)"> + <compile files="PrivateCall2.java,PrivateCall3.java"/> + <run class="def.PrivateCall3"/> + </ajc-test> + + <ajc-test dir="bugs/doYouHaveVisiblePrivates" pr="71372" + title="NoSuchMethodError calling private method from around advice in inner aspect (3)"> + <compile files="PrivateCallInstance.java"/> + <run class="PrivateCallInstance"/> + </ajc-test> + + <ajc-test dir="bugs/doYouHaveVisiblePrivates" pr="71372" + title="NoSuchMethodError calling private method from around advice in inner aspect (4)"> + <compile files="PrivateCall_Instance_Package1.java,PrivateCall_Instance_Package2.java"/> + <run class="def.PrivateCall_Instance_Package2"/> + </ajc-test> + + <ajc-test dir="bugs/privilegedNPE" pr="67579" + title="NPE on privileged aspect error"> + <compile files="a/ITD.aj,b/B.aj"/> + <run class="b.B"/> + </ajc-test> + + <ajc-test dir="bugs/privilegedNPE" pr="67579" + title="NPE on privileged aspect error (2)"> + <compile files="b/B.aj,a/ITD.aj"/> + <run class="b.B"/> + </ajc-test> + + <ajc-test dir="bugs/privilegedAccess" pr="67578" + title="Privileged Aspect Access Problem Across Packages"> + <compile files="b/B.aj,a/ITD.aj"/> + <run class="b.B"/> + </ajc-test> + + <ajc-test dir="bugs/privilegedAccess" pr="67578" + title="Privileged Aspect Access Problem Across Packages (2)"> + <compile files="b/B_notPrivileged.aj,a/ITD.aj"> + <message kind="error" line="7" text="The method returnNothing(Object) from the type ITD is not visible"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="62642" + title="proper handling of ExceptionInIntializer inside clinit in presence of after throwing advice"> + <compile files="pr62642.java"/> + <run class="pr62642"/> + </ajc-test> + + <ajc-test dir="bugs" pr="64069" + title="ITD name clashes with private members"> + <compile files="PR64069.aj"> + <message kind="error" line="5" text="conflicts with existing member"/> + <message kind="error" line="10" text="conflicts with existing member"/> + <message kind="error" line="14" text="conflicts with existing member"/> + <!-- new error expected due to 275032 change - the itd for the ctor will be ignored in the clash case --> + <message kind="error" line="41" text="The constructor A() is not visible"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/pr71723" pr="71723" + title="Inconsistency in scoping of protected members in ITDs"> + <compile files="foo/Foo.java,bar/Bar.aj"> + <message kind="error" line="8" text="The method i() from the type Foo is not visible"/> + <message kind="error" line="9" text="The method ancientI() from the type Foo is not visible"/> + <message kind="error" line="10" text="The method ancientJ() from the type AncientFoo is not visible"/> + <message kind="error" line="11" text="The method clone() from the type Object is not visible"/> + <message kind="error" line="12" text="Cannot make a static reference to the non-static method clone() from the type Object"/> + </compile> + </ajc-test> + + <ajc-test dir="design/sourceLines" pr="37020" + title="wrong line for method execution join point"> + <compile files="TestSourceLines.java"> + <message kind="warning" line="1" text="static init"/> + <message kind="warning" line="12" text="cons execution"/> + <message kind="warning" line="12" text="pre-init"/> + <message kind="warning" line="12" text="just-init"/> + <message kind="warning" line="16" text="cons execution"/> + <message kind="warning" line="16" text="just-init"/> + <message kind="warning" line="16" text="pre-init"/> + <message kind="warning" line="20" text="method execution"/> + <message kind="warning" line="24" text="method execution"/> + <message kind="warning" line="28" text="method execution"/> + <message kind="warning" line="35" text="static init"/> + <message kind="warning" line="35" text="just-init"/> + <message kind="warning" line="35" text="pre-init"/> + <message kind="warning" line="39" text="pre-init"/> + <message kind="warning" line="39" text="just-init"/> + <message kind="warning" line="39" text="static init"/> + <message kind="warning" line="47" text="advice"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/interfaceITDs" pr="70794" + title="The introduction on interface causes the interface implementation class error (1)"> + <compile files="PublicPublic.java"/> + </ajc-test> + + + <ajc-test dir="bugs/interfaceITDs" pr="70794" + title="The introduction on interface causes the interface implementation class error (2)"> + <compile files="PackagePublic.java"/> + </ajc-test> + + <ajc-test dir="bugs/interfaceITDs" pr="70794" + title="The introduction on interface causes the interface implementation class error (3)"> + <compile files="PackagePackage.java"> + <message kind="error" line="17" text="abstract intertype method declaration 'void PackagePackage.world()' on interface PackagePackage must be declared public (compiler limitation)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/interfaceITDs" pr="70794" + title="The introduction on interface causes the interface implementation class error (4)"> + <compile files="PublicPackage.java"> + <message kind="error" line="13" text="abstract intertype method declaration 'void PublicPackage.world()' on interface PublicPackage must be declared public (compiler limitation)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/pr72531" pr="72531" + title="declare warning warns at wrong points"> + <compile files="de/rohith/HelloWorld.java,de/rohith/HelloWorldAspect.java,de/rohith/PrinterWorld.java"> + <message kind="warning" line="15" text="*[] returning method called"/> + <message kind="warning" line="22" text="*[] returning method called"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="72699" + title="Bogus error message: The abstract method ajc$pointcut$$tracingScope$a2 in type Tracing can only be defined by an abstract class (1)"> + <compile files="BogusMessage.java"> + <message kind="error" line="2" text="The abstract pointcut tracingScope can only be defined in an abstract aspect"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="72699" + title="Bogus error message: The abstract method ajc$pointcut$$tracingScope$a2 in type Tracing can only be defined by an abstract class (2)"> + <compile files="BogusMessage2.java"> + <message kind="error" line="1" text="The type BogusMessage2 must be an abstract class to define abstract methods"/> + <message kind="error" line="2" text="The abstract pointcut tracingScope can only be defined in an aspect"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/pr70404" pr="70404" + title="passing null to array arguments confuzes static join point signature. (1)"> + <compile files="Main.java,MainAspect.java"/> + <run class="dk.infimum.aspectjtest.Main"/> + </ajc-test> + + <ajc-test dir="bugs/pr70404" pr="70404" + title="passing null to array arguments confuzes static join point signature. (2)"> + <compile files="Main2.java,MainAspect.java"/> + <run class="dk.infimum.aspectjtest.Main2"/> + </ajc-test> + + <ajc-test dir="bugs" pr="72528" + title="around advice throws java.lang.VerifyError at runtime"> + <compile files="ArrayCloning.java"/> + <run class="ArrayCloning"/> + </ajc-test> + + <ajc-test dir="bugs" pr="72157" + title="declare soft can cause programs with invalid exception behaviour to be generated"> + <compile files="PR72157.java"> + <message kind="error" line="13" text="Unhandled"/> + </compile> + </ajc-test> + + <ajc-test + dir="bugs" + pr="75129" + title="NPE on thisJoinPoint mistake"> + <compile files="TjpMistake.java"> + <message kind="error" line="22"/> + </compile> + </ajc-test> + + <ajc-test dir="cflow" pr="76030" title="Optimization of cflow - counters (1)"> + <compile files="CounterTest01.java"/> + <run class="CounterTest01"/> + </ajc-test> + + <ajc-test dir="cflow" pr="76030" title="Optimization of cflow - shared counters (2)"> + <compile files="CounterTest02.java" options="-1.4"/> + <run class="CounterTest02"/> + </ajc-test> + + <ajc-test dir="cflow" pr="76030" title="Optimization of cflow - shared stacks (3)"> + <compile files="CounterTest03.java"/> + <run class="CounterTest03"/> + </ajc-test> + + <ajc-test dir="cflow" pr="76030" title="Optimization of cflow - counters (4)"> + <compile files="CounterTest04.java" options="-1.4"/> + <run class="CounterTest04"/> + </ajc-test> + + <ajc-test dir="cflow" pr="76030" title="Optimization of cflow - counters with abstract pointcuts (5)"> + <compile files="CounterTest05.java"/> + <run class="CounterTest05"/> + </ajc-test> + + <ajc-test dir="bugs/pr76096" pr="76096" title="Anonymous classes unaware of introductions into abstract classes"> + <compile files="ConcreteClassA.java"/> + <run class="ConcreteClassA"/> + </ajc-test> + + <ajc-test dir="bugs" pr="74952" title="before,after not (cflow(within(Trace*))) prints nothing"> + <compile files="WhatsGoingOn.java"/> + <run class="WhatsGoingOn"/> + </ajc-test> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc121/ajc121.xml b/tests/src/test/java/org/aspectj/systemtest/ajc121/ajc121.xml new file mode 100644 index 000000000..8ad54bf32 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc121/ajc121.xml @@ -0,0 +1,12 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[ +<!ENTITY tests SYSTEM "../tests/src/org/aspectj/systemtest/ajc121/ajc121-tests.xml"> +]> + +<!-- AspectJ v1.2.1 Tests --> + +<suite> + +&tests; + +</suite> + diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/AccBridgeMethods.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/AccBridgeMethods.java new file mode 100644 index 000000000..e9348f49c --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/AccBridgeMethods.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + + +/** + * <b>These tests check binary weaving of code compiled with the 1.5 compiler. If you need to rebuild + * the class files then you will have to run tests/java5/bridgeMethods/build.xml.</b> + * + * <p>Bridge methods are generated when a type extends or implements a parameterized class or interface and + * type erasure changes the signature of any inherited method. + * + * <p>They impact AspectJ in two ways: + * <ol> + * <li>They exist as a method execution join point, and their 'body' exists as a set of new join points + * (although their body is normally coded simply to delegate to the method they are bridging too). + * <li> They create a potential call join point where a call can be made to the bridge method. + * </ol> + * + * <p>The principal things we have to do are avoid weaving their body and ignore their existence + * as a method execution join point. Their existence as a potential target for a call join point are + * more complicated. Although they exist in the code, a 1.5 compiler will prevent a call to them with + * an error like this: + * + * M.java:3: compareTo(Number) in Number cannot be applied to (java.lang.String) + * new Number(5).compareTo("abc"); + * + * Our problem is that a Java 1.4 or earlier compiler will allow you to write calls to this bridge method + * and it will let them through. + */ +public class AccBridgeMethods extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AccBridgeMethods.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + + /** + * AspectX attempts to weave call and execution of the method for which a 'bridge method' is also created. + * If the test works then only two weaving messages come out. If it fails then usually 4 messages come out + * and we have incorrectly woven the bridge method (the 3rd message is execution of the bridge method and + * the 4th message is the call within the bridge method to the real method). + */ + public void test001_bridgeMethodIgnored() { + runTest("Ignore bridge methods"); + } + + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/Ajc150Tests.java new file mode 100644 index 000000000..c9998d6c9 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/Ajc150Tests.java @@ -0,0 +1,1035 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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.ajc150; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; + +import junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.apache.bcel.classfile.Signature; +import org.aspectj.asm.AsmManager; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.util.LangUtil; + +public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc150Tests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + public void testMixingCodeStyles_pr121385() { + runTest("mixing aspect styles"); + } + + public void testTypeVars_pr121575() { + runTest("different numbers of type vars"); + } + + public void testTypeVars_pr121575_2() { + runTest("different numbers of type vars - 2"); + } + + public void testTypeVars_pr121575_3() { + runTest("different numbers of type vars - 3"); + } + + public void testTypeVars_pr121575_4() { + runTest("different numbers of type vars - 4"); + } + + public void testDecps1() { + runTest("decps - 1"); + } + + public void testDecps1b() { + runTest("decps - 1b"); + } + + public void testDecps2() { + runTest("decps - 2"); + } + + public void testDecps2b() { + runTest("decps - 2b"); + } + + public void testDecps3() { + runTest("decps - 3"); + } + + public void testDecps3b() { + runTest("decps - 3b"); + } + + public void testDecps3c() { + runTest("decps - 3c"); + } + + public void testVarargsNPE_pr120826() { + runTest("varargs NPE"); + } + + public void testNamedPointcutPertarget_pr120521() { + runTest("named pointcut not resolved in pertarget pointcut"); + } + + public void testDollarClasses_pr120474() { + runTest("Dollar classes"); + } + + public void testGenericPTW_pr119539_1() { + runTest("generic pertypewithin aspect - 1"); + } + + public void testGenericPTW_pr119539_2() { + runTest("generic pertypewithin aspect - 2"); + } + + public void testGenericPTW_pr119539_3() { + runTest("generic pertypewithin aspect - 3"); + } + + /* + * public void testBrokenDispatchByITD_pr72834() { runTest("broken dispatch");} public void testMissingAccessor_pr73856() { + * runTest("missing accessor");} public void testCunningDeclareParents_pr92311() { runTest("cunning declare parents");} public + * void testGenericITDsAndAbstractMethodError_pr102357() { runTest("generic itds and abstract method error");} + */ + public void testIncorrectSignatureMatchingWithExceptions_pr119749() { + runTest("incorrect exception signature matching"); + } + + public void testGeneratingCodeForAnOldRuntime_pr116679_1() { + runTest("generating code for a 1.2.1 runtime - 1"); + } + + public void testGeneratingCodeForAnOldRuntime_pr116679_2() { + runTest("generating code for a 1.2.1 runtime - 2"); + } + + public void testAmbiguousMethod_pr118599_1() { + runTest("ambiguous method when binary weaving - 1"); + } + + public void testAmbiguousMethod_pr118599_2() { + runTest("ambiguous method when binary weaving - 2"); + } + + public void testAroundAdviceArrayAdviceSigs_pr118781() { + runTest("verify error with around advice array sigs"); + } + + public void testAtDeclareParents_pr117681() { + runTest("at declare parents"); + } + + public void testPrivilegeProblem_pr87525() { + runTest("privilege problem with switch"); + } + + public void testRangeProblem_pr109614() { + runTest("Range problem"); + } + + public void testGenericAspects_pr115237() { + runTest("aspectOf and generic aspects"); + } + + public void testClassFormatError_pr114436() { + runTest("ClassFormatError binary weaving perthis"); + } + + public void testParserException_pr115788() { + runTest("parser exception"); + } + + public void testPossibleStaticImports_pr113066_1() { + runTest("possible static imports bug - 1"); + } + + public void testPossibleStaticImports_pr113066_2() { + runTest("possible static imports bug - 2"); + } + + public void testPossibleStaticImports_pr113066_3() { + runTest("possible static imports bug - 3"); + } + + public void testITDCtor_pr112783() { + runTest("Problem with constructor ITDs"); + } + + public void testAnnotatedITDFs_pr114005_1() { + runTest("Annotated ITDFs - 1"); + } + + public void testAnnotatedITDFs_pr114005_2() { + runTest("Annotated ITDFs - 2"); + } + + public void testCantCallSuperMethods_pr90143() { + runTest("cant call super methods"); + } + + public void testBrokenDecp_pr112476() { + runTest("binary weaving decp broken"); + } + + public void testUnboundFormal_pr112027() { + runTest("unexpected error unboundFormalInPC"); + } + + public void testNPEScopeSetup_pr115038() { + runTest("NPE in ensureScopeSetup"); + } + + public void testCCEGenerics_pr113445() { + runTest("Generics ClassCastException"); + } + + public void testMatthewsAspect_pr113947_1() { + runTest("maws generic aspect - 1"); + } + + public void testMatthewsAspect_pr113947_2() { + runTest("maws generic aspect - 2"); + } + + public void testFieldGet_pr114343() { + runTest("field-get, generics and around advice"); + } + + public void testFieldGet_pr114343_2() { + runTest("field-get, generics and around advice - 2"); + } + + public void testFieldGet_pr114343_3() { + runTest("field-get, generics and around advice - 3"); + } + + public void testCaptureBinding_pr114744() { + runTest("capturebinding wildcard problem"); + } + + public void testAutoboxingAroundAdvice_pr119210_1() { + runTest("autoboxing around advice - 1"); + } + + public void testAutoboxingAroundAdvice_pr119210_2() { + runTest("autoboxing around advice - 2"); + } + + public void testAutoboxingAroundAdvice_pr119210_3() { + runTest("autoboxing around advice - 3"); + } + + public void testBadDecp_pr110788_1() { + runTest("bad generic decp - 1"); + } + + public void testBadDecp_pr110788_2() { + runTest("bad generic decp - 2"); + } + + public void testBadDecp_pr110788_3() { + runTest("bad generic decp - 3"); + } + + public void testBadDecp_pr110788_4() { + runTest("bad generic decp - 4"); + } + + // public void testSimplifiedGenericAspectITDTest() { runTest("spurious override method warning - 3");} + // public void testSpuriousOverrideMethodWarning_pr119570_1() { runTest("spurious override method warning");} + // public void testSpuriousOverrideMethodWarning_pr119570_2() { runTest("spurious override method warning - 2");} + + public void testBrokenSwitch_pr117854() { + runTest("broken switch transform"); + } + + public void testVarargsITD_pr110906() { + runTest("ITD varargs problem"); + } + + public void testBadRenderer_pr86903() { + runTest("bcelrenderer bad"); + } + + // public void testIllegalInitialization_pr118326_1() { runTest("illegal initialization - 1");} + // public void testIllegalInitialization_pr118326_2() { runTest("illegal initialization - 2");} + public void testLintForAdviceSorting_pr111667() { + runTest("lint for advice sorting"); + } + + public void testIncompatibleClassChangeError_pr113630_1() { + runTest("IncompatibleClassChangeError - errorscenario"); + } + + public void testIncompatibleClassChangeError_pr113630_2() { + runTest("IncompatibleClassChangeError - workingscenario"); + } + + public void testFieldGetProblemWithGenericField_pr113861() { + runTest("field-get problems with generic field"); + } + + public void testAccesstoPrivateITDInNested_pr118698() { + runTest("access to private ITD from nested type"); + } + + public void testDeclareAnnotationOnNonExistentType_pr99191_1() { + runTest("declare annotation on non existent type - 1"); + } + + public void testDeclareAnnotationOnNonExistentType_pr99191_2() { + runTest("declare annotation on non existent type - 2"); + } + + public void testDeclareAnnotationOnNonExistentType_pr99191_3() { + runTest("declare annotation on non existent type - 3"); + } + + public void testDeclareAnnotationOnNonExistentType_pr99191_4() { + runTest("declare annotation on non existent type - 4"); + } + + public void testDeclareAnnotationOnNonExistentType_pr99191_5() { + runTest("declare annotation on non existent type - 5"); + } + + public void testBadGenericSigAttribute_pr110927() { + runTest("cant create signature attribute"); + Signature sig = GenericsTests.getClassSignature(ajc, "I"); + if (sig == null) + fail("Couldn't find signature attribute for type I"); + String sigString = sig.getSignature(); + if (!(sigString.equals("Ljava/lang/Object;LIE2;LIE1<Ljava/lang/String;>;") || sigString + .equals("Ljava/lang/Object;LIE1<Ljava/lang/String;>;LIE2;"))) { + fail("Signature was " + sigString + + " when should have been something like Ljava/lang/Object;LIE1<Ljava/lang/String;>;LIE2;"); + } + } + + public void test_typeProcessingOrderWhenDeclareParents() { + runTest("Order of types passed to compiler determines weaving behavior"); + } + + public void test_aroundMethod() { + runTest("method called around in class"); + } + + public void test_aroundMethodAspect() { + runTest("method called around in aspect"); + } + + public void test_ambiguousBindingsDetection() { + runTest("Various kinds of ambiguous bindings"); + } + + public void test_ambiguousArgsDetection() { + runTest("ambiguous args"); + } + + public void testIncorrectExceptionTableWhenBreakInMethod_pr78021() { + runTest("Injecting exception into while loop with break statement causes catch block to be ignored"); + } + + public void testIncorrectExceptionTableWhenReturnInMethod_pr79554() { + runTest("Return in try-block disables catch-block if final-block is present"); + } + + public void testMissingDebugInfoForGeneratedMethods_pr82570() throws ClassNotFoundException { + runTest("Weaved code does not include debug lines"); + boolean f = false; + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "PR82570_1"); + Method[] meths = jc.getMethods(); + for (int i = 0; i < meths.length; i++) { + Method method = meths[i]; + if (f) + System.err.println("Line number table for " + method.getName() + method.getSignature() + " = " + + method.getLineNumberTable()); + assertTrue("Didn't find a line number table for method " + method.getName() + method.getSignature(), + method.getLineNumberTable() != null); + } + + // This test would determine the info isn't there if you pass -g:none ... + // cR = ajc(baseDir,new String[]{"PR82570_1.java","-g:none"}); + // assertTrue("Expected no compile problem:"+cR,!cR.hasErrorMessages()); + // System.err.println(cR.getStandardError()); + // jc = getClassFrom(ajc.getSandboxDirectory(),"PR82570_1"); + // meths = jc.getMethods(); + // for (int i = 0; i < meths.length; i++) { + // Method method = meths[i]; + // assertTrue("Found a line number table for method "+method.getName(), + // method.getLineNumberTable()==null); + // } + } + + public void testCanOverrideProtectedMethodsViaITDandDecp_pr83303() { + runTest("compiler error when mixing inheritance, overriding and polymorphism"); + } + + public void testPerTypeWithin_pr106554() { + runTest("Problem in staticinitialization with pertypewithin aspect"); + } + + public void testPerTypeWithinMissesNamedInnerTypes() { + runTest("pertypewithin() handing of inner classes (1)"); + } + + public void testPerTypeWithinMissesAnonymousInnerTypes() { + runTest("pertypewithin() handing of inner classes (2)"); + } + + public void testPerTypeWithinIncorrectlyMatchingInterfaces() { + runTest("pertypewithin({interface}) illegal field modifier"); + } + + public void test051_arrayCloningInJava5() { + runTest("AJC possible bug with static nested classes"); + } + + public void testBadASMforEnums() throws IOException { + runTest("bad asm for enums"); + + if (LangUtil.is15VMOrGreater()) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + PrintWriter pw = new PrintWriter(baos); + AsmManager.dumptree(pw, AsmManager.lastActiveStructureModel.getHierarchy().getRoot(), 0); + pw.flush(); + String tree = baos.toString(); + assertTrue("Expected 'Red [enumvalue]' somewhere in here:" + tree, tree.indexOf("Red [enumvalue]") != -1); + } + } + + public void npeOnTypeNotFound() { + runTest("structure model npe on type not found"); + } + + public void testNoRuntimeExceptionSoftening() { + runTest("declare soft of runtime exception"); + } + + public void testRuntimeNoSoftenWithHandler() { + runTest("declare soft w. catch block"); + } + + public void testSyntaxError() { + runTest("invalid cons syntax"); + } + + public void testVarargsInConsBug() { + runTest("varargs in constructor sig"); + } + + public void testAspectpathdirs() { + runTest("dirs on aspectpath"); + } + + public void testIntroSample() { + runTest("introduction sample"); + } + + public void testPTWInterface() { + runTest("pertypewithin({interface}) illegal field modifier"); + } + + public void testEnumCalledEnumEtc() { + runTest("enum called Enum, annotation called Annotation, etc"); + } + + public void testInternalCompilerError_pr86832() { + runTest("Internal compiler error"); + } + + public void testCloneMethod_pr83311() { + runTest("overriding/polymorphism error on interface method introduction"); + } + + // IfPointcut.findResidueInternal() was modified to make this test complete in a short amount + // of time - if you see it hanging, someone has messed with the optimization. + public void testIfEvaluationExplosion_pr94086() { + runTest("Exploding compile time with if() statements in pointcut"); + } + + public void testReflectNPE_pr94167() { + runTest("NPE in reflect implementation"); + } + + public void testStaticImports_pr84260() { + runTest("static import failures"); + } + + public void testGenerics_pr99089() { + runTest("ArrayIndexOutOfBoundsException - Generics in privileged aspects"); + } + + public void testGenerics_pr95993() { + runTest("NPE at ClassScope.java:660 when compiling generic class"); + } + + public void testItdGenerics_pr99228() { + runTest("ITD of a field into a generic class"); + } + + public void testItdGenerics_pr98320() { + runTest("intertype with nested generic type"); + } + + public void testItdGenerics_pr100227() { + runTest("inner class with generic enclosing class"); + } + + public void testItdGenerics_pr100260() { + runTest("methods inherited from a generic parent"); + } + + public void testSyntaxErrorNPE_pr103266() { + runTest("NPE on syntax error"); + } + + public void testFinalAbstractClass_pr109486() { + runTest("Internal compiler error (ClassParser.java:242)"); + } + + public void testComplexBinding_pr102210() { + runTest("NullPointerException trying to compile"); + } + + public void testIllegalStateExceptionOnNestedParameterizedType_pr106634() { + runTest("IllegalStateException unpacking signature of nested parameterized type"); + } + + public void testParseErrorOnAnnotationStarPlusPattern() { + runTest("(@Foo *)+ type pattern parse error"); + } + + public void test_pr106130_tooManyLocals() { + runTest("test weaving with > 256 locals"); + } + + public void testMissingNamePattern_pr106461() { + runTest("missing name pattern"); + } + + public void testMissingNamePattern_pr107059() { + runTest("parser crashes on call(void (@a *)(..)"); + } + + public void testIntermediateAnnotationMatching() { + runTest("intermediate annotation matching"); + } + + public void testBadRuntimeTestGeneration() { + runTest("target(@Foo *)"); + } + + // ONE_EIGHT remove for now, needs some grammar changes to ensure empty type annotations are put in place for later consumption +// public void testErrorMessageOnITDWithTypePatterns() { +// runTest("clear error message on itd with type pattern"); +// } + + public void testAjKeywordsAsIdentifiers() { + runTest("before and after are valid identifiers in classes"); + } + + public void testAjKeywordsAsIdentifiers2() { + runTest("before and after are valid identifiers in classes, part 2"); + } + + public void testNoBeforeReturningAdvice() { + runTest("before returning advice not allowed!"); + } + + public void testDetectVoidFieldType() { + runTest("void field type in pointcut expression"); + } + + public void testPointcutOverriding() { + runTest("overriding final pointcut from super-aspect"); + } + + public void testAtSuppressWarnings() { + runTest("@SuppressWarnings should suppress"); + } + + public void testDEOWWithBindingPointcut() { + runTest("declare warning : foo(str) : ...;"); + } + + public void testAroundAdviceAndInterfaceInitializer() { + runTest("around advice on interface initializer"); + } + + public void testGoodErrorMessageOnUnmatchedMemberSyntax() { + runTest("good error message for unmatched member syntax"); + } + + public void testITDWithNoExceptionAndIntermediary() { + runTest("itd override with no exception clause"); + } + + public void testAnonymousInnerClasses() { + runTest("anonymous inner classes"); + } + + public void testMultipleAnonymousInnerClasses() { + runTest("multiple anonymous inner classes"); + } + + public void testPrivilegedMethodAccessorsGetRightExceptions_pr82989() { + runTest("Compiler error due to a wrong exception check in try blocks"); + } + + public void testAnonymousInnerClassWithMethodReturningTypeParameter_pr107898() { + runTest("anonymous inner class with method returning type parameter"); + } + + public void testMatchingOfObjectArray() { + runTest("matching against Object[]"); + } + + public void testMultipleAnonymousInnerClasses_pr108104() { + runTest("multiple anonymous inner classes 2"); + } + + public void testSignatureMatchingInMultipleOverrideScenario() { + runTest("signature matching in override scenario"); + } + + public void testWildcardAnnotationMatching_pr108245() { + runTest("wildcard annotation matching - pr108245"); + } + + public void testInnerTypesAndTypeVariables() { + runTest("inner types and type variables"); + } + + public void testAtAfterThrowingWithNoFormal() { + runTest("@AfterThrowing with no formal specified"); + } + + public void testParameterizedVarArgsMatch() { + runTest("varargs with type variable"); + } + + public void testFieldAccessInsideITDM() { + runTest("itd field access inside itd method"); + } + + public void testTypeVarWithTypeVarBound() { + runTest("type variable with type variable bound"); + } + + public void testEnumSwitchInITD() { + runTest("switch on enum inside ITD method"); + } + + public void testInnerTypeOfGeneric() { + runTest("inner type of generic interface reference from parameterized type"); + } + + public void testDeclareParentsIntroducingCovariantReturnType() { + runTest("declare parents introducing override with covariance"); + } + + public void testInnerClassPassedToVarargs() { + runTest("inner class passed as argument to varargs method"); + } + + public void testInlinedFieldAccessInProceedCall() { + runTest("inlined field access in proceed call"); + } + + public void testVisibiltyInSignatureMatchingWithOverridesPart1() { + runTest("visibility in signature matching with overrides - 1"); + } + + public void testVisibiltyInSignatureMatchingWithOverridesPart2() { + runTest("visibility in signature matching with overrides - 2"); + } + + public void testVisibiltyInSignatureMatchingWithOverridesPart3() { + runTest("visibility in signature matching with overrides - 3"); + } + + public void testArgsGeneratedCorrectlyForAdviceExecution() { + runTest("args generated correctly for advice execution join point"); + } + + public void testNoUnusedWarningsOnAspectTypes() { + runTest("no unused warnings on aspect types"); + } + + public void testSyntheticArgumentsOnITDConstructorsNotUsedInMatching() { + runTest("synthetic arguments on itd cons are not used in matching"); + } + + public void testParsingOfGenericTypeSignature() { + runTest("parse generic type signature with parameterized type in interface"); + } + + public void testOverrideAndCovarianceWithDecPRuntime() { + runTest("override and covariance with decp - runtime"); + } + + public void testOverrideAndCovarianceWithDecPRuntimeMultiFiles() { + runTest("override and covariance with decp - runtime separate files"); + } + + public void testOverrideAndCovarianceWithDecPRuntimeMultiFilesBinaryWeaving() { + runTest("override and covariance with decp - binary weaving"); + } + + public void testAbstractSynchronizedITDMethods() { + runTest("abstract synchronized itdms not detected"); + } + + public void testSynchronizedITDInterfaceMethods() { + runTest("synchronized itd interface methods"); + } + + public void testNoWarningOnUnusedPointcut() { + runTest("unused private pointcuts"); + } + + public void testITDOnInterfaceWithExistingMember() { + runTest("itd interface method already existing on interface"); + } + + public void testFinalITDMOnInterface() { + runTest("final itd methods on interfaces"); + } + + public void testPrivatePointcutOverriding() { + runTest("can't override private pointcut in abstract aspect"); + } + + public void testAdviceOnCflow() { + runTest("advising cflow advice execution"); + } + + public void testNoTypeMismatchOnSameGenericTypes() { + runTest("no type mismatch on generic types in itds"); + } + + public void testSuperCallInITD() { + runTest("super call in ITD"); + } + + public void testSuperCallInITDPart2() { + runTest("super call in ITD - part 2"); + } + + public void testAtAnnotationBadTest_pr103740() { + runTest("Compiler failure on at_annotation"); + } + + public void testNoUnusedParameterWarningsForSyntheticAdviceArgs() { + runTest("no unused parameter warnings for synthetic advice args"); + } + + public void testNoVerifyErrorWithSetOnInnerType() { + runTest("no verify error with set on inner type"); + } + + public void testCantFindTypeErrorWithGenericReturnTypeOrParameter() { + runTest("cant find type error with generic return type or parameter"); + } + + public void testNoVerifyErrorOnGenericCollectionMemberAccess() { + runTest("no verify error on generic collection member access"); + } + + public void testRawAndGenericTypeConversionITDCons() { + runTest("raw and generic type conversion with itd cons"); + } + + public void testAtAnnotationBindingWithAround() { + runTest("@annotation binding with around advice"); + } + + public void testUnableToBuildShadows_pr109728() { + runTest("Unable to build shadows"); + } + + public void testMessageOnMissingTypeInDecP() { + runTest("declare parents on a missing type"); + } + + public void testParameterizedGenericMethods() { + runTest("parameterized generic methods"); + } + + public void testIllegalChangeToPointcutDeclaration_pr111915() { + runTest("test illegal change to pointcut declaration"); + } + + public void testCantProvideDefaultImplViaITD_pr110307_1() { + runTest("Cant provide default implementation via ITD - 1"); + } + + public void testCantProvideDefaultImplViaITD_pr110307_2() { + runTest("Cant provide default implementation via ITD - 2"); + } + + public void testCantProvideDefaultImplViaITD_pr110307_3() { + runTest("Cant provide default implementation via ITD - 3"); + } + + public void testCantProvideDefaultImplViaITD_pr110307_4() { + runTest("Cant provide default implementation via ITD - 4"); + } + + public void testCantProvideDefaultImplViaITD_pr110307_5() { + runTest("Cant provide default implementation via ITD - 5"); + } + + // Needs a change in the compiler so that getType() can be overridden in the intertype scope - thats + // where we can police whether a type variable has been used without being specified appropriately. + // public void testCantProvideDefaultImplViaITD_pr110307_6() {runTest("Cant provide default implementation via ITD - 6");} + + public void testCantProvideDefaultImplViaITD_pr110307_7() { + runTest("Cant provide default implementation via ITD - 7"); + } + + public void testCallJoinPointsInAnonymousInnerClasses() { + runTest("call join points in anonymous inner classes"); + } + + public void testNoRequirementForUnwovenTypesToBeExposedToWeaver() { + runTest("default impl of Runnable"); + } + + public void testArrayCloneCallJoinPoints() { + runTest("array clone call join points in 1.4 vs 1.3"); + } + + public void testDebugInfoForAroundAdvice() { + runTest("debug info in around advice inlining"); + } + + public void testCCEWithGenericWildcard_pr112602() { + runTest("ClassCastException with generic wildcard"); + } + + public void testVarArgsIITDInConstructor() { + runTest("ITD varargs in constructor"); + } + + public void testWeaveInfoMessageForDeclareAtMethodOnITDdMethod() { + runTest("weaveinfo message for declare at method on an ITDd method"); + } + + public void testITDCWithNoExplicitConsCall() { + runTest("ITDC with no explicit cons call"); + } + + public void testJava5SpecificFeaturesUsedAtJava14OrLower() { + if (LangUtil.is17VMOrGreater()) { + runTest("java 5 pointcuts and declares at pre-java 5 compliance levels - 1.7"); + } else { + runTest("java 5 pointcuts and declares at pre-java 5 compliance levels"); + } + } + + public void testAnonymousTypes() { + runTest("Anonymous types and nome matching"); + } + + public void testAdviceExecutionJPToStringForms() { + runTest("adviceexecution join point toString forms"); + } + + public void testAssertWithinPointcutExpression() { + runTest("pointcut expression containing 'assert'"); + } + + public void testNoVerifyErrorWithTwoThisPCDs_pr113447() { + runTest("no verify error with two this pcds"); + } + + public void testNoVerifyErrorWithTwoAtThisPCDs_pr113447() { + runTest("no verify error with two at this pcds"); + } + + public void testNoVerifyErrorWithAtWithinPCDs_pr113447() { + runTest("no verify error with at within pcds"); + } + + public void testNoVerifyErrorWithAtWithincodePCDs_pr113447() { + runTest("no verify error with at withincode pcds"); + } + + public void testNoVerifyErrorWithAtAnnotationPCDs_pr113447() { + runTest("no verify error with at annotation pcds"); + } + + public void testNoVerifyErrorWithTwoArgsPCDs_pr113447() { + runTest("no verify error with two args pcds"); + } + + public void testNoStackOverflowWithCircularPCDInGenericAspect() { + runTest("no StackOverflowError with circular pcd in generic aspect"); + } + + public void testNoStackOverflowWithCircularPCDInGenericAspect2() { + runTest("no StackOverflowError with circular pcd in generic aspect - 2"); + } + + public void testNPEInThisJoinPointStaticPart() { + runTest("thisJoinPointStaticPart in if test"); + } + + public void testPointcutParsingOfCompiledPointcuts() { + runTest("pointcut parsing with ajc compiled pointcut references"); + } + + public void testReflectionOfAbstractITDs() { + runTest("reflection on abstract ITDs (Billing example)"); + } + + public void testDeclareSoftWithAdviceExecution() { + runTest("declare soft and adviceexecution"); + } + + public void testDeclareSoftWithExclusions() { + runTest("declare soft and exclusions"); + } + + public void testReturningObjectBinding() { + runTest("returning(Object) binding"); + } + + public void testPerTargetAndNegation() { + runTest("pertarget and negated pointcut"); + } + + public void testParameterizedPointcutAndAdvice() { + runTest("parameterized pointcut and advice"); + } + + public void testDoublyParameterizedAbstractType() { + runTest("double parameter generic abstract type"); + } + + public void testArgNamesInAdviceAnnotations() { + runTest("arg names in advice annotations"); + } + + /* + * Load-time weaving bugs + */ + public void testNPEinWeavingAdaptor_pr116626() { + runTest("NPE in WeavingAdaptor"); + } + + public void testXlintMessageForImproperAnnotationType_pr115252_Exact() { + runTest("xlint message for improper exact annotation type"); + } + + public void testXlintMessageForImproperAnnotationType_pr115252_OR() { + runTest("xlint message for improper annotation type inside OR"); + } + + public void testXlintMessageForImproperAnnotationType_pr115252_AND() { + runTest("xlint message for improper annotation type inside AND"); + } + + public void testXlintMessageForImproperAnnotationType_pr115252_Return() { + runTest("xlint message for improper annotated return type"); + } + + public void testXlintMessageForImproperAnnotationType_pr115252_Declaring() { + runTest("xlint message for improper annotated declaring type"); + } + + public void testXlintMessageForImproperAnnotationType_pr115252_Parameter() { + runTest("xlint message for improper annotated parameter type"); + } + + public void testXlintMessageForImproperAnnotationType_pr115252_Throws() { + runTest("xlint message for improper annotated throws pattern"); + } + + public void testXlintMessageForImproperAnnotationType_pr115252_MoreThanOne() { + runTest("xlint message for more than one improper annotated parameter type"); + } + + public void testNoNPEWhenInaccessibleMethodIsCalledWithinITD_pr119019() { + runTest("no NPE when inaccessible method is called within itd"); + } + + public void testNoNPEWithOrPointcutAndMoreThanOneArgs_pr118149() { + runTest("no NPE with or pointcut and more than one args"); + } + + public void testNoSOBWithGenericInnerAspects_pr119543() { + runTest("no StringOutOfBoundsException with generic inner aspects"); + } + + public void testIllegalAccessErrorWithAroundAdvice_pr119657() { + runTest("IllegalAccessError with around advice on interface method call"); + } + + public void testIllegalAccessErrorWithAroundAdviceNotSelf_pr119657() { + runTest("IllegalAccessError with around advice on interface method call not self"); + } + + public void testIllegalAccessErrorWithAroundAdviceTerminateAfterCompilationLTW_pr119657() { + runTest("IllegalAccessError with around advice on interface method call using -XterminateAfterCompilation and LTW"); + } + + public void testIllegalAccessErrorWithAroundAdviceLTW_pr119657() { + runTest("IllegalAccessError with around advice on interface method call using LTW"); + } + + public void testIllegalAccessErrorWithAroundAdviceNotSelfLTW_pr119657() { + runTest("IllegalAccessError with around advice on interface method call not self using LTW"); + } + + public void testIllegalAccessErrorWithAroundAdviceSelfAndNotSelfLTW_pr119657() { + runTest("IllegalAccessError with around advice on interface method call self and not self using LTW"); + } + + public void testIllegalAccessErrorWithAroundAdviceLTWNoInline_pr119657() { + runTest("IllegalAccessError with around advice on interface method call using LTW and -XnoInline"); + } + + public void testReflectOnCodeStyleITDs() { + runTest("reflection on itds"); + } + + public void testReflectOnAtAspectJDecP() { + runTest("reflection on @DeclareParents"); + } + + public void testModifierOverrides() { + runTest("modifier overrides"); + } + + public void testAbstractPerThisInAtAspectJ() { + runTest("abstract perthis in @AspectJ"); + } + + public void testNPEInBcelAdviceWithConcreteAspect_pr121385() { + runTest("override protected pointcut in aop.xml concrete aspect"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/AllTestsAspectJ150.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/AllTestsAspectJ150.java new file mode 100644 index 000000000..1d750bb94 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/AllTestsAspectJ150.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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.ajc150; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.aspectj.systemtest.ajc150.ataspectj.AtAjLTWTests; +import org.aspectj.systemtest.ajc150.ataspectj.AtAjMisuseTests; +import org.aspectj.systemtest.ajc150.ataspectj.AtAjSyntaxTests; +import org.aspectj.systemtest.ajc150.ltw.LTWServerTests; +import org.aspectj.systemtest.ajc150.ltw.LTWTests; + +/** + * This pulls together tests we have written for AspectJ 1.5.0 that don't need Java 1.5 to run + */ +public class AllTestsAspectJ150 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ1.5.0 tests"); + // $JUnit-BEGIN$ + suite.addTestSuite(MigrationTests.class); + suite.addTest(Ajc150Tests.suite()); + suite.addTestSuite(SCCSFixTests.class); + + suite.addTest(AccBridgeMethods.suite()); + suite.addTestSuite(CovarianceTests.class); + suite.addTestSuite(Enums.class); + suite.addTest(AnnotationsBinaryWeaving.suite()); + suite.addTest(AnnotationPointcutsTests.suite()); + suite.addTestSuite(VarargsTests.class); + suite.addTestSuite(StaticImports.class); + suite.addTest(AnnotationRuntimeTests.suite()); + suite.addTestSuite(PerTypeWithinTests.class); + + suite.addTest(Autoboxing.suite()); + suite.addTest(Annotations.suite()); + suite.addTest(AnnotationBinding.suite()); + suite.addTest(RuntimeAnnotations.suite()); + + suite.addTest(SuppressedWarnings.suite()); + suite.addTest(DeclareAnnotationTests.suite()); + suite.addTest(GenericsTests.suite()); + suite.addTest(GenericITDsDesign.suite()); + suite.addTest(AtAjSyntaxTests.suite()); + suite.addTest(AtAjMisuseTests.suite()); + suite.addTest(AtAjLTWTests.suite()); + suite.addTest(HasMember.suite()); + + suite.addTestSuite(LTWTests.class); + suite.addTestSuite(LTWServerTests.class); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationBinding.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationBinding.java new file mode 100644 index 000000000..466567641 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationBinding.java @@ -0,0 +1,402 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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.ajc150; + +import java.io.File; +import java.util.List; + +import junit.framework.Test; + +import org.aspectj.asm.AsmManager; +import org.aspectj.asm.IHierarchy; +import org.aspectj.asm.IProgramElement; +import org.aspectj.asm.IRelationship; +import org.aspectj.asm.internal.Relationship; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class AnnotationBinding extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AnnotationBinding.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + // /////////////////////////////////// @ANNOTATION and CALL + + // Very simple annotation binding for 'call() && @annotation()' + public void testCallAnnotationBinding1() { + runTest("call annotation binding 1"); + } + + // 'call() && @annotation()' when the called method has multiple arguments + public void testCallAnnotationBinding2() { + runTest("call annotation binding 2"); + } + + // 'call() && @annotation()' when the called method takes primitive arguments (YUCK!) + public void testCallAnnotationBinding3() { + runTest("call annotation binding 3"); + } + + // 'call() && @annotation()' when runtime type will exhibit different annotation (due to interface implementing) + public void testCallAnnotationBinding4() { + runTest("call annotation binding 4"); + } + + // 'call() && @annotation()' when target doesnt have an annotation ! + public void testCallAnnotationBinding5() { + runTest("call annotation binding 5"); + } + + // 'call() && @annotation()' when runtime type will exhibit different annotation (due to subclassing) + public void testCallAnnotationBinding6() { + runTest("call annotation binding 6"); + } + + // 'call() && @annotation()' using named pointcut + public void testCallAnnotationBinding7() { + runTest("call annotation binding 7"); + } + + // /////////////////////////////////// @TARGET + + // 'call() && @target()' + public void testAtTargetAnnotationBinding1() { + runTest("@target annotation binding 1"); + } + + // 'call() && @target() && @target' + public void testAtTargetAnnotationBinding2() { + runTest("@target annotation binding 2"); + } + + // 'call() && @target()' - using a type hierarchy where some levels are missing annotations + public void testAtTargetAnnotationBinding3() { + runTest("@target annotation binding 3"); + } + + // 'call() && @target()' - using a type hierarchy where some levels are missing annotations + // but the annotation is inherited + public void testAtTargetAnnotationBinding4() { + runTest("@target annotation binding 4"); + } + + // @target() with an annotation in a package + public void testAtTargetAnnotationBinding5() { + runTest("@target annotation binding 5"); + } + + // /////////////////////////////////// @THIS + + // 'call() && @this()' + public void testAtThisAnnotationBinding1() { + runTest("@this annotation binding 1"); + } + + // 'call() && @this() && @this' + public void testAtThisAnnotationBinding2() { + runTest("@this annotation binding 2"); + } + + // 'call() && @this()' - using a type hierarchy where some levels are missing annotations + public void testAtThisAnnotationBinding3() { + runTest("@this annotation binding 3"); + } + + // 'call() && @this()' - using a type hierarchy where some levels are missing annotations + // but the annotation is inherited + public void testAtThisAnnotationBinding4() { + runTest("@this annotation binding 4"); + } + + // '@this() and @target()' used together + public void testAtThisAtTargetAnnotationBinding() { + runTest("@this annotation binding 5"); + } + + // /////////////////////////////////// @ARGS + + // complex case when there are 3 parameters + public void testAtArgs1() { + runTest("@args annotation binding 1"); + } + + // simple case when there is only one parameter + public void testAtArgs2() { + runTest("@args annotation binding 2"); + } + + // simple case when there is only one parameter and no binding + public void testAtArgs3() { + runTest("@args annotation binding 3"); + } + + // complex case binding different annotation kinds + public void testAtArgs4() { + runTest("@args annotation binding 4"); + } + + // check @args and execution() + public void testAtArgs5() { + runTest("@args annotation binding 5"); + } + + // /////////////////////////////////// @ANNOTATION and EXECUTION + + // 'execution() && @annotation()' + public void testExecutionAnnotationBinding1() { + runTest("execution and @annotation"); + } + + // /////////////////////////////////// @ANNOTATION and SET + + // 'set() && @annotation()' + public void testFieldAnnotationBinding1() { + runTest("set and @annotation"); + } + + // 'get() && @annotation()' + public void testFieldAnnotationBinding2() { + runTest("get and @annotation"); + } + + // 'get() && @annotation()' when using array fields + public void testFieldAnnotationBinding3() { + runTest("get and @annotation with arrays"); + } + + // /////////////////////////////////// @ANNOTATION and CTOR-CALL + + // 'ctor-call(new) && @annotation()' + public void testCtorCallAnnotationBinding1() { + runTest("cons call and @annotation"); + } + + // /////////////////////////////////// @ANNOTATION and CTOR-CALL + + // 'ctor-execution() && @annotation()' + public void testCtorExecAnnotationBinding1() { + runTest("cons exe and @annotation"); + } + + // /////////////////////////////////// @ANNOTATION and STATICINITIALIZATION + + // 'staticinitialization() && @annotation()' + public void testStaticInitAnnotationBinding1() { + runTest("staticinit and @annotation"); + } + + // /////////////////////////////////// @ANNOTATION and PREINITIALIZATION + + // 'preinitialization() && @annotation()' + public void testPreInitAnnotationBinding1() { + runTest("preinit and @annotation"); + } + + // /////////////////////////////////// @ANNOTATION and INITIALIZATION + + // 'initialization() && @annotation()' + public void testInitAnnotationBinding1() { + runTest("init and @annotation"); + } + + // /////////////////////////////////// @ANNOTATION and ADVICEEXECUTION + + // 'adviceexecution() && @annotation()' + public void testAdviceExecAnnotationBinding1() { + runTest("adviceexecution and @annotation"); + } + + // /////////////////////////////////// @ANNOTATION and HANDLER + + // 'handler() && @annotation()' + public void testHandlerAnnotationBinding1() { + runTest("handler and @annotation"); + } + + // /////////////////////////////////// @WITHIN + + // '@within()' + public void testWithinBinding1() { + runTest("@within"); + } + + // '@within()' but multiple types around (some annotated) + public void testWithinBinding2() { + runTest("@within - multiple types"); + } + + // /////////////////////////////////// @WITHINCODE + + // '@withincode() && call(* println(..))' + public void testWithinCodeBinding1() { + runTest("@withincode() and call(* println(..))"); + } + + // /////////////////////////////////// @ANNOTATION complex tests + + // Using package names for the types (including the annotation) - NO BINDING + public void testPackageNamedTypesNoBinding() { + runTest("packages and no binding"); + } + + // Using package names for the types (including the annotation) - INCLUDES BINDING + public void testPackageNamedTypesWithBinding() { + runTest("packages and binding"); + } + + // declare parents: @Color * implements Serializable + public void testDeclareParentsWithAnnotatedAnyPattern() { + runTest("annotated any pattern"); + } + + // Should error (in a nice way!) on usage of an annotation that isnt imported + public void testAnnotationUsedButNotImported() { + runTest("annotation not imported"); + } + + // Binding with calls/executions of static methods + public void testCallsAndExecutionsOfStaticMethods() { + runTest("binding with static methods"); + } + + // /////////////////////////////////////////////////////////////////////////////// + // annotation binding with ITDs + + public void testAnnotationBindingAndITDs1() { + runTest("simple binding annotation values where itd method is annotated"); + } + + public void testAnnotationBindingAndITDs2() { + runTest("simple binding annotation values where itd field is annotated"); + } + + public void testAnnotationBindingAndITDs3() { + runTest("simple binding annotation values where itd ctor is annotated"); + } + + public void testAnnotationBindingAndITDs4() { + runTest("simple binding annotation values where itd method is annotated via declare"); + } + + public void testAnnotationBindingAndITDs5() { + runTest("simple binding annotation values where itd field is annotated via declare"); + } + + public void testAnnotationBindingAndITDs6() { + runTest("simple binding annotation values where itd field is annotated multiple times via declare"); + } + + public void testAnnotationBindingAndITDs7() { + runTest("simple binding annotation values where itd ctor is annotated via declare"); + } + + public void testAnnotationBindingAndITDs4_asmtest() { + // AsmManager.setReporting("c:/debug.txt",true,true,true,true); + runTest("simple binding annotation values where itd method is annotated via declare"); + + if (getCurrentTest().canRunOnThisVM()) { + AsmManager asm = AsmManager.lastActiveStructureModel; + IHierarchy top = asm.getHierarchy(); + + IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_ANNOTATION_AT_METHOD, + "declare @method: int A.m() : @Fruit(\"orange\")"); + assertTrue("Couldn't find 'declare @method' element in the tree", ipe != null); + + List<IRelationship> l = asm.getRelationshipMap().get(ipe); + assertTrue("Should have a relationship but does not ", l.size() > 0); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_ANNOTATION_AT_METHOD, + "declare @method: int A.n() : @Fruit(\"banana\")"); + assertTrue("Couldn't find 'declare @method element in the tree", ipe != null); + + l = asm.getRelationshipMap().get(ipe); + assertTrue("Should have a relationship but does not ", l.size() > 0); + + Relationship rel = (Relationship) l.get(0); + assertTrue("Should have 1 target but has " + rel.getTargets().size(), rel.getTargets().size() == 1); + String tgt = (String) rel.getTargets().get(0); + int lineNumber = asm.getHandleProvider().getLineNumberForHandle(tgt); + assertTrue("Should point to line 10 but doesnt: " + lineNumber, lineNumber == 10); + } + } + + public void testAnnotationBindingAndITDs5_asmtest() { + // AsmManager.setReporting("c:/debug.txt",true,true,true,true); + runTest("simple binding annotation values where itd field is annotated via declare"); + + if (getCurrentTest().canRunOnThisVM()) { + AsmManager asm = AsmManager.lastActiveStructureModel; + IHierarchy top = asm.getHierarchy(); + + IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_ANNOTATION_AT_FIELD, + "declare @field: int A.i : @Fruit(\"orange\")"); + assertTrue("Couldn't find 'declare @type' element in the tree", ipe != null); + + List<IRelationship> l = asm.getRelationshipMap().get(ipe); + assertTrue("Should have a relationship but does not ", l.size() > 0); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_ANNOTATION_AT_FIELD, + "declare @field: java.lang.String A.j : @Fruit(\"banana\")"); + assertTrue("Couldn't find 'declare @field element in the tree", ipe != null); + + l = asm.getRelationshipMap().get(ipe); + assertTrue("Should have a relationship but does not ", l.size() > 0); + + Relationship rel = (Relationship) l.get(0); + assertTrue("Should have 1 target but has " + rel.getTargets().size(), rel.getTargets().size() == 1); + String tgt = (String) rel.getTargets().get(0); + int lineNumber = asm.getHandleProvider().getLineNumberForHandle(tgt); + assertTrue("Should point to line 10 but doesnt: " + lineNumber, lineNumber == 10); + + } + } + + public void testAnnotationBindingAndITDs7_asmtest() { + // AsmManager.setReporting("c:/debug.txt",true,true,true,true); + runTest("simple binding annotation values where itd ctor is annotated via declare"); + + if (getCurrentTest().canRunOnThisVM()) { + + AsmManager asm = AsmManager.lastActiveStructureModel; + IHierarchy top = asm.getHierarchy(); + + IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_ANNOTATION_AT_CONSTRUCTOR, + "declare @constructor: A.new(java.lang.String) : @Fruit(\"pear\")"); + assertTrue("Couldn't find 'declare @constructor' element in the tree", ipe != null); + + List<IRelationship> l = asm.getRelationshipMap().get(ipe); + assertTrue("Should have a relationship but does not ", l.size() > 0); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_ANNOTATION_AT_CONSTRUCTOR, + "declare @constructor: A.new(int) : @Fruit(\"orange\")"); + assertTrue("Couldn't find 'declare @constructor element in the tree", ipe != null); + + l = asm.getRelationshipMap().get(ipe); + assertTrue("Should have a relationship but does not ", l.size() > 0); + + Relationship rel = (Relationship) l.get(0); + assertTrue("Should have 1 target but has " + rel.getTargets().size(), rel.getTargets().size() == 1); + String tgt = (String) rel.getTargets().get(0); + int lineNumber = asm.getHandleProvider().getLineNumberForHandle(tgt); + assertTrue("Should point to line 10 but doesnt: " + lineNumber, lineNumber == 10); + + } + } + + public void testAnnotationBindingArgsVerifyError_pr92053() { + runTest("AtArgs causes a VerifyError: Unable to pop operand off an empty stack"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationPointcutsTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationPointcutsTests.java new file mode 100644 index 000000000..4301a44c0 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationPointcutsTests.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + + +/** + * Tests the use of Annotations in pointcuts + */ +public class AnnotationPointcutsTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AnnotationPointcutsTests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + // before(): call(@SimpleAnnotation * *(..)) { } + public void test001_usingAnnotationsInPointcuts() { + runTest("annotation matching on call"); + } + + public void test002_AtAnnotationMatching() { + runTest("at annotation matching"); + } + + public void test003_Within_Code() { + runTest("annotations and within(code)"); + } + + public void test004_Within() { + runTest("annotations and within"); + } + + // TODO extra tests + // 3) @annotation on the different join point kinds, matches with inherited annotation + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationRuntimeTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationRuntimeTests.java new file mode 100644 index 000000000..e1d83a6cc --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationRuntimeTests.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** +* Tests for @this, @target, @args +*/ +public class AnnotationRuntimeTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AnnotationRuntimeTests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + +// No longer a limitation ASC 31Jan05 +// public void test001_BindingWithAtTargetAllowed() { +// CompilationResult cR = binaryWeave("TestingAnnotations.jar","BindingWithAtTarget.aj",0,0); +// List errors = cR.getErrorMessages(); +// RunResult rR = run("TestingAnnotations"); +// System.err.println(rR.getStdErr()); +// } + + public void test002_MustHaveRuntimeRetention() { + runTest("must have runtime retention"); + } + + public void test003_InheritableOrNot() { + runTest("inheritable or not"); + } + + public void test004_CantUseinDecEoW() { + runTest("use of @this/target in deow"); + } + + public void test005_ArgsSuite() { + runTest("@args tests"); + } + + public void test006_CantUseinDecEoW() { + runTest("use of @args in deow"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/Annotations.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/Annotations.java new file mode 100644 index 000000000..f6cea64cb --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/Annotations.java @@ -0,0 +1,171 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class Annotations extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Annotations.class); + } + + protected File getSpecFile() { + return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml"); + } + + public void testCompilingAnnotation() { + runTest("compiling an annotation"); + } + + public void testCompilingAnnotatedFile() { + runTest("compiling annotated file"); + } + + public void testCompilingUsingWithinAndAnnotationTypePattern() { + runTest("annotations and within (src)"); + } + + /** + * We had a bug where annotations were not present in the output class file for methods + * that got woven. This was due to unpacking bugs in LazyMethodGen. This test compiles + * a simple program then checks the annotations were copied across. + */ + public void testBugWithAnnotationsLostOnWovenMethods() throws ClassNotFoundException { + runTest("losing annotations..."); + if (getCurrentTest().canRunOnThisVM()) { + + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"Program"); + Method[] meths = jc.getMethods(); + for (int i = 0; i < meths.length; i++) { + Method method = meths[i]; + if (method.getName().equals("m1")) { + assertTrue("Didn't have annotations - were they lost? method="+method.getName(),method.getAnnotations().length==1); + } + } + } + } + + public void testAnnotatedAnnotations() { + runTest("annotated annotations (@Target)"); + } + + public void testSimpleAnnotatedAspectMembers() { + runTest("simple annotated aspect members"); + } + + public void testAnnotatedAspectMembersWithWrongAnnotationType() { + runTest("simple annotated aspect members with bad target"); + } + + // more implementation work needed before this test passes + public void testAnnotatedITDs() { + runTest("annotated itds"); + } + + public void testAnnotatedITDs2() { + runTest("annotated public itds"); + } + + public void testAnnotatedITDs3() { + runTest("annotated public itds - values"); + } + + public void testAnnotatedITDs4() { + runTest("annotated public itds - multiple complex annotations"); + } + + public void testAnnotatedITDsWithWrongAnnotationType() { + runTest("annotated itds with bad target"); + } + + public void testAnnotatedAdvice() { + runTest("annotated advice"); + } + + public void testAnnotatedAdviceWithWrongAnnotationType() { + runTest("annotated advice with bad target"); + } + + public void testAnnotatedPointcut() { + runTest("annotated pointcut"); + } + + // FIXME asc uncomment this test when parser is opened up +// public void testAnnotatedDeclareStatements() { +// runTest("annotated declare statements"); +// } + + public void testBasicDeclareAnnotation() { + runTest("basic declare annotation parse test"); + } + + public void testAJDKAnnotatingAspects() { + runTest("ajdk: annotating aspects chapter"); + } + + public void testAJDKAnnotatingAspects2() { + runTest("ajdk: annotating aspects chapter, ex 2"); + } + + public void testAnnotationPatterns() { + runTest("ajdk: annotation pattern matching"); + } + + public void testAnnotationTypePatterns() { + runTest("ajdk: annotation type pattern matching"); + } + + public void testAnnotationSigPatterns() { + runTest("ajdk: annotations in sig patterns"); + } + + public void testAnnotationRuntimeMatching() { + runTest("ajdk: runtime annotations"); + } + + public void testAnnotationRetentionChecking() { + runTest("ajdk: @retention checking"); + } + + public void testAnnotationInheritance() { + runTest("ajdk: @inherited"); + } + + public void testAnnotationDEOW() { + runTest("ajdk: deow-ann"); + } + + public void testAnnotationDecp() { + runTest("ajdk: decp-ann"); + } + + public void testAnnotationDecPrecedence() { + runTest("ajdk: dec precedence"); + } + + public void testAnnotationDecAnnotation() { + runTest("ajdk: dec annotation"); + } + + public void testAnnotationsAndITDs() { + runTest("nasty annotation and itds test"); + } + + // helper methods..... + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationsBinaryWeaving.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationsBinaryWeaving.java new file mode 100644 index 000000000..cec4665a7 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/AnnotationsBinaryWeaving.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + + +/** + * Annotations, the rules/tests: + * + * 1. cannot make ITD (C,M or F) on an annotation + * 2. cannot use declare parents to change the super type of an annotation + * 3. cannot use decp to make an annotation type implement an interface + * 4. cannot use decp to dec java.lang.annotation.Annotation as the parent of any type + * 5. cannot extend set of values in an annotation via an ITD like construct + * 6. Compilation error if you explicitly identify an Annotation type. + * 7. Lint warning if a non-explicit type pattern would match an annotation type. + */ +public class AnnotationsBinaryWeaving extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AnnotationsBinaryWeaving.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + // Cannot make ITD (c/m/f) on an annotation + public void test001_itdsOnAnnotationsNotAllowed() { + runTest("no itds on annotation types"); + } + + // Deals with the cases where an explicit type is specified and it is an annotation type + public void test002_decpOnAnnotationNotAllowed_errors() { + runTest("no declare parents on annotation types"); + } + + //Deals with the cases where an wild type pattern is specified and it hits an annotation type + public void test004_decpOnAnnotationNotAllowed_xlints() { + runTest("declare parents wildcards matching annotation types"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/Autoboxing.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/Autoboxing.java new file mode 100644 index 000000000..46a261e24 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/Autoboxing.java @@ -0,0 +1,94 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * 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 implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** +This test must be run under a Java5 VM - so it is *not* currently +in the test suite !!! +*/ +public class Autoboxing extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Autoboxing.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + public void testSimpleBoxing() { + runTest("simple boxing test"); + } + + public void testIntegerBoxing() { + runTest("integer boxing"); + } + + public void testCharacterBoxing() { + runTest("char boxing"); + } + + public void testDoubleBoxing() { + runTest("double boxing"); + } + + public void testFloatBoxing() { + runTest("float boxing"); + } + + public void testShortBoxing() { + runTest("short boxing"); + } + + public void testLongBoxing() { + runTest("long boxing"); + } + + public void testBooleanBoxing() { + runTest("boolean boxing"); + } + + public void testByteBoxing() { + runTest("byte boxing"); + } + + public void testBoxingAfterReturning() { + runTest("boxing in after returning"); + } +// CompilationResult cR = binaryWeave("testcode.jar","AspectAfterReturning.aj",0,0,"-1.5"); +// //System.err.println(cR.getStandardError()); +// assertTrue("Expected six weaving messages but got: "+getWeavingMessages(cR.getInfoMessages()).size(), +// getWeavingMessages(cR.getInfoMessages()).size()==6); +// RunResult rR = run("AspectAfterReturning"); +// int lines = countLines(rR.getStdErr()); +// assertTrue("Expected 6 lines of output but got: #"+lines+":\n"+rR.getStdErr(),lines==6); +// } +// +// public int countLines(String s) { +// int count = 0; +// while (s.indexOf("\n")!=-1) { +// count++; +// s = s.substring(s.indexOf("\n")+1); +// } +// return count; +// } +// +// protected void verify(String output,String lookingFor) { +// assertTrue("Didn't find expected string '"+lookingFor+"' in:\n"+output,output.indexOf(lookingFor)!=-1); +// } +// +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/CovarianceTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/CovarianceTests.java new file mode 100644 index 000000000..662394969 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/CovarianceTests.java @@ -0,0 +1,166 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM Corporation and others. + * 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 implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/* + +class Car {} + +class FastCar extends Car {} + +class Super { + Car getCar() { + return new Car(); + } +} + +class Sub extends Super { + FastCar getCar() { + return new FastCar(); + } +} + +public class CovBaseProgram01 { + public static void main(String[] argv) { + new CovBaseProgram01().run(); + } + + public void run() { + Super instance_super = new Super(); + Sub instance_sub = new Sub(); + + Car c1 = instance_super.getCar(); // Line 26 + Car c2 = instance_sub.getCar(); // Line 27 + } +} + +// Line26: callJPs: call(Car Super.getCar()) +// Line27: callJPs: call(FastCar Sub.getCar()) call(Car Super.getCar()) + + */ + +/** + * Covariance is simply where a type overrides some inherited implementation and narrows the return type. + */ +public class CovarianceTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(CovarianceTests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + private boolean verbose = false; + + + /** + * call(* getCar()) should match both + */ + public void testCOV001() { + runTest("covariance 1"); + } + + + /** + * call(* Super.getCar()) should match both + * + * This test required a change to the compiler. When we are looking at signatures and comparing them we walk up + * the hierarchy looking for supertypes that declare the same method. The problem is that in the comparison for + * whether to methods are compatible we were including the return type - this meant 'Car getCar()' on Super was + * different to 'FastCar getCar()' on Sub - it thought they were entirely different methods. In fact the return + * type is irrelevant here, we just want to make sure the names and the parameter types are the same - so I + * added a parameterSignature to the Member class that looks like '()' where the full signature looks like + * '()LFastCar;' (which includes the return type). If the full signature comparison fails then it looks at the + * parameter signature - I did it that way to try and preserve some performance. I haven't changed the + * definition of 'signature' for a member as trimming the return type off it seems rather serious ! + * + * What might break: + * - 'matches' can now return true for things that have different return types - I guess whether this is a problem + * depends on what the caller of matches is expecting, their code will have been written before covariance was + * a possibility. All the tests pass so I'll leave it like this for now. + */ + public void testCOV002() { + runTest("covariance 2"); + } + + /** + * call(Car getCar()) should match both + * + * Had to implement proper covariance support here... + */ + public void testCOV003() { + runTest("covariance 3"); + } + + /** + * *** Different base program, where Sub does not extend Super. + * call(Car Super.getCar()) should only match first call to getCar() + */ + public void testCOV004() { + runTest("covariance 4"); + } + + /** + * *** Original base program + * call(Car Super.getCar()) should match both + */ + public void testCOV005() { + runTest("covariance 5"); + } + + /** + * call(Car Sub.getCar()) should not match anything + */ + public void testCOV006() { + runTest("covariance 6"); + } + + /** + * call(Car+ Sub.getCar()) should match 2nd call with xlint for the 1st call + */ + public void testCOV007() { + runTest("covariance 7"); + } + + /** + * *** aspect now contains two pointcuts and two pieces of advice + * call(FastCar getCar()) matches on 2nd call + * call(FastCar Sub.getCar()) matches on 2nd call + */ + public void testCOV008() { + runTest("covariance 8"); + } + + /** + * call(FastCar Super.getCar()) matches nothing + */ + public void testCOV009() { + runTest("covariance 9"); + } + + /** + * call(Car+ getCar()) matches both + */ + public void testCOV010() { + runTest("covariance 10"); + } + + public void testAJDKExamples() { + runTest("ajdk: covariance"); + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/DeclareAnnotationTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/DeclareAnnotationTests.java new file mode 100644 index 000000000..28d48c6ca --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/DeclareAnnotationTests.java @@ -0,0 +1,331 @@ +/******************************************************************************* + * Copyright (c) 2005 IBM + * 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 implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; +import java.util.List; + +import junit.framework.Test; + +import org.aspectj.asm.AsmManager; +import org.aspectj.asm.IHierarchy; +import org.aspectj.asm.IProgramElement; +import org.aspectj.asm.IRelationship; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class DeclareAnnotationTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(DeclareAnnotationTests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + // parsing the various forms of declare @ + public void testDeclareAnnotationParsing() { + runTest("basic declare annotation parse test"); + } + + // declare @type + + // declare @type for one simple annotation on one specific type + public void testAtType_OneAnnotationHittingOneType_Src() { + runTest("declare @type 1"); + } + + // declare @type for one simple annotation to multiple types + public void testAtType_OneAnnotationHittingMultipleTypes_Src() { + runTest("declare @type 2"); + } + + // declare @type for one simple annotation and a pointcut that matches on it + public void testAtType_PointcutMatchingOnDeclaredAnnotation() { + runTest("declare @type - with matching pointcut"); + } + + // binary weaving declare @type, one annotation on one type + public void testAtType_OneAnnotationHittingOneType_Bin() { + runTest("declare @type - binary weaving"); + } + + // an annotation with multiple values (all the primitives and string) + // is declared upon a single type + public void testAtType_ComplexAnnotation_BinWeaving() { + runTest("declare @type - complex annotation - binary weaving"); + } + + public void testAtType_ComplexAnnotation_SrcWeaving() { + runTest("declare @type - complex annotation - source weaving"); + } + + // two annotations are declared on a type + public void testAtType_TwoAnnotationsOnOneType_BinWeaving() { + runTest("declare @type - two annotations hit one type - binary weaving"); + } + + public void testAtType_TwoAnnotationsOnOneType_SrcWeaving() { + runTest("declare @type - two annotations hit one type - source weaving"); + } + + // decp and deca can interact, let's try some variants that should + // result in the same thing + public void testAtType_InteractingWithDeclareParents1_BinWeaving() { + runTest("declare @type - declare parents interactions (order 1) - binary weaving"); + } + + public void testAtType_InteractingWithDeclareParents1_SrcWeaving() { + runTest("declare @type - declare parents interactions (order 1) - source weaving"); + } + + public void testAtType_InteractingWithDeclareParents2_BinWeaving() { + runTest("declare @type - declare parents interactions (order 2) - binary weaving"); + } + + public void testAtType_InteractingWithDeclareParents2_SrcWeaving() { + runTest("declare @type - declare parents interactions (order 2) - source weaving"); + } + + public void testAtType_InteractingWithDeclareParents3_BinWeaving() { + runTest("declare @type - declare parents interactions (order 3) - binary weaving"); + } + + public void testAtType_InteractingWithDeclareParents3_SrcWeaving() { + runTest("declare @type - declare parents interactions (order 3) - source weaving"); + } + + public void testAtType_InteractingWithDeclareParents4_BinWeaving() { + runTest("declare @type - declare parents interactions (order 4) - binary weaving"); + } + + public void testAtType_InteractingWithDeclareParents4_SrcWeaving() { + runTest("declare @type - declare parents interactions (order 4) - source weaving"); + } + + public void testAtType_AnnotatingAlreadyAnnotatedType_BinWeaving() { + runTest("declare @type - annotating an already annotated type - binary weaving"); + } + + public void testAtType_AnnotatingAlreadyAnnotatedType_SrcWeaving() { + runTest("declare @type - annotating an already annotated type - source weaving"); + } + + // testing for error messages when exact type patterns used + // public void testAtType_UsingWrongAnnotationOnAType_BinWeaving() + // runTest("declare @type - annotations with different targets - binary weaving"); + // } + public void testAtType_UsingWrongAnnotationOnAType_SrcWeaving() { + runTest("declare @type - annotations with different targets - source weaving"); + } + + // testing for the lint message when non exact patterns used + // public void testAtType_UsingWrongAnnotationOnAType_TypeSpecifiedByPattern_BinWeaving() { + // runTest("declare @type - annotations with different targets (using type patterns) - binary weaving"); + // } + public void testAtType_UsingWrongAnnotationOnAType_TypeSpecifiedByPattern_SrcWeaving() { + runTest("declare @type - annotations with different targets (using type patterns) - source weaving"); + } + + // testing how multiple decAtType/decps interact when they rely on each other + public void testAtType_ComplexDecpDecAtTypeInteractions_BinWeaving() { + runTest("declare @type - complex decp decAtType interactions - binary weaving"); + } + + public void testAtType_ComplexDecpDecAtTypeInteractions_SrcWeaving() { + runTest("declare @type - complex decp decAtType interactions - source weaving"); + } + + public void testAtType_PuttingIncorrectAnnosOnTypes_SrcWeaving() { + runTest("declare @type - trying to put annotation targetting annos on normal types - source weaving"); + } + + public void testAtType_PuttingIncorrectAnnosOnTypes_BinWeaving() { + runTest("declare @type - trying to put annotation targetting annos on normal types - binary weaving"); + } + + public void testAtType_PuttingIncorrectAnnosOnTypesWithPatterns_SrcWeaving() { + runTest("declare @type - trying to put annotation targetting annos on normal types (uses pattern) - source weaving"); + } + + public void testAtType_PuttingIncorrectAnnosOnTypesWithPatterns_BinWeaving() { + runTest("declare @type - trying to put annotation targetting annos on normal types (uses pattern) - binary weaving"); + } + + // I think this fails because of a freaky JDT compiler bug ... + // public void testAtType_UsingClassOrEnumElementValuesInAnnotations_SrcWeaving() { + // runTest("declare @type - covering enum and class element values - source weaving"); + // } + + public void testAtType_UsingClassOrEnumElementValuesInAnnotations_BinWeaving() { + runTest("declare @type - covering enum and class element values - binary weaving"); + } + + // /////////////////////////////////////////////////////////////////////////////// + // declare @field + + public void testAtField_SimpleSource() { + runTest("declare @field - simple source weaving"); + } + + public void testAtField_SimpleBinary() { + runTest("declare @field - simple binary weaving"); + } + + // lint warning + public void testAtField_TwoTheSameOnOneSource() { + runTest("declare @field - two the same on one - source weaving"); + } + + // lint warning + public void testAtField_TwoTheSameOnOneBinary() { + runTest("declare @field - two the same on one - binary weaving"); + } + + public void testAtField_TwoDifferentOnOneSource() { + runTest("declare @field - two different on one - source weaving"); + } + + public void testAtField_TwoDifferentOnOneBinary() { + runTest("declare @field - two different on one - binary weaving"); + } + + public void testAtField_WrongTargetSource() { + runTest("declare @field - wrong target - source weaving"); + } + + // Can't do a test like this - as verification of the declare @ is + // done when the aspect is first compiled. + // public void testAtField_WrongTargetBinary() { + // runTest("declare @field - wrong target - binary weaving"); + // } + + public void testAtField_RightTargetSource() { + runTest("declare @field - right target - source weaving"); + } + + public void testAtField_RightTargetBinary() { + runTest("declare @field - right target - binary weaving"); + } + + public void testAtField_RecursiveSource() { + runTest("declare @field - recursive application - source weaving"); + } + + public void testAtField_RecursiveBinary() { + runTest("declare @field - recursive application - binary weaving"); + } + + public void testAtField_RecursiveOtherOrderSource() { + runTest("declare @field - recursive application (other order) - source weaving"); + } + + public void testAtField_RecursiveOtherOrderBinary() { + runTest("declare @field - recursive application (other order) - binary weaving"); + } + + // /////////////////////////////////////////////////////////////////////////////// + // declare @method + + public void testAtMethod_SimpleSource() { + runTest("declare @method - simple source weaving"); + } + + public void testAtMethod_SimpleBinary() { + runTest("declare @method - simple binary weaving"); + } + + // /////////////////////////////////////////////////////////////////////////////// + // declare @constructor + + public void testAtCtor_SimpleSource() { + runTest("declare @constructor - simple source weaving"); + } + + public void testAtCtor_SimpleBinary() { + runTest("declare @constructor - simple binary weaving"); + } + + // /////////////////////////////////////////////////////////////////////////////// + // declare @method @constructor + + public void testAtMethodCtor_WrongTargetSource() { + runTest("declare @method @ctor - wrong target - source weaving"); + } + + public void testAtMethodCtor_RightTargetSource() { + runTest("declare @method @ctor - right target - source weaving"); + } + + public void testAtMethodCtor_RightTargetBinary() { + runTest("declare @method @ctor - right target - binary weaving"); + } + + // lint warning + public void testAtMethodCtor_TwoTheSameOnOneSource() { + runTest("declare @method @ctor - two the same on one - source weaving"); + } + + // lint warning + public void testAtMethodCtor_TwoTheSameOnOneBinary() { + runTest("declare @method @ctor - two the same on one - binary weaving"); + } + + public void testAtMethodCtor_TwoDifferentOnOneSource() { + runTest("declare @method @ctor - two different on one - source weaving"); + } + + public void testAtMethodCtor_TwoDifferentOnOneBinary() { + runTest("declare @method @ctor - two different on one - binary weaving"); + } + + // to debug this test, uncomment the first line which will give you a nice + // dump of the structure model in c:/debug.txt + public void testStructureModel() { + // AsmManager.setReporting("c:/debug.txt",true,true,true,true); + runTest("declare all annotations on one class - source weaving"); + + if (getCurrentTest().canRunOnThisVM()) { + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + + IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_ANNOTATION_AT_TYPE, + "declare @type: p.q.DeathByAnnotations : @Colored(\"red\")"); + assertTrue("Couldn't find 'declare @type' element in the tree", ipe != null); + + List<IRelationship> l = AsmManager.lastActiveStructureModel.getRelationshipMap().get(ipe); + assertTrue("Should have a relationship but does not ", l != null && l.size() > 0); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_ANNOTATION_AT_METHOD, + "declare @method: * m*(..) : @Fruit(\"tomato\")"); + assertTrue("Couldn't find 'declare @method element in the tree", ipe != null); + + l = AsmManager.lastActiveStructureModel.getRelationshipMap().get(ipe); + assertTrue("Should have a relationship but does not ", l.size() > 0); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_ANNOTATION_AT_CONSTRUCTOR, + "declare @constructor: p.q.DeathByAnnotations.new(..) : @Fruit(\"tomato\")"); + assertTrue("Couldn't find 'declare @constructor element in the tree", ipe != null); + l = AsmManager.lastActiveStructureModel.getRelationshipMap().get(ipe); + assertTrue("Should have a relationship but does not ", l.size() > 0); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_ANNOTATION_AT_FIELD, + "declare @field: * p.q.DeathByAnnotations.* : @Material(\"wood\")"); + assertTrue("Couldn't find 'declare @field element in the tree", ipe != null); + l = AsmManager.lastActiveStructureModel.getRelationshipMap().get(ipe); + assertTrue("Should have a relationship but does not ", l.size() > 0); + } + } + + public void testDeclareTypeMisspelled() { + runTest("declare @Type (should be @type)"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/Enums.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/Enums.java new file mode 100644 index 000000000..7f7f8bac4 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/Enums.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + + +/** + * Enums, the rules/tests: + * + * 1. cannot make ITDC on an enum + * 2. cannot make ITDM or ITDF on an enum + * 3. cannot use declare parents to change the super type of an enum + * 4. cannot use decp to make an enum type implement an interface + * 5. cannot use decp to dec java.lang.Enum as the parent of any type + * 6. cannot extend set of values in an enum via an ITD like construct + * 7. Compilation error if you explicitly identify an Enum type. + * 8. Lint warning if a non-explicit type pattern would match an enum type. + * + */ +public class Enums extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Enums.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + // Cannot make ITDC on an enum + public void test001_itdcsOnEnumNotAllowed() { + runTest("cant itd constructor on enum"); + } + + // Cannot make ITDM or ITDF on an enum + public void test002_itdFieldOrMethodOnEnumNotAllowed() { + runTest("cant itd field or method on enum"); + } + + // Deals with the cases where an explicit type is specified and it is an enum type + public void test003_decpOnEnumNotAllowed_errors() { + runTest("declare parents and enums"); + } + + //Deals with the cases where an wild type pattern is specified and it hits an enum type + public void test004_decpOnEnumNotAllowed_xlints() { + runTest("wildcard enum match in itd"); + } +// CompilationResult cR = binaryWeave("testcode.jar","EnumAspect04.aj",0,2,false); +// IMessage msg = (IMessage)cR.getWarningMessages().get(0); +// assertTrue("Expected a message about an enum type matching a declare parents but being ignored: "+msg, +// msg.toString().indexOf("matches a declare parents type pattern")!=-1); +// msg = (IMessage)cR.getWarningMessages().get(1); +// assertTrue("Expected a message about an enum type matching a declare parents but being ignored: "+msg, +// msg.toString().indexOf("matches a declare parents type pattern")!=-1); +// verifyWeavingMessagesOutput(cR,new String[]{}); +// } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericITDsDesign.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericITDsDesign.java new file mode 100644 index 000000000..6209298c1 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericITDsDesign.java @@ -0,0 +1,254 @@ +package org.aspectj.systemtest.ajc150; + +import java.io.File; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; + +import junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.Attribute; +import org.aspectj.apache.bcel.classfile.Field; +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Signature; +import org.aspectj.apache.bcel.util.ClassPath; +import org.aspectj.apache.bcel.util.SyntheticRepository; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.tools.ajc.Ajc; +import org.aspectj.weaver.ConcreteTypeMunger; +import org.aspectj.weaver.CrosscuttingMembers; +import org.aspectj.weaver.ReferenceType; +import org.aspectj.weaver.ResolvedMember; +import org.aspectj.weaver.ResolvedType; +import org.aspectj.weaver.ResolvedTypeMunger; +import org.aspectj.weaver.TypeVariable; +import org.aspectj.weaver.TypeVariableReference; +import org.aspectj.weaver.World; +import org.aspectj.weaver.bcel.BcelTypeMunger; +import org.aspectj.weaver.bcel.BcelWorld; + +public class GenericITDsDesign extends XMLBasedAjcTestCase { + + private World recentWorld; + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(GenericITDsDesign.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + private void verifyDebugString(ResolvedMember theMember, String string) { + assertTrue("Expected '" + string + "' but found " + theMember.toDebugString(), theMember.toDebugString().equals(string)); + } + + public static JavaClass getClassFromDisk(Ajc ajc, String classname) { + try { + ClassPath cp = new ClassPath(ajc.getSandboxDirectory() + File.pathSeparator + System.getProperty("java.class.path")); + SyntheticRepository sRepos = SyntheticRepository.getInstance(cp); + return sRepos.loadClass(classname); + } catch (ClassNotFoundException e) { + fail("Couldn't find class " + classname + " in the sandbox directory."); + } + return null; + } + + public static Signature getClassSignature(Ajc ajc, String classname) { + JavaClass clazz = getClassFromDisk(ajc, classname); + Signature sigAttr = null; + Attribute[] attrs = clazz.getAttributes(); + for (int i = 0; i < attrs.length; i++) { + Attribute attribute = attrs[i]; + if (attribute.getName().equals("Signature")) { + sigAttr = (Signature) attribute; + } + } + return sigAttr; + } + + // Check the signature attribute on a class is correct + public static void verifyClassSignature(Ajc ajc, String classname, String sig) { + Signature sigAttr = getClassSignature(ajc, classname); + assertTrue("Failed to find signature attribute for class " + classname, sigAttr != null); + assertTrue("Expected signature to be '" + sig + "' but was '" + sigAttr.getSignature() + "'", sigAttr.getSignature() + .equals(sig)); + } + + public List<ConcreteTypeMunger> getTypeMunger(String classname) { + ClassPath cp = new ClassPath(ajc.getSandboxDirectory() + File.pathSeparator + System.getProperty("java.class.path")); + recentWorld = new BcelWorld(cp.toString()); + ReferenceType resolvedType = (ReferenceType) recentWorld.resolve(classname); + CrosscuttingMembers cmembers = resolvedType.collectCrosscuttingMembers(true); + List<ConcreteTypeMunger> tmungers = cmembers.getTypeMungers(); + return tmungers; + } + + private BcelTypeMunger getMungerFromLine(String classname, int linenumber) { + List allMungers = getTypeMunger(classname); + for (Iterator iter = allMungers.iterator(); iter.hasNext();) { + BcelTypeMunger element = (BcelTypeMunger) iter.next(); + if (element.getMunger().getSourceLocation().getLine() == linenumber) { + return element; + } + } + for (Iterator iter = allMungers.iterator(); iter.hasNext();) { + BcelTypeMunger element = (BcelTypeMunger) iter.next(); + System.err.println("Line: " + element.getMunger().getSourceLocation().getLine() + " > " + element); + } + fail("Couldn't find a type munger from line " + linenumber + " in class " + classname); + return null; + } + + public Hashtable<String,Field> getMeTheFields(String classname) { + JavaClass theClass = getClassFromDisk(ajc, classname); + Hashtable<String,Field> retval = new Hashtable<>(); + org.aspectj.apache.bcel.classfile.Field[] fs = theClass.getFields(); + for (int i = 0; i < fs.length; i++) { + Field field = fs[i]; + retval.put(field.getName(), field); + } + return retval; + } + + /* + * test plan: 1. Serializing and recovering 'default bounds' type variable info: a. methods b. fields c. ctors 2. Serializing + * and recovering 'extends' with a class bounded type variable info: a. methods b. fields c. ctors 3. Serializing and recovering + * 'extends' with an interface bounded type variable info: a. methods b. fields c. ctors 4. Multiple interface bounds a. methods + * b. fields c. ctors 5. wildcard bounds '? extends/? super' a. methods b. fields c. ctors 6. using type variables in an ITD + * from the containing aspect, no bounds a. methods b. fields c. ctors + */ + + // Verify: a) After storing it in a class file and recovering it (through deserialization), we can see the type + // variable and that the parameter refers to the type variable. + public void testDesignA() { + runTest("generic itds - design A"); + BcelTypeMunger theBcelMunger = getMungerFromLine("X", 5); + ResolvedType typeC = recentWorld.resolve("C"); + ResolvedTypeMunger rtMunger = theBcelMunger.getMunger(); + ResolvedMember theMember = rtMunger.getSignature(); + // Let's check all parts of the member + assertTrue("Declaring type should be C: " + theMember, theMember.getDeclaringType().equals(typeC)); + + TypeVariable tVar = theMember.getTypeVariables()[0]; + TypeVariableReference tvrt = (TypeVariableReference) theMember.getParameterTypes()[0]; + + theMember.resolve(recentWorld); // resolution will join the type variables together (i.e. make them refer to the same + // instance) + + tVar = theMember.getTypeVariables()[0]; + tvrt = (TypeVariableReference) theMember.getParameterTypes()[0]; + + assertTrue( + "Post resolution, the type variable in the parameter should be identical to the type variable declared on the member", + tVar == tvrt.getTypeVariable()); + } + + // Verify: bounds are preserved and accessible after serialization + public void testDesignB() { + runTest("generic itds - design B"); + BcelTypeMunger theBcelMunger = getMungerFromLine("X", 7); + ResolvedTypeMunger rtMunger = theBcelMunger.getMunger(); + ResolvedMember theMember = rtMunger.getSignature(); + verifyDebugString(theMember, "<T extends java.lang.Number> void C.m0(T)"); + + theBcelMunger = getMungerFromLine("X", 9); + rtMunger = theBcelMunger.getMunger(); + theMember = rtMunger.getSignature(); + verifyDebugString(theMember, "<Q extends I> void C.m1(Q)"); + + theBcelMunger = getMungerFromLine("X", 11); + rtMunger = theBcelMunger.getMunger(); + theMember = rtMunger.getSignature(); + verifyDebugString(theMember, "<R extends java.lang.Number,I> void C.m2(R)"); + } + + // Verify: a) multiple type variables work. + // b) type variables below the 'top level' (e.g. List<A>) are preserved. + public void testDesignC() { + runTest("generic itds - design C"); + BcelTypeMunger theBcelMunger = getMungerFromLine("X", 9); + // System.err.println(theBcelMunger.getMunger().getSignature().toDebugString()); + verifyDebugString(theBcelMunger.getMunger().getSignature(), "<T extends java.lang.Number,Q extends I> void C.m0(T, Q)"); + + theBcelMunger = getMungerFromLine("X", 11); + // System.err.println(theBcelMunger.getMunger().getSignature().toDebugString()); + verifyDebugString(theBcelMunger.getMunger().getSignature(), "<A,B,C> java.util.List<A> C.m1(B, java.util.Collection<C>)"); + } + + // Verify: a) sharing type vars with some target type results in the correct variable names in the serialized form + public void testDesignD() { + runTest("generic itds - design D"); + BcelTypeMunger theBcelMunger = getMungerFromLine("X", 9); + // System.err.println(theBcelMunger.getMunger().getSignature().toDebugString()); + verifyDebugString(theBcelMunger.getMunger().getSignature(), "void C.m0(R)"); + + theBcelMunger = getMungerFromLine("X", 11); + // System.err.println(theBcelMunger.getMunger().getSignature().toDebugString()); + verifyDebugString(theBcelMunger.getMunger().getSignature(), + "java.util.List<Q> C.m0(Q, int, java.util.List<java.util.List<Q>>)"); + } + + // Verify: a) for fields, sharing type vars with some target type results in the correct entries in the class file + public void testDesignE() { + runTest("generic itds - design E"); + BcelTypeMunger theBcelMunger = getMungerFromLine("X", 9); + verifyDebugString(theBcelMunger.getMunger().getSignature(), "java.util.List<Z> C.ln"); + assertTrue("Expected to find \"Z\": " + theBcelMunger.getTypeVariableAliases(), theBcelMunger.getTypeVariableAliases() + .contains("Z")); + + theBcelMunger = getMungerFromLine("X", 11); + verifyDebugString(theBcelMunger.getMunger().getSignature(), "Q C.n"); + assertTrue("Expected to find \"Q\": " + theBcelMunger.getTypeVariableAliases(), theBcelMunger.getTypeVariableAliases() + .contains("Q")); + } + + // Verifying what gets into a class targetted with a field ITD + public void testDesignF() { + runTest("generic itds - design F"); + Hashtable<String,Field> fields = getMeTheFields("C"); + + // Declared in src as: List C.list1; and List<Z> C<Z>.list2; + Field list1 = (Field) fields.get("list1");// ajc$interField$$list1"); + assertTrue("Field list1 should be of type 'Ljava/util/List;' but is " + list1.getSignature(), list1.getSignature().equals( + "Ljava/util/List;")); + Field list2 = (Field) fields.get("list2");// ajc$interField$$list1"); + assertTrue("Field list2 should be of type 'Ljava/util/List;' but is " + list2.getSignature(), list2.getSignature().equals( + "Ljava/util/List;")); + + // Declared in src as: String C.field1; and Q C<Q>.field2; + // bound for second field collapses to Object + Field field1 = (Field) fields.get("field1");// ajc$interField$$field1"); + assertTrue("Field list1 should be of type 'Ljava/lang/String;' but is " + field1.getSignature(), field1.getSignature() + .equals("Ljava/lang/String;")); + Field field2 = (Field) fields.get("field2");// ajc$interField$$field2"); + assertTrue("Field list2 should be of type 'Ljava/lang/Object;' but is " + field2.getSignature(), field2.getSignature() + .equals("Ljava/lang/Object;")); + } + + // Verifying what gets into a class when an interface it implements was targetted with a field ITD + public void testDesignG() { + runTest("generic itds - design G"); + Hashtable<String,Field> fields = getMeTheFields("C"); + + // The ITDs are targetting an interface. That interface is generic and is parameterized with + // 'String' when implemented in the class C. This means the fields that make it into C should + // be parameterized with String also. + + // List<Z> I<Z>.ln; and Q I<Q>.n; + // Field field1 = (Field)fields.get("ajc$interField$X$I$ln"); + // assertTrue("Field list1 should be of type 'Ljava/util/List;' but is "+field1.getSignature(), + // field1.getSignature().equals("Ljava/util/List;")); + // Field field2 = (Field)fields.get("ajc$interField$X$I$n"); + // assertTrue("Field list2 should be of type 'Ljava/lang/String;' but is "+field2.getSignature(), + // field2.getSignature().equals("Ljava/lang/String;")); + } + + // // Verify: a) sharing type vars with some target type results in the correct variable names in the serialized form + // public void testDesignE() { + // runTest("generic itds - design E"); + // + // } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericsTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericsTests.java new file mode 100644 index 000000000..907e3d7a5 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/GenericsTests.java @@ -0,0 +1,996 @@ +package org.aspectj.systemtest.ajc150; + +import java.io.File; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.HashSet; +import java.util.Set; + +import org.aspectj.apache.bcel.classfile.Attribute; +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Signature; +import org.aspectj.apache.bcel.util.ClassPath; +import org.aspectj.apache.bcel.util.SyntheticRepository; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.tools.ajc.Ajc; +import org.aspectj.util.LangUtil; + +import junit.framework.Test; + +public class GenericsTests extends XMLBasedAjcTestCase { + + /*========================================== + * Generics test plan for pointcuts. + * + * handler PASS + * - does not permit type var spec + * - does not permit generic type (fail with type not found) + * - does not permit parameterized types + * if PASS + * - does not permit type vars + * cflow PASS + * - does not permit type vars + * cflowbelow PASS + * - does not permit type vars + * @this PASS + * - does not permit type vars PASS + * - does not permit parameterized type PASS + * @target PASS + * - does not permit type vars PASS + * - does not permit parameterized type PASS + * @args PASS + * - does not permit type vars PASS + * - does not permit parameterized type PASS + * @annotation PASS + * - does not permit type vars PASS + * - does not permit parameterized type PASS + * @within, @within code - as above PASS + * annotation type pattern with generic and parameterized types PASS + * - just make sure that annotation interfaces can never be generic first! VERIFIED + * - @Foo<T> should fail PASS + * - @Foo<String> should fail PASS + * - @(Foo || Bar<T>) should fail DEFERRED (not critical) + * staticinitialization PASS + * - error on parameterized type PASS N/A + * - permit parameterized type + PASS N/A + * - matching with parameterized type + N/A + * - wrong number of parameters in parameterized type PASS N/A + * - generic type with one type parameter N/A + * - generic type with n type parameters N/A + * - generic type with bounds [extends, extends + i/f's] N/A + * - generic type with wrong number of type params N/A + * - wildcards in bounds N/A + * within PASS + * - as above, but allows parameterized type (disallowed in simplified plan) + * - wildcards in type parameters N/A + * this PASS + * - no type vars + * - parameterized types - disallowed in simplification plan + * - implements + * - instanceof + * target PASS + * - as this + * args + * - args(List) matches List, List<T>, List<String> PASS + * - args(List<T>) -> invalid absolute type T + * - args(List<String>) matches List<String> but not List<Number> PASS + * - args(List<String>) matches List with unchecked warning PASS + * - args(List<String>) matches List<?> with unchecked warning PASS + * - args(List<Double>) matches List, List<?>, List<? extends Number> with unchecked warning PASS + * matches List<Double> PASS, List<? extends Double> PASS(with warning) + * - args(List<?>) matches List, List<String>, List<?>, ... PASS + * - args(List<? extends Number) matches List<Number>, List<Double>, not List<String> PASS + * matches List, List<?> with unchecked warning PASS + * - args(List<? super Number>) matches List<Object>, List<Number> + * does not match List<Double> + * matches List, List<?> with unchecked warning + * matches List<? super Number> + * matches List<? extends Object> with unchecked warning + * matches List<? extends Number> with unchecked warning + * get & set PASS + * - parameterized declaring type PASS + * - generic declaring type PASS + * - field type is type variable PASS + * - field type is parameterized PASS + * initialization, preinitialization PASS + * - generic declaring type PASS + * - type variables as params PASS + * - parameterized types as params PASS + * - no join points for init, preinit of parameterized types (as per staticinit) PASS + * withincode PASS + * - no generic or parameterized declaring type patterns PASS + * - no parameterized throws patterns PASS + * - return type as type variable PASS + * - return type as parameterized type PASS + * - parameter as type variable PASS + * - parameter as parameterized type PASS + * - no join points within bridge methods PASS + * execution PASS + * - no generic or parameterized declaring type patterns PASS + * - no parameterized throws patterns PASS + * - return type as type variable PASS + * - return type as parameterized type PASS + * - parameter as type variable PASS + * - parameter as parameterized type PASS + * - no join points for bridge methods PASS + * call PASS + * - no generic or parameterized declaring type patterns PASS + * - no parameterized throws patterns PASS + * - return type as type variable PASS + * - return type as parameterized type PASS + * - parameter as type variable PASS + * - parameter as parameterized type PASS + * - calls to a bridge methods PASS + * after throwing - can't use parameterized type pattern + * after returning - same as for args + */ + + /* ========================================== + * Generics test plan for ITDs. + * + * think about: + * - 'visibility' default/private/public + * - static/nonstatic + * - parameterized ITDs (methods/ctors/fields) + * - ITD target: interface/class/aspect + * - multiple type variables + * - constructor ITDs, method ITDs + * - ITDs sharing type variables with generic types + * - relating to above point, this makes generic ITD fields possible + * - signature attributes for generic ITDs (required? required only for public ITDs?) + * - binary weaving when target type changes over time (might start out 'simple' then sometime later be 'generic') + * - bridge methods - when to create them + * - multiple 'separate' ITDs in a file that share a type variable by 'name' + * - wildcards '?' 'extends' 'super' '&' + * - do type variables assigned to members need to persist across serialization + * - recursive type variable definitions eg. <R extends Comparable<? super R>> + * - super/extends with parameterized types <? extends List<String>> + * - multiple ITDs defined in one type that reuse type variable letters, specifying different bounds + * - generic aspects + * + * PASS parsing generic ITDs + * PASS generic methods + * PASS generic constructors + * PASS ITD visibility + * PASS static/nonstatic + * PASS parameterizedITDs + * PASS differing targets (interface/class/aspect) + * PASS multiple type variables in an ITD + * PASS parsing ITDs that share type variables with target type + * PASS using type variables from the target type in your field ITD + * PASS using type variables from the target type in your method ITD (but no type vars of your own) + * PASS using type variables from the target type in your ctor ITD (but no type vars of your own) + * PASS using type variables from the target type and having your own too (methods) + * PASS using type variables from the target type and having your own too (ctors) + * PASS reusing type variable letter but differing spec across multiple ITDs in one aspect + * PASS wildcards + * PASS recursive type variable definitions + * PASS generic aspects + * PASS parameterizing ITDs with type variables + * PASS using type variables from the target type in your *STATIC* ITD (field/method/ctor) (error scenario) + * PASS basic binary weaving of generic itds + * + * TODO generic aspect binary weaving (or at least multi source file weaving) + * TODO binary weaving with changing types (moving between generic and simple) + * TODO bridge method creation (also relates to covariance overrides..) + * TODO exotic class/interface bounds ('? extends List<String>','? super anything') + * TODO signature attributes for generic ITDs (public only?) + * + */ + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(GenericsTests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + public void testITDReturningParameterizedType() { + runTest("ITD with parameterized type"); + } + + public void testPR91267_1() { + runTest("NPE using generic methods in aspects 1"); + } + + public void testParameterizedTypeAndAroundAdvice_PR115250() { + runTest("parameterized type and around advice"); + } + + public void testParameterizedTypeAndAroundAdvice_PR115250_2() { + runTest("parameterized type and around advice - 2"); + } + + public void testPR91267_2() { + runTest("NPE using generic methods in aspects 2"); + } + + public void testPR91053() { + runTest("Generics problem with Set"); + } + + public void testPR87282() { + runTest("Compilation error on generic member introduction"); + } + + public void testGenericsOverrides_1() { runTest("generics and ITD overrides - 1"); } + public void testGenericsOverrides_2() { runTest("generics and ITD overrides - 2"); } + public void testGenericsOverrides_3() { runTest("generics and ITD overrides - 3"); } + public void testGenericsOverrides_4() { runTest("generics and ITD overrides - 4"); } + + + public void testSelfBoundGenerics_pr117296() { + runTest("self bounding generic types"); + } + + public void testPR88606() { + runTest("Parameterized types on introduced fields not correctly recognized"); + } + + public void testPR97763() { + runTest("ITD method with generic arg"); + } + + public void testGenericsBang_pr95993() { + runTest("NPE at ClassScope.java:660 when compiling generic class"); + } + + + // generic aspects + public void testPR96220_GenericAspects1() {runTest("generic aspects - 1");} + public void testPR96220_GenericAspects2() {runTest("generic aspects - 2");} + public void testPR96220_GenericAspects3() {runTest("generic aspects - 3");} + public void testGenericAspects4() {runTest("generic aspects - 4");} + public void testGenericAspects5() {runTest("generic aspects - 5 (ajdk)");} // in separate files + public void testGenericAspects6() {runTest("generic aspects - 6 (ajdk)");} // all in one file + public void testTypeVariablesInDeclareWarning() { runTest("generic aspect with declare warning using type vars");} + public void testTypeVariablesInExecutionAdvice() { runTest("generic aspect with execution advice using type vars");} + public void testTypeVariablesInAnonymousPointcut() { runTest("generic aspect with anonymous pointcut");} + public void testDeclareParentWithParameterizedInterface() { + runTest("generic aspect declare parents"); + } + public void testDeclareSoftInGenericAspect() { + runTest("generic aspect declare soft"); + } + + ////////////////////////////////////////////////////////////////////////////// + // Generic/Parameterized ITDs - includes scenarios from developers notebook // + ////////////////////////////////////////////////////////////////////////////// + + + // parsing of generic ITD members + public void testParseItdNonStaticMethod() {runTest("Parsing generic ITDs - 1");} + public void testParseItdStaticMethod() {runTest("Parsing generic ITDs - 2");} + public void testParseItdCtor() {runTest("Parsing generic ITDs - 3");} + public void testParseItdComplexMethod() {runTest("Parsing generic ITDs - 4");} + public void testParseItdSharingVars1() {runTest("Parsing generic ITDs - 5");} + public void testParseItdSharingVars2() {runTest("Parsing generic ITDs - 6");} + + + // non static + public void testGenericMethodITD1() {runTest("generic method itd - 1");} // <E> ... (List<? extends E>) + public void testGenericMethodITD2() {runTest("generic method itd - 2");} // <E extends Number> ... (List<? extends E>) called incorrectly + public void testGenericMethodITD3() {runTest("generic method itd - 3");} // <E> ... (List<E>,List<E>) + public void testGenericMethodITD4() {runTest("generic method itd - 4");} // <A,B> ... (List<A>,List<B>) + public void testGenericMethodITD5() {runTest("generic method itd - 5");} // <E> ... (List<E>,List<E>) called incorrectly + public void testGenericMethodITD6() {runTest("generic method itd - 6");} // <E extends Number> ... (List<? extends E>) + public void testGenericMethodITD7() {runTest("generic method itd - 7"); } // <E> ... (List<E>,List<? extends E>) + public void testGenericMethodITD8() {runTest("generic method itd - 8"); } // <E> ... (List<E>,List<? extends E>) called incorrectly + public void testGenericMethodITD9() {runTest("generic method itd - 9"); } // <R extends Comparable<? super R>> ... (List<R>) + public void testGenericMethodITD10() {runTest("generic method itd - 10");} // <R extends Comparable<? super R>> ... (List<R>) called incorrectly + public void testGenericMethodITD11() {runTest("generic method itd - 11");} // <R extends Comparable<? extends R>> ... (List<R>) + public void testGenericMethodITD12() {runTest("generic method itd - 12");} // <R extends Comparable<? extends R>> ... (List<R>) called incorrectly + public void testGenericMethodITD13() {runTest("generic method itd - 13");} // <R extends Comparable<? extends R>> ... (List<R>) called correctly in a clever way ;) + public void testGenericMethodITD14() {runTest("generic method itd - 14");} // <R extends Comparable<? super R>> ... (List<R>) called incorrectly in a clever way + public void testGenericMethodITD15() {runTest("generic method itd - 15");} // <R extends Comparable<? super R>> ... (List<R>) called correctly in a clever way + + + + // generic ctors + public void testGenericCtorITD1() {runTest("generic ctor itd - 1");} // <T> new(List<T>) + public void testGenericCtorITD2() {runTest("generic ctor itd - 2");} // <T> new(List<T>,List<? extends T>) + public void testGenericCtorITD3() {runTest("generic ctor itd - 3");} // <T> new(List<T>,Comparator<? super T>) + + + // parameterized ITDs + public void testParameterizedMethodITD1() {runTest("parameterized method itd - 1");} // (List<? extends Super>) + public void testParameterizedMethodITD2() {runTest("parameterized method itd - 2");} // (List<? extends Number>) called incorrectly + public void testParameterizedMethodITD3() {runTest("parameterized method itd - 3");} // (List<? super A>) called incorrectly + public void testParameterizedMethodITD4() {runTest("parameterized method itd - 4");} // (List<? super B>) + + + // differing visibilities + public void testPublicITDs() {runTest("public itds");} + public void testPublicITDsErrors() {runTest("public itds with errors");} + public void testPrivateITDs() {runTest("private itds");} + public void testPackageITDs() {runTest("package itds");} + + + // targetting different types (interface/class/aspect) + public void testTargettingInterface() {runTest("targetting interface");} + public void testTargettingAspect() {runTest("targetting aspect");} + public void testTargettingClass() {runTest("targetting class");} + + + + // using a type variable from the target generic type in your ITD + public void testFieldITDsUsingTargetTypeVars1() {runTest("field itd using type variable from target type - 1");} + public void testFieldITDsUsingTargetTypeVars2() {runTest("field itd using type variable from target type - 2");} + public void testFieldITDsUsingTargetTypeVars3() {runTest("field itd using type variable from target type - 3");} + public void testFieldITDsUsingTargetTypeVars4() {runTest("field itd using type variable from target type - 4");} + public void testFieldITDsUsingTargetTypeVars5() {runTest("field itd using type variable from target type - 5");} + public void testFieldITDsUsingTargetTypeVars6() {runTest("field itd using type variable from target type - 6");} + public void testFieldITDsUsingTargetTypeVars7() {runTest("field itd using type variable from target type - 7");} + public void testFieldITDsUsingTargetTypeVars8() {runTest("field itd using type variable from target type - 8");} + public void testFieldITDsUsingTargetTypeVars9() {runTest("field itd using type variable from target type - 9");} + public void testFieldITDsUsingTargetTypeVars10(){runTest("field itd using type variable from target type -10");} + public void testFieldITDsUsingTargetTypeVars11(){runTest("field itd using type variable from target type -11");} + public void testFieldITDsUsingTargetTypeVars12(){runTest("field itd using type variable from target type -12");} + public void testFieldITDsUsingTargetTypeVars13(){runTest("field itd using type variable from target type -13");} + public void testFieldITDsUsingTargetTypeVars14(){runTest("field itd using type variable from target type -14");} + public void testFieldITDsUsingTargetTypeVars15(){runTest("field itd using type variable from target type -15");} + public void testFieldITDsUsingTargetTypeVars16(){runTest("field itd using type variable from target type -16");} + public void testFieldITDsUsingTargetTypeVars17(){runTest("field itd using type variable from target type -17");} + + + public void testMethodITDsUsingTargetTypeVarsA1() {runTest("method itd using type variable from target type - A1");} + public void testMethodITDsUsingTargetTypeVarsA2() {runTest("method itd using type variable from target type - A2");} + public void testMethodITDsUsingTargetTypeVarsA3() {runTest("method itd using type variable from target type - A3");} + public void testMethodITDsUsingTargetTypeVarsA4() {runTest("method itd using type variable from target type - A4");} + public void testMethodITDsUsingTargetTypeVarsB1() {runTest("method itd using type variable from target type - B1");} + public void testMethodITDsUsingTargetTypeVarsC1() {runTest("method itd using type variable from target type - C1");} + public void testMethodITDsUsingTargetTypeVarsD1() {runTest("method itd using type variable from target type - D1");} + public void testMethodITDsUsingTargetTypeVarsE1() {runTest("method itd using type variable from target type - E1");} + public void testMethodITDsUsingTargetTypeVarsF1() {runTest("method itd using type variable from target type - F1");} + public void testMethodITDsUsingTargetTypeVarsG1() {runTest("method itd using type variable from target type - G1");} + public void testMethodITDsUsingTargetTypeVarsH1() {runTest("method itd using type variable from target type - H1");} + public void testMethodITDsUsingTargetTypeVarsI1() {runTest("method itd using type variable from target type - I1");} + public void testMethodITDsUsingTargetTypeVarsI2() {runTest("method itd using type variable from target type - I2");} + public void testMethodITDsUsingTargetTypeVarsJ1() {runTest("method itd using type variable from target type - J1");} + public void testMethodITDsUsingTargetTypeVarsK1() {runTest("method itd using type variable from target type - K1");} + public void testMethodITDsUsingTargetTypeVarsL1() {runTest("method itd using type variable from target type - L1");} + public void testMethodITDsUsingTargetTypeVarsM1() {runTest("method itd using type variable from target type - M1");} + public void testMethodITDsUsingTargetTypeVarsM2() {runTest("method itd using type variable from target type - M2");} + public void testMethodITDsUsingTargetTypeVarsN1() {runTest("method itd using type variable from target type - N1");} + public void testMethodITDsUsingTargetTypeVarsO1() {runTest("method itd using type variable from target type - O1");} + public void testMethodITDsUsingTargetTypeVarsO2() {runTest("method itd using type variable from target type - O2");} + public void testMethodITDsUsingTargetTypeVarsP1() {runTest("method itd using type variable from target type - P1");} + public void testMethodITDsUsingTargetTypeVarsQ1() {runTest("method itd using type variable from target type - Q1");} + + public void testCtorITDsUsingTargetTypeVarsA1() {runTest("ctor itd using type variable from target type - A1");} + public void testCtorITDsUsingTargetTypeVarsB1() {runTest("ctor itd using type variable from target type - B1");} + public void testCtorITDsUsingTargetTypeVarsC1() {runTest("ctor itd using type variable from target type - C1");} + public void testCtorITDsUsingTargetTypeVarsD1() {runTest("ctor itd using type variable from target type - D1");} + public void testCtorITDsUsingTargetTypeVarsE1() {runTest("ctor itd using type variable from target type - E1");} + public void testCtorITDsUsingTargetTypeVarsF1() {runTest("ctor itd using type variable from target type - F1");} + public void testCtorITDsUsingTargetTypeVarsG1() {runTest("ctor itd using type variable from target type - G1");} + public void testCtorITDsUsingTargetTypeVarsH1() {runTest("ctor itd using type variable from target type - H1");} + public void testCtorITDsUsingTargetTypeVarsI1() {runTest("ctor itd using type variable from target type - I1");} + + public void testSophisticatedAspectsA() {runTest("uberaspects - A");} + public void testSophisticatedAspectsB() {runTest("uberaspects - B");} + public void testSophisticatedAspectsC() {runTest("uberaspects - C");} + public void testSophisticatedAspectsD() {runTest("uberaspects - D");} + public void testSophisticatedAspectsE() {runTest("uberaspects - E");} + public void testSophisticatedAspectsF() {runTest("uberaspects - F");} + public void testSophisticatedAspectsG() {runTest("uberaspects - G");} + public void testSophisticatedAspectsH() {runTest("uberaspects - H");} + public void testSophisticatedAspectsI() {runTest("uberaspects - I");} + public void testSophisticatedAspectsJ() {runTest("uberaspects - J");} + //public void testSophisticatedAspectsK() {runTest("uberaspects - K");} // FIXME asc bounds testing is tough! + public void testSophisticatedAspectsK2(){runTest("uberaspects - K2");} + public void testSophisticatedAspectsL() {runTest("uberaspects - L");} + public void testSophisticatedAspectsM() {runTest("uberaspects - M");} + public void testSophisticatedAspectsN() {runTest("uberaspects - N");} + public void testSophisticatedAspectsO() {runTest("uberaspects - O");} + public void testSophisticatedAspectsP() {runTest("uberaspects - P");} + public void testSophisticatedAspectsQ() {runTest("uberaspects - Q");} + public void testSophisticatedAspectsR() {runTest("uberaspects - R");} + public void testSophisticatedAspectsS() {runTest("uberaspects - S");} + public void testSophisticatedAspectsT() {runTest("uberaspects - T");} + public void testSophisticatedAspectsU() {runTest("uberaspects - U");} // includes nasty casts + public void testSophisticatedAspectsV() {runTest("uberaspects - V");} // casts are gone + public void testSophisticatedAspectsW() {runTest("uberaspects - W");} + public void testSophisticatedAspectsX() {runTest("uberaspects - X");} // from the AJDK + public void testSophisticatedAspectsY() {runTest("uberaspects - Y");} // pointcut matching + public void testSophisticatedAspectsZ() {runTest("uberaspects - Z");} + + // FIXME asc these two tests have peculiar error messages - generic aspect related +// public void testItdUsingTypeParameter() {runTest("itd using type parameter");} +// public void testItdIncorrectlyUsingTypeParameter() {runTest("itd incorrectly using type parameter");} + + + public void testUsingSameTypeVariable() {runTest("using same type variable in ITD");} + + public void testBinaryWeavingITDsA() {runTest("binary weaving ITDs - A");} + public void testBinaryWeavingITDsB() {runTest("binary weaving ITDs - B");} + public void testBinaryWeavingITDs1() {runTest("binary weaving ITDs - 1");} + public void testBinaryWeavingITDs2() {runTest("binary weaving ITDs - 2");} + public void testBinaryWeavingITDs3() {runTest("binary weaving ITDs - 3");} + public void testGenericITFSharingTypeVariable() {runTest("generic intertype field declaration, sharing type variable");} + + + // general tests ... usually just more complex scenarios + public void testReusingTypeVariableLetters() {runTest("reusing type variable letters");} + public void testMultipleGenericITDsInOneFile() {runTest("multiple generic itds in one file");} + public void testItdNonStaticMember() {runTest("itd of non static member");} + public void testItdStaticMember() {runTest("itd of static member");} + public void testStaticGenericMethodITD() {runTest("static generic method itd");} + + + public void testAtOverride0() {runTest("atOverride used with ITDs");} + public void testAtOverride1() {runTest("atOverride used with ITDs - 1");} + public void testAtOverride2() {runTest("atOverride used with ITDs - 2");} + public void testAtOverride3() {runTest("atOverride used with ITDs - 3");} + public void testAtOverride4() {runTest("atOverride used with ITDs - 4");} + public void testAtOverride5() {runTest("atOverride used with ITDs - 5");} + public void testAtOverride6() {runTest("atOverride used with ITDs - 6");} + public void testAtOverride7() {runTest("atOverride used with ITDs - 7");} + + + // bridge methods + public void testITDBridgeMethodsCovariance1() {runTest("bridging with covariance 1 - normal");} + public void testITDBridgeMethodsCovariance2() {runTest("bridging with covariance 1 - itd");} + public void testITDBridgeMethods1Normal() {runTest("basic bridging with type vars - 1 - normal");} + public void testITDBridgeMethods1Itd() {runTest("basic bridging with type vars - 1 - itd");} + public void testITDBridgeMethods2Normal() {runTest("basic bridging with type vars - 2 - normal");} + public void testITDBridgeMethods2Itd() {runTest("basic bridging with type vars - 2 - itd");} + public void testITDBridgeMethodsPr91381() {runTest("Abstract intertype method and covariant returns");} + + + // Just normal source compile of two types with a method override between them + public void testGenericITDsBridgeMethods1() { + runTest("bridge methods - 1"); + checkMethodsExist("Sub1",new String[]{ + "java.lang.Integer Sub1.m()", + "java.lang.Object Sub1.m() [BridgeMethod]"}); + } + // Now the same thing but the aspect (which doesn't do much!) is binary woven in. + public void testGenericITDsBridgeMethods1binary() { + runTest("bridge methods - 1 - binary"); + checkMethodsExist("Sub1",new String[]{ + "java.lang.Integer Sub1.m()", + "java.lang.Object Sub1.m() [BridgeMethod]"}); + } + // Now the method is put into the superclass via ITD - there should be a bridge method in the subclass + public void testGenericITDsBridgeMethods2() { + runTest("bridge methods - 2"); + checkMethodsExist("Sub2",new String[]{ + "java.lang.Integer Sub2.m()", + "java.lang.Object Sub2.m() [BridgeMethod]"}); + } + // Now the superclass ITD is done with binary weaving so the weaver (rather than compiler) has to create the bridge method + public void testGenericITDsBridgeMethods2binary() { + runTest("bridge methods - 2 - binary"); + checkMethodsExist("Sub2",new String[]{ + "java.lang.Integer Sub2.m()", + "java.lang.Object Sub2.m() [BridgeMethod]"}); + } + // Now the method is put into the subclass via ITD - there should be a bridge method alongside it in the subclass + public void testGenericITDsBridgeMethods3() { + runTest("bridge methods - 3"); + checkMethodsExist("Sub3",new String[]{ + "java.lang.Integer Sub3.m()", + "java.lang.Object Sub3.m() [BridgeMethod]"}); + } + // Now the subclass ITD is done with binary weaving - the weaver should create the necessary bridge method + public void testGenericITDsBridgeMethods3binary() { + runTest("bridge methods - 3 - binary"); + checkMethodsExist("Sub3",new String[]{ + "java.lang.Integer Sub3.m()", + "java.lang.Object Sub3.m() [BridgeMethod]"}); + } + // Now the two types are disconnected until the aspect supplies a declare parents relationship - + // the bridge method should still be created in the subtype + public void testGenericITDSBridgeMethods4() { + runTest("bridge methods - 4"); + checkMethodsExist("Sub4",new String[]{ + "java.lang.Integer Sub4.m()", + "java.lang.Object Sub4.m() [BridgeMethod]"}); + } + // now the aspect doing the decp between the types is applied via binary weaving - weaver should create the bridge method + public void testGenericITDSBridgeMethods4binary() { + runTest("bridge methods - 4 - binary"); + checkMethodsExist("Sub4",new String[]{ + "java.lang.Integer Sub4.m()", + "java.lang.Object Sub4.m() [BridgeMethod]"}); + } + + public void testBinaryBridgeMethodsOne() { + runTest("binary bridge methods - one"); + checkMethodsExist("OneB",new String[]{ + "java.lang.Number OneB.firstMethod() [BridgeMethod]", + "java.lang.Integer OneB.firstMethod()", + "void OneB.secondMethod(java.lang.Number) [BridgeMethod]", + "void OneB.secondMethod(java.lang.Integer)", + "void OneB.thirdMethod(java.lang.Number,java.lang.Number) [BridgeMethod]", + "void OneB.thirdMethod(java.lang.Integer,java.lang.Integer)", + "void OneB.fourthMethod(java.util.List)", + "java.lang.Number OneB.fifthMethod(java.lang.Number,java.util.List) [BridgeMethod]", + "java.lang.Integer OneB.fifthMethod(java.lang.Integer,java.util.List)" + }); + } + public void testBinaryBridgeMethodsTwo() { + runTest("binary bridge methods - two"); + checkMethodsExist("TwoB",new String[]{ + "java.lang.Number TwoB.firstMethod(java.io.Serializable) [BridgeMethod]", + "java.lang.Integer TwoB.firstMethod(java.lang.String)" + }); + } + public void testBinaryBridgeMethodsThree() { + runTest("binary bridge methods - three"); + checkMethodsExist("ThreeB",new String[]{ + "java.lang.Number ThreeB.m() [BridgeMethod]", + "java.lang.Double ThreeB.m()" + }); + } + + + public void testGenericITDsBridgeMethodsPR91381() {runTest("abstract intertype methods and covariant returns");} + public void testGenericITDsBridgeMethodsPR91381_2() {runTest("abstract intertype methods and covariant returns - error");} + + // ---------------------------------------------------------------------------------------- + // generic declare parents tests + // ---------------------------------------------------------------------------------------- + + public void testPR96220_GenericDecp() { + runTest("generic decp - simple"); + checkOneSignatureAttribute(ajc,"Basic"); + verifyClassSignature(ajc,"Basic","Ljava/lang/Object;LJ<Ljava/lang/Double;>;LI<Ljava/lang/Double;>;"); + } + + // Both the existing type decl and the one adding via decp are parameterized + public void testGenericDecpMultipleVariantsOfAParameterizedType1() { + runTest("generic decp - implementing two variants #1"); + } + + // Existing type decl is raw and the one added via decp is parameterized + public void testGenericDecpMultipleVariantsOfAParameterizedType2() { + runTest("generic decp - implementing two variants #2"); + } + + // Existing type decl is parameterized and the one added via decp is raw + public void testGenericDecpMultipleVariantsOfAParameterizedType3() { + runTest("generic decp - implementing two variants #3"); + } + + // decp is parameterized but it does match the one already on the type + public void testGenericDecpMultipleVariantsOfAParameterizedType4() { + runTest("generic decp - implementing two variants #4"); + } + + // same as above four tests for binary weaving + public void testGenericDecpMultipleVariantsOfAParameterizedType1_binaryWeaving() { + runTest("generic decp binary - implementing two variants #1"); + } + + public void testGenericDecpMultipleVariantsOfAParameterizedType2_binaryWeaving() { + runTest("generic decp binary - implementing two variants #2"); + } + + // Existing type decl is parameterized and the one added via decp is raw + public void testGenericDecpMultipleVariantsOfAParameterizedType3_binaryWeaving() { + runTest("generic decp binary - implementing two variants #3"); + } + + // decp is parameterized but it does match the one already on the type + public void testGenericDecpMultipleVariantsOfAParameterizedType4_binaryWeaving() { + runTest("generic decp binary - implementing two variants #4"); + } + + public void testGenericDecpParameterized() { + runTest("generic decp - with parameterized on the target"); + checkOneSignatureAttribute(ajc,"Basic6"); + verifyClassSignature(ajc,"Basic6","<J:Ljava/lang/Object;>Ljava/lang/Object;LI<TJ;>;LK<Ljava/lang/Integer;>;"); + } + + public void testGenericDecpIncorrectNumberOfTypeParams() { + runTest("generic decp - incorrect number of type parameters"); + } + + public void testGenericDecpSpecifyingBounds() { + runTest("generic decp - specifying bounds"); + } + + public void testGenericDecpViolatingBounds() { + runTest("generic decp - specifying bounds but breaking them"); + } + + // need separate compilation test to verify signatures are ok +// +// public void testIllegalGenericDecp() { +// runTest("illegal generic decp"); +// } +// +// public void testPR95992_TypeResolvingProblemWithGenerics() { +// runTest("Problems resolving type name inside generic class"); +// } + + + // -- Pointcut tests... + + public void testHandlerWithGenerics() { + runTest("handler pcd and generics / type vars"); + } + + public void testPointcutsThatDontAllowTypeVars() { + runTest("pointcuts that dont allow type vars"); + } + + public void testParameterizedTypesInAtPCDs() { + runTest("annotation pcds with parameterized types"); + } + + public void testAnnotationPatternsWithParameterizedTypes() { + runTest("annotation patterns with parameterized types"); + } + + public void testStaticInitializationWithParameterizedTypes() { + runTest("staticinitialization and parameterized types"); + } + + // no longer a valid test with generics simplication +// public void testStaticInitializationMatchingWithParameterizedTypes() { +// runTest("staticinitialization and parameterized type matching"); +// } + +// no longer a valid test in simplified design +// public void testStaticInitializationWithGenericTypes() { +// runTest("staticinitialization with generic types"); +// } + +// no longer a valid test in simplified design +// public void testStaticInitializationWithGenericTypesAdvanced() { +// runTest("staticinitialization with generic types - advanced"); +// } + + public void testWithinPointcutErrors() { + runTest("within pcd with various parameterizations and generic types - errors"); + } + + public void testWithinPointcutWarnings() { + runTest("within pcd with various parameterizations and generic types - warnings"); + } + + public void testThisTargetPointcutErrors() { + runTest("this and target with various parameterizations and generic types - errors"); + } + + public void testThisTargetPointcutRuntime() { + runTest("this and target with various parameterizations and generic types - runtime"); + } + + public void testInitAndPreInitPointcutErrors() { + runTest("init and preinit with parameterized declaring types"); + } + + public void testInitAndPreInitPointcutMatchingWithGenericDeclaringTypes() { + runTest("init and preinit with raw declaring type pattern"); + } + + public void testInitAndPreInitPointcutMatchingWithParameterizedParameterTypes() { + runTest("init and preinit with parameterized parameter types"); + } + + public void testWithinCodePointcutErrors() { + runTest("withincode with various parameterizations and generic types - errors"); + } + + public void testWithinCodeMatching() { + runTest("withincode with various parameterizations and generic types - matching"); + } + + public void testWithinCodeOverrideMatchingWithGenericMembers() { + runTest("withincode with overriding of inherited generic members"); + } + + public void testExecutionWithRawType() { + runTest("execution pcd with raw type matching"); + } + + public void testExecutionWithRawSignature() { + runTest("execution pcd with raw signature matching"); + } + + public void testExecutionPointcutErrors() { + runTest("execution with various parameterizations and generic types - errors"); + } + + public void testExecutionMatching() { + runTest("execution with various parameterizations and generic types - matching"); + } + + public void testExecutionOverrideMatchingWithGenericMembers() { + runTest("execution with overriding of inherited generic members"); + } + + public void testCallPointcutErrors() { + runTest("call with various parameterizations and generic types - errors"); + } + + public void testCallMatching() { + runTest("call with various parameterizations and generic types - matching"); + } + + public void testCallOverrideMatchingWithGenericMembers() { + runTest("call with overriding of inherited generic members"); + } + + public void testCallWithBridgeMethods() { + runTest("call with bridge methods"); + } + + public void testGetAndSetPointcutErrors() { + runTest("get and set with various parameterizations and generic types - errors"); + } + + public void testGetAndSetPointcutMatchingWithGenericAndParameterizedTypes() { + runTest("get and set with various parameterizations and generic declaring types"); + } + + public void testGetAndSetPointcutMatchingWithGenericAndParameterizedFieldTypes() { + runTest("get and set with various parameterizations and generic field types"); + } + + public void testArgsWithRawType() { + runTest("args with raw type and generic / parameterized sigs"); + } + + public void testArgsParameterizedType() { + runTest("args with parameterized type and generic / parameterized sigs"); + } + + public void testArgsParameterizedAndWildcards() { + runTest("args with parameterized type and wildcards"); + } + + public void testArgsWithWildcardVar() { + runTest("args with generic wildcard"); + } + + public void testArgsWithWildcardExtendsVar() { + runTest("args with generic wildcard extends"); + } + + public void testArgsWithWildcardSuperVar() { + runTest("args with generic wildcard super"); + } + + public void testGenericMethodMatching() { + runTest("generic method matching"); + } + + public void testGenericWildcardsInSignatureMatching() { + runTest("generic wildcards in signature matching"); + } + + public void testAfterThrowing() { + runTest("after throwing with parameterized throw type"); + } + + public void testAfterReturningWithRawType() { + runTest("after returning with raw type and generic / parameterized sigs"); + } + + public void testAfterReturningParameterizedType() { + runTest("after returning with parameterized type and generic / parameterized sigs"); + } + + public void testAfterReturningParameterizedAndWildcards() { + runTest("after returning with parameterized type and wildcards"); + } + + public void testAfterReturningWithWildcardVar() { + if (LangUtil.is19VMOrGreater()) { + // See ReferenceType.isCoerceableFrom comments + return; + } + // Something to investigate here. The implementation of isCoerceable + runTest("after returning with generic wildcard"); + } + + public void testAfterReturningWithWildcardExtendsVar() { + runTest("after returning with generic wildcard extends"); + } + + public void testAfterReturningWithWildcardSuperVar() { + runTest("after returning with generic wildcard super"); + } + + public void testAJDKErasureMatchingExamples() { + runTest("ajdk notebook: erasure matching examples"); + } + + public void testAJDKParameterizedMatchingSimpleExamples() { + runTest("ajdk notebook: simple parameterized type matching examples"); + } + + public void testAJDKMixedTypeVarsAndParametersExample() { + runTest("ajdk notebook: mixed parameterized types and generic methods"); + } + + public void testAJDKSignatureAndWildcardExamples() { + runTest("ajdk notebook: signature matching with generic wildcards"); + } + + // had to remove at e37 level - although pointcuts are likely to work, we can't compile the code + // that invokes the bridge methods - seems the compiler is too smart and won't let them through. +// public void testAJDKBridgeMethodExamples() { +// runTest("ajdk notebook: bridge method examples"); +// } + + public void testAJDKArgsExamples() { + runTest("ajdk notebook: args examples"); + } + + public void testAJDKArgsAndWildcardsExamples() { + runTest("ajdk notebook: args and wildcards examples"); + } + + public void testAJDKAfterReturningExamples() { + runTest("ajdk notebook: after returning examples"); + } + + public void testAJDKPointcutInGenericClassExample() { + runTest("ajdk notebook: pointcut in generic class example"); + } + + // TESTS for generic abstract aspects that get extended and parameterized... + + public void testStaticPointcutParameterization() { + runTest("static pointcut parameterization suite"); + } + + public void testDynamicPointcutParameterization() { + runTest("dynamic pointcut parameterization suite"); + } + + public void testReferenceToPointcutInGenericClass() { + runTest("reference to pointcut in generic class"); + } + + public void testReferenceToPointcutInGenericClass2() { + runTest("reference to non-parameterized pointcut in generic class"); + } + + public void testDeclareParentsParameterized() { + runTest("declare parents parameterized"); + } + + public void testDeclarePrecedenceParameterized() { + runTest("declare precedence parameterized"); + } + + public void testDeclareAnnotationParameterized() { + runTest("declare annotation parameterized"); + } + + public void testMultiLevelGenericAspects() { + runTest("multi-level generic abstract aspects"); + } + + // --- helpers + + /** + * When a class has been written to the sandbox directory, you can ask this method to + * verify it contains a particular set of methods. Typically this is used to verify that + * bridge methods have been created. + */ + public void checkMethodsExist(String classname,String[] methods) { + Set<String> methodsFound = new HashSet<>(); + StringBuffer debugString = new StringBuffer(); + try { + ClassLoader cl = new URLClassLoader(new URL[]{ajc.getSandboxDirectory().toURL()}); + Class<?> clz = Class.forName(classname,false,cl); + java.lang.reflect.Method[] ms = clz.getDeclaredMethods(); + if (ms!=null) { + for (int i =0;i<ms.length;i++) { + String methodString = ms[i].getReturnType().getName()+" "+ms[i].getDeclaringClass().getName()+"."+ + ms[i].getName()+"("+stringify(ms[i].getParameterTypes())+")"+ + (isBridge(ms[i])?" [BridgeMethod]":""); + methodsFound.add(methodString); + debugString.append("\n[").append(methodString).append("]"); + } + } + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + + // check the methods specified do exist + for (int i = 0; i < methods.length; i++) { + String string = methods[i]; + if (!methodsFound.remove(string)) { + fail("Couldn't find ["+string+"] in the set of methods in "+classname+" => "+debugString); + } + } + StringBuffer unexpectedMethods = new StringBuffer(); + if (!methodsFound.isEmpty()) { + for (String element: methodsFound) { + unexpectedMethods.append("[").append(element).append("]"); + } + fail("These methods weren't expected: "+unexpectedMethods); + } + + } + + /** + * Use 1.5 API isBridge if available. + * See JLS3 15.12.4.5 Create Frame, Synchronize, Transfer Control + */ + public static boolean isBridge(java.lang.reflect.Method m) { + // why not importing java.lang.reflect.Method? No BCEL clash? + if (!LangUtil.is15VMOrGreater()) { + return false; + } + try { + final Class<?>[] noparms = new Class[0]; + java.lang.reflect.Method isBridge + = java.lang.reflect.Method.class.getMethod("isBridge", noparms); + Boolean result = (Boolean) isBridge.invoke(m, new Object[0]); + return result.booleanValue(); + } catch (Throwable t) { + return false; + } + } + public static JavaClass getClass(Ajc ajc, String classname) { + try { + ClassPath cp = + new ClassPath(ajc.getSandboxDirectory() + File.pathSeparator + System.getProperty("java.class.path")); + SyntheticRepository sRepos = SyntheticRepository.getInstance(cp); + JavaClass clazz = sRepos.loadClass(classname); + return clazz; + } catch (ClassNotFoundException e) { + fail("Couldn't find class "+classname+" in the sandbox directory."); + } + return null; + } + + public static Signature getClassSignature(Ajc ajc,String classname) { + JavaClass clazz = getClass(ajc,classname); + Signature sigAttr = null; + Attribute[] attrs = clazz.getAttributes(); + for (int i = 0; i < attrs.length; i++) { + Attribute attribute = attrs[i]; + if (attribute.getName().equals("Signature")) sigAttr = (Signature)attribute; + } + return sigAttr; + } + + public static void checkOneSignatureAttribute(Ajc ajc,String classname) { + JavaClass clazz = getClass(ajc,classname); + Attribute[] attrs = clazz.getAttributes(); + int signatureCount = 0; + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < attrs.length; i++) { + Attribute attribute = attrs[i]; + if (attribute.getName().equals("Signature")) { + signatureCount++; + sb.append("\n"+((Signature)attribute).getSignature()); + } + } + if (signatureCount>1) fail("Should be only one signature attribute but found "+signatureCount+sb.toString()); + } + + // Check the signature attribute on a class is correct + public static void verifyClassSignature(Ajc ajc,String classname,String sig) { + Signature sigAttr = getClassSignature(ajc,classname); + assertTrue("Failed to find signature attribute for class "+classname,sigAttr!=null); + assertTrue("Expected signature to be '"+sig+"' but was '"+sigAttr.getSignature()+"'", + sigAttr.getSignature().equals(sig)); + } + + private static String stringify(Class<?>[] clazzes) { + if (clazzes==null) return ""; + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < clazzes.length; i++) { + if (i>0) sb.append(","); + sb.append(clazzes[i].getName()); + } + return sb.toString(); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/HasMember.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/HasMember.java new file mode 100644 index 000000000..57e053b9b --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/HasMember.java @@ -0,0 +1,58 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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: + * Adrian Colyer - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class HasMember extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(HasMember.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + public void testSimpleDecPHasMethod() { + runTest("declare parents : hasmethod(..) - 1"); + } + + public void testSimpleDecPHasMethodInherited() { + runTest("declare parents : hasmethod(..) - 2"); + } + + public void testSimpleDecPHasMethodInheritedPrivate() { + runTest("declare parents : hasmethod(..) - 3"); + } + + // this test not passing yet, ITD integration not implemented +// public void testDecPHasMethodViaITD() { +// runTest("declare parents : hasmethod(..) - 4"); +// } + + public void testSimpleDecPHasField() { + runTest("declare parents : hasfield(..) - 1"); + } + + public void testSimpleDecPHasFieldInherited() { + runTest("declare parents : hasfield(..) - 2"); + } + + public void testSimpleDecPHasFieldInheritedPrivate() { + runTest("declare parents : hasfield(..) - 3"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/MigrationTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/MigrationTests.java new file mode 100644 index 000000000..a9322b086 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/MigrationTests.java @@ -0,0 +1,64 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + + +/** + * Checks if we are obeying migration rules. + */ +public class MigrationTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(MigrationTests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + /** + * Compile a simple java class with an aspect library built with aspectj 1.2.1 - this + * checks that we can load in attributes (especially pointcuts) that were written out + * in the 'old way' + * + */ + public void testMigrationFrom121_pointcutsAndAdvice() { + runTest("load aspectj 1.2.1 aspects in aspectj 5"); +// CompilationResult cR = ajc(baseDir,new String[]{"-aspectpath","aspects121.jar","Program.java"}); +// System.err.println(cR.getStandardError()); +// assertTrue("Should not coredump: "+cR.getStandardError(),cR.getStandardError().indexOf("Dumping to ajcore")==-1); +// assertTrue("Should be no error messages: \n"+cR.getErrorMessages(),cR.getErrorMessages().size()==0); +// File f = new File(ajc.getSandboxDirectory()+File.separator+"Program.class"); +// assertTrue("Missing class file",f.exists()); +// run("Program"); + } + +// /** +// * We cannot support all aspects built prior to AspectJ 1.2.1 - so we don't support any. +// * There are probably many reasons but the first one I've hit is: +// * - Changes for cflow optimizations (counters instead of stacks where we can) mean that an aspect +// * compiled at AspectJ1.2.0 will contain stack cases but AspectJ1.5.0 will look for counter +// * fields in some cases. +// * +// * This means we should get a reasonable failure message in this case. +// */ +// public void testMigrationFrom120_pointcutsAndAdvice() { +// CompilationResult cR = ajc(baseDir,new String[]{"-aspectpath","aspects120.jar","Program.java"}); +// assertTrue("Should have failed",cR.getFailMessages().size()>0); +// assertTrue("Should have produced nice message",cR.getFailMessages().get(0).toString().indexOf("Unable to continue")!=-1); +// } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/PerTypeWithinTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/PerTypeWithinTests.java new file mode 100644 index 000000000..84b014392 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/PerTypeWithinTests.java @@ -0,0 +1,104 @@ +/******************************************************************************* + * Copyright (c) 2005 IBM + * 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.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.tools.ajc.CompilationResult; + + + +public class PerTypeWithinTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(PerTypeWithinTests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + /** + * First few tests: + * + * Five types p.A, p.B, p.C, q.D, q.E and an aspect a.X. + * + * The aspect is pertypewithin(p..*) - this should match A,B,C but not D,E. + * + * Aspect instances should be accessible for A,B,C but not D,E. + * The aspect instances for A,B,C should be different. + * + * hasAspect(), aspectOf() should work. + * + * We test these assumptions in A,B,C,D,E. + */ + public void testDoesItWorkAtAll() { + runTest("basic ptw test"); + } + + public void testCheckHasAspectWorks() { + runTest("ptw hasAspect"); + } + + public void testCheckAspectOfWorks() { + runTest("ptw aspectOf"); + } + /** + * Aspects Q and R match P with a pertypewithin() - they shouldn't clash in any way + * + */ + public void testTwoAspectsHittingOneType() { + runTest("ptw multi-aspects"); + } + + /** + * Checks the use of pertypewithin() doesn't result in extra join points (i.e. the + * infrastructure is properly hidden in ajc$ or synthetic members) + */ + public void testPervasivenessOfWeaving() { + CompilationResult cR = ajc(new File("../tests/java5/pertypewithin"),new String[]{"U.java","-showWeaveInfo"}); + int weavingMessagesFromNormalDeploymentModel = cR.getWeaveMessages().size(); + + cR = ajc(new File("../tests/java5/pertypewithin"),new String[]{"V.java","-showWeaveInfo"}); + int weavingMessagesFromPerTypeWithin = cR.getWeaveMessages().size(); + + assertEquals("Expected same number of messages regardless of perclause", + weavingMessagesFromNormalDeploymentModel,weavingMessagesFromPerTypeWithin); + } + + + public void testBinaryWeaving_ClassesAreBinary() { + runTest("ptw binary"); + } + + public void testBinaryWeaving_AspectsAreBinary() { + runTest("ptw binary aspect"); + } + + public void testAJDKExamples() { + runTest("ajdk: ptw"); + } +// // Compile the aspect H.java into classes3 +// CompilationResult cR = ajc(new File("../tests/java5/pertypewithin"),new String[]{"H.java","-outjar","aspects.jar"}); +// setShouldEmptySandbox(false); +// // Compile the class with H.class as aspectpath, should be binary woven correctly +// cR = ajc(new File("../tests/java5/pertypewithin"),new String[]{"G.java","-aspectpath","aspects.jar"}); +// RunResult rR = run("G"); +// assertTrue("Expected aspect related message 'advice running' in output from G", +// rR.getStdErr().indexOf("advice running")!=-1); +// setShouldEmptySandbox(true); +// } +// +// // binary weaving case ... +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/RuntimeAnnotations.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/RuntimeAnnotations.java new file mode 100644 index 000000000..676c2b014 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/RuntimeAnnotations.java @@ -0,0 +1,138 @@ +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * Checking that runtime visible annotations are visible at runtime (they get into the class file) + */ +public class RuntimeAnnotations extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(RuntimeAnnotations.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + public void test01() { + runTest("public method with declare @method"); + } + + public void test02() { + runTest("public method on the aspect that declares @method on it"); + } + + public void test03() { + runTest("public annotated method"); + } + + public void test04() { + runTest("public ITD method with declare @method"); + } + + public void test05() { + runTest("public annotated ITD method"); + } + + public void test06() { + runTest("public ITD-on-itself method with declare @method"); + } + + public void test07() { + runTest("public annotated ITD-on-itself method"); + } + + public void test08() { + runTest("public method on an Interface with declare @method"); + } + + public void test09() { + runTest("public annotated method on an Interface"); + } + + public void test10() { + runTest("public ITD method onto an Interface with declare @method"); + } + + public void test11() { + runTest("public annotated ITD method onto an Interface"); + } + + public void test12() { + runTest("public abstract method with declare @method"); + } + + public void test13() { + runTest("public abstract method on the aspect that declares @method on it"); + } + + public void test14() { + runTest("public abstract annotated method"); + } + + public void test15() { + runTest("public abstract ITD method with declare @method"); + } + + public void test16() { + runTest("public abstract annotated ITD method"); + } + + public void test17() { + runTest("public abstract ITD-on-itself method with declare @method"); + } + + public void test18() { + runTest("public abstract annotated ITD-on-itself method"); + } + + public void test19() { + runTest("public abstract method on an Interface with declare @method"); + } + + public void test20() { + runTest("public abstract annotated method on an Interface"); + } + + public void test21() { + runTest("public abstract ITD method onto an Interface with declare @method"); + } + + public void test22() { + runTest("public abstract annotated ITD method onto an Interface"); + } + + public void test23() { + runTest("public field with declare @field"); + } + + public void test24() { + runTest("public field on the aspect that declares @field on it"); + } + + public void test25() { + runTest("public annotated field"); + } + + public void test26() { + runTest("public ITD field with declare @field"); + } + + public void test27() { + runTest("public annotated ITD field"); + } + + public void test28() { + runTest("public ITD-on-itself field with declare @field"); + } + + public void test29() { + runTest("public annotated ITD-on-itself field"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/SCCSFixTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/SCCSFixTests.java new file mode 100644 index 000000000..30dba129f --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/SCCSFixTests.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2005 IBM Corporation and others. + * 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: + * Wes Isberg - initial implementation + *******************************************************************************/ + +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import org.aspectj.tools.ajc.AjcTestCase; +import org.aspectj.tools.ajc.CompilationResult; +import org.aspectj.util.FileUtil; + +/** + * SCCS/CVS directory fix. + * Would add to Ajc150TestsNoHarness, but can't share basedir/setup, etc. + */ +public class SCCSFixTests extends AjcTestCase { + File baseDir; + File sourceroot; + + public void setUp() throws Exception { + super.setUp(); + baseDir = FileUtil.getTempDir("BugFixTests"); + sourceroot = new File(baseDir, "sourceroot"); + sourceroot.mkdirs(); + } + public void tearDown() { + FileUtil.deleteContents(baseDir); + } + /** + * @see org/aspectj/util/FileUtil.java 1.17 + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=48650 + */ + public void testSkipCVS() { + doTestSkip("CVS"); + } + + /** + * @see org/aspectj/util/FileUtil.java 1.17 + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=48650 + */ + public void testSkipSCCS() { + doTestSkip("SCCS"); + } + + /** + * Can't check in "CVS" or "SCCS" directories, + * so construct for each test. + */ + private void doTestSkip(String name) { + File dir = new File(sourceroot, name); + sourceroot.mkdirs(); + File file = new File(dir, "Error.java"); + FileUtil.writeAsString(file, "public class Error { here }"); + file = new File(sourceroot, "Main.java"); + FileUtil.writeAsString(file, MAIN); + String[] args = { "-sourceroots", sourceroot.getPath() }; + CompilationResult result = ajc(baseDir, args); + assertNoMessages(result); + RunResult r = run("Main"); + String m = r.getStdOut().trim(); + assertEquals("I ran", m); + } + private static final String MAIN = + "public class Main { public static void main(String[] a) {System.out.println(\"I ran\");}}"; +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/StaticImports.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/StaticImports.java new file mode 100644 index 000000000..71b82f4e4 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/StaticImports.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2005 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: + * Andrew Huff - initial implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class StaticImports extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(StaticImports.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + public void testImportStaticSystemDotOut() { + runTest("import static java.lang.System.out"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/SuppressedWarnings.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/SuppressedWarnings.java new file mode 100644 index 000000000..0a830018e --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/SuppressedWarnings.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class SuppressedWarnings extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(SuppressedWarnings.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + // Check basic suppression + public void testSuppression1() { + runTest("suppressing non-matching advice warnings"); + } + + // Checks source contexts aren't put out incorrectly + // NOTE: Source contexts only come out if the primary source location in a message + // matches the file currently being dealt with. Because advice not matching + // messages come out at the last stage of compilation, you currently only + // get sourcecontext for advice not matching messages that point to places in + // the last file being processed. You do get source locations in all cases - + // you just don't always get context, we could revisit this sometime... + // (see bug 62073 reference in WeaverMessageHandler.handleMessage()) + public void testSuppression2() { + runTest("suppressing non-matching advice warnings when multiple source files involved"); + } + + public void testSuppressionWithCflow_pr93345() { + runTest("XLint warning for advice not applied with cflow(execution)"); + } + + public void testSuppressionOfMessagesIssuedDuringMatching() { + runTest("SuppressAjWarnings raised during matching"); + } +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/VarargsTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/VarargsTests.java new file mode 100644 index 000000000..7592f7c6d --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/VarargsTests.java @@ -0,0 +1,80 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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.ajc150; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + + +/** + * Varargs, the rules/tests: + * + * 1. cannot match on a varargs method by using 'Object[]' in your signature, + * this affects call/execution/initialization/withincode + */ +public class VarargsTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(VarargsTests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc150.xml"); + } + + // check when signature is from a call PCD + // should get message: + // "an array type as the last parameter in a signature does not match on the varargs declared method: <blah>" + public void test001_cantMatchVarargsWithObjectArray_callPCD() { + runTest("varargs not matched by Object[] (call)"); + } + + // check when signature is from an execution PCD + public void test002_cantMatchVarargsWithObjectArray_execPCD() { + runTest("varargs not matched by Object[] (exe)"); + } + + // check when signature is from an initialization PCD + public void test003_cantMatchVarargsWithObjectArray_initPCD() { + runTest("varargs not matched by Object[] (init)"); + } + + // check when signature is from an withincode PCD + public void test003_cantMatchVarargsWithObjectArray_withincodePCD() { + runTest("varargs not matched by Object[] (withincode)"); + } + + // before(): call(* *(Integer...)) { } + public void test_usingVarargsInPointcuts1() { + runTest("call with varargs signature"); + } + + // before(): call(* *(int,Integer...)) { } - slightly more complex pcut + public void test_usingVarargsInPointcuts2() { + runTest("call with varargs multi-signature"); + } + + public void testAJDKExamples() { + runTest("ajdk: varargs"); + } + + public void testStarVarargs() { + runTest("star varargs pattern"); + } + + public void testVarargsWithDotDotInPointcut() { + runTest("Varargs with .. in pointcut"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/test/java/org/aspectj/systemtest/ajc150/ajc150.xml new file mode 100644 index 000000000..9eda00b0c --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ajc150.xml @@ -0,0 +1,6308 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.5.0 Tests --> +<suite> + + <ajc-test dir="bugs150" title="abstract perthis in @AspectJ"> + <compile files="pr121197.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" title="different numbers of type vars"> + <compile files="pr121575.aj" options="-1.5"/> + <run class="pr121575"/> + </ajc-test> + + + <ajc-test dir="bugs150/pr121385" title="mixing aspect styles"> + <compile files="A.java" options="-1.5"/> + <run class="A"/> + </ajc-test> + + <ajc-test dir="java5/generics/tvars" title="different numbers of type vars - 2"> + <compile files="Case1.aj" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void MyClass.read(java.lang.String))' in Type 'MyClass' (Case1.aj:13) advised by before advice from 'MyAspect' (Case1.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/tvars" title="different numbers of type vars - 3"> + <compile files="Case2.aj" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void MyClass.read(java.lang.Number))' in Type 'MyClass' (Case2.aj:13) advised by before advice from 'MyAspect' (Case2.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/tvars" title="different numbers of type vars - 4"> + <compile files="Case3.aj" options="-1.5 -showWeaveInfo"> + <message kind="error" line="9" text="The type MyClass<T,E> must implement the inherited abstract method MyInterface<T>.read(T)"/> + </compile> + </ajc-test> + + + <ajc-test dir="bugs150" title="access to private ITD from nested type"> + <compile files="pr118698.aj"/> + <run class="pr118698"/> + </ajc-test> + + <ajc-test dir="bugs150" title="modifier overrides"> + <compile files="pr119749.aj" options="-1.5"> + <message kind="warning" line="26" text="C E.*()"/> + <message kind="warning" line="25" text="D E.*()"/> + <message kind="warning" line="17" text="aa @Me void m()"/> + <message kind="warning" line="17" text="aa void m() throws Exception"/> + <message kind="warning" line="17" text="aa * *(..) throws Exception"/> + <message kind="warning" line="37" text="aa call void m() throws Exception"/> + <message kind="warning" line="38" text="aa call void m() throws Exception"/> + </compile> + <run class="pr119749"> + <stdout> + <line text="execution(void pr119749.C.m()): execMe[Me]"/> + <line text="execution(void pr119749.C.m()): execEx"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr120826" pr="120826" title="varargs NPE"> + <compile files="TestVarargs.java" options="-1.5"/> + </ajc-test> + + + <ajc-test dir="bugs150/pr112476/case1" title="binary weaving decp broken"> + <compile files="lib/A.java,lib/B.java,lib/C.java" outjar="library.jar" options="-1.5"/> + <!-- library.jar on the aspectpath here just for resolution when compiling SuperC --> + <compile aspectpath="library.jar" files="weaved/SuperC.java" outjar="newsuper.jar" options="-1.5"/> + <compile inpath="library.jar;newsuper.jar" files="weaved/DeclareAspect.aj" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Setting superclass of type 'lib.C' (C.java) to 'weaved.SuperC' (DeclareAspect.aj)"/> + </compile> + <run class="weaved.SuperC"> + <stdout> + <line text="Is [class lib.C] subcass of [class weaved.SuperC]? true"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr114005" title="Annotated ITDFs - 1"> + <compile files="Declaration1.java" options="-1.5"/> + <run class="Declaration1"> + <stdout> + <line text="public java.lang.String Test.firstProperty has annotation:true"/> + <line text="public java.lang.String Test.secondProperty has annotation:true"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="114495" title="parameterized pointcut and advice"> + <compile files="Pr114495.aj" options="-1.5"> + <message kind="warning" line="3" text="going()"/> + </compile> + <run class="Pr114495"> + <stdout> + <line text="A.going()"/> + <line text="AA.going()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="112880" title="double parameter generic abstract type"> + <compile files="Pr112880.aj" options="-1.5"> + </compile> + <run class="Pr112880"> + <stdout> + <line text="method returning C1 or C2"/> + <line text="method returning C1 or C2"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr114005" title="Annotated ITDFs - 2"> + <compile files="Declaration2.java" options="-1.5"/> + <run class="Declaration2"> + <stdout> + <line text="public java.lang.String Test.firstProperty has annotation:true"/> + <line text="public java.lang.String Test.secondProperty has annotation:true"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="114054" title="pertarget and negated pointcut"> + <compile files="Pr114054.aj" options=""/> + <run class="Pr114054"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="121385" title="mixing styles"> + <compile files="pr121385.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/decps" title="decps - 1"> + <compile files="Basic1.java" options="-1.5"/> + <run class="Basic1"/> + </ajc-test> + + <ajc-test dir="java5/decps" title="decps - 1b"> + <compile files="Basic1b.java" options="-1.5"/> + <run class="Basic1b"/> + </ajc-test> + + <ajc-test dir="java5/decps" title="decps - 2"> + <compile files="Basic2.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void X$I.m2())' in Type 'X' (Basic2.java:15) advised by before advice from 'X' (Basic2.java:23)"/> + <message kind="weave" text="Type 'X$I' (Basic2.java) has intertyped method from 'X' (Basic2.java:'void X$I.m2()')"/> + <message kind="weave" text="Extending interface set for type 'Basic2' (Basic2.java) to include 'X$I' (Basic2.java)"/> + <message kind="weave" text="Type 'Basic2' (Basic2.java) has intertyped method from 'X' (Basic2.java:'void X$I.m2()')"/> + <message kind="weave" text="Join point 'method-execution(void Basic2.main(java.lang.String[]))' in Type 'Basic2' (Basic2.java:2) advised by before advice from 'X' (Basic2.java:23)"/> + </compile> + <run class="Basic2"/> + </ajc-test> + + <ajc-test dir="java5/decps" title="decps - 2b"> + <compile files="Basic2b.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void X$IIimpl.m2())' in Type 'X$IIimpl' (Basic2b.java:18) advised by before advice from 'X' (Basic2b.java:27)"/> + <message kind="weave" text="Extending interface set for type 'Basic2b' (Basic2b.java) to include 'X$I' (Basic2b.java)"/> + <message kind="weave" text="Join point 'method-execution(void Basic2b.main(java.lang.String[]))' in Type 'Basic2b' (Basic2b.java:4) advised by before advice from 'X' (Basic2b.java:27)"/> + </compile> + <run class="Basic2b"/> + </ajc-test> + + <ajc-test dir="java5/decps" title="decps - 3"> + <compile files="Basic3.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Extending interface set for type 'Basic3' (Basic3.java) to include 'X$I' (Basic3.java)"/> + <message kind="weave" text="Type 'Basic3' (Basic3.java) has intertyped method from 'X' (Basic3.java:'void X$I.m2()')"/> + <message kind="weave" text="Type 'Basic3' (Basic3.java) has intertyped method from 'X' (Basic3.java:'void X$I.m3()')"/> + <message kind="weave" text="Type 'Basic3' (Basic3.java) has intertyped method from 'X' (Basic3.java:'void X$I.m4()')"/> + <message kind="weave" text="Join point 'method-call(void X$I.m2())' in Type 'Basic3' (Basic3.java:7) advised by before advice from 'X' (Basic3.java:29)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m3())' in Type 'Basic3' (Basic3.java:8) advised by before advice from 'X' (Basic3.java:29)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m2())' in Type 'Basic3' (Basic3.java:9) advised by before advice from 'X' (Basic3.java:29)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m4())' in Type 'Basic3' (Basic3.java:10) advised by before advice from 'X' (Basic3.java:29)"/> + <message kind="weave" text="Type 'X$I' (Basic3.java) has intertyped method from 'X' (Basic3.java:'void X$I.m2()')"/> + <message kind="weave" text="Type 'X$I' (Basic3.java) has intertyped method from 'X' (Basic3.java:'void X$I.m3()')"/> + <message kind="weave" text="Type 'X$I' (Basic3.java) has intertyped method from 'X' (Basic3.java:'void X$I.m4()')"/> + </compile> + <run class="Basic3"/> + </ajc-test> + + <ajc-test dir="java5/decps" title="decps - 3b"> + <compile files="Basic3b.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Extending interface set for type 'Basic3b' (Basic3b.java) to include 'X$I' (Basic3b.java)"/> + <message kind="weave" text="Type 'Basic3b' (Basic3b.java) has intertyped method from 'X' (Basic3b.java:'void X$I.m2()')"/> + <message kind="weave" text="Type 'Basic3b' (Basic3b.java) has intertyped method from 'X' (Basic3b.java:'void X$I.m3()')"/> + <message kind="weave" text="Type 'Basic3b' (Basic3b.java) has intertyped method from 'X' (Basic3b.java:'void X$I.m4()')"/> + <message kind="weave" text="Join point 'method-call(void X$I.m2())' in Type 'Basic3b' (Basic3b.java:7) advised by before advice from 'X' (Basic3b.java:35)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m3())' in Type 'Basic3b' (Basic3b.java:8) advised by before advice from 'X' (Basic3b.java:35)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m2())' in Type 'Basic3b' (Basic3b.java:9) advised by before advice from 'X' (Basic3b.java:35)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m4())' in Type 'Basic3b' (Basic3b.java:10) advised by before advice from 'X' (Basic3b.java:35)"/> + </compile> + <run class="Basic3b"/> + </ajc-test> + + <ajc-test dir="java5/decps" title="decps - 3c"> + <compile files="Basic3c.java" options="-1.5"> + <message kind="error" text="@DeclareParents: defaultImpl="X$IImpl" has a no argument constructor, but it is of incorrect visibility"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr119570" pr="119570" title="spurious override method warning"> + <compile files="NodeImpl.java,INode.java,ParameterizedDP.java" options="-1.5"/> + <run class="bugs.ParameterizedDP"/> + </ajc-test> + + <ajc-test dir="bugs150/pr119570" pr="119570" title="spurious override method warning - 2"> + <compile files="ParameterizedDP.java,NodeImpl.java,INode.java" options="-1.5"/> + <run class="bugs.ParameterizedDP"/> + </ajc-test> + + <ajc-test dir="bugs150/pr119570" pr="119570" title="spurious override method warning - 3"> + <compile files="SimpleTest.java" options="-1.5"/> + <run class="SimpleTest"/> + </ajc-test> + + <ajc-test dir="bugs150/pr120521" pr="120521" title="named pointcut not resolved in pertarget pointcut"> + <compile files="PerTargetSubaspectError.java" options="-1.4"/> + </ajc-test> + + <ajc-test dir="bugs150/pr119210" pr="119210" title="autoboxing around advice - 1"> + <compile files="TestLib.java,ThreadAspectLib.java" options="-1.5"/> + <run class="TestLib"> + <stderr> + <line text="obtaining five, got 3"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119210" pr="119210" title="autoboxing around advice - 2"> + <compile files="TestLib2.java,ThreadAspectLib2.java" options="-1.5"/> + <run class="TestLib2"> + <stderr> + <line text="obtaining five, got 3"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119210" pr="119210" title="autoboxing around advice - 3"> + <compile files="TestLib2.java,ThreadAspectLib2.java" options="-1.4"> + <message kind="error" line="16" text="incompatible return type applying to method-call(java.lang.Integer TestLib2.getFive())"/> + <message kind="error" line="4" text="incompatible return type applying to method-call(java.lang.Integer TestLib2.getFive())"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr119539" pr="119539" title="generic pertypewithin aspect - 1"> + <compile files="GenericPerTypeWithin.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'constructor-execution(void bugs.C.<init>())' in Type 'bugs.C' (GenericPerTypeWithin.java:10) advised by before advice from 'bugs.A' (GenericPerTypeWithin.java:21)"/> + <message kind="weave" text="Join point 'constructor-execution(void bugs.C.<init>())' in Type 'bugs.C' (GenericPerTypeWithin.java:10) advised by before advice from 'bugs.A' (GenericPerTypeWithin.java:20)"/> + </compile> + <run class="bugs.GenericPerTypeWithin"/> + </ajc-test> + + <ajc-test dir="bugs150/pr119539" pr="119539" title="generic pertypewithin aspect - 2"> + <compile files="GenericPerTypeWithin2.java" options="-1.5 -showWeaveInfo"> + <message kind="error" line="24" text="a generic super-aspect must be fully parameterized in an extends clause"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr119539" pr="119539" title="generic pertypewithin aspect - 3"> + <compile files="GenericPerTypeWithin3.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'constructor-execution(void bugs.GenericPerTypeWithin3$C.<init>())' in Type 'bugs.GenericPerTypeWithin3$C' (GenericPerTypeWithin3.java:15) advised by before advice from 'bugs.GenericPerTypeWithin3$A' (GenericPerTypeWithin3.java:10)"/> + <message kind="warning" line="15" text="Singleton.creation()"/> + </compile> + <run class="bugs.GenericPerTypeWithin3"/> + </ajc-test> + + <ajc-test dir="bugs150/pr117854" pr="117854" title="broken switch transform"> + <compile files="BrokenSwitch.java" options=""/> + <run class="BrokenSwitch"/> + </ajc-test> + + <ajc-test dir="bugs150/pr119749" pr="119749" title="incorrect exception signature matching"> + <compile files="InheritedThrows.java" options="-showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void InheritedThrows$NestedClassBoth.m())' in Type 'InheritedThrows$NestedClassBoth' (InheritedThrows.java:24) advised by afterThrowing advice from 'InheritedThrows$A' (InheritedThrows.java:4)"/> + <message kind="weave" text="Join point 'method-execution(void InheritedThrows$NestedClass1.m())' in Type 'InheritedThrows$NestedClass1' (InheritedThrows.java:16) advised by afterThrowing advice from 'InheritedThrows$A' (InheritedThrows.java:4)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr118599" pr="118599" title="ambiguous method when binary weaving - 1"> + <!-- separate compilation was failing --> + <compile files="Attributable.java" outjar="foo.jar" options="-1.5"/> + <compile files="AnAttributedClass.java" aspectpath="foo.jar" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr118599" pr="118599" title="ambiguous method when binary weaving - 2"> + <!-- complete compilation works --> + <compile files="Attributable.java,AnAttributedClass.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="104220" title="adviceexecution join point toString forms"> + <compile files="Pr104220.aj"/> + <run class="Pr104220"> + <stdout> + <line text="adviceexecution"/> + <line text="adviceexecution(void SomeAspect.before())"/> + <line text="adviceexecution(SomeAspect.before())"/> + <line text="adviceexecution(void SomeAspect.before())"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="112756" title="pointcut expression containing 'assert'"> + <compile files="Pr112756.aj" options="-warn:assertIdentifier -Xdev:Pinpoint"/> + </ajc-test> + + <ajc-test dir="bugs150/pr118781" pr="118781" title="verify error with around advice array sigs"> + <compile files="MyMain.java,MyAspect.java,MyClass.java" options="-XnoInline"/> + <run class="blah.MyMain"/> + </ajc-test> + + <ajc-test dir="bugs150/pr117681" pr="117681" title="at declare parents"> + <compile files="Test.java,TestAspect.java,Audit.java,AuditImpl.java" options="-1.5"/> + <run class="Test"/> + </ajc-test> + + <ajc-test dir="bugs150/pr120474" pr="120474" title="Dollar classes"> + <compile files="$ProxyPr120474.java"/> + <compile files="X.aj" options="-outxml -1.4"/> + <run class="$ProxyPr120474" ltw="aop.xml"> + <stdout> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr111667" pr="111667" title="lint for advice sorting"> + <compile files="A.java,X.java,Y.java" options="-1.5 -Xlint:warning"> + <message kind="warning" line="9" text="at this shadow method-execution(void A.m1()) no precedence is specified between advice applying from aspect X and aspect Y [Xlint:unorderedAdviceAtShadow]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr118326" pr="118326" title="illegal initialization - 1"> + <compile files="Foo.java,Bar.java"> + <message kind="error" line="2" text="Type mismatch: cannot convert from null to int"/> + <message kind="error" line="6" text="Type mismatch: cannot convert from Integer to int"/> + <message kind="error" line="8" text="Type mismatch: cannot convert from String to int"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr118326" pr="118326" title="illegal initialization - 2"> + <compile files="Foo.java,Bar.java" options="-1.5"> + <message kind="error" line="2" text="Type mismatch: cannot convert from null to int"/> + <message kind="error" line="8" text="Type mismatch: cannot convert from String to int"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr117296" pr="117296" title="self bounding generic types"> + <compile files="PropertySupport.java" options="-1.5"/> + <run class="PropertySupport"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="113368" title="thisJoinPointStaticPart in if test"> + <compile files="Pr113368.aj"/> + <run class="Pr113368"> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr87525" pr="87525" title="privilege problem with switch"> + <compile files="A.java,B.java"> + <message kind="error" line="5" text="Fields accessible due to an aspect being privileged can not be used in switch statements"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/reflection" title="pointcut parsing with ajc compiled pointcut references"> + <compile files="PointcutLibrary.aj,ReflectOnAjcCompiledPointcuts.java" options="-1.5"></compile> + <run class="ReflectOnAjcCompiledPointcuts" classpath="../lib/bcel/bcel.jar"/> + </ajc-test> + + <ajc-test dir="java5/reflection" title="reflection on itds"> + <compile files="InterTypeDeclarations.aj,ReflectOnCodeStyleITDs.java" options="-1.5 -Xlint:ignore -makeAjReflectable"></compile> + <run class="ReflectOnCodeStyleITDs" classpath="../lib/bcel/bcel.jar"> + <stdout> + <line text="public C.new(int, int, int)"/> + <line text="C.new(int, int)"/> + <line text="private C.new(int)"/> + <line text="private C.new(int)"/> + <line text="public C.new(int, int, int)"/> + <line text="public C.new(int, int, int)"/> + <line text="int C.getY()"/> + <line text="int I.getY()"/> + <line text="public int C.getZ()"/> + <line text="public int I.getZ()"/> + <line text="private int C.getX()"/> + <line text="private int I.getX()"/> + <line text="private int C.getX()"/> + <line text="public int C.getZ()"/> + <line text="public int I.getZ()"/> + <line text="public int C.getZ()"/> + <line text="int C.y"/> + <line text="int I.y"/> + <line text="public int C.z"/> + <line text="public int I.z"/> + <line text="private int C.x"/> + <line text="private int I.x"/> + <line text="private int C.x"/> + <line text="public int C.z"/> + <line text="public int I.z"/> + <line text="public int C.z"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/reflection" title="reflection on @DeclareParents"> + <compile files="AtAspectJDeclareParents.aj,ReflectOnAtAspectJDeclareParents.java" options="-1.5 -Xlint:ignore"></compile> + <run class="ReflectOnAtAspectJDeclareParents" classpath="../lib/bcel/bcel.jar"> + <stdout> + <line text="declare parents : C implements I"/> + <line text="public int I.getX()"/> + <line text="public void I.setX(int)"/> + <line text="public int I.getX()"/> + <line text="public int I.getX()"/> + <line text="public void I.setX(int)"/> + <line text="public int I.getX()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="compatibility/case1" title="generating code for a 1.2.1 runtime - 1"> + <compile files="Simple.java" options="-Xajruntimetarget:1.2"/> + <run class="Simple" classpath="../lib/aspectj/lib/aspectjrt121.jar"/> + </ajc-test> + + <ajc-test dir="compatibility/case2" title="generating code for a 1.2.1 runtime - 2"> + <compile files="TrackingErrors.aj,A.java" options="-Xajruntimetarget:1.2 -Xlint:ignore"/> + <run class="A" classpath="../lib/aspectj/lib/aspectjrt121.jar"/> + </ajc-test> + + <ajc-test dir="java5/reflection" title="arg names in advice annotations"> + <compile files="AdviceWithArgs.aj" options="-1.5"></compile> + <run class="AdviceWithArgs"/> + </ajc-test> + + + <ajc-test dir="java5/reflection" pr="114322" title="reflection on abstract ITDs (Billing example)"> + <compile files="ReflectBilling.java,Billing.aj" options="-1.5 -makeAjReflectable"/> + <run class="ReflectBilling"> + <stdout> + <line text="public void Customer.addCharge(long)"/> + <line text="public long Local.callRate()"/> + <line text="public long LongDistance.callRate()"/> + <line text="public abstract long Connection.callRate()"/> + <line text="public Customer Connection.payer"/> + <line text="public long Customer.totalCharge"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="103157" title="returning(Object) binding"> + <compile files="Pr103157.aj" options="-1.4"/> + <run class="Pr103157"> + <stdout> + <line text="returning from staticinit"/> + <line text="returning from preinit"/> + <line text="returning from set"/> + <line text="returning from cons exe"/> + <line text="returning from init"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" title="declare soft and adviceexecution" pr="103051"> + <compile files="Pr103051.aj" options="-Xdev:Pinpoint"/> + </ajc-test> + + <ajc-test dir="bugs150" title="declare soft and exclusions" pr="103097"> + <compile files="Pr103097.aj" options="-Xlint:ignore"/> + <run class="Pr103097"/> + </ajc-test> + + + <ajc-test dir="bugs150" title="Range problem"> + <compile files="pr109614.java"/> + <run class="pr109614"/> + </ajc-test> + + <ajc-test dir="bugs150/pr114436" title="ClassFormatError binary weaving perthis"> + <compile files="SimpleTrace.aj,ConcreteSimpleTracing.aj" outjar="aspects.jar" options="-1.4"/> + <compile files="TestClass.java" aspectpath="aspects.jar" options="-1.4"/> + <run class="TestClass"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113066" title="possible static imports bug - 1"> + <compile files="Consts.java,TestNPE.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" title="parameterized type and around advice"> + <compile files="pr115250.aj" options="-1.5 -Xlint:ignore"> + <!-- this first error happens twice, once for each piece of around advice --> + <message kind="error" line="10" text="incompatible return type applying to constructor-execution(void pr115250$C.<init>())"/> + <message kind="error" line="17" text="incompatible return type applying to constructor-execution(void pr115250$C.<init>())"/> + <message kind="error" line="27" text="incompatible return type applying to constructor-execution(void pr115250$C.<init>())"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="parameterized type and around advice - 2"> + <compile files="pr115250_2.aj" options="-1.5 -Xlint:ignore -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(pr115250_2$C pr115250_2$C.foo())' in Type 'pr115250_2$C' (pr115250_2.aj:7) advised by around advice from 'pr115250_2$A' (pr115250_2.aj:22)"/> + <message kind="weave" text="Join point 'method-execution(pr115250_2$C pr115250_2$C.foo())' in Type 'pr115250_2$C' (pr115250_2.aj:7) advised by around advice from 'pr115250_2$Normal' (pr115250_2.aj:12)"/> + </compile> + <run class="pr115250_2"> + <stderr> + <line text="funky advice running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr115788" title="parser exception"> + <compile files="AAA.java"> + <message kind="warning" line="3" text="no match for this type name: Screen"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr113066" title="possible static imports bug - 2"> + <compile files="Consts2.java,TestNPE2.java" options="-1.5"> + <message kind="error" line="2" text="The field Consts2.a.Consts2.A_CONST is not visible"/> + <!-- message has changed with 3.3 compiler upgrade, it used to be this: --> + <!-- message kind="error" line="2" text="The import a.Consts2.A_CONST cannot be resolved"/--> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr113066" title="possible static imports bug - 3"> + <compile files="Consts3.java,TestNPE3.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/staticImports" title="import static java.lang.System.out"> + <compile files="StaticImport.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" title="Problem with constructor ITDs"> + <compile files="pr112783.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" title="NPE in ensureScopeSetup"> + <compile files="pr115038.aj" options="-1.5"> + <message kind="error" line="2" text="Cannot make inter-type declarations on type variables"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="ITDC with no explicit cons call"> + <compile files="Pr62606.aj" options="-1.5"> + <message kind="warning" line="6" text="[Xlint:noExplicitConstructorCall]"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/bugs" title="using same type variable in ITD"> + <compile files="SameTypeVariable.aj" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="capturebinding wildcard problem"> + <compile files="pr114744.aj" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="Anonymous types and nome matching"> + <compile files="Pr73050.aj" outjar="jar1.jar"> + <message kind="warning" line="16" text="anonymous types should be matched by a * wild card"/> + </compile> + <compile inpath="jar1.jar"> + <message kind="warning" line="0" text="anonymous types should be matched by a * wild card"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr86903" title="bcelrenderer bad"> + <compile files="GenericService.java,Service.java,Main.java,BadWormhole.java"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="bugs150/pr114343" title="field-get, generics and around advice"> + <compile files="Test.java,Test1.java,Test2.java,TestAspect.aj" options="-1.5"> + <message kind="warning" line="7" text="unchecked conversion when advice applied at shadow field-get(java.util.Set Test1.intsSet), expected java.util.Set<java.lang.Integer> but advice uses java.util.Set"/> + <message kind="warning" line="8" text="unchecked conversion when advice applied at shadow field-get(java.util.Set Test2.doubSet), expected java.util.Set<java.lang.Double> but advice uses java.util.Set"/> + </compile> + <run class="TestAspect"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113947/case1" title="maws generic aspect - 1"> + <compile files="AbstractListSupport.java,AnotherItem.java,Item.java,LinkedList.java,LinkedListItem.java,ListItem.java,StringList.java" options="-1.5"> + <message kind="error" line="6" text="Cannot make inter-type declarations on type variables"/> + <message kind="error" line="8" text="Cannot make inter-type declarations on type variables"/> + <message kind="error" line="12" text="Cannot make inter-type declarations on type variables"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="aspectOf and generic aspects"> + <compile files="pr115237.aj" options="-1.5"/> + <run class="pr115237"/> + </ajc-test> + + <ajc-test dir="bugs150/pr114343/case2" title="field-get, generics and around advice - 2"> + <compile files="Test.java,TTT.java,TestAspect.java" options="-1.5"/> + <run class="TestAspect"> + <stderr> + <line text="TestAspect.main: Calling foo"/> + <line text="Creating Test<Integer> instance"/> + <line text="Calling toArray"/> + <line text="In around advice"/> + <line text="In toArray()"/> + <line text="done"/> + <line text="TestAspect.main: done"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr114343/case3" title="field-get, generics and around advice - 3"> + <compile files="Test.java,TTT.java,TestAspect.java" options="-1.5"/> + <run class="TestAspect"> + <stderr> + <line text="TestAspect.main: Calling foo"/> + <line text="Creating Test<Integer> instance"/> + <line text="Calling toArray"/> + <line text="In around advice"/> + <line text="In toArray()"/> + <line text="done"/> + <line text="Creating Test<Integer> instance"/> + <line text="Calling getFirst"/> + <line text="around on getFirstExec(): running"/> + <line text="done"/> + <line text="TestAspect.main: done"/> + </stderr> + </run> + </ajc-test> + + + <ajc-test dir="bugs150/pr113947/case2" title="maws generic aspect - 2"> + <compile files="AbstractListSupport.java,AnotherItem.java,Item.java,LinkedList.java,LinkedListItem.java,ListItem.java,StringList.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113861" title="field-get problems with generic field"> + <compile files="Test.java,TestAspect.java" options="-1.5"/> + <run class="com.Test"/> + </ajc-test> + + + <ajc-test dir="bugs150/pr99191" title="declare annotation on non existent type - 1"> + <compile files="pr99191_1.java" options="-1.5"> + <message kind="error" line="4" text="The field 'int C.noSuchField' does not exist"/> + <message kind="error" line="5" text="The field 'int B.noSuchField' does not exist"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/bugs/lists/case1" title="generics and ITD overrides - 1"> + <compile files="Identifiable.java,Bean.java,LongIdentifiable.java,IdentifiableAspect.java" options="-1.5"> + </compile> + <run class="IdentifiableAspect"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs/lists/case2" title="generics and ITD overrides - 2"> + <compile files="Identifiable.java,Bean.java,LongIdentifiable.java,IdentifiableAspect.java" options="-1.5"> + </compile> + <run class="IdentifiableAspect"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs/lists/case3" title="generics and ITD overrides - 3"> + <compile files="Identifiable.java,Bean.java,LongIdentifiable.java,IdentifiableAspect.java" options="-1.5"> + </compile> + <run class="IdentifiableAspect"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs/lists/case4" title="generics and ITD overrides - 4"> + <compile files="Identifiable.java,Bean.java,LongIdentifiable.java,IdentifiableAspect.java" options="-1.5"> + </compile> + <run class="IdentifiableAspect"/> + </ajc-test> + + <!-- Currently a warning doesn't occur if the annotation is already on the field + (see bug 113029). If this is fixed, need to add check for this warning to this + test as in test "declare annotation on non existent type - 4" --> + <ajc-test dir="bugs150/pr99191" title="declare annotation on non existent type - 2"> + <compile files="pr99191_2.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr99191" title="declare annotation on non existent type - 3"> + <compile files="pr99191_3.java" options="-1.5"> + <message kind="error" line="4" text="The method 'public * C.noSuchMethod(..)' does not exist"/> + <message kind="error" line="5" text="The method '* B.noSuchMethod(..)' does not exist"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr99191" title="declare annotation on non existent type - 4"> + <compile files="pr99191_4.java" options="-1.5"> + <message kind="warning" text="void C.amethod() - already has an annotation of type Annotation, cannot add a second instance [Xlint:elementAlreadyAnnotated]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr99191" title="declare annotation on non existent type - 5"> + <compile files="pr99191_5.java" options="-1.5"> + <message kind="error" line="4" text="The method 'C.new(java.lang.String)' does not exist"/> + <message kind="error" line="5" text="The method 'B.new(int)' does not exist"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr99191" title="declare annotation on non existent type - 6"> + <compile files="pr99191_6.java" options="-1.5"> + <message kind="warning" text="void C.<init>(int) - already has an annotation of type Annotation, cannot add a second instance [Xlint:elementAlreadyAnnotated]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr113630/case1" title="IncompatibleClassChangeError - errorscenario"> + <compile files="Bean.java,BeanTestCase.java,javaBean.java,propertyChanger.java,PropertySupportAspect5.aj" options="-1.5"> + <message kind="warning" line="9" text="Failing match because annotation 'javaBean' on type 'Bean' has SOURCE retention. Matching allowed when RetentionPolicy is CLASS or RUNTIME"/> + <message kind="error" line="18" text="The method addPropertyChangeListener(String, BeanTestCase) is undefined for the type Bean"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr113630/case2" title="IncompatibleClassChangeError - workingscenario"> + <compile files="Bean.java,BeanTestCase.java,javaBean.java,propertyChanger.java,PropertySupportAspect5.aj" options="-1.5"/> + <run class="BeanTestCase"/> + </ajc-test> + + <ajc-test dir="bugs150" title="Generics ClassCastException"> + <compile files="pr113445.aj" options="-1.5,-emacssym"/> + </ajc-test> + + <ajc-test dir="bugs150" title="test illegal change to pointcut declaration"> + <compile files="pr111915.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void SomeClass.doSomething())' in Type 'SomeClass' (pr111915.java:4) advised by around advice from 'DoesntCompile' (pr111915.java:15)"/> + <message kind="weave" text="Extending interface set for type 'SomeClass' (pr111915.java) to include 'java.io.Serializable' (pr111915.java)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/bridgeMethods" pr="72766" title="Ignore bridge methods"> + <compile files="AspectX.aj" inpath="testcode.jar" options="-showWeaveInfo"> + <!-- <message kind="warning" line="7" text="pointcut did not match on the method call to a bridge method."/> + <message kind="warning" line="7" text="does not match because declaring type is Number"/>--> + <message kind="weave" text="(AspectX.aj:18) advised by before advice from 'AspectX'"/> + <message kind="weave" text="(AspectX.aj:19) advised by before advice from 'AspectX'"/> + <message kind="weave" text="(Number.java:5) advised by before advice from 'AspectX'"/> + </compile> + </ajc-test> + + <ajc-test title="intermediate annotation matching" dir="bugs150"> + <compile files="AnnotationPlusPatternMatchingError.aj" options="-1.5"> + <message kind="warning" line="28" text="matched"/> + </compile> + <run class="AnnotationPlusPatternMatchingError"> + <stdout> + <line text="In advice"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="migration" title="load aspectj 1.2.1 aspects in aspectj 5"> + <compile files="Program.java" aspectpath="aspects121.jar"> + </compile> + <run class="Program"/> + </ajc-test> + + <ajc-test dir="bugs/java5/arrayCloning" pr="72150" vm="1.5" + title="AJC possible bug with static nested classes"> + <compile files="A.java,C.java" options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'C' (C.java:14) advised by around advice from 'A' (A.java:2)"/> + </compile> + <run class="C"/> + </ajc-test> + + <ajc-test dir="java5/pseudoKeywords" + title="method called around in class"> + <compile files="MethodCalledAround.java"> + </compile> + </ajc-test> + + <ajc-test dir="java5/pseudoKeywords" + title="method called around in aspect"> + <compile files="MethodCalledAroundAspect.java"> + <message kind="error" line="2"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="64568" title="clear error message on itd with type pattern"> + <compile files="pr64568.aj"> + <message line="4" kind="error" text="Syntax error on token "*", delete this token"/> + <message line="4" kind="error" text="foo cannot be resolved to a type"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="74562" title="before and after are valid identifiers in classes"> + <compile files="pr74562.aj"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="107486" title="anonymous inner classes"> + <compile files="pr107486.aj"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="102210" title="NullPointerException trying to compile"> + <compile files="PR102210.java"/> + <run class="PR102210"> + <stderr> + <line text="List size is 1"/> + <line text="m1 running"/> + <line text="List size is 2"/> + <line text="m2 running"/> + <line text="List size is 3"/> + <line text="m3 running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="107486" title="multiple anonymous inner classes"> + <compile files="pr107486part2.aj"> + </compile> + <run class="pr107486part2"> + <stdout> + <line text="[advised] f"/> + <line text="[advised] g"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/compliance" title="java 5 pointcuts and declares at pre-java 5 compliance levels"> + <compile files="AJ5FeaturesAtJ14.aj" options="-1.4"> + <message kind="error" line="3" text="the @annotation pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="11" text="the @within pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="13" text="the @withincode pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="5" text="the @this pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="7" text="the @target pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="9" text="the @args pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="15" text="declare @type is only supported at Java 5 compliance level or above"/> + <message kind="error" line="15" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="15" text="cannot convert from Foo to Annotation"/> + <message kind="error" line="17" text="declare @method is only supported at Java 5 compliance level or above"/> + <message kind="error" line="17" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="17" text="cannot convert from Foo to Annotation"/> + <message kind="error" line="19" text="declare @field is only supported at Java 5 compliance level or above"/> + <message kind="error" line="19" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="19" text="cannot convert from Foo to Annotation"/> + <message kind="error" line="21" text="declare @constructor is only supported at Java 5 compliance level or above"/> + <message kind="error" line="21" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="21" text="cannot convert from Foo to Annotation"/> + <message kind="error" line="25" text="annotation type patterns are only supported at Java 5 compliance level or above"/> + <message kind="error" line="27" text="annotation type patterns are only supported at Java 5 compliance level or above"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/compliance" title="java 5 pointcuts and declares at pre-java 5 compliance levels - 1.7"> + <compile files="AJ5FeaturesAtJ14.aj" options="-1.4"> + <message kind="error" line="3" text="the @annotation pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="11" text="the @within pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="13" text="the @withincode pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="5" text="the @this pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="7" text="the @target pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="9" text="the @args pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="15" text="declare @type is only supported at Java 5 compliance level or above"/> + <message kind="error" line="15" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="15" text="Foo is not an annotation type"/> + <message kind="error" line="17" text="declare @method is only supported at Java 5 compliance level or above"/> + <message kind="error" line="17" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="17" text="Foo is not an annotation type"/> + <message kind="error" line="19" text="declare @field is only supported at Java 5 compliance level or above"/> + <message kind="error" line="19" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="19" text="Foo is not an annotation type"/> + <message kind="error" line="21" text="declare @constructor is only supported at Java 5 compliance level or above"/> + <message kind="error" line="21" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="21" text="Foo is not an annotation type"/> + <message kind="error" line="25" text="annotation type patterns are only supported at Java 5 compliance level or above"/> + <message kind="error" line="27" text="annotation type patterns are only supported at Java 5 compliance level or above"/> + </compile> + </ajc-test> + + + <ajc-test dir="bugs150" pr="91114" title="before and after are valid identifiers in classes, part 2"> + <compile files="pr91114.aj"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="78621" title="void field type in pointcut expression"> + <compile files="pr78261.aj"> + <message line="3" kind="error" text="fields cannot have a void type"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="86057" title="overriding final pointcut from super-aspect"> + <compile files="pr86057.aj"> + <message line="9" kind="error" text="can't override final pointcut Base.foo()"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="78707" title="before returning advice not allowed!"> + <compile files="pr78707.aj"> + <message line="3" kind="error" text="Syntax error on token "returning", delete this token"/> + <message line="3" kind="error" text="Syntax error on token "throwing", delete this token"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="104529" title="@SuppressWarnings should suppress"> + <compile files="pr104529.aj" options = "-1.5 -warn:+unchecked"> + <message line="11" kind="warning" text="needs unchecked conversion"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="79523" title="declare warning : foo(str) : ...;"> + <compile files="pr79523.aj"> + <message line="4" kind="warning" text="no match for this type name: str"/> + <message line="4" kind="error" text="bad parameter"/> + <message line="4" kind="error" text="args() pointcut designator cannot be used in declare statement"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="107059" title="parser crashes on call(void (@a *)(..)"> + <compile files="pr107059.aj"> + <message line="3" kind="error" text="Syntax error on token "(", "name pattern" expected"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="107059" title="target(@Foo *)"> + <compile files="pr107059_2.aj" options="-1.5"> + <message kind="error" line="4" text="wildcard type pattern not allowed"></message> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="varargs with type variable"> + <compile files="ParameterizedVarArgMatch.aj" options="-1.5"> + </compile> + </ajc-test> + + + <ajc-test dir="bugs150" pr="108104" title="multiple anonymous inner classes 2"> + <compile files="pr108104.aj" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="108050" title="signature matching in override scenario"> + <compile files="pr108050.aj" options="-1.5"> + <message kind="warning" line = "2" text="servlet request"></message> + <message kind="warning" line = "7" text="servlet request"></message> + <message kind="warning" line = "21" text="servlet request"></message> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr108425" pr="108245" title="wildcard annotation matching - pr108245"> + <compile files="package1/Bean.java,package2/Bean.java,package2/propertyChanger.java,package3/pr108425.aj" options="-1.5 -Xlint:ignore"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/" pr="108104" title="inner types and type variables"> + <compile files="ShapeCommandMap.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/" pr="107953" title="@AfterThrowing with no formal specified"> + <compile files="pr107953.java" options="-1.5"> + <message kind="error" line="8" text="throwing formal 'RuntimeException' must be declared as a parameter in the advice signature"></message> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr106130" pr="106130" title="test weaving with > 256 locals"> + <compile files="AroundLotsOfVars.java LotsOfVars.java" options="-preserveAllLocals"/> + <run class="LotsOfVars"> + <stdout> + <line text="hello"/> + <line text="2"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr87376" title="structure model npe on type not found"> + <compile files="I.java,NPE.aj" options="-emacssym"> + <message kind="error" line="8" text="I cannot be resolved to a type"/> + <message kind="error" line="10" text="I cannot be resolved to a type"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="83311" title="overriding/polymorphism error on interface method introduction"> + <compile files="pr83311.aj"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="103266" title="NPE on syntax error"> + <compile files="pr103266.aj"> + <message kind="error" line="41" text="ConnectionRequestContext cannot be resolved to a type"/> + <!-- this next message is new in e37 --> + <message kind="error" line="41" text="Type mismatch: cannot convert from new ConnectionRequestContext(){} to WorkerExample.RequestContext"/> + </compile> + </ajc-test> + + <ajc-test title="itd override with no exception clause" dir="bugs150"> + <compile files="pr83377.aj"></compile> + </ajc-test> + + <ajc-test dir="bugs150/pr84260" vm="1.5" title="static import failures"> + <compile files="A.java,I1.java,I2.java" options="-1.5"/> + <run class="I1"> + <stderr> + <line text="static method running"/> + </stderr> + </run> + <run class="I2"> + <stderr> + <line text="static method running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test title="anonymous inner class with method returning type parameter" pr="107898" dir="bugs150"> + <compile files="pr107898.aj" options="-1.5"></compile> + </ajc-test> + + <ajc-test title="matching against Object[]" pr="72668" dir="bugs150"> + <compile files="pr72668.aj" options="-1.5"> + <message kind="error" line="3" text="incompatible return type applying to method-execution(java.lang.Number[] pr72668.getThoseInts())"></message> + <message kind="error" line="10" text="incompatible return type applying to method-execution(java.lang.Number[] pr72668.getThoseInts())"></message> + </compile> + </ajc-test> + + <ajc-test dir="decp" pr="80249" title="Order of types passed to compiler determines weaving behavior"> + <compile files="A.java,B.java,AspectX.java"/> + <run class="B"/> + <compile files="B.java,A.java,AspectX.java"/> + <run class="B"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="99228" vm="1.5" title="ITD of a field into a generic class"> + <compile files="PR99228.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="98320" vm="1.5" title="intertype with nested generic type"> + <compile files="PR98320.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="decs" pr="42743" title="declare soft of runtime exception"> + <compile files="DeclareSoftRuntimeException.aj"> + <message kind="warning" line="3" text="MyRuntimeException will not be softened as it is already a RuntimeException"/> + </compile> + <run class="DeclareSoftRuntimeException"> + <stdout> + <line text="MyRuntimeException"/> + <line text="org.aspectj.lang.SoftException"/> + <line text="MyRuntimeException"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="decs" pr="42743" title="declare soft w. catch block"> + <compile files="VerifyError.aj" options="-Xlint:ignore"> + </compile> + <run class="VerifyError"/> + </ajc-test> + + <ajc-test dir="bugs" pr="61568" title="Various kinds of ambiguous bindings"> + <compile files="AmbiguousBindings.aj" options="-1.4"> + <message line="17" text="ambiguous binding of parameter(s) foo across '||' in pointcut"></message> + <message line="19" text="ambiguous binding of parameter(s) foo across '||' in pointcut"></message> + <message line="21" text="ambiguous binding of parameter(s) foo across '||' in pointcut"></message> + <message line="23" text="ambiguous binding of parameter(s) x across '||' in pointcut"></message> + <message line="25" text="ambiguous binding of parameter(s) foo across '||' in pointcut"></message> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="61658" title="ambiguous args"> + <compile files="PR61658.java"> + <message line="17" text="ambiguous binding of parameter(s) a, b across '||' in pointcut"></message> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="78021" title="Injecting exception into while loop with break statement causes catch block to be ignored"> + <compile files="PR78021.java"/> + <run class="PR78021"/> + </ajc-test> + + <ajc-test dir="bugs150/pr99089" vm="1.5" pr="99089" title="ArrayIndexOutOfBoundsException - Generics in privileged aspects"> + <compile files="DataClass.java,TracingAspect.java" options="-1.5"/> + <run class="DataClass"> + <stderr> + <line text="before:Length of v=1"/> + <line text="after:Length of v=2"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="79554" title="Return in try-block disables catch-block if final-block is present"> + <compile files="PR79554.java"/> + <run class="PR79554"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="82570" title="Weaved code does not include debug lines"> + <compile files="PR82570_1.java"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="83303" title="compiler error when mixing inheritance, overriding and polymorphism"> + <compile files="PR83303.java"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="83563" title="pertypewithin() handing of inner classes (1)"> + <compile files="PR83563_1.java"/> + <run class="PR83563_1"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="83563" title="pertypewithin() handing of inner classes (2)"> + <compile files="PR83563_2.java"/> + <run class="PR83563_2"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="83645" title="pertypewithin({interface}) illegal field modifier"> + <compile files="PR83645.java" options="-Xlint:ignore"/> + <run class="PR83645"/> + </ajc-test> + + <ajc-test dir="bugs150" title="bad asm for enums" vm="1.5"> + <compile files="Rainbow.java" options="-emacssym,-1.5,-Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="10461" title="missing name pattern"> + <compile files="PR106461.aj"> + <message kind="error" line="3" text="Syntax error on token "(", "name pattern" expected"/> + <message kind="error" line="5" text="Syntax error on token ")", "name pattern" expected"/> + <message kind="error" line="7" text="Syntax error on token ".", "name pattern" expected"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="106634" title="IllegalStateException unpacking signature of nested parameterized type"> + <compile files="pr106634.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" title="(@Foo *)+ type pattern parse error"> + <compile files="AnnotationPlusPatternParseError.aj" options="-1.5"/> + <!-- next line needs the change for inherited anno matching... --> + <!--compile files="AnnotationPlusPatternParseError.aj" options="-1.5"> + <message kind="warning" line="19"/> + </compile--> + </ajc-test> + + <ajc-test dir="bugs150" pr="80571" title="around advice on interface initializer"> + <compile files="pr80571.aj"> + <message kind="warning" text="The joinpoint 'constructor-call(void pr80571.<init>())' cannot be advised"/> + </compile> + <run class="pr80571"> + <stdout> + <line text="before"/> + <line text="after"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="78314" title="good error message for unmatched member syntax"> + <compile files="pr78314.aj" options="-1.5"> + <message kind="error" line="5" text="Syntax error on token "foo", no accurate correction available"/> + </compile> + <compile files="pr78314.aj"> + <message kind="error" line="5" text="Syntax error on token "foo", no accurate correction available"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="108377" title="itd field access inside itd method"> + <compile files="pr108377.aj"/> + <run class="pr108377"/> + </ajc-test> + + <ajc-test dir="bugs150/pr108054" pr="108054" title="type variable with type variable bound"> + <compile files="pr108054.aj" options="-1.5"/> + <compile files="ISequence.java,ICounter.java,ASequence.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr108370" pr="108370" title="switch on enum inside ITD method"> + <compile files="et/Q.java" options="-1.5"/> + <compile files="EnumTest.aj" options="-1.5 -inpath et"/> + <run class="EnumTest"> + <stdout> + <line text="B!"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="95992" title="inner type of generic interface reference from parameterized type"> + <compile files="pr95992.aj" options="-1.5"/> + </ajc-test> + + + <ajc-test dir="bugs150" pr="104024" title="inner class passed as argument to varargs method"> + <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> + + <ajc-test dir="bugs150/pr71159" pr="71159" title="visibility in signature matching with overrides - 1"> + <compile files="pr71159.aj"> + <message kind="warning" line="26" text="should match"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr71159" pr="71159" title="visibility in signature matching with overrides - 2"> + <compile files="PrivateITD.aj"> + <message kind="warning" line="28" text="should match"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr71159" pr="71159" title="visibility in signature matching with overrides - 3"> + <compile files="pkg1/A.java,pkg1/B.java,pkg1/C.java,pkg2/ITDInDiffPackage.aj"> + <message kind="warning" line="10" text="should match"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="59196" title="args generated correctly for advice execution join point"> + <compile files="pr59196.aj" options="-XnoInline -1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="74048" title="no unused warnings on aspect types"> + <compile files="pr74048.aj" options="-warn:unusedPrivate"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="59397" title="synthetic arguments on itd cons are not used in matching"> + <compile files="pr59397.aj"> + <message line="6" kind="warning" text="should match"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="108602" title="parse generic type signature with parameterized type in interface"> + <compile files="pr108602.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="105479" title="declare parents introducing override with covariance"> + <compile files="pr105479.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="105479" title="override and covariance with decp - runtime"> + <compile files="pr105479part2.aj" options="-1.5"/> + <run class="pr105479part2"> + <stdout> + <line text="in Test.hashCode()"/> + <line text="in Test.hashCode()"/> + <line text="id"/> + <line text="in Test.hashCode()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr105479/case1" pr="105479" title="override and covariance with decp - runtime separate files"> + <compile files="ReturnTypeTest.aj,ReturnTypeTester.java,Driver.java" options="-1.5"/> + <run class="Driver"> + <stdout> + <line text="in Test.hashCode()"/> + <line text="in Test.hashCode()"/> + <line text="id"/> + <line text="in Test.hashCode()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr105479/case2" pr="105479" title="override and covariance with decp - binary weaving"> + <compile files="ReturnTypeTest.java" outjar="jar1.jar" options="-1.5 -Xlint:ignore"/> + <compile files="ReturnTypeTester.java" outjar="jar2.jar" options="-1.5"/> + <compile inpath="jar1.jar;jar2.jar" options="-1.5"/> + <run class="ReturnTypeTester"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="102212" title="abstract synchronized itdms not detected"> + <compile files="pr102212.aj"> + <message line="7" kind="error" text="The abstract method _abstract in type Parent can only set a visibility modifier, one of public or protected"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="102212" title="synchronized itd interface methods"> + <compile files="SynchronizedInterfaceMethods.aj" options="-1.5"> + </compile> + <run class="SynchronizedInterfaceMethods"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="101606" title="unused private pointcuts"> + <compile files="pr101606.aj" options="-warn:unusedPrivate"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr99125" pr="99125" title="itd interface method already existing on interface"> + <compile files="p/pr99125.aj,p/I.java,p/J.java" options="-1.5"> + </compile> + <compile files="Aspects.aj" options="-inpath p"/> + <run class="p.pr99125"/> + <compile files="p2/pr99125.aj,p/I.java,p/J.java"/> <!-- actually in package p, introduces incompatible change --> + <compile files="Aspects.aj" options="-inpath p"> + <message kind="error" line="7" text="inter-type declaration from X conflicts with existing member"/> + <!-- 275032 - new error at affected member location too --> + <message kind="error" line="10" text="inter-type declaration from X conflicts with existing member"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr87530" pr="87530" title="final itd methods on interfaces"> + <compile files="FinalITDMOnInterface.aj"> + <message kind="error" line="12" text="Cannot override the final method from A.TestInterface"></message> + </compile> + <compile files="FinalITDMOnInterface2.aj"> + <!--message kind="error" line="8" text="Cannot override the final method from A.TestInterface"></message--> + <message kind="error" line="8" text="can't override final void A$TestInterface.m()"></message> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="108818" title="can't override private pointcut in abstract aspect"> + <compile files="PrivatePointcutOverriding.aj"> + <message kind="warning" line="19" text="matched join point from super advice"/> + <message kind="warning" line="21" text="matched join point from sub advice"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="108816" title="advising cflow advice execution"> + <compile files="pr108816.aj" > + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr108902" pr="108902" title="no type mismatch on generic types in itds"> + <compile files="Subject.java,Observer.java,ObserverProtocol.aj" > + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="108903" title="super call in ITD"> + <compile files="pr108903.aj" > + <message kind="error" line="14" text="The method print() is undefined for the type Object"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="109042" title="no unused parameter warnings for synthetic advice args"> + <compile files="pr109042.aj" options="-warn:+unusedArgument -warn:+unusedPrivate -warn:+unusedImport -1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="109486" title="Internal compiler error (ClassParser.java:242)"> + <compile files="PR109486.java" > + <message kind="error" line="1" text="The class PR109486 can be either abstract or final, not both"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="109124" title="no verify error with set on inner type"> + <compile files="VerifyErrorOnSet.aj" options="-1.5" > + </compile> + <run class="test.VerifyErrorOnSet"/> + <compile files="pr106874.aj" options="-1.5" > + </compile> + <run class="pr106874"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="108826" title="cant find type error with generic return type or parameter"> + <compile files="pr108826.aj" options="-1.5 -emacssym" > + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="105181" title="no verify error on generic collection member access"> + <compile files="pr105181.aj" options="-1.5"> + </compile> + <run class="pr105181"/> + </ajc-test> + + <ajc-test dir="bugs150/pr108903" pr="108903" title="super call in ITD - part 2"> + <compile files="com/designpattern/decorator/HeaderDecorator.aj,com/designpattern/decorator/Main.java,com/designpattern/decorator/Order.java,com/designpattern/decorator/OrderDecorator.aj,com/designpattern/decorator/SalesOrder.java" options="-1.5" > + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr103740" pr="103740" title="Compiler failure on at_annotation"> + <compile files="AroundAdvice.aj" options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void C.m1())' in Type 'C' (AroundAdvice.aj:12) advised by before advice from 'ErrorHandling' (AroundAdvice.aj:8)"/> + <message kind="weave" text="Join point 'method-execution(void C.m3())' in Type 'C' (AroundAdvice.aj:14) advised by before advice from 'ErrorHandling' (AroundAdvice.aj:8)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr106554" pr="106554" title="Problem in staticinitialization with pertypewithin aspect"> + <compile files="A.aj" options="-showWeaveInfo -1.4"> + <message kind="weave" text="Join point 'staticinitialization(void A.<clinit>())' in Type 'A' (A.aj:1) advised by before advice from 'StopsInit' (A.aj:21)"/> + </compile> + <run class="A"> + <stdout> + <line text="test = 1"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/SimpleInsuranceFailure" title="raw and generic type conversion with itd cons"> + <compile files="" options=" -emacssym, -sourceroots ." > + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="@annotation binding with around advice"> + <compile files="AnnotationBinding.aj" options="-1.5"/> + <run class="AnnotationBinding"/> + </ajc-test> + + <ajc-test dir="bugs150" title="declare parents on a missing type"> + <compile files="Pr76374.aj" options="-1.5"> + <message kind="warning" line="3" text="no match for this type name"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="parameterized generic methods"> + <compile files="Pr109283.aj" options="-1.5 -warn:indirectStatic"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="call join points in anonymous inner classes"> + <compile files="pr104229.aj" options="-1.5"> + <message kind="warning" line="54" text="bingo"/> + <message kind="warning" line="115" text="bingo"/> + <message kind="warning" line="130" text="bingo"/> + </compile> + <run class="pr104229"> + <stdout> + <line text="call match class pr104229"/> + <line text="OK it worked!"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" title="default impl of Runnable"> + <compile files="pr88900.aj" options="-Xdev:Pinpoint"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="array clone call join points in 1.4 vs 1.3"> + <compile files="pr102933.aj" options="-1.3"> + <message kind="warning" line="7" text="a call within pr102933"/> + </compile> + <compile files="pr102933.aj" options="-1.4"> + <message kind="warning" line="7" text="a call within pr102933"/> + </compile> + <compile files="pr102933.aj" options="-1.5"> + <message kind="warning" line="7" text="a call within pr102933"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="100195" title="debug info in around advice inlining"> + <compile files="pr100195.aj"> + </compile> + <run class="pr100195"/> + </ajc-test> + + <ajc-test dir="bugs150" title="weaveinfo message for declare at method on an ITDd method"> + <compile files="pr113073.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Type 'C' (pr113073.java) has intertyped method from 'D' (pr113073.java:'void C.anotherMethod()')"/> + <message kind="weave" text="'public void C.anotherMethod()' (pr113073.java) is annotated with @Annotation method annotation from 'B' (pr113073.java:3)"/> + <message kind="weave" text="Type 'C' (pr113073.java) has intertyped method from 'D' (pr113073.java:'void C.anotherMethod(java.lang.String)')"/> + <message kind="weave" text="'public void C.anotherMethod(String)' (pr113073.java) is annotated with @Annotation method annotation from 'B' (pr113073.java:3)"/> + <message kind="weave" text="Type 'C' (pr113073.java) has intertyped constructor from 'D' (pr113073.java:'void C."/> + <message kind="weave" text="'public void C.new(String)' (pr113073.java) is annotated with @Annotation constructor annotation from 'B' (pr113073.java:4)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr113447" title="no verify error with two this pcds"> + <compile files="PR113447.java"> + </compile> + <run class="PR113447"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113447" title="no verify error with two at this pcds"> + <compile files="PR113447a.java" options="-1.5"> + </compile> + <run class="PR113447a"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113447" title="no verify error with at within pcds"> + <compile files="PR113447b.java" options="-1.5"> + </compile> + <run class="PR113447b"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113447" title="no verify error with at withincode pcds"> + <compile files="PR113447c.java" options="-1.5"> + </compile> + <run class="PR113447c"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113447" title="no verify error with at annotation pcds"> + <compile files="PR113447d.java" options="-1.5"> + </compile> + <run class="PR113447d"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113447" title="no verify error with two args pcds"> + <compile files="PR113447e.java" options="-1.5"> + </compile> + <run class="PR113447e"/> + </ajc-test> + + <ajc-test dir="bugs150" title="no StackOverflowError with circular pcd in generic aspect"> + <compile files="pr115235.aj" options="-1.5"> + <message kind="warning" line="3" text="advice defined in GenericAbstractAspect has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="error" text="circular pointcut declaration involving: pc()"/> + <message kind="error" line="20" text="circular pointcut declaration involving: pc2()"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="no StackOverflowError with circular pcd in generic aspect - 2"> + <compile files="pr115235b.aj" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for improper exact annotation type"> + <compile files="ExactAnnotationTypePattern.java" options="-1.5"> + <message kind="warning" line="20" text="field blah"/> + <message kind="warning" line="28" text="does not match because annotation @TypeAnnotation has @Target{ElementType.TYPE} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="37" text="does not match because annotation @FieldAnnotation has @Target{ElementType.FIELD} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="46" text="does not match because annotation @MethodAnnotation has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for improper annotation type inside OR"> + <compile files="OrTypePattern.java" options="-1.5"> + <message kind="warning" line="26" text="does not match because annotation @FieldAnnotation has @Target{ElementType.FIELD} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="31" text="does not match because annotation @TypeAnnotation has @Target{ElementType.TYPE} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="31" text="does not match because annotation @FieldAnnotation has @Target{ElementType.FIELD} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for improper annotation type inside AND"> + <compile files="AndTypePattern.java" options="-1.5"> + <message kind="warning" line="23" text="does not match because annotation @FieldAnnotation has @Target{ElementType.FIELD} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for improper annotated return type"> + <compile files="AnnotationReturnType.java" options="-1.5"> + <!-- warnings coming from matching pointcuts and corresponding declare warnings --> + <message kind="warning" line="12" text="(@TypeAnnotation *) *(..)"/> + <message kind="warning" line="12" text="(@(TypeAnnotation || MethodAnnotation) *) *(..)"/> + <!-- xlint warnings that were put in as part of fix for pr115252 --> + <message kind="warning" line="32" text="does not match because annotation @MethodAnnotation has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="37" text="does not match because annotation @MethodAnnotation has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for improper annotated declaring type"> + <compile files="AnnotationDeclaringType.java" options="-1.5"> + <!-- warning coming from matching pointcuts and corresponding declare warnings --> + <message kind="warning" line="13" text="* (@TypeAnnotation *).*(..)"/> + <!-- xlint warning that was put in as part of fix for pr115252 --> + <message kind="warning" line="27" text="does not match because annotation @MethodAnnotation has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for improper annotated parameter type"> + <compile files="AnnotationParameterType.java" options="-1.5"> + <!-- warning coming from matching pointcuts and corresponding declare warnings --> + <message kind="warning" line="12" text="* *(@TypeAnnotation *)"/> + <!-- xlint warning that was put in as part of fix for pr115252 --> + <message kind="warning" line="31" text="does not match because annotation @MethodAnnotation has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for improper annotated throws pattern"> + <compile files="AnnotationThrowsPattern.java" options="-1.5"> + <!-- warnings coming from matching pointcuts and corresponding declare warnings --> + <message kind="warning" line="12" text="(* *.*(..) throws (@TypeAnnotation *))"/> + <message kind="warning" line="12" text="* *.*(..) throws !(@MethodAnnotation *)"/> + <message kind="warning" line="14" text="(* *.*(..) throws !(@TypeAnnotation *))"/> + <message kind="warning" line="14" text="* *.*(..) throws !(@MethodAnnotation *)"/> + <!-- xlint warnings that were put in as part of fix for pr115252 --> + <message kind="warning" line="40" text="does not match because annotation @MethodAnnotation has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="46" text="does not match because annotation @MethodAnnotation has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for more than one improper annotated parameter type"> + <compile files="MoreThanOneTargetAnnotation.java" options="-1.5"> + <!-- xlint warning that was put in as part of fix for pr115252 --> + <message kind="warning" line="28" text="does not match because annotation @MethodAndFieldAnnotation has @Target{ElementType.FIELD,ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="38" text="does not match because annotation @TypeAndMethodAnnotation has @Target{ElementType.METHOD,ElementType.TYPE} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr119019" title="no NPE when inaccessible method is called within itd"> + <compile files="bar/TargetITDClass.java,foo/ITDWithACall.aj"/> + <run class="foo.ITDWithACall"/> + </ajc-test> + + <ajc-test dir="bugs150" title="no NPE with or pointcut and more than one args"> + <compile files="PR118149.aj"/> + </ajc-test> + + <ajc-test dir="bugs150" title="no StringOutOfBoundsException with generic inner aspects"> + <compile files="PR119543.java" options="-1.5"> + <message kind="warning" line="8" text="advice defined in PR119543$A has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + </ajc-test> + + <!-- ============================================================================ --> + <!-- ============================================================================ --> + + <!-- atOverride tests with ITDs --> + + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs"> + <compile files="AtOverride.aj" options="-1.5"/> + </ajc-test> + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 1"> + <compile files="AtOverride1.aj" options="-1.5"> + <message kind="error" line="9" text="The method method() of type Child must override a superclass method"/> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 2"> + <compile files="AtOverride2.aj" options="-1.5"/> + </ajc-test> + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 3"> + <compile files="AtOverride3.aj" options="-1.5"/> + </ajc-test> + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 4"> + <compile files="AtOverride4.aj" options="-1.5"/> + </ajc-test> + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 5"> + <compile files="AtOverride5.aj" options="-1.5"> + <message kind="error" line="11" text="The method method() of type Child must override a superclass method"/> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 6"> + <compile files="AtOverride6.aj" options="-1.5"/> + </ajc-test> + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 7"> + <compile files="AtOverride7.aj" options="-1.5"/> + </ajc-test> + + <!-- end of atOverride tests with ITDs --> + + <ajc-test dir="../docs/dist/doc/examples/introduction" title="introduction sample" vm="1.5"> + <compile files="CloneablePoint.java,ComparablePoint.java,HashablePoint.java,Point.java" options="-1.5 -Xlint:ignore"/> + </ajc-test> + + <ajc-test dir="java5/varargs" title="varargs in constructor sig" vm="1.5"> + <compile files="Pr88652.aj" options="-1.5"> + <message kind="warning" line="8" text="should match"/> + <message kind="warning" line="9" text="should match"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs" title="Varargs with .. in pointcut" vm="1.5"> + <compile files="pr93356.aj" options="-1.5"> + <message kind="warning" line="5" text="a"/> + <message kind="warning" line="5" text="b"/> + <message kind="warning" line="5" text="c"/> + <message kind="warning" line="5" text="d"/> + <message kind="warning" line="5" text="e"/> + <message kind="warning" line="5" text="k"/> + <message kind="warning" line="5" text="l"/> + + <message kind="warning" line="4" text="f"/> + <message kind="warning" line="4" text="g"/> + <message kind="warning" line="4" text="h"/> + <message kind="warning" line="4" text="i"/> + <message kind="warning" line="4" text="j"/> + + <message kind="warning" line="7" text="f"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs" title="star varargs pattern" vm="1.5"> + <compile files="StarVarargsPattern.aj" options="-1.5"> + <message kind="warning" line="5" text="you used a varargs signature"/> + <message kind="warning" line="7" text="you used a varargs signature"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations" title="invalid cons syntax" vm="1.5"> + <compile files="SyntaxError.aj" options="-1.5"> + <message kind="error" line="3" text="Syntax error on token "new", "method name (not constructor)" expected"/> + </compile> + </ajc-test> + + <!-- hasmethod / hasfield tests --> + + <ajc-test title="declare parents : hasmethod(..) - 1" dir="hasmember"> + <compile files="HasMethod.aj"> + <message kind="error" line="5" text="the type pattern hasmethod(* print(..)) can only be used when the -XhasMember option is set"/> + </compile> + </ajc-test> + + <ajc-test title="declare parents : hasmethod(..) - 1" dir="hasmember"> + <compile files="HasMethod.aj" options="-XhasMember"> + </compile> + <run class="HasMethod"></run> + </ajc-test> + + <ajc-test title="declare parents : hasmethod(..) - 2" dir="hasmember"> + <compile files="HasMethodInherited.aj" options="-XhasMember"> + </compile> + <run class="HasMethodInherited"></run> + </ajc-test> + + <ajc-test title="declare parents : hasmethod(..) - 3" dir="hasmember"> + <compile files="HasPrivateMethodInherited.aj" options="-XhasMember"> + </compile> + <run class="HasPrivateMethodInherited"></run> + </ajc-test> + + <ajc-test title="declare parents : hasmethod(..) - 4" dir="hasmember"> + <compile files="HasMethodViaITD.aj" options="-XhasMember"> + <message kind="warning" line="15" text="hasmethod matched on ITD ok"/> + </compile> + </ajc-test> + + <ajc-test title="declare parents : hasfield(..) - 1" dir="hasmember"> + <compile files="HasField.aj" options="-XhasMember"> + </compile> + <run class="HasField"></run> + </ajc-test> + + <ajc-test title="declare parents : hasfield(..) - 2" dir="hasmember"> + <compile files="HasFieldInherited.aj" options="-XhasMember"> + </compile> + <run class="HasFieldInherited"></run> + </ajc-test> + + <ajc-test title="declare parents : hasfield(..) - 3" dir="hasmember"> + <compile files="HasPrivateFieldInherited.aj" options="-XhasMember"> + </compile> + <run class="HasPrivateFieldInherited"></run> + </ajc-test> + + <!-- Annotation binding tests --> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 1"> + <compile files="CallAnnBinding.aj" options="-1.5"/> + <run class="CallAnnBinding"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 2"> + <compile files="CallAnnBinding2.aj" options="-1.5"/> + <run class="CallAnnBinding2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 3"> + <compile files="CallAnnBinding3.aj" options="-1.5"/> + <run class="CallAnnBinding3"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 4"> + <compile files="CallAnnBinding4.aj" options="-1.5"/> + <run class="CallAnnBinding4"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 5"> + <compile files="CallAnnBinding5.aj" options="-1.5"/> + <run class="CallAnnBinding5"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 6"> + <compile files="CallAnnBinding6.aj" options="-1.5"/> + <run class="CallAnnBinding6"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 7"> + <compile files="CallAnnBinding7.aj" options="-1.5"/> + <run class="CallAnnBinding7"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@target annotation binding 1"> + <compile files="AtTarget1.aj" options="-1.5"/> + <run class="AtTarget1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@target annotation binding 2"> + <compile files="AtTarget2.aj" options="-1.5"/> + <run class="AtTarget2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@target annotation binding 3"> + <compile files="AtTarget3.aj" options="-1.5"/> + <run class="AtTarget3"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@target annotation binding 4"> + <compile files="AtTarget4.aj" options="-1.5"/> + <run class="AtTarget4"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding/usingPackageNames" vm="1.5" title="@target annotation binding 5"> + <compile files="MyAspect.aj,MyAnnotation.java,MyClass.java" options="-1.5"/> + <run class="test.MyClass"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@this annotation binding 1"> + <compile files="AtThis1.aj" options="-1.5"/> + <run class="AtThis1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@this annotation binding 2"> + <compile files="AtThis2.aj" options="-1.5"/> + <run class="AtThis2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@this annotation binding 3"> + <compile files="AtThis3.aj" options="-1.5"/> + <run class="AtThis3"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@this annotation binding 4"> + <compile files="AtThis4.aj" options="-1.5"/> + <run class="AtThis4"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@this annotation binding 5"> + <compile files="AtThis5.aj" options="-1.5"/> + <run class="AtThis5"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@args annotation binding 1"> + <compile files="AtArgs1.aj" options="-1.5"/> + <run class="AtArgs1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@args annotation binding 2"> + <compile files="AtArgs2.aj" options="-1.5"/> + <run class="AtArgs2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@args annotation binding 3"> + <compile files="AtArgs3.aj" options="-1.5"/> + <run class="AtArgs3"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@args annotation binding 4"> + <compile files="AtArgs4.aj" options="-1.5"/> + <run class="AtArgs4"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@args annotation binding 5"> + <compile files="AtArgs5.aj" options="-1.5"/> + <run class="AtArgs5"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="execution and @annotation"> + <compile files="ExecutionAnnBinding1.aj" options="-1.5"/> + <run class="ExecutionAnnBinding1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="set and @annotation"> + <compile files="FieldAnnBinding1.aj" options="-1.5"/> + <run class="FieldAnnBinding1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="get and @annotation"> + <compile files="FieldAnnBinding2.aj" options="-1.5"/> + <run class="FieldAnnBinding2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="get and @annotation with arrays"> + <compile files="FieldAnnBinding3.aj" options="-1.5"/> + <run class="FieldAnnBinding3"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="cons call and @annotation"> + <compile files="CtorAnnBinding1.aj" options="-1.5"/> + <run class="CtorAnnBinding1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="cons exe and @annotation"> + <compile files="CtorAnnBinding2.aj" options="-1.5"/> + <run class="CtorAnnBinding2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="staticinit and @annotation"> + <compile files="StaticInitBinding.aj" options="-1.5"/> + <run class="StaticInitBinding"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="preinit and @annotation"> + <compile files="PreInitBinding.aj" options="-1.5"/> + <run class="PreInitBinding"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="init and @annotation"> + <compile files="InitBinding.aj" options="-1.5"/> + <run class="InitBinding"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="adviceexecution and @annotation"> + <compile files="AdviceExecBinding.aj" options="-1.5"/> + <run class="AdviceExecBinding"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="handler and @annotation"> + <compile files="HandlerBinding.aj" options="-1.5"/> + <run class="HandlerBinding"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@withincode() and call(* println(..))"> + <compile files="WithinCodeBinding1.aj" options="-1.5"/> + <run class="WithinCodeBinding1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@within"> + <compile files="WithinBinding1.aj" options="-1.5"/> + <run class="WithinBinding1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@within - multiple types"> + <compile files="WithinBinding2.aj" options="-1.5"/> + <run class="WithinBinding2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding/complexExample" vm="1.5" title="packages and no binding"> + <compile files="A.java,B.java,Color.java,X.java" options="-1.5"/> + <run class="a.b.c.A"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding/complexExample" vm="1.5" title="packages and binding"> + <compile files="A.java,B.java,Color.java,X2.java" options="-1.5"/> + <run class="a.b.c.A"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="binding with static methods"> + <compile files="StaticMethods.java" options="-1.5"/> + <run class="StaticMethods"/> + </ajc-test> + + <ajc-test dir="java5/annotations" vm="1.5" title="annotation matching on call"> + <weave classesFiles="AnnotatedType.java,SimpleAnnotation.java,SimpleAnnotation2.java" + aspectsFiles="AnnotationAspect02.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'AnnotatedType' (AnnotatedType.java:3) advised by before advice from 'AnnotationAspect02' (aspects.jar!AnnotationAspect02.class:4(from AnnotationAspect02.aj))"/> + <message kind="weave" text="Type 'AnnotatedType' (AnnotatedType.java:3) advised by before advice from 'AnnotationAspect02' (aspects.jar!AnnotationAspect02.class:2(from AnnotationAspect02.aj))"/> + <message kind="weave" text="Type 'AnnotatedType' (AnnotatedType.java:4) advised by before advice from 'AnnotationAspect02' (aspects.jar!AnnotationAspect02.class:4(from AnnotationAspect02.aj))"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/annotations" vm="1.5" title="at annotation matching"> + <weave classesFiles="AnnotatedType.java,SimpleAnnotation.java,SimpleAnnotation2.java" + aspectsFiles="AnnotationAspect03.aj" + options="-1.5,-showWeaveInfo"> + <message kind="warning" line="8" text="@annotation matched here"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/annotations/within_code" vm="1.5" title="annotations and within(code)"> + <weave classesFiles="TestingAnnotations.java" + aspectsFiles="WithinAndWithinCodeTests.java" + options="-1.5,-showWeaveInfo"> + <message kind="warning" line="31" text="@within match on non-inherited annotation"/> + <message kind="warning" line="39" text="@within match on non-inherited annotation"/> + <message kind="warning" line="39" text="@within match on inheritable annotation"/> + <message kind="warning" line="43" text="@within match on inheritable annotation"/> + <message kind="warning" line="32" text="@withincode match"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/annotations/within" vm="1.5" title="annotations and within"> + <weave classesFiles="PlainWithin.java" + aspectsFiles="PlainWithinTests.java" + options="-1.5,-showWeaveInfo"> + <message kind="warning" line="21" text="positive within match on annotation"/> + <message kind="warning" line="25" text="negative within match on annotation"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/annotations/thisOrtarget" vm="1.5" title="must have runtime retention"> + <compile options="-1.5" files="NotRuntimeRetention.aj"> + <message kind="error" line="20" text="Annotation type MySourceAnnotation does not have runtime retention"/> + <message kind="error" line="21" text="Annotation type MyClassAnnotation does not have runtime retention"/> + <message kind="error" line="22" text="Annotation type MyAnnotation does not have runtime retention"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/thisOrtarget" vm="1.5" title="inheritable or not"> + <compile options="-1.5" files="TestingAnnotations.java,ThisOrTargetTests.aj"> + </compile> + <run class="TestingAnnotations"/> + </ajc-test> + + <ajc-test dir="java5/annotations/thisOrtarget" vm="1.5" title="use of @this/target in deow"> + <compile options="-1.5" files="TestingAnnotations.java,DeclareEoW.java"> + <message kind="error" line="3" text="this() pointcut designator cannot be used in declare statement"/> + <message kind="error" line="5" text="target() pointcut designator cannot be used in declare statement"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/args" vm="1.5" title="@args tests"> + <compile options="-1.5" files="TestingArgsAnnotations.java,AtArgsAspect.java"> + </compile> + <run class="TestingArgsAnnotations"/> + </ajc-test> + + <ajc-test dir="java5/annotations/args" vm="1.5" title="use of @args in deow"> + <compile options="-1.5" files="TestingArgsAnnotations.java,DeclareEoW.java"> + <message kind="error" line="3" text="args() pointcut designator cannot be used in declare statement"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations" vm="1.5" title="compiling an annotation"> + <compile options="-1.5" files="SimpleAnnotation.java"> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations" vm="1.5" title="compiling annotated file"> + <compile options="-1.5" files="SimpleAnnotation.java,AnnotatedType.java"> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/within" vm="1.5" title="annotations and within (src)"> + <compile files="PlainWithin.java,PlainWithinTests.java" + aspectsFiles="PlainWithinTests.java" + options="-1.5"> + <message kind="warning" line="21" text="positive within match on annotation"/> + <message kind="warning" line="25" text="negative within match on annotation"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/attarget" vm="1.5" title="losing annotations..."> + <compile options="-1.5" files="Program.java,AtTargetAspect.java"> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations" vm="1.5" title="no itds on annotation types"> + <compile files="AnnotatedType.java,SimpleAnnotation.java,SimpleAnnotation2.java,AnnotationAspect01.aj" + options="-1.5"> + <message kind="error" line="4" text="can't make inter-type constructor declarations"/> + <message kind="error" line="8" text="can't make inter-type method declarations"/> + <message kind="error" line="13" text="can't make inter-type field declarations"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations" vm="1.5" title="no declare parents on annotation types"> + <compile files="AnnotatedType.java,SimpleAnnotation.java,SimpleAnnotation2.java,AnnotationAspect04.aj" + options="-1.5"> + <message kind="error" line="7" text="can't use declare parents to alter supertype of annotation type SimpleAnnotation"/> + <message kind="error" line="10" text="can't use declare parents to make 'java.lang.annotation.Annotation' the parent of type"/> + <message kind="error" line="4" text="can't use declare parents to make annotation type SimpleAnnotation implement an interface"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations" vm="1.5" title="declare parents wildcards matching annotation types"> + <compile files="AnnotatedType.java,SimpleAnnotation.java,SimpleAnnotation2.java,AnnotationAspect05.aj" + options="-1.5"> + <message kind="warning" line="4" text="annotation type SimpleAnnotation2 matches a declare parents type pattern but is being ignored"/> + <message kind="warning" line="4" text="annotation type SimpleAnnotation matches a declare parents type pattern but is being ignored"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/binding/complexExample" vm="1.5" title="annotated any pattern"> + <compile files="A.java,B.java,C.java,Color.java,X3.java" + options="-1.5"> + </compile> + <run class="g.h.i.C"/> + <run class="a.b.c.A"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding/complexExample" vm="1.5" title="annotation not imported"> + <compile files="A.java,B.java,C.java,Color.java,X4.java" + options="-1.5"> + <message kind="warning" line="6" text="no match for this type name: Color"/> + </compile> + <run class="a.b.c.A"/> + </ajc-test> + + <ajc-test dir="java5/annotations/itds" vm="1.5" title="annotated public itds"> + <compile files="AtItd2.aj" options="-1.5"/> + <run class="AtItd2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/itds" vm="1.5" title="annotated public itds - values"> + <compile files="AtItd3.aj" options="-1.5"/> + <run class="AtItd3"/> + </ajc-test> + + <ajc-test dir="java5/annotations/itds" vm="1.5" title="annotated public itds - multiple complex annotations"> + <compile files="AtItd4.aj" options="-1.5"/> + <run class="AtItd4"/> + </ajc-test> + + + <ajc-test dir="java5/annotations/itds" vm="1.5" title="nasty annotation and itds test"> + <compile files="AnnotationsAndITDs.aj" options="-1.5"> + <!-- first two are ITCs, second two are ITCs annotated via declare @ctor, third is default ctor --> + <message kind="warning" line="17" text="execution(@SomeAnnotation ...new(..)"/> + <message kind="warning" line="20" text="execution(@SomeAnnotation ...new(..)"/> + <message kind="warning" line="45" text="execution(@SomeAnnotation ...new(..)"/> + <message kind="warning" line="46" text="execution(@SomeAnnotation ...new(..)"/> + <message kind="warning" line="180" text="execution(@SomeAnnotation ...new(..)"/> + + <!-- first four are fields annotated via declare, last two are directly annotated ITDs --> + <message kind="warning" line="59" text="set(@SomeAnnotation...)"/> + <message kind="warning" line="60" text="set(@SomeAnnotation...)"/> + <message kind="warning" line="70" text="set(@SomeAnnotation...)"/> + <message kind="warning" line="71" text="set(@SomeAnnotation...)"/> + <message kind="warning" line="76" text="set(@SomeAnnotation...)"/> + <message kind="warning" line="77" text="set(@SomeAnnotation...)"/> + + <!-- annotations added via declare --> + <message kind="warning" line="175" text="si(@SomeAnnotation...)"/> + <message kind="warning" line="180" text="si(@SomeAnnotation...)"/> + + <message kind="warning" line="25" text="execution(@SomeAnnotation ...)"/> + <message kind="warning" line="28" text="execution(@SomeAnnotation ...)"/> + <message kind="warning" line="52" text="execution(@SomeAnnotation ...)"/> + <message kind="warning" line="53" text="execution(@SomeAnnotation ...)"/> + <!--message kind="warning" line="70" text="set(@SomeAnnotation...)"/> + <message kind="warning" line="71" text="set(@SomeAnnotation...)"/--> + </compile> + <run class="AnnotationsAndITDs"> + <stderr> + <line text="@type java.lang.System (AnnotationsAndITDs.aj:0)"/> + <line text="hello AnnotationsAndITDs (AnnotationsAndITDs.aj:17)"/> + <line text="goodbye java.lang.String (AnnotationsAndITDs.aj:20)"/> + <line text="goodbye java.lang.String (AnnotationsAndITDs.aj:20)"/> + <line text="y java.lang.Integer (AnnotationsAndITDs.aj:28)"/> + <line text="d java.lang.Double (AnnotationsAndITDs.aj:70)"/> + <line text="f java.lang.Double (AnnotationsAndITDs.aj:71)"/> + <line text="@type java.lang.System (AnnotationsAndITDs.aj:0)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:59)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:60)"/> + <line text="@cons java.lang.String (AnnotationsAndITDs.aj:45)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:59)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:60)"/> + <line text="@cons java.lang.String (AnnotationsAndITDs.aj:46)"/> + <line text="@cons java.lang.String (AnnotationsAndITDs.aj:46)"/> + <line text="@method ITDMe2 (AnnotationsAndITDs.aj:53)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:76)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:77)"/> + + <!-- + <line text="method bar has 1 params, first param annotation is @ParamAnnotation"/> + --> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" pr="91858" title="declare @Type (should be @type)"> + <compile files="DeathByPoorSpelling.aj" options="-1.5"> + <message kind="error" line="6" text="Syntax error on token ":", "one of type, method, field, constructor" expected"/> + </compile> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- Autoboxing tests --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="simple boxing test"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,SimpleAutoboxingAspect.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'SimpleAutoboxing' (SimpleAutoboxing.java:7) advised by before advice from 'SimpleAutoboxingAspect' (SimpleAutoboxingAspect.aj:8)"/> + <message kind="weave" text="Type 'SimpleAutoboxing' (SimpleAutoboxing.java:7) advised by before advice from 'SimpleAutoboxingAspect' (SimpleAutoboxingAspect.aj:4)"/> + </compile> + <run class="SimpleAutoboxing"> + <stderr> + <line text="Matching by Integer:20000"/> + <line text="Matching by int:20000"/> + <line text="method_takes_Integer=20000"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="integer boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectInteger.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:11) advised by before advice from 'AspectInteger' (AspectInteger.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:11) advised by before advice from 'AspectInteger' (AspectInteger.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:12) advised by before advice from 'AspectInteger' (AspectInteger.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:12) advised by before advice from 'AspectInteger' (AspectInteger.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:13) advised by before advice from 'AspectInteger' (AspectInteger.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:13) advised by before advice from 'AspectInteger' (AspectInteger.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:14) advised by before advice from 'AspectInteger' (AspectInteger.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:14) advised by before advice from 'AspectInteger' (AspectInteger.aj:4)"/> + </compile> + <run class="AutoboxingI"> + <stderr> + <line text="Matching by Integer:10000"/> + <line text="Matching by int:10000"/> + <line text="method_takes_Integer=10000"/> + <line text="Matching by Integer:20000"/> + <line text="Matching by int:20000"/> + <line text="method_takes_Integer=20000"/> + <line text="Matching by Integer:30000"/> + <line text="Matching by int:30000"/> + <line text="method_takes_int=30000"/> + <line text="Matching by Integer:40000"/> + <line text="Matching by int:40000"/> + <line text="method_takes_int=40000"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="char boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectChar.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:11) advised by before advice from 'AspectChar' (AspectChar.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:11) advised by before advice from 'AspectChar' (AspectChar.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:12) advised by before advice from 'AspectChar' (AspectChar.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:12) advised by before advice from 'AspectChar' (AspectChar.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:13) advised by before advice from 'AspectChar' (AspectChar.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:13) advised by before advice from 'AspectChar' (AspectChar.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:14) advised by before advice from 'AspectChar' (AspectChar.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:14) advised by before advice from 'AspectChar' (AspectChar.aj:4)"/> + </compile> + <run class="AutoboxingC"> + <stderr> + <line text="Character:1"/> + <line text="char:1"/> + <line text="method_takes_Character=1"/> + <line text="Character:2"/> + <line text="char:2"/> + <line text="method_takes_Character=2"/> + <line text="Character:3"/> + <line text="char:3"/> + <line text="method_takes_char=3"/> + <line text="Character:4"/> + <line text="char:4"/> + <line text="method_takes_char=4"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="double boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectDouble.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:11) advised by before advice from 'AspectDouble' (AspectDouble.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:11) advised by before advice from 'AspectDouble' (AspectDouble.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:12) advised by before advice from 'AspectDouble' (AspectDouble.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:12) advised by before advice from 'AspectDouble' (AspectDouble.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:13) advised by before advice from 'AspectDouble' (AspectDouble.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:13) advised by before advice from 'AspectDouble' (AspectDouble.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:14) advised by before advice from 'AspectDouble' (AspectDouble.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:14) advised by before advice from 'AspectDouble' (AspectDouble.aj:4)"/> + </compile> + <run class="AutoboxingD"> + <stderr> + <line text="Double:100.0"/> + <line text="double:100.0"/> + <line text="method_takes_Double=100.0"/> + <line text="Double:200.0"/> + <line text="double:200.0"/> + <line text="method_takes_Double=200.0"/> + <line text="Double:300.0"/> + <line text="double:300.0"/> + <line text="method_takes_double=300.0"/> + <line text="Double:400.0"/> + <line text="double:400.0"/> + <line text="method_takes_double=400.0"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="float boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectFloat.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:11) advised by before advice from 'AspectFloat' (AspectFloat.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:11) advised by before advice from 'AspectFloat' (AspectFloat.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:12) advised by before advice from 'AspectFloat' (AspectFloat.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:12) advised by before advice from 'AspectFloat' (AspectFloat.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:13) advised by before advice from 'AspectFloat' (AspectFloat.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:13) advised by before advice from 'AspectFloat' (AspectFloat.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:14) advised by before advice from 'AspectFloat' (AspectFloat.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:14) advised by before advice from 'AspectFloat' (AspectFloat.aj:4)"/> + </compile> + <run class="AutoboxingF"> + <stderr> + <line text="Float:100.0"/> + <line text="float:100.0"/> + <line text="method_takes_Float=100.0"/> + <line text="Float:200.0"/> + <line text="float:200.0"/> + <line text="method_takes_Float=200.0"/> + <line text="Float:300.0"/> + <line text="float:300.0"/> + <line text="method_takes_float=300.0"/> + <line text="Float:400.0"/> + <line text="float:400.0"/> + <line text="method_takes_float=400.0"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="short boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectShort.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:11) advised by before advice from 'AspectShort' (AspectShort.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:11) advised by before advice from 'AspectShort' (AspectShort.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:12) advised by before advice from 'AspectShort' (AspectShort.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:12) advised by before advice from 'AspectShort' (AspectShort.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:13) advised by before advice from 'AspectShort' (AspectShort.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:13) advised by before advice from 'AspectShort' (AspectShort.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:14) advised by before advice from 'AspectShort' (AspectShort.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:14) advised by before advice from 'AspectShort' (AspectShort.aj:4)"/> + </compile> + <run class="AutoboxingS"> + <stderr> + <line text="Short:100"/> + <line text="short:100"/> + <line text="method_takes_Short=100"/> + <line text="Short:200"/> + <line text="short:200"/> + <line text="method_takes_Short=200"/> + <line text="Short:300"/> + <line text="short:300"/> + <line text="method_takes_short=300"/> + <line text="Short:400"/> + <line text="short:400"/> + <line text="method_takes_short=400"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="long boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectLong.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:11) advised by before advice from 'AspectLong' (AspectLong.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:11) advised by before advice from 'AspectLong' (AspectLong.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:12) advised by before advice from 'AspectLong' (AspectLong.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:12) advised by before advice from 'AspectLong' (AspectLong.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:13) advised by before advice from 'AspectLong' (AspectLong.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:13) advised by before advice from 'AspectLong' (AspectLong.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:14) advised by before advice from 'AspectLong' (AspectLong.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:14) advised by before advice from 'AspectLong' (AspectLong.aj:4)"/> + </compile> + <run class="AutoboxingJ"> + <stderr> + <line text="Long:1000000"/> + <line text="long:1000000"/> + <line text="method_takes_Long=1000000"/> + <line text="Long:2000000"/> + <line text="long:2000000"/> + <line text="method_takes_Long=2000000"/> + <line text="Long:3000000"/> + <line text="long:3000000"/> + <line text="method_takes_long=3000000"/> + <line text="Long:4000000"/> + <line text="long:4000000"/> + <line text="method_takes_long=4000000"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="boolean boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectBoolean.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:9) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:9) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:10) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:10) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:11) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:11) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:12) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:12) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:4)"/> + </compile> + <run class="AutoboxingZ"> + <stderr> + <line text="Boolean:false"/> + <line text="boolean:false"/> + <line text="method_takes_Boolean=false"/> + <line text="Boolean:false"/> + <line text="boolean:false"/> + <line text="method_takes_Boolean=false"/> + <line text="Boolean:false"/> + <line text="boolean:false"/> + <line text="method_takes_boolean=false"/> + <line text="Boolean:false"/> + <line text="boolean:false"/> + <line text="method_takes_boolean=false"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="byte boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectByte.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:11) advised by before advice from 'AspectByte' (AspectByte.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:11) advised by before advice from 'AspectByte' (AspectByte.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:12) advised by before advice from 'AspectByte' (AspectByte.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:12) advised by before advice from 'AspectByte' (AspectByte.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:13) advised by before advice from 'AspectByte' (AspectByte.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:13) advised by before advice from 'AspectByte' (AspectByte.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:14) advised by before advice from 'AspectByte' (AspectByte.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:14) advised by before advice from 'AspectByte' (AspectByte.aj:4)"/> + </compile> + <run class="AutoboxingB"> + <stderr> + <line text="Byte:1"/> + <line text="byte:1"/> + <line text="method_takes_Byte=1"/> + <line text="Byte:50"/> + <line text="byte:50"/> + <line text="method_takes_Byte=50"/> + <line text="Byte:3"/> + <line text="byte:3"/> + <line text="method_takes_byte=3"/> + <line text="Byte:52"/> + <line text="byte:52"/> + <line text="method_takes_byte=52"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="boxing in after returning"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectAfterReturning.aj" + options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'AspectAfterReturning' (AspectAfterReturning.aj:18) advised by afterReturning advice from 'AspectAfterReturning' (AspectAfterReturning.aj:4)"/> + <message kind="weave" text="Type 'AspectAfterReturning' (AspectAfterReturning.aj:18) advised by afterReturning advice from 'AspectAfterReturning' (AspectAfterReturning.aj:8)"/> + <message kind="weave" text="Type 'AspectAfterReturning' (AspectAfterReturning.aj:18) advised by afterReturning advice from 'AspectAfterReturning' (AspectAfterReturning.aj:12)"/> + <message kind="weave" text="Type 'AspectAfterReturning' (AspectAfterReturning.aj:19) advised by afterReturning advice from 'AspectAfterReturning' (AspectAfterReturning.aj:4)"/> + <message kind="weave" text="Type 'AspectAfterReturning' (AspectAfterReturning.aj:19) advised by afterReturning advice from 'AspectAfterReturning' (AspectAfterReturning.aj:8)"/> + <message kind="weave" text="Type 'AspectAfterReturning' (AspectAfterReturning.aj:19) advised by afterReturning advice from 'AspectAfterReturning' (AspectAfterReturning.aj:12)"/> + </compile> + <run class="AspectAfterReturning"> + <stderr> + <line text="Returning I=5"/> + <line text="Returning Integer=5"/> + <line text="Returning Object=5"/> + <line text="Returning I=10"/> + <line text="Returning Integer=10"/> + <line text="Returning Object=10"/> + </stderr> + </run> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- Covariance tests --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 1"> + <compile options="-1.5,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect01.aj"> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:26) advised by before advice from 'CovAspect01' (CovAspect01.aj:5)"/> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect01' (CovAspect01.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 2"> + <compile options="-1.5,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect02.aj"> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:26) advised by before advice from 'CovAspect02' (CovAspect02.aj:5)"/> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect02' (CovAspect02.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 3"> + <compile options="-1.5,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect03.aj"> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:26) advised by before advice from 'CovAspect03' (CovAspect03.aj:5)"/> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect03' (CovAspect03.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 4"> + <compile options="-1.5,-showWeaveInfo" files="CovBaseProgram02.java,CovAspect04.aj"> + <message kind="weave" text="Type 'CovBaseProgram02' (CovBaseProgram02.java:30) advised by before advice from 'CovAspect04' (CovAspect04.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 5"> + <compile options="-1.5,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect05.aj"> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:26) advised by before advice from 'CovAspect05' (CovAspect05.aj:5)"/> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect05' (CovAspect05.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 6"> + <compile options="-1.5,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect06.aj"> + <message kind="warning" line="3" text="does not match because declaring type is Super"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 7"> + <compile options="-1.5,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect07.aj"> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect07' (CovAspect07.aj:5)"/> + <message kind="warning" line="3" text="does not match because declaring type is Super"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 8"> + <compile options="-1.5,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect08.aj"> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect08' (CovAspect08.aj:11)"/> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect08' (CovAspect08.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 9"> + <compile options="-1.5,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect09.aj"> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 10"> + <compile options="-1.5,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect10.aj"> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:26) advised by before advice from 'CovAspect10' (CovAspect10.aj:5)"/> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect10' (CovAspect10.aj:5)"/> + </compile> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- Enum tests --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/enums" vm="1.5" title="cant itd constructor on enum"> + <compile files="SimpleEnum.java,SimpleEnum2.java,EnumAspect01.aj" options="-1.5"> + <message kind="error" line="2" text="can't make inter-type constructor declarations on enum types"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/enums" vm="1.5" title="cant itd field or method on enum"> + <compile files="SimpleEnum.java,SimpleEnum2.java,EnumAspect02.aj" options="-1.5"> + <message kind="error" line="2" text="can't make inter-type method declarations on enum types"/> + <message kind="error" line="6" text="can't make inter-type field declarations on enum types"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/enums" vm="1.5" title="declare parents and enums"> + <compile files="SimpleEnum.java,SimpleEnum2.java,EnumAspect03.aj" options="-1.5"> + <message kind="error" line="5" text="can't use declare parents to make enum type SimpleEnum implement an interface"/> + <message kind="error" line="8" text="can't use declare parents to alter supertype of enum type SimpleEnum"/> + <message kind="error" line="11" text="can't use declare parents to make 'java.lang.Enum' the parent of type EnumAspect03$D"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/enums" vm="1.5" title="wildcard enum match in itd"> + <compile files="SimpleEnum.java,SimpleEnum2.java,EnumAspect04.aj" options="-1.5"> + <message kind="warning" line="5" text="enum type SimpleEnum2 matches a declare parents type pattern but is being ignored"/> + <message kind="warning" line="5" text="enum type SimpleEnum matches a declare parents type pattern but is being ignored"/> + </compile> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- pertypewithin tests --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/pertypewithin" title="basic ptw test"> + <compile files="A.java,B.java,C.java,D.java,Main.java,X.java" options="-Xlint:ignore"/> + <run class="p.A"> + <stderr> + <line text="hi from A"/> + <line text="after() returning from a method call to sayhi()"/> + <line text="hi from A"/> + <line text="after() returning from a method call to sayhi()"/> + <line text="Tests in A have passed"/> + <line text="callcount = 2"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/pertypewithin" title="ptw hasAspect"> + <compile files="A.java,B.java,C.java,D.java,Main.java,X.java" options="-Xlint:ignore"/> + <run class="p.B"> + <stderr> + <line text="hi from B"/> + <line text="after() returning from a method call to sayhi()"/> + <line text="hi from B"/> + <line text="after() returning from a method call to sayhi()"/> + <line text="hi from B"/> + <line text="after() returning from a method call to sayhi()"/> + <line text="callcount = 3"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/pertypewithin" title="ptw aspectOf"> + <compile files="A.java,B.java,C.java,D.java,Main.java,X.java" options="-Xlint:ignore"/> + <run class="p.C"/> + </ajc-test> + + <ajc-test dir="java5/pertypewithin" title="ptw multi-aspects"> + <compile files="P.java,Q.java,R.java"/> + <run class="P"> + <stderr> + <line text="Q reporting 2"/> + <line text="R reporting 3"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/pertypewithin" title="ptw binary"> + <weave classesFiles="G.java" aspectsFiles="H.java" options="-1.4"/> + <run class="G"> + <stderr> + <line text="advice running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/pertypewithin" title="ptw binary aspect"> + <compile files="H.java" outjar="aspects.jar" options="-1.4"> + <message kind="warning" line="1" text="no match for this type name: G"/> + </compile> + <compile files="G.java" aspectpath="aspects.jar"/> + <run class="G"> + <stderr> + <line text="advice running"/> + </stderr> + </run> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- varargs tests --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/varargs" vm="1.5" title="varargs not matched by Object[] (call)"> + <compile files="SimpleVarargs.java,VarargsAspect01.aj" options="-1.5,-showWeaveInfo"> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs" vm="1.5" title="varargs not matched by Object[] (exe)"> + <compile files="SimpleVarargs.java,VarargsAspect02.aj" options="-1.5,-showWeaveInfo"> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs" vm="1.5" title="varargs not matched by Object[] (init)"> + <compile files="SimpleVarargs.java,VarargsAspect03.aj" options="-1.5,-showWeaveInfo"> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs" vm="1.5" title="varargs not matched by Object[] (withincode)"> + <compile files="SimpleVarargs.java,VarargsAspect04.aj" options="-1.5,-showWeaveInfo"> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs" vm="1.5" title="call with varargs signature"> + <compile files="SimpleVarargs.java,VarargsAspect05.aj" options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'SimpleVarargs' (SimpleVarargs.java:20) advised by before advice from 'VarargsAspect05' (VarargsAspect05.aj:3)"/> + <message kind="weave" text="Type 'SimpleVarargs' (SimpleVarargs.java:21) advised by before advice from 'VarargsAspect05' (VarargsAspect05.aj:3)"/> + <message kind="weave" text="Type 'SimpleVarargs' (SimpleVarargs.java:22) advised by before advice from 'VarargsAspect05' (VarargsAspect05.aj:3)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs" vm="1.5" title="call with varargs multi-signature"> + <compile files="SimpleVarargs.java,VarargsAspect06.aj" options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'SimpleVarargs' (SimpleVarargs.java:25) advised by before advice from 'VarargsAspect06' (VarargsAspect06.aj:3)"/> + <message kind="weave" text="Type 'SimpleVarargs' (SimpleVarargs.java:26) advised by before advice from 'VarargsAspect06' (VarargsAspect06.aj:3)"/> + <message kind="weave" text="Type 'SimpleVarargs' (SimpleVarargs.java:27) advised by before advice from 'VarargsAspect06' (VarargsAspect06.aj:3)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/suppressedWarnings" vm="1.5" title="suppressing non-matching advice warnings"> + <compile files="Suppression1.aj" options="-1.5,-showWeaveInfo"> + <message kind="warning" line="13"/> + <message kind="warning" line="21"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/suppressedWarnings" vm="1.5" title="suppressing non-matching advice warnings when multiple source files involved"> + <compile files="A.java,A1.aj,A2.aj,A3.aj" options="-1.5,-showWeaveInfo"> + <message kind="warning" line="4" file="A1.aj"/> + <message kind="warning" line="4" file="A2.aj"/> + <message kind="warning" line="11" file="A2.aj"/> + <message kind="warning" line="4" file="A3.aj"/> + <message kind="warning" line="11" file="A3.aj"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="XLint warning for advice not applied with cflow(execution)" pr="93345"> + <compile options="-Xlint,-1.5" files="PR93345.aj" > + <message kind="warning" line="9" text="advice defined in AnAspect has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="NPE in reflect implementation" pr="94167"> + <compile files="PR94167.java"/> + <run class="reflect.PR94167"/> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- annotated aspect members --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/annotations/aspectMembers" title="annotated annotations (@Target)"> + <compile files="a/Annotations.java,a/Foo.java" options="-1.5"> + <message kind="error" line="16" text="The annotation @MethodAnnotation is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="simple annotated aspect members"> + <compile files="a/Annotations.java,a/AnnotatedAspect.aj" options="-1.5"> + <message kind="warning" line="4" text="annotated type"/> + <message kind="warning" line="6" text="annotated field"/> + <message kind="warning" line="8" text="annotated method"/> + <message kind="warning" line="11" text="annotated constructor"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="simple annotated aspect members with bad target"> + <compile files="a/Annotations.java,a/AnnotatedAspect02.aj" options="-1.5"> + <message kind="error" line="3" text="The annotation @MethodAnnotation is disallowed for this location"/> + <message kind="error" line="6" text="The annotation @TypeAnnotation is disallowed for this location"/> + <message kind="error" line="8" text="The annotation @FieldAnnotation is disallowed for this location"/> + <message kind="error" line="10" text="The annotation @AnnotationAnnotation is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="annotated itds"> + <compile files="a/Annotations.java,a/AnnotatedAspect03.aj" options="-1.5"> + <message kind="warning" line="4" text="annotated type"/> + <message kind="warning" line="6" text="annotated field"/> + <message kind="warning" line="8" text="annotated field"/> + <message kind="warning" line="10" text="annotated method"/> + <message kind="warning" line="12" text="annotated constructor"/> + <message kind="warning" line="12" text="annotated field"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="annotated itds with bad target"> + <compile files="a/Annotations.java,a/AnnotatedAspect04.aj" options="-1.5"> + <message kind="error" line="6" text="The annotation @ConstructorAnnotation is disallowed for this location"/> + <message kind="error" line="8" text="The annotation @FieldAnnotation is disallowed for this location"/> + <message kind="error" line="10" text="The annotation @TypeAnnotation is disallowed for this location"/> + <!-- known limitation... + <message kind="error" line="12" text="The annotation @MethodAnnotation is disallowed for this location"/> + --> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="annotated advice"> + <compile files="a/Annotations.java,a/AnnotatedAspect05.aj" options="-1.5"> + <message kind="warning" line="17"/> + </compile> + <run class="a.AnnotatedAspect05"/> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="annotated advice with bad target"> + <compile files="a/Annotations.java,a/AnnotatedAspect06.aj" options="-1.5"> + <message kind="error" line="6" text="The annotation @ConstructorAnnotation is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="annotated pointcut"> + <compile files="a/Annotations.java,a/AnnotatedAspect07.aj" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="annotated declare statements"> + <compile files="a/Annotations.java,a/AnnotatedAspect08.aj" options="-1.5"> + </compile> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- ajdk examples --> + <!-- ======================================================================================= --> + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: annotating aspects chapter"> + <compile files="AnnotatingAspects.aj" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: annotating aspects chapter, ex 2"> + <compile files="SuppressAj.aj" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: annotation pattern matching"> + <compile files="AnnotationPatternMatching.aj,org/xyz/OrgXYZAnnotation.java" options="-1.5"> + <message kind="warning" line="25" text="@Immutable"/> + <message kind="warning" line="25" text="!@Persistent"/> + <message kind="warning" line="29" text="!@Persistent"/> + <message kind="warning" line="31" text="!@Persistent"/> + <message kind="warning" line="33" text="!@Persistent"/> + <message kind="warning" line="29" text="@Foo @Goo"/> + <message kind="warning" line="29" text="@(Foo || Goo)"/> + <message kind="warning" line="31" text="@(Foo || Goo)"/> + <message kind="warning" line="33" text="@(org.xyz..*)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: annotation type pattern matching"> + <compile files="AnnotationsInTypePatterns.aj,org/xyz/OrgXYZAnnotation.java,org/xyz/Types.java,org/abc/Types.java,anns/Immutable.java,anns/NonPersistent.java" options="-1.5"> + <message kind="warning" line="23" text="(@Immutable *)"/> + <message kind="warning" line="32" text="(@Immutable *)"/> + <message kind="warning" line="3" text="(@Immutable *)"/> + <message kind="warning" line="5" text="(@Immutable *)"/> + <message kind="warning" line="8" text="(@Immutable *)"/> + <message kind="warning" line="25" text="(!@Immutable *)"/> + <message kind="warning" line="27" text="(!@Immutable *)"/> + <message kind="warning" line="29" text="(!@Immutable *)"/> + <message kind="warning" line="5" text="(!@Immutable *)"/> + <message kind="warning" line="6" text="(!@Immutable *)"/> + <message kind="warning" line="2" text="(!@Immutable *)"/> + <message kind="warning" line="2" text="(!@Immutable *)"/> + <message kind="warning" line="5" text="(!@Immutable *)"/> + <message kind="warning" line="3" text="@Immutable (org.xyz.* || org.abc.*)"/> + <message kind="warning" line="5" text="@Immutable (org.xyz.* || org.abc.*)"/> + <message kind="warning" line="8" text="@Immutable (org.xyz.* || org.abc.*)"/> + <message kind="warning" line="32" text="((@Immutable Foo+) || Goo)"/> + <message kind="warning" line="27" text="((@Immutable Foo+) || Goo)"/> + <message kind="warning" line="3" text="@(Immutable || NonPersistent) org.xyz..*"/> + <message kind="warning" line="6" text="@(Immutable || NonPersistent) org.xyz..*"/> + <message kind="warning" line="8" text="@(Immutable || NonPersistent) org.xyz..*"/> + <message kind="warning" line="8" text="@Immutable @NonPersistent org.xyz..*"/> + <message kind="warning" line="6" text="@(@Inherited *) org.xyz..*"/> + <message kind="warning" line="8" text="@(@Inherited *) org.xyz..*"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: annotations in sig patterns"> + <compile files="AnnotationsInSignaturePatterns.aj,anns/Cachable.java,anns/SensitiveData.java,anns/Persisted.java,Classified.java,anns/Immutable.java,Secure.java,Catastrophic.java,Oneway.java,anns/Transaction.java,org/xyz/SignatureTypes.java" options="-1.5"> + <message kind="warning" line="32" text="@SensitiveData * *"/> + <message kind="warning" line="7" text="@SensitiveData * *"/> + <message kind="warning" line="13" text="@SensitiveData * *"/> + <message kind="warning" line="7" text="@SensitiveData List org.xyz..*.*"/> + <message kind="warning" line="11" text="(@SensitiveData *) org.xyz..*.*"/> + <message kind="warning" line="13" text="(@SensitiveData *) org.xyz..*.*"/> + <message kind="warning" line="50" text="@Foo (@Goo *) (@Hoo *).*"/> + <message kind="warning" line="38" text="@Persisted @Classified * *"/> + + <message kind="warning" line="44" text="@Oneway * *(..)"/> + <message kind="warning" line="18" text="@Transaction * (@Persisted org.xyz..*).*(..)"/> + <message kind="warning" line="52" text="* *.*(@Immutable *,..)"/> + <message kind="warning" line="53" text="* *.*(@Immutable *,..)"/> + <message kind="warning" line="54" text="* *.*(@Immutable *,..)"/> + + <message kind="warning" line="62" text="within(@Secure *)"/> + <message kind="warning" line="63" text="within(@Secure *)"/> + <message kind="warning" line="66" text="staticinitialization(@Persisted *)"/> + <message kind="warning" line="17" text="staticinitialization(@Persisted *)"/> + <message kind="warning" line="56" text="call(@Oneway * *(..))"/> + <message kind="warning" line="28" text="execution(public (@Immutable *) org.xyz..*.*(..))"/> + <message kind="warning" line="26" text="set(@Cachable * *)"/> + <message kind="warning" line="80" text="handler(!@Catastrophic *)"/> + + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: runtime annotations"> + <compile files="RuntimeTypeMatching.aj" options="-1.5"> + <message kind="warning" line="121" text="@within(Foo)"/> + <message kind="warning" line="122" text="@within(Foo)"/> + </compile> + <run class="RuntimeTypeMatching"> + <stdout> + <line text="This information is TOP-SECRET"/> + <line text="@target(Classified) at call(void A.a())"/> + <line text="@this(Foo) at execution(void B.b())"/> + <line text="Classified data being passed at call(void B.callA(A))"/> + <line text="Classified data being passed at execution(void B.callA(A))"/> + <line text="This information is TOP-SECRET"/> + <line text="@target(Classified) at call(Class java.lang.Object.getClass())"/> + <line text="1 @Foo()"/> + <line text="1 @Foo()"/> + <line text="1 @Classified(classification=TOP-SECRET)" vm="1.5,1.6,1.7,1.8"/> + <line text="1 @Classified(classification="TOP-SECRET")" vm="9+"/> + <line text="This information is TOP-SECRET"/> + <line text="Entering critical join point with priority 3"/> + <line text="Entering critical join point with reflectively obtained priority 3"/> + <line text="@target(Classified) at call(void A.a())"/> + <line text="@this(Foo) at execution(void B.callA(A))"/> + <line text="(Class) Transaction required at execution(void ByeByeEJB.method1())"/> + <line text="(Method) Transaction required at execution(void ByeByeEJB.method1())"/> + <line text="(Class) Transaction required at execution(void ByeByeEJB.method2())"/> + <line text="(Method) Transaction required at execution(void ByeByeEJB.method2())"/> + <line text="(Class) Transaction required at execution(void ByeByeEJB.method3())"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: @retention checking"> + <compile files="RetentionTime.aj" options="-1.5"> + <message kind="error" line="8" text="Annotation type Goo does not have runtime retention"/> + <message kind="error" line="13" text="Annotation type Goo does not have runtime retention"/> + <message kind="error" line="18" text="Annotation type Goo does not have runtime retention"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: @inherited"> + <compile files="AnnotationInheritance.aj" options="-1.5"> + <message kind="warning" line="16" text="annotatedMethodCall()"/> + <!-- <message kind="warning" line="17" text="annotatedMethodCall()"/> --> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: deow-ann"> + <compile files="DeclaresWithAnnotations.aj,org/xyz/model/Model.java" options="-1.5"> + <message kind="warning" line="27" text="Expensive operation called from within performance critical section"/> + <message kind="error" line="26" text="Untrusted code should not call the model classes directly"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: decp-ann"> + <compile files="DecpAnnotations.aj" options="-1.5"> + </compile> + <run class="DecpAnnotations"> + <stdout> + <line text="Test Foo is not secured: PASS"/> + <line text="Test Goo is secured: PASS"/> + <line text="goo credentials: none"/> + <line text="Test BankAccount is not secured: PASS"/> + <line text="Test PrivateBankAccount is not secured: PASS"/> + <line text="Test BusinessBankAccount is secured: PASS"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: dec precedence"> + <compile files="PrecedenceAnnotations.aj" options="-1.5"> + </compile> + <run class="PrecedenceAnnotations"> + <stdout> + <line text="@Security S2"/> + <line text="S1"/> + <line text="@Performance P2"/> + <line text="P1"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: dec annotation"> + <compile files="DeclareAnnotation.aj,org/xyz/model/Model.java" options="-1.5"> + <message kind="warning" line="3" text="@BusinessDomain"/> + <message kind="warning" line="43" text="@Secured"/> + <message kind="warning" line="44" text="@Secured"/> + <message kind="warning" line="55" text="@Secured"/> + <message kind="warning" line="62" text="@Persisted"/> + <message kind="warning" line="68" text="@Persisted"/> + <message kind="warning" line="41" text="@Secured"/> + <message kind="warning" line="51" text="@Secured"/> + </compile> + <run class="DeclareAnnotation"/> + </ajc-test> + + <ajc-test dir="java5/covariance/ajdk" title="ajdk: covariance"> + <compile files="AJDKExamples.aj" options="-1.5"> + <message kind="warning" line="43" text="call(* whoAreYou())"/> + <message kind="warning" line="44" text="call(* whoAreYou())"/> + <message kind="warning" line="43" text="call(* A.whoAreYou())"/> + <message kind="warning" line="44" text="call(* A.whoAreYou())"/> + <message kind="warning" line="43" text="call(A whoAreYou())"/> + <message kind="warning" line="44" text="call(A whoAreYou())"/> + <message kind="warning" line="44" text="call(A+ B.whoAreYou())"/> + <message kind="warning" line="44" text="call(B whoAreYou())"/> + <message kind="warning" line="44" text="call(B B.whoAreYou())"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs/ajdk" title="ajdk: varargs"> + <compile files="AJDKExamples.aj,org/xyz/Foo.java,org/xyz/Goo.java,org/xyz/Hoo.java" options="-1.5"> + <message kind="warning" line="8" text="call vararg match"/> + <message kind="warning" line="14" text="execution vararg match"/> + <message kind="warning" line="5" text="init vararg match"/> + <message kind="warning" line="6" text="init vararg match"/> + <message kind="warning" line="27" text="single vararg"/> + <message kind="warning" line="28" text="single String[]"/> + <message kind="warning" line="18" text="single String[]"/> + </compile> + <run class="AJDKExamples"> + <stdout> + <line text="Matched at call(void X.foo(int, String[]))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/pertypewithin/ajdk" title="ajdk: ptw"> + <compile files="AJDKExamples.aj" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'constructor-execution(void org.xyz.foo.B.<init>())' in Type 'org.xyz.foo.B' (AJDKExamples.aj:38) advised by afterReturning advice from 'org.xyz.foo.AJDKExamples' (AJDKExamples.aj:11)"/> + <message kind="weave" text="Join point 'constructor-execution(void org.xyz.foo.A.<init>())' in Type 'org.xyz.foo.A' (AJDKExamples.aj:36) advised by afterReturning advice from 'org.xyz.foo.AJDKExamples' (AJDKExamples.aj:11)"/> + </compile> + <run class="org.xyz.foo.AJDKExamples"> + <stdout> + <line text="Aspect instance constructed"/> + <line text="Aspect instance constructed"/> + <line text="true"/> + <line text="true"/> + <line text="There are 2 As"/> + <line text="There are 3 Bs"/> + </stdout> + </run> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- declare annotation --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/annotations/declare" title="basic declare annotation parse test"> + <compile files="BasicParseTest.aj" options="-1.5"> + </compile> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- declare annotation (@type) --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/annotations/declare" title="declare @type 1"> + <compile files="DecaType1.java" options="-1.5"/> + <run class="DecaType1"> + <stderr> + <line text="annotation is @MyAnnotation()"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type 2"> + <compile files="DecaType2.java" options="-1.5,-Xlint:ignore" > + </compile> + <run class="DecaType2"> + <stderr> + <line text="annotation on DecaType2 is @MyAnnotation()"/> + <line text="annotation on X is @MyAnnotation()"/> + <line text="annotation on MyAnnotation is @MyAnnotation()"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - with matching pointcut"> + <compile files="DecaType3.java" options="-1.5"/> + <run class="DecaType3"> + <stderr> + <line text="hello world"/> + <line text="advice running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - binary weaving"> + <weave classesFiles="BaseTypes.java" + aspectsFiles="DecaTypeBin1.aj,Colored.java" + options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + </weave> + <run class="BaseTypes"> + <stderr> + <line text="Color identified on class X"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - complex annotation - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaTypeBin2.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="BaseTypes"> + <stderr> + <line text="ComplexAnnotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - complex annotation - source weaving"> + <compile files="BaseTypes.java,DecaTypeBin2.aj" options="-1.5"/> + <run class="BaseTypes"> + <stderr> + <line text="ComplexAnnotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - two annotations hit one type - source weaving"> + <compile files="BaseTypes.java,DecaTypeBin3.aj" options="-1.5"/> + <run class="BaseTypes"> + <stderr> + <line text="Color identified on execution(void A.m())"/> + <line text="Fruit identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - two annotations hit one type - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaTypeBin3.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="BaseTypes"> + <stderr> + <line text="Color identified on execution(void A.m())"/> + <line text="Fruit identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 1) - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaDecpInteractions1.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 1) - source weaving"> + <compile files="BaseTypes.java,DecaDecpInteractions1.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 2) - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaDecpInteractions2.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 2) - source weaving"> + <compile files="BaseTypes.java,DecaDecpInteractions2.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 3) - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaDecpInteractions3.aj" options="-1.5,-Xlint:ignore"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 3) - source weaving"> + <compile files="BaseTypes.java,DecaDecpInteractions3.aj" options="-1.5,-Xlint:ignore"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 4) - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaDecpInteractions4.aj" options="-1.5,-Xlint:ignore"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 4) - source weaving"> + <compile files="BaseTypes.java,DecaDecpInteractions4.aj" options="-1.5,-Xlint:ignore"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - annotating an already annotated type - binary weaving"> + <weave classesFiles="AnnotatedType.java" aspectsFiles="DecaTypeBin4.aj" options="-1.5,-Xlint:ignore"/> + <run class="AnnotatedType"> + <stderr> + <line text="Color identified on execution(void AnnotatedType.m())"/> + <line text="Fruit identified on execution(void AnnotatedType.m())"/> + <line text="m() running"/> + </stderr> + </run> + </ajc-test> + <ajc-test dir="java5/annotations/declare" title="declare @type - annotating an already annotated type - source weaving"> + <compile files="AnnotatedType.java,DecaTypeBin4.aj" options="-1.5,-Xlint:ignore"/> + <run class="AnnotatedType"> + <stderr> + <line text="Color identified on execution(void AnnotatedType.m())"/> + <line text="Fruit identified on execution(void AnnotatedType.m())"/> + <line text="m() running"/> + </stderr> + </run> + </ajc-test> + + + <!--ajc-test dir="java5/annotations/declare" title="declare @type - annotations with different targets - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaTypeBin5.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="error" line="15" text="The annotation @ColorM is disallowed for this location"/> + <message kind="error" line="16" text="The annotation @ColorC is disallowed for this location"/> + <message kind="error" line="18" text="The annotation @ColorF is disallowed for this location"/> + <message kind="error" line="19" text="The annotation @ColorP is disallowed for this location"/> + <message kind="error" line="20" text="The annotation @ColorL is disallowed for this location"/> + <message kind="error" line="21" text="The annotation @ColorPkg is disallowed for this location"/> + </weave> + <run class="BaseTypes"> + <stderr> + <line text="ColorT identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test--> + + <ajc-test dir="java5/annotations/declare" title="declare @type - annotations with different targets - source weaving"> + <compile files="BaseTypes.java,DecaTypeBin5.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="error" line="15" text="The annotation @ColorM is disallowed for this location"/> + <message kind="error" line="16" text="The annotation @ColorC is disallowed for this location"/> + <message king="error" line="17" text="A is not a valid target for annotation ColorA"/> + <message kind="error" line="18" text="The annotation @ColorF is disallowed for this location"/> + <message kind="error" line="19" text="The annotation @ColorP is disallowed for this location"/> + <message kind="error" line="20" text="The annotation @ColorL is disallowed for this location"/> + <message kind="error" line="21" text="The annotation @ColorPkg is disallowed for this location"/> + </compile> + </ajc-test> + + <!--ajc-test dir="java5/annotations/declare" title="declare @type - annotations with different targets (using type patterns) - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaTypeBin6.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="warning" line="15" text="A is not a valid target for annotation ColorM"/> + <message kind="warning" line="16" text="A is not a valid target for annotation ColorC"/> + <message kind="warning" line="17" text="A is not a valid target for annotation ColorL"/> + <message kind="warning" line="17" text="B is not a valid target for annotation ColorL"/> + <message kind="warning" line="17" text="C is not a valid target for annotation ColorL"/> + </weave> + <run class="BaseTypes"> + <stderr> + <line text="ColorT identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="ColorT identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="ColorT identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test--> + + <ajc-test dir="java5/annotations/declare" title="declare @type - annotations with different targets (using type patterns) - source weaving"> + <compile files="BaseTypes.java,DecaTypeBin6.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="error" line="15" text="The annotation @ColorM is disallowed for this location"/> + <message kind="error" line="16" text="The annotation @ColorC is disallowed for this location"/> + <message kind="error" line="17" text="The annotation @ColorL is disallowed for this location"/> + <message kind="error" line="18" text="The annotation @ColorF is disallowed for this location"/> + </compile> + </ajc-test> + + + <ajc-test dir="java5/annotations/declare" title="declare @type - complex decp decAtType interactions - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaTypeBin7.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + </weave> + <run class="BaseTypes"> + <stderr> + <line text="Color identified on execution(void A.m())"/> + <line text="Fruit identified on execution(void A.m())"/> + <line text="Chocolate identified on execution(void A.m())"/> + <line text="M1 at execution(void A.m())"/> + <line text="M2 at execution(void A.m())"/> + <line text="M3 at execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Fruit identified on execution(void B.m())"/> + <line text="Chocolate identified on execution(void B.m())"/> + <line text="M1 at execution(void B.m())"/> + <line text="M2 at execution(void B.m())"/> + <line text="M3 at execution(void B.m())"/> + <line text="B.m() running"/> + <line text="Fruit identified on execution(void C.m())"/> + <line text="Chocolate identified on execution(void C.m())"/> + <line text="M1 at execution(void C.m())"/> + <line text="M2 at execution(void C.m())"/> + <line text="M3 at execution(void C.m())"/> + <line text="C.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - complex decp decAtType interactions - source weaving"> + <compile files="BaseTypes.java,DecaTypeBin7.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="BaseTypes"> + <stderr> + <line text="Color identified on execution(void A.m())"/> + <line text="Fruit identified on execution(void A.m())"/> + <line text="Chocolate identified on execution(void A.m())"/> + <line text="M1 at execution(void A.m())"/> + <line text="M2 at execution(void A.m())"/> + <line text="M3 at execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Fruit identified on execution(void B.m())"/> + <line text="Chocolate identified on execution(void B.m())"/> + <line text="M1 at execution(void B.m())"/> + <line text="M2 at execution(void B.m())"/> + <line text="M3 at execution(void B.m())"/> + <line text="B.m() running"/> + <line text="Fruit identified on execution(void C.m())"/> + <line text="Chocolate identified on execution(void C.m())"/> + <line text="M1 at execution(void C.m())"/> + <line text="M2 at execution(void C.m())"/> + <line text="M3 at execution(void C.m())"/> + <line text="C.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - trying to put annotation targetting annos on normal types - source weaving"> + <compile files="BaseTypes.java,DecaTypeBin8.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="error" line="8" text="A is not a valid target for annotation ColorA"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - trying to put annotation targetting annos on normal types - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaTypeBin8.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="error" line="8" text="A is not a valid target for annotation ColorA"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - trying to put annotation targetting annos on normal types (uses pattern) - source weaving"> + <compile files="BaseTypes.java,DecaTypeBin9.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="warning" line="8" text="A is not a valid target for annotation ColorA"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - trying to put annotation targetting annos on normal types (uses pattern) - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaTypeBin9.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="warning" line="8" text="A is not a valid target for annotation ColorA"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - covering enum and class element values - source weaving"> + <compile files="EnumAndClassValues.aj,FunkyAnnotations.java" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="FunkyAnnotations"> + <stderr> + <line text="hello world"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - covering enum and class element values - binary weaving"> + <weave aspectsFiles="EnumAndClassValues.aj" classesFiles="FunkyAnnotations.java" options="-1.5 -Xdev:Pinpoint" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="FunkyAnnotations"> + <stderr> + <line text="advice running: Red"/> + <line text="advice running: class java.lang.Integer"/> + <line text="method running"/> + </stderr> + </run> + </ajc-test> + + + <!-- ======================================================================================= --> + <!-- declare annotation (@field) --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - simple source weaving"> + <compile files="Base.java,Colored.java,AtField1.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - simple binary weaving"> + <weave classesFiles="Base.java,Colored.java" aspectsFiles="AtField1.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - two the same on one - source weaving"> + <compile files="Base.java,Colored.java,TwoOnOneField.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="warning" text="int Base.publicIntField - already has an annotation of type Colored"/> + </compile> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - two the same on one - binary weaving"> + <weave classesFiles="Base.java,Colored.java" aspectsFiles="TwoOnOneField.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="warning" text="int Base.publicIntField - already has an annotation of type Colored"/> + </weave> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - two different on one - source weaving"> + <compile files="Base.java,Colored.java,Fruit.java,TwoOnOneField2.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + </compile> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + <line text="Fruit field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - two different on one - binary weaving"> + <weave classesFiles="Base.java,Colored.java,Fruit.java" aspectsFiles="TwoOnOneField2.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + </weave> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + <line text="Fruit field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - wrong target - source weaving"> + <compile files="Base.java,Colored.java,WrongTarget.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="error" line="8" text="The annotation @MethodColoring is disallowed for this location"/> + <message kind="error" line="9" text="The annotation @TypeColoring is disallowed for this location"/> + <!-- xlint warnings that were put in as part of fix for pr115252 --> + <message kind="warning" line="13" text="does not match because annotation @MethodColoring has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="16" text="does not match because annotation @TypeColoring has @Target{ElementType.TYPE} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - right target - source weaving"> + <compile files="Base.java,Colored.java,RightTarget.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - right target - binary weaving"> + <weave classesFiles="Base.java,Colored.java" aspectsFiles="RightTarget.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - recursive application - source weaving"> + <compile files="Base.java,Colored.java,Fruit.java,RecursiveFields.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Fruit field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - recursive application - binary weaving"> + <weave classesFiles="Base.java,Colored.java,Fruit.java" aspectsFiles="RecursiveFields.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Fruit field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - recursive application (other order) - source weaving"> + <compile files="Base.java,Colored.java,Fruit.java,RecursiveFields2.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Fruit field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - recursive application (other order) - binary weaving"> + <weave classesFiles="Base.java,Colored.java,Fruit.java" aspectsFiles="RecursiveFields2.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Fruit field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + <!-- incorrect target type for annotation on field --> + + <!-- incorrect target type for annotation on method --> + <!-- two annotations on one method --> + <!-- two of the same annotation on one method - error --> + <!-- two of the same on one using pattern spec - lint --> + +<!-- need some incorrect signatures in the declare @statements - e.g. declare @constructor: public Base(int): XXX; will blow things up as it uses Base rather than new --> + <!-- incorrect target type for annotation on ctor --> + <!-- two annotations on one ctor --> + <!-- two of the same annotation on one ctor - error --> + <!-- two of the same on one using pattern spec - lint --> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method - simple source weaving"> + <compile files="Base.java,Colored.java,AtMethod1.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored method invocation at call(void Base.m1())"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method - simple binary weaving"> + <weave classesFiles="Base.java,Colored.java" aspectsFiles="AtMethod1.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored method invocation at call(void Base.m1())"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @constructor - simple source weaving"> + <compile files="Base.java,Colored.java,AtCtor1.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored constructor invocation at call(Base(int))"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @constructor - simple binary weaving"> + <weave classesFiles="Base.java,Colored.java" aspectsFiles="AtCtor1.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored constructor invocation at call(Base(int))"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + + + <!-- These tests verify both @method and @ctor behavior - they are so similar it is OK to have them together... --> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method @ctor - wrong target - source weaving"> + <compile files="Base.java,Colored.java,WrongTarget.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="error" line="8" text="The annotation @MethodColoring is disallowed for this location"/> + <message kind="error" line="9" text="The annotation @TypeColoring is disallowed for this location"/> + <message kind="error" line="10" text="The annotation @MethodColoring is disallowed for this location"/> + <message kind="error" line="11" text="The annotation @TypeColoring is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method @ctor - right target - source weaving"> + <compile files="Base.java,Colored.java,RightTarget.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored ctor call at call(Base(int))"/> + <line text="Colored method call at call(void Base.m1())"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method @ctor - right target - binary weaving"> + <weave classesFiles="Base.java,Colored.java" aspectsFiles="RightTarget.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored ctor call at call(Base(int))"/> + <line text="Colored method call at call(void Base.m1())"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + +<!-- check @method/@ctor/@field recursively applying, can only happen if a pattern for one of them includes an annotation --> + + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method @ctor - two the same on one - source weaving"> + <compile files="Base.java,Colored.java,TwoOnOneMember.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="warning" text="void Base.m1() - already has an annotation of type Colored"/> + <message kind="warning" text="void Base.<init>(int) - already has an annotation of type Colored"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method @ctor - two the same on one - binary weaving"> + <weave classesFiles="Base.java,Colored.java" aspectsFiles="TwoOnOneMember.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="warning" text="void Base.m1() - already has an annotation of type Colored"/> + <message kind="warning" text="void Base.<init>(int) - already has an annotation of type Colored"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method @ctor - two different on one - source weaving"> + <compile files="Base.java,Colored.java,Fruit.java,TwoOnOneMember2.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + </compile> + <run class="Base"> + <stderr> + <line text="Colored ctor call at Base.java:11"/> + <line text="Fruit ctor call at Base.java:11"/> + <line text="Colored method call at Base.java:15"/> + <line text="Fruit method call at Base.java:15"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method @ctor - two different on one - binary weaving"> + <weave classesFiles="Base.java,Colored.java,Fruit.java" aspectsFiles="TwoOnOneMember2.aj" options="-1.5" xlintfile="ignoreTypeNotExposed.properties"> + </weave> + <run class="Base"> + <stderr> + <line text="Colored ctor call at Base.java:11"/> + <line text="Fruit ctor call at Base.java:11"/> + <line text="Colored method call at Base.java:15"/> + <line text="Fruit method call at Base.java:15"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare all annotations on one class - source weaving"> + <compile files="DeathByAnnotations.aj" options="-1.5,-emacssym" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="p.q.DeathByAnnotations"/> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- annotation binding with ITDs --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd method is annotated"> + <compile files="BindingWithAnnotatedItds1.aj" options="-1.5"/> + <run class="BindingWithAnnotatedItds1"> + <stderr> + <line text="Found apple at jp execution(int A.m()) (BindingWithAnnotatedItds1.aj:8)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd field is annotated"> + <compile files="BindingWithAnnotatedItds2.aj" options="-1.5"/> + <run class="BindingWithAnnotatedItds2"> + <stderr> + <line text="Found banana at jp set(int A.i) (BindingWithAnnotatedItds2.aj:16)"/> + <line text="Found apple at jp set(String A.j) (BindingWithAnnotatedItds2.aj:17)"/> + <line text="Found orange at jp set(int[] A.k) (BindingWithAnnotatedItds2.aj:18)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd ctor is annotated"> + <compile files="BindingWithAnnotatedItds3.aj" options="-1.5"/> + <run class="BindingWithAnnotatedItds3"> + <stderr> + <line text="Found pear at jp execution(A(String)) (BindingWithAnnotatedItds3.aj:8)"/> + <line text="Found orange at jp execution(A(int)) (BindingWithAnnotatedItds3.aj:10)"/> + <line text="Found tomato at jp execution(A(boolean)) (BindingWithAnnotatedItds3.aj:12)"/> + </stderr> + </run> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- declare annotation targetting ITDs --> + <!-- ======================================================================================= --> + + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd method is annotated via declare"> + <compile files="BindingWithDeclaredAnnotationItds1.aj" options="-1.5,-emacssym"/> + <run class="BindingWithDeclaredAnnotationItds1"> + <stderr> + <line text="Found orange at jp call(int A.m()) (BindingWithDeclaredAnnotationItds1.aj:16)"/> + <line text="Found orange at jp execution(int A.m()) (BindingWithDeclaredAnnotationItds1.aj:8)"/> + <line text="Found banana at jp call(int A.n()) (BindingWithDeclaredAnnotationItds1.aj:17)"/> + <line text="Found banana at jp execution(int A.n()) (BindingWithDeclaredAnnotationItds1.aj:10)"/> + <line text="Found tomato at jp call(int A.o()) (BindingWithDeclaredAnnotationItds1.aj:18)"/> + <line text="Found tomato at jp execution(int A.o()) (BindingWithDeclaredAnnotationItds1.aj:12)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd field is annotated via declare"> + <compile files="BindingWithDeclaredAnnotationItds2.aj" options="-1.5,-emacssym"/> + <run class="BindingWithDeclaredAnnotationItds2"> + <stderr> + <line text="Found orange at jp set(int A.i) (BindingWithDeclaredAnnotationItds2.aj:16)"/> + <line text="Found banana at jp set(String A.j) (BindingWithDeclaredAnnotationItds2.aj:17)"/> + <line text="Found apple at jp set(boolean[] A.k) (BindingWithDeclaredAnnotationItds2.aj:18)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd field is annotated multiple times via declare"> + <compile files="BindingWithDeclaredAnnotationItds3.aj" options="-1.5,-emacssym"/> + <run class="BindingWithDeclaredAnnotationItds3"> + <stderr> + <line text="Found fruit orange at jp set(int A.i) (BindingWithDeclaredAnnotationItds3.aj:13)"/> + <line text="Found drink margarita at jp set(int A.i) (BindingWithDeclaredAnnotationItds3.aj:13)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd ctor is annotated via declare"> + <compile files="BindingWithDeclaredAnnotationItds4.aj" options="-1.5,-emacssym"/> + <run class="BindingWithDeclaredAnnotationItds4"> + <stderr> + <line text="Found pear at jp execution(A(String)) (BindingWithDeclaredAnnotationItds4.aj:8)"/> + <line text="Found orange at jp execution(A(int)) (BindingWithDeclaredAnnotationItds4.aj:10)"/> + <line text="Found tomato at jp execution(A(boolean)) (BindingWithDeclaredAnnotationItds4.aj:12)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/suppressedWarnings" title="SuppressAjWarnings raised during matching"> + <compile files="SuppressionDuringMatching.aj" options="-1.5"> + </compile> + </ajc-test> + + <!-- ============================================================== --> + + <ajc-test dir="options/aspectpath" title="dirs on aspectpath"> + <compile files="MyAspect.aj" options="-d out"/> + <compile files="MyClass.java" options="-aspectpath out"> + <message kind="warning" line="3" text="a method"/> + </compile> + </ajc-test> + + <!-- ============================================================== --> + <!-- Start of generics tests --> + <!-- ============================================================== --> + + <ajc-test dir="java5/generics" title="ITD with parameterized type" vm="1.5"> + <compile files="ITDReturningParameterizedType.aj" options="-1.5"/> + <run class="ITDReturningParameterizedType"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding/bugs" title="AtArgs causes a VerifyError: Unable to pop operand off an empty stack" vm="1.5"> + <compile files="Test3.java" options="-1.5"/> + <run class="Test3"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs/pr91267" title="NPE using generic methods in aspects 1" vm="1.5"> + <compile files="TestBug1.aj" options="-1.5"/> + <run class="TestBug1"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs/pr91267" title="NPE using generic methods in aspects 2" vm="1.5"> + <compile files="TestBug2.aj" options="-1.5"/> + <run class="TestBug2"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs" title="Generics problem with Set" vm="1.5"> + <compile files="PR91053.aj" options="-1.5"/> + <run class="PR91053"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs" title="Compilation error on generic member introduction" vm="1.5"> + <compile files="PR87282.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs" title="Parameterized types on introduced fields not correctly recognized" vm="1.5"> + <compile files="PR88606.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" title="enum called Enum, annotation called Annotation, etc"> + <compile files="PR90827.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" title="Internal compiler error"> + <compile files="PR86832.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" title="Exploding compile time with if() statements in pointcut"> + <compile files="PR94086.aj" options="-1.5"/> + </ajc-test> + + <!-- generic abstract aspects... --> + + <ajc-test dir="java5/generics/genericaspects" title="static pointcut parameterization suite"> + <compile files="GenericAspectPointcuts.aj" options="-1.5"> + <message kind="warning" line="62" text="kinded-returning-ok"/> + <message kind="warning" line="52" text="kinded-declaring-ok"/> + <message kind="warning" line="67" text="kinded-declaring-ok"/> + <message kind="warning" line="50" text="kinded-params-ok"/> + <message kind="warning" line="56" text="kinded-throws-ok"/> + <message kind="warning" line="64" text="and-ok"/> + <message kind="warning" line="60" text="or-ok"/> + <message kind="warning" line="64" text="or-ok"/> + <message kind="warning" line="67" text="or-ok"/> + <message kind="warning" line="1" text="not-ok"/> + <message kind="warning" line="42" text="not-ok"/> + <message kind="warning" line="72" text="not-ok"/> + <message kind="warning" line="59" text="within-ok"/> + <message kind="warning" line="64" text="withincode-ok"/> + <message kind="warning" line="53" text="handler-ok"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="dynamic pointcut parameterization suite"> + <compile files="GenericAspectRuntimePointcuts.aj" options="-1.5"> + </compile> + <run class="GenericAspectRuntimePointcuts"> + <stdout> + <line text="target-ok an X execution(void X.foo())"/> + <line text="@this-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5,1.6,1.7,1.8"/> + <line text="@this-ok @MyAnnotation(value="my-value") execution(void X.foo())" vm="9+"/> + <line text="@target-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5,1.6,1.7,1.8"/> + <line text="@target-ok @MyAnnotation(value="my-value") execution(void X.foo())" vm="9+"/> + <line text="@within-ok @MyAnnotation(value=my-value) execution(void X.foo())" vm="1.5,1.6,1.7,1.8"/> + <line text="@within-ok @MyAnnotation(value="my-value") execution(void X.foo())" vm="9+"/> + <line text="cflow-ok an X a Y set(Y X.y)"/> + <line text="@annotation-ok-sub @MyAnnotation(value=bar) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> + <line text="@annotation-ok-sub @MyAnnotation(value="bar") execution(void X.bar())" vm="9+"/> + <line text="@annotation-ok @MyAnnotation(value=bar) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> + <line text="@annotation-ok @MyAnnotation(value="bar") execution(void X.bar())" vm="9+"/> + <line text="target-ok an X execution(void X.bar())"/> + <line text="@this-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> + <line text="@this-ok @MyAnnotation(value="my-value") execution(void X.bar())" vm="9+"/> + <line text="@target-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> + <line text="@target-ok @MyAnnotation(value="my-value") execution(void X.bar())" vm="9+"/> + <line text="@within-ok @MyAnnotation(value=my-value) execution(void X.bar())" vm="1.5,1.6,1.7,1.8"/> + <line text="@within-ok @MyAnnotation(value="my-value") execution(void X.bar())" vm="9+"/> + <line text="@args-ok @MyAnnotation(value=my-value) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/> + <line text="@args-ok @MyAnnotation(value="my-value") execution(void Y.foo(X))" vm="9+"/> + <line text="args-ok an X execution(void Y.foo(X))"/> + <line text="this-ok a Y execution(void Y.foo(X))"/> + <line text="@this-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/> + <line text="@this-ok @MyAnnotation(value="on Y") execution(void Y.foo(X))" vm="9+"/> + <line text="@target-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/> + <line text="@target-ok @MyAnnotation(value="on Y") execution(void Y.foo(X))" vm="9+"/> + <line text="@within-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))" vm="1.5,1.6,1.7,1.8"/> + <line text="@within-ok @MyAnnotation(value="on Y") execution(void Y.foo(X))" vm="9+"/> + <line text="@annotation-ok-sub @MyAnnotation(value=my-value) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> + <line text="@annotation-ok-sub @MyAnnotation(value="my-value") execution(X Y.bar())" vm="9+"/> + <line text="@annotation-ok @MyAnnotation(value=my-value) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> + <line text="@annotation-ok @MyAnnotation(value="my-value") execution(X Y.bar())" vm="9+"/> + <line text="this-ok a Y execution(X Y.bar())"/> + <line text="@this-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> + <line text="@this-ok @MyAnnotation(value="on Y") execution(X Y.bar())" vm="9+"/> + <line text="@target-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> + <line text="@target-ok @MyAnnotation(value="on Y") execution(X Y.bar())" vm="9+"/> + <line text="@within-ok @MyAnnotation(value=on Y) execution(X Y.bar())" vm="1.5,1.6,1.7,1.8"/> + <line text="@within-ok @MyAnnotation(value="on Y") execution(X Y.bar())" vm="9+"/> + <line text="@withincode-ok @MyAnnotation(value=my-value) get(X Y.x)" vm="1.5,1.6,1.7,1.8"/> + <line text="@withincode-ok @MyAnnotation(value="my-value") get(X Y.x)" vm="9+"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="reference to pointcut in generic class"> + <compile files="PointcutsInGenericClasses.aj" options="-1.5"> + <message kind="warning" line="16" text="a match"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="reference to non-parameterized pointcut in generic class"> + <compile files="PointcutsInGenericClasses2.aj" options="-1.5"> + <message kind="error" line="10" text="cannot use a raw type reference to refer to a pointcut in a generic type (use a parameterized reference instead)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="declare parents parameterized"> + <compile files="DecPGenericTest.aj" options="-1.5"> + <message kind="warning" line="16" text="success"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="declare precedence parameterized"> + <compile files="DecPrecedenceGenericTest.aj" options="-1.5 -Xdev:Pinpoint"> + </compile> + <run class="DecPrecedenceGenericTest"> + <stdout> + <line text="A1"/> + <line text="A2"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="declare annotation parameterized"> + <compile files="DecAnnGenericTest.aj" options="-1.5"> + <message kind="warning" line="18" text="@type ok"/> + <message kind="warning" line="20" text="@field ok"/> + <message kind="warning" line="22" text="@constructor ok"/> + <message kind="warning" line="24" text="@method ok"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="multi-level generic abstract aspects"> + <compile files="MultiLevelGenericTest.aj" options="-1.5"> + <message kind="warning" line="23" text="base match"/> + <message kind="warning" line="23" text="middle match"/> + <message kind="warning" line="23" text="top match"/> + </compile> + </ajc-test> + <!-- generic bugs --> + + <ajc-test dir="java5/generics/bugs" title="ITD method with generic arg"> + <compile files="PR97763.aj" options="-1.5"/> + <run class="PR97763"> + <stderr> + <line text="Number of entries=2"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150" title="NPE at ClassScope.java:660 when compiling generic class"> + <compile files="PR95993.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs" title="Problems resolving type name inside generic class"> + <compile files="PR95992.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="100227" title="inner class with generic enclosing class"> + <compile files="pr100227.aj" options="-1.5"/> + <run class="pr100227"> + <stderr> + <line text="Outer.Inner.inner=2"/> + <line text="Outer.Inner.p() executing"/> + <line text="Generic_Outer.Inner.inner=4"/> + <line text="Generic_Outer.Inner.p() executing"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="100260" title="methods inherited from a generic parent"> + <compile files="pr100260.aj" options="-1.5"/> + <run class="pr100260"/> + </ajc-test> + + <!-- end of generic bugs --> + + <!-- generic aspects --> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspects - 1"> + <compile files="GenericAspect1.aj" options="-1.5"> + <message kind="error" line="2" text="only abstract aspects can have type parameters"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspects - 2"> + <compile files="GenericAspect2.aj" options="-1.5"> + <message kind="error" line="9" text="a generic super-aspect must be fully parameterized in an extends clause"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspects - 3"> + <compile files="GenericAspect3.aj" options="-1.5"/> + <run class="GenericAspect3"> + <stderr> + <line text="A"/> + <line text="B"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspects - 4"> + <compile files="ParentChildRelationship.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspect with declare warning using type vars"> + <compile files="DeclareWarningInGenericAspect.aj" options="-1.5"> + <message kind="warning" line="16" text="this method takes a T!"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspect with execution advice using type vars"> + <compile files="ExecutionAdviceInGenericAspect.aj" options="-1.5"> + </compile> + <run class="ExecutionAdviceInGenericAspect"> + <stdout> + <line text="I matched at execution(void C.foo(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspect with anonymous pointcut"> + <compile files="AnonymousPointcutInGenericAspect.aj" options="-1.5"> + </compile> + <run class="AnonymousPointcutInGenericAspect"> + <stdout> + <line text="I matched at execution(void C.foo(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspect declare parents"> + <compile files="DeclareParentsWithTypeVars.aj" options="-1.5"> + </compile> + <run class="DeclareParentsWithTypeVars"> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspect declare soft"> + <compile files="DeclareSoftWithTypeVars.aj" options="-1.5"> + </compile> + <run class="DeclareSoftWithTypeVars"> + <stderr> + <line text="handled exception: io, io, it's off to work we go..."/> + <line text="Successfully converted to domain exception"/> + </stderr> + </run> + </ajc-test> + + <!-- ajdk example --> + <ajc-test dir="java5/generics/genericaspects" title="generic aspects - 5 (ajdk)"> + <compile files="Blob.java,BlobContainment.aj,ParentChildRelationship.aj" options="-1.5"/> + <run class="BlobContainment"/> + </ajc-test> + + <!-- same as above but all types in one file --> + <ajc-test dir="java5/generics/genericaspects" title="generic aspects - 6 (ajdk)"> + <compile files="TheBigOne.java" options="-1.5"/> + <run class="TheBigOne"/> + </ajc-test> + + <!-- end of generic aspects --> + + <!-- generic ITDs --> + + <ajc-test dir="java5/generics/itds" title="ITDs on generic type"> + <compile files="Parse5.java" options="-1.5"> + <message kind="error" line="9"/> + <message kind="error" line="11"/> + <message kind="error" line="13"/> + <message kind="error" line="15"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="itd of non static member"> + <compile files="A.java" options="-1.5"/> + <run class="A"> + <stderr> + <line text="min(2,4)=>2"/> + <line text="max(2,4)=>4"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="itd of static member"> + <compile files="B.java" options="-1.5"/> + <run class="B"> + <stderr> + <line text="min(2,4)=>2"/> + <line text="max(2,4)=>4"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="itd using type parameter"> + <compile files="C.java" options="-1.5"/> + <run class="C"> + <stderr> + <line text="fillthisin..."/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="itd incorrectly using type parameter"> + <compile files="D.java" options="-1.5"/> + <run class="D"> + <stderr> + <line text="fillthisin..."/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="static generic method itd"> + <compile files="StaticGenericMethodITD.aj" options="-1.5"/> + <run class="StaticGenericMethodITD"> + <stderr> + <line text="First=10"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic ctor itd - 1"> + <compile files="GenericCtorITD1.aj" options="-1.5"/> + <run class="GenericCtorITD1"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic ctor itd - 2"> + <compile files="GenericCtorITD2.aj" options="-1.5"/> + <run class="GenericCtorITD2"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic ctor itd - 3"> + <compile files="GenericCtorITD3.aj" options="-1.5"/> + <run class="GenericCtorITD3"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="parameterized method itd - 1"> + <compile files="ParameterizedMethodITD1.aj" options="-1.5"/> + <run class="ParameterizedMethodITD1"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="parameterized method itd - 2"> + <compile files="ParameterizedMethodITD2.aj" options="-1.5"> + <message kind="error" line="9" text="The method simple(List<? extends Number>) in the type Base is not applicable for the arguments (List<A>)"/> + </compile> + </ajc-test> + + + <ajc-test dir="java5/generics/itds" title="parameterized method itd - 3"> + <compile files="ParameterizedMethodITD3.aj" options="-1.5"> + <message kind="error" line="9" text="The method simple(List<? super A>) in the type Base is not applicable for the arguments (List<B>)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="parameterized method itd - 4"> + <compile files="ParameterizedMethodITD4.aj" options="-1.5"/> + <run class="ParameterizedMethodITD4"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 1"> + <compile files="GenericMethodITD1.aj" options="-1.5"/> + <run class="GenericMethodITD1"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 2"> + <compile files="GenericMethodITD2.aj" options="-1.5"> + <message kind="error" line="9" text="Bound mismatch: The generic method simple(List<? extends E>) of type Base is not applicable for the arguments (List<A>). The inferred type A is not a valid substitute for the bounded parameter <E extends Number>"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 3"> + <compile files="GenericMethodITD3.aj" options="-1.5"/> + <run class="GenericMethodITD3"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 4"> + <compile files="GenericMethodITD4.aj" options="-1.5"/> + <run class="GenericMethodITD4"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 5"> + <compile files="GenericMethodITD5.aj" options="-1.5"> + <message kind="error" line="10" text="The method simple(List<E>, List<E>) in the type Base is not applicable for the arguments (List<A>, List<B>)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 6"> + <compile files="GenericMethodITD6.aj" options="-1.5"/> + <run class="GenericMethodITD6"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 7"> + <compile files="GenericMethodITD7.aj" options="-1.5"/> + <run class="GenericMethodITD7"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 8"> + <compile files="GenericMethodITD8.aj" options="-1.5"> + <message kind="error" line="10" text="The method simple(List<E>, List<? extends E>) in the type Base is not applicable for the arguments (List<Number>, List<String>)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 9"> + <compile files="GenericMethodITD9.aj" options="-1.5"/> + <run class="GenericMethodITD9"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 10"> + <compile files="GenericMethodITD10.aj" options="-1.5"> + <message kind="error" line="10" text="Bound mismatch: The generic method crazy(List<R>) of type Base is not applicable for the arguments (List<A>). The inferred type A is not a valid substitute for the bounded parameter <R extends Comparable<? super R>>"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 11"> + <compile files="GenericMethodITD11.aj" options="-1.5"/> + <run class="GenericMethodITD11"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 12"> + <compile files="GenericMethodITD12.aj" options="-1.5"> + <message kind="error" line="10" text="Bound mismatch: The generic method crazy(List<R>) of type Base is not applicable for the arguments (List<A>). The inferred type A is not a valid substitute for the bounded parameter <R extends Foo<? extends R>>"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 13"> + <compile files="GenericMethodITD13.aj" options="-1.5"/> + <run class="GenericMethodITD13"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 14"> + <compile files="GenericMethodITD14.aj" options="-1.5"> + <message kind="error" line="10" text="Bound mismatch: The generic method crazy(List<R>) of type Base is not applicable for the arguments (List<A>). The inferred type A is not a valid substitute for the bounded parameter <R extends Foo<? super R>>"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 15"> + <compile files="GenericMethodITD15.aj" options="-1.5"/> + <run class="GenericMethodITD15"/> + </ajc-test> + + <!-- visibility --> + + <ajc-test dir="java5/generics/itds/visibility" title="public itds"> + <compile files="PublicITDs.aj" options="-1.5"/> + <run class="PublicITDs"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/visibility" title="private itds"> + <compile files="PrivateITDs.aj" options="-1.5"/> + <run class="PrivateITDs"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/visibility" title="package itds"> + <compile files="PackageITDs.aj" options="-1.5"/> + <run class="PackageITDs"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/visibility" title="public itds with errors"> + <compile files="PublicITDsErrors.aj" options="-1.5"> + <message kind="error" line="13" text="The method publicMethod2(List<R>, List<R>) in the type Base is not applicable for the arguments (List<Double>, List<Float>)"/> + <message kind="error" line="15" text="The constructor Base(List<Double>, Map<Integer,String>) is undefined"/> + </compile> + </ajc-test> + + <!-- targetting different types --> + + <ajc-test dir="java5/generics/itds/differingTargets" title="targetting interface"> + <compile files="TargettingInterface.aj" options="-1.5"/> + <run class="TargettingInterface"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/differingTargets" title="targetting aspect"> + <compile files="TargettingAspect.aj" options="-1.5"/> + <run class="TargettingAspect"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/differingTargets" title="targetting class"> + <compile files="TargettingClass.aj" options="-1.5"/> + <run class="TargettingClass"/> + </ajc-test> + + <!-- sharing type variables between the ITD and the generic type --> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 1"> + <compile files="FieldA.aj" options="-1.5"/> + <run class="FieldA"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 2"> + <compile files="FieldB.aj" options="-1.5"> + <message kind="error" line="16" text="Incorrect number of type parameters supplied. The generic type Base<N,M> has 2 type parameters, not 1."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 3"> + <compile files="FieldC.aj" options="-1.5"/> + <run class="FieldC"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 4"> + <compile files="FieldD.aj" options="-1.5"/> + <run class="FieldD"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 5"> + <compile files="FieldE.aj" options="-1.5"/> + <run class="FieldE"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 6"> + <compile files="FieldF.aj" options="-1.5"/> + <run class="FieldF"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 7"> + <compile files="FieldG.aj" options="-1.5"/> + <run class="FieldG"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 8"> + <compile files="FieldH.aj" options="-1.5"/> + <run class="FieldH"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 9"> + <compile files="FieldI.aj" options="-1.5"> + <message kind="error" line="7" text="Type mismatch: cannot convert from List<String> to List<Integer>"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -10"> + <compile files="FieldJ.aj" options="-1.5"/> + <run class="FieldJ"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -11"> + <compile files="FieldK.aj" options="-1.5"/> + <run class="FieldK"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -12"> + <compile files="FieldL.aj" options="-1.5"/> + <run class="FieldL"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -13"> + <compile files="FieldM.aj" options="-1.5"/> + <run class="FieldM"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -14"> + <compile files="FieldN.aj" options="-1.5"> + <message kind="error" line="11" text="Type parameters can not be specified in the ITD target type - the target type I is not generic."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -15"> + <compile files="FieldO.aj" options="-1.5"> + <message kind="error" line="11" text="Intertype declarations can only be made on the generic type, not on a parameterized type. The name 'String' cannot be used as a type parameter, since it refers to a real type."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -16"> + <compile files="FieldP.aj" options="-1.5"> + <message kind="error" line="10" text="static intertype field declarations cannot refer to type variables from the target generic type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -17"> + <compile files="FieldQ.aj" options="-1.5"/> + <run class="FieldQ"/> + </ajc-test> + + <!-- Now intertype declared methods on generic types that use the target types type vars --> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - A1"> + <compile files="MethodA.aj" options="-1.5"/> + <run class="MethodA"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - A2"> + <compile files="MethodA2.aj" options="-1.5"/> + <run class="MethodA2"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - A3"> + <compile files="MethodA3.aj" options="-1.5"/> + <run class="MethodA3"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - A4"> + <compile files="MethodA4.aj" options="-1.5"/> + <run class="MethodA4"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - B1"> + <compile files="MethodB.aj" options="-1.5"> + <message kind="error" line="16" text="Incorrect number of type parameters supplied. The generic type Base<N,M> has 2 type parameters, not 1."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - C1"> + <compile files="MethodC.aj" options="-1.5"/> + <run class="MethodC"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - D1"> + <compile files="MethodD.aj" options="-1.5"/> + <run class="MethodD"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - E1"> + <compile files="MethodE.aj" options="-1.5"/> + <run class="MethodE"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - F1"> + <compile files="MethodF.aj" options="-1.5"/> + <run class="MethodF"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - G1"> + <compile files="MethodG.aj" options="-1.5"/> + <run class="MethodG"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - H1"> + <compile files="MethodH.aj" options="-1.5"/> + <run class="MethodH"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - I1"> + <compile files="MethodI.aj" options="-1.5"> + <message kind="error" line="6" text="Type mismatch: cannot convert from List<Integer> to List<String>"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - I2"> + <compile files="MethodI2.aj" options="-1.5"> + <message kind="error" line="7" text="The method m(List<Integer>) in the type Base<Integer> is not applicable for the arguments (List<String>)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - J1"> + <compile files="MethodJ.aj" options="-1.5"/> + <run class="MethodJ"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - K1"> + <compile files="MethodK.aj" options="-1.5"/> + <run class="MethodK"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - L1"> + <compile files="MethodL.aj" options="-1.5"/> + <run class="MethodL"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - M1"> + <compile files="MethodM.aj" options="-1.5"/> + <run class="MethodM"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - M2"> + <compile files="MethodM2.aj" options="-1.5"/> + <run class="MethodM2"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - N1"> + <compile files="MethodN.aj" options="-1.5"> + <message kind="error" line="11" text="Type parameters can not be specified in the ITD target type - the target type I is not generic."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - O1"> + <compile files="MethodO.aj" options="-1.5"> + <message kind="error" line="11" text="Intertype declarations can only be made on the generic type, not on a parameterized type. The name 'String' cannot be used as a type parameter, since it refers to a real type."/> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - O2"> + <compile files="MethodO2.aj" options="-1.5"> + <message kind="error" line="11" text="Intertype declarations can only be made on the generic type, not on a parameterized type. The name 'String' cannot be used as a type parameter, since it refers to a real type."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - P1"> + <compile files="MethodP.aj" options="-1.5"/> + <run class="MethodP"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - Q1"> + <compile files="MethodQ.aj" options="-1.5"/> + <run class="MethodQ"/> + </ajc-test> + + <!-- Now intertype declared constructors on generic types that use the target types type vars --> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - A1"> + <compile files="CtorA.aj" options="-1.5"/> + <run class="CtorA"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - B1"> + <compile files="CtorB.aj" options="-1.5"> + <message kind="error" line="15" text="Incorrect number of type parameters supplied. The generic type Base<N,M> has 2 type parameters, not 1."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - C1"> + <compile files="CtorC.aj" options="-1.5"/> + <run class="CtorC"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - D1"> + <compile files="CtorD.aj" options="-1.5"/> + <run class="CtorD"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - E1"> + <compile files="CtorE.aj" options="-1.5"/> + <run class="CtorE"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - F1"> + <compile files="CtorF.aj" options="-1.5"/> + <run class="CtorF"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - G1"> + <compile files="CtorG.aj" options="-1.5"/> + <run class="CtorG"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - H1"> + <compile files="CtorH.aj" options="-1.5"/> + <run class="CtorH"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - I1"> + <compile files="CtorI.aj" options="-1.5"/> + <run class="CtorI"/> + </ajc-test> + + <!-- putting it all together, fields/methods/ctors and decps --> + + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - A"> + <compile files="GenericAspectA.aj" options="-1.5"/> + <run class="GenericAspectA"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - B"> + <compile files="GenericAspectB.aj" options="-1.5"/> + <run class="GenericAspectB"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - C"> + <compile files="GenericAspectC.aj" options="-1.5"/> + <run class="GenericAspectC"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - D"> + <compile files="GenericAspectD.aj" options="-1.5"/> + <run class="GenericAspectD"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - E"> + <compile files="GenericAspectE.aj" options="-1.5"/> + <run class="GenericAspectE"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - F"> + <compile files="GenericAspectF.aj" options="-1.5"/> + <run class="GenericAspectF"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - G"> + <compile files="GenericAspectG.aj" options="-1.5"/> + <run class="GenericAspectG"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - H"> + <compile files="GenericAspectH.aj" options="-1.5"> + <message kind="error" line="7" text="Type java.lang.String does not meet the specification for type parameter 1 (N extends java.lang.Number) in generic type GenericAspect$SimpleI"/> + <!-- see pr133307, shame about this --> + <!--message kind="error" line="16" text="The method m4(String) is undefined for the type Base"/--> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - I"> + <compile files="GenericAspectI.aj" options="-1.5"/> + <run class="GenericAspectI"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - J"> + <compile files="GenericAspectJ.aj" options="-1.5"/> + <run class="GenericAspectJ"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - K"> + <compile files="GenericAspectK.aj" options="-1.5"> + <message kind="error" line="7" text="B does not meet the specification for type parameter 1 (L extends java.lang.Number) in generic type GenericAspect$SimpleI"/> + <message kind="error" line="16" text="The method m4(String) is undefined for the type Base"/> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - K2"> + <compile files="GenericAspectK2.aj" options="-1.5"> + <message kind="error" line="13" text="The type String is not a valid substitute"/> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - L"> + <compile files="GenericAspectL.aj" options="-1.5"/> + <run class="GenericAspectL"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - M"> + <compile files="GenericAspectM.aj" options="-1.5"> + <message kind="error" line="23" text="The method m0(Integer) in the type GenericAspect.SimpleI<Integer> is not applicable for the arguments (String)"/> + <message kind="error" line="24" text="The method m1(List<Integer>) in the type GenericAspect.SimpleI<Integer> is not applicable for the arguments (List<String>)"/> + <message kind="error" line="25" text="Type mismatch: cannot convert from String to Integer"/> + <message kind="error" line="26" text="Type mismatch: cannot convert from List<String> to List<Integer>"/> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - N"> + <compile files="GenericAspectN.aj" options="-1.5"/> + <run class="GenericAspectN"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - O"> + <compile files="GenericAspectO.aj" options="-1.5"> + <message kind="error" line="24" text="Cannot make a static reference to the non-static field Bottom.parent"/> + <message kind="error" line="26" text="The method add(Bottom) in the type List<Bottom> is not applicable for the arguments (Top)"/> + <message kind="error" line="27" text="Cannot make a static reference to the non-static field Top.children"/> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - P"> + <compile files="GenericAspectP.aj" options="-1.5"/> + <run class="GenericAspectP"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - Q"> + <compile files="GenericAspectQ.aj" options="-1.5"/> + <run class="GenericAspectQ"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - R"> + <compile files="GenericAspectR.aj" options="-1.5"/> + <run class="GenericAspectR"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - S"> + <compile files="GenericAspectS.aj" options="-1.5"/> + <run class="GenericAspectS"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - T"> + <compile files="GenericAspectT.aj" options="-1.5"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - U"> + <compile files="GenericAspectU.aj" options="-1.5"/> + <run class="GenericAspectU"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - V"> + <compile files="GenericAspectV.aj" options="-1.5"/> + <run class="GenericAspectV"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - W"> + <compile files="GenericAspectW.aj" options="-1.5"/> + <run class="GenericAspectW"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - X"> + <compile files="GenericAspectX.aj" options="-1.5"/> + <run class="GenericAspectX"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - Y"> + <compile files="GenericAspectY.aj" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void ParentChildRelationship$ParentHasChildren.addChild(C))' in Type 'ParentChildRelationship' (GenericAspectY.aj:53) advised by before advice from 'GenericAspectY' (GenericAspectY.aj:101) [with runtime test]"/> + <message kind="weave" text="Extending interface set for type 'Top' (GenericAspectY.aj) to include 'ParentChildRelationship$ParentHasChildren<Bottom>' (GenericAspectY.aj)"/> + <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<Bottom> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<Bottom> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.addChild(Bottom)')"/> + <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(Bottom)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.addChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'P ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'P ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/> + <message kind="weave" text="Extending interface set for type 'Bottom' (GenericAspectY.aj) to include 'ParentChildRelationship$ChildHasParent<Top>' (GenericAspectY.aj)"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'Top ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'Top ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ChildHasParent.setParent(Top)')"/> + </compile> + <run class="GenericAspectY"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - Z"> + <compile files="GenericAspectZ.aj" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void ParentChildRelationship$ParentHasChildren.addChild(C))' in Type 'ParentChildRelationship' (GenericAspectZ.aj:53) advised by before advice from 'GenericAspectZ' (GenericAspectZ.aj:95) [with runtime test]"/> + <message kind="weave" text="Join point 'method-execution(void ParentChildRelationship$ParentHasChildren.removeChild(C))' in Type 'ParentChildRelationship' (GenericAspectZ.aj:65) advised by before advice from 'GenericAspectZ' (GenericAspectZ.aj:96) [with runtime test]"/> + + <message kind="weave" text="Extending interface set for type 'Top' (GenericAspectZ.aj) to include 'ParentChildRelationship$ParentHasChildren<Bottom>' (GenericAspectZ.aj)"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<Bottom> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<Bottom> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.addChild(Bottom)')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(Bottom)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.addChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'P ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'P ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/> + <message kind="weave" text="Extending interface set for type 'Bottom' (GenericAspectZ.aj) to include 'ParentChildRelationship$ChildHasParent<Top>' (GenericAspectZ.aj)"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'Top ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'Top ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ChildHasParent.setParent(Top)')"/> + + <!--message kind="weave" text="Extending interface set for type 'Top' (GenericAspectZ.aj) to include 'ParentChildRelationship$ParentHasChildren<Bottom>' (GenericAspectZ.aj)"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.addChild(C)')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.addChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/> + <message kind="weave" text="Extending interface set for type 'Bottom' (GenericAspectZ.aj) to include 'ParentChildRelationship$ChildHasParent<Top>' (GenericAspectZ.aj)"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/--> + </compile> + <run class="GenericAspectZ"/> + </ajc-test> + + <ajc-test dir="java5/generics/binaryBridging" title="binary bridge methods - two"> + <compile files="TwoA.java" outjar="twoa.jar" options="-1.5"/> + <compile files="TwoB.java" outjar="twob.jar" options="-1.5"/> + <compile files="TwoX.java" inpath="twoa.jar;twob.jar" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd sharing type variable with generic type"> + <compile files="Simple.aj" options="-1.5"/> + <run class="Simple"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd sharing type variable with generic type"> + <compile files="Simple2.aj" options="-1.5"/> + <run class="Simple2"/> + </ajc-test> + + + <ajc-test dir="java5/generics/itds" title="non static generic method itd - 2"> + <compile files="NonstaticGenericCtorITD2.aj" options="-1.5"/> + <run class="NonstaticGenericCtorITD2"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="reusing type variable letters"> + <compile files="ReusingLetters.aj" options="-1.5"/> + <run class="ReusingLetters"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="multiple generic itds in one file"> + <compile files="BizarroSignatures.aj" options="-1.5"/> + <run class="BizarroSignatures"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic intertype field declaration, sharing type variable"> + <compile files="FieldITDOnGenericType.aj" options="-1.5"/> + <run class="FieldITDOnGenericType"> + <stderr> + <line text=">42"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="Parsing generic ITDs - 1"> + <compile files="Parse1.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="Parsing generic ITDs - 2"> + <compile files="Parse2.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="Parsing generic ITDs - 3"> + <compile files="Parse3.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="Parsing generic ITDs - 4"> + <compile files="Parse4.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="Parsing generic ITDs - 5"> + <compile files="Parse5.java" options="-1.5"> + <message kind="error" line="11" text="Incorrect number of type parameters supplied. The generic type Parse5<T,S> has 2 type parameters, not 3."/> + <message kind="error" line="13" text="Incorrect number of type parameters supplied. The generic type Parse5<T,S> has 2 type parameters, not 1."/> + <message kind="error" line="15" text="Intertype declarations can only be made on the generic type, not on a parameterized type. The name 'String' cannot be used as a type parameter, since it refers to a real type."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="Parsing generic ITDs - 6"> + <compile files="Parse6.java" options="-1.5"/> + </ajc-test> + + <!-- end of generic ITDs --> + + <!-- generic decps --> + + <ajc-test dir="java5/generics/decp" title="generic decp - simple"> + <compile files="Basic.aj" options="-1.5"/> + <run class="Basic"/> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - implementing two variants #1"> + <compile files="Basic2.aj" options="-1.5"> + <message kind="error" line="11" text="Cannot declare parent I<java.lang.Integer> onto type Basic2 since it already has I<java.lang.String> in its hierarchy"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - implementing two variants #2"> + <compile files="Basic2b.aj" options="-1.5"> + <message kind="error" line="10" text="Cannot declare parent I<java.lang.Integer> onto type Basic2b since it already has I in its hierarchy"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - implementing two variants #3"> + <compile files="Basic2c.aj" options="-1.5"> + <message kind="error" line="10" text="Cannot declare parent I onto type Basic2c since it already has I<java.lang.Double> in its hierarchy"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - implementing two variants #4"> + <compile files="Basic2d.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/decp/binary" title="generic decp binary - implementing two variants #1"> + <weave classesFiles="Base1.java" aspectsFiles="Asp1.aj" options="-1.5,-showWeaveInfo"> + <message kind="error" line="2" text="Cannot declare parent I<java.lang.Integer> onto type Base1 since it already has I<java.lang.String> in its hierarchy"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/generics/decp/binary" title="generic decp binary - implementing two variants #2"> + <weave classesFiles="Base2.java" aspectsFiles="Asp2.aj" options="-1.5,-showWeaveInfo"> + <message kind="error" line="2" text="Cannot declare parent I<java.lang.Integer> onto type Base2 since it already has I in its hierarchy"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/generics/decp/binary" title="generic decp binary - implementing two variants #3"> + <weave classesFiles="Base3.java" aspectsFiles="Asp3.aj" options="-1.5,-showWeaveInfo"> + <message kind="error" line="2" text="Cannot declare parent I onto type Base3 since it already has I<java.lang.Double> in its hierarchy"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/generics/decp/binary" title="generic decp binary - implementing two variants #4"> + <weave classesFiles="Base4.java" aspectsFiles="Asp4.aj" options="-1.5,-showWeaveInfo"/> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - incorrect number of type parameters"> + <compile files="Basic3.aj" options="-1.5"> + <message kind="error" line="10" text="Type pattern does not match because the wrong number of type parameters are specified: Type I requires 1 parameter(s)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - specifying bounds"> + <compile files="Basic4.aj" options="-1.5"/> + <run class="Basic4"/> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - specifying bounds but breaking them"> + <compile files="Basic5.aj" options="-1.5"> + <message kind="error" line="7" text="Type java.lang.String does not meet the specification for type parameter 1 (T extends java.lang.Number) in generic type I"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - with parameterized on the target"> + <compile files="Basic6.aj" options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Extending interface set for type 'Basic6' (Basic6.aj) to include 'K<java.lang.Integer>' (Basic6.aj)"/> + </compile> + <run class="Basic6"/> + </ajc-test> + + <!-- end of generic decps --> + + <!-- generics/itds and binary weaving --> + + <ajc-test dir="java5/generics/itds/binaryweaving" vm="1.5" title="binary weaving ITDs - A"> + <compile files="TestA_generictype.java" outjar="code.jar" options="-1.5"/> + <compile files="TestA_aspect.aj,TestA_class.java" inpath="code.jar" options="-1.5"/> + <run class="TestA_class"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/binaryweaving" vm="1.5" title="binary weaving ITDs - B"> + <compile files="TestB_generictype.java" outjar="code.jar" options="-1.5"/> + <compile files="TestB_aspect1.aj,TestB_aspect2.aj,TestB_class.java" inpath="code.jar" options="-1.5"/> + <run class="TestB_class"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/binaryweaving" vm="1.5" title="binary weaving ITDs - 1"> + <compile files="BaseClass.java" outjar="code.jar" options="-1.5"/> + <compile files="A1.aj" inpath="code.jar" options="-1.5"/> + <run class="BaseClass"> + <stderr> + <line text="Advice count=1"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds/binaryweaving" vm="1.5" title="binary weaving ITDs - 2"> + <compile files="BaseClass.java,A1.aj" outjar="code.jar" options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A1' (A1.aj:'java.util.List<java.lang.String> BaseClass.list1')"/> + <message kind="weave" text="Type 'BaseClass' (BaseClass.java:12) advised by after advice from 'A1' (A1.aj:7)"/> + </compile> + <compile files="A2.aj" inpath="code.jar" options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A1' (A1.aj:'java.util.List<java.lang.String> BaseClass.list1')"/> + <message kind="weave" text="Type 'BaseClass' (BaseClass.java:12) advised by after advice from 'A1' (code.jar!A1.class:7(from A1.aj))"/> + <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A2' (A2.aj:'java.util.List<N> BaseClass.list2')"/> + <message kind="weave" text="Type 'BaseClass' (BaseClass.java:13) advised by after advice from 'A2' (A2.aj:8)"/> + </compile> + <run class="BaseClass"> + <stderr> + <line text="Advice count=2"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds/binaryweaving" vm="1.5" title="binary weaving ITDs - 3"> + <compile files="BaseClass.java,A1.aj,A2.aj" outjar="code.jar" options="-1.5"/> + <compile files="A3.aj" inpath="code.jar" options="-1.5"/> + <run class="BaseClass"> + <stderr> + <line text="Advice count=3"/> + </stderr> + </run> + </ajc-test> + + <!-- end of generics/itds and binary weaving --> + + <!-- generics/itds and bridge methods --> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 1"> + <compile files="Sub1.java,Super1.java,X1.aj" options="-1.5"/> + <run class="X1"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 1 - binary"> + <compile files="Sub1.java,Super1.java" outjar="code.jar" options="-1.5"/> + <compile files="X1.aj" inpath="code.jar" options ="-1.5"/> + <run class="X1"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 2"> + <compile files="Sub2.java,Super2.java,X2.aj" options="-1.5"/> + <run class="X2"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 2 - binary"> + <compile files="Sub2.java,Super2.java" outjar="code.jar" options="-1.5"/> + <compile files="X2.aj,Util.java" inpath="code.jar" options ="-1.5"/> + <run class="X2"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 3"> + <compile files="Sub3.java,Super3.java,X3.aj" options="-1.5"/> + <run class="X3"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 3 - binary"> + <compile files="Sub3.java,Super3.java" outjar="code.jar" options="-1.5"/> + <compile files="X3.aj" inpath="code.jar" options ="-1.5"/> + <run class="X3"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 4"> + <compile files="Sub4.java,Super4.java,X4.aj" options="-1.5"/> + <run class="X4"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 4 - binary"> + <compile files="Sub4.java,Super4.java" outjar="code.jar" options="-1.5"/> + <compile files="X4.aj" inpath="code.jar" options ="-1.5"/> + <run class="X4"/> + </ajc-test> + + <ajc-test dir="java5/generics/binaryBridging" title="binary bridge methods - one"> + <compile files="OneA.java" outjar="onea.jar" options="-1.5"/> + <compile files="OneB.java" outjar="oneb.jar" options="-1.5"/> + <compile files="OneX.java" inpath="onea.jar;oneb.jar" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/binaryBridging" title="binary bridge methods - two"> + <compile files="TwoA.java" outjar="twoa.jar" options="-1.5"/> + <compile files="TwoB.java" outjar="twob.jar" options="-1.5"/> + <compile files="TwoX.java" inpath="twoa.jar;twob.jar" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/binaryBridging" title="binary bridge methods - three"> + <compile files="ThreeA.java" outjar="threea.jar" options="-1.5"/> + <compile files="ThreeB.java" outjar="threeb.jar" options="-1.5"/> + <compile files="ThreeX.java" inpath="threea.jar;threeb.jar" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="abstract intertype methods and covariant returns"> + <compile files="pr91381.aj" options="-1.5"/> + <run class="pr91381"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" title="abstract intertype methods and covariant returns - error"> + <compile files="pr91381_2.aj"> + <message kind="error" line="15" text="The return type is incompatible with A.foo()"/> + </compile> + </ajc-test> + + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridging with covariance 1 - normal"> + <compile files="Bridging1.aj,Util.java" options="-1.5"/> + <run class="Bridging1"> + <stderr> + <line text="Number of methods defined for D is 2"/> + <line text="C D.method1() [BridgeMethod]"/> + <line text="D D.method1()"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridging with covariance 1 - itd"> + <compile files="BridgingITD1.aj,Util.java" options="-1.5"/> + <run class="BridgingITD1"> + <stderr> + <line text="Number of methods defined for D is 2"/> + <line text="C D.method1() [BridgeMethod]"/> + <line text="D D.method1()"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="basic bridging with type vars - 1 - normal"> + <compile files="Bridging2.aj,Util.java" options="-1.5"/> + <run class="Bridging2"> + <stderr> + <line text="Number of methods defined for D is 2"/> + <line text="java.lang.Object D.next() [BridgeMethod]"/> + <line text="java.lang.String D.next()"/> + </stderr> + </run> + </ajc-test> + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="basic bridging with type vars - 1 - itd"> + <compile files="BridgingITD2.aj,Util.java" options="-1.5"/> + <run class="BridgingITD2"> + <stderr> + <line text="Number of methods defined for D is 2"/> + <line text="java.lang.Object D.next() [BridgeMethod]"/> + <line text="java.lang.String D.next()"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="basic bridging with type vars - 2 - normal"> + <compile files="Bridging3.aj,Util.java" options="-1.5"/> + <run class="Bridging3"> + <stderr> + <line text="Number of methods defined for D is 2"/> + <line text="java.lang.Object D.id(java.lang.Object) [BridgeMethod]"/> + <line text="java.lang.String D.id(java.lang.String)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="basic bridging with type vars - 2 - itd"> + <compile files="BridgingITD3.aj,Util.java" options="-1.5"/> + <run class="BridgingITD3"> + <stderr> + <line text="Number of methods defined for D is 2"/> + <line text="java.lang.Object D.id(java.lang.Object) [BridgeMethod]"/> + <line text="java.lang.String D.id(java.lang.String)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="Abstract intertype method and covariant returns" pr="91381"> + <compile files="pr91381.aj" options="-1.5,-showWeaveInfo"> + <message kind="weave" text="Type 'A' (pr91381.aj) has intertyped method from 'pr91381' (pr91381.aj:'java.lang.Object A.foo()')"/> + </compile> + <run class="pr91381"/> + </ajc-test> + <!-- end of generics/itds and bridge methods --> + + + <!-- generics and pointcuts --> + + <ajc-test dir="java5/generics/pointcuts" title="handler pcd and generics / type vars"> + <compile files="GenericInterface.java,HandlerPointcutTests.aj" options="-1.5"> + <message kind="error" line="4" text="Syntax error on token"/> + <message kind="error" line="8" text="a parameterized type pattern may not be used in a handler pointcut expression"/> + <message kind="warning" line="8" text="no match for this type name: T"/> + <message kind="error" line="11" text="a parameterized type pattern may not be used in a handler pointcut expression"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="pointcuts that dont allow type vars"> + <compile files="PointcutsThatDontAllowTypeVars.aj" options="-1.5"> + <message kind="error" line="3" text="Syntax error on token"/> + <message kind="error" line="5" text="Syntax error on token"/> + <message kind="error" line="7" text="Syntax error on token"/> + <message kind="error" line="9" text="Syntax error on token"/> + <message kind="error" line="11" text="Syntax error on token"/> + <message kind="error" line="13" text="Syntax error on token"/> + <message kind="error" line="15" text="Syntax error on token"/> + <message kind="error" line="17" text="Syntax error on token"/> + <message kind="error" line="19" text="Syntax error on token"/> + <message kind="error" line="21" text="Syntax error on token"/> + <message kind="error" line="23" text="Syntax error on token"/> + <message kind="error" line="25" text="Syntax error on token"/> + <message kind="error" line="27" text="Syntax error on token"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="annotation pcds with parameterized types"> + <compile files="ParameterizedTypesInAtPCDs.aj" options="-1.5"> + <message kind="error" line="3" text="Syntax error on token"/> + <message kind="error" line="5" text="Syntax error on token"/> + <message kind="error" line="7" text="Syntax error on token"/> + <message kind="error" line="9" text="Syntax error on token"/> + <message kind="error" line="11" text="Syntax error on token"/> + <message kind="error" line="13" text="Syntax error on token"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="annotation patterns with parameterized types"> + <compile files="ParameterizedTypesInAnnotationPatterns.aj" options="-1.5"> + <message kind="error" line="5" text="is not an annotation type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="staticinitialization and parameterized types"> + <compile files="GenericInterface.java,GenericImplementingClass.java,StaticInitializationWithParameterizedTypes.aj" options="-1.5"> + <message kind="error" line="4" text="no static initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="6" text="no static initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="9" text="no static initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="11" text="no static initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="14" text="no static initialization join points for parameterized types, use raw type instead"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="staticinitialization and parameterized type matching"> + <compile files="GenericInterface.java,GenericImplementingClass.java,ConcreteImplementingClass.java,ConcreteExtendingClass.java,StaticInitializationWithParameterizedTypesMatching.aj" options="-1.5"> + <message kind="warning" line="1" text="clinit(GenericInterface<Double>+)"/> + <message kind="warning" line="3" text="clinit(GenericInterface<Double>+)"/> + <message kind="warning" line="3" text="clinit(GenericImplementingClass<Double>+)"/> + <message kind="warning" line="15" text="Type java.lang.String does not meet the specification for type parameter 1 (N extends java.lang.Number) in generic type GenericInterface"/> + <message kind="warning" line="19" text="Type pattern does not match because the wrong number of type parameters are specified: Type GenericInterface requires 1 parameter(s)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="staticinitialization with generic types"> + <compile files="GenericInterface.java,GenericImplementingClass.java,StaticInitializationWithGenericTypes.aj" options="-1.5"> + <message kind="warning" line="1" text="one generic param, correct bounds"/> + <message kind="warning" line="1" text="doesn't matter what type variable name you use"/> + <message kind="warning" line="1" text="works with classes too"/> + <message kind="warning" line="4" text="Type T does not meet the specification for type parameter 1 (N extends java.lang.Number) in generic type GenericInterface"/> + <message kind="warning" line="20" text="Type pattern does not match because the wrong number of type parameters are specified: Type GenericImplementingClass requires 1 parameter(s)"/> + <message kind="warning" line="24" text="Type N extends java.lang.Number & java.lang.Comparable does not meet the specification for type parameter 1 (N extends java.lang.Number) in generic type GenericImplementingClass"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="staticinitialization with generic types - advanced"> + <compile files="StaticInitializationWithGenericTypesAdvanced.aj" options="-1.5"> + <message kind="warning" line="76" text="simple match"/> + <message kind="warning" line="76" text="matches since R and R extends Object are equivalent"/> + <message kind="warning" line="63" text="raw type should match"/> + <message kind="warning" line="63" text="matches all bounds"/> + <message kind="warning" line="63" text="still matches with interfaces specified in a different order"/> + <message kind="warning" line="69" text="matches with type variable inter-dependencies"/> + <message kind="warning" line="76" text="matches any generic type with one unbound type var"/> + <message kind="warning" line="82" text="any generic type with one type var bound to Number or subtype"/> + <message kind="warning" line="63" text="matches a generic type with any upper bound and i/f bounds"/> + <message kind="warning" line="76" text="matches a generic type with any upper bound and i/f bounds"/> + <message kind="warning" line="82" text="matches a generic type with any upper bound and i/f bounds"/> + <message kind="warning" line="19" text="Type X does not meet the specification for type parameter 1 (T extends java.lang.Number & java.lang.Comparable & java.io.Serializable) in generic type ClassWithInterfaceBounds"/> + <message kind="warning" line="23" text="Type Y extends java.lang.Number does not meet the specification for type parameter 1 (T extends java.lang.Number & java.lang.Comparable & java.io.Serializable) in generic type ClassWithInterfaceBounds"/> + <message kind="warning" line="27" text="Type Z extends java.lang.Number & java.lang.Comparable does not meet the specification for type parameter 1 (T extends java.lang.Number & java.lang.Comparable & java.io.Serializable) in generic type ClassWithInterfaceBounds"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="within pcd with various parameterizations and generic types - errors"> + <compile files="WithinPointcutMatching.aj" options="-1.5"> + <message kind="warning" line="4" text="no match for this type name: T"/> + <message kind="error" line="4" text="parameterized type pattern not supported by 'within', use a raw type pattern instead"/> + <message kind="error" line="5" text="parameterized type pattern not supported by 'within', use a raw type pattern instead"/> + <message kind="error" line="6" text="parameterized type pattern not supported by 'within', use a raw type pattern instead"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="within pcd with various parameterizations and generic types - warnings"> + <compile files="WithinPointcutMatchingWarnings.aj" options="-1.5"> + <message kind="warning" line="16" text="matched set correctly"/> + <message kind="warning" line="18" text="matched execution correctly"/> + <message kind="warning" line="24" text="init matched correctly"/> + <message kind="warning" line="32" text="matched parameterization ok"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="this and target with various parameterizations and generic types - errors"> + <compile files="ThisAndTargetPointcutMatching.aj" options="-1.5"> + <message kind="warning" line="4" text="no match for this type name: T"/> + <message kind="warning" line="5" text="no match for this type name: T"/> + <message kind="error" line="4" text="parameterized types not supported for this and target pointcuts (erasure limitation)"/> + <message kind="error" line="5" text="parameterized types not supported for this and target pointcuts (erasure limitation)"/> + <message kind="error" line="6" text="parameterized types not supported for this and target pointcuts (erasure limitation)"/> + <message kind="error" line="7" text="parameterized types not supported for this and target pointcuts (erasure limitation)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="this and target with various parameterizations and generic types - runtime"> + <compile files="ThisAndTargetPointcutMatchingRuntime.aj" options="-1.5"> + </compile> + <run class="ThisAndTargetPointcutMatchingRuntime"> + <stdout> + <line text="set and this matched ok"/> + <line text="set and target matched ok"/> + <line text="call and target matched ok"/> + <line text="execution and this matched ok"/> + <line text="execution and target matched ok"/> + <line text="parameterized call and target matched ok"/> + <line text="parameterized call and this matched ok"/> + <line text="parameterized call and target matched ok"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="get and set with various parameterizations and generic types - errors"> + <compile files="GetAndSetPointcutMatching.aj" options="-1.5"> + <message kind="warning" line="4" text="no match for this type name: T"/> + <message kind="warning" line="5" text="no match for this type name: T"/> + <message kind="error" line="4" text="can't use parameterized type patterns for the declaring type of a get or set pointcut expression (use the raw type instead)"/> + <message kind="error" line="5" text="can't use parameterized type patterns for the declaring type of a get or set pointcut expression (use the raw type instead)"/> + <message kind="error" line="6" text="can't use parameterized type patterns for the declaring type of a get or set pointcut expression (use the raw type instead)"/> + <message kind="error" line="7" text="can't use parameterized type patterns for the declaring type of a get or set pointcut expression (use the raw type instead)"/> + <message kind="error" line="8" text="can't use parameterized type patterns for the declaring type of a get or set pointcut expression (use the raw type instead)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="get and set with various parameterizations and generic declaring types"> + <compile files="GetAndSetPointcutMatchingDeclaringType.aj" options="-1.5"> + <message kind="warning" line="15" text="generic/param get matching ok"/> + <message kind="warning" line="33" text="generic/param get matching ok"/> + <message kind="warning" line="12" text="generic/param set matching ok"/> + <message kind="warning" line="32" text="generic/param set matching ok"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="get and set with various parameterizations and generic field types"> + <compile files="GetAndSetPointcutMatchingFieldType.aj" options="-1.5"> + <message kind="warning" line="13" text="raw field type matching in get ok"/> + <message kind="warning" line="14" text="raw field type matching in set ok"/> + <message kind="warning" line="49" text="erasure matching in get ok"/> + <message kind="warning" line="45" text="erasure matching in set ok"/> + <message kind="warning" line="53" text="erasure matching in get with params ok"/> + <message kind="warning" line="46" text="erasure matching in set with params ok"/> + <message kind="warning" line="72" text="parameterized type matching in set ok"/> + <message kind="warning" line="73" text="parameterized type matching in get ok"/> + <message kind="warning" line="74" text="parameterized type matching in set ok x2"/> + <message kind="warning" line="75" text="parameterized type matching in get ok x2"/> + <message kind="warning" line="83" text="wildcard set matching ok"/> + <message kind="warning" line="84" text="wildcard get matching ok"/> + <message kind="warning" line="85" text="wildcard extends set matching ok"/> + <message kind="warning" line="86" text="wildcard extends get matching ok"/> + <message kind="warning" line="87" text="wildcard super set matching ok"/> + <message kind="warning" line="88" text="wildcard super get matching ok"/> + <message kind="warning" line="73" text="the really wild show"/> + <message kind="warning" line="84" text="the really wild show"/> + <message kind="warning" line="86" text="the really wild show"/> + <message kind="warning" line="88" text="the really wild show"/> + <message kind="warning" line="53" text="the really wild show"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="init and preinit with parameterized declaring types"> + <compile files="InitializationPointcutMatching.aj" options="-1.5"> + <message kind="warning" line="4" text="no match for this type name: T"/> + <message kind="warning" line="5" text="no match for this type name: T"/> + <message kind="error" line="4" text="no [pre]initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="5" text="no [pre]initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="6" text="no [pre]initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="7" text="no [pre]initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="8" text="no [pre]initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="9" text="invalid throws pattern: a generic class may not be a direct or indirect subclass of Throwable"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="init and preinit with raw declaring type pattern"> + <compile files="InitializationPointcutMatchingDeclaringType.aj" options="-1.5"> + <message kind="warning" line="10" text="generic/param init matching ok"/> + <message kind="warning" line="10" text="generic/param preinit matching ok"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="init and preinit with parameterized parameter types"> + <compile files="InitializationPointcutMatchingParamTypes.aj" options="-1.5"> + <message kind="warning" line="36" text="raw param type matching in init ok"/> + <message kind="warning" line="36" text="raw param type matching in preinit ok"/> + <message kind="warning" line="37" text="erasure matching in init ok"/> + <message kind="warning" line="37" text="erasure matching in preinit ok"/> + <message kind="warning" line="38" text="erasure matching in init with params ok"/> + <message kind="warning" line="38" text="erasure matching in preinit with params ok"/> + <message kind="warning" line="48" text="parameterized type matching in init ok"/> + <message kind="warning" line="48" text="parameterized type matching in preinit ok"/> + <message kind="warning" line="49" text="parameterized type matching in init ok x2"/> + <message kind="warning" line="49" text="parameterized type matching in preinit ok x2"/> + <message kind="warning" line="50" text="wildcard init matching ok"/> + <message kind="warning" line="50" text="wildcard preinit matching ok"/> + <message kind="warning" line="51" text="wildcard extends init matching ok"/> + <message kind="warning" line="51" text="wildcard extends preinit matching ok"/> + <message kind="warning" line="52" text="wildcard super init matching ok"/> + <message kind="warning" line="52" text="wildcard super preinit matching ok"/> + <message kind="warning" line="48" text="the really wild show"/> + <message kind="warning" line="50" text="the really wild show"/> + <message kind="warning" line="51" text="the really wild show"/> + <message kind="warning" line="52" text="the really wild show"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="withincode with various parameterizations and generic types - errors"> + <compile files="WithincodePointcutMatching.aj" options="-1.5"> + <message kind="warning" line="4" text="no match for this type name: T"/> + <message kind="error" line="4" text="can't use parameterized type patterns for the declaring type of a withincode pointcut expression (use the raw type instead)"/> + <message kind="error" line="5" text="can't use parameterized type patterns for the declaring type of a withincode pointcut expression (use the raw type instead)"/> + <message kind="error" line="6" text="invalid throws pattern: a generic class may not be a direct or indirect subclass of Throwable"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="withincode with various parameterizations and generic types - matching"> + <compile files="WithinCodePointcutMatchingParamAndReturnTypes.aj" options="-1.5"> + <message kind="warning" line="35" text="raw param type matching in withincode ok"/> + <message kind="warning" line="36" text="raw param type matching in withincode ok"/> + <message kind="warning" line="67" text="raw return type matching in withincode ok"/> + <message kind="warning" line="38" text="erasure type matching in withincode ok"/> + <message kind="warning" line="39" text="erasure type matching in withincode ok"/> + <message kind="warning" line="42" text="erasure type matching in withincode ok"/> + <message kind="warning" line="62" text="withincode and parameterized method ok"/> + <message kind="warning" line="62" text="withincode and generic interface ok"/> + <message kind="warning" line="65" text="withincode and interface control test"/> + <message kind="warning" line="35" text="match on parameterized args"/> + <message kind="warning" line="36" text="match on parameterized args"/> + <message kind="warning" line="67" text="match on parameterized return type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="withincode with overriding of inherited generic members"> + <compile files="WithinCodeOverriding.aj" options="-1.5"> + <message kind="warning" line="37" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="50" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="63" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="37" text="base declaring type match on erasure"/> + <message kind="warning" line="50" text="base declaring type match on erasure"/> + <message kind="warning" line="63" text="base declaring type match on erasure"/> + <message kind="warning" line="50" text="sub type match on erasure"/> + <message kind="warning" line="63" text="parameterized match on erasure"/> + <message kind="warning" line="80" text="erasure match on base interface"/> + <message kind="warning" line="80" text="wildcard match on erasure"/> + <message kind="warning" line="80" text="parameterized match"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="execution pcd with raw type matching"> + <compile files="GenericInterface.java,ConcreteImplementingClass.java,GenericImplementingClass.java,RawTypeMatching.aj" options="-1.5"> + <message kind="warning" line="4" text="execution(* GenericInterface.*(..))"/> + <message kind="warning" line="5" text="execution(* GenericInterface.*(..))"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="execution pcd with raw signature matching"> + <compile files="GenericInterface.java,ConcreteImplementingClass.java,GenericImplementingClass.java,RawSignatureMatching.aj" options="-1.5"> + <message kind="warning" line="4" text="execution(* GenericInterface.asInt(Number))"/> + <message kind="warning" line="5" text="execution(* GenericInterface.asInt(Number))"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="execution with various parameterizations and generic types - errors"> + <compile files="ExecutionPointcutMatchingErrorCases.aj" options="-1.5"> + <message kind="warning" line="4" text="no match for this type name: T"/> + <message kind="error" line="4" text="can't use parameterized type patterns for the declaring type of an execution pointcut expression (use the raw type instead)"/> + <message kind="error" line="5" text="can't use parameterized type patterns for the declaring type of an execution pointcut expression (use the raw type instead)"/> + <message kind="error" line="6" text="invalid throws pattern: a generic class may not be a direct or indirect subclass of Throwable"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="execution with various parameterizations and generic types - matching"> + <compile files="ExecutionPointcutMatchingParamAndReturnTypes.aj" options="-1.5"> + <message kind="warning" line="35" text="raw param type matching in execution ok"/> + <message kind="warning" line="67" text="raw return type matching in execution ok"/> + <message kind="warning" line="38" text="erasure type matching in execution ok"/> + <message kind="warning" line="42" text="erasure type matching in execution ok"/> + <message kind="warning" line="61" text="execution and parameterized method ok"/> + <message kind="warning" line="61" text="execution and generic interface ok"/> + <message kind="warning" line="65" text="execution and interface control test"/> + <message kind="warning" line="35" text="match on parameterized args"/> + <message kind="warning" line="67" text="match on parameterized return type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="execution with overriding of inherited generic members"> + <compile files="ExecutionOverriding.aj" options="-1.5"> + <message kind="warning" line="36" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="49" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="62" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="36" text="base declaring type match on erasure"/> + <message kind="warning" line="49" text="base declaring type match on erasure"/> + <message kind="warning" line="62" text="base declaring type match on erasure"/> + <message kind="warning" line="49" text="sub type match on erasure"/> + <message kind="warning" line="62" text="parameterized match on erasure"/> + <message kind="warning" line="79" text="erasure match on base interface"/> + <message kind="warning" line="79" text="wildcard match on erasure"/> + <message kind="warning" line="79" text="parameterized match"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="execution pcd with generic declaring type and erased parameter types"> + <compile files="GenericInterface.java,ConcreteImplementingClass.java,GenericImplementingClass.java,GenericDeclaringTypeWithParameterErasure.aj" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="execution pcd with generic signature matching"> + <compile files="GenericInterface.java,ConcreteImplementingClass.java,GenericImplementingClass.java,GenericSignatureMatching.aj" options="-1.5"> + <message kind="warning" line="4" text="execution<T>(* GenericInterface<T extends Number>.asInt(T))"/> + <message kind="warning" line="5" text="execution<T>(* GenericInterface<T extends Number>.asInt(T))"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="call with various parameterizations and generic types - errors"> + <compile files="CallPointcutMatchingErrorCases.aj" options="-1.5"> + <message kind="warning" line="4" text="no match for this type name: T"/> + <message kind="error" line="4" text="can't use parameterized type patterns for the declaring type of a call pointcut expression (use the raw type instead)"/> + <message kind="error" line="5" text="can't use parameterized type patterns for the declaring type of a call pointcut expression (use the raw type instead)"/> + <message kind="error" line="6" text="invalid throws pattern: a generic class may not be a direct or indirect subclass of Throwable"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="call with various parameterizations and generic types - matching"> + <compile files="CallPointcutMatchingParamAndReturnTypes.aj" options="-1.5"> + <message kind="warning" line="7" text="raw param type matching in call ok"/> + <message kind="warning" line="8" text="raw return type matching in call ok"/> + <message kind="warning" line="9" text="erasure type matching in call ok"/> + <message kind="warning" line="10" text="erasure type matching in call ok"/> + <message kind="warning" line="11" text="call and parameterized method ok"/> + <message kind="warning" line="11" text="call and generic interface ok"/> + <message kind="warning" line="12" text="call and interface control test"/> + <message kind="warning" line="7" text="match on parameterized args"/> + <message kind="warning" line="8" text="match on parameterized return type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="call with overriding of inherited generic members"> + <compile files="CallOverriding.aj" options="-1.5"> + <message kind="warning" line="8" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="9" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="10" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="8" text="base declaring type match on erasure"/> + <message kind="warning" line="9" text="base declaring type match on erasure"/> + <message kind="warning" line="10" text="base declaring type match on erasure"/> + <message kind="warning" line="9" text="sub type match on erasure"/> + <message kind="warning" line="10" text="parameterized match on erasure"/> + <message kind="warning" line="87" text="erasure match on base interface"/> + <message kind="warning" line="87" text="wildcard match on erasure"/> + <message kind="warning" line="87" text="parameterized match"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="call with bridge methods"> + <compile files="CallWithBridgeMethods.aj" options="-1.5"> + <!-- see testcode + <message kind="warning" line="23" text="should match call to bridge method on L23, this is a real call!"/> + --> + </compile> + </ajc-test> + + + <ajc-test dir="java5/generics/pointcuts" title="args with raw type and generic / parameterized sigs"> + <compile files="RawArgs.aj" options="-1.5"> + </compile> + <run class="RawArgs"> + <stdout> + <line text="args(List) match at call(void Generic.foo(List))"/> + <line text="args(List) match at call(void Generic.bar(List))"/> + <line text="args(List) match at call(void Generic.tada(List))"/> + <line text="args(List) match at call(void Generic.tada(List))"/> + <line text="args(List) match at call(void Generic.tada(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="args with parameterized type and generic / parameterized sigs"> + <compile files="ArgsParameterized.aj" options="-1.5"> + <message kind="warning" line="28" text="unchecked match of List<String> with List"/> + </compile> + <run class="ArgsParameterized"> + <stdout> + <line text="args(List<String> matched at call(void Generic.foo(List))"/> + <line text="args(List<String> matched at call(void Generic.bar(List))"/> + <line text="args(List<String> matched at call(void Generic.tada(List))"/> + <line text="args(List<String> matched at call(void Generic.something(List))"/> + <line text="args(List<String> matched at call(void MustBeString.listit(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="args with parameterized type and wildcards"> + <compile files="ArgsParameterizedWithWildcards.aj" options="-1.5"> + <message kind="warning" line="10" text="unchecked match of List<Double> with List when argument is an instance of List"/> + <message kind="warning" line="10" text="unchecked match of List<Double> with List<? extends Double> when argument is an instance of List"/> + <message kind="warning" line="10" text="unchecked match of List<Double> with List<? extends Number> when argument is an instance of List"/> + <message kind="warning" line="10" text="unchecked match of List<Double> with List<?> when argument is an instance of List"/> + </compile> + <run class="ArgsParameterizedWithWildcards"> + <stdout> + <line text="List<Double> matched at execution(void C.rawList(List))"/> + <line text="List<Double> matched at execution(void C.listOfSomething(List))"/> + <line text="List<Double> matched at execution(void C.listOfSomeNumber(List))"/> + <line text="List<Double> matched at execution(void C.listOfDouble(List))"/> + <line text="List<Double> matched at execution(void C.listOfSomeDouble(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="args with generic wildcard"> + <compile files="ArgsListOfSomething.aj" options="-1.5 -Xlint:ignore"> + </compile> + <run class="ArgsListOfSomething"> + <stdout> + <line text="List<?> matches execution(void ArgsListOfSomething.rawList(List))"/> + <line text="List<?> matches execution(void ArgsListOfSomething.listOfString(List))"/> + <line text="List<?> matches execution(void ArgsListOfSomething.listOfSomething(List))"/> + <line text="List<?> matches execution(void ArgsListOfSomething.listOfSomethingExtends(List))"/> + <line text="List<?> matches execution(void ArgsListOfSomething.listOfSomethingSuper(List))"/> + <line text="wild map matches execution(void ArgsListOfSomething.mapit(Map))"/> + <line text="exact wild map matches execution(void ArgsListOfSomething.mapit(Map))"/> + <line text="super type exact matches execution(void ArgsListOfSomething.setOf(HashSet))"/> + <line text="super wild type matches execution(void ArgsListOfSomething.setOf(HashSet))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="args with generic wildcard extends"> + <compile files="ArgsListOfSomethingExtends.aj" options="-1.5"> + <message kind="warning" line="27" text="unchecked match of List<? extends Number> with List"/> + <message kind="warning" line="27" text="unchecked match of List<? extends Number> with List<?>"/> + </compile> + <run class="ArgsListOfSomethingExtends"> + <stdout> + <line text="List<? extends Number> matches execution(void ArgsListOfSomethingExtends.rawList(List))"/> + <line text="List<? extends Number> matches execution(void ArgsListOfSomethingExtends.listOfNumber(List))"/> + <line text="List<? extends Number> matches execution(void ArgsListOfSomethingExtends.listOfDouble(List))"/> + <line text="List<? extends Number> matches execution(void ArgsListOfSomethingExtends.listOfSomething(List))"/> + <line text="List<? extends Number> matches execution(void ArgsListOfSomethingExtends.listOfSomethingExtends(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="args with generic wildcard super"> + <compile files="ArgsListOfSomethingSuper.aj" options="-1.5"> + <message kind="warning" line="32" text="unchecked match of List<? super Number> with List"/> + <message kind="warning" line="32" text="unchecked match of List<? super Number> with List<?>"/> + <message kind="warning" line="32" text="unchecked match of List<? super Number> with List<? extends Number>"/> + </compile> + <run class="ArgsListOfSomethingSuper"> + <stdout> + <line text="List<? super Number> matches execution(void ArgsListOfSomethingSuper.rawList(List))"/> + <line text="List<? super Number> matches execution(void ArgsListOfSomethingSuper.listOfObject(List))"/> + <line text="List<? super Number> matches execution(void ArgsListOfSomethingSuper.listOfNumber(List))"/> + <line text="List<? super Number> matches execution(void ArgsListOfSomethingSuper.listOfSomething(List))"/> + <line text="List<? super Number> matches execution(void ArgsListOfSomethingSuper.listOfSomethingSuper(List))"/> + <line text="List<? super Number> matches execution(void ArgsListOfSomethingSuper.listOfSomethingExtendsNumber(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="generic method matching"> + <compile files="GenericMethods.aj" options="-1.5"> + <message kind="warning" line="19" text="static generic method match"/> + <message kind="warning" line="34" text="static generic method match"/> + <message kind="warning" line="24" text="instance generic method match"/> + <message kind="warning" line="39" text="instance generic method match"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="generic wildcards in signature matching"> + <compile files="GenericWildcardsInSignatureMatching.aj" options="-1.5"> + <message kind="warning" line="5" text="set of a list"/> + <message kind="warning" line="7" text="exact nested wildcard match"/> + <message kind="warning" line="7" text="wildcard nested wildcard match"/> + <message kind="warning" line="11" text="super"/> + <message kind="warning" line="15" text="super wild match"/> + </compile> + </ajc-test> + + <!-- end of generics and pointcuts tests --> + + <ajc-test dir="java5/generics/afterAdvice" title="after throwing with parameterized throw type"> + <compile files="AfterThrowing.aj" options="-1.5"> + <message kind="error" line="6" text="cannot convert from List<String> to Throwable"/> + </compile> + </ajc-test> + + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with raw type and generic / parameterized sigs"> + <compile files="AfterReturningRawType.aj" options="-1.5"> + </compile> + <run class="AfterReturningRawType"> + <stdout> + <line text="returning(List) match at call(List Generic.foo(List))"/> + <line text="returning(List) match at call(List Generic.bar(List))"/> + <line text="returning(List) match at call(List Generic.tada(List))"/> + <line text="returning(List) match at call(List Generic.tada(List))"/> + <line text="returning(List) match at call(List Generic.tada(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with parameterized type and generic / parameterized sigs"> + <compile files="AfterReturningParameterized.aj" options="-1.5"> + <message kind="warning" line="28" text="unchecked match of List<String> with List"/> + </compile> + <run class="AfterReturningParameterized"> + <stdout> + <line text="returning(List<String> matched at call(List Generic.foo(List))"/> + <line text="returning(List<String> matched at call(List Generic.bar(List))"/> + <line text="returning(List<String> matched at call(List Generic.tada(List))"/> + <line text="returning(List<String> matched at call(List Generic.something(List))"/> + <line text="returning(List<String> matched at call(List MustBeString.listit(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with parameterized type and wildcards"> + <compile files="AfterReturningParameterizedWithWildcards.aj" options="-1.5"> + <message kind="warning" line="10" text="unchecked match of List<Double> with List when argument is an instance of List"/> + <message kind="warning" line="10" text="unchecked match of List<Double> with List<? extends Double> when argument is an instance of List"/> + <message kind="warning" line="10" text="unchecked match of List<Double> with List<? extends Number> when argument is an instance of List"/> + <message kind="warning" line="10" text="unchecked match of List<Double> with List<?> when argument is an instance of List"/> + </compile> + <run class="AfterReturningParameterizedWithWildcards"> + <stdout> + <line text="List<Double> matched at call(List C.rawList(List))"/> + <line text="List<Double> matched at call(List C.listOfSomething(List))"/> + <line text="List<Double> matched at call(List C.listOfSomeNumber(List))"/> + <line text="List<Double> matched at call(List C.listOfDouble(List))"/> + <line text="List<Double> matched at call(List C.listOfSomeDouble(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with generic wildcard"> + <compile files="AfterReturningListOfSomething.aj" options="-1.5"> + <!-- warning is unchecked match of List<?> from line 28 onto line 15. --> + <!-- some sets may be lists unless the set is final, so as a cast is allowed, the match is allowed --> + <message kind="warning" line="28"/> + <message kind="warning" line="44"/> + <message kind="warning" line="48"/> + </compile> + <run class="AfterReturningListOfSomething"> + <stdout> + <line text="List<?> matches execution(List AfterReturningListOfSomething.rawList(List))"/> + <line text="List<?> matches execution(List AfterReturningListOfSomething.listOfString(List))"/> + <line text="List<?> matches execution(List AfterReturningListOfSomething.listOfSomething(List))"/> + <line text="List<?> matches execution(List AfterReturningListOfSomething.listOfSomethingExtends(List))"/> + <line text="List<?> matches execution(List AfterReturningListOfSomething.listOfSomethingSuper(List))"/> + <line text="wild map matches execution(Map AfterReturningListOfSomething.mapit(Map))"/> + <line text="exact wild map matches execution(Map AfterReturningListOfSomething.mapit(Map))"/> + <line text="super type exact matches execution(HashSet AfterReturningListOfSomething.setOf(HashSet))"/> + <line text="super wild type matches execution(HashSet AfterReturningListOfSomething.setOf(HashSet))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with generic wildcard extends"> + <compile files="AfterReturningListOfSomethingExtends.aj" options="-1.5"> + <message kind="warning" line="27" text="unchecked match of List<? extends Number> with List"/> + <message kind="warning" line="27" text="unchecked match of List<? extends Number> with List<?>"/> + </compile> + <run class="AfterReturningListOfSomethingExtends"> + <stdout> + <line text="List<? extends Number> matches execution(List AfterReturningListOfSomethingExtends.rawList(List))"/> + <line text="List<? extends Number> matches execution(List AfterReturningListOfSomethingExtends.listOfNumber(List))"/> + <line text="List<? extends Number> matches execution(List AfterReturningListOfSomethingExtends.listOfDouble(List))"/> + <line text="List<? extends Number> matches execution(List AfterReturningListOfSomethingExtends.listOfSomething(List))"/> + <line text="List<? extends Number> matches execution(List AfterReturningListOfSomethingExtends.listOfSomethingExtends(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with generic wildcard super"> + <compile files="AfterReturningListOfSomethingSuper.aj" options="-1.5"> + <message kind="warning" line="32" text="unchecked match of List<? super Number> with List"/> + <message kind="warning" line="32" text="unchecked match of List<? super Number> with List<?>"/> + <message kind="warning" line="32" text="unchecked match of List<? super Number> with List<? extends Number>"/> + </compile> + <run class="AfterReturningListOfSomethingSuper"> + <stdout> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.rawList(List))"/> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.listOfObject(List))"/> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.listOfNumber(List))"/> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.listOfSomething(List))"/> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.listOfSomethingSuper(List))"/> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.listOfSomethingExtendsNumber(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test title="ajdk notebook: erasure matching examples" dir="java5/generics/ajdk"> + <compile files="ErasureMatching.aj" options="-1.5"> + <message kind="warning" line="18" text="static generic method match"/> + <message kind="warning" line="21" text="instance generic method match"/> + <message kind="warning" line="31" text="method in generic type match"/> + <message kind="warning" line="28" text="field in generic type match"/> + </compile> + </ajc-test> + + <ajc-test title="ajdk notebook: simple parameterized type matching examples" dir="java5/generics/ajdk"> + <compile files="SimpleParameterizedTypeExamples.aj" options="-1.5"> + <message kind="warning" line="34" text="get myStrings 1"/> + <message kind="warning" line="34" text="get myStrings 2"/> + <message kind="warning" line="38" text="get myStrings 1"/> + <message kind="warning" line="38" text="get myStrings 2"/> + <message kind="warning" line="35" text="get myFloats 1"/> + <message kind="warning" line="35" text="get myFloats 2"/> + <message kind="warning" line="35" text="get myFloats 3"/> + <message kind="warning" line="34" text="getter 1"/> + <message kind="warning" line="35" text="getter 1"/> + <message kind="warning" line="34" text="getter 2"/> + <message kind="warning" line="35" text="getter 2"/> + <message kind="warning" line="34" text="getter 3"/> + <message kind="warning" line="35" text="getter 4"/> + <message kind="warning" line="25" text="call 1"/> + <message kind="warning" line="25" text="call 2"/> + </compile> + </ajc-test> + + <ajc-test title="ajdk notebook: mixed parameterized types and generic methods" dir="java5/generics/ajdk"> + <compile files="MixedParameterizedAndTypeVariables.aj" options="-1.5"> + <message kind="warning" line="13" text="erasure match"/> + <message kind="warning" line="13" text="mixed match"/> + <message kind="warning" line="13" text="params only match"/> + </compile> + </ajc-test> + + <ajc-test title="ajdk notebook: signature matching with generic wildcards" dir="java5/generics/ajdk"> + <compile files="SignatureWildcards.aj" options="-1.5"> + <message kind="warning" line="13" text="any list"/> + <message kind="warning" line="15" text="any list"/> + <message kind="warning" line="17" text="any list"/> + <message kind="warning" line="13" text="only foo"/> + <message kind="warning" line="15" text="some list"/> + <message kind="warning" line="13" text="any list with upper bound"/> + <message kind="warning" line="15" text="any list with upper bound"/> + </compile> + </ajc-test> + + <ajc-test title="ajdk notebook: bridge method examples" dir="java5/generics/ajdk"> + <compile files="BridgeMethodExamples.aj" options="-1.5"> + <message kind="warning" line="17" text="double match"/> + <message kind="warning" line="25" text="double match"/> + <message kind="warning" line="9" text="match"/> + <message kind="warning" line="11" text="match"/> + </compile> + </ajc-test> + + <ajc-test title="ajdk notebook: args examples" dir="java5/generics/ajdk"> + <compile files="ArgsExamples.aj" options="-1.5"> + <message kind="warning" line="15" text="unchecked match of List<Double> with List<? extends Number> when argument is an instance of List at join point method-execution(void C.goo(List<? extends Number>)) [Xlint:uncheckedArgument]"/> + <message kind="warning" line="53" text="unchecked match"/> + </compile> + <run class="ArgsExamples"> + <stdout> + <line text="args(List)"/> + <line text="args List of String"/> + <line text="args(List)"/> + <line text="args List of Double"/> + <line text="args(List)"/> + <line text="args List of Double"/> + </stdout> + </run> + </ajc-test> + + <ajc-test title="ajdk notebook: after returning examples" dir="java5/generics/ajdk"> + <compile files="AfterReturningExamples.aj" options="-1.5"> + <message kind="warning" line="20" text="unchecked match of List<Double> with List<? extends Number>"/> + </compile> + <run class="AfterReturningExamples"> + <stdout> + <line text="execution(List C.foo(List))"/> + <line text="raw s1"/> + <line text="raw s2"/> + <line text="execution(List C.bar(List))"/> + <line text="raw 5.0"/> + <line text="raw 10.0"/> + <line text="a1 5.0"/> + <line text="a1 10.0"/> + <line text="a2 5.0"/> + <line text="a2 10.0"/> + <line text="a3 5.0"/> + <line text="a3 10.0"/> + <line text="execution(List C.goo(List))"/> + <line text="raw 5.0"/> + <line text="raw 10.0"/> + <line text="a1 5.0"/> + <line text="a1 10.0"/> + <line text="a3 5.0"/> + <line text="a3 10.0"/> + </stdout> + </run> + </ajc-test> + + <ajc-test title="ajdk notebook: args and wildcards examples" dir="java5/generics/ajdk"> + <compile files="WildcardArgsExamples.aj" options="-1.5"> + <message kind="warning" line="6" text="unchecked match of List<? extends Number> with List"/> + </compile> + <run class="WildcardArgsExamples"> + <stdout> + <line text="advice match at call(void C.foo(Object))"/> + <line text="advice match at call(void C.foo(Object))"/> + <line text="advice match 2 at call(void C.goo1(List))"/> + <line text="advice match 2 at call(void C.goo2(List))"/> + <line text="advice match 2 at call(void C.goo4(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test title="ajdk notebook: pointcut in generic class example" dir="java5/generics/ajdk"> + <compile files="PointcutInGenericClassExample.aj" options="-1.5"> + <message kind="warning" line="23" text="parameterized with C"/> + <message kind="warning" line="29" text="parameterized with D"/> + </compile> + </ajc-test> + + <!-- ============================================================== --> + <!-- End of generics tests --> + <!-- ============================================================== --> + + <ajc-test dir="bugs150/pr98901" title="public method with declare @method"> + <compile files="Case01.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B01"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" title="Compiler error due to a wrong exception check in try blocks"> + <compile files="pr82989.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr98901" title="public method on the aspect that declares @method on it"> + <compile files="Case02.aj" options="-1.5 -Xlint:error"/> + <run class="B02"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr98901" title="public annotated method"> + <compile files="Case03.aj" options="-1.5 -Xlint:error"/> + <run class="B03"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public ITD method with declare @method"> + <compile files="Case04.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B04"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public annotated ITD method"> + <compile files="Case05.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B05"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public ITD-on-itself method with declare @method"> + <compile files="Case06.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B06"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public annotated ITD-on-itself method"> + <compile files="Case07.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B07"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public method on an Interface with declare @method"> + <compile files="Case08.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B08"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public annotated method on an Interface"> + <compile files="Case09.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B09"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public ITD method onto an Interface with declare @method"> + <compile files="Case10.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B10"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public annotated ITD method onto an Interface"> + <compile files="Case11.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B11"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract method with declare @method"> + <compile files="Case12.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B12"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract method on the aspect that declares @method on it"> + <compile files="Case13.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B13"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract annotated method"> + <compile files="Case14.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B14"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract ITD method with declare @method"> + <compile files="Case15.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B15"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract annotated ITD method"> + <compile files="Case16.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B16"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract ITD-on-itself method with declare @method"> + <compile files="Case17.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B17"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract annotated ITD-on-itself method"> + <compile files="Case18.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B18"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract method on an Interface with declare @method"> + <compile files="Case19.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B19"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract annotated method on an Interface"> + <compile files="Case20.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B20"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract ITD method onto an Interface with declare @method"> + <compile files="Case21.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B21"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract annotated ITD method onto an Interface"> + <compile files="Case22.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B22"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public field with declare @field"> + <compile files="Case23.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B23"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + +<ajc-test dir="bugs150/pr98901" title="public field on the aspect that declares @field on it"> + <compile files="Case24.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B24"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public annotated field"> + <compile files="Case25.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B25"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr98901" title="public ITD field with declare @field"> + <compile files="Case26.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B26"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr98901" title="public annotated ITD field"> + <compile files="Case27.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B27"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr98901" title="public ITD-on-itself field with declare @field"> + <compile files="Case28.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B28"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr98901" title="public annotated ITD-on-itself field"> + <compile files="Case29.aj" options="-1.5 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B29"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" title="Unable to build shadows"> + <compile files="pr109728.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr110788" title="bad generic decp - 1"> + <compile files="Case1.java" options="-1.5"> + <message kind="error" line="10" text="Cannot declare parent B<java.lang.Number> onto type C since it already has A<java.lang.String> in its hierarchy"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr110788" title="bad generic decp - 2"> + <compile files="Case2.java" options="-1.5"> + <message kind="error" line="8" text="Cannot declare parent A<java.lang.Number> onto type C since it already has A<java.lang.String> in its hierarchy"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr110788" title="bad generic decp - 3"> + <compile files="Case3.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr110788" title="bad generic decp - 4"> + <compile files="Case4.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr110927" title="cant create signature attribute"> + <compile files="Case1.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr72834" title="broken dispatch"> + <compile files="Trouble.java"> + <message kind="error" line="7" text="package visible abstract inter-type declarations are not allowed"/> + <message kind="error" line="9" text="The method getName() is undefined for the type A"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr73856" title="missing accessor"> + <compile files="MissingAccessor.java"/> + <run class="MissingAccessor"/> + </ajc-test> + + <ajc-test dir="bugs150/pr90143" title="cant call super methods"> + <compile files="A.aj"/> + </ajc-test> + + <ajc-test dir="bugs150" title="cunning declare parents"> + <compile files="pr92311.aj"/> + </ajc-test> + + <ajc-test dir="bugs150" title="ITD varargs problem"> + <compile files="pr110906.aj" options="-1.5"/> + <run class="pr110906"> + <stdout> + <line text="a"/> + <line text="a"/> + <line text="a"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" title="generic itds and abstract method error"> + <compile files="pr102357.aj"/> + <run class="pr102357"/> + </ajc-test> + + <ajc-test dir="bugs150" title="unexpected error unboundFormalInPC"> + <compile files="pr112027.aj"/> + </ajc-test> + + <ajc-test dir="bugs150" title="ITD varargs in constructor"> + <compile files="pr111481.aj" options="-1.5"/> + <run class="pr111481"> + <stdout> + <line text="a"/> + <line text="a"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr112602" title="ClassCastException with generic wildcard"> + <compile files="GenericInterface.java,Implementation.java" options="-1.5,-emacssym"/> + </ajc-test> + + <ajc-test dir="bugs150/pr110307" title="Cant provide default implementation via ITD - 1"> + <compile files="Case1.java" options="-1.5"> + <message kind="warning" line="27" text="no match for this type name: Branch [Xlint:invalidAbsoluteTypeName]"/> + <message kind="error" line="26" text="can't bind type name 'Branch'"/> + <message kind="error" line="27" text="can't bind type name 'Revision'"/> + <message kind="error" line="33" text="List cannot be resolved to a type"/> + <message kind="error" line="38" text="List cannot be resolved to a type"/> + <message kind="error" line="39" text="List cannot be resolved to a type"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr110307" title="Cant provide default implementation via ITD - 2"> + <compile files="Case2.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr110307" title="Cant provide default implementation via ITD - 3"> + <compile files="Case3.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr110307" title="Cant provide default implementation via ITD - 4"> + <compile files="Case4.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr110307" title="Cant provide default implementation via ITD - 5"> + <compile files="Case5.java" options="-1.5"> + <!-- might possibly need more diagnostics in this case to explain what has happened --> + <message kind="error" line="10" text="can't override java.util.List<java.lang.String> I.foo() with java.util.List<java.lang.Integer> A.foo() return types don't match"/> + <message kind="error" line="15" text="can't override java.util.List<java.lang.String> I.foo() with java.util.List<java.lang.Integer> A.foo() return types don't match"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr110307" title="Cant provide default implementation via ITD - 6"> + <compile files="Case6.java" options="-1.5"> + <message kind="error" line="8" text="N cannot be resolved to a type"/> + <!--message kind="error" line="7" text="T cannot be resolved to a type"/--> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr110307" title="Cant provide default implementation via ITD - 7"> + <compile files="Case7.java" options="-1.5"/> + <run class="Case7"> + <stderr> + <line text="in=hello out=hello"/> + <line text="in=35 out=35"/> + <line text="in=[] out=[]"/> + </stderr> + </run> + </ajc-test> + + <!-- generic ITDs --> + + <ajc-test dir="java5/generics/itds/design" title="generic itds - design A"> + <compile files="DesignA.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/design" title="generic itds - design B"> + <compile files="DesignB.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/design" title="generic itds - design C"> + <compile files="DesignC.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/design" title="generic itds - design D"> + <compile files="DesignD.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/design" title="generic itds - design E"> + <compile files="DesignE.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/design" title="generic itds - design F"> + <compile files="DesignF.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/design" title="generic itds - design G"> + <compile files="DesignG.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs150/pr116626" title="NPE in WeavingAdaptor"> + <compile files="com/foo/bar/Test.java, TestAspect.aj" options="-1.5"/> + <run class="com.foo.bar.Test" ltw="aop.xml" + > + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119657" title="IllegalAccessError with around advice on interface method call"> + <compile files="services/account/StockQuoteServiceTest.java, services/accountdata/StockAccount.java, services/stockquote/StockQuoteService.java, services/stockquote/StockQuoteServiceImpl.java, services/account/AccountReport.java, accounts/recovery/Recovery.aj"/> + <run class="services.account.StockQuoteServiceTest"> + <stdout> + <line text="Recovery.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + <run class="services.account.StockQuoteServiceTest" ltw="aop.xml"> + <stdout> + <line text="Recovery.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119657" title="IllegalAccessError with around advice on interface method call not self"> + <compile files="services/account/StockQuoteServiceTest.java, services/accountdata/StockAccount.java, services/stockquote/StockQuoteService.java, services/stockquote/StockQuoteServiceImpl.java, services/account/AccountReport.java, accounts/recovery/RecoveryNotSelf.aj"/> + <run class="services.account.StockQuoteServiceTest"> + <stdout> + <line text="RecoveryNotSelf.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + <run class="services.account.StockQuoteServiceTest" ltw="aop-notself.xml"> + <stdout> + <line text="RecoveryNotSelf.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119657" title="IllegalAccessError with around advice on interface method call using -XterminateAfterCompilation and LTW"> + <compile files="services/account/StockQuoteServiceTest.java, services/accountdata/StockAccount.java, services/stockquote/StockQuoteService.java, services/stockquote/StockQuoteServiceImpl.java, services/account/AccountReport.java"/> + <compile files="accounts/recovery/Recovery.aj" options="-XterminateAfterCompilation"/> + <run class="services.account.StockQuoteServiceTest" ltw="aop.xml"> + <stdout> + <line text="Recovery.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119657" title="IllegalAccessError with around advice on interface method call using LTW"> + <compile files="services/account/StockQuoteServiceTest.java, services/accountdata/StockAccount.java, services/stockquote/StockQuoteService.java, services/stockquote/StockQuoteServiceImpl.java, services/account/AccountReport.java"/> + <compile files="accounts/recovery/Recovery.aj"/> + <run class="services.account.StockQuoteServiceTest" ltw="aop.xml"> + <stdout> + <line text="Recovery.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119657" title="IllegalAccessError with around advice on interface method call not self using LTW"> + <compile files="services/account/StockQuoteServiceTest.java, services/accountdata/StockAccount.java, services/stockquote/StockQuoteService.java, services/stockquote/StockQuoteServiceImpl.java, services/account/AccountReport.java"/> + <compile files="accounts/recovery/RecoveryNotSelf.aj" options="-1.4"/> + <run class="services.account.StockQuoteServiceTest" ltw="aop-notself.xml"> + <stdout> + <line text="RecoveryNotSelf.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119657" title="IllegalAccessError with around advice on interface method call self and not self using LTW"> + <compile files="services/account/StockQuoteServiceTest.java, services/accountdata/StockAccount.java, services/stockquote/StockQuoteService.java, services/stockquote/StockQuoteServiceImpl.java, services/account/AccountReport.java"/> + <compile files="accounts/recovery/Recovery.aj, accounts/recovery/RecoveryNotSelf.aj"/> + <run class="services.account.StockQuoteServiceTest" ltw="aop-selfandnotself.xml"> + <stdout> + <line text="Recovery.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + <line text="RecoveryNotSelf.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119657" title="IllegalAccessError with around advice on interface method call using LTW and -XnoInline"> + <compile files="services/account/StockQuoteServiceTest.java, services/accountdata/StockAccount.java, services/stockquote/StockQuoteService.java, services/stockquote/StockQuoteServiceImpl.java, services/account/AccountReport.java"/> + <compile files="accounts/recovery/Recovery.aj"/> + <run class="services.account.StockQuoteServiceTest" ltw="aop-noinline.xml"> + <stdout> + <line text="Recovery.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr121385" title="override protected pointcut in aop.xml concrete aspect"> + <compile files="Hello.java"/> + <compile files="World.aj, ConcreteWorld.aj" options="-1.4"/> + <run class="Hello" ltw="aop.xml"> + <stdout> + <line text="around start!"/> + <line text="Hello"/> + <line text="around start!"/> + <line text="World"/> + <line text="around end!"/> + <line text="around end!"/> + </stdout> + </run> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjAnnotationGenTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjAnnotationGenTests.java new file mode 100644 index 000000000..bfbc289f6 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjAnnotationGenTests.java @@ -0,0 +1,160 @@ +/******************************************************************************* + * Copyright (c) 2005 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: + * initial development Jonas Bon�r, Alexandre Vasseur + *******************************************************************************/ +package org.aspectj.systemtest.ajc150.ataspectj; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * A suite for @AspectJ aspects located in java5/ataspectj + * + * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> + */ +public class AtAjAnnotationGenTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AtAjAnnotationGenTests.class); + } + + protected File getSpecFile() { + return getClassResource("annotationgen.xml"); + } + + public void testSimpleAspect() { + runTest("annotation gen for simple aspect"); + } + + public void testSimpleAspectIn14Mode() { + runTest("annotation gen for simple aspect pre 1.5"); + } + + public void testAspectAlreadyAnnotated() { + runTest("annotation gen for simple annotated aspect"); + } + + public void testPrivilegedAspect() { + runTest("annotation gen for privileged aspect"); + } + + public void testPerThisAspect() { + runTest("annotation gen for perthis aspect"); + } + + public void testPerTargetAspect() { + runTest("annotation gen for pertarget aspect"); + } + + public void testPerCflowAspect() { + runTest("annotation gen for percflow aspect"); + } + + public void testPerCflowbelowAspect() { + runTest("annotation gen for percflowbelow aspect"); + } + + public void testPertypewithinAspect() { + runTest("annotation gen for pertypewithin aspect"); + } + + public void testInnerAspectOfClass() { + runTest("annotation gen for inner aspect of aspect"); + } + + public void testInnerAspectOfAspect() { + runTest("annotation gen for inner aspect of class"); + } + + public void testAdvice() { + runTest("annotation gen for advice declarations"); + } + + public void testSimplePointcut() { + runTest("annotation gen for simple pointcut"); + } + + public void testPointcutModifiers() { + runTest("annotation gen for pointcut modifiers"); + } + + public void testPointcutParams() { + runTest("annotation gen for pointcut params"); + } + + public void testPointcutRefs() { + runTest("annotation gen for pointcut refs"); + } + + public void testBeforeWithBadReturn() { + runTest("before ann with non-void return"); + } + + public void testTwoAnnotationsOnSameElement() { + runTest("two anns on same element"); + } + + public void testBadPcutInAdvice() { + runTest("bad pcut in after advice"); + } + + public void testBadParameterBinding() { + runTest("bad parameter binding in advice"); + } + + public void testSimpleAtPointcut() { + runTest("simple pointcut no params"); + } + + public void testPointcutMedley() { + runTest("pointcut medley"); + } + + public void testAdviceDeclaredInClass() { + runTest("advice in a class"); + } + + public void testDeows() { + runTest("ann gen for deows"); + } + + // no reliable way to get around classpath issues for + // running this test as part of release script :( +// public void testRuntimePointcutsReferencingCompiledPointcuts() { +// runTest("runtime pointcut resolution referencing compiled pointcuts"); +// } + + public void testDecP() { + runTest("ann gen for decp"); + } + + public void testDecPAdvanced() { + runTest("ann gen for decp 2"); + } + + public void testDecS() { + runTest("ann gen for decs"); + } + + public void testDecPrecedence() { + runTest("ann gen for dec precedence"); + } + + public void testDecAnnotation() { + runTest("ann gen for dec annotation"); + } + + public void testITDs() { + runTest("ann gen for itds"); + } +} + diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java new file mode 100644 index 000000000..966642da2 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java @@ -0,0 +1,237 @@ +/******************************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alexandre Vasseur initial implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150.ataspectj; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.util.FileUtil; + +/** + * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> + */ +public class AtAjLTWTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(org.aspectj.systemtest.ajc150.ataspectj.AtAjLTWTests.class); + } + + protected File getSpecFile() { + return getClassResource("ltw.xml"); + } + + public void testRunThemAllWithJavacCompiledAndLTW() { + runTest("RunThemAllWithJavacCompiledAndLTW"); + } + + public void testAjcLTWPerClauseTest_XterminateAfterCompilation() { + runTest("AjcLTW PerClauseTest -XterminateAfterCompilation"); + } + + public void testAjcLTWPerClauseTest_Xreweavable() { + runTest("AjcLTW PerClauseTest -Xreweavable"); + } + + public void testJavaCAjcLTWPerClauseTest() { + runTest("JavaCAjcLTW PerClauseTest"); + } + + public void testAjcLTWAroundInlineMungerTest_XterminateAfterCompilation() { + runTest("AjcLTW AroundInlineMungerTest -XterminateAfterCompilation"); + } + + public void testAjcLTWAroundInlineMungerTest_Xreweavable() { + runTest("AjcLTW AroundInlineMungerTest"); + } + + public void testAjcLTWAroundInlineMungerTest() { + runTest("AjcLTW AroundInlineMungerTest"); + } + + public void testAjcLTWAroundInlineMungerTest_XnoInline_Xreweavable() { + runTest("AjcLTW AroundInlineMungerTest -XnoInline -Xreweavable"); + } + + public void testAjcLTWAroundInlineMungerTest2() { + runTest("AjcLTW AroundInlineMungerTest2"); + } + + public void testLTWDumpNone() { + runTest("LTW DumpTest none"); + + File f = new File("_ajdump/ataspectj/DumpTest.class"); + assertFalse(f.exists()); + f = new File("_ajdump/_before/ataspectj/DumpTestTheDump.class"); + assertFalse(f.exists()); + f = new File("_ajdump/ataspectj/DumpTestTheDump.class"); + assertFalse(f.exists()); + } + + public void testLTWDump() { + runTest("LTW DumpTest"); + + File f = new File("_ajdump/ataspectj/DumpTest.class"); + assertFalse(f.exists()); + f = new File("_ajdump/_before/ataspectj/DumpTestTheDump.class"); + assertFalse(f.exists()); + f = new File("_ajdump/ataspectj/DumpTestTheDump.class"); + assertTrue(f.exists()); + + // tidy up... + f = new File("_ajdump"); + FileUtil.deleteContents(f); + f.delete(); + } + + public void testLTWDumpBeforeAndAfter() { + runTest("LTW DumpTest before and after"); + + // before + File f = new File("_ajdump/_before/com/foo/bar"); + CountingFilenameFilter cff = new CountingFilenameFilter(".class"); + f.listFiles(cff); + assertEquals("Expected dump file in " + f.getAbsolutePath(), 1, cff.getCount()); + + // after + f = new File("_ajdump/com/foo/bar"); + cff = new CountingFilenameFilter(".class"); + f.listFiles(cff); + assertEquals("Expected dump file in " + f.getAbsolutePath(), 1, cff.getCount()); + + // tidy up... + f = new File("_ajdump"); + FileUtil.deleteContents(f); + f.delete(); + } + + public void testLTWDumpClosure() { + runTest("LTW DumpTest closure"); + + File f = new File("_ajdump/ataspectj/DumpTestTheDump$AjcClosure1.class"); + assertTrue("Missing dump file " + f.getAbsolutePath(), f.exists()); + + // tidy up... + f = new File("_ajdump"); + FileUtil.deleteContents(f); + f.delete(); + } + + public void testLTWDumpProxy() { + runTest("LTW DumpTest proxy"); + + // The working directory is different because this test must be forked + File dir = new File("../tests/java5/ataspectj"); + File f = new File(dir, "_ajdump/_before/com/sun/proxy"); + CountingFilenameFilter cff = new CountingFilenameFilter(".class"); + f.listFiles(cff); + assertEquals("Expected dump file in " + f.getAbsolutePath(), 1, cff.getCount()); + f = new File(dir, "_ajdump/com/sun/proxy"); + cff = new CountingFilenameFilter(".class"); + f.listFiles(cff); + assertEquals(1, cff.getCount()); + + // tidy up... + f = new File(dir, "_ajdump"); + FileUtil.deleteContents(f); + f.delete(); + } + + public void testLTWDumpJSP() { + runTest("LTW DumpTest JSP"); + + // The working directory is different because this test must be forked + File f = new File("_ajdump/_before/com/ibm/_jsp"); + CountingFilenameFilter cff = new CountingFilenameFilter(".class"); + f.listFiles(cff); + assertEquals("Expected dump file in " + f.getAbsolutePath(), 1, cff.getCount()); + f = new File("_ajdump/com/ibm/_jsp"); + cff = new CountingFilenameFilter(".class"); + f.listFiles(cff); + assertEquals(1, cff.getCount()); + + // tidy up... + f = new File("_ajdump"); + FileUtil.deleteContents(f); + f.delete(); + } + + public void testAjcAspect1LTWAspect2_Xreweavable() { + runTest("Ajc Aspect1 LTW Aspect2 -Xreweavable"); + } + + public void testLTWLogSilent() { + runTest("LTW Log silent"); + } + + public void testLTWLogVerbose() { + runTest("LTW Log verbose"); + } + + public void testLTWLogVerboseAndShow() { + runTest("LTW Log verbose and showWeaveInfo"); + } + + public void testLTWLogMessageHandlerClass() { + runTest("LTW Log messageHandlerClass"); + } + + public void testLTWUnweavable() { + // actually test that we do LTW proxy and jit classes + runTest("LTW Unweavable"); + } + + public void testLTWDecp() { + runTest("LTW Decp"); + } + + public void testLTWDecp2() { + runTest("LTW Decp2"); + } + + public void testCompileTimeAspectsDeclaredToLTWWeaver() { + runTest("Compile time aspects declared to ltw weaver"); + } + + public void testConcreteAtAspect() { + runTest("Concrete@Aspect"); + } + + public void testConcreteAspect() { + runTest("ConcreteAspect"); + } + + public void testConcretePrecedenceAspect() { + runTest("ConcretePrecedenceAspect"); + } + + // public void testAspectOfWhenAspectNotInInclude() { + // runTest("AspectOfWhenAspectNotInInclude"); + // } + // + // public void testAspectOfWhenAspectExcluded_pr152873() { + // runTest("AspectOfWhenAspectExcluded"); + // } + + public void testAspectOfWhenNonAspectExcluded_pr152873() { + runTest("AspectOfWhenNonAspectExcluded"); + } + + public void testAppContainer() { + runTest("AppContainer"); + } + + public void testCflowBelowStack() { + runTest("CflowBelowStack"); + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjMisuseTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjMisuseTests.java new file mode 100644 index 000000000..0f13e8f8b --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjMisuseTests.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2005 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: + * Alexandre Vasseur initial implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150.ataspectj; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> + */ +public class AtAjMisuseTests extends XMLBasedAjcTestCase { + + protected File getSpecFile() { + return getClassResource("misuse.xml"); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AtAjMisuseTests.class); + } + + public void testQAspectClassExtendingQAspectClass() { + runTest("@Aspect class extending @Aspect class"); + } + + // TODO asc commented out for now until Alex manages to get ajdtcore up to date... +// public void testClassWithQBeforeExtendingQAspectClass() { +// runTest("class with @Before extending @Aspect class"); +// } + + public void testQPointcutNotReturningVoid() { + runTest("@Pointcut not returning void"); + } + + public void testQPointcutWithGarbageString() { + runTest("@Pointcut with garbage string"); + } + + public void testQPointcutWithThrowsClause() { + runTest("@Pointcut with throws clause"); + } + + public void testQAfterReturningWithWrongNumberOfArgs() { + runTest("@AfterReturning with wrong number of args"); + } + + public void testQBeforeOnNon_publicMethod() { + runTest("@Before on non-public method"); + } + + public void testQBeforeOnMethodNotReturningVoid() { + runTest("@Before on method not returning void"); + } + + public void testQBeforeWithPJP() { + runTest("@Before with PJP"); + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java new file mode 100644 index 000000000..794fce907 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java @@ -0,0 +1,145 @@ +/******************************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * initial implementation Alexandre Vasseur + *******************************************************************************/ +package org.aspectj.systemtest.ajc150.ataspectj; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * A suite for @AspectJ aspects located in java5/ataspectj + * + * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> + */ +public class AtAjSyntaxTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AtAjSyntaxTests.class); + } + + protected File getSpecFile() { + return getClassResource("syntax.xml"); + } + + public void testSimpleBefore() { + runTest("SimpleBefore"); + } + + public void testSimpleAfter() { + runTest("SimpleAfter"); + } + + public void testSingletonAspectBindings() { + // Note AV: uncomment setReporting to get it in modules/tests folder + // org.aspectj.asm.AsmManager.setReporting("debug.txt",true,true,true,true); + runTest("singletonAspectBindings"); + // same stuff with AJ + // org.aspectj.asm.AsmManager.setReporting("debug-aj.txt",true,true,true,true); + // runTest("singletonAspectBindings2"); + + } + + public void testCflowTest() { + runTest("CflowTest"); + } + + public void testPointcutReferenceTest() { + runTest("PointcutReferenceTest"); + } + + public void testXXJoinPointTest() { + runTest("XXJoinPointTest"); + } + + public void testPrecedenceTest() { + runTest("PrecedenceTest"); + } + + public void testAfterXTest() { + runTest("AfterXTest"); + } + + public void testBindingTest() { + runTest("BindingTest"); + } + + public void testBindingTestNoInline() { + runTest("BindingTest no inline"); + } + + public void testPerClause() { + runTest("PerClause"); + } + + public void testAroundInlineMunger_XnoInline() { + runTest("AroundInlineMunger -XnoInline"); + } + + public void testAroundInlineMunger() { + try { + runTest("AroundInlineMunger"); + } finally { + System.out.println(ajc.getLastCompilationResult().getStandardError()); + } + } + + public void testAroundInlineMunger2() { + runTest("AroundInlineMunger2"); + } + + public void testDeow() { + runTest("Deow"); + } + + public void testSingletonInheritance() { + runTest("singletonInheritance"); + } + + public void testPerClauseInheritance() { + runTest("perClauseInheritance"); + } + + public void testIfPointcut() { + runTest("IfPointcutTest"); + } + + public void testIfPointcut2() { + runTest("IfPointcut2Test"); + } + + public void testMultipleBinding() { + runTest("MultipleBinding"); + } + + public void testBug104212() { + runTest("Bug104212"); + } + + public void testDeclareParentsInterface() { + runTest("DeclareParentsInterface"); + } + + public void testDeclareParentsImplements() { + runTest("DeclareParentsImplements"); + } + + public void testAbstractAspectNPE() { + runTest("AbstractAspectNPE"); + } + + public void testAbstractInherited() { + runTest("AbstractInherited"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/annotationgen.xml b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/annotationgen.xml new file mode 100644 index 000000000..3a8bda2ad --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/annotationgen.xml @@ -0,0 +1,187 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> +<!-- @AspectJ v1.5.0 Tests --> + + <!-- ================================================================= --> + <!-- Adrian's tests for generation of @AspectJ annotations from ajc --> + <!-- ================================================================= --> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for simple aspect"> + <compile files="SimpleAspect.aj" options="-1.5"/> + <run class="SimpleAspect"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for simple annotated aspect"> + <compile files="SimpleAnnotatedAspect.aj" options="-1.5"/> + <run class="SimpleAnnotatedAspect"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for simple aspect pre 1.5"> + <compile files="Simple14Aspect.aj" options="-1.4"/> + <compile files="Simple14AspectTest.java" options="-1.5"/> + <run class="Simple14AspectTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for privileged aspect"> + <compile files="PrivilegedAspect.aj" options="-1.5"/> + <run class="PrivilegedAspect"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for perthis aspect"> + <compile files="PerThisAspect.aj" options="-1.5"/> + <run class="PerThisAspect"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for pertarget aspect"> + <compile files="PerTargetAspect.aj" options="-1.5"/> + <run class="PerTargetAspect"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for percflow aspect"> + <compile files="PerCflowAspect.aj" options="-1.5"/> + <run class="PerCflowAspect"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for percflowbelow aspect"> + <compile files="PerCflowbelowAspect.aj" options="-1.5"/> + <run class="PerCflowbelowAspect"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for pertypewithin aspect"> + <compile files="PerTypeWithinAspect.aj" options="-1.5"/> + <run class="PerTypeWithinAspect"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for inner aspect of aspect"> + <compile files="InnerAspectAspect.aj" options="-1.5"/> + <run class="InnerAspectAspect"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for inner aspect of class"> + <compile files="InnerAspectClass.aj" options="-1.5"/> + <run class="InnerAspectClass"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for advice declarations"> + <compile files="BasicAdvice.aj" options="-1.5"/> + <run class="BasicAdvice"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for simple pointcut"> + <compile files="SimplePointcut.aj" options="-1.5"/> + <run class="SimplePointcut"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for pointcut modifiers"> + <compile files="PointcutModifiers.aj" options="-1.5"/> + <run class="PointcutModifiers"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for pointcut params"> + <compile files="PointcutsWithParams.aj" options="-1.5"/> + <run class="PointcutsWithParams"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="annotation gen for pointcut refs"> + <compile files="ReferencePointcuts.aj" options="-1.5"/> + <run class="ReferencePointcuts"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="before ann with non-void return"> + <compile files="BeforeWithBadReturn.java" options="-1.5"> + <message kind="error" line="7" text="This advice must return void"/> + <message kind="error" line="7" text="This method must return a result of type String"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="two anns on same element"> + <compile files="TwoForThePriceOfOne.java" options="-1.5"> + <message kind="error" line="7" text="The annotation @Pointcut is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="bad pcut in after advice"> + <compile files="AfterReturningWithBadPCut.java" options="-1.5"> + <message kind="error" line="6" text="Syntax error on token "excution(* *.*(..))""/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="bad parameter binding in advice"> + <compile files="BadParameterBinding.java" options="-1.5"> + <message kind="warning" line="11" text="no match for this type name: bpb"/> + <message kind="warning" line="15" text="no match for this type name: TheUnknownType"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="simple pointcut no params"> + <compile files="APointcut.java" options="-1.5"/> + <run class="APointcut"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="pointcut medley"> + <compile files="PointcutAssortment.java" options="-1.5"> + <message kind="error" line="9" text="Methods annotated with @Pointcut must return void"/> + <message kind="error" line="9" text="This method must return a result of type String"/> + <message kind="error" line="15" text="Pointcuts without an if() expression should have an empty method body"/> + <message kind="error" line="28" text="Duplicate annotation @Pointcut"/> + <message kind="error" line="29" text="Duplicate annotation @Pointcut"/> + <message kind="error" line="11" text="can't find referenced pointcut foo"/> + <message kind="warning" line="32" text="no match for this type name: foo [Xlint:invalidAbsoluteTypeName]"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="advice in a class"> + <compile files="AdviceInAClass.java" options="-1.5"> + <message kind="error" line="6" text="Advice must be declared inside an aspect type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="ann gen for deows"> + <compile files="Deow.aj" options="-1.5"> + </compile> + <run class="Deow"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="runtime pointcut resolution referencing compiled pointcuts"> + <compile files="PCLib.aj,RuntimePointcuts.java" options="-1.5"> + </compile> + <run class="RuntimePointcuts" classpath=".;../lib/bcel/bcel.jar" ltw=""/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="ann gen for decp"> + <compile files="DeclareParentsTest.aj" options="-1.5, -outxml"> + </compile> + <run class="DeclareParentsTest" ltw=""/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="ann gen for decp 2"> + <compile files="DeclareParentsTestAdvanced.aj" options="-1.5, -outxml"> + </compile> + <run class="a.b.c.DeclareParentsTestAdvanced" ltw=""/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="ann gen for decs"> + <compile files="DeclareSoftTest.aj" options="-1.5"> + </compile> + <run class="DeclareSoftTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="ann gen for dec precedence"> + <compile files="DeclarePrecedenceTest.aj" options="-1.5"> + </compile> + <run class="DeclarePrecedenceTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="ann gen for dec annotation"> + <compile files="DeclareAnnotationTest.aj" options="-1.5"> + </compile> + <run class="DeclareAnnotationTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj/annotationGen" title="ann gen for itds"> + <compile files="ITDTest.aj" options="-1.5, -outxml -Xlint:ignore -makeAjReflectable"> + </compile> + <run class="a.b.c.ITDTest" ltw=""/> + </ajc-test> +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/coverage/CoverageTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/coverage/CoverageTests.java new file mode 100644 index 000000000..534c7e57d --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/coverage/CoverageTests.java @@ -0,0 +1,43 @@ +package org.aspectj.systemtest.ajc150.ataspectj.coverage; + +import java.io.File; + +import junit.framework.Test; +import junit.framework.TestResult; + +public class CoverageTests extends + org.aspectj.testing.AutowiredXMLBasedAjcTestCase { + + // set to false to debug tests + static final boolean failing = true; + + /** + * disabled here so Ant JUnit rule wrt running *Tests works. + */ + public static Test suite() { + if (failing) { + return new Test() { + public int countTestCases() { + return 1; + } + + public void run(TestResult r) { + r.startTest(this); + r.endTest(this); + } + + public String toString() { + return CoverageTests.class.getName() + " fail"; + } + }; + } + return org.aspectj.testing.AutowiredXMLBasedAjcTestCase + .loadSuite(CoverageTests.class); + } + + protected File getSpecFile() { + return new File( + "../tests/src/org/aspectj/systemtest/ajc150/ataspectj/coverage/coverage.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/coverage/coverage.xml b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/coverage/coverage.xml new file mode 100644 index 000000000..f0ad3f4d3 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/coverage/coverage.xml @@ -0,0 +1,320 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.5.0 Tests --> + +<suite> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Aspect extending Aspect"> + <compile files="Test001.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Aspect with codestyle pointcut"> + <compile files="Test002.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="Codestyle Aspect with @Pointcut"> + <compile files="Test003.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut declared on codestyle advice"> + <compile files="Test004.java" options="-1.5"> + <message kind="error" line="9" text="Only @AdviceName AspectJ annotation allowed on advice"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Aspect class extending @Aspect class"> + <compile files="Test005.java" options="-1.5"> + <message kind="error" line="9" text="cannot extend a concrete aspect"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="class with @Before extending @Aspect class"> + <compile files="Test006.java" options="-1.5"> + <message kind="error" line="10" text="a class cannot extend an aspect"/> + <message kind="error" line="12" text="Advice must be declared inside an aspect type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before declared on codestyle advice"> + <compile files="Test007.java" options="-1.5"> + <message kind="error" line="8" text="Duplicate annotation @Before"/> + <message kind="error" line="9" text="Only @AdviceName AspectJ annotation allowed on advice"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut not returning void"> + <compile files="Test008.java" options="-1.5"> + <message kind="error" line="10" text="Pointcuts should have an empty method body"/> + <message kind="error" line="10" text="Methods annotated with @Pointcut must return void"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut on @Aspect class constructor"> + <compile files="Test009.java" options="-1.5"> + <message kind="error" line="7" text="The annotation @Pointcut is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Aspect on interface"> + <compile files="Test010.java" options="-1.5"> + <message kind="error" line="6" text="only classes can have an @Aspect annotation"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut on non-aspect class method"> + <compile files="Test011.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before on non-aspect class method"> + <compile files="Test012.java" options="-1.5"> + <message kind="error" line="6" text="Syntax error on token """/> + <message kind="error" line="7" text="Advice must be declared inside an aspect type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut on Interface method"> + <compile files="Test013.java" options="-1.5"> + <message kind="error" line="8" text="pointcuts can only be declared in a class or an aspect"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut with garbage string"> + <compile files="Test014.java" options="-1.5"> + <message kind="error" line="7" text="String literal is not properly closed by a double-quote"/> + <message kind="error" line="8" text="Syntax error, insert "}" to complete BlockStatements"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut with non-empty method body"> + <compile files="Test015.java" options="-1.5"> + <message kind="error" line="8" text="Pointcuts should have an empty method body"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut with throws clause"> + <compile files="Test016.java" options="-1.5"> + <message kind="error" line="8" text="pointcuts cannot throw exceptions!"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Aspect used badly"> + <compile files="Test017.java" options="-1.5"> + <message kind="error" line="5" text="Syntax error, insert "interface JavaIdentifier" to complete InterfaceHeader"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before declared on @Aspect class constructor"> + <compile files="Test018.java" options="-1.5"> + <message kind="error" line="7" text="The annotation @Before is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@AfterReturning with wrong number of args"> + <compile files="Test019.java" options="-1.5"> + <message kind="error" line="7" text="formal unbound in pointcut"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before on non-public method"> + <compile files="Test020.java" options="-1.5"> + <message kind="error" line="7" text="advice must be public"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before on method not returning void"> + <compile files="Test021.java" options="-1.5"> + <message kind="error" line="7" text="This advice must return void"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut with wrong number of args"> + <compile files="Test022.java" options="-1.5"> + <message kind="error" line="8" text="formal unbound in pointcut"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@DeclareParents with interface extending interface"> + <compile files="Test023.java" options="-1.5"> + <message kind="error" line="11" text="@DeclareParents must be called before a class implementing a single interface"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@DeclareParents with interface extending interface"> + <compile files="Test024.java" options="-1.5"> + <message kind="error" line="13" text="@DeclareParents must be called before a class implementing a single interface"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@DeclareParents used outside of an Aspect"> + <compile files="Test025.java" options="-1.5"> + <message kind="error" line="9" text="@DeclareParents must be called inside an aspect"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@DeclareParents on an @Aspect"> + <compile files="Test026.java" options="-1.5"> + <message kind="error" line="11" text="@DeclareParents must be called before a class implementing a single interface"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@DeclareParents on an @Aspect with @DeclarePrecidence"> + <compile files="Test027.java" options="-1.5"> + <message kind="error" line="12" text="@DeclareParents must be called before a class implementing a single interface"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@DeclareWarning with a non-final String"> + <compile files="Test028.java" options="-1.5"> + <message kind="error" line="6" text="@DeclareWarning must be called before a static final String"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@DeclareWarning with a static final Object (that is a String)"> + <compile files="Test029.java" options="-1.5"> + <message kind="error" line="7" text="Is this an error?"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@DeclareWarning with a static final Integer"> + <compile files="Test030.java" options="-1.5"> + <message kind="error" line="6" text="@DeclareWarning must be called before a static final String"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Around given an extension of ProceedingJoinPoint"> + <compile files="Test031.java" options="-1.5"> + <message kind="error" line="11" text="formal unbound in pointcut"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="calling @Before advice explicitly as a method"> + <compile files="Test032.java" options="-1.5"> + <message kind="error" line="14" text="Advice should never be called explicitly"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before on Interface method"> + <compile files="Test033.java" options="-1.5"> + <message kind="error" line="7" text="advice must be public"/> + <message kind="error" line="7" text="Advice must be declared inside an aspect type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Aspect Aspect double declaration"> + <compile files="Test034.java" options="-1.5"> + <message kind="error" line="5" text="The annotation @Aspect is only allowed before a class definition"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before and @After on one method"> + <compile files="Test035.java" options="-1.5"> + <message kind="error" line="7" text="The annotation @After is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before twice on one method"> + <compile files="Test036.java" options="-1.5"> + <message kind="error" line="6" text="Duplicate annotation @Before"/> + <message kind="error" line="7" text="Duplicate annotation @Before"/> + <message kind="error" line="7" text="The annotation @Before is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before advice with empty string"> + <compile files="Test037.java" options="-1.5"> + <message kind="error" line="6" text="Syntax error on token """/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="isPrivileged=truu misspelling"> + <compile files="Test038.java" options="-1.5"> + <message kind="error" line="5" text="The attribute isPrivileged is undefined for the annotation type Aspect"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut with an empty string"> + <compile files="Test039.java" options="-1.5"> + <message kind="error" line="11" text="Syntax error on token """/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before with && in string"> + <compile files="Test040.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@AdviceName given an empty string"> + <compile files="Test041.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@AdviceName used on @Before advice"> + <compile files="Test042.java" options="-1.5"> + <message kind="error" line="6" text="AdviceName annotation cannot be used for advice defined using annotation style"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="The Moody example"> + <compile files="Test043.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@DeclareWarning"> + <compile files="Test044.java" options="-1.5"> + <message kind="warning" line="13" text="This call is warned"/> + </compile> + </ajc-test> + + + + + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml new file mode 100644 index 000000000..a72fa4ebf --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml @@ -0,0 +1,349 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> +<suite> + + <ajc-test dir="java5/ataspectj" title="RunThemAllWithJavacCompiledAndLTW"> + <ant file="ajc-ant.xml" target="RunThemAllWithJavacCompiledAndLTW" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AjcLTW PerClauseTest -XterminateAfterCompilation"> + <compile + files="ataspectj/PerClauseTest.java,ataspectj/PerClauseTestAspects.java,ataspectj/TestHelper.java" + options="-1.5 -XterminateAfterCompilation"/> + <ant file="ajc-ant.xml" target="ltw.PerClauseTest" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AjcLTW PerClauseTest -Xreweavable"> + <compile + files="ataspectj/PerClauseTest.java,ataspectj/PerClauseTestAspects.java,ataspectj/TestHelper.java" + options="-1.5"/> + <ant file="ajc-ant.xml" target="ltw.PerClauseTest" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="JavaCAjcLTW PerClauseTest"> + <compile + files="ataspectj/PerClauseTest.java,ataspectj/TestHelper.java,ataspectj/PerClauseTestAspects.java" + options="-1.5 -XterminateAfterCompilation"/> + <comment> + aspectOf methods will be pushed in, ignore warning for adviceDidNotMatch but still do the logic for them + since such just added methods are an interesting case (percflow ajc$perCflowStack advice) + </comment> + <compile + files="ataspectj/PerClauseTestAspects.java" + options="-1.5 -Xdev:NoAtAspectJProcessing"> + <message kind="warning"/> + </compile> + <ant file="ajc-ant.xml" target="ltw.PerClauseTest" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AjcLTW AroundInlineMungerTest -XterminateAfterCompilation"> + <compile + files="ataspectj/AroundInlineMungerTest.java,ataspectj/AroundInlineMungerTestAspects.java,ataspectj/TestHelper.java" + options="-1.5 -XterminateAfterCompilation"/> + <ant file="ajc-ant.xml" target="ltw.AroundInlineMungerTest" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AjcLTW AroundInlineMungerTest -Xreweavable"> + <compile + files="ataspectj/AroundInlineMungerTest.java,ataspectj/AroundInlineMungerTestAspects.java,ataspectj/TestHelper.java" + options="-1.5"/> + <ant file="ajc-ant.xml" target="ltw.AroundInlineMungerTest" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AjcLTW AroundInlineMungerTest"> + <compile + files="ataspectj/AroundInlineMungerTestAspects.java" + options="-1.5 -Xlint:ignore"/> + <compile + files="ataspectj/AroundInlineMungerTest.java,ataspectj/TestHelper.java" + options="-1.5"/> + <ant file="ajc-ant.xml" target="ltw.AroundInlineMungerTest" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AjcLTW AroundInlineMungerTest -XnoInline -Xreweavable"> + <compile + files="ataspectj/AroundInlineMungerTestAspects.java" + options="-1.5 -Xlint:ignore -XnoInline"/> + <compile + files="ataspectj/AroundInlineMungerTest.java,ataspectj/TestHelper.java" + options="-1.5 -XnoInline"/> + <ant file="ajc-ant.xml" target="ltw.AroundInlineMungerTest" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AjcLTW AroundInlineMungerTest2"> + <compile + files="ataspectj/AroundInlineMungerTestAspects2.aj" + options="-1.5 -Xlint:ignore"/> + <compile + files="ataspectj/AroundInlineMungerTest2.aj,ataspectj/TestHelper.java" + options="-1.5"/> + <ant file="ajc-ant.xml" target="ltw.AroundInlineMungerTest2" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW DumpTest none"> + <compile + files="ataspectj/DumpTest.java,ataspectj/DumpTestTheDump.java,ataspectj/TestHelper.java" + options="-1.5"/> + <run class="ataspectj.DumpTest" ltw="ataspectj/aop-dumpnone.xml"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW DumpTest"> + <compile + files="ataspectj/EmptyAspect.aj" + options="-1.5 -Xlint:ignore"/> + <compile + files="ataspectj/DumpTest.java,ataspectj/DumpTestTheDump.java,ataspectj/TestHelper.java" + options="-1.5"/> + <run class="ataspectj.DumpTest" ltw="ataspectj/aop-dump.xml"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW DumpTest before and after"> + <compile + files="ataspectj/EmptyAspect.aj" + options="-1.5 -Xlint:ignore"/> + <compile + files="com/foo/bar/Test.java, com/foo/bar/Test$$EnhancerByCGLIB$$12345.java" + options="-1.5"/> + <run class="com.foo.bar.Test$$EnhancerByCGLIB$$12345" ltw="ataspectj/aop-dumpbeforeandafter.xml"> + <stdout> + <line text="Test$$EnhancerByCGLIB$$12345.main()"/> + <line text="Test.main()"/> + </stdout> + <stderr> + <line text="info AspectJ Weaver Version"/> + <line text="info register classloader"/> + <line text="info using"/> + <line text="info register aspect ataspectj.EmptyAspect"/> + <line text="debug not weaving 'com.foo.bar.Test$$EnhancerByCGLIB$$12345'"/> + <line text="debug weaving 'com.foo.bar.Test'"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW DumpTest closure"> + <compile + files="ataspectj/DumpTest.java,ataspectj/DumpTestTheDump.java,ataspectj/TestAroundAspect.aj" + options="-1.5"/> + <run class="ataspectj.DumpTest" ltw="ataspectj/aop-dumpclosure.xml"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW DumpTest proxy"> + <compile + files="ataspectj/EmptyAspect.aj" + options="-1.5 -Xlint:ignore"/> + <compile + files="ataspectj/TestProxyGenerator.java,ataspectj/TestInterface.java" + options="-1.5"/> + <ant file="ajc-ant.xml" target="ltw.DumpProxyTest" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW DumpTest JSP"> + <compile + files="ataspectj/EmptyAspect.aj" + options="-1.5 -Xlint:ignore"/> + <compile + files="com/ibm/_jsp/_abc123_xyz890.java" + options="-1.5"/> + <run class="com.ibm._jsp._abc123_xyz890" ltw="ataspectj/aop-dumpjsp.xml"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="Ajc Aspect1 LTW Aspect2 -Xreweavable"> + <compile + files="ataspectj/ltwreweavable/Main.java,ataspectj/ltwreweavable/Aspect1.java,ataspectj/ltwreweavable/Advisable.java" + options="-1.5" + outjar="main1.jar"/> + <ant file="ajc-ant.xml" target="ltw.Aspect2MainTest" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW Log silent"> + <compile + files="ataspectj/ltwlog/Main.java" + options="-1.5" + /> + <compile + files="ataspectj/ltwlog/Aspect1.java" + options="-1.5 -XterminateAfterCompilation" + > + </compile> + <run class="ataspectj.ltwlog.Main" ltw="ataspectj/ltwlog/aop-silent.xml"> + <stdout> + <line text="execution(Main.target())"/> + </stdout> + <stderr> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW Log verbose"> + <compile + files="ataspectj/ltwlog/Main.java" + options="-1.5" + /> + <compile + files="ataspectj/ltwlog/Aspect1.java" + options="-1.5 -XterminateAfterCompilation" + > + </compile> + <run class="ataspectj.ltwlog.Main" ltw="ataspectj/ltwlog/aop-verbose.xml"> + <stdout> + <line text="execution(Main.target())"/> + </stdout> + <stderr> + <line text="info AspectJ Weaver Version"/> + <line text="info register classloader"/> + <line text="info using"/> + <line text="info register aspect ataspectj.ltwlog.Aspect1"/> + <line text="debug weaving 'ataspectj.ltwlog.Main'"/> + <line text="debug weaving 'ataspectj.ltwlog.Aspect1'"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW Log verbose and showWeaveInfo"> + <compile + files="ataspectj/ltwlog/Main.java" + options="-1.5" + /> + <compile + files="ataspectj/ltwlog/Aspect1.java" + options="-1.5 -XterminateAfterCompilation" + > + </compile> + <run class="ataspectj.ltwlog.Main" ltw="ataspectj/ltwlog/aop-verboseandshow.xml"> + <stdout> + <line text="execution(Main.target())"/> + </stdout> + <stderr> + <line text="info AspectJ Weaver Version"/> + <line text="info register classloader"/> + <line text="info using"/> + <line text="info register aspect ataspectj.ltwlog.Aspect1"/> + <line text="debug weaving 'ataspectj.ltwlog.Main'"/> + <line text="weaveinfo Join point 'method-execution(void ataspectj.ltwlog.Main.target())' in Type 'ataspectj.ltwlog.Main' (Main.java:22) advised by before advice from 'ataspectj.ltwlog.Aspect1' (Aspect1.java)"/> + <line text="debug weaving 'ataspectj.ltwlog.Aspect1'"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW Log messageHandlerClass"> + <compile + files="ataspectj/ltwlog/Main.java, ataspectj/ltwlog/MessageHolder.java" + options="-1.5" + /> + <compile + files="ataspectj/ltwlog/Aspect1.java" + options="-1.5 -XterminateAfterCompilation" + > + </compile> + <run class="ataspectj.ltwlog.Main" ltw="ataspectj/ltwlog/aop-messagehandler.xml"> + <stdout> + <line text="MessageHolder.MessageHolder()"/> + <line text="execution(Main.target())"/> + </stdout> + <stderr> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW Unweavable"> + <ant file="ajc-ant.xml" target="ltw.Unweavable" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW Decp"> + <!-- ajc compile them to test reweable as well --> + <compile + files="ataspectj/DeclareParentsInterfaceTest.java,ataspectj/DeclareParentsImplementsTest.java,ataspectj/TestHelper.java" + options="-1.5" + /> + <!--<run class="ataspectj.DeclareParentsInterfaceTest" ltw="ataspectj/aop-decptest.xml"/>--> + <ant file="ajc-ant.xml" target="ltw.Decp" verbose="true"> + <stderr> + <line text="weaveinfo Extending interface set for type 'ataspectj.DeclareParentsInterfaceTest$Target' (DeclareParentsInterfaceTest.java) to include 'ataspectj.DeclareParentsInterfaceTest$Marker' (DeclareParentsInterfaceTest.java)"/> + <line text="weaveinfo Join point 'method-execution(void ataspectj.DeclareParentsInterfaceTest$Target.target())' in Type 'ataspectj.DeclareParentsInterfaceTest$Target' (DeclareParentsInterfaceTest.java:27) advised by before advice from 'ataspectj.DeclareParentsInterfaceTest$TestAspect' (DeclareParentsInterfaceTest.java)"/> + <line text="weaveinfo Extending interface set for type 'ataspectj.DeclareParentsImplementsTest$Target' (DeclareParentsImplementsTest.java) to include 'ataspectj.DeclareParentsImplementsTest$Introduced' (DeclareParentsImplementsTest.java)"/> + <line text="weaveinfo Type 'ataspectj.DeclareParentsImplementsTest$Target' (DeclareParentsImplementsTest.java) has intertyped method from 'ataspectj.DeclareParentsImplementsTest$TestAspect' (DeclareParentsImplementsTest.java:'void ataspectj.DeclareParentsImplementsTest$Introduced.intro()')"/> + <line text="weaveinfo Join point 'method-execution(void ataspectj.DeclareParentsImplementsTest$Implementation.intro())' in Type 'ataspectj.DeclareParentsImplementsTest$Implementation' (DeclareParentsImplementsTest.java:47) advised by before advice from 'ataspectj.DeclareParentsImplementsTest$TestAspect' (DeclareParentsImplementsTest.java)"/> + </stderr> + </ant> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="LTW Decp2"> + <!-- ajc compile them but with only one aspect --> + <compile + files="ataspectj/DeclareParentsImplementsReweavableTest.java,ataspectj/TestHelper.java" + options="-1.5" + /> + <!-- compile the other aspect alone (won't be applied) --> + <ant file="ajc-ant.xml" target="ltw.Decp2" verbose="true"/> + </ajc-test> + + + <ajc-test dir="java5/ataspectj" title="Compile time aspects declared to ltw weaver"> + <compile + files="ataspectj/ltwlog/MessageHolder.java,ataspectj/ltwreweavable/MainReweavableLogging.java,ataspectj/ltwreweavable/AspectReweavableLogging.java,ataspectj/ltwreweavable/Advisable.java,ataspectj/ltwreweavable/EmptyAtAspect.java" + options="-1.5" + outjar="main1.jar"/> + <ant file="ajc-ant.xml" target="Compile time aspects declared to ltw weaver" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="Concrete@Aspect"> + <compile + files="ataspectj/ConcreteAtAspectTest.java,ataspectj/TestHelper.java" + options="-1.5 -XterminateAfterCompilation" + /> + <run class="ataspectj.ConcreteAtAspectTest" ltw="ataspectj/aop-concreteataspect.xml"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="ConcreteAspect"> + <compile + files="ataspectj/ConcreteAspectTest.aj,ataspectj/TestHelper.java" + options="-1.5 -Xdev:NoAtAspectJProcessing -XterminateAfterCompilation" + /> + <run class="ataspectj.ConcreteAspectTest" ltw="ataspectj/aop-concreteaspect.xml"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="ConcretePrecedenceAspect"> + <compile + files="ataspectj/ConcretePrecedenceAspectTest.java,ataspectj/TestHelper.java" + options="-1.5 -Xdev:NoAtAspectJProcessing -XterminateAfterCompilation" + /> + <run class="ataspectj.ConcretePrecedenceAspectTest" ltw="ataspectj/aop-concreteprecedenceaspect.xml"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AspectOfWhenAspectNotInInclude"> + <compile + files="ataspectj/bugs/AspectOfWhenAspectNotInIncludeTest.java,ataspectj/TestHelper.java" + options="-1.5 -XterminateAfterCompilation"/> + <run class="ataspectj.bugs.AspectOfWhenAspectNotInIncludeTest" ltw="ataspectj/bugs/aop-aspectofwhenaspectnotinincludetest.xml"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AspectOfWhenAspectExcluded"> + <compile + files="ataspectj/bugs/AspectOfWhenAspectNotInIncludeTest.java,ataspectj/TestHelper.java" + options="-1.5 -XterminateAfterCompilation"/> + <run class="ataspectj.bugs.AspectOfWhenAspectNotInIncludeTest" ltw="ataspectj/bugs/aop-aspectofwhenaspectexcludedtest.xml"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AspectOfWhenNonAspectExcluded"> + <compile + files="ataspectj/bugs/NotAspect.java" + options="-1.5 -XterminateAfterCompilation"/> + <run class="ataspectj.bugs.NotAspect" ltw="ataspectj/bugs/aop-aspectofwhennonaspectexcludedtest.xml"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AppContainer"> + <compile + files="ataspectj/hierarchy/AppContainerTest.java,ataspectj/hierarchy/app/SubApp.java,ataspectj/TestHelper.java" + options="-1.5 -XterminateAfterCompilation" + /> + <ant file="ajc-ant.xml" target="ltw.AppContainer" verbose="true"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="CflowBelowStack"> + <compile + files="ataspectj/bugs/CflowBelowStackTest.java,ataspectj/TestHelper.java" + options="-1.5 -verbose "/> + <run class="ataspectj.bugs.CflowBelowStackTest" ltw="ataspectj/bugs/aop-cflowbelowstacktest.xml"/> + </ajc-test> + + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/misuse.xml b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/misuse.xml new file mode 100644 index 000000000..9aec9d7a4 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/misuse.xml @@ -0,0 +1,146 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.5.0 Tests --> + +<suite> + + <ajc-test dir="java5/ataspectj" + pr="" title="@Aspect class extending @Aspect class"> + <compile files="ataspectj/misuse/Test005.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj" + pr="" title="class with @Before extending @Aspect class"> + <compile files="ataspectj/misuse/Test006.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + <message kind="error" line="11" text="class 'Test006B' can not extend aspect"/> + </compile> + </ajc-test> + + <comment>a warning. We ignore the pointcut (TBD) - line is enclosing class (TBD Andy do better ?)</comment> + <ajc-test dir="java5/ataspectj" + pr="" title="@Pointcut not returning void"> + <compile files="ataspectj/misuse/Test008.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + <message kind="warning" line="9" text="Found @Pointcut on a method not returning 'void' or not 'public static boolean'"/> + </compile> + </ajc-test> + +<!-- <ajc-test dir="java5/ataspectj"--> +<!-- pr="" title="@Aspect on interface">--> +<!-- <compile files="ataspectj/misuse/Test010.java" options="-1.5 -Xdev:NoAtAspectJProcessing">--> +<!-- <message kind="warning" line="7" text="Found @Aspect on an interface type 'ataspectj.misuse.Test010'"/>--> +<!-- </compile>--> +<!-- </ajc-test>--> + + <comment>line is enclosing class - TBD</comment> + <ajc-test dir="java5/ataspectj" + pr="" title="@Pointcut with garbage string"> + <compile files="ataspectj/misuse/Test014.java" options="-1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore"> + <message kind="error" line="7" text="Invalid pointcut 'call%dddd"/> + <message kind="error" text="can't find referenced pointcut"/> + <message kind="error" text="can't find pointcut"/> + <message kind="error" text="@AfterThrowing: either 'value' or 'poincut' must be provided, not both"/> + <message kind="error" text="@AfterReturning: either 'value' or 'poincut' must be provided, not both"/> + <message kind="error" text="@DeclareWarning used on a non String constant field"/> + <message kind="error" text="@DeclareError used on a non String constant field"/> + </compile> + </ajc-test> + + <comment>line is enclosing class - TBD</comment> + <ajc-test dir="java5/ataspectj" + pr="" title="@Pointcut with throws clause"> + <compile files="ataspectj/misuse/Test016.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + <message kind="warning" line="7" text="Found @Pointcut on a method throwing exception"/> + </compile> + </ajc-test> + + <comment>very dirty hack - can't get this location to work properly so added match all error..</comment> + <comment>amc - with new checks for binding of returning this was giving a different message, so I + tweaked the test slightly by swapping the order of the args</comment> + <ajc-test dir="java5/ataspectj" + pr="" title="@AfterReturning with wrong number of args"> + <compile files="ataspectj/misuse/Test019.java" options="-1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore"> + <message kind="error" line="1" text="the parameter x is not bound"/> + <message kind="error" line="1" text="formal unbound in pointcut"/> + </compile> + </ajc-test> + + <comment>line number is enclosing type</comment> + <ajc-test dir="java5/ataspectj" + pr="" title="@Before on non-public method"> + <compile files="ataspectj/misuse/Test020.java" options="-1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore"> + <message kind="error" line="7" text="Found @AspectJ annotation on a non public advice 'someCall()V'"/> + </compile> + </ajc-test> + + <comment>line number is enclosing type</comment> + <ajc-test dir="java5/ataspectj" + pr="" title="@Before on method not returning void"> + <compile files="ataspectj/misuse/Test021.java" options="-1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore"> + <message kind="error" line="7" text="Found @AspectJ annotation on a non around advice not returning void 'someCall()I'"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj" + pr="" title="@Before with PJP"> + <compile files="ataspectj/misuse/Test100.java" options="-1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore"> + <message kind="error" text="use of ProceedingJoinPoint is allowed only on around advice"/> + </compile> + </ajc-test> + + <!-- +ALEX: todo + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut with wrong number of args"> + <compile files="ataspectj/misuse/Test022.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + <message kind="error" line="8" text="int x is not declared in the pointcut parameters"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Around given an extension of ProceedingJoinPoint"> + <compile files="ataspectj/misuse/Test031.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + <message kind="error" line="9" text="Is this an error?"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="calling @Before advice explicitly as a method"> + <compile files="ataspectj/misuse/Test032.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + <message kind="error" line="14" text="Advice should never be called explicitly"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before on Interface method"> + <compile files="ataspectj/misuse/Test033.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + <message kind="error" line="4" text="The annotation @Before is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before and @After on one method"> + <compile files="ataspectj/misuse/Test035.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + <message kind="error" line="7" text="A method may only be declared as advice once"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before advice with empty string"> + <compile files="ataspectj/misuse/Test037.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Pointcut with an empty string"> + <compile files="ataspectj/misuse/Test039.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj/coverage" + pr="" title="@Before with AND in string"> + <compile files="ataspectj/misuse/Test040.java" options="-1.5 -Xdev:NoAtAspectJProcessing"> + </compile> + </ajc-test> +--> +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/syntax.xml b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/syntax.xml new file mode 100644 index 000000000..69055af39 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/syntax.xml @@ -0,0 +1,202 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> +<suite> + + <ajc-test dir="java5/ataspectj" title="SimpleBefore"> + <compile files="SimpleBefore.java" options="-1.5 -showWeaveInfo -XnoInline"> + <message kind="weave" text="(SimpleBefore.java:23) advised by before advice from 'SimpleBefore$X' (SimpleBefore.java:33)"/> + </compile> + <run class="SimpleBefore"/> + <compile files="SimpleBefore.java" options="-1.5 -showWeaveInfo -XnoInline -Xdev:NoAtAspectJProcessing"> + <message kind="weave" text="(SimpleBefore.java:23) advised by before advice from 'SimpleBefore$X' (SimpleBefore.java:33)"/> + </compile> + <run class="SimpleBefore"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="SimpleAfter"> + <compile files="SimpleAfter.java" options="-1.5 -showWeaveInfo -XnoInline"> + <message kind="weave" text="(SimpleAfter.java:13) advised by after advice from 'SimpleAfter$X'"/> + </compile> + <run class="SimpleAfter"/> + <compile files="SimpleAfter.java" options="-1.5 -showWeaveInfo -XnoInline -Xdev:NoAtAspectJProcessing"> + <message kind="weave" text="(SimpleAfter.java:13) advised by after advice from 'SimpleAfter$X'"/> + </compile> + <run class="SimpleAfter"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="singletonAspectBindings"> + <compile files="ataspectj/SingletonAspectBindingsTest.java,ataspectj/TestHelper.java" options="-1.5 -emacssym -XnoInline"/> + <run class="ataspectj.SingletonAspectBindingsTest"/> + <compile files="ataspectj/SingletonAspectBindingsTest.java,ataspectj/TestHelper.java" options="-1.5 -emacssym -XnoInline -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.SingletonAspectBindingsTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="singletonAspectBindings2"> + <compile files="ataspectj/SingletonAspectBindingsTest2.aj,ataspectj/TestHelper.java" options="-1.5 -emacssym -XnoInline"/> + <run class="ataspectj.SingletonAspectBindingsTest2"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="CflowTest"> + <compile files="ataspectj/CflowTest.java,ataspectj/TestHelper.java" options="-1.5"/> + <run class="ataspectj.CflowTest"/> + <compile files="ataspectj/CflowTest.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.CflowTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="PointcutReferenceTest"> + <compile files="ataspectj/PointcutReferenceTest.java,ataspectj/TestHelper.java" options="-1.5"/> + <run class="ataspectj.PointcutReferenceTest"/> + <compile files="ataspectj/PointcutReferenceTest.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.PointcutReferenceTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="XXJoinPointTest"> + <compile files="ataspectj/XXJoinPointTest.java,ataspectj/TestHelper.java" options="-1.5"/> + <run class="ataspectj.XXJoinPointTest"/> + <compile files="ataspectj/XXJoinPointTest.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.XXJoinPointTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="PrecedenceTest"> + <compile files="ataspectj/PrecedenceTest.java,ataspectj/TestHelper.java" options="-1.5"/> + <run class="ataspectj.PrecedenceTest"/> + <compile files="ataspectj/PrecedenceTest.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.PrecedenceTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AfterXTest"> + <compile files="ataspectj/AfterXTest.java,ataspectj/TestHelper.java" options="-1.5"/> + <run class="ataspectj.AfterXTest"/> + <compile files="ataspectj/AfterXTest.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.AfterXTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="IfPointcutTest"> + <compile files="ataspectj/IfPointcutTest.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.IfPointcutTest"/> + <compile files="ataspectj/IfPointcutTest.java,ataspectj/TestHelper.java" options="-1.5"/> + <run class="ataspectj.IfPointcutTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="IfPointcut2Test"> + <compile files="ataspectj/IfPointcut2Test.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.IfPointcut2Test"/> + <compile files="ataspectj/IfPointcut2Test.java,ataspectj/TestHelper.java" options="-1.5"/> + <run class="ataspectj.IfPointcut2Test"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="BindingTest"> + <compile files="ataspectj/BindingTest.java,ataspectj/TestHelper.java" options="-1.5"/> + <run class="ataspectj.BindingTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="BindingTest no inline"> + <compile files="ataspectj/BindingTest.java,ataspectj/TestHelper.java" options="-1.5 -XnoInline"/> + <run class="ataspectj.BindingTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="PerClause"> + <compile files="ataspectj/PerClauseTest.java,ataspectj/PerClauseTestAspects.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.PerClauseTest"/> + <compile files="ataspectj/PerClauseTest.java,ataspectj/PerClauseTestAspects.java,ataspectj/TestHelper.java" options="-1.5"/> + <run class="ataspectj.PerClauseTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AroundInlineMunger -XnoInline"> + <compile files="ataspectj/AroundInlineMungerTest.java,ataspectj/AroundInlineMungerTestAspects.java,ataspectj/TestHelper.java" options="-1.5 -XnoInline -Xdev:NoAtAspectJProcessing -Xlint:ignore"/> + <run class="ataspectj.AroundInlineMungerTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AroundInlineMunger"> + <compile files="ataspectj/AroundInlineMungerTest.java,ataspectj/AroundInlineMungerTestAspects.java" options="-1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore"/> + <run class="ataspectj.AroundInlineMungerTest"> + <stdout> + <line text="AroundInlineMungerTestAspects.Open.aroundCount=3"/> + <line text="AroundInlineMungerTestAspects.Open.beforeCount=6"/> + </stdout> + </run> + <!-- + <compile files="ataspectj/AroundInlineMungerTest.java,ataspectj/AroundInlineMungerTestAspects.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore"/> + <run class="ataspectj.AroundInlineMungerTest"/> + --> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AroundInlineMunger2"> + <compile files="ataspectj/AroundInlineMungerTest2.aj,ataspectj/AroundInlineMungerTestAspects2.aj" options="-1.5 -Xlint:ignore"/> + <run class="ataspectj.AroundInlineMungerTest2"> + <stdout> + <line text="AroundInlineMungerTestAspects2.Open.aroundCount=3"/> + <line text="AroundInlineMungerTestAspects2.Open.beforeCount=6"/> + </stdout> + </run> + <!-- + <compile files="ataspectj/AroundInlineMungerTest2.aj,ataspectj/AroundInlineMungerTestAspects2.aj,ataspectj/TestHelper.java" options="-1.5 -Xlint:ignore"/> + <run class="ataspectj.AroundInlineMungerTest2"/> + --> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="Deow"> + <compile files="ataspectj/DeowTest.java" options="-1.5"> + <message kind="warning" line="28" text="call hello"/> + <message kind="error" line="29" text="call hi"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="singletonInheritance"> + <compile files="ataspectj/SingletonInheritanceTest.java,ataspectj/TestHelper.java" options="-1.5 -XnoInline"/> + <run class="ataspectj.SingletonInheritanceTest"/> + <compile files="ataspectj/SingletonInheritanceTest.java,ataspectj/TestHelper.java" options="-1.5 -XnoInline -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.SingletonInheritanceTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="perClauseInheritance"> + <compile files="ataspectj/PerClauseInheritanceTest.java,ataspectj/TestHelper.java" options="-1.5 -XnoInline"/> + <run class="ataspectj.PerClauseInheritanceTest"/> + <compile files="ataspectj/PerClauseInheritanceTest.java,ataspectj/TestHelper.java" options="-1.5 -XnoInline -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.PerClauseInheritanceTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="MultipleBinding"> + <compile files="ataspectj/MultipleBindingTest.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing -XnoInline"/> + <run class="ataspectj.MultipleBindingTest"/> + <compile files="ataspectj/MultipleBindingTest.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing"/> + <run class="ataspectj.MultipleBindingTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="Bug104212"> + <compile files="ataspectj/Bug104212.java,ataspectj/TestHelper.java" options="-1.5"/> + <run class="ataspectj.Bug104212"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="DeclareParentsInterface"> + <compile files="ataspectj/DeclareParentsInterfaceTest.java,ataspectj/TestHelper.java" options="-showWeaveInfo -1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore"> + <message kind="weave" text="Extending interface set for type 'ataspectj.DeclareParentsInterfaceTest$Target' (DeclareParentsInterfaceTest.java) to include 'ataspectj.DeclareParentsInterfaceTest$Marker' (DeclareParentsInterfaceTest.java)"/> + <message kind="weave" text="Join point "/> + </compile> + <run class="ataspectj.DeclareParentsInterfaceTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="DeclareParentsImplements"> + <compile files="ataspectj/DeclareParentsImplementsTest.java,ataspectj/TestHelper.java" options="-showWeaveInfo -1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore"> + <message kind="weave" text="Join point "/> + <message kind="weave" text="Extending interface set for type 'ataspectj.DeclareParentsImplementsTest$Target' (DeclareParentsImplementsTest.java) to include 'ataspectj.DeclareParentsImplementsTest$Introduced' (DeclareParentsImplementsTest.java)"/> + <message kind="weave" text="Type 'ataspectj.DeclareParentsImplementsTest$Target' (DeclareParentsImplementsTest.java) has intertyped method from 'ataspectj.DeclareParentsImplementsTest$TestAspect' (DeclareParentsImplementsTest.java:'void ataspectj.DeclareParentsImplementsTest$Introduced.intro()')"/> + </compile> + <run class="ataspectj.DeclareParentsImplementsTest"/> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="AbstractAspectNPE"> + <compile files="ataspectj/bugs/AbstractAspectNPEParent.java,ataspectj/bugs/AbstractAspectNPEChild.java" + options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void ataspectj.bugs.AbstractAspectNPEParent.main"/> + </compile> + </ajc-test> + + + <ajc-test dir="java5/ataspectj" title="AbstractInherited"> + <compile files="ataspectj/bugs/AbstractInherited.java" + options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point "/> + </compile> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/LTWServerTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/LTWServerTests.java new file mode 100644 index 000000000..d73e594b9 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/LTWServerTests.java @@ -0,0 +1,27 @@ +package org.aspectj.systemtest.ajc150.ltw; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class LTWServerTests extends XMLBasedAjcTestCase { + + public static Test suite() { + return loadSuite(LTWServerTests.class); + } + + protected File getSpecFile() { + return getClassResource("ltw.xml"); + } + + public void testServerWithHelloWorld () { + runTest("TestServer with HelloWorld"); + } + + public void testServerWithParentAndChild () { + runTest("TestServer with Parent and Child"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/LTWTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/LTWTests.java new file mode 100644 index 000000000..ff9e59339 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/LTWTests.java @@ -0,0 +1,213 @@ +/******************************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Matthew Webster initial implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc150.ltw; + +import java.io.File; +import java.util.Enumeration; +import java.util.Properties; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.weaver.tools.WeavingAdaptor; + +public class LTWTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(LTWTests.class); + } + + protected File getSpecFile() { + return new File("../tests/src/org/aspectj/systemtest/ajc150/ltw/ltw.xml"); + } + + public void testInclusionAndPattern() { + runTest("Inclusion and patterns"); + } + + public void testExclusionAndPattern() { + runTest("Exclusion and patterns"); + } + + public void testAndPatternsAspects() { + runTest("And patterns aspects"); + } + + public void test001(){ + runTest("Ensure 1st aspect is rewoven when weaving 2nd aspect"); + } + + public void testOutxmlFile (){ + runTest("Ensure valid aop.xml file is generated"); + } + public void testOutxmlJar (){ + runTest("Ensure valid aop.xml is generated for -outjar"); + } + + public void testNoAopxml(){ + setSystemProperty(WeavingAdaptor.WEAVING_ADAPTOR_VERBOSE,"true"); + runTest("Ensure no weaving without visible aop.xml"); + } + + public void testDefineConcreteAspect(){ + runTest("Define concrete sub-aspect using aop.xml"); + } + + public void testDeclareAbstractAspect(){ +// setSystemProperty(WeavingAdaptor.WEAVING_ADAPTOR_VERBOSE,"true"); +// setSystemProperty(WeavingAdaptor.SHOW_WEAVE_INFO_PROPERTY,"true"); + runTest("Use abstract aspect for ITD using aop.xml"); + } + + public void testAspectsInclude () { + runTest("Ensure a subset of inherited aspects is used for weaving"); + } + + public void testAspectsIncludeWithLintWarning () { + runTest("Ensure weaver lint warning issued when an aspect is not used for weaving"); + } + + public void testXsetEnabled () { + runTest("Set Xset properties enabled"); + } + public void testXsetDisabled () { + runTest("Set Xset properties disabled"); + } + + public void testXlintfileEmpty () { + runTest("Empty Xlint.properties file"); + } + + public void testXlintfileMissing () { + runTest("Warning with missing Xlint.properties file"); + } + + public void testXlintWarningAdviceDidNotMatchSuppressed () { + runTest("Warning when advice doesn't match suppressed for LTW"); + } + + public void testXlintfile () { + runTest("Override suppressing of warning when advice doesn't match using -Xlintfile"); + } + + public void testXlintDefault () { + runTest("Warning when advice doesn't match using -Xlint:default"); + } + + public void testXlintWarning () { + runTest("Override suppressing of warning when advice doesn't match using -Xlint:warning"); + } + + public void testNonstandardJarFiles() { + runTest("Nonstandard jar file extensions"); + } + + public void testOddzipOnClasspath() { + runTest("Odd zip on classpath"); + } + + public void testJ14LTWWithXML() { + runTest("JDK14 LTW with XML"); + } + +// public void testJ14LTWWithASPECTPATH() { +// runTest("JDK14 LTW with ASPECTPATH"); +// } + + + //public void testDiscardingWovenTypes() { + // runTest("discarding woven types - 1"); + //} + + public void testWeavingTargetOfCallAggressivelyInLTW_DeclareParents_pr133770() { + runTest("aggressive ltw - decp"); + } + + public void testWeavingTargetOfCallAggressivelyInLTW_DeclareParents_pr133770_Deactivate() { + runTest("aggressive ltw - decp - deactivate"); + } + + public void testWeavingTargetOfCallAggressivelyInLTW_DeclareParents_Nested_pr133770() { + runTest("aggressive ltw - decp - 2"); + } + + public void testWeavingTargetOfCallAggressivelyInLTW_DeclareParents_Hierarchy_pr133770() { + runTest("aggressive ltw - hierarchy"); + } + + public void testSeparateCompilationDeclareParentsCall_pr133770() { + runTest("separate compilation with ltw: declare parents and call"); + } + + public void testConfigurationSystemProperty_pr149289() { + runTest("override default path using -Dorg.aspectj.weaver.loadtime.configuration"); + } + + public void testSimpleLTW_pr159854 () { + runTest("simple LTW"); + } + + public void testDumpOnError_pr155033 () { + runTest("dump on error"); + + File dir = getSandboxDirectory(); + CountingFilenameFilter cff = new CountingFilenameFilter(".txt"); + dir.listFiles(cff); + assertEquals("Missing ajcore file in " + dir.getAbsolutePath(),1,cff.getCount()); + } + + public void testMultipleDumpOnError_pr155033 () { + runTest("multiple dump on error"); + + File dir = getSandboxDirectory(); + CountingFilenameFilter cff = new CountingFilenameFilter(".txt"); + dir.listFiles(cff); + assertEquals("Missing ajcore file in " + dir.getAbsolutePath(),2,cff.getCount()); + } + + /* + * Allow system properties to be set and restored + * TODO maw move to XMLBasedAjcTestCase or RunSpec + */ + private final static String NULL = "null"; + + private Properties savedProperties; + + protected void setSystemProperty (String key, String value) { + Properties systemProperties = System.getProperties(); + copyProperty(key,systemProperties,savedProperties); + systemProperties.setProperty(key,value); + } + + private static void copyProperty (String key, Properties from, Properties to) { + String value = from.getProperty(key,NULL); + to.setProperty(key,value); + } + + protected void setUp() throws Exception { + super.setUp(); + savedProperties = new Properties(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + + /* Restore system properties */ + Properties systemProperties = System.getProperties(); + for (Enumeration enu = savedProperties.keys(); enu.hasMoreElements(); ) { + String key = (String)enu.nextElement(); + String value = savedProperties.getProperty(key); + if (value == NULL) systemProperties.remove(key); + else systemProperties.setProperty(key,value); + } + } +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml b/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml new file mode 100644 index 000000000..0dcdbf142 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml @@ -0,0 +1,670 @@ + +<!-- Load-time weaving tests --> +<ajc-test dir="ltw" + title="Ensure 1st aspect is rewoven when weaving 2nd aspect" + keywords="reweavable"> + <compile files="Main.java, Aspect1.aj" outjar="main1.jar" + options="-showWeaveInfo -verbose -1.4"> + <message kind="weave" + text="method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)" /> + </compile> + <compile classpath="main1.jar" files="Aspect2.aj" + outjar="aspect2.jar" options="-showWeaveInfo -verbose -1.4"> + </compile> + <run class="Main" ltw="aop-ltwreweavable.xml"> + <stdout> + <line text="Main.main" /> + <line text="Main.test1" /> + <line text="Main.test2" /> + </stdout> + <stderr> + <line + text="weaveinfo Join point 'method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)" /> + <line + text="weaveinfo Join point 'method-execution(void Main.test2())' in Type 'Main' (Main.java:21) advised by before advice from 'Aspect2' (Aspect2.aj:16)" /> + <line text="Aspect1.before_test1" /> + <line text="Aspect2.before_test2" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Ensure valid aop.xml file is generated" keywords="-outxml"> + <compile files="Main.java" outjar="main.jar"> + </compile> + <compile classpath="main.jar" + files="Aspect1.aj, Aspect2.aj, pakkage/Aspect3.aj" + outxmlfile="META-INF/aop.xml" options="-1.4"> + </compile> + <run class="Main" ltw=""> + <stdout> + <line text="Main.main" /> + <line text="Main.test1" /> + <line text="Main.test2" /> + </stdout> + <stderr> + <line text="Aspect1.before_test1" /> + <line text="Aspect2.before_test2" /> + <line text="pakkage.Aspect3.before_test2" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Ensure valid aop.xml is generated for -outjar" + keywords="-outxml"> + <compile files="Main.java" outjar="main.jar"> + </compile> + <compile classpath="main.jar" + files="Aspect1.aj, Aspect2.aj, pakkage/Aspect3.aj" + outjar="aspects.jar" options="-1.4 -outxml"> + </compile> + <run class="Main" ltw=""> + <stdout> + <line text="Main.main" /> + <line text="Main.test1" /> + <line text="Main.test2" /> + </stdout> + <stderr> + <line text="Aspect1.before_test1" /> + <line text="Aspect2.before_test2" /> + <line text="pakkage.Aspect3.before_test2" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Ensure no weaving without visible aop.xml" keywords="reweavable"> + <compile files="TestMain.java, Main.java"> + </compile> + <run class="TestMain" ltw=""> + <stdout> + <line text="Main.main" /> + <line text="Main.test1" /> + <line text="Main.test2" /> + </stdout> + <stderr> + <line text="info AspectJ Weaver Version" /> + <line + text="info register classloader org.aspectj.weaver.loadtime.WeavingURLClassLoader" /> + <line + text="info no configuration found. Disabling weaver for class loader org.aspectj.weaver.loadtime.WeavingURLClassLoader" /> + </stderr> + </run> +</ajc-test> + +<!-- type discarding tests, investigating call munging --> + +<ajc-test dir="ltw/callMunging" + title="discarding woven types - 1"> + <compile files="A.java,B.java,T.java,Main.java" + outjar="classes.jar" /> + <compile files="X.java" outjar="aspects.jar" + classpath="classes.jar" options="-Xlint:ignore" /> + <run class="Main" ltw="aop.xml"> + <stdout> + <line text="into:main" /> + <line text="A.method() running" /> + <line text="advice running" /> + <line text="T.m1() running" /> + <line text="B.method() running" /> + <line text="advice running" /> + <line text="T.m2() running" /> + <line text="leave:main" /> + </stdout> + </run> +</ajc-test> + +<ajc-test dir="ltw/callMunging/case1" + title="aggressive ltw - decp"> + <compile files="A.java,T.java,Main.java" outjar="classes.jar" /> + <compile files="X.java" outjar="aspects.jar" + classpath="classes.jar" options="-Xlint:ignore" /> + <run class="Main" ltw="aop.xml"> + <stdout> + <line text="into:main" /> + <line text="A.method() running" /> + <line text="advice running" /> + <line text="T.m1() running" /> + <line text="leave:main" /> + </stdout> + </run> +</ajc-test> + +<ajc-test dir="ltw/callMunging/case1" + title="aggressive ltw - decp - deactivate"> + <compile files="A.java,T.java,Main.java" outjar="classes.jar" /> + <compile files="X.java" outjar="aspects.jar" + classpath="classes.jar" options="-Xlint:ignore" /> + <run class="Main" ltw="aop2.xml"> + <stdout> + <line text="into:main" /> + <line text="A.method() running" /> + <line text="T.m1() running" /> + <line text="leave:main" /> + </stdout> + </run> +</ajc-test> + +<ajc-test dir="ltw/callMunging/case1" + title="aggressive ltw - hierarchy"> + <compile files="T.java,HierMain.java" outjar="classes.jar" /> + <compile files="A.java" outjar="sub.hiddenjar" + classpath="classes.jar" /> + <compile files="X.java" outjar="aspects.jar" + classpath="classes.jar" options="-Xlint:ignore" /> + <run class="HierMain" ltw="aop.xml"> + <stdout> + <line text="into:main" /> + <line text="A.method() running" /> + <line text="advice running" /> + <line text="T.m1() running" /> + <line text="leave:main" /> + </stdout> + </run> +</ajc-test> + +<ajc-test dir="ltw/callMunging/case3" + title="aggressive ltw - decp - 2"> + <compile files="A.java,T.java,S.java,Main.java" + outjar="classes.jar" /> + <compile files="X.java" outjar="aspects.jar" + classpath="classes.jar" options="-Xlint:ignore" /> + <run class="Main" ltw="aop.xml"> + <stdout> + <line text="into:main" /> + <line text="A.method() running" /> + <line text="advice running" /> + <line text="T.m1() running" /> + <line text="leave:main" /> + </stdout> + </run> +</ajc-test> + +<ajc-test dir="ltw/callMunging/case2" + title="aggressive ltw - deca"> + <compile files="A.java,T.java,Main.java,MarkerAnnotation.java" + outjar="classes.jar" options="-1.5" /> + <compile files="X.java" outjar="aspects.jar" + classpath="classes.jar" options="-1.5 -Xlint:ignore" /> + <run class="Main" ltw="aop.xml"> + <stdout> + <line text="into:main" /> + <line text="A.method() running" /> + <line text="advice running" /> + <line text="T.m1() running" /> + <line text="leave:main" /> + </stdout> + </run> +</ajc-test> + + + +<!-- end of discarding type tests --> + +<ajc-test dir="ltw" + title="Define concrete sub-aspect using aop.xml" keywords="aop.xml"> + <compile files="Main.java" outjar="main.jar"> + </compile> + <!-- was in next section classpath="main1.jar" --> + <compile files="AbstractSuperAspect.aj" outjar="aspect.jar" + options="-1.4"> + </compile> + <run class="Main" ltw="aop-defineaspect.xml"> + <stdout> + <line text="Main.main" /> + <line text="Main.test1" /> + <line text="Main.test2" /> + </stdout> + <stderr> + <line text="info AspectJ Weaver Version" /> + <line text="info register classloader" /> + <line text="info using" /> + <line text="info define aspect ConcreteAspect" /> + <line text="debug weaving 'ConcreteAspect'" /> + <line text="debug generating class 'ConcreteAspect'" /> + <line text="debug weaving 'Main'" /> + <line text="AbstractSuperAspect.before_test1" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Use abstract aspect for ITD using aop.xml" + keywords="abstract aspect, ITD"> + <compile files="TestITDMethod.java"> + </compile> + <compile files="AbstractAspect.aj" options="-1.4"> + <message kind="warning" + text="this affected type is not exposed to the weaver: TestITDMethod" /> + </compile> + <run class="TestITDMethod" options="test" + ltw="aop-abstractaspect.xml"> + <stdout> + <line text="TestITDMethod.main" /> + </stdout> + <stderr> + <line + text="weaveinfo Type 'TestITDMethod' (TestITDMethod.java) has intertyped method from 'AbstractAspect' (AbstractAspect.aj:'void TestITDMethod.test()')" /> + <line text="AbstractAspect_TestITDMethod.test" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Ensure a subset of inherited aspects is used for weaving" + keywords="aspects, include"> + <compile files="Main.java" outjar="main.jar"> + </compile> + <compile classpath="main.jar" + files="Aspect1.aj, Aspect2.aj, pakkage/Aspect3.aj" + outjar="aspects.jar" options="-outxml -1.4"> + </compile> + <run class="Main" ltw="aop-aspectsinclude.xml"> + <stdout> + <line text="Main.main" /> + <line text="Main.test1" /> + <line text="Main.test2" /> + </stdout> + <stderr> + <line text="pakkage.Aspect3.before_test2" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Ensure weaver lint warning issued when an aspect is not used for weaving" + keywords="aspects, include, lint"> + <compile files="Main.java" outjar="main.jar"> + </compile> + <compile classpath="main.jar" + files="Aspect1.aj, Aspect2.aj, pakkage/Aspect3.aj" + outjar="aspects.jar" options="-outxml -1.4"> + </compile> + <run class="Main" ltw="aop-aspectsincludewithlintwarning.xml"> + <stdout> + <line text="Main.main" /> + <line text="Main.test1" /> + <line text="Main.test2" /> + </stdout> + <stderr ordered="no"> + <line + text="warning aspect Aspect1 exluded for class loader org.aspectj.weaver.loadtime.WeavingURLClassLoader [Xlint:aspectExcludedByConfiguration]" /> + <line + text="warning aspect Aspect2 exluded for class loader org.aspectj.weaver.loadtime.WeavingURLClassLoader [Xlint:aspectExcludedByConfiguration]" /> + <line text="pakkage.Aspect3.before_test2" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" title="Empty Xlint.properties file" + keywords="xlint, ltw"> + <compile files="Main.java"> + </compile> + <run class="Main" ltw="aop-xlintfile.xml" + xlintfile="Xlint-empty.properties"> + <stderr> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" title="Set Xset properties enabled" + keywords="xSet, ltw"> + <compile files="Main.java,Aspect1.aj"> + </compile> + <run class="Main" ltw="aop-xset-verbose.xml" + xlintfile="Xlint-empty.properties"> + </run> +</ajc-test> + +<ajc-test dir="ltw" title="Set Xset properties disabled" + keywords="xSet, ltw"> + <compile files="Main.java,Aspect1.aj"> + </compile> + <run class="Main" ltw="aop-xset-verbose.xml" + xlintfile="Xlint-empty.properties"> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Warning with missing Xlint.properties file" + keywords="xlint, ltw"> + <compile files="Main.java"> + </compile> + <run class="Main" ltw="aop-xlintfile.xml"> + <stderr> + <line + text="warning Cannot access resource for -Xlintfile:Xlint-empty.properties" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw/hier" + title="separate compilation with ltw: declare parents and call" + keywords="ltw"> + <compile files="util/A.aj,util/T.aj" /> + <compile + files="child/Executor.aj,child/Advisor.aj,top/SimpleMain.aj" + options="-1.4"> + <message kind="warning" + text="this affected type is not exposed to the weaver: util.A" /> + </compile> + <run class="top.SimpleMain" ltw="aop-single.xml"> + <stdout> + <line text="T call" /> + </stdout> + <stderr> + <line + text="weaveinfo Join point 'method-call(void util.A.foo())' in Type 'child.Executor' (Executor.aj:18) advised by before advice from 'child.Advisor' (Advisor.aj:20)" /> + <line + text="weaveinfo Extending interface set for type 'util.A' (A.aj) to include 'util.T' (Advisor.aj)" /> + <line + text="weaveinfo Extending interface set for type 'child.Advisor' (Advisor.aj) to include 'util.T' (Advisor.aj)" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Warning when advice doesn't match suppressed for LTW" + keywords="xlint, ltw"> + <compile files="Main.java"> + </compile> + <compile files="Aspect3.aj" options="-1.4"> + </compile> + <run class="Main" ltw="aop-nomatch.xml"> + <stderr> + <line text="info AspectJ Weaver Version" /> + <line text="info register classloader" /> + <line text="info using" /> + <line text="info register aspect Aspect3" /> + <line text="debug weaving 'Main'" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Override suppressing of warning when advice doesn't match using -Xlintfile" + keywords="xlint, ltw"> + <compile files="Main.java"> + </compile> + <compile files="Aspect3.aj" options="-1.4"> + </compile> + <run class="Main" ltw="aop-nomatchxlintfile.xml" + xlintfile="Xlint-nomatch.properties"> + <stderr> + <line text="info AspectJ Weaver Version" /> + <line text="info register classloader" /> + <line text="info using" /> + <line text="info register aspect Aspect3" /> + <line text="can not build thisJoinPoint lazily for this advice" /> + <line text="debug weaving 'Main'" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Warning when advice doesn't match using -Xlint:default" + keywords="xlint, ltw"> + <compile files="Main.java"> + </compile> + <compile files="Aspect3.aj" options="-1.4"> + </compile> + <run class="Main" ltw="aop-nomatchxlint.xml"> + <stderr> + <line text="info AspectJ Weaver Version" /> + <line text="info register classloader" /> + <line text="info using" /> + <line text="info register aspect Aspect3" /> + <line text="can not build thisJoinPoint lazily for this advice" /> + <line text="debug weaving 'Main'" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" + title="Override suppressing of warning when advice doesn't match using -Xlint:warning" + keywords="xlint, ltw"> + <compile files="Main.java"> + </compile> + <compile files="Aspect3.aj" options="-1.4"> + </compile> + <run class="Main" ltw="aop-nomatchxlint.xml"> + <stderr> + <line text="info AspectJ Weaver Version" /> + <line text="info register classloader" /> + <line text="info using" /> + <line text="info register aspect Aspect3" /> + <line text="can not build thisJoinPoint lazily for this advice" /> + <line text="debug weaving 'Main'" /> + </stderr> + </run> +</ajc-test> + +<!-- based on "Ensure 1st aspect is rewoven when weaving 2nd aspect" --> +<ajc-test dir="ltw" title="Nonstandard jar file extensions" + pr="137235"> + <compile files="folder.jar/Main.java, folder.jar/Aspect1.aj" + outjar="folder.jar/main1.zip" options="-showWeaveInfo -1.4"> + <message kind="weave" + text="method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)" /> + </compile> + <compile classpath="$sandbox/folder.jar/main1.zip" + files="Aspect2.aj" outjar="aspect2Jar" options="-showWeaveInfo -1.4"> + </compile> + <run class="Main" ltw="aop-ltwreweavable.xml" + classpath="$sandbox/folder.jar/main1.zip,$sandbox/aspect2Jar"> + <stdout> + <line text="Main.main" /> + <line text="Main.test1" /> + <line text="Main.test2" /> + </stdout> + <stderr> + <line + text="weaveinfo Join point 'method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)" /> + <line + text="weaveinfo Join point 'method-execution(void Main.test2())' in Type 'Main' (Main.java:21) advised by before advice from 'Aspect2' (Aspect2.aj:16)" /> + <line text="Aspect1.before_test1" /> + <line text="Aspect2.before_test2" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" title="Odd zip on classpath" pr="137235"> + <compile files="folder.jar/Main.java, folder.jar/Aspect1.aj" + outjar="folder.jar/main1.archive" options="-showWeaveInfo"> + <message kind="weave" + text="method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)" /> + </compile> + <compile classpath="$sandbox/folder.jar/main1.archive" + files="Aspect2.aj" outjar="aspect2Jar" options="-showWeaveInfo -1.4"> + </compile> + <run class="Main" ltw="aop-ltwreweavable.xml" + classpath="$sandbox/folder.jar/main1.archive,$sandbox/aspect2Jar"> + <stdout> + <line text="Main.main" /> + <line text="Main.test1" /> + <line text="Main.test2" /> + </stdout> + <stderr> + <line + text="weaveinfo Join point 'method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)" /> + <line + text="weaveinfo Join point 'method-execution(void Main.test2())' in Type 'Main' (Main.java:21) advised by before advice from 'Aspect2' (Aspect2.aj:16)" /> + <line text="Aspect1.before_test1" /> + <line text="Aspect2.before_test2" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" title="JDK14 LTW with XML" keywords="ltw"> + <compile files="HelloWorldWithException.java" + options="-outjar hello.jar" /> + <compile files="ExceptionHandler.aj" + options="-outxml -outjar handler.jar -1.4" /> + <ant file="ant.xml" target="JDK14 LTW with XML" verbose="true"> + <stdout> + <line text="Hello World!" /> + </stdout> + <stderr> + <line text="TraceFactory.instance=" /> + </stderr> + </ant> +</ajc-test> + +<ajc-test dir="ltw" title="JDK14 LTW with ASPECTPATH" + keywords="ltw"> + <compile files="HelloWorldWithException.java" + options="-outjar hello.jar" /> + <compile files="ExceptionHandler.aj" + options="-outjar handler.jar" /> + <ant file="ant.xml" target="JDK14 LTW with ASPECTPATH" + verbose="true"> + <stdout> + <line text="Hello World!" /> + </stdout> + <stderr> + <line text="TraceFactory.instance=" /> + </stderr> + </ant> +</ajc-test> + +<ajc-test dir="ltw" title="TestServer with HelloWorld" + keywords="ltw,server"> + <compile files="HelloWorldWithException.java" + options="-outjar hello.jar" /> + <compile files="ExceptionHandler.aj" + options="-outxml -outjar handler.jar -1.4" /> + <ant file="ant-server.xml" target="TestServer with HelloWorld" + verbose="true"> + <stdout> + <line text="Starting ..." /> + <line text="Running HelloWorld" /> + <line text="Hello World!" /> + <line text="Stopping ..." /> + </stdout> + </ant> +</ajc-test> +<!-- <ajc-test dir="ltw" title="TestServer with Parent and Child" keywords="ltw,server"> + <compile files="Parent.java" options="-outjar parent.jar"/> <compile files="Child.java" + options="-classpath parent.jar -outjar child.jar"/> <ant file="ant-server.xml" + target="TestServer with Parent and Child" verbose="true"> <stdout> <line + text="Starting ..."/> <line text="Running Child"/> <line text="Parent"/> + <line text="Child"/> <line text="Stopping ..."/> </stdout> </ant> </ajc-test> --> +<ajc-test dir="ltw" title="TestServer with Parent and Child" + keywords="ltw,server"> + <compile files="HelloWorldWithException.java" + options="-outjar child.jar" /> + <compile files="ExceptionHandler.aj" + options="-outxml -outjar parent.jar -1.4" /> + <ant file="ant-server.xml" + target="TestServer with Parent and Child" verbose="true"> + <stdout> + <line text="Starting ..." /> + <line text="Running HelloWorld" /> + <line text="Hello World!" /> + <line text="Stopping ..." /> + </stdout> + </ant> +</ajc-test> + +<ajc-test dir="ltw" + title="override default path using -Dorg.aspectj.weaver.loadtime.configuration" + keywords="ltw"> + <compile files="HelloWorldWithException.java" + options="-outjar hello.jar" /> + <compile files="ExceptionHandler.aj" + options="-outxml -outjar handler.jar -1.4" /> + <compile files="Tracing.aj" + options="-outxml -outjar tracing.jar -1.4" /> + <ant file="ant.xml" + target="override default path using -Dorg.aspectj.weaver.loadtime.configuration" + verbose="true"> + <stdout> + <line text="Hello World!" /> + </stdout> + </ant> +</ajc-test> + +<ajc-test dir="ltw/inclExcl" title="Inclusion and patterns" + keywords="ltw"> + <compile files="pkg/sub/Foo.aj, pkg/Main.aj" + options="-outjar base.jar" /> + <compile files="tracing/Tracer.aj" options="-1.4" /> + <run class="pkg.Main" ltw="aop-include.xml"> + <stderr> + <line text="execution(void pkg.Main.foo())" /> + <line text="Main.class" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw/inclExcl" title="Exclusion and patterns" + keywords="ltw"> + <compile files="pkg/sub/Foo.aj, pkg/Main.aj" + options="-outjar base.jar" /> + <compile files="tracing/Tracer.aj" options="-1.4" /> + <run class="pkg.Main" ltw="aop-exclude.xml"> + <stderr> + <line text="execution(void pkg.sub.Foo.foo())" /> + </stderr> + </run> +</ajc-test> +<ajc-test dir="ltw/inclExcl" title="And patterns aspects" + keywords="ltw"> + <compile files="pkg/sub/Foo.aj, pkg/Main.aj" + options="-outjar base.jar" /> + <compile + files="tracing/Tracer.aj, tracing/staticinit/Tracer.aj, tracing/staticinit/sub/Tracer.aj" + options="-1.4" /> + <run class="pkg.Main" ltw="aop-aspectinclexcl.xml"> + <stderr> + <line text="staticinitialization(pkg.Main.<clinit>)" /> + <line text="staticinitialization(pkg.sub.Foo.<clinit>)" /> + </stderr> + </run> +</ajc-test> + +<ajc-test dir="ltw" title="simple LTW" keywords="ltw"> + <compile files="HelloWorldWithException.java" /> + <compile files="ExceptionHandler.aj" options="-outxml -1.4" /> + <ant file="ant.xml" target="simple LTW" verbose="true"> + <stdout> + <line text="Hello World!" /> + </stdout> + </ant> +</ajc-test> + +<ajc-test dir="ltw" title="dump on error" keywords="ltw"> + <compile files="HelloWorldWithException.java" /> + <compile files="ExceptionHandler.aj" options="-outxml -1.4" /> + <ant file="ant.xml" target="dump on error" verbose="true"> + <stdout> + <line text="Hello World!" /> + </stdout> + </ant> +</ajc-test> + +<ajc-test dir="bugs153/pr155033" title="multiple dump on error" + keywords="ltw"> + <compile files="Annotation.java" options="-1.5" /> + <compile + files="MultipleDumpTest.java, Class1.java, Class2.java, Class3.java" + options="-1.5" /> + <compile files="Aspect.aj" options="-1.5 -outxml -Xlint:ignore" /> + <!-- <run class="MultipleDumpTest" ltw="aop-multipledumponerror.xml"> <stdout> + <line text="? AbortingMessageHandler.AbortingMessageHandler()"/> </stdout> + </run> --> + <ant file="ant.xml" target="multiple dump on error" verbose="true"> + <stdout> + <line text="? MultipleDumpTest.main()" /> + <line text="? Class1.main()" /> + <line text="? Aspect.before()" /> + <line text="? Class2.main()" /> + <line text="? Aspect.before()" /> + <line text="? Class3.main()" /> + <line text="? Aspect.before()" /> + </stdout> + </ant> +</ajc-test> + +
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/ltw.xml b/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/ltw.xml new file mode 100644 index 000000000..311872c09 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ltw/ltw.xml @@ -0,0 +1,11 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[ +<!ENTITY tests SYSTEM "../tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml"> +]> + +<!-- Load-time weaving tests --> + +<suite> + +&tests; + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/tests/.cvsignore b/tests/src/test/java/org/aspectj/systemtest/ajc150/tests/.cvsignore new file mode 100644 index 000000000..9d3c17f8d --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/tests/.cvsignore @@ -0,0 +1 @@ +ajcTestSuite.dtd diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc151/Ajc151Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc151/Ajc151Tests.java new file mode 100644 index 000000000..8928678c8 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc151/Ajc151Tests.java @@ -0,0 +1,282 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM + * 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.ajc151; + +import java.io.File; +import java.io.IOException; + +import org.aspectj.asm.AsmManager; +import org.aspectj.asm.IHierarchy; +import org.aspectj.asm.IProgramElement; +import org.aspectj.systemtest.ajc150.GenericsTests; +import org.aspectj.testing.XMLBasedAjcTestCase; + +import junit.framework.Test; + +public class Ajc151Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + // Some @DeclareParents testing + public void testAtDecp_1() { + runTest("atDecp - simple"); + } + + public void testAtDecp_2() { + runTest("atDecp - annotation"); + } + + public void testAtDecp_3() { + runTest("atDecp - binary interface"); + } + + public void testAtDecp_4() { + runTest("atDecp - binary interface - 2"); + } + + public void testAnnotationsAndItds_pr98901() { + runTest("annotations and itds"); + } + + public void testAnnotationsAndItds_pr98901_2() { + runTest("annotations and itds - 2"); + } + + public void testCircularGenerics_pr133307() { + runTest("circular generics"); + } + + public void testDeca() { + runTest("doubly annotating a method with declare"); + } + + public void testDeca2() { + runTest("doubly annotating a method with declare - 2"); + } + + public void testCrashingWithASM_pr132926_1() { + runTest("crashing on annotation type resolving with asm - 1"); + } + + public void testCrashingWithASM_pr132926_2() { + runTest("crashing on annotation type resolving with asm - 2"); + } + + public void testCrashingWithASM_pr132926_3() { + runTest("crashing on annotation type resolving with asm - 3"); + } + + public void testGenericAdviceParameters_pr123553() { + runTest("generic advice parameters"); + } + + public void testMemberTypesInGenericTypes_pr122458() { + runTest("member types in generic types"); + } + + public void testMemberTypesInGenericTypes_pr122458_2() { + runTest("member types in generic types - 2"); + } + + public void testNPEOnDeclareAnnotation_pr123695() { + runTest("Internal nullptr exception with complex declare annotation"); + } + + public void testHasMemberPackageProblem_pr124105() { + runTest("hasMember problems with packages"); + } + + public void testDifferentNumbersofTVars_pr124803() { + runTest("generics and different numbers of type variables"); + } + + public void testDifferentNumbersofTVars_pr124803_2() { + runTest("generics and different numbers of type variables - classes"); + } + + public void testParameterizedCollectionFieldMatching_pr124808() { + runTest("parameterized collection fields matched via pointcut"); + } + + public void testGenericAspectsAndAnnotations_pr124654() { + runTest("generic aspects and annotations"); + } + + public void testCallInheritedGenericMethod_pr124999() { + runTest("calling inherited generic method from around advice"); + } + + public void testIncorrectlyReferencingPointcuts_pr122452() { + runTest("incorrectly referencing pointcuts"); + } + + public void testIncorrectlyReferencingPointcuts_pr122452_2() { + runTest("incorrectly referencing pointcuts - 2"); + } + + public void testInlinevisitorNPE_pr123901() { + runTest("inlinevisitor NPE"); + } + + // public void testExposingWithintype_enh123423() { runTest("exposing withintype");} + // public void testMissingImport_pr127299() { runTest("missing import gives funny message");} + public void testUnusedInterfaceMessage_pr120527() { + runTest("incorrect unused interface message"); + } + + public void testAtAspectInheritsAdviceWithTJPAndThis_pr125699() { + runTest("inherit advice with this() and thisJoinPoint"); + } + + public void testAtAspectInheritsAdviceWithTJPAndThis_pr125699_2() { + runTest("inherit advice with this() and thisJoinPoint - 2"); + } + + public void testBrokenLTW_pr128744() { + runTest("broken ltw"); + } + + public void testAtAspectNoInvalidAbsoluteTypeName_pr126560() { + runTest("@AJ deow doesn't throw an invalidAbsoluteTypeName when specify type in the same package"); + } + + public void testAtAspectNoInvalidAbsoluteTypeName_pr126560_2() { + runTest("@AJ deow doesn't throw an invalidAbsoluteTypeName when specify type in the same file"); + } + + public void testArrayindexoutofbounds_pr129566() { + runTest("arrayindexoutofbounds"); + // public class SkipList<T extends Comparable> extends Object implements Set<T>, Iterable<T> + GenericsTests.verifyClassSignature(ajc, "common.SkipList", + "<T::Ljava/lang/Comparable;>Ljava/lang/Object;Ljava/util/Set<TT;>;Ljava/lang/Iterable<TT;>;"); + // protected class SkipListElement<E> extends Object + GenericsTests.verifyClassSignature(ajc, "common.SkipList$SkipListElement", "<E:Ljava/lang/Object;>Ljava/lang/Object;"); + // protected class SkipListIterator<E> implements Iterator<T> + GenericsTests.verifyClassSignature(ajc, "common.SkipList$SkipListIterator", + "<E:Ljava/lang/Object;>Ljava/lang/Object;Ljava/util/Iterator<TT;>;"); + } + + public void testMixingNumbersOfTypeParameters_pr125080() { + runTest("mixing numbers of type parameters"); + GenericsTests.verifyClassSignature(ajc, "AspectInterface", "<T:Ljava/lang/Object;S:Ljava/lang/Object;>Ljava/lang/Object;"); + GenericsTests.verifyClassSignature(ajc, "AbstractAspect", + "<T:Ljava/lang/Object;>Ljava/lang/Object;LAspectInterface<TT;Ljava/lang/Integer;>;"); + GenericsTests.verifyClassSignature(ajc, "ConcreteAspect", "LAbstractAspect<Ljava/lang/String;>;"); + } + + public void testMixingNumbersOfTypeParameters_pr125080_2() { + runTest("mixing numbers of type parameters - 2"); + GenericsTests.verifyClassSignature(ajc, "AspectInterface", "<T:Ljava/lang/Object;S:Ljava/lang/Number;>Ljava/lang/Object;"); + GenericsTests.verifyClassSignature(ajc, "AbstractAspect", + "<T:Ljava/lang/Object;>Ljava/lang/Object;LAspectInterface<TT;Ljava/lang/Integer;>;"); + GenericsTests.verifyClassSignature(ajc, "ConcreteAspect", "LAbstractAspect<LStudent;>;"); + } + + public void testIProgramElementMethods_pr125295() throws IOException { + runTest("new IProgramElement methods"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + + IProgramElement typeC = top.findElementForType("pkg", "C"); + IProgramElement pe = top.findElementForSignature(typeC, IProgramElement.Kind.METHOD, "foo(int,java.lang.Object)"); + assertNotNull("Couldn't find 'foo' element in the tree", pe); + // check that the defaults return the fully qualified arg + assertEquals("foo(int,java.lang.Object)", pe.toLabelString()); + assertEquals("C.foo(int,java.lang.Object)", pe.toLinkLabelString()); + assertEquals("foo(int,java.lang.Object)", pe.toSignatureString()); + // check that can get hold of the non qualified args + assertEquals("foo(int,Object)", pe.toLabelString(false)); + assertEquals("C.foo(int,Object)", pe.toLinkLabelString(false)); + assertEquals("foo(int,Object)", pe.toSignatureString(false)); + + IProgramElement typeA = top.findElementForType("pkg", "A"); + IProgramElement pe2 = top.findElementForSignature(typeA,IProgramElement.Kind.METHOD,"printParameters(org.aspectj.lang.JoinPoint)"); + assertNotNull("Couldn't find 'printParameters' element in the tree", pe2); + // the argument is org.aspectj.lang.JoinPoint, check that this is added + assertFalse("printParameters method should have arguments", pe2.getParameterSignatures().isEmpty()); + } + + public void testParameterizedEnum_pr126316() { + runTest("E extends Enum(E) again"); + } + + public void testSwallowedException() { + runTest("swallowed exceptions"); + } + + public void testAtAspectVerifyErrorWithAfterThrowingAndthisJoinPoint_pr122742() { + runTest("@AJ VerifyError with @AfterThrowing and thisJoinPoint argument"); + } + + public void testAtAspectVerifyErrorWithAfterReturningAndthisJoinPoint_pr122742() { + runTest("@AJ VerifyError with @AfterReturning and thisJoinPoint argument"); + } + + public void testSwallowedExceptionIgnored() { + runTest("swallowed exceptions with xlint"); + } + + public void testGenericAspectWithUnknownType_pr131933() { + runTest("no ClassCastException with generic aspect and unknown type"); + } + + /* + * @AspectJ bugs and enhancements + */ + // public void testAtAspectInheritsAdviceWithTJPAndThis_pr125699 () { + // runTest("inherit adivce with this() and thisJoinPoint"); + // } + public void testAtAspectInheritsAbstractPointcut_pr125810() { + runTest("warning when inherited pointcut not made concrete"); + } + + public void testAtAspectWithoutJoinPointImport_pr121616() { + runTest("@AJ without JoinPoint import"); + } + + public void testAtAspectDeclareParentsRetainsFieldState_pr122370() { + runTest("@AJ declare parents retains field state"); + } + + public void testAtAspectNoNPEWithPcdContainingOrThisAndWildcard_pr128237() { + runTest("@AJ no npe with pointcut containing or, this and a wildcard"); + } + + /* + * Load-time weaving bugs and enhancements + */ + public void testEmptyPointcutInAtAspectJ_pr125475() { + runTest("define empty pointcut using an annotation"); + } + + public void testEmptyPointcutInAtAspectJ_pr125475_2() { + runTest("define empty pointcut using an annotation - 2"); + } + + public void testEmptyPointcutInAtAspectJWithLTW_pr125475() { + runTest("define empty pointcut using aop.xml"); + } + + public void testGenericAspectsWithAnnotationTypeParameters() { + runTest("Generic aspects with annotation type parameters"); + } + + public void testPointcutInterfaces_pr130869() { + runTest("Pointcut interfaces"); + } + + // /////////////////////////////////////// + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc151Tests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc151.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc151/AllTestsAspectJ151.java b/tests/src/test/java/org/aspectj/systemtest/ajc151/AllTestsAspectJ151.java new file mode 100644 index 000000000..32a3ed5b3 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc151/AllTestsAspectJ151.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM + * 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.ajc151; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ151 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.5.1 tests"); + //$JUnit-BEGIN$ + suite.addTest(Ajc151Tests.suite()); + suite.addTest(NewarrayJoinpointTests.suite()); + suite.addTest(AtAroundTests.suite()); + suite.addTest(SerialVersionUIDTests.suite()); + //$JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc151/AtAroundTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc151/AtAroundTests.java new file mode 100644 index 000000000..9512e8db4 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc151/AtAroundTests.java @@ -0,0 +1,89 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * 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 implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc151; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * This testcode shows what is possible with code style and the current limitations + * of @AJ style. Each program is written in both styles and those variations + * not currently possible are commented out. + * + * @author AndyClement + * + */ +public class AtAroundTests extends XMLBasedAjcTestCase { + + public void testCodeBasic() { runTest("code style - basic"); } + public void testAtBasicNoInline() { runTest("annotation style - basic - noinline"); } + public void testAtBasic() { runTest("annotation style - basic"); } + + public void testCodeBindingTarget() { runTest("code style - correct usage, binding and passing same target for call"); } + public void testAtBindingTargetNoInline() { runTest("annotation style - correct usage, binding and passing same target for call - noinline"); } + public void testAtBindingTarget() { runTest("annotation style - correct usage, binding and passing same target for call"); } + + public void testCodeBindingTarget2() { runTest("code style - correct usage, binding and passing new target for call"); } + public void testAtBindingTargetNoInline2() { runTest("annotation style - correct usage, binding and passing new target for call - noinline"); } + public void testAtBindingTarget2() { runTest("annotation style - correct usage, binding and passing new target for call"); } + + public void testCodeErrorCase1() { runTest("code style - forget to pass target");} + // Don't think we can report correct errors for @AJ as the parameters are specified as an object array + //public void testAtErrorCase1() { runTest("annotation style - forget to pass target");} + + public void testCodeBindThisCallChangeProceed() { runTest("code style - bind this on call - change on proceed - no effect");} + public void testAtBindThisCallChangeProceedNoInline() { runTest("annotation style - bind this on call - change on proceed - no effect - noinline");} + public void testAtBindThisCallChangeProceed() { runTest("annotation style - bind this on call - change on proceed - no effect");} + + public void testCodeBindThisExecutionChangeProceed() { runTest("code style - bind this on execution - change on proceed - works");} + public void testAtBindThisExecutionChangeProceedNoInline() { runTest("annotation style - bind this on execution - change on proceed - works - noinline");} + public void testAtBindThisExecutionChangeProceed() { runTest("annotation style - bind this on execution - change on proceed - works");} + + public void testCodeBindBothExecutionChangeProceed() { runTest("code style - bind this and target on execution - change on proceed - works");} + public void testAtBindBothExecutionChangeProceedNoInline() { runTest("annotation style - bind this and target on execution - change on proceed - works - noinline");} + public void testAtBindBothExecutionChangeProceed() { runTest("annotation style - bind this and target on execution - change on proceed - works");} + + public void testCodeErrorCase2() { runTest("code style - incorrect arg types");} + // Don't think we can report correct errors for @AJ as the parameters are specified as an object array + // public void testAtErrorCase2() { runTest("annotation style - incorrect arg types");} + + public void testCodeChangingTargetDifferingOrder() { runTest("code style - changing target for call - reverse order"); } + // @AJ cant cope with the changing of the order of arguments bound and passed through proceed + //public void testAtChangingTargetDifferingOrder() { runTest("annotation style - changing target for call - reverse order"); } + + public void testCodeBindBothCallChangeProceed() { runTest("code style - bind this and target on call - change on proceed - works");} + public void testAtBindBothCallChangeProceedNoInline() { runTest("annotation style - bind this and target on call - change on proceed - works - noinline");} + public void testAtBindBothCallChangeProceed() { runTest("annotation style - bind this and target on call - change on proceed - works");} + + public void testBreakingIt1() { runTest("breaking it - one");} + public void testBreakingIt2() { runTest("breaking it - two");} + + public void testBugCase1() { runTest("bug case one");} + public void testBugCase2() { runTest("bug case two");} + public void testMultipleArgs() { runTest("multiple args");} + + public void testCodeSubsetArguments() { runTest("code style - works with subset of arguments in advice");} + // cant do this for annotation style + //public void testAtSubsetArguments() { runTest("annotation style - works with subset of arguments in advice");} + + // --- + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AtAroundTests.class); + } + + protected File getSpecFile() { + return getClassResource("ataround.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc151/NewarrayJoinpointTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc151/NewarrayJoinpointTests.java new file mode 100644 index 000000000..9654c04dd --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc151/NewarrayJoinpointTests.java @@ -0,0 +1,136 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * 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 implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc151; + +import java.io.File; +import java.util.List; + +import org.aspectj.asm.AsmManager; +import org.aspectj.asm.IProgramElement; +import org.aspectj.asm.IRelationship; +import org.aspectj.testing.XMLBasedAjcTestCase; + +import junit.framework.Test; + +/* + * The design: + * + * There are 3 instructions that create arrays: + * + * - NEWARRAY for primitive arrays + * - ANEWARRAY for object arrays + * - MULTIANEWARRAY for multidimensional arrays + * + * The changes to expose the new joinpoint are in: + * BcelClassWeaver.match(LazyMethodGen mg,InstructionHandle ih,BcelShadow enclosingShadow,List shadowAccumulator) + * + * Determining the type of the array is easy. Determining the size of the array is not easy statically, it is on the stack. + * + * + * What still needs testing: + * - structure model + * + */ + +public class NewarrayJoinpointTests extends XMLBasedAjcTestCase { + + // when its the creation of a new 'object' (not a primitive) single dimension array + public void testTheBasics_1() { + runTest("basics"); + } + + public void testTheBasics_2() { + runTest("basics - 2"); + } + + public void testWhatShouldntMatch() { + runTest("shouldnt match"); + } + + public void testThisJoinPoint() { + runTest("thisjoinpoint"); + } + + public void testThisJoinPoint19() { + try { + System.setProperty("ASPECTJ_OPTS", "-Xajruntimetarget:1.9"); + runTest("thisjoinpoint"); + } finally { + System.setProperty("ASPECTJ_OPTS", ""); + } + } + + public void testDifferentAdviceKinds() { + runTest("different advice kinds"); + } + + public void testArgs() { + runTest("args"); + } + + // when it is the creation of a new array of primitives + public void testBasicWithAPrimitiveArray() { + runTest("basic primitive array creation"); + } + + // when it is the creation of a new multi-dimensional array + public void testBasicWithAMultiDimensionalArray() { + runTest("multi dimensional array creation"); + } + + public void testArgsWithAMultiDimensionalArray() { + runTest("multi dimensional array args"); + } + + // various + public void testOptionoff() { + runTest("option deactivated - no match expected"); + } + + public void testUsingTargetAndAfterReturningAdvice() { + runTest("using target and after returning"); + } + + public void testUsingItForReal() { + runTest("using it for real"); + } + + public void testDifferentiatingArrayTypes() { + runTest("differentiating array types"); + } + + public void testStructureModel() { + // AsmManager.setReporting("c:/foo.txt",true,true,true,true); + runTest("structure model"); + IProgramElement ipe = AsmManager.lastActiveStructureModel.getHierarchy().findElementForType("", "Five"); + assertTrue("Couldnt find 'Five' type in the model", ipe != null); + List<IProgramElement> kids = ipe.getChildren(); + assertTrue("Couldn't find 'main' method in the 'Five' type", kids != null && kids.size() == 1); + List<IProgramElement> codenodes = kids.get(0).getChildren(); + assertTrue("Couldn't find nodes below 'main' method", codenodes != null && codenodes.size() == 1); + IProgramElement arrayCtorCallNode = codenodes.get(0); + String exp = "constructor-call(void java.lang.Integer[].<init>(int))"; + assertTrue("Expected '" + exp + "' but found " + arrayCtorCallNode.toString(), arrayCtorCallNode.toString().equals(exp)); + List<IRelationship> rels = AsmManager.lastActiveStructureModel.getRelationshipMap().get(arrayCtorCallNode); + assertTrue("Should have a relationship from the ctorcall node, but didn't find one?", rels != null && rels.size() == 1); + } + + // + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(NewarrayJoinpointTests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("newarray_joinpoint.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc151/SerialVersionUIDTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc151/SerialVersionUIDTests.java new file mode 100644 index 000000000..c1bf29475 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc151/SerialVersionUIDTests.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * 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 implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc151; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + + +public class SerialVersionUIDTests extends XMLBasedAjcTestCase { + + public void testTheBasics() { runTest("basic"); } + public void testTheBasicsWithLint() { runTest("basic - lint"); } + public void testHorrible() { runTest("horrible"); } + + public void testAbstractClass() { runTest("abstract class");} + + // + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(SerialVersionUIDTests.class); + } + + protected File getSpecFile() { + return getClassResource("serialversionuid.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc151/ajc151.xml b/tests/src/test/java/org/aspectj/systemtest/ajc151/ajc151.xml new file mode 100644 index 000000000..279c56e04 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc151/ajc151.xml @@ -0,0 +1,414 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.5.1 Tests --> +<suite> + + <!-- atDecp begin --> + + <!-- something simple --> + <ajc-test dir="bugs151/atDecp/case1" title="atDecp - simple"> + <compile files="MainClass.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Extending interface set for type 'moody.AnnotationMoodImplementor' (MainClass.java) to include 'moody.AnnotationMoodIndicator$Moody' (MainClass.java)"/> + <message kind="weave" text="Type 'moody.AnnotationMoodImplementor' (MainClass.java) has intertyped method from 'moody.AnnotationMoodIndicator' (MainClass.java:'moody.Mood moody.AnnotationMoodIndicator$Moody.getMood()')"/> + <message kind="weave" text="Type 'moody.AnnotationMoodImplementor' (MainClass.java) has intertyped method from 'moody.AnnotationMoodIndicator' (MainClass.java:'void moody.AnnotationMoodIndicator$Moody.setMood(moody.Mood)')"/> + </compile> + <run class="moody.MainClass"> + <stderr> + <line text="ami0's mood is HAPPY"/> + <line text="ami1's mood is now JOLLY"/> + <line text="ami0's mood is still HAPPY"/> + </stderr> + </run> + </ajc-test> + + <!-- applying parent based on annotation --> + <ajc-test dir="bugs151/atDecp/case2" title="atDecp - annotation"> + <compile files="MainClass.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Extending interface set for type 'moody.AnnotationMoodImplementor' (MainClass.java) to include 'moody.AnnotationMoodIndicator$Moody' (MainClass.java)"/> + <message kind="weave" text="Type 'moody.AnnotationMoodImplementor' (MainClass.java) has intertyped method from 'moody.AnnotationMoodIndicator' (MainClass.java:'moody.Mood moody.AnnotationMoodIndicator$Moody.getMood()')"/> + <message kind="weave" text="Type 'moody.AnnotationMoodImplementor' (MainClass.java) has intertyped method from 'moody.AnnotationMoodIndicator' (MainClass.java:'void moody.AnnotationMoodIndicator$Moody.setMood(moody.Mood)')"/> + </compile> + <run class="moody.MainClass"> + <stderr> + <line text="ami0's mood is HAPPY"/> + <line text="ami1's mood is now JOLLY"/> + <line text="ami0's mood is still HAPPY"/> + </stderr> + </run> + </ajc-test> + + <!-- when interface is binary --> + <ajc-test dir="bugs151/atDecp/case3" title="atDecp - binary interface"> + <compile files="Mood.java,Moody.java" outjar="moody.jar" options="-1.5"/> + <compile files="MainClass.java" classpath="moody.jar" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Extending interface set for type 'theapp.AnnotationMoodImplementor' (MainClass.java) to include 'moody.Moody' (MainClass.java)"/> + <message kind="weave" text="Type 'theapp.AnnotationMoodImplementor' (MainClass.java) has intertyped method from 'theapp.AnnotationMoodIndicator' (MainClass.java:'moody.Mood moody.Moody.getMood()')"/> + <message kind="weave" text="Type 'theapp.AnnotationMoodImplementor' (MainClass.java) has intertyped method from 'theapp.AnnotationMoodIndicator' (MainClass.java:'void moody.Moody.setMood(moody.Mood)')"/> + </compile> + <run class="theapp.MainClass"> + <stderr> + <line text="ami0's mood is HAPPY"/> + <line text="ami1's mood is now JOLLY"/> + <line text="ami0's mood is still HAPPY"/> + </stderr> + </run> + </ajc-test> + + <!-- when interface is binary and implementation is not an inner --> + <ajc-test dir="bugs151/atDecp/case4" title="atDecp - binary interface - 2"> + <compile files="Mood.java,Moody.java" outjar="moody.jar" options="-1.5"/> + <compile files="MainClass.java,AnnotationMoodImplementor.java,TheAspect.java,MoodyImpl.java" classpath="moody.jar" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Extending interface set for type 'theapp.AnnotationMoodImplementor' (AnnotationMoodImplementor.java) to include 'moody.Moody' (TheAspect.java)"/> + <message kind="weave" text="Type 'theapp.AnnotationMoodImplementor' (AnnotationMoodImplementor.java) has intertyped method from 'theapp.AnnotationMoodIndicator' (TheAspect.java:'moody.Mood moody.Moody.getMood()')"/> + <message kind="weave" text="Type 'theapp.AnnotationMoodImplementor' (AnnotationMoodImplementor.java) has intertyped method from 'theapp.AnnotationMoodIndicator' (TheAspect.java:'void moody.Moody.setMood(moody.Mood)')"/> + </compile> + <run class="theapp.MainClass"> + <stderr> + <line text="ami0's mood is HAPPY"/> + <line text="ami1's mood is now JOLLY"/> + <line text="ami0's mood is still HAPPY"/> + </stderr> + </run> + </ajc-test> + + <!-- atDecp end --> + + + <ajc-test dir="bugs151/pr126560" title="@AJ deow doesn't throw an invalidAbsoluteTypeName when specify type in the same package"> + <compile files="pkg1/C.java, pkg1/A.java" options="-1.5"> + <message kind="error" line="8" text="error"/> + <message kind="warning" line="5" text="warning"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs151/pr126560" title="@AJ deow doesn't throw an invalidAbsoluteTypeName when specify type in the same file"> + <compile files="pkg2/InOneFile.java" options="-1.5"> + <message kind="warning" line="14" text="call hello"/> + <message kind="error" line="15" text="call hi"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs151/pr98901" title="annotations and itds"> + <compile files="Failing.java" options="-1.5"/> + <run class="Failing"> + <stderr> + <line text="On TestInterface:@TestAnnotation(value=true)"/> + <line text="On Failing:@TestAnnotation(value=true)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs151/pr98901" title="annotations and itds - 2"> + <compile files="Failing2.java" options="-1.5"/> + <run class="Failing2"> + <stderr> + <line text="On TestInterface:@TestAnnotation(value=true)"/> + <line text="On Failing2:@TestAnnotation(value=true)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs151/pr132926" pr="132926" title="crashing on annotation type resolving with asm - 1"> + <compile files="InputAnnotation.java,AffectedType.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs151/pr132926" pr="132926" title="crashing on annotation type resolving with asm - 2"> + <compile files="InputAnnotation.java" outjar="foo.jar" options="-1.5"/> + <compile files="AffectedType.java" classpath="foo.jar" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs151/pr132926" pr="132926" title="crashing on annotation type resolving with asm - 3"> + <compile files="InputAnnotation2.java" outjar="foo.jar" options="-1.5"/> + <compile files="AffectedType.java" classpath="foo.jar" options="-1.5"> + <message kind="error" line="9" text="AffectedType is not a valid target for annotation InputAnnotation, this annotation can only be applied to these element types {METHOD}"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs151/pr133307" title="circular generics"> + <compile files="Broken.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs151/pr123553" title="generic advice parameters"> + <compile files="A.java" options="-1.5"/> + <run class="A"/> + </ajc-test> + + <ajc-test dir="bugs151/pr133298" title="doubly annotating a method with declare"> + <compile files="DecA.java" options="-1.5"/> + <run class="DecA"> + <stderr> + <line text="There are 2 annotations on public void m()"/> + <line text="1) One"/> + <line text="2) Two"/> + <line text="There are 2 annotations on public Target(int):"/> + <line text="1) Four"/> + <line text="2) Three"/> + <line text="There are 2 annotations on public int x:"/> + <line text="1) Five"/> + <line text="2) Six"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs151/pr133298" title="doubly annotating a method with declare - 2"> + <compile files="DecA2.java" options="-1.5"/> + <run class="DecA2"> + <stderr> + <line text="There are 2 annotations on public void Target.m()"/> + <line text="1) One"/> + <line text="2) Two"/> + <line text="There are 2 annotations on public void A.m()"/> + <line text="1) One"/> + <line text="2) Two"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs151/pr129566" title="arrayindexoutofbounds"> + <compile files="SkipList.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs151" title="member types in generic types"> + <compile files="pr122458.aj" options="-1.5 -emacssym"/> + </ajc-test> + + <ajc-test dir="bugs151/pr127299" title="missing import gives funny message"> + <compile files="ModelErrorConversion.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs151/pr122742" title="@AJ VerifyError with @AfterThrowing and thisJoinPoint argument"> + <compile files="AfterThrowingTest.java" options="-1.5"/> + <run class="AfterThrowingTest"> + </run> + </ajc-test> + + <ajc-test dir="bugs151/pr122742" title="@AJ VerifyError with @AfterReturning and thisJoinPoint argument"> + <compile files="AfterReturningTest.java" options="-1.5"/> + <run class="AfterReturningTest"> + </run> + </ajc-test> + + <ajc-test dir="bugs151/pr120527" title="incorrect unused interface message"> + <compile files="Bugs.aj" options="-warn:unusedPrivate"/> + </ajc-test> + + <ajc-test dir="bugs151/pr123901" title="inlinevisitor NPE"> + <compile files="A.java,B.java" options="-1.5"> + <message kind="error" line="5" text="A cannot be resolved or is not a field"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs151" title="member types in generic types - 2"> + <compile files="pr122458_2.aj" options="-1.5 -emacssym"/> + <run class="pr122458_2"/> + </ajc-test> + + <ajc-test dir="bugs151/pr123695" title="Internal nullptr exception with complex declare annotation"> + <compile files="InjectName.java,Main.java,MarkMyMethods.java,MarkMyMethodsAspect.java,NameAspect.java,Named.java,Read.java,Write.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs151/pr124105" title="hasMember problems with packages"> + <compile files="com/test/IOption.java,com/test/IXOption.java,com/test/IYOption.java,com/test/IZOption.java,com/test/MyBrokenXOption.java,com/test/MyXOption.java,com/test/OptionAspect.aj,com/test/OptionType.java" options="-1.5 -XhasMember"> + <message kind="error" line="4" text="IOption implementations must provide a constructor which accepts an OptionType"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs151/pr124803" title="generics and different numbers of type variables"> + <compile files="Test.java,TestAspect.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void Test.foo(java.lang.Number))' in Type 'Test' (Test.java:12) advised by after advice from 'TestAspect' (TestAspect.java:4)"/> + </compile> + <run class="Test"> + <stderr> + <line text="Aspects:execution(void Test.foo(Number))"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs151/pr124803" title="generics and different numbers of type variables - classes"> + <compile files="Test2.java,TestAspect2.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void Test2.foo(java.lang.Number))' in Type 'Test2' (Test2.java:12) advised by after advice from 'TestAspect2' (TestAspect2.java:4)"/> + <message kind="weave" text="Join point 'method-execution(void Generic1.foo(java.lang.Number))' in Type 'Generic1' (Test2.java:2) advised by after advice from 'TestAspect2' (TestAspect2.java:4) [with runtime test]"/> + </compile> + <run class="Test2"> + <stderr> + <line text="Aspects:execution(void Test2.foo(Number))"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs151/pr124808" title="parameterized collection fields matched via pointcut"> + <compile files="Test.java,TestAspect.java" options="-1.5"/> + <run class="Test"> + <stderr> + <line text="GO Aspects! get(Set Test.ints)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs151" title="calling inherited generic method from around advice"> + <compile files="pr124999.aj" options="-1.5"/> + <run class="pr124999"/> + </ajc-test> + + <ajc-test dir="bugs151/pr124654" title="generic aspects and annotations"> + <compile files="GenericAnnotation.java,TestSubAspect.java" options="-1.5"/> + <run class="TestSubAspect"> + <stderr> + <line text="Reference pointcut advice. interface MyAnnotation"/> + <line text="Inlined pointcut advice. interface MyAnnotation"/> + <line text="run running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs151" title="incorrectly referencing pointcuts"> + <compile files="pr122452.aj" options="-1.5"> + <message kind="warning" line="2" text="no match for this type name: Point [Xlint:invalidAbsoluteTypeName]"/> + <message kind="warning" line="3" text="no match for this type name: related.Hello [Xlint:invalidAbsoluteTypeName]"/> + <message kind="error" line="4" text="Syntax error on token "*", "(" expected"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs151" title="incorrectly referencing pointcuts - 2"> + <compile files="pr122452_2.aj" options="-1.5"> + <message kind="error" line="2" text="Syntax error on token "*", "(" expected"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs151/pr125080" title="mixing numbers of type parameters"> + <compile files="Test.java" options="-1.5"/> + <run class="ConcreteAspect"/> + </ajc-test> + + <ajc-test dir="bugs151/pr125080" title="mixing numbers of type parameters - 2"> + <compile files="Test2.java" options="-1.5"/> + <run class="ConcreteAspect"/> + </ajc-test> + + <ajc-test dir="bugs151/pr125295" title="new IProgramElement methods"> + <compile files="pkg/C.java,pkg/A.aj" options="-emacssym"/> + </ajc-test> + + <ajc-test dir="bugs151/pr125475" title="define empty pointcut using an annotation"> + <compile files="TestEmptyPointcutAtAspect.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs151/pr125475" title="define empty pointcut using an annotation - 2"> + <compile files="TestEmptyPointcutAtAspect2.java" options="-1.5 -showWeaveInfo"> + <message kind="warning" line="10" text="advice defined in TestEmptyPointcutAtAspect2 has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs151/pr125475" title="define empty pointcut using aop.xml"> + <compile files="Test.java TestAspect.aj"/> + <run class="Test" ltw="aop.xml"/> + </ajc-test> + + <ajc-test dir="bugs151/pr128744" title="broken ltw"> + <compile files="Hello.java World.java" options="-1.5" /> + <run class="Hello" ltw="aop.xml"> + <stdout> + <line text="Hello"/> + <line text="World"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs151/pr125699" title="inherit advice with this() and thisJoinPoint"> + <compile files="Tracing.aj, TestTracing.aj, AtTestTracing.java" options="-1.5"> + <message kind="warning" line="13" text="advice defined in Tracing has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="warning" line="8" text="advice defined in Tracing has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="warning" line="3" text="advice defined in Tracing has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs151/pr125699" title="inherit advice with this() and thisJoinPoint - 2"> + <compile files="Tracing.aj, SubAbstractTracing.aj, SubAtAj.java" options="-1.5"> + <message kind="warning" line="13" text="advice defined in Tracing has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="warning" line="8" text="advice defined in Tracing has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="warning" line="3" text="advice defined in Tracing has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs151/pr125810" title="warning when inherited pointcut not made concrete"> + <compile files="SuperAspect.aj, SubAspect.aj, SubAtAspect.java" options="-1.5"> + <message kind="error" line="3" text="inherited abstract pointcut SuperAspect.scope() is not made concrete in SubAspect"/> + <message kind="error" line="1" text="inherited abstract pointcut SuperAspect.scope() is not made concrete in SubAspect"/> + <message kind="error" line="3" text="inherited abstract pointcut SuperAspect.scope() is not made concrete in SubAtAspect"/> + <message kind="error" line="4" text="inherited abstract pointcut SuperAspect.scope() is not made concrete in SubAtAspect"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs151" title="E extends Enum(E) again"> + <compile files="Pr126316.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs151" title="@AJ without JoinPoint import"> + <compile files="pr121616.java" options="-1.5"> + <message kind="error" line="13" text="JoinPoint cannot be resolved to a type"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs151/pr122370" title="@AJ declare parents retains field state"> + <compile files="moody/AnnotationMoodImplementor.java, moody/AnnotationMoodIndicator.java, moody/Mood.java, moody/MainClass.java" options="-1.5"/> + <run class="moody.MainClass"> + <stdout> + <line text="ami0's mood is HAPPY"/> + <line text="ami1's mood is now JOLLY"/> + <line text="ami0's mood is still HAPPY"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs151" title="@AJ no npe with pointcut containing or, this and a wildcard"> + <compile files="pr128237.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs151" title="Generic aspects with annotation type parameters"> + <compile files="GenericAspectWithAnnotationTypeParameter.aj" options="-1.5"/> + <run class="GenericAspectWithAnnotationTypeParameter"> + <stdout> + <line text="annotation match - no binding"/> + <line text="execution with annotation match"/> + <line text="annotation match - binding"/> + <line text="hello"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs151" title="Pointcut interfaces"> + <compile files="pr130869.aj" options="-1.5"> + <message kind="warning" line="30" text="no directly runnable classes"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs151" title="no ClassCastException with generic aspect and unknown type"> + <compile files="pr131933.aj" options="-1.5"> + <message kind="error" line="5" text="can't bind type name 'MyList'"/> + </compile> + </ajc-test> + + <!-- New features down here... when they arent big enough to have their own test file --> + + <ajc-test dir="features151/ptw" title="exposing withintype"> + <compile files="ExposedType.java" options="-1.5"/> + <run class="ExposedType"> + <stderr> + <line text="here I am execution(void ExposedTypeOne.foo()): for class ExposedTypeOne"/> + <line text="here I am execution(void ExposedTypeTwo.foo()): for class ExposedTypeTwo"/> + <line text="here I am execution(void ExposedTypeThree.foo()): for class ExposedTypeThree"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/swallowedExceptions" title="swallowed exceptions"> + <compile files="SwallowedException.java" options="-Xlint:warning"> + <message kind="warning" line="11" text="Exception swallowed in catch block"/> + </compile> + </ajc-test> + + <ajc-test dir="features151/swallowedExceptions" title="swallowed exceptions with xlint"> + <compile files="SwallowedException.java"> + </compile> + </ajc-test> +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc151/ataround.xml b/tests/src/test/java/org/aspectj/systemtest/ajc151/ataround.xml new file mode 100644 index 000000000..d8b625823 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc151/ataround.xml @@ -0,0 +1,379 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.5.1 Tests --> +<suite> + + + <ajc-test dir="features151/ataround" title="code style - basic"> + <compile files="X1.java" options="-1.5"/> + <run class="X1"> + <stderr> + <line text="advice from code aspect"/> + <line text="faked"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/ataround" title="annotation style - basic - noinline"> + <compile files="A1.java" options="-1.5 -XnoInline"/> + <run class="A1"> + <stderr> + <line text="advice from ataj aspect"/> + <line text="faked"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/ataround" title="annotation style - basic"> + <compile files="A1.java" options="-1.5"/> + <run class="A1"> + <stderr> + <line text="advice from ataj aspect"/> + <line text="faked"/> + </stderr> + </run> + </ajc-test> + + + + + <ajc-test dir="features151/ataround" title="code style - correct usage, binding and passing same target for call"> + <compile files="X4.java" options="-1.5"/> + <run class="X4"> + <stderr> + <line text="advice from code aspect"/> + <line text="1faked"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/ataround" title="annotation style - correct usage, binding and passing same target for call - noinline"> + <compile files="A4.java" options="-1.5 -XnoInline"/> + <run class="A4"> + <stderr> + <line text="advice from ataj aspect"/> + <line text="1faked"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/ataround" title="annotation style - correct usage, binding and passing same target for call"> + <compile files="A4.java" options="-1.5"/> + <run class="A4"> + <stderr> + <line text="advice from ataj aspect"/> + <line text="1faked"/> + </stderr> + </run> + </ajc-test> + + + + + <ajc-test dir="features151/ataround" title="code style - correct usage, binding and passing new target for call"> + <compile files="X42.java" options="-1.5"/> + <run class="X42"> + <stderr> + <line text="advice from code aspect"/> + <line text="2faked"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/ataround" title="annotation style - correct usage, binding and passing new target for call - noinline"> + <compile files="A42.java" options="-1.5 -XnoInline"/> + <run class="A42"> + <stderr> + <line text="advice from ataj aspect"/> + <line text="2faked"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/ataround" title="annotation style - correct usage, binding and passing new target for call"> + <compile files="A42.java" options="-1.5"/> + <run class="A42"> + <stderr> + <line text="advice from ataj aspect"/> + <line text="2faked"/> + </stderr> + </run> + </ajc-test> + + + + + + <ajc-test dir="features151/ataround" title="code style - forget to pass target"> + <compile files="X2.java" options="-1.5"> + <message kind="error" line="7" text="too few arguments to proceed, expected 2"/> + </compile> + </ajc-test> + + <ajc-test dir="features151/ataround" title="annotation style - forget to pass target"> + <compile files="A2.java" options="-1.5"> + <message kind="error" line="7" text="too few arguments to proceed, expected 2"/> + </compile> + </ajc-test> + + + + + <ajc-test dir="features151/ataround" title="code style - bind this on call - change on proceed - no effect"> + <compile files="X7.java" options="-1.5"/> + <run class="X7"> + <stderr> + <line text="advice from code aspect"/> + <line text="1faked"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/ataround" title="annotation style - bind this on call - change on proceed - no effect - noinline"> + <compile files="A7.java" options="-1.5 -XnoInline"/> + <run class="A7"> + <stderr> + <line text="advice from ataj aspect"/> + <line text="1faked"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/ataround" title="annotation style - bind this on call - change on proceed - no effect"> + <compile files="A7.java" options="-1.5"/> + <run class="A7"> + <stderr> + <line text="advice from ataj aspect"/> + <line text="1faked"/> + </stderr> + </run> + </ajc-test> + + + + <ajc-test dir="features151/ataround" title="code style - bind this on execution - change on proceed - works"> + <compile files="X8.java" options="-1.5"/> + <run class="X8"> + <stderr> + <line text="advice from code aspect"/> + <line text="2faked"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/ataround" title="annotation style - bind this on execution - change on proceed - works - noinline"> + <compile files="A8.java" options="-1.5 -XnoInline"/> + <run class="A8"> + <stderr> + <line text="advice from ataj aspect"/> + <line text="2faked"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/ataround" title="annotation style - bind this on execution - change on proceed - works"> + <compile files="A8.java" options="-1.5"/> + <run class="A8"> + <stderr> + <line text="advice from ataj aspect"/> + <line text="2faked"/> + </stderr> + </run> + </ajc-test> + + + + + <ajc-test dir="features151/ataround" title="code style - incorrect arg types"> + <compile files="X3.java" options="-1.5"> + <message kind="error" line="7" text="Type mismatch: cannot convert from String to M"/> + <message kind="error" line="7" text="Type mismatch: cannot convert from M to String"/> + </compile> + </ajc-test> + + <ajc-test dir="features151/ataround" title="annotation style - incorrect arg types"> + <compile files="A3.java" options="-1.5"> + <message kind="error" line="7" text="too few arguments to proceed, expected 2"/> + </compile> + </ajc-test> + + + + + <ajc-test dir="features151/ataround" title="code style - bind this and target on execution - change on proceed - works"> + <compile files="X9.java" options="-1.5"/> + <run class="X9"> + <stderr> + <line text="advice from code aspect"/> + <line text="3faked"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/ataround" title="annotation style - bind this and target on execution - change on proceed - works - noinline"> + <compile files="A9.java" options="-1.5 -XnoInline"/> + <run class="A9"> + <stderr> + <line text="advice from ataj aspect"/> + <line text="3faked"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/ataround" title="annotation style - bind this and target on execution - change on proceed - works"> + <compile files="A9.java" options="-1.5"/> + <run class="A9"> + <stderr> + <line text="advice from ataj aspect"/> + <line text="3faked"/> + </stderr> + </run> + </ajc-test> + + + + + + <ajc-test dir="features151/ataround" title="code style - bind this and target on call - change on proceed - works"> + <compile files="X10.java" options="-1.5"/> + <run class="X10"> + <stderr> + <line text="advice from code aspect"/> + <line text="3faked"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/ataround" title="annotation style - bind this and target on call - change on proceed - works - noinline"> + <compile files="A10.java" options="-1.5"/> + <run class="A10"> + <stderr> + <line text="advice from ataj aspect"/> + <line text="3faked"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/ataround" title="annotation style - bind this and target on call - change on proceed - works"> + <compile files="A10.java" options="-1.5"/> + <run class="A10"> + <stderr> + <line text="advice from ataj aspect"/> + <line text="3faked"/> + </stderr> + </run> + </ajc-test> + + + + + <ajc-test dir="features151/ataround" title="breaking it - one"> + <compile files="Break1.java" options="-1.5"/> + <run class="Break1"> + <stderr> + <line text="advice from ataj aspect"/> + <line text="1faked"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/ataround" title="breaking it - two"> + <compile files="Break2.java" options="-1.5"/> + <run class="Break2"> + <stderr> + <line text="advice from ataj aspect"/> + <line text="1faked"/> + </stderr> + </run> + </ajc-test> + + + <ajc-test dir="features151/ataround" title="bug case one"> + <compile files="BugCase1.java" options="-1.5"/> + <run class="BugCase1"> + <stderr> + <line text="advice running"/> + <line text="Setting age to 10"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/ataround" title="bug case two"> + <compile files="BugCase2.java" options="-1.5"/> + <run class="BugCase2"> + <stderr> + <line text="advice running"/> + <line text="Setting age to 10"/> + </stderr> + </run> + </ajc-test> + + + <ajc-test dir="features151/ataround" title="multiple args"> + <compile files="MultipleArgs.java" options="-1.5"/> + <run class="MultipleArgs"> + <stderr> + <line text="advice running"/> + <line text="advice running"/> + <line text="advice running"/> + </stderr> + </run> + </ajc-test> + + + + + + + + <ajc-test dir="features151/ataround" title="code style - changing target for call - reverse order"> + <compile files="X6.java" options="-1.5"/> + <run class="X6"> + <stderr> + <line text="advice from code aspect"/> + <line text="2faked"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/ataround" title="annotation style - changing target for call - reverse order"> + <compile files="A6.java" options="-1.5"/> + <run class="A6"> + <stderr> + <line text="advice from ataj aspect"/> + <line text="2faked"/> + </stderr> + </run> + </ajc-test> + + + + + + + + + + + + <ajc-test dir="features151/ataround" title="code style - works with subset of arguments in advice"> + <compile files="X11.java" options="-1.5"/> + <run class="X11"> + <stderr> + <line text="advice from code aspect"/> + <line text="3x_z"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/ataround" title="annotation style - works with subset of arguments in advice"> + <compile files="A11.java" options="-1.5"/> + <run class="A11"> + <stderr> + <line text="advice from code aspect"/> + <line text="3x_z"/> + </stderr> + </run> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc151/newarray_joinpoint.xml b/tests/src/test/java/org/aspectj/systemtest/ajc151/newarray_joinpoint.xml new file mode 100644 index 000000000..fb11fa596 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc151/newarray_joinpoint.xml @@ -0,0 +1,165 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.5.1 Tests --> +<suite> + + <ajc-test dir="features151/newarrayjoinpoint" title="basics"> + <compile files="One.java" options="-1.5 -showWeaveInfo -Xjoinpoints:arrayconstruction"> + <message kind="weave" text="Join point 'constructor-call(void java.lang.Integer[].<init>(int))' in Type 'One' (One.java:4) advised by before advice from 'X' (One.java:9)"/> + </compile> + <run class="One"> + <stderr> + <line text="advice running"/> + </stderr> + </run> + </ajc-test> + + + <ajc-test dir="features151/newarrayjoinpoint" title="basics - 2"> + <compile files="Two.java" options="-1.5 -showWeaveInfo -Xjoinpoints:arrayconstruction"> + <message kind="weave" text="Join point 'constructor-call(void java.lang.Integer[].<init>(int))' in Type 'Two' (Two.java:4) advised by before advice from 'X' (Two.java:9)"/> + </compile> + <run class="Two"> + <stderr> + <line text="advice running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/newarrayjoinpoint" title="shouldnt match"> + <compile files="Three.java" options="-1.5 -showWeaveInfo -Xjoinpoints:arrayconstruction"> + <message kind="warning" line="9" text="advice defined in X has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="warning" line="10" text="advice defined in X has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="warning" line="11" text="advice defined in X has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="warning" line="12" text="advice defined in X has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + </ajc-test> + + <ajc-test dir="features151/newarrayjoinpoint" title="thisjoinpoint"> + <compile files="Four.java" options="-1.5 -showWeaveInfo -Xjoinpoints:arrayconstruction"> + <message kind="weave" text="Join point 'constructor-call(void java.lang.Integer[].<init>(int))' in Type 'Four' (Four.java:4) advised by before advice from 'X' (Four.java:10)"/> + <message kind="weave" text="Join point 'constructor-call(void Foo.<init>(int))' in Type 'Four' (Four.java:5) advised by before advice from 'X' (Four.java:13)"/> + </compile> + <run class="Four"> + <stderr> + <line text="tjp1=>call(java.lang.Integer[](int))"/> + <line text="tjp2=>call(Foo(int))"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/newarrayjoinpoint" title="different advice kinds"> + <compile files="Five.java" options="-1.5 -showWeaveInfo -Xjoinpoints:arrayconstruction"> + <message kind="weave" text="Join point 'constructor-call(void java.lang.Integer[].<init>(int))' in Type 'Five' (Five.java:4) advised by around advice from 'Z' (Five.java:16)"/> + <message kind="weave" text="Join point 'constructor-call(void java.lang.Integer[].<init>(int))' in Type 'Five' (Five.java:4) advised by after advice from 'Y' (Five.java:12)"/> + <message kind="weave" text="Join point 'constructor-call(void java.lang.Integer[].<init>(int))' in Type 'Five' (Five.java:4) advised by afterReturning advice from 'Y' (Five.java:13)"/> + <message kind="weave" text="Join point 'constructor-call(void java.lang.Integer[].<init>(int))' in Type 'Five' (Five.java:4) advised by before advice from 'X' (Five.java:9)"/> + </compile> + <run class="Five"> + <stderr> + <line text="before"/> + <line text="around!"/> + <line text="after"/> + <line text="after returning"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/newarrayjoinpoint" title="args"> + <compile files="Six.java" options="-1.5 -Xjoinpoints:arrayconstruction"/> + <run class="Six"> + <stderr> + <line text="Array size = 5"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/newarrayjoinpoint" title="basic primitive array creation"> + <compile files="Seven.java" options="-1.5 -Xjoinpoints:arrayconstruction"/> + <run class="Seven"> + <stderr> + <line text="advice running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/newarrayjoinpoint" title="multi dimensional array creation"> + <compile files="Eight.java" options="-1.5 -Xjoinpoints:arrayconstruction"/> + <run class="Eight"> + <stderr> + <line text="advice running 2"/> + <line text="advice running 1"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/newarrayjoinpoint" title="multi dimensional array args"> + <compile files="Nine.java" options="-1.5 -Xjoinpoints:arrayconstruction"/> + <run class="Nine"> + <stderr> + <line text="advice running 2 (5,6)"/> + <line text="advice running 1 (2,4)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/newarrayjoinpoint" title="using target and after returning"> + <compile files="Ten.java" options="-1.5 -showWeaveInfo -Xjoinpoints:arrayconstruction"> + <message kind="warning" line="13" text="advice defined in X has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="warning" line="17" text="advice defined in X has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="weave" text="Join point 'constructor-call(void Ten.<init>())' in Type 'Ten' (Ten.java:4) advised by afterReturning advice from 'X' (Ten.java:21)"/> + <message kind="weave" text="Join point 'constructor-call(void int[].<init>(int))' in Type 'Ten' (Ten.java:5) advised by afterReturning advice from 'X' (Ten.java:21)"/> + </compile> + <run class="Ten"> + <stderr> + <line text="afterReturning class Ten"/> + <line text="afterReturning class [I"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/newarrayjoinpoint" title="using it for real"> + <compile files="Eleven.java" options="-1.5 -Xjoinpoints:arrayconstruction"> + <!--message kind="weave" text="Join point 'constructor-call(void Ten.<init>())' in Type 'Ten' (Ten.java:4) advised by afterReturning advice from 'X' (Ten.java:21)"/> + <message kind="weave" text="Join point 'constructor-call(void int[].<init>(int))' in Type 'Ten' (Ten.java:5) advised by afterReturning advice from 'X' (Ten.java:21)"/--> + </compile> + <run class="Eleven"> + <stderr> + <line text="Found the interesting array"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/newarrayjoinpoint" title="differentiating array types"> + <compile files="Twelve.java" options="-1.5 -Xjoinpoints:arrayconstruction"/> + <run class="Twelve"> + <stderr> + <line text="It is class [I"/> + <line text="Is it an array? true"/> + <line text="Component type is int"/> + <line text="--"/> + <line text="It is class [Ljava.lang.Integer;"/> + <line text="Is it an array? true"/> + <line text="Component type is class java.lang.Integer"/> + <line text="--"/> + <line text="It is class [[Ljava.lang.String;"/> + <line text="Is it an array? true"/> + <line text="Component type is class [Ljava.lang.String;"/> + <line text="--"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/newarrayjoinpoint" title="structure model"> + <compile files="Five.java" options="-1.5 -emacssym -Xjoinpoints:arrayconstruction"/> + </ajc-test> + + <ajc-test dir="features151/newarrayjoinpoint" title="option deactivated - no match expected"> + <compile files="One.java" options="-1.5 -showWeaveInfo"> + <message kind="warning" line="9" text="advice defined in X has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="warning" line="9" text="There are no join points for array construction unless -Xjoinpoints:arrayconstruction is specified"/> + </compile> + </ajc-test> + + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc151/serialversionuid.xml b/tests/src/test/java/org/aspectj/systemtest/ajc151/serialversionuid.xml new file mode 100644 index 000000000..f7b05af63 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc151/serialversionuid.xml @@ -0,0 +1,51 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.5.1 Tests --> +<suite> + + <ajc-test dir="features151/serialveruid" title="basic"> + <compile files="Basic.java" options="-1.5 -XaddSerialVersionUID"/> + <run class="Basic"> + <stderr> + <line text="SerialVersionUID is -7868414887470674287"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/serialveruid" title="basic - lint"> + <compile files="Basic.java" options="-1.5 -XaddSerialVersionUID -Xlint:warning"> + <message kind="warning" text="calculated SerialVersionUID for type Basic"/> + </compile> + <run class="Basic"> + <stderr> + <line text="SerialVersionUID is -7868414887470674287"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/serialveruid" title="horrible"> + <compile files="BigHorribleClass.java,AnAspect.java" options="-1.5 -XaddSerialVersionUID -Xlint:warning"> + <message kind="warning" text="calculated SerialVersionUID for type BigHorribleClass"/> + </compile> + <run class="BigHorribleClass"> + <stderr> + <line text="SerialVersionUID is -3425710461209091702"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features151/serialveruid" title="abstract class"> + <compile files="TwoTypes.java,Test.java,ATest.java" options="-1.5 -XaddSerialVersionUID -Xlint:warning"> + <message kind="warning" text="calculated SerialVersionUID for type TwoTypes"/> + <message kind="warning" text="calculated SerialVersionUID for type com.testware.ejb.common.Test to be -1674849842374764518L"/> + <message kind="warning" text="calculated SerialVersionUID for type com.testware.ejb.common.ATest to be -7300724421810308152L"/> + </compile> + <run class="TwoTypes"> + <stderr> + <line text="Test SerialVersionUID is -1674849842374764518"/> + <line text="ATest SerialVersionUID is -7300724421810308152"/> + </stderr> + </run> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc152/Ajc152Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc152/Ajc152Tests.java new file mode 100644 index 000000000..eef463214 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc152/Ajc152Tests.java @@ -0,0 +1,384 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM + * 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.ajc152; + +import java.io.File; +import java.util.List; + +import junit.framework.Test; + +import org.aspectj.asm.AsmManager; +import org.aspectj.asm.IHierarchy; +import org.aspectj.asm.IProgramElement; +import org.aspectj.asm.internal.CharOperation; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + // public void testCovarianceAndDecp_pr128443_1() { runTest("covariance and decp - 1"); } + // public void testSuperITDExplosion_pr134425() { runTest("super ITDs");} + // public void testMisbehavingDeclareAnnotation_pr135865() { runTest("misbehaving declare annotation");} + // public void testMisbehavingDeclareAnnotation_pr135865_2() { runTest("misbehaving declare annotation - 2");} + // public void testClassCastForInvalidAnnotationValue_pr148537() { runTest("classcast annotation value");} + + // tests added post 152rc1 and before final + public void testSeparateCallAspectOf_pr148727() { + runTest("separate compilation calling aspectOf and hasAspect"); + } + + public void testIntegratedCallAspectOf_pr148727() { + runTest("integrated compilation calling aspectOf and hasAspect"); + } + + public void testFreakyNewArrayJoinpoint_pr148786() { + runTest("freaky new array joinpoint"); + } + + // tests adding during 152 development + public void testPrivilegeGeneric_pr148545() { + runTest("nosuchmethoderror for privileged aspect"); + } + + public void testPrivilegeGeneric_pr148545_2() { + runTest("nosuchmethoderror for privileged aspect - 2"); + } + + public void testUnknownAnnotationNPE() { + runTest("NPE for unknown annotation"); + } + + public void testDuplicateBridgeMethods_pr147801_1() { + runTest("duplicate bridge methods"); + } + + public void testPackageIgnoredForException_pr147701_1() { + runTest("package for exception ignored"); + } + + public void testPackageIgnoredForException_pr147701_2() { + runTest("package for exception ignored - 2"); + } + + public void testPackageIgnoredForException_pr147701_3() { + runTest("package for exception ignored - 3"); + } + + public void testBrokenAddSerialVersionUID_pr145950() { + runTest("fails to discover Serializable"); + } + + public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_1() { + runTest("no unnecessary declaration of thrown exception warning - 1"); + } + + public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_2() { + runTest("no unnecessary declaration of thrown exception warning - 2"); + } + + public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_3() { + runTest("no unnecessary declaration of thrown exception warning - 3"); + } + + public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_4() { + runTest("no unnecessary declaration of thrown exception warning - 4"); + } + + public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_5() { + runTest("no unnecessary declaration of thrown exception warning - 5"); + } + + public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_6() { + runTest("no unnecessary declaration of thrown exception warning - 6"); + } + + public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_7() { + runTest("no unnecessary declaration of thrown exception warning - 7"); + } + + public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_8() { + runTest("no unnecessary declaration of thrown exception warning - 8"); + } + + public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_9() { + runTest("no unnecessary declaration of thrown exception warning - 9"); + } + + public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_10() { + runTest("no unnecessary declaration of thrown exception warning - 10"); + } + + public void testAtAJVerificationError_pr144602() { + runTest("atAJ perthis aspect verification error"); + } + + public void testLTWAndGeneratingSUID_pr144465() { + runTest("ltw with serialversionUID creation"); + } + + public void testAspects14PerSingleton_pr122253() { + runTest("aspects14 - persingleton"); + } + + public void testAspects14PerCflow_pr122253() { + runTest("aspects14 - percflow"); + } + + public void testAspects14PerThis_pr122253() { + runTest("aspects14 - perthis"); + } + + public void testAspects14PerTypeWithin_pr122253() { + runTest("aspects14 - pertypewithin"); + } + + public void testFunkyGenericErrorWithITDs_pr126355() { + runTest("bizarre generic error with itds"); + } + + public void testConcretizingAbstractMethods_pr142466() { + runTest("aop.xml aspect inheriting but not concretizing abstract method"); + } + + public void testConcretizingAbstractMethods_pr142466_2() { + runTest("aop.xml aspect inheriting but not concretizing abstract method - 2"); + } + + public void testComplexGenericDecl_pr137568() { + runTest("complicated generics declaration"); + } + + public void testItdOnInnerTypeOfGenericType_pr132349() { + runTest("ITD on inner type of generic type"); + } + + public void testItdOnInnerTypeOfGenericType_pr132349_2() { + runTest("ITD on inner type of generic type - 2"); + } + + public void testItdOnInnerTypeOfGenericType_pr132349_3() { + runTest("ITD on inner type of generic type - 3"); + } + + public void testLTWGeneratedAspectAbstractMethod_pr125480() { + runTest("aop.xml aspect inheriting abstract method "); + } + + public void testLTWGeneratedAspectAbstractMethod_pr125480_2() { + runTest("aop.xml aspect inheriting abstract method - code style"); + } + + public void testCompletelyBrokenAopConcretization_pr142165_1() { + runTest("broken concretization"); + } + + public void testCompletelyBrokenAopConcretization_pr142165_2() { + runTest("broken concretization - 2"); + } + + public void testCompletelyBrokenAopConcretization_pr142165_3() { + runTest("broken concretization - 3"); + } + + // public void testVerifyErrorLTW_pr135068() { runTest("ltw verifyerror");} + // public void testVerifyErrorLTW_pr135068_2() { runTest("ltw verifyerror - 2");} + // public void testVerifyErrorLTW_pr135068_3() { runTest("ltw verifyerror - 3");} + public void testVerifyErrorLTW_pr135068_4() { + runTest("ltw verifyerror - 4"); + } + + public void testVerifyErrorForComplexCflow_pr136026() { + runTest("verifyerror"); + } + + public void testVerifyErrorForComplexCflow_pr136026_2() { + runTest("verifyerror - 2"); + } + + public void testAnnotationsAndGenericsBCException_pr129704() { + runTest("annotations and generics leading to BCException"); + } + + public void testMethodTooBigAfterWeaving_pr138384() { + runTest("method too big"); + } + + public void testNotAtWithincode_pr138158_1() { + runTest("not at withincode - 1"); + } + + public void testNotAtWithincode_pr138158_2() { + runTest("not at withincode - 2"); + } + + public void testNotAtWithincode_pr138158_3() { + runTest("not at within - 3"); + } + + public void testNpeOnDup_pr138143() { + runTest("npe on duplicate method with ataj"); + } + + public void testPointcutsAndGenerics_pr137496_1() { + runTest("pointcuts and generics - B"); + } + + public void testPointcutsAndGenerics_pr137496_2() { + runTest("pointcuts and generics - D"); + } + + public void testPointcutsAndGenerics_pr137496_3() { + runTest("pointcuts and generics - E"); + } + + public void testPointcutsAndGenerics_pr137496_4() { + runTest("pointcuts and generics - F"); + } + + public void testPointcutsAndGenerics_pr137496_5() { + runTest("pointcuts and generics - G"); + } + + public void testPointcutsAndGenerics_pr137496_6() { + runTest("pointcuts and generics - H"); + } + + public void testAspectLibrariesAndASM_pr135001() { + runTest("aspect libraries and asm"); + } + + public void testStackOverflow_pr136258() { + runTest("stack overflow"); + } + + public void testIncorrectOverridesEvaluation13() { + runTest("incorrect overrides evaluation - 1.3"); + } + + public void testIncorrectOverridesEvaluation15() { + runTest("incorrect overrides evaluation - 1.5"); + } + + public void testAtWithinCodeBug_pr138798() { + runTest("atWithinCodeBug"); + } + + public void testReferencePCutInDeclareWarning_pr138215() { + runTest("Reference pointcut fails inside @DeclareWarning"); + } + + public void testReferencePCutInPerClause_pr138219() { + runTest("Can't use a FQ Reference pointcut in any pointcut expression referenced by a per-clause"); + } + + public void testReferencePCutInPerClause_pr130722() { + runTest("FQ Reference pointcut from perclause ref pc"); + } + + public void testDoubleAnnotationMatching_pr138223() { + runTest("Double at annotation matching (no binding)"); + } + + public void testSuperCallsInAtAspectJAdvice_pr139749() { + runTest("Super calls in @AspectJ advice"); + } + + public void testNoClassCastExceptionWithPerThis_pr138286() { + runTest("No ClassCastException with perThis"); + } + + public void testGenericAspectHierarchyWithBounds_pr147845() { + runTest("Generic abstract aspect hierarchy with bounds"); + } + + public void testJRockitBooleanReturn_pr148007() { + runTest("jrockit boolean fun"); + } + + public void testJRockitBooleanReturn2_pr148007() { + runTest("jrockit boolean fun (no aspects)"); + } + + public void testSyntheticAjcMembers_pr147711() { + runTest("synthetic ajc$ members"); + } + + // this next one reported as a bug by Rob Harrop, but I can't reproduce the failure yet... + // public void testAtAspectWithReferencePCPerClause_pr138220() { runTest("@Aspect with reference pointcut in perclause");} + + public void testJarChecking_pr137235_1() { + runTest("directory with .jar extension: source and outjar"); + } + + public void testJarChecking_pr137235_2() { + runTest("directory with .jar extension"); + } + + public void testMakePreMethodNPE_pr136393() { + runTest("NPE in makePreMethod"); + } + + public void testGetParameterSignatures_pr141730() { + runTest("new iprogramelement method getParameterSignatures"); + + checkGetParamSigOfMethod("stringMethod(java.lang.String)", "Ljava/lang/String;"); + checkGetParamSigOfMethod("main(java.lang.String[])", "[Ljava/lang/String;"); + checkGetParamSigOfMethod("multiMethod(java.lang.String[][])", "[[Ljava/lang/String;"); + } + + public void testGetParameterSignaturesWithGenerics_pr141730() { + runTest("new iprogramelement method getParameterSignatures with generics"); + + checkGetParamSigOfMethod("genericMethod(java.util.List<java.lang.String>)", "Ljava/util/List<Ljava/lang/String;>;"); + checkGetParamSigOfMethod("genericMethod2(MyGenericClass<java.lang.String,MyClass>)", + "LMyGenericClass<Ljava/lang/String;LMyClass;>;"); + } + + // public void testFunkyGenericErrorWithITDs_pr126355_2() { + // runTest("bizarre generic error with itds - 2"); + // // public class Pair<F,S> affected by pertarget aspect + // GenericsTests.verifyClassSignature(ajc,"Pair","<F:Ljava/lang/Object;S:Ljava/lang/Object;>Ljava/lang/Object;LIdempotentCache$ajcMightHaveAspect;;"); + // } + + public void testNoAspects() { + // setSystemProperty(WeavingAdaptor.WEAVING_ADAPTOR_VERBOSE,"true"); + runTest("Ensure no weaving without included aspects"); + } + + public void testWeaveinfoMessages() { + runTest("weaveinfo messages with include and exclude"); + } + + // tests that can't be included for some reason + + // Not valid whilst the ajc compiler forces debug on (ignores -g:none) - it will be green but is invalid, trust me + // public void testLongWindedMessages_pr129408() { runTest("long winded ataj messages");} + + // ---------------- helper methods --------------- + + private void checkGetParamSigOfMethod(String ipeLabel, String expectedParm) { + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.METHOD, ipeLabel); + assertNotNull("Couldn't find '" + ipeLabel + "' element in the tree", ipe); + List<char[]> l = ipe.getParameterSignatures(); + boolean eq = CharOperation.equals(((char[]) l.get(0)), expectedParm.toCharArray()); + assertTrue("expected parameter to be '" + expectedParm + "' but found '" + new String(((char[]) l.get(0))) + "'", eq); + } + + // /////////////////////////////////////// + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc152Tests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc152.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc152/AllTestsAspectJ152.java b/tests/src/test/java/org/aspectj/systemtest/ajc152/AllTestsAspectJ152.java new file mode 100644 index 000000000..05c311f50 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc152/AllTestsAspectJ152.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM + * 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.ajc152; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ152 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.5.2 tests"); + //$JUnit-BEGIN$ + suite.addTest(Ajc152Tests.suite()); + suite.addTest(SynchronizationTests.suite()); + suite.addTest(SynchronizationTransformTests.suite()); + //$JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc152/SynchronizationTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc152/SynchronizationTests.java new file mode 100644 index 000000000..47baa2940 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc152/SynchronizationTests.java @@ -0,0 +1,261 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * 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 implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc152; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * Work items, phase #1: lock()/unlock() x expose new joinpoints x parse new pcds x fix tjp string x preventing double unlock() + * messages/markers in structure model x error messages appropriate for attempting to use around advice on synchronization join + * points x making the use of lock/unlock conditional on an -Xjoinpoints:synchronization x activating the -Xjoinpoints options from + * LTW configurations rather than through batch/AJDT x ensure the lock/unlock joinpoints only appear when + * -Xjoinpoints:synchronization specified TAG: Completion of PHASE1 + * + * + * Work items, phase #2: transformation + * + * Design: transform all synchronized methods: public synchronized void m() { ... } => public void m() { synchronized (this) { ... } + * } + * + * x transforming synchronized methods x matching execution(synchronized * *(..)) for transformed code x warning message for + * execution() hitting a synchronized method x ensure verifier runs over generated code (done by just executing the code as part of + * the test spec) - Ant task support for -Xjoinpoints TAG: Completion of PHASE2 + * + * + * TAG: Finished + * + * Future work items: - optimize matching for transformed methods since we *know* the type we are locking on - supporting type + * pattern in lock() unlock() - this is not entirely trivial as kinded pointcuts do not usually have any residue - weaving messages + * include 'unusual' strings for the join points, not the same as revealed by thisJoinPoint.getSignature() in code - handler is + * probably similar - documentation - lazy translation of synchronized methods, rather than eager - applying execution(* *(..)) + * correctly to transformed methods (i.e. inside lock/unlock) - use knowledge of type containing synchronized methods to optimize + * matching of (un)lock() - not always needing residue - line number table is incorrect for transformed code (lock joinpoint has no + * line number) + * + * Notes: IllegalMonitorStateException Thrown to indicate that a thread has attempted to wait on an object's monitor or to notify + * other threads waiting on an object's monitor without owning the specified monitor. + * + * around advice won't work on SUN VMs (may be a bug that it does work on other VMs) since the monitor instructions are extracted to + * a separate method for proceed() calls and yet the VM seems to want them paired inside a single method. + * + * Really we only need to restrict the use of around advice on synchronization join points if the advice uses proceed() - but + * policing that is a little tough because (DOH) the AdviceAttribute field 'proceedCallSignatures' is never filled in (which records + * how many proceeds occur in the advice) - see where it isnt filled in at AdviceDeclaration.resolveStatements() in the loop that + * goes over the proceedCalls list. + * + * + * Problems: - Can't run it on a 1.2.1 runtime - just not practical + * + * + * Method transformation, example: + * + * public synchronized void m(); Code: Stack=2, Locals=1, Args_size=1 0: getstatic #2; //Field + * java/lang/System.err:Ljava/io/PrintStream; 3: ldc #3; //String hello 5: invokevirtual #4; //Method + * java/io/PrintStream.println:(Ljava/lang/String;)V 8: getstatic #2; //Field java/lang/System.err:Ljava/io/PrintStream; 11: ldc #5; + * //String world 13: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V 16: return LineNumberTable: line + * 4: 0 line 5: 8 line 6: 16 + * + * public void m2(); Code: Stack=2, Locals=3, Args_size=1 0: aload_0 1: dup 2: astore_1 3: monitorenter 4: getstatic #2; //Field + * java/lang/System.err:Ljava/io/PrintStream; 7: ldc #3; //String hello 9: invokevirtual #4; //Method + * java/io/PrintStream.println:(Ljava/lang/String;)V 12: getstatic #2; //Field java/lang/System.err:Ljava/io/PrintStream; 15: ldc + * #5; //String world 17: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V 20: aload_1 21: monitorexit + * 22: goto 30 25: astore_2 26: aload_1 27: monitorexit 28: aload_2 29: athrow 30: return Exception table: from to target type 4 22 + * 25 any 25 28 25 any + * + * Factors affecting transformation: - LDC in Java5 supports referring to a class literal, e.g. Foo.class whereas before Java5, it + * did not. This means if generating the synchronized() block for a static method from a preJava5 class then we have to generate a + * lot of crap to build the class object for locking and unlocking. The object is also stored in a local field of the type (if we + * follow the pattern of JDT/JAVAC) + */ + +public class SynchronizationTests extends XMLBasedAjcTestCase { + + // testing the new join points for monitorenter/monitorexit + public void testTheBasics_1() { + runTest("basic"); + } + + public void testTheBasics_2() { + runTest("basic - within"); + } + + public void testTheBasics_3() { + runTest("basic - within plus args"); + } + + public void testTheBasics_4() { + runTest("basic - within plus this"); + } // this null in static context + + public void testTheBasics_5() { + runTest("basic - within plus target"); + } // target null in static context? + + // testing parsing of the new PCDs lock/unlock + public void testParsing_1() { + runTest("parsing - lock"); + } + + public void testParsing_2() { + runTest("parsing - unlock"); + } + + public void testParsing_errors_1() { + runTest("parsing - error - lock"); + } + + public void testParsing_errors_2() { + runTest("parsing - error - unlock"); + } + + // testing parsing and matching with the new PCDs + public void testParsingAndMatching_1() { + runTest("parsing and matching - lock and static context"); + } + + public void testParsingAndMatching_2() { + runTest("parsing and matching - unlock and static context"); + } + + public void testParsingAndMatching_3() { + runTest("parsing and matching - lock and non-static context"); + } + + public void testParsingAndMatching_4() { + runTest("parsing and matching - unlock and non-static context"); + } + + public void testParsingAndMatching_5() { + runTest("parsing and matching - lock and non-static context"); + } + + public void testParsingAndMatching_6() { + runTest("parsing and matching - unlock and non-static context"); + } + + // using the new PCDs in a LTW environment + public void testUsingWithLTW_MissingFlag_1() { + runTest("using lock with LTW - missing flag"); + } + + public void testUsingWithLTW_MissingFlag_2() { + runTest("using unlock with LTW - missing flag"); + } + + public void testUsingWithLTW_1() { + runTest("using lock with LTW"); + } + + public void testUsingWithLTW_2() { + runTest("using unlock with LTW"); + } + + // multiple PCDs + public void testCombiningPCDs_1() { + runTest("combining pcds - lock and this"); + } + + public void testCombiningPCDs_2() { + runTest("combining pcds - unlock and this"); + } + + // useful examples + public void testUseful_1() { + runTest("a useful program"); + } // just uses within/args - matching the (un)lock jps + + public void testUseful_2() { + runTest("a useful program - with lock"); + } // uses lock/args + + // all the methods of thisJoinPoint + public void testThisJoinPoint_1() { + runTest("thisjoinpoint - monitor entry"); + } + + public void testThisJoinPoint_2() { + runTest("thisjoinpoint - monitor exit"); + } + + public void testDoubleMessagesOnUnlock() { + // AsmManager.setReporting("c:/foo.txt",true,true,true,true); + runTest("prevent double unlock weaving messages and model contents"); + // checkModel1(); + } + + // targetting 1.2 runtime - signature creation code in LazyClassGen.initializeTjp may not work + + // different advice kinds + public void testBeforeAdvice_1() { + runTest("before advice - lock"); + } + + public void testBeforeAdvice_2() { + runTest("before advice - unlock"); + } + + public void testAfterAdvice_1() { + runTest("after advice - lock"); + } + + public void testAfterAdvice_2() { + runTest("after advice - unlock"); + } + + public void testAroundAdvice_1() { + runTest("around advice - lock"); + } + + public void testAroundAdvice_2() { + runTest("around advice - unlock"); + } + + public void testLockingTJP() { + runTest("obtaining locked object through getArgs"); + } + + // binary weaving? + + // nested locking/unlocking + + // --- helpers + + // Half finished - could check there is only one relationship for unlock() rather than two - but + // that seems to be the case anyway (peculiar...) + // private void checkModel1() { + // // Verifies only one unlock relationship, not two + // IProgramElement unlockNode = + // AsmManager.getDefault().getHierarchy().findElementForLabel(AsmManager.getDefault().getHierarchy().getRoot(), + // IProgramElement.Kind.CODE,"unlock(void java.lang.Object.<unlock>(java.lang.Object))"); + // assertTrue("Couldn't find the unlock node",unlockNode!=null); + // List l = AsmManager.getDefault().getRelationshipMap().get(unlockNode); + // assertTrue("should be one entry :"+l,l!=null && l.size()==1); + // IRelationship ir = (IRelationship)l.get(0); + // System.err.println(ir); + // List targs = ir.getTargets(); + // System.err.println(targs.size()); + // System.err.println(targs.get(0)); + // } + + // --- + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(SynchronizationTests.class); + } + + protected File getSpecFile() { + return getClassResource("synchronization.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc152/SynchronizationTransformTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc152/SynchronizationTransformTests.java new file mode 100644 index 000000000..922f4c5b4 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc152/SynchronizationTransformTests.java @@ -0,0 +1,310 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * 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 implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc152; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.PrintStream; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.testing.util.TestUtil; +import org.aspectj.testing.util.TestUtil.LineStream; +import org.aspectj.weaver.ReferenceType; +import org.aspectj.weaver.ResolvedType; +import org.aspectj.weaver.World; +import org.aspectj.weaver.bcel.BcelObjectType; +import org.aspectj.weaver.bcel.BcelWorld; +import org.aspectj.weaver.bcel.LazyClassGen; +import org.aspectj.weaver.bcel.LazyMethodGen; + +/** + * Method transformation, example: + * + * public synchronized void m(); Code: Stack=2, Locals=1, Args_size=1 0: getstatic #2; //Field + * java/lang/System.err:Ljava/io/PrintStream; 3: ldc #3; //String hello 5: invokevirtual #4; //Method + * java/io/PrintStream.println:(Ljava/lang/String;)V 8: getstatic #2; //Field java/lang/System.err:Ljava/io/PrintStream; 11: ldc #5; + * //String world 13: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V 16: return LineNumberTable: line + * 4: 0 line 5: 8 line 6: 16 + * + * public void m2(); Code: Stack=2, Locals=3, Args_size=1 0: aload_0 1: dup 2: astore_1 3: monitorenter 4: getstatic #2; //Field + * java/lang/System.err:Ljava/io/PrintStream; 7: ldc #3; //String hello 9: invokevirtual #4; //Method + * java/io/PrintStream.println:(Ljava/lang/String;)V 12: getstatic #2; //Field java/lang/System.err:Ljava/io/PrintStream; 15: ldc + * #5; //String world 17: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V 20: aload_1 21: monitorexit + * 22: goto 30 25: astore_2 26: aload_1 27: monitorexit 28: aload_2 29: athrow 30: return Exception table: from to target type 4 22 + * 25 any 25 28 25 any + */ + +public class SynchronizationTransformTests extends XMLBasedAjcTestCase { + + private static boolean regenerate; + + static { + regenerate = false; + } + + private World world; + + public void testInvestigatingTransforming() { + runTest("investigation"); + checkMethod("Investigation", "b"); // similar output to One.b + checkMethod("Investigation", "c"); + checkMethod("Investigation", "d"); + checkMethod("Investigation", "e"); + } + + public void testTransform1() { + runTest("One"); + checkMethod("One", "b"); + checkMethod("One", "c"); + checkMethod("One", "e"); + } + + // before() on execution jp + public void testTransform2() { + runTest("Two"); + checkMethod("C", "ma"); + } + + public void testTransform2XlintOff() { + runTest("Two - xlintoff"); + checkMethod("C", "ma"); + } + + // after() returning/after() throwing on execution jp + // after() returning -> make all returns go through the same exit point and make + // it call the advice + // after() throwing -> add a catch block that calls the advice + public void testTransform3() { + runTest("Three"); + checkMethod("C", "m3"); + checkMethod("C", "m32"); + checkMethod("C", "m33"); // like m() but synchronized block + checkMethod("C", "m34"); // like m2() but synchronized block + } + + // like testTransform3() but pointcuts explicitly specify synchronized + public void testTransform4() { + runTest("Four"); + checkMethod("C", "m"); + checkMethod("C", "m2"); + } + + // Java5 variant + public void testStaticSynchronizedMethodTransformJava5() { + runTest("Five - Java5"); + checkMethod("C", "b"); + } + + // < Java5 variant + public void testStaticSynchronizedMethodTransformPreJava5() { + runTest("Six - preJava5"); + checkMethod("C", "bbb"); + } + + public void testLockPcdOnTransformedNonStaticMethod() { + runTest("lock pcd on transformed non-static method"); + } + + public void testUnlockPcdOnTransformedNonStaticMethod() { + runTest("unlock pcd on transformed non-static method"); + } + + public void testLockPcdOnTransformedStaticMethod() { + runTest("lock pcd on transformed static method - J5"); + } + + public void testUnlockPcdOnTransformedStaticMethod() { + runTest("unlock pcd on transformed static method - J5"); + } + + public void testLockPcdOnTransformedStaticMethodPreJ5() { + runTest("lock pcd on transformed static method - preJ5"); + } + + public void testUnlockPcdOnTransformedStaticMethodPreJ5() { + runTest("unlock pcd on transformed static method - preJ5"); + } + + public void testJoinpointsEnabledButNoLock() { + runTest("joinpoints enabled but no lock"); + } + + public void testTransformWithLTW() { + runTest("transform with LTW"); + } + + public void testTransformStaticMethodPreJava5() { + runTest("transform static method - preJ5"); + } + + public void testTransformStaticMethodPreJava5_2() { + runTest("transform static method - packages - preJ5"); + } + + // more complex code sequences... + public void testOtherTargeters() { + runTest("other targeters"); + } + + // --- infrastructure below + + private void checkMethod(String typename, String methodname) { + LazyMethodGen m = getMethod(typename, methodname); + File expectedF = new File(".." + File.separator + "tests" + File.separator + "features152" + File.separator + + "synchronization" + File.separator + "transformed" + File.separator + "expected" + File.separator + typename + + "." + methodname + ".txt"); + if (regenerate) { + saveMethod(expectedF, m); + } else { + compareMethod(expectedF, m); + } + } + + private LazyMethodGen getMethod(String typename, String methodname) { + BcelObjectType type = getBcelObjectFor(typename); + LazyClassGen lcg = type.getLazyClassGen(); + List<LazyMethodGen> methods = lcg.getMethodGens(); + for (LazyMethodGen element: methods) { + if (element.getName().equals(methodname)) { + return element; + } + } + return null; + } + + private BcelObjectType getBcelObjectFor(String clazzname) { + ensureWorldSetup(); + ResolvedType rt = world.resolve(clazzname); + if (rt == null) + fail("Couldn't find class " + clazzname); + ReferenceType rtt = (ReferenceType) rt; + BcelObjectType bot = (BcelObjectType) rtt.getDelegate(); + return bot; + } + + private void ensureWorldSetup() { + if (world == null) { + world = new BcelWorld(getSandboxDirectory() + File.pathSeparator + System.getProperty("java.class.path")); + } + } + + protected Method getMethod(JavaClass cl, String methodname) { + Method[] methods = cl.getMethods(); + for (int i = 0; i < methods.length; i++) { + Method m = methods[i]; + if (m.getName().equals(methodname)) { + return m; + } + } + return null; + } + + public void dump(String title, String[] strs) { + System.err.println(title); + for (int i = 0; i < strs.length; i++) { + System.err.println(i + ") " + strs[i]); + } + } + + private void compareMethod(File f, LazyMethodGen m) { + BufferedReader fr; + if (!f.exists()) { + fail("Can't find expected output file " + f); + } + try { + // Load the file in + fr = new BufferedReader(new FileReader(f)); + String line = null; + List<String> originalFileContents = new ArrayList<>(); + while ((line = fr.readLine()) != null) + originalFileContents.add(line); + String[] fileContents = (String[]) originalFileContents.toArray(new String[] {}); + + LineStream ls = new TestUtil.LineStream(); + m.print(ls, null); + String[] lines = ls.getLines(); + for (int i = 0; i < lines.length; i++) { + String existingLine = lines[i]; + if (fileContents[i].indexOf("MethodDeclarationLineNumber") == -1 && !fileContents[i].equals(existingLine)) { + dump("File contents:", fileContents); + dump("Actual:", lines); + fail("\nDifference in method " + m.getName() + " on line " + i + " between the expected:\n" + fileContents[i] + + "\nand the found:\n" + existingLine); + } + } + } catch (Exception e) { + fail("Unexpected exception saving weaving messages:" + e); + } + } + + private String stringify(List<String> l) { + StringBuffer result = new StringBuffer(); + for (Iterator<String> iter = l.iterator(); iter.hasNext();) { + String str = iter.next(); + result.append(str); + result.append("\n"); + } + return result.toString(); + } + + private void saveMethod(File f, LazyMethodGen m) { + System.out.println("Saving method into " + f.getName()); + try { + m.print(new PrintStream(new FileOutputStream(f)), null); + } catch (FileNotFoundException e) { + e.printStackTrace(); + fail("Couldn't store the method in file " + f); + } + } + + // --- helpers + + // Half finished - could check there is only one relationship for unlock() rather than two - but + // that seems to be the case anyway (peculiar...) + // private void checkModel1() { + // // Verifies only one unlock relationship, not two + // IProgramElement unlockNode = + // AsmManager.getDefault().getHierarchy().findElementForLabel(AsmManager.getDefault().getHierarchy().getRoot(), + // IProgramElement.Kind.CODE,"unlock(void java.lang.Object.<unlock>(java.lang.Object))"); + // assertTrue("Couldn't find the unlock node",unlockNode!=null); + // List l = AsmManager.getDefault().getRelationshipMap().get(unlockNode); + // assertTrue("should be one entry :"+l,l!=null && l.size()==1); + // IRelationship ir = (IRelationship)l.get(0); + // System.err.println(ir); + // List targs = ir.getTargets(); + // System.err.println(targs.size()); + // System.err.println(targs.get(0)); + // } + + // --- + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(SynchronizationTransformTests.class); + } + + protected File getSpecFile() { + return getClassResource("synchronization.xml"); + } + + public void tearDown() { + world = null; + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc152/ajc152.xml b/tests/src/test/java/org/aspectj/systemtest/ajc152/ajc152.xml new file mode 100644 index 000000000..c7a917688 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc152/ajc152.xml @@ -0,0 +1,777 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.5.2 Tests --> +<suite> + + <ajc-test dir="bugs152/pr135001" title="aspect libraries and asm"> + <compile files="AbstractAspect.java" outjar="lib.jar" options="-1.5"/> + <compile files="Foo.java,ConcreteAspect.java" classpath="lib.jar" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-call(void Foo.foo())' in Type 'Foo' (Foo.java:3) advised by around advice from 'ConcreteAspect' (AbstractAspect.java:5)"/> + </compile> + <run class="Foo"> + <stderr> + <line text="In the advice!"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr122253" title="aspects14 - persingleton"> + <compile files="Singleton.java"/> + <run class="Singleton"> + <stderr> + <line text="hasAspect? true : true"/> + <line text="aspectOf? SingletonInstance : SingletonInstance"/> + <line text="hasAspect? true : true"/> + <line text="aspectOf? SingletonInstance : SingletonInstance"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr122253" title="aspects14 - percflow"> + <compile files="PerCflow.java"/> + <run class="PerCflow"> + <stderr> + <line text="before"/> + <line text="hasAspect? false : false"/> + <line text="aspectOf? null : null"/> + <line text="during"/> + <line text="hasAspect? true : true"/> + <line text="aspectOf? PerCflowInstance : PerCflowInstance"/> + <line text="after"/> + <line text="hasAspect? false : false"/> + <line text="aspectOf? null : null"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr122253" title="aspects14 - perthis"> + <compile files="PerThis.java"/> + <run class="PerThis"> + <stderr> + <line text="before"/> + <line text="hasAspect? false : false"/> + <line text="aspectOf? null : null"/> + <line text="during"/> + <line text="hasAspect? true : true"/> + <line text="aspectOf? PerThisInstance : PerThisInstance"/> + <line text="after"/> + <line text="hasAspect? false : false"/> + <line text="aspectOf? null : null"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr122253" title="aspects14 - pertypewithin"> + <compile files="PerTypeWithin.java"/> + <run class="PerTypeWithin"> + <stderr> + <line text="before"/> + <line text="hasAspect? false : false"/> + <line text="aspectOf? null : null"/> + <line text="during"/> + <line text="hasAspect? true : true"/> + <line text="aspectOf? PerTypeWithinInstance : PerTypeWithinInstance"/> + <line text="after"/> + <line text="hasAspect? false : false"/> + <line text="aspectOf? null : null"/> + </stderr> + </run> + </ajc-test> + + + <ajc-test dir="bugs152/pr148536" title="NPE for unknown annotation"> + <compile files="Bug.java" options="-1.5"> + <message kind="error" line="2" text="SomeAnnotation cannot be resolved to a type"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs152/pr148537" title="classcast annotation value"> + <compile files="MyClass.java,MyAspect.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs152/pr148545" title="nosuchmethoderror for privileged aspect"> + <compile files="MyClass.java,MyAspect.java,MyAnnotation.java,MyEnum.java" options="-1.5"/> + <run class="MyClass"/> + </ajc-test> + + <ajc-test dir="bugs152/pr148545" title="nosuchmethoderror for privileged aspect - 2"> + <compile files="MyClass.java,MyAspect2.java,MyAnnotation.java,MyEnum.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void MyClass.test())' in Type 'MyClass' (MyClass.java:8) advised by around advice from 'MyAspect2' (MyAspect2.java:5)"/> + </compile> + <run class="MyClass"/> + </ajc-test> + + <ajc-test dir="bugs152/pr126355" title="bizarre generic error with itds"> + <compile files="Pair.java" options="-1.5"/> + <compile files="Test.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs152/pr126355" title="bizarre generic error with itds - 2"> + <compile files="Pair.java" options="-1.5"/> + <compile files="Test.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs152/pr145950" title="fails to discover Serializable"> + <compile files="Indirect.java" options="-1.5 -XaddSerialVersionUID"/> + <run class="Indirect"> + <stderr> + <line text="SerialVersionUID is "/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr132349" title="ITD on inner type of generic type"> + <compile files="TopLevelType.java" options="-1.5"/> + <run class="TopLevelType"/> + </ajc-test> + + + <ajc-test dir="bugs152/pr144602" title="atAJ perthis aspect verification error"> + <compile files="MyAspect.aj" options="-1.5"/> + <run class="MyAspect"/> + </ajc-test> + + <ajc-test dir="bugs152/pr132349" title="ITD on inner type of generic type - 2"> + <compile files="TopLevelType2.java" options="-1.5"> + <message kind="error" line="12"/> <!-- error message is currently crap - its a parser message --> + </compile> + </ajc-test> + + <ajc-test dir="bugs152/pr132349" title="ITD on inner type of generic type - 3"> + <compile files="TopLevelType3.java" options="-1.5"> + <message kind="error" line="12" text="Cannot make inter-type declarations on parameterized types"/> + <message kind="error" line="7" text="The method someMethod() is undefined for the type TopLevelType3.NestedType"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs152/pr135865" title="misbehaving declare annotation"> + <compile files="B.java,A.java" options="-1.5 -Xlint:ignore"> + <!--message kind="weave" text="Join point 'method-call(void B.foo())' in Type 'A' (A.java:32) advised by before advice from 'Aspect' (A.java:22) [with runtime test]"/> + <message kind="weave" text="Join point 'method-call(void A.foo())' in Type 'A' (A.java:33) advised by before advice from 'Aspect' (A.java:22) [with runtime test]"/> + <message kind="weave" text="' void B.goo()' (A.java:7) is annotated with @Ann method annotation from 'Aspect' (A.java:27)"/--> + </compile> + <run class="A"> + <stdout> + <line text="Join point: call(void B.foo())"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr135865" title="misbehaving declare annotation - 2"> + <compile files="A.java,B.java" options="-1.5 -Xlint:ignore"> + <!--message kind="weave" text="Join point 'method-call(void B.foo())' in Type 'A' (A.java:32) advised by before advice from 'Aspect' (A.java:22) [with runtime test]"/> + <message kind="weave" text="Join point 'method-call(void A.foo())' in Type 'A' (A.java:33) advised by before advice from 'Aspect' (A.java:22) [with runtime test]"/> + <message kind="weave" text="' void B.goo()' (A.java:7) is annotated with @Ann method annotation from 'Aspect' (A.java:27)"/--> + </compile> + <run class="A"> + <stdout> + <line text="Join point: call(void B.foo())"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr129704" title="annotations and generics leading to BCException"> + <compile files="A.java" options="-1.5"/> + <run class="A"> + <stderr> + <line text="@Marker()"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr136026" title="verifyerror"> + <compile files="CflowOrder.java" options="-1.5"/> + <run class="CflowOrder"/> + </ajc-test> + + <ajc-test dir="bugs152/pr136026" title="verifyerror - 2"> + <compile files="CflowOrderOriginal.java" options="-1.5"/> + <run class="bugs.CflowOrderOriginal"> + <stderr> + <line text="Starting CflowOrder.main(..)"/> + <line text="topAnnotated"/> + <!--line text=" Join point: call(void bugs.CflowOrderOriginal.A.foo())"/> + <line text=" Enclosing join point: execution(void bugs.CflowOrderOriginal.A.main(String[]))"/> + <line text=" Annotation: @bugs.CflowOrderOriginal$Annotation(value=A.foo)"/--> + <line text="nonTopAnnotated"/> + <!--line text=" Join point: call(void bugs.CflowOrderOriginal.B.foo())"/> + <line text=" Enclosing join point: execution(void bugs.CflowOrderOriginal.A.foo())"/> + <line text=" Annotation: @bugs.CflowOrderOriginal$Annotation(value=B.foo)"/--> + <line text="B.foo()"/> + <line text="A.foo()"/> + <line text="A.main(..)"/> + <line text="Ending CflowOrder.main(..)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr136258" title="stack overflow"> + <compile files="StatisticsTypeImpl.java" options="-1.5"/> + <run class="StatisticsTypeImpl"/> + </ajc-test> + + <ajc-test dir="bugs152/pr138384" title="method too big"> + <compile files="BigMethod.java" options="-1.5"> <!-- will be 67628 bytes in the big method --> + <message kind="error" line="1" text="problem generating method BigMethod.i_am_a_big_method : Code size too big: 67629"/> + </compile> + <!--run class="BigMethod"/--> + </ajc-test> + + <ajc-test dir="bugs152/pr138798" title="atWithinCodeBug"> + <compile files="ErrorHandling.aj" options="-1.5"/> + <run class="ErrorHandling"> + <stderr> + <line text="Caught in foo"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr138158" title="not at withincode - 1"> + <compile files="Boo.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-call(void Boo.m())' in Type 'Boo' (Boo.java:9) advised by before advice from 'X' (Boo.java:19)"/> + </compile> + <run class="Boo"/> + </ajc-test> + + <ajc-test dir="bugs152/pr138158" title="not at within - 3"> + <compile files="Doo.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-call(void java.io.PrintStream.println(java.lang.String))' in Type 'Soo' (Doo.java:20) advised by before advice from 'X' (Doo.java:25)"/> + </compile> + <run class="Doo"/> + </ajc-test> + + <ajc-test dir="bugs152/pr138158" title="not at withincode - 2"> + <compile files="Foo.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-call(void java.io.PrintStream.println(java.lang.String))' in Type 'Foo' (Foo.java:14) advised by before advice from 'X' (Foo.java:26)"/> + <message kind="weave" text="Join point 'method-call(void java.io.PrintStream.println(java.lang.String))' in Type 'Foo' (Foo.java:18) advised by before advice from 'X' (Foo.java:23)"/> + </compile> + <run class="Foo"/> + </ajc-test> + + <ajc-test dir="bugs152/pr137568" title="complicated generics declaration"> + <compile files="C.java" options="-emacssym -1.5"/> + <run class="C"/> + </ajc-test> + + <ajc-test dir="bugs152/pr138143" title="npe on duplicate method with ataj"> + <compile files="AspectClass.java" options="-1.5"> + <message kind="error" line="7" text="Duplicate method incomingMessage() in type AspectClass"/> + <message kind="error" line="12" text="Duplicate method incomingMessage() in type AspectClass"/> + <!-- in e37 the TypeDeclaration.traverse(ASTVisitor,CompilationUnitScope) no longer checks 'ignoreFurtherInvestigation' so gets further --> + <message kind="warning" line="11" text="no match for this type name: Incoming [Xlint:invalidAbsoluteTypeName]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs152/pr137496" title="pointcuts and generics - B"> + <compile files="B.java" options="-1.5 -showWeaveInfo"> + <!--message kind="weave" text="Join point 'method-call(java.lang.String C.pm(java.lang.String))' in Type 'B' (B.java:20) advised by before advice from 'X' (B.java:26)"/--> + <message kind="weave" text="Join point 'method-call(java.lang.Object C.pm(java.lang.Object))' in Type 'B' (B.java:20) advised by before advice from 'X' (B.java:26)"/> + <!--message kind="weave" text="Join point 'method-call(java.lang.String C.pm2(java.lang.String))' in Type 'B' (B.java:21) advised by before advice from 'X' (B.java:27)"/--> + </compile> + <run class="B"> + <stderr> + <line text="advice"/> + <line text="foo"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr137496" title="pointcuts and generics - D"> + <compile files="D.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-call(java.lang.String CImpl.pm(java.lang.String))' in Type 'D' (D.java:20) advised by before advice from 'X' (D.java:26)"/> + <message kind="weave" text="Join point 'method-call(java.lang.String CImpl.pm2(java.lang.String))' in Type 'D' (D.java:21) advised by before advice from 'X' (D.java:27)"/> + </compile> + <run class="D"> + <stderr> + <line text="advice"/> + <line text="foo"/> + <line text="advice2"/> + <line text="foo"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr137496" title="pointcuts and generics - E"> + <compile files="E.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-call(java.lang.Object C.pm(java.lang.Object))' in Type 'E' (E.java:18) advised by before advice from 'X' (E.java:23)"/> + </compile> + <run class="E"> + <stderr> + <line text="advice"/> + <line text="foo"/> + </stderr> + </run> + </ajc-test> + + + <ajc-test dir="bugs152/pr137496" title="pointcuts and generics - F"> + <compile files="F.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-call(java.lang.Object C.pm(java.lang.Object))' in Type 'F' (F.java:18) advised by before advice from 'X' (F.java:23)"/> + </compile> + <run class="F"> + <stderr> + <line text="advice"/> + <line text="foo"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr137496" title="pointcuts and generics - G"> + <compile files="G.java" options="-1.5 -showWeaveInfo"> + <message kind="warning" line="23" text="advice defined in X has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + <run class="G"> + <stderr> + <line text="foo"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr137496" title="pointcuts and generics - H"> + <compile files="H.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-call(java.lang.Object C.pm(java.lang.Object))' in Type 'H' (H.java:20) advised by around advice from 'X' (H.java:26)"/> + </compile> + <run class="H"> + <stderr> + <line text="advice"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/binaryDecp" title="incorrect overrides evaluation - 1.3"> + <compile files="SubClassLoader.java,SubSubClassLoader.java" options="-1.3" outjar="lib.jar"/> + <compile files="X.aj" inpath="lib.jar" options="-showWeaveInfo"> + <message kind="weave" text="Setting superclass of type 'SubSubClassLoader' (SubSubClassLoader.java) to 'SubClassLoader' (X.aj)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs152/binaryDecp" title="incorrect overrides evaluation - 1.4"> + <compile files="IsItSynthetic.java" options="-1.5"/> + <compile files="Top.java" options="-source 1.5 -target 1.5" outjar="a.jar"/> + <compile files="Bottom.java" classpath="$sandbox/a.jar" options="-source 1.4 -target 1.4" outjar="b.jar"/> + <compile files="Middle.java" classpath="$sandbox/a.jar" options="-source 1.4 -target 1.4" outjar="c.jar"/> + <compile files="X2.aj" classpath="$sandbox/a.jar;$sandbox/b.jar;$sandbox/c.jar" options="-Xlint:ignore" outjar="x.jar"/> + <run class="Bottom" classpath="a.jar;b.jar;c.jar;x.jar" ltw="aop.xml"/> + <!--message kind="weave" text="Setting superclass of type 'Bottom' (Bottom.java) to 'Middle' (X2.aj)"/--> + </ajc-test> + + <ajc-test dir="bugs152/binaryDecp" title="incorrect overrides evaluation - 1.5"> + <compile files="SubClassLoader.java,SubSubClassLoader.java" options="-1.5" outjar="lib.jar"/> + <compile files="X.aj" inpath="lib.jar" options="-showWeaveInfo"> + <message kind="weave" text="Setting superclass of type 'SubSubClassLoader' (SubSubClassLoader.java) to 'SubClassLoader' (X.aj)"/> + </compile> + </ajc-test> + + + <ajc-test dir="bugs152/pr129282" title="no unnecessary declaration of thrown exception warning - 1"> + <compile files="MethodExecution.aj" options="-warn:+unusedThrown"> + <message kind="warning" line="30" text="The declared exception SQLException is not actually thrown by the method needsToThrow() from type C"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs152/pr129282" title="no unnecessary declaration of thrown exception warning - 2"> + <compile files="MethodCall.aj" options="-warn:+unusedThrown"> + <message kind="warning" line="36" text="The declared exception FileNotFoundException is not actually thrown by the method m4() from type C1"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs152/pr129282" title="no unnecessary declaration of thrown exception warning - 3"> + <compile files="InnerMethodCall.aj" options="-warn:+unusedThrown"> + <message kind="warning" line="44" text="The declared exception FileNotFoundException is not actually thrown by the method m4() from type C1"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs152/pr129282" title="no unnecessary declaration of thrown exception warning - 4"> + <compile files="AdviceExecution.aj" options="-1.5 -warn:+unusedThrown"/> + </ajc-test> + + <ajc-test dir="bugs152/pr129282" title="no unnecessary declaration of thrown exception warning - 5"> + <compile files="ExceptionHandler.aj" options="-warn:+unusedThrown"> + <message kind="warning" line="34" text="The declared exception MyException is not actually thrown by the method throwingMethod2() from type C"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs152/pr129282" title="no unnecessary declaration of thrown exception warning - 6"> + <compile files="Initialization.aj" options="-warn:+unusedThrown"/> + </ajc-test> + + <ajc-test dir="bugs152/pr129282" title="no unnecessary declaration of thrown exception warning - 7"> + <compile files="ConstructorCall.aj" options="-warn:+unusedThrown"/> + </ajc-test> + + <ajc-test dir="bugs152/pr129282" title="no unnecessary declaration of thrown exception warning - 8"> + <compile files="ConstructorExecution.aj" options="-warn:+unusedThrown"/> + </ajc-test> + + <ajc-test dir="bugs152/pr129282" title="no unnecessary declaration of thrown exception warning - 9"> + <compile files="MethodCallInDiffClass.aj" options="-warn:+unusedThrown"/> + </ajc-test> + + <ajc-test dir="bugs152/pr129282" title="no unnecessary declaration of thrown exception warning - 10"> + <compile files="InnerMethodCall2.aj" options="-warn:+unusedThrown"/> + </ajc-test> + + <ajc-test dir="bugs152/pr138215" pr="138215" title="Reference pointcut fails inside @DeclareWarning"> + <compile files="pr138215.aj" options="-1.5"> + <message kind="warning" line="17" text="no foos please"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs152/pr138219" pr="138219" title="Can't use a FQ Reference pointcut in any pointcut expression referenced by a per-clause"> + <compile files="PerThisWithReference.aj,SomeOtherType.aj,RegularPCWithReference.aj" options="-1.5"> + </compile> + <run class="PerThisWithReference"> + <stdout> + <line text="before PerThisWithReference:1"/> + <line text="before PerThisWithReference:2"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr130722" pr="130722" title="FQ Reference pointcut from perclause ref pc"> + <compile files="test/Test.java,test/PointcutConsumer.aj,test1/PointcutProvider.aj"/> + </ajc-test> + + <ajc-test dir="bugs152/pr138220" pr="138220" title="@Aspect with reference pointcut in perclause"> + <compile files="AtAspectWithPerClause.aj" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs152/pr144465" title="ltw with serialversionUID creation"> + <compile files="BigHorribleClass.java"/> + <compile files="AnAspect.java" options="-1.4"/> + <run class="BigHorribleClass" ltw="aop1.xml"> + <stderr> + <line text="weaveinfo Join point 'staticinitialization(void BigHorribleClass.<clinit>())'"/> + <line text="SerialVersionUID is "/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr125480" title="aop.xml aspect inheriting abstract method "> + <compile files="HelloWorld.java"/> + <compile files="AbstractMethods.aj, ConcreteMethods.aj" options="-1.5"/> + <run class="HelloWorld" ltw="aop-tracing.xml"> + <stdout> + <line text="advice running"/> + <line text="Hello World!"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr125480/case2" title="aop.xml aspect inheriting abstract method - code style"> + <compile files="HelloWorld.java"/> + <compile files="AbstractMethods.aj, ConcreteMethods.aj" options="-1.5"/> + <run class="HelloWorld" ltw="aop-tracing.xml"> + <stdout> + <line text="advice running"/> + <line text="Hello World!"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr142466" title="aop.xml aspect inheriting but not concretizing abstract method"> + <compile files="HelloWorld.java"/> + <compile files="AbstractMethods.aj, ConcreteMethods.aj" options="-1.5"/> + <run class="HelloWorld" ltw="aop-tracing.xml"> + <stderr> + <line text="error Abstract method 'void ConcreteMethods.foo(int)' cannot be concretized in XML:"/> + <line text="error Concrete-aspect 'TraceHelloWorld' could not be registered"/> + <line text="warning failure(s) registering aspects. Disabling weaver for class loader"/> + </stderr> + <stdout> + <line text="Hello World!"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr142466/case2" title="aop.xml aspect inheriting but not concretizing abstract method - 2"> + <compile files="HelloWorld.java"/> + <compile files="AbstractMethods.aj, ConcreteMethods.aj" options="-1.5"/> + <run class="HelloWorld" ltw="aop-tracing.xml"> + <stderr> + <line text="error Abstract method 'void AbstractMethods.test()' cannot be concretized in XML"/> + <line text="error Concrete-aspect 'TraceHelloWorld' could not be registered"/> + <line text="warning failure(s) registering aspects. Disabling weaver for class loader"/> + </stderr> + <stdout> + <line text="Hello World!"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr138223" pr="138223" title="Double at annotation matching (no binding)"> + <compile files="DoubleAnnotationMatching.aj" options="-1.5"> + </compile> + <run class="DoubleAnnotationMatching"> + <stderr> + <line text="advice running at execution(void Foo.a())"/> + <line text="advice running at execution(void TxTrueFoo.a())"/> + <line text="advice running at execution(void TxTrueFoo.b())"/> + <line text="advice running at execution(void TxTrueFoo.c())"/> + <line text="advice running at execution(void TxFalseFoo.a())"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr138286" pr="138286" title="No ClassCastException with perThis"> + <compile files="A.aj" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'initialization(void A.<init>())' in Type 'A' (A.aj:9) advised by before advice from 'A' (A.aj:13) [with runtime test]"/> + <message kind="weave" text="Join point 'initialization(void Soo.<init>())' in Type 'Soo' (A.aj:31) advised by before advice from 'A' (A.aj:13) [with runtime test]"/> + <message kind="weave" text="Join point 'initialization(void Goo.<init>())' in Type 'Goo' (A.aj:27) advised by before advice from 'A' (A.aj:13) [with runtime test]"/> + <message kind="weave" text="Join point 'initialization(void Foo.<init>())' in Type 'Foo' (A.aj:25) advised by before advice from 'A' (A.aj:13) [with runtime test]"/> + <message kind="weave" text="Join point 'initialization(void Boo.<init>())' in Type 'Boo' (A.aj:29) advised by before advice from 'A' (A.aj:13) [with runtime test]"/> + </compile> + <run class="A"> + <stderr> + <line text="class Foo"/> + <line text="class Boo"/> + <line text="class Boo"/> <!-- this one is because of the super() call in Soo's default ctor --> + <line text="class Soo"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr139749" pr="139749" title="Super calls in @AspectJ advice"> + <compile files="AroundAdvicePassingPjpAsArgToSuper.java" options="-1.5"> + </compile> + <run class="a.b.c.AroundAdvicePassingPjpAsArgToSuper"/> + </ajc-test> + + <ajc-test dir="bugs152/pr137235" pr="137235" + title="directory with .jar extension: source and outjar"> + <compile files="directory.jar/Hello.java" outjar="directory.jar/run.custom"/> + <run class="Hello" classpath="$sandbox/directory.jar/run.custom"> + <stdout> + <line text="Hello Java"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr137235" pr="137235" + title="directory with .jar extension" > + <compile files="directory.jar/Before.java" outjar="directory.jar/inOne.custom" options="-1.4"/> + <compile files="directory.jar/BeforeExec.aj" outjar="directory.jar/inTwo" options="-1.4"/> + <compile files="directory.jar/Rename.aj" outjar="directory.jar/weave.jar" options="-1.4"/> + <compile files="directory.jar/Hello.java" inpath="directory.jar/inOne.custom,directory.jar/inTwo" aspectpath="directory.jar/weave.jar" outjar="directory.jar/outJar.jar"/> + <run class="Hello" classpath="$sandbox/directory.jar/outJar.jar,$sandbox/directory.jar/weave.jar"> + <stdout> + <line text="Before call"/> + <line text="Before execution"/> + <line text="Hello AspectJ not just Java"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr136393" title="NPE in makePreMethod"> + <compile files="World.aj" options="-1.5"> + <message kind="warning" line="10" text="this affected type is not exposed to the weaver: java.lang.String [Xlint:typeNotExposedToWeaver]"/> + <message kind="error" line="11" text="h cannot be resolved"/> + <message kind="error" line="16" text="Stystems cannot be resolved"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs152/pr135068" title="ltw verifyerror"> + <compile files="C.java,Ajava.java" options="-1.5 -XnoInline"/> + <run class="C"/> + </ajc-test> + + <ajc-test dir="bugs152/pr135068" title="ltw verifyerror - 2"> + <compile files="C2.java,Ajava2.java" options="-1.5 -XnoInline"> + <message kind="error" line="13" text="advice can not be declared static"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs152/pr135068" title="ltw verifyerror - 3"> + <compile files="t/C.java" options="-1.5"/> + <compile files="t/Ajava.java" options="-1.5"> + <message kind="warning" line="13" text="advice defined"/> + </compile> + <run class="t.C" ltw="aop.xml"/> + </ajc-test> + + <ajc-test dir="bugs152/pr135068" title="ltw verifyerror - 4"> + <compile files="t/C2.java" options="-1.5"/> + <compile files="t/Ajava2.java" options="-1.5"> + <message kind="error" line="13" text="advice can not be declared static"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs152/pr142165" title="broken concretization"> + <compile files="C.java" options="-1.5"/> + <compile files="A.java" options="-1.5"/> + <run class="C" ltw="aop.xml"> + <stderr> + <line text="warning at Type 'AA' (no debug info available)::0 no match for this type name: SomeType [Xlint:invalidAbsoluteTypeName]"/> + <line text="foo running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr142165" title="broken concretization - 2"> + <compile files="C.java" options="-1.5"/> + <compile files="A.java" options="-1.5"/> + <run class="C" ltw="aop2.xml"> + <stderr> + <line text="foo running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr142165" title="broken concretization - 3"> + <compile files="C.java" options="-1.5"/> + <compile files="A.java" options="-1.5"/> + <run class="C" ltw="aop3.xml"> + <stderr> + <line text="advice"/> + <line text="foo running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr134425" title="super ITDs"> + <compile files="Derived.aj" options="-1.5"/> + <run class="Derived"/> + </ajc-test> + + <ajc-test dir="bugs152/pr128443" title="covariance and decp - 1"> + <compile files="Covariance.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs152/pr147701" title="package for exception ignored"> + <compile files="TestBean.java" options="-1.5"/> + <run class="a.b.c.TestBean"/> + </ajc-test> + + <ajc-test dir="bugs152/pr147701" title="package for exception ignored - 2"> + <compile files="TestBean2.java" options="-1.5"/> + <run class="a.b.c.TestBean2"/> + </ajc-test> + + <ajc-test dir="bugs152/pr147701" title="package for exception ignored - 3"> + <compile files="TestBean3.java" options="-1.5"> + <message kind="error" text="@DeclareParents: defaultImpl="a.b.c.Impl" does not implement the interface 'a.b.c.I'"/> + </compile> + </ajc-test> + + <!-- wont work whilst the compiler BuildArgParser.setDebugOptions is always switching debug on --> + <ajc-test dir="bugs152/pr129408" title="long winded ataj messages"> + <compile files="AtAj.java" options="-XterminateAfterCompilation -g:none -1.5"/> + <compile files="C.java" options="-g:none -1.5"/> + <run class="C" ltw="aop.xml"> + <!-- should check for expected stderr output here --> + </run> + </ajc-test> + + <ajc-test dir="ltw" + title="Ensure no weaving without included aspects" + keywords="reweavable"> + <compile + files="TestMain.java, Main.java" + > + </compile> + <run class="TestMain" ltw="aop-optionsonly.xml"> + <stdout> + <line text="Main.main"/> + <line text="Main.test1"/> + <line text="Main.test2"/> + </stdout> + <stderr> + <line text="info AspectJ Weaver Version"/> + <line text="info register classloader org.aspectj.weaver.loadtime.WeavingURLClassLoader"/> + <line text="info using"/> + <line text="info no aspects registered. Disabling weaver for class loader org.aspectj.weaver.loadtime.WeavingURLClassLoader"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="ltw" title="weaveinfo messages with include and exclude"> + <compile files="EmptyTest1.java, EmptyTest2.java"/> + <compile files="EmptyAspect.aj"/> + <run class="EmptyTest1" ltw="aop-emptytests.xml"> + <stdout> + <line text="EmptyTest1.main()"/> + <line text="EmptyTest2.main()"/> + </stdout> + <stderr> + <line text="info AspectJ Weaver Version"/> + <line text="info register classloader org.aspectj.weaver.loadtime.WeavingURLClassLoader"/> + <line text="info using configuration"/> + <line text="info register aspect EmptyAspect"/> + <line text="debug weaving"/> + <line text="debug not weaving"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr147845" title="Generic abstract aspect hierarchy with bounds"> + <compile files="GenericAspectHierarchy.aj" options="-1.5"> + <message kind="warning" line="25" text="a match"/> + <message kind="warning" line="27" text="a match"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs152/pr147801" title="duplicate bridge methods"> + <compile files="Advisor.aj" inpath="foo.jar" options="-1.5"/> + <run class="Foo"> + <stderr> + <line text="x"/> + <line text="1) public Sub Foo.getParameterMetaData() throws MyException"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr148007" title="jrockit boolean fun"> + <compile files="test/BooleanUnitTest.java, test/LoggingAspect.aj"/> + <run class="test.BooleanUnitTest"/> + </ajc-test> + + <ajc-test dir="bugs152/pr148007/purejava" title="jrockit boolean fun (no aspects)"> + <compile files="test/BooleanUnitTest.java, test/LoggingAspect.java" options="-inlineJSR"/> + <run class="test.BooleanUnitTest"/> + </ajc-test> + + <ajc-test dir="features152/synthetic" title="synthetic ajc$ members"> + <compile files="TheWholeShow.aj" options="-1.5"/> + <run class="TheWholeShow"/> + </ajc-test> + + <ajc-test dir="bugs152/pr148786" title="freaky new array joinpoint"> + <compile files="A.java" options="-Xjoinpoints:arrayconstruction"/> + <run class="A"> + <stderr> + <line text="new array: class [[B"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr148727" pr="148727" + title="integrated compilation calling aspectOf and hasAspect" > + <compile files="Asp.aj, Client.java" options="-source 1.4"/> + <run class="Client"> + <stdout> + <line text="Can call aspectOf? Asp@"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs152/pr148727" pr="148727" + title="separate compilation calling aspectOf and hasAspect" > + <compile files="Asp.aj" outjar="asp.jar"/> + <compile files="Client.java" classpath="asp.jar" options="-source 1.4"/> + <run class="Client"> + <stdout> + <line text="Can call aspectOf? Asp@"/> + </stdout> + </run> + </ajc-test> + + + <ajc-test dir="bugs152" title="new iprogramelement method getParameterSignatures"> + <compile files="pr141730a.java" options="-emacssym -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="bugs152" title="new iprogramelement method getParameterSignatures with generics"> + <compile files="pr141730b.java" options="-1.5 -emacssym -Xset:minimalModel=false"/> + </ajc-test> +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc152/synchronization.xml b/tests/src/test/java/org/aspectj/systemtest/ajc152/synchronization.xml new file mode 100644 index 000000000..99096fa53 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc152/synchronization.xml @@ -0,0 +1,650 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.5.1 Tests --> +<suite> + + <ajc-test dir="features152/synchronization" title="basic"> + <compile files="Basic.java" options="-1.5 -showWeaveInfo -Xjoinpoints:synchronization"> + </compile> + <run class="Basic"> + <stderr> + <line text="methodWithSyncBlock1"/> + <line text="staticMethodWithSyncBlock1"/> + <line text="methodWithSyncBlock2"/> + <line text="staticMethodWithSyncBlock2"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="basic - within"> + <compile files="Basic2.java" options="-1.5 -Xjoinpoints:synchronization"> + </compile> + <run class="Basic2"> + <stderr> + <line text="methodWithSyncBlock1"/> + <line text="Advice running at lock(Object)"/> + <line text="Advice running at unlock(Object)"/> + <line text="staticMethodWithSyncBlock1"/> + <line text="Advice running at lock(Object)"/> + <line text="Advice running at unlock(Object)"/> + <line text="methodWithSyncBlock2"/> + <line text="Advice running at lock(Object)"/> + <line text="Advice running at unlock(Object)"/> + <line text="staticMethodWithSyncBlock2"/> + <line text="Advice running at lock(Object)"/> + <line text="Advice running at unlock(Object)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="basic - within plus args"> + <compile files="Basic3.java" options="-1.5 -Xjoinpoints:synchronization"> + </compile> + <run class="Basic3"> + <stderr> + <line text="methodWithSyncBlock1"/> + <line text="Advice running at lock(Object) with this of type class Basic3 with value Basic3@"/> + <line text="Advice running at unlock(Object) with this of type class Basic3 with value Basic3@"/> + <line text="staticMethodWithSyncBlock1"/> + <line text="Advice running at lock(Object) with this of type class Basic3 with value Basic3@"/> + <line text="Advice running at unlock(Object) with this of type class Basic3 with value Basic3@"/> + <line text="methodWithSyncBlock2"/> + <line text="Advice running at lock(Object) with this of type class Basic3 with value Basic3@"/> + <line text="Advice running at unlock(Object) with this of type class Basic3 with value Basic3@"/> + <line text="staticMethodWithSyncBlock2"/> + <line text="Advice running at lock(Object) with this of type class Basic3 with value Basic3@"/> + <line text="Advice running at unlock(Object) with this of type class Basic3 with value Basic3@"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="basic - within plus this"> + <compile files="Basic4.java" options="-1.5 -Xjoinpoints:synchronization"> + </compile> + <run class="Basic4"> + <stderr> + <line text="methodWithSyncBlock1"/> + <line text="Advice running at lock(Object) with args of type class Basic4 with value Basic4@"/> + <line text="Advice running at unlock(Object) with args of type class Basic4 with value Basic4@"/> + <line text="staticMethodWithSyncBlock1"/> + <line text="Advice running at lock(Object) with args of type class java.lang.Class with value class Basic4"/> + <line text="Advice running at unlock(Object) with args of type class java.lang.Class with value class Basic4"/> + <line text="methodWithSyncBlock2"/> + <line text="Advice running at lock(Object) with args of type class Basic4 with value Basic4@"/> + <line text="Advice running at unlock(Object) with args of type class Basic4 with value Basic4@"/> + <line text="staticMethodWithSyncBlock2"/> + <line text="Advice running at lock(Object) with args of type class java.lang.Class with value class Basic4"/> + <line text="Advice running at unlock(Object) with args of type class java.lang.Class with value class Basic4"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="basic - within plus target"> + <compile files="Basic5.java" options="-1.5 -Xjoinpoints:synchronization"> + </compile> + <run class="Basic5"> + <stderr> + <line text="Advice running at void Basic5.methodWithSyncBlock1() with target of type class Basic5 with value Basic5@"/> + <line text="Advice running at void Basic5.methodWithSyncBlock1() with target of type class Basic5 with value Basic5@"/> + <line text="methodWithSyncBlock1"/> + <line text="Advice running at void Basic5.staticMethodWithSyncBlock1() with target of type class Basic5 with value Basic5@"/> + <line text="Advice running at void Basic5.staticMethodWithSyncBlock1() with target of type class Basic5 with value Basic5@"/> + <line text="staticMethodWithSyncBlock1"/> + <line text="Advice running at void Basic5.methodWithSyncBlock2() with target of type class Basic5 with value Basic5@"/> + <line text="Advice running at void Basic5.methodWithSyncBlock2() with target of type class Basic5 with value Basic5@"/> + <line text="methodWithSyncBlock2"/> + <line text="Advice running at void Basic5.staticMethodWithSyncBlock2() with target of type class Basic5 with value Basic5@"/> + <line text="Advice running at void Basic5.staticMethodWithSyncBlock2() with target of type class Basic5 with value Basic5@"/> + <line text="staticMethodWithSyncBlock2"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="a useful program"> + <compile files="Useful1.java" options="-1.5 -Xjoinpoints:synchronization"> + </compile> + <run class="Useful1"> + <stderr> + <line text="Average lock taking time over 2000"/> + <line text="We did time something!"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="parsing - lock"> + <compile files="Parsing1.java" options="-1.5 -Xjoinpoints:synchronization"> + <message kind="warning" line="5" text="advice defined in Parsing1 has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="parsing - unlock"> + <compile files="Parsing2.java" options="-1.5 -Xjoinpoints:synchronization"> + <message kind="warning" line="5" text="advice defined in Parsing2 has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="parsing - error - lock"> + <compile files="Parsing1.java" options="-1.5"> + <message kind="warning" line="5" text="advice defined in Parsing1 has not been applied [Xlint:adviceDidNotMatch]"/> + <!-- this next warning comes out twice because we unpack the attributes twice... --> + <message kind="warning" line="5" text="lock() pointcut designator cannot be used without the option -Xjoinpoints:synchronization"/> + </compile> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="parsing - error - unlock"> + <compile files="Parsing2.java" options="-1.5"> + <message kind="warning" line="5" text="advice defined in Parsing2 has not been applied [Xlint:adviceDidNotMatch]"/> + <!-- this next warning comes out twice because we unpack the attributes twice... --> + <message kind="warning" line="5" text="unlock() pointcut designator cannot be used without the option -Xjoinpoints:synchronization"/> + </compile> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="parsing and matching - lock and static context"> + <compile files="ParsingAndMatching1.java" options="-1.5 -Xjoinpoints:synchronization"/> + <run class="ParsingAndMatching1"> + <stderr> + <line text="Advice running at ParsingAndMatching1.java:14"/> + <line text="static method running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="using lock with LTW - missing flag"> + <compile files="LockAspect1.java" options="-1.5"> + <message kind="warning" line="6" text="lock() pointcut designator cannot be used without the option -Xjoinpoints:synchronization"/> + </compile> + <compile files="BasicProgram1.java" options="-1.5"/> + <run class="BasicProgram1" ltw="aop1.xml"> + <stderr> + <!-- warning is something like 'warning at C:\temp\ajcSandbox\ajcTest61975.tmp\LockAspect1.java:6::0 lock() pointcut designator cannot be used without the option -Xjoinpoints:synchronization'/--> + <line text="warning at "/> + <line text="nonstatic method running"/> + <line text="static method running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization/transformed" title="transform with LTW"> + <compile files="CaptureLock.aj" options="-1.5"/> + <compile files="Program.java" options="-1.5"/> + <run class="Program" ltw="aop1.xml"> + <stdout> + <line text="Before a lock or unlock"/> + <line text="hello from b()"/> + <line text="Before a lock or unlock"/> + <line text="Before a lock or unlock"/> + <line text="bang in c()"/> + <line text="Before a lock or unlock"/> + <line text="Before a lock or unlock"/> + <line text="hello from d()"/> + <line text="Before a lock or unlock"/> + <line text="hello from block in d()"/> + <line text="Before a lock or unlock"/> + <line text="Before a lock or unlock"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="using lock with LTW"> + <compile files="LockAspect1.java" options="-1.5 -Xjoinpoints:synchronization"/> + <compile files="BasicProgram1.java" options="-1.5 -Xjoinpoints:synchronization"/> + <run class="BasicProgram1" ltw="aop3.xml"> + <stderr> + <line text="weaveinfo Join point 'lock(void java.lang.Object.<lock>(java.lang.Object))' in Type 'BasicProgram1' (BasicProgram1.java:11) advised by before advice from 'LockAspect1' (LockAspect1.java:6)"/> + <line text="weaveinfo Join point 'lock(void java.lang.Object.<lock>(java.lang.Object))' in Type 'BasicProgram1' (BasicProgram1.java:17) advised by before advice from 'LockAspect1' (LockAspect1.java:6)"/> + <line text="Lock advice running at BasicProgram1.java:17"/> + <line text="nonstatic method running"/> + <line text="Lock advice running at BasicProgram1.java:11"/> + <line text="static method running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="using unlock with LTW"> + <compile files="UnlockAspect1.java" options="-1.5 -Xjoinpoints:synchronization"/> + <compile files="BasicProgram1.java" options="-1.5 -Xjoinpoints:synchronization"/> + <run class="BasicProgram1" ltw="aop4.xml"> + <stderr> + <line text="weaveinfo Join point 'unlock(void java.lang.Object.<unlock>(java.lang.Object))' in Type 'BasicProgram1' (BasicProgram1.java:11) advised by before advice from 'UnlockAspect1' (UnlockAspect1.java:6)"/> + <line text="weaveinfo Join point 'unlock(void java.lang.Object.<unlock>(java.lang.Object))' in Type 'BasicProgram1' (BasicProgram1.java:17) advised by before advice from 'UnlockAspect1' (UnlockAspect1.java:6)"/> + <line text="nonstatic method running"/> + <line text="Unlock advice running at BasicProgram1.java:17"/> + <line text="static method running"/> + <line text="Unlock advice running at BasicProgram1.java:11"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="using unlock with LTW - missing flag"> + <compile files="UnlockAspect1.java" options="-1.5"> + <message kind="warning" line="6" text="unlock() pointcut designator cannot be used without the option -Xjoinpoints:synchronization"/> + </compile> + <compile files="BasicProgram1.java" options="-1.5"/> + <run class="BasicProgram1" ltw="aop2.xml"> + <stderr> + <line text="warning at "/> + <line text="nonstatic method running"/> + <line text="static method running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="parsing and matching - unlock and static context"> + <compile files="ParsingAndMatching2.java" options="-1.5 -Xjoinpoints:synchronization"/> + <run class="ParsingAndMatching2"> + <stderr> + <line text="static method running"/> + <line text="Advice running at ParsingAndMatching2.java:14"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="parsing and matching - lock and non-static context"> + <compile files="ParsingAndMatching3.java" options="-1.5 -Xjoinpoints:synchronization"/> + <run class="ParsingAndMatching3"> + <stderr> + <line text="Advice running at ParsingAndMatching3.java:15"/> + <line text="non-static method running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="parsing and matching - unlock and non-static context"> + <compile files="ParsingAndMatching4.java" options="-1.5 -Xjoinpoints:synchronization"/> + <run class="ParsingAndMatching4"> + <stderr> + <line text="non-static method running"/> + <line text="Advice running at ParsingAndMatching4.java:15"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="a useful program - with lock"> + <compile files="Useful2.java" options="-1.5 -showWeaveInfo -Xjoinpoints:synchronization"> + <message kind="weave" text="Join point 'method-execution(void Useful2.main(java.lang.String[]))' in Type 'Useful2' (Useful2.java:33) advised by afterReturning advice from 'LockMonitor' (Useful2.java:25)"/> + <message kind="weave" text="Join point 'lock(void java.lang.Object.<lock>(java.lang.Object))' in Type 'Useful2' (Useful2.java:42) advised by before advice from 'LockMonitor' (Useful2.java:9) [with runtime test]"/> + <message kind="weave" text="Join point 'unlock(void java.lang.Object.<unlock>(java.lang.Object))' in Type 'Useful2' (Useful2.java:42) advised by after advice from 'LockMonitor' (Useful2.java:14) [with runtime test]"/> + <!-- hope we aren't getting double messages out --> + </compile> + <run class="Useful2"> + <stderr> + <line text="Average time spent with lock over"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="combining pcds - lock and this"> + <compile files="CombiningPCDs1.java" options="-1.5 -Xjoinpoints:synchronization"/> + <run class="CombiningPCDs1"> + <stderr> + <line text="static method running"/> + <line text="advice running at CombiningPCDs1.java:17"/> + <line text="non-static method running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="combining pcds - unlock and this"> + <compile files="CombiningPCDs2.java" options="-1.5 -Xjoinpoints:synchronization"/> + <run class="CombiningPCDs2"> + <stderr> + <line text="static method running"/> + <line text="non-static method running"/> + <line text="advice running at CombiningPCDs2.java:17"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="thisjoinpoint - monitor entry"> + <compile files="ThisJoinPointLock.java" options="-1.5 -Xjoinpoints:synchronization"/> + <run class="ThisJoinPointLock"> + <stderr> + <line text="match.toString(): lock(lock(Object))"/> + <line text="match.toShortString(): lock(lock(Object))"/> + <line text="match.toLongString(): lock(lock(java.lang.Object))"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="thisjoinpoint - monitor exit"> + <compile files="ThisJoinPointUnlock.java" options="-1.5 -Xjoinpoints:synchronization"/> + <run class="ThisJoinPointUnlock"> + <stderr> + <line text="match.toString(): unlock(unlock(Object))"/> + <line text="match.toShortString(): unlock(unlock(Object))"/> + <line text="match.toLongString(): unlock(unlock(java.lang.Object))"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="prevent double unlock weaving messages and model contents"> + <compile files="ThisJoinPointUnlock.java" options="-1.5 -Xjoinpoints:synchronization -showWeaveInfo -emacssym"> + <message kind="weave" text="Join point 'lock(void java.lang.Object.<lock>(java.lang.Object))' in Type 'ThisJoinPointUnlock' (ThisJoinPointUnlock.java:38) advised by before advice from 'TJPAspect' (ThisJoinPointUnlock.java:4)"/> + <message kind="weave" text="Join point 'method-call(void ThisJoinPointUnlock.staticMethod())' in Type 'ThisJoinPointUnlock' (ThisJoinPointUnlock.java:39) advised by before advice from 'TJPAspect' (ThisJoinPointUnlock.java:4)"/> + <message kind="weave" text="Join point 'unlock(void java.lang.Object.<unlock>(java.lang.Object))' in Type 'ThisJoinPointUnlock' (ThisJoinPointUnlock.java:38) advised by before advice from 'TJPAspect' (ThisJoinPointUnlock.java:4)"/> + </compile> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="before advice - lock"> + <compile files="BeforeLock.java" options="-1.5 -Xjoinpoints:synchronization"/> + <run class="BeforeLock"> + <stderr> + <line text="before() lock: advice running at BeforeLock.java:26"/> + <line text="static method running"/> + <line text="before(Foo) lock: advice running at BeforeLock.java:21"/> + <line text="before() lock: advice running at BeforeLock.java:21"/> + <line text="non-static method running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="before advice - unlock"> + <compile files="BeforeUnlock.java" options="-1.5 -Xjoinpoints:synchronization"/> + <run class="BeforeUnlock"> + <stderr> + <line text="static method running"/> + <line text="before() unlock: advice running at BeforeUnlock.java:26"/> + <line text="non-static method running"/> + <line text="before(Foo) unlock: advice running at BeforeUnlock.java:21"/> + <line text="before() unlock: advice running at BeforeUnlock.java:21"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="after advice - lock"> + <compile files="AfterLock.java" options="-1.5 -Xjoinpoints:synchronization"/> + <run class="AfterLock"> + <stderr> + <line text="after() lock: advice running at AfterLock.java:26"/> + <line text="static method running"/> + <line text="after(Foo) lock: advice running at AfterLock.java:21"/> + <line text="after() lock: advice running at AfterLock.java:21"/> + <line text="non-static method running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="after advice - unlock"> + <compile files="AfterUnlock.java" options="-1.5 -Xjoinpoints:synchronization"/> + <run class="AfterUnlock"> + <stderr> + <line text="static method running"/> + <line text="after() unlock: advice running at AfterUnlock.java:26"/> + <line text="non-static method running"/> + <line text="after(Foo) unlock: advice running at AfterUnlock.java:21"/> + <line text="after() unlock: advice running at AfterUnlock.java:21"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="around advice - lock"> + <compile files="AroundLock.java" options="-1.5 -Xjoinpoints:synchronization"> + <message kind="warning" line="11" text="Around advice is not supported on the lock and unlock join points (compiler limitation)"/> + <message kind="warning" line="17" text="Around advice is not supported on the lock and unlock join points (compiler limitation)"/> + <message kind="warning" line="31" text="Around advice is not supported on the lock and unlock join points (compiler limitation)"/> + <message kind="warning" line="36" text="Around advice is not supported on the lock and unlock join points (compiler limitation)"/> + <message kind="warning" line="11" text="advice defined in AroundLock has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="warning" line="17" text="advice defined in AroundLock has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + <run class="AroundLock"> + <stderr> + <!--line text="around() lock: advice running at AroundLock.java:26"/--> + <line text="static method running"/> + <!--line text="around(Foo) lock: advice running at AroundLock.java:21"/> + <line text="around() lock: advice running at AroundLock.java:21"/--> + <line text="non-static method running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="around advice - unlock"> + <compile files="AroundUnlock.java" options="-1.5 -Xjoinpoints:synchronization"> + <message kind="warning" line="5" text="Around advice is not supported on the lock and unlock join points (compiler limitation)"/> + <message kind="warning" line="10" text="Around advice is not supported on the lock and unlock join points (compiler limitation)"/> + <message kind="warning" line="23" text="Around advice is not supported on the lock and unlock join points (compiler limitation)"/> + <message kind="warning" line="28" text="Around advice is not supported on the lock and unlock join points (compiler limitation)"/> + <message kind="warning" line="5" text="advice defined in AroundUnlock has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="warning" line="10" text="advice defined in AroundUnlock has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + <run class="AroundUnlock"> + <stderr> + <!--line text="around() unlock: advice running at AroundUnlock.java:26"/--> + <line text="static method running"/> + <!--line text="around(Foo) unlock: advice running at AroundUnlock.java:21"/--> + <!--line text="around() unlock: advice running at AroundUnlock.java:21"/--> + <line text="non-static method running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization/transformed" title="investigation"> + <compile files="Investigation.java"> + </compile> + </ajc-test> + + <ajc-test dir="features152/synchronization/transformed" title="One"> + <compile files="One.java -Xjoinpoints:synchronization"> + </compile> + <run class="One"/><!-- will check verification ... --> + </ajc-test> + + <ajc-test dir="features152/synchronization/transformed" title="Two"> + <compile files="Two.java -Xjoinpoints:synchronization"> + <message kind="warning" line="14" text="advice matching the synchronized method shadow 'method-execution(void C.ma())' will be executed outside the lock rather than inside (compiler limitation) [Xlint"/> + </compile> + <run class="Two"> + <stderr> + <line text="execution advice running"/> + <line text="hello"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization/transformed" title="Two - xlintoff"> + <compile files="Two.java -Xjoinpoints:synchronization -Xlint:ignore"/> + <run class="Two"> + <stderr> + <line text="execution advice running"/> + <line text="hello"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization/transformed" title="Three"> + <compile files="Three.java -Xjoinpoints:synchronization"> + <message kind="warning" line="20" text="advice matching the synchronized method shadow 'method-execution(void C.m3())' will be executed outside the lock rather than inside (compiler limitation) [Xlint"/> + <message kind="warning" line="24" text="advice matching the synchronized method shadow 'method-execution(void C.m32())' will be executed outside the lock rather than inside (compiler limitation) [Xlint"/> + </compile> + <run class="Three"> + <stderr> + <line text="hello"/> + <line text="execution advice running"/> + <line text="hello"/> + <line text="execution advice running2"/> + <line text="hello"/> + <line text="execution advice running3"/> + <line text="hello"/> + <line text="execution advice running4"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization/transformed" title="Four"> + <compile files="Four.java -Xjoinpoints:synchronization"> + <message kind="warning" line="16" text="advice matching the synchronized method shadow 'method-execution(void C.m())' will be executed outside the lock rather than inside (compiler limitation) [Xlint"/> + <message kind="warning" line="20" text="advice matching the synchronized method shadow 'method-execution(void C.m2())' will be executed outside the lock rather than inside (compiler limitation) [Xlint"/> + </compile> + <run class="Four"> + <stderr> + <line text="hello"/> + <line text="execution advice running"/> + <line text="hello"/> + <line text="execution advice running2"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization/transformed" title="Five - Java5"> + <compile files="Five.java -1.5 -Xjoinpoints:synchronization"> + </compile> + <run class="Five"> + <stderr> + <line text="test"/> + <line text="hello"/> + <line text="test"/> + <line text="hello"/> + <line text="test"/> + <line text="hello"/> + <line text="test"/> + <line text="hello"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization/transformed" title="Six - preJava5"> + <compile files="Six.java -Xjoinpoints:synchronization"> + </compile> + <run class="Six"> + <stderr> + <line text="test"/> + <line text="hello"/> + <line text="test"/> + <line text="hello"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization/transformed" title="lock pcd on transformed non-static method"> + <compile files="Seven.java -Xjoinpoints:synchronization"> + </compile> + <run class="Seven"> + <stderr> + <line text="Locking occurring at lock(lock(Object))"/> + <line text="Seven.java"/> + <line text="hello"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization/transformed" title="unlock pcd on transformed non-static method"> + <compile files="Eight.java -Xjoinpoints:synchronization"> + </compile> + <run class="Eight"> + <stderr> + <line text="hello"/> + <line text="Unlocking occurring at unlock(unlock(Object))"/> + <line text="Eight.java"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization/transformed" title="lock pcd on transformed static method - J5"> + <compile files="Nine.java -1.5 -Xjoinpoints:synchronization"> + </compile> + <run class="Nine"> + <stderr> + <line text="Locking occurring at lock(lock(Object))"/> + <line text="Nine.java"/> + <line text="hello"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization/transformed" title="unlock pcd on transformed static method - J5"> + <compile files="Ten.java -1.5 -Xjoinpoints:synchronization"> + </compile> + <run class="Ten"> + <stderr> + <line text="hello"/> + <line text="Unlocking occurring at unlock(unlock(Object))"/> + <line text="Ten.java"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization/transformed" title="lock pcd on transformed static method - preJ5"> + <compile files="Eleven.java -Xjoinpoints:synchronization"> + </compile> + <run class="Eleven"> + <stderr> + <line text="Locking occurring at lock(lock(Object))"/> + <line text="Eleven.java"/> + <line text="hello"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization/transformed" title="unlock pcd on transformed static method - preJ5"> + <compile files="Twelve.java" options="-Xjoinpoints:synchronization"> + </compile> + <run class="Twelve"> + <stderr> + <line text="hello"/> + <line text="Unlocking occurring at unlock(unlock(Object))"/> + <line text="Twelve.java"/> + </stderr> + </run> + </ajc-test> + + + <ajc-test dir="features152/synchronization/transformed" title="transform static method - preJ5"> + <compile files="Fifteen.java" options="-Xjoinpoints:synchronization -1.4"> + </compile> + <run class="Fifteen"> + <stderr> + <line text="Locking occurring at lock(lock(Object))"/> + <line text="Fifteen.java"/> + <line text="hello"/> + </stderr> + </run> + </ajc-test> + + + <ajc-test dir="features152/synchronization/transformed" title="transform static method - packages - preJ5"> + <compile files="Sixteen.java" options="-Xjoinpoints:synchronization -1.4"> + </compile> + <run class="a.b.c.d.Sixteen"> + <stderr> + <line text="Locking occurring at lock(lock(Object))"/> + <line text="Sixteen.java"/> + <line text="hello"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization" title="obtaining locked object through getArgs"> + <compile files="LockingWithTJP.java" options="-Xjoinpoints:synchronization"> + </compile> + <run class="LockingWithTJP"> + <stderr> + <line text="before() lock: advice running at LockingWithTJP.java:18"/> + <line text="Locked on LockingWithTJP$Foo"/> + <line text="non-static method running"/> + <line text="before() lock: advice running at LockingWithTJP.java:23"/> + <line text="Locked on class java.lang.String"/> + <line text="static method running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features152/synchronization/transformed" title="other targeters"> + <compile files="OtherTargeters.java" options="-Xjoinpoints:synchronization"> + <message kind="warning" line="8" text="advice matching the synchronized "/> + </compile> + <run class="OtherTargeters"> + <stderr> + <line text="advice running"/> + <line text="foo() running"/> + </stderr> + </run> + </ajc-test> + + + <ajc-test dir="features152/synchronization/transformed" title="joinpoints enabled but no lock"> + <compile files="Fourteen.java" options="-Xjoinpoints:synchronization"> + <!--message kind="warning" line="8" text="advice matching the synchronized "/--> + </compile> + <run class="Fourteen"/> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc153/Ajc153Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc153/Ajc153Tests.java new file mode 100644 index 000000000..304e34898 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc153/Ajc153Tests.java @@ -0,0 +1,508 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM + * 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.ajc153; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.asm.AsmManager; +import org.aspectj.asm.IHierarchy; +import org.aspectj.asm.IProgramElement; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.weaver.bcel.Utility; + +public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testFormalCommentsAreSetForConstructorIPEs_pr164340() { + runTest("formal comments are set for constructor ipes"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.CONSTRUCTOR, "C()"); + assertNotNull("expected formal comment to be non null but" + " found that it was null", ipe.getFormalComment()); + } + + // public void testGenericsProblem_pr151978() { runTest("generics problem");} + // public void testArgnamesAndJavac_pr148381() { runTest("argNames and javac");} + // public void testCFlowXMLAspectLTW_pr149096() { runTest("cflow xml concrete aspect"); } + // public void testAmbiguousBinding_pr121805() { runTest("ambiguous binding");} + // public void testNegatedAnnotationMatchingProblem_pr153464() { runTest("negated annotation matching problem");} + public void testAnnotationStyleBcException_pr162135() { + runTest("bcexception in annotation style around advice"); + } + + public void testAnnotationStyleBcException_pr162135_2() { + runTest("bcexception in annotation style around advice - 2"); + } + + public void testAnnotationStyleBcException_pr162135_3() { + runTest("bcexception in annotation style around advice - 3"); + } + + public void testAnnotationStyleBcException_pr162135_4() { + runTest("bcexception in annotation style around advice - 4"); + } + + public void testAnnotationStyleBcException_pr162135_5() { + runTest("bcexception in annotation style around advice - 5"); + } + + public void testAnnotationStyleBcException_pr162135_6() { + runTest("bcexception in annotation style around advice - 6"); + } + + public void testAnnotationStyleBcException_pr162135_7() { + runTest("bcexception in annotation style around advice - 7"); + } + + public void testIncompatibleClassChangeWithITD_pr164633() { + runTest("incompatibleclasschange"); + } + + public void testComplexPointcut_pr162657() { + runTest("complex pointcut"); + } + + public void testGenericsInPointcuts_pr161502() { + runTest("generics in pointcuts"); + } + + public void testGenericsInPointcuts_pr161502_2() { + runTest("generics in pointcuts - 2"); + } + + public void testNoNPEDueToMissingType_pr149908() { + runTest("ensure no npe due to missing type"); + } + + public void testNoNPEDueToMember_pr149908() { + runTest("ensure no npe due to missing member"); + } + + public void testPTWgetWithinTypeName_pr123423_1() { + runTest("basic usage of getWithinTypeName"); + } + + public void testPTWgetWithinTypeName_pr123423_2() { + runTest("basic usage of getWithinTypeName - multiple types"); + } + + public void testPTWgetWithinTypeName_pr123423_3() { + runTest("basic usage of getWithinTypeName - non matching types"); + } + + public void testPTWgetWithinTypeName_pr123423_4() { + runTest("basic usage of getWithinTypeName - types in packages"); + } + + public void testPTWgetWithinTypeName_pr123423_5() { + runTest("basic usage of getWithinTypeName - annotation style"); + } + + public void testTurningOffBcelCaching_pr160674() { + runTest("turning off bcel caching"); + } + + public void testNoIllegalStateExceptionWithGenericInnerAspect_pr156058() { + runTest("no IllegalStateException with generic inner aspect"); + } + + public void testNoIllegalStateExceptionWithGenericInnerAspect_pr156058_2() { + runTest("no IllegalStateException with generic inner aspect - 2"); + } + + public void testDeclareMethodAnnotations_pr159143() { + runTest("declare method annotations"); + } + + public void testVisibilityProblem_pr149071() { + runTest("visibility problem"); + } + + public void testMissingLineNumbersInStacktraceAfter_pr145442() { + runTest("missing line numbers in stacktrace after"); + } + + public void testMissingLineNumbersInStacktraceAround_pr145442() { + runTest("missing line numbers in stacktrace around"); + } + + public void testGenericArrays_pr158624() { + runTest("generics and arrays"); + } + + public void testMissingLineNumbersInStacktraceBefore_pr145442() { + runTest("missing line numbers in stacktrace before"); + } + + public void testMissingLineNumbersInStacktraceBefore_pr145442_Binary() { + runTest("missing line numbers in stacktrace before - binary"); + } + + public void testAnnotationStylePointcutNPE_pr158412() { + runTest("annotation style pointcut npe"); + } + + public void testAnnotationStylePointcutNPE_pr158412_2() { + runTest("annotation style pointcut npe - 2"); + } + + public void testAnnotationsCallConstructors_pr158126() { + runTest("annotations, call and constructors problem"); + } + + public void testIllegalStateExceptionGenerics_pr153845() { + runTest("IllegalStateException at GenericSignatureParser.java"); + } + + public void testNoIllegalStateExceptionFromAsmDelegate_pr153490_1() { + runTest("no illegal state exception from AsmDelegate - 1"); + } + + public void testNoIllegalStateExceptionFromAsmDelegate_pr153490_2() { + runTest("no illegal state exception from AsmDelegate - 2"); + } + + public void testNoIllegalStateExceptionFromAsmDelegate_pr153490_3() { + runTest("no illegal state exception from AsmDelegate - 3"); + } + + public void testAnnotMethod_pr156962() { + runTest("Test Annot Method"); + } + + public void testAnnotMethodHasMember_pr156962() { + runTest("Test Annot Method Has Member"); + } + + public void testMixingGenerics_pr152848() { + runTest("mixing generics"); + } + + public void testIncorrectStaticinitializationWeaving_pr149560_1() { + runTest("incorrect staticinitialization weaving - codestyle"); + } + + public void testIncorrectStaticinitializationWeaving_pr149560_2() { + runTest("incorrect staticinitialization weaving - annstyle"); + } + + public void testIncorrectDeprecatedAnnotationProcessing_pr154332() { + runTest("incorrect deprecated annotation processing"); + } + + public void testPipeliningProblemWithAnnotationsDecp_pr153380_1() { + runTest("pipelining decps"); + } + + public void testUnwantedPointcutWarning_pr148219() { + runTest("unwanted warning for pointcut"); + } + + public void testDecpAndCflowadderMungerClash_pr152631() { + runTest("decp and cflowadder munger clash"); + } + + public void testGenericInheritanceDecp_pr150095() { + runTest("generics, inheritance and decp"); + } + + public void testIllegalStateException_pr148737() { + runTest("illegalstateexception for non generic type"); + } + + public void testAtajInheritance_pr149305_1() { + runTest("ataj inheritance - 1"); + } + + public void testAtajInheritance_pr149305_2() { + runTest("ataj inheritance - 2"); + } + + public void testAtajInheritance_pr149305_3() { + runTest("ataj inheritance - 3"); + } + + // public void testVerificationFailureForAspectOf_pr148693() { + // runTest("verification problem"); // build the code + // Utils.verifyClass(ajc, "mypackage.MyAspect"); // verify it <<< BRAND NEW VERIFY UTILITY FOR EVERYONE TO TRY ;) + // } + + public void testIncorrectAnnotationValue_pr148537() { + runTest("incorrect annotation value"); + } + + public void testVerifyErrNoTypeCflowField_pr145693_1() { + runTest("verifyErrNoTypeCflowField"); + } + + public void testVerifyErrInpathNoTypeCflowField_pr145693_2() { + runTest("verifyErrInpathNoTypeCflowField"); + } + + public void testCpathNoTypeCflowField_pr145693_3() { + runTest("cpathNoTypeCflowField"); + } + + // public void testAdviceNotWovenAspectPath_pr147841() { runTest("advice not woven on aspectpath");} + public void testGenericSignatures_pr148409() { + runTest("generic signature problem"); + } + + public void testCantFindType_pr149322_01() { + runTest("can't find type on interface call 1"); + } + + public void testCantFindType_pr149322_02() { + runTest("can't find type on interface call 2"); + } + + public void testCantFindType_pr149322_03() { + runTest("can't find type on interface call 3"); + } + + public void testParsingBytecodeLess_pr152871() { + Utility.testingParseCounter = 0; + runTest("parsing bytecode less"); + assertTrue("Should have called parse 2 times, not " + Utility.testingParseCounter + " times", + Utility.testingParseCounter == 2); + // 5 means: // 3 of these are gone with change to UnwovenClassFileWTPMB to take a classname in ctor + // (1)=registerAspect + // (2,3)=checkingIfShouldWeave,AcceptingResult for class + // (4,5)=checkingIfShouldWeave,AcceptingResult for aspect + } + + public void testMatchVolatileField_pr150671() { + runTest("match volatile field"); + } + + public void testDuplicateJVMTIAgents_pr151938() { + runTest("Duplicate JVMTI agents"); + } + + public void testLTWWorldWithAnnotationMatching_pr153572() { + runTest("LTWWorld with annotation matching"); + } + + public void testReweavableAspectNotRegistered_pr129525() { + runTest("reweavableAspectNotRegistered error"); + } + + public void testNPEinConstructorSignatureImpl_pr155972() { + runTest("NPE in ConstructorSignatureImpl"); + } + + public void testNPEinFieldSignatureImpl_pr155972() { + runTest("NPE in FieldSignatureImpl"); + } + + public void testNPEinInitializerSignatureImpl_pr155972() { + runTest("NPE in InitializerSignatureImpl"); + } + + public void testLineNumberTableCorrectWithGenericsForEachAndContinue_pr155763() { + runTest("ensure LineNumberTable correct with generics, for each and continue"); + } + + public void testDeclareSoftDoesntAllowUndeclaredExInAnonInnerClass_pr151772() { + runTest("ensure declare soft doesn't allow undeclared exception in anonymous inner class"); + } + + public void testDeclareSoftDoesntAllowUndeclaredExInAnonInnerClass_pr151772_2() { + runTest("ensure declare soft doesn't allow undeclared exception in anonymous inner class - 2"); + } + + public void testDeclareSoftAndInnerClasses_pr125981() { + runTest("declare soft and inner classes"); + } + + public void testGetSourceSignature_pr148908() { + runTest("ensure getSourceSignature correct with static field"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, "MY_COMPARATOR"); + String expected = "static final Comparator MY_COMPARATOR = null;\n"; + assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe + .getSourceSignature()); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, "aString"); + expected = "static final String aString = \"Constant String\";\n"; + assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe + .getSourceSignature()); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, "bString"); + expected = "static final String bString = aString;\n"; + assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe + .getSourceSignature()); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, "cString"); + expected = "static final String cString = (aString + bString);\n"; + assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe + .getSourceSignature()); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, "dString"); + expected = "static final String dString = ((aString + \" and \") + bString);\n"; + assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe + .getSourceSignature()); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, "eString"); + expected = "static final String eString = \"Hello World\";\n"; + assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe + .getSourceSignature()); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, "aList"); + expected = "public List<String> aList = null;\n"; + assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe + .getSourceSignature()); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, "bList"); + expected = "public List<String> bList = null;\n"; + assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe + .getSourceSignature()); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.FIELD, "cList"); + expected = "public List<String> cList = null;\n"; + assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe + .getSourceSignature()); + } + + // public void testNPEWithCustomAgent_pr158205() { + // runTest("NPE with custom agent"); + // } + + public void testWeaveConcreteSubaspectWithAdvice_pr132080() { + runTest("Weave concrete sub-aspect with advice"); + } + + public void testWeaveConcreteSubaspectWithITD_pr132080() { + runTest("Weave concrete sub-aspect with ITD"); + } + + public void testWeaveConcreteSubaspectWithAroundClosure_pr132080() { + runTest("Weave concrete sub-aspect with around closure"); + } + + public void testWeaveConcreteSubaspectWithCflow_pr132080() { + runTest("Weave concrete sub-aspect with cflow"); + } + + public void testNPEWithLTWPointcutLibraryAndMissingAspectDependency_pr158957() { + runTest("NPE with LTW, pointcut library and missing aspect dependency"); + } + + public void testNoInvalidAbsoluteTypeNameWarning_pr156904_1() { + runTest("ensure no invalidAbsoluteTypeName when do match - 1"); + } + + public void testNoInvalidAbsoluteTypeNameWarning_pr156904_2() { + runTest("ensure no invalidAbsoluteTypeName when do match - 2"); + } + + public void testNoInvalidAbsoluteTypeNameWarning_pr156904_3() { + runTest("ensure no invalidAbsoluteTypeName when do match - 3"); + } + + public void testNoInvalidAbsoluteTypeNameWarning_pr156904_4() { + runTest("ensure no invalidAbsoluteTypeName when do match - 4"); + } + + public void testNoNPEWithThrownExceptionWarningAndAtAspectj_pr161217() { + runTest("NPE with thrown exception warning and at aspectj"); + } + + public void testJavadocCommentsAreSetIfHaveNormalComments_pr164340() { + runTest("javadoc comments are set if have normal comments"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + + IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.METHOD, "foo()"); + assertNotNull("expected formal comment to be non null but" + " found that it was null", ipe.getFormalComment()); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.METHOD, "bar()"); + assertNotNull("expected formal comment to be non null but" + " found that it was null", ipe.getFormalComment()); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.METHOD, "goo()"); + assertNull("expected formal comment to be null but" + " found that it was " + ipe.getFormalComment(), ipe + .getFormalComment()); + + } + + public void testBinaryWeavingIntoJava6Library_pr164384() { + runTest("binary weaving into java 6 library"); + } + + public void testCompilanceJava6ThrowsUsageError_pr164384() { + runTest("compliance java 6 throws usage error"); + } + + public void testSourceLevelJava6ThrowsUsageError_pr164384() { + runTest("source level java 6 throws usage error"); + } + + public void testTargetLevelJava6ThrowsUsageError_pr164384() { + runTest("target level java 6 throws usage error"); + } + + public void testStaticImport() { + runTest("ensure static import reference have static modifier set"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + + IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.IMPORT_REFERENCE, + "ABC.StaticImport.Alphabet.A"); + String expected = "import static ABC.StaticImport.Alphabet.A;"; + assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe + .getSourceSignature()); + } + + public void testAspected_Annotation() { + runTest("ensure Annotations are added to import list"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + + IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.IMPORT_REFERENCE, "annotation.A"); + String expected = "import annotation.A;"; + assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe + .getSourceSignature()); + + } + + public void testGetSourceSignature_GenericMethods() { + runTest("ensure getSourceSignature correct with generic method"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + + IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.METHOD, "returnT(T)"); + String expected = "public <T> T returnT(T a)"; + assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe + .getSourceSignature()); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.METHOD, "returnQ(Q)"); + expected = "public <Q extends List> Q returnQ(Q a)"; + assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe + .getSourceSignature()); + + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.METHOD, "doubleGeneric(Q,T)"); + expected = "public <T, Q> void doubleGeneric(Q a, T b)"; + assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe + .getSourceSignature()); + + // Generic Method Constructor + ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.CONSTRUCTOR, "C(T)"); + expected = "public <T> C(T b)"; + assertEquals("expected source signature to be " + expected + " but found " + ipe.getSourceSignature(), expected, ipe + .getSourceSignature()); + } + + // /////////////////////////////////////// + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc153Tests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc153.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc153/AllTestsAspectJ153.java b/tests/src/test/java/org/aspectj/systemtest/ajc153/AllTestsAspectJ153.java new file mode 100644 index 000000000..2951175f3 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc153/AllTestsAspectJ153.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM + * 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.ajc153; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ153 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.5.3 tests"); + //$JUnit-BEGIN$ + suite.addTest(Ajc153Tests.suite()); + suite.addTest(JDTLikeHandleProviderTests.suite()); + suite.addTest(PipeliningTests.suite()); + suite.addTest(LTWServer153Tests.suite()); + //$JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc153/JDTLikeHandleProviderTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc153/JDTLikeHandleProviderTests.java new file mode 100644 index 000000000..e26c8c90b --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc153/JDTLikeHandleProviderTests.java @@ -0,0 +1,553 @@ +/******************************************************************** + * Copyright (c) 2006 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://eclipse.org/legal/epl-v10.html + * + * Contributors: IBM Corporation - initial API and implementation + * Helen Hawkins - initial version + *******************************************************************/ +package org.aspectj.systemtest.ajc153; + +import java.io.File; +import java.io.IOException; +import java.util.Iterator; +import java.util.List; + +import junit.framework.Test; + +import org.aspectj.asm.AsmManager; +import org.aspectj.asm.IHierarchy; +import org.aspectj.asm.IProgramElement; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class JDTLikeHandleProviderTests extends XMLBasedAjcTestCase { + + // IElementHandleProvider handleProvider; + + protected void setUp() throws Exception { + super.setUp(); + // handleProvider = AsmManager.getDefault().getHandleProvider(); + // AsmManager.getDefault().setHandleProvider(new JDTLikeHandleProvider()); + } + + protected void tearDown() throws Exception { + super.tearDown(); + // AsmManager.getDefault().setHandleProvider(handleProvider); + } + + public void testMoreThanOneNamedPointcut() { + runTest("More than one named pointcut"); + } + + public void testAspectHandle() { + runTest("aspect handle"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + IProgramElement pe = top.findElementForType("pkg", "A1"); + String expected = "<pkg*A1.aj'A1"; + String found = pe.getHandleIdentifier(); + assertEquals("handleIdentifier - expected " + expected + ", but found " + found, expected, found); + } + + public void testAdviceHandle() { + runTest("advice handle"); + compareHandles(IProgramElement.Kind.ADVICE, "before(): <anonymous pointcut>", "<pkg*A2.aj'A2&before"); + } + + public void testPointcutHandle() { + runTest("pointcut handle"); + compareHandles(IProgramElement.Kind.POINTCUT, "p()", "<pkg*A4.aj'A4\"p"); + } + + public void testGetIPEWithAspectHandle() { + runTest("get IProgramElement with aspect handle"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + String handle = "<pkg*A1.aj'A1"; + IProgramElement ipe = top.getElement(handle); + assertNotNull("should have found ipe with handle " + handle, ipe); + IProgramElement ipe2 = top.getElement(handle); + assertEquals("should be the same IPE", ipe, ipe2); + } + + public void testAdviceHandleWithCrossCutting() { + runTest("advice handle with crosscutting"); + compareHandles(IProgramElement.Kind.ADVICE, "before(): <anonymous pointcut>", "<pkg*A3.aj'A3&before"); + } + + public void testPointcutHandleWithArgs() { + runTest("pointcut handle with args"); + compareHandles(IProgramElement.Kind.POINTCUT, "p(java.lang.Integer)", "<*A6.aj'A6\"p\"QInteger;"); + } + + public void testAdviceHandleWithArgs() { + runTest("advice handle with args"); + compareHandles(IProgramElement.Kind.ADVICE, "afterReturning(java.lang.Integer): p..", + "<pkg*A8.aj'A8&afterReturning&QInteger;"); + } + + public void testFieldITD() { + runTest("field itd handle"); + compareHandles(IProgramElement.Kind.INTER_TYPE_FIELD, "C.x", "<pkg*A9.aj'A9,C.x"); + } + + public void testMethodITD() { + runTest("method itd handle"); + compareHandles(IProgramElement.Kind.INTER_TYPE_METHOD, "C.method()", "<pkg*A9.aj'A9)C.method"); + } + + public void testMethodITDWithArgs() { + runTest("method itd with args handle"); + compareHandles(IProgramElement.Kind.INTER_TYPE_METHOD, "C.methodWithArgs(int)", "<pkg*A9.aj'A9)C.methodWithArgs)I"); + } + + public void testConstructorITDWithArgs() { + runTest("constructor itd with args"); + compareHandles(IProgramElement.Kind.INTER_TYPE_CONSTRUCTOR, "C.C(int,java.lang.String)", + "<pkg*A13.aj'A13)C.C_new)I)QString;"); + } + + public void testDeclareParentsHandle() { + runTest("declare parents handle"); + compareHandles(IProgramElement.Kind.DECLARE_PARENTS, "declare parents: implements C2", "<pkg*A7.aj'A7`declare parents"); + } + + public void testTwoDeclareParents() { + runTest("two declare parents in same file"); + compareHandles(IProgramElement.Kind.DECLARE_PARENTS, "declare parents: extends C5", "<pkg*A7.aj'A7`declare parents!2"); + } + + public void testMethodCallHandle() { + runTest("method call handle"); + compareHandles(IProgramElement.Kind.CODE, "method-call(void pkg.C.m2())", "<pkg*A10.aj[C~m1?method-call(void pkg.C.m2())"); + } + + public void testDeclareAtType() { + // AJDT: =AJHandleProject/src<pkg*A.aj}A`declare \@type + runTest("declare @type"); + compareHandles(IProgramElement.Kind.DECLARE_ANNOTATION_AT_TYPE, "declare @type: pkg.C : @MyAnnotation", + "<pkg*A12.aj'A`declare \\@type"); + } + + public void testDeclareAtField() { + // AJDT: =AJHandleProject/src<pkg*A.aj}A`declare \@field + runTest("declare @field"); + compareHandles(IProgramElement.Kind.DECLARE_ANNOTATION_AT_FIELD, "declare @field: int pkg.C.someField : @MyAnnotation", + "<pkg*A12.aj'A`declare \\@field"); + } + + public void testDeclareAtMethod() { + // AJDT: =AJHandleProject/src<pkg*A.aj}A`declare \@method + runTest("declare @method"); + compareHandles(IProgramElement.Kind.DECLARE_ANNOTATION_AT_METHOD, + "declare @method: public void pkg.C.method1() : @MyAnnotation", "<pkg*A12.aj'A`declare \\@method"); + } + + public void testDeclareAtConstructor() { + // AJDT: =AJHandleProject/src<pkg*A.aj}A`declare \@constructor + runTest("declare @constructor"); + compareHandles(IProgramElement.Kind.DECLARE_ANNOTATION_AT_CONSTRUCTOR, "declare @constructor: pkg.C.new() : @MyAnnotation", + "<pkg*A12.aj'A`declare \\@constructor"); + } + + // what about 2 pieces of before advice with the same + // signature and the same pointcut + public void testTwoPiecesOfAdviceWithSameSignatureAndPointcut() { + runTest("two pieces of advice with the same signature and pointcut"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + IProgramElement parent = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.ASPECT, "A5"); + List children = parent.getChildren(); + String handle1 = null; + String handle2 = null; + for (Iterator iter = children.iterator(); iter.hasNext();) { + IProgramElement element = (IProgramElement) iter.next(); + if (element.getKind().equals(IProgramElement.Kind.ADVICE)) { + if (handle1 == null) { + handle1 = element.getHandleIdentifier(); + } else { + handle2 = element.getHandleIdentifier(); + } + } + } + String expected1 = "<pkg*A5.aj'A5&before"; + String expected2 = "<pkg*A5.aj'A5&before!2"; + boolean b = expected1.equals(handle1); + if (b) { + assertEquals("handleIdentifier - expected " + expected2 + ", but found " + handle2, expected2, handle2); + } else { + assertEquals("handleIdentifier - expected " + expected1 + ", but found " + handle2, expected1, handle2); + assertEquals("handleIdentifier - expected " + expected2 + ", but found " + handle1, expected2, handle1); + } + } + + public void testDeclareWarningHandle() { + runTest("declare warning handle"); + compareHandles(IProgramElement.Kind.DECLARE_WARNING, "declare warning: \"Illegal call.\"", + "<pkg*A11.aj'A11`declare warning"); + } + + public void testTwoDeclareWarningHandles() { + runTest("two declare warning handles"); + compareHandles(IProgramElement.Kind.DECLARE_WARNING, "declare warning: \"blah\"", "<pkg*A11.aj'A11`declare warning!2"); + } + + // this is to ensure the logic for not including '1' in the count + // works correctly. We don't want a decw ipe with count 1 but we do + // want one with count 10. + public void testTenDeclareWarningHandles() { + runTest("ten declare warning handles"); + compareHandles(IProgramElement.Kind.DECLARE_WARNING, "declare warning: \"warning 1\"", + "<*DeclareWarnings.aj'DeclareWarnings`declare warning"); + compareHandles(IProgramElement.Kind.DECLARE_WARNING, "declare warning: \"warning 10\"", + "<*DeclareWarnings.aj'DeclareWarnings`declare warning!10"); + + } + + // these two handles are the same unless we have added a counter + // on the end + public void testIPEsWithSameNameHaveUniqueHandles_methodCall() { + runTest("ipes with same name have unique handles - method-call"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + String handle1 = "<*TwoMethodCalls.aj[Main~main~\\[QString;?method-call(" + + "void java.io.PrintStream.println(java.lang.String))"; + assertNotNull("expected to find node with handle " + handle1 + ", but did not", top.getElement(handle1)); + + String handle2 = "<*TwoMethodCalls.aj[Main~main~\\[QString;?method-call(" + + "void java.io.PrintStream.println(java.lang.String))!2"; + assertNotNull("expected to find node with handle " + handle2 + ", but did not", top.getElement(handle2)); + + String handle3 = "<*TwoMethodCalls.aj[Main~main~\\[QString;?method-call(" + + "void java.io.PrintStream.println(java.lang.String))!3"; + assertNull("expected not to find node with handle " + handle3 + ", but found one", top.getElement(handle3)); + } + + // these two handles should be different anyway so second one + // shouldn't have the "2" + public void testIPEsWithDiffNamesDontHaveCounter_methodCall() { + runTest("ipes with different names do not have counter - method-call"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + String handle1 = "<*TwoDiffMethodCalls.aj[Main~main~\\[QString;?method-call(" + + "void java.io.PrintStream.println(java.lang.String))"; + assertNotNull("expected to find node with handle " + handle1 + ", but did not", top.getElement(handle1)); + + String handle2 = "<*TwoDiffMethodCalls.aj[Main~method~\\[QString;?method-call(" + + "void java.io.PrintStream.println(java.lang.String))"; + assertNotNull("expected to find node with handle " + handle2 + ", but did not", top.getElement(handle2)); + } + + public void testIPEsWithSameNameHaveUniqueHandles_handler() { + runTest("ipes with same name have unique handles - handler"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + String handle1 = "<*Handler.aj[C~method?exception-handler(void C." + "<catch>(java.io.FileNotFoundException))"; + assertNotNull("expected to find node with handle " + handle1 + ", but did not", top.getElement(handle1)); + + String handle2 = "<*Handler.aj[C~method?exception-handler(void C." + "<catch>(java.io.FileNotFoundException))!2"; + assertNotNull("expected to find node with handle " + handle2 + ", but did not", top.getElement(handle2)); + } + + public void testIPEsWithSameNameHaveUniqueHandles_get() { + runTest("ipes with same name have unique handles - get"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + String handle1 = "<*Get.aj[C1~method1?field-get(int C1.x)"; + assertNotNull("expected to find node with handle " + handle1 + ", but did not", top.getElement(handle1)); + + String handle2 = "<*Get.aj[C1~method1?field-get(int C1.x)!2"; + assertNotNull("expected to find node with handle " + handle2 + ", but did not", top.getElement(handle2)); + } + + public void testIPEsWithSameNameHaveUniqueHandles_set() { + runTest("ipes with same name have unique handles - set"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + String handle1 = "<*Set.aj[C1~method?field-set(int C1.x)"; + assertNotNull("expected to find node with handle " + handle1 + ", but did not", top.getElement(handle1)); + + String handle2 = "<*Set.aj[C1~method?field-set(int C1.x)!2"; + assertNotNull("expected to find node with handle " + handle2 + ", but did not", top.getElement(handle2)); + } + + public void testTwoPiecesOfBeforeAdviceInInjarAspectHaveUniqueHandles_pr159896() { + runTest("advice with same name in injar aspect should have unique handles"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + String handle1 = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.ADVICE, "before(): p..").getHandleIdentifier(); + String handle2 = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.ADVICE, "before(): exec..") + .getHandleIdentifier(); + assertFalse("expected the two advice nodes to have unique handles but" + " did not", handle1.equals(handle2)); + try { + AsmManager.lastActiveStructureModel.dumptree(AsmManager.lastActiveStructureModel.getHierarchy().getRoot(), 0); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public void testTwoDeclareWarningsInInjarAspectHaveUniqueHandles_pr159896() { + runTest("declare warnings in injar aspect should have unique handles"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + String handle1 = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_WARNING, "declare warning: \"blah\"") + .getHandleIdentifier(); + String handle2 = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_WARNING, "declare warning: \"blah2\"") + .getHandleIdentifier(); + assertFalse("expected the two declare warning nodes to have unique handles but" + " did not", handle1.equals(handle2)); + } + + // if have one declare warning and one declare error statement within an + // injar + // aspect, neither of them should have a counter (i.e. "!2") at the end of + // their handle + public void testOnlyIncrementSameDeclareTypeFromInjar_pr159896() { + runTest("dont increment counter for different declares"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + String warning = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_WARNING, + "declare warning: \"warning\"").getHandleIdentifier(); + assertTrue("shouldn't have incremented counter for declare warning handle " + "because only one declare warning statement", + warning.indexOf("!0") == -1 && warning.indexOf("!2") == -1); + String error = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.DECLARE_ERROR, "declare error: \"error\"") + .getHandleIdentifier(); + assertTrue("shouldn't have incremented counter for declare error handle " + "because only one declare error statement", + error.indexOf("!0") == -1 && error.indexOf("!2") == -1); + } + + // public void testOnlyIncrementSameAdviceKindFromInjar_pr159896() { + // runTest("dont increment counter for different advice kinds"); + // IHierarchy top = AsmManager.getDefault().getHierarchy(); + // String before = top.findElementForLabel(top.getRoot(), + // IProgramElement.Kind.ADVICE, "before(): p..") + // .getHandleIdentifier(); + // assertTrue("shouldn't have incremented counter for before handle " + // + "because only one before advice", before.indexOf("!0") == -1 + // && before.indexOf("!2") == -1 && before.indexOf("!3") == -1); + // String after = top.findElementForLabel(top.getRoot(), + // IProgramElement.Kind.ADVICE, "after(): p..") + // .getHandleIdentifier(); + // assertTrue("shouldn't have incremented counter for after handle " + // + "because only one after advice", after.indexOf("!0") == -1 + // && after.indexOf("!2") == -1 && after.indexOf("!3") == -1); + // String around = top.findElementForLabel(top.getRoot(), + // IProgramElement.Kind.ADVICE, "around(): p1..") + // .getHandleIdentifier(); + // assertTrue("shouldn't have incremented counter for around handle " + // + "because only one around advice", around.indexOf("!0") == -1 + // && around.indexOf("!2") == -1 && around.indexOf("!3") == -1); + // + // } + + // ---------- following tests ensure we produce the same handles as jdt + // -----// + // ---------- (apart from the prefix) + + // NOTES: there is no ipe equivalent to a package fragment root or + // + + public void testCompilationUnitSameAsJDT() { + // JDT: =TJP Example/src<tjp{Demo.java + runTest("compilation unit same as jdt"); + compareHandles(IProgramElement.Kind.FILE_JAVA, "Demo.java", "<tjp{Demo.java"); + } + + public void testClassSameAsJDT() { + // JDT: =Java5 Handles/src<pkg{C.java[C + runTest("class same as jdt"); + compareHandles(IProgramElement.Kind.CLASS, "C", "<pkg{C.java[C"); + } + + public void testInterfaceSameAsJDT() { + // JDT: =Java5 Handles/src<pkg{C.java[MyInterface + runTest("interface same as jdt"); + compareHandles(IProgramElement.Kind.INTERFACE, "MyInterface", "<pkg{C.java[MyInterface"); + } + + public void testConstructorSameAsJDT() { + // JDT: =Java5 Handles/src<pkg{C.java[C~C + runTest("constructor same as jdt"); + compareHandles(IProgramElement.Kind.CONSTRUCTOR, "C()", "<pkg{C.java[C~C"); + } + + public void testConstructorWithArgsSameAsJDT() { + // JDT: =Java5 Handles/src<pkg{C.java[C~C~QString; + runTest("constructor with args same as jdt"); + compareHandles(IProgramElement.Kind.CONSTRUCTOR, "C(java.lang.String)", "<pkg{C.java[C~C~QString;"); + } + + // public void testPackageDeclarationSameAsJDT() { + // // JDT: =TJP Example/src<tjp{Demo.java%tjp + // fail("package declaration isn't the same"); + // runTest("package declaration same as jdt"); + // compareHandles(IProgramElement.Kind.PACKAGE, + // "tjp", + // "<tjp{Demo.java%tjp"); + // } + + public void testImportDeclarationSameAsJDT() { + // JDT: =TJP Example/src<tjp{Demo.java#java.io.* + runTest("import declaration same as jdt"); + compareHandles(IProgramElement.Kind.IMPORT_REFERENCE, "java.io.*", "<tjp{Demo.java#java.io.*"); + } + + public void testTypeSameAsJDT() { + // JDT: =TJP Example/src<tjp{Demo.java[Demo + runTest("type same as jdt"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + IProgramElement pe = top.findElementForType("tjp", "Demo"); + String expected = "<tjp{Demo.java[Demo"; + String found = pe.getHandleIdentifier(); + assertEquals("handleIdentifier - expected " + expected + ", but found " + found, expected, found); + } + + public void testFieldSameAsJDT() { + // JDT: =TJP Example/src<tjp{Demo.java[Demo^d + runTest("field same as jdt"); + compareHandles(IProgramElement.Kind.FIELD, "d", "<tjp{Demo.java[Demo^d"); + } + + public void testInitializationSameAsJDT() { + // JDT: =TJP Example/src<tjp{Demo.java[Demo|1 + // and =TJP Example/src<tjp{Demo.java[Demo|2 + runTest("initialization same as jdt"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + IProgramElement parent = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.CLASS, "Demo"); + List children = parent.getChildren(); + String handle1 = null; + String handle2 = null; + for (Iterator iter = children.iterator(); iter.hasNext();) { + IProgramElement element = (IProgramElement) iter.next(); + if (element.getKind().equals(IProgramElement.Kind.INITIALIZER)) { + if (handle1 == null) { + handle1 = element.getHandleIdentifier(); + } else { + handle2 = element.getHandleIdentifier(); + } + } + } + String expected1 = "<tjp{Demo.java[Demo|1"; + String expected2 = "<tjp{Demo.java[Demo|2"; + boolean b = expected1.equals(handle1); + System.err.println("actual: " + handle1); + System.err.println("actual: " + handle2); + if (b) { + assertEquals("handleIdentifier - expected " + expected2 + ", but found " + handle2, expected2, handle2); + } else { + assertEquals("handleIdentifier - expected " + expected1 + ", but found " + handle2, expected1, handle2); + assertEquals("handleIdentifier - expected " + expected2 + ", but found " + handle1, expected2, handle1); + } + } + + public void testMethodWithStringArrayArgsSameAsJDT() { + // JDT: =TJP Example/src<tjp{Demo.java[Demo~main~\[QString; + runTest("method with string array as argument same as jdt"); + compareHandles(IProgramElement.Kind.METHOD, "main(java.lang.String[])", "<tjp{Demo.java[Demo~main~\\[QString;"); + } + + public void testMethodWithIntArrayArgsSameAsJDT() { + // JDT: =TJP Example/src<tjp{Demo.java[Demo~m~\[I + runTest("method with int array as argument same as jdt"); + compareHandles(IProgramElement.Kind.METHOD, "m(int[])", "<tjp{Demo.java[Demo~m~\\[I"); + } + + public void testMethodWithNoArgsSameAsJDT() { + // JDT: =TJP Example/src<tjp{Demo.java[Demo~go + runTest("method with no args same as jdt"); + compareHandles(IProgramElement.Kind.METHOD, "go()", "<tjp{Demo.java[Demo~go"); + } + + public void testMethodWithTwoArgsSameAsJDT() { + // JDT: =TJP Example/src<tjp{Demo.java[Demo~foo~I~QObject; + runTest("method with two args same as jdt"); + compareHandles(IProgramElement.Kind.METHOD, "foo(int,java.lang.Object)", "<tjp{Demo.java[Demo~foo~I~QObject;"); + } + + public void testMethodWithTwoStringArgsSameAsJDT() { + // JDT: =TJP Example/src<tjp{Demo.java[Demo~m2~QString;~QString; + runTest("method with two string args same as jdt"); + compareHandles(IProgramElement.Kind.METHOD, "m2(java.lang.String,java.lang.String)", + "<tjp{Demo.java[Demo~m2~QString;~QString;"); + } + + public void testEnumSameAsJDT() { + // JDT: =Java5 Handles/src<pkg{E.java[E + runTest("enum same as jdt"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + IProgramElement pe = top.findElementForType("pkg", "E"); + String expected = "<pkg{E.java[E"; + String found = pe.getHandleIdentifier(); + assertEquals("handleIdentifier - expected " + expected + ", but found " + found, expected, found); + } + + public void testEnumValueSameAsJDT() { + // JDT: =Java5 Handles/src<pkg{E.java[E^A + runTest("enum value same as jdt"); + compareHandles(IProgramElement.Kind.ENUM_VALUE, "A", "<pkg{E.java[E^A"); + } + + public void testAnnotationSameAsJDT() { + // JDT: =Java5 Handles/src<pkg{MyAnnotation.java[MyAnnotation + runTest("annotation same as jdt"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + IProgramElement pe = top.findElementForType("pkg", "MyAnnotation"); + String expected = "<pkg{MyAnnotation.java[MyAnnotation"; + String found = pe.getHandleIdentifier(); + assertEquals("handleIdentifier - expected " + expected + ", but found " + found, expected, found); + } + + public void testMethodWithListArgSameAsJDT() { + // JDT: =Java5 Handles/src<pkg{Java5Class.java[Java5Class~method2~QList; + runTest("method with list arg same as jdt"); + compareHandles(IProgramElement.Kind.METHOD, "method2(java.util.List)", "<pkg{Java5Class.java[Java5Class~method2~QList;"); + } + + public void testMethodWithGenericArgSameAsJDT() { + // JDT: =Java5 Handles/src<pkg{Java5Class.java[Java5Class + // ~genericMethod1~QList\<QString;>; + runTest("method with generic arg same as jdt"); + compareHandles(IProgramElement.Kind.METHOD, "genericMethod1(java.util.List<java.lang.String>)", + "<pkg{Java5Class.java[Java5Class~genericMethod1~QList\\<QString;>;"); + } + + public void testMethodWithTwoGenericArgsSameAsJDT() { + // JDT: =Java5 Handles/src<pkg{Java5Class.java[Java5Class + // ~genericMethod2~QList\<QString;>;~QMyGenericClass\<QInteger;>; + runTest("method with two generic args same as jdt"); + compareHandles(IProgramElement.Kind.METHOD, "genericMethod2(java.util.List<java.lang.String>," + + "pkg.MyGenericClass<java.lang.Integer>)", "<pkg{Java5Class.java[Java5Class~genericMethod2~QList" + + "\\<QString;>;~QMyGenericClass\\<QInteger;>;"); + } + + public void testMethodWithTwoTypeParametersSameAsJDT() { + // JDT: =Java5 Handles/src<pkg{Java5Class.java[Java5Class~genericMethod4 + // ~QMyGenericClass2\<QString;QInteger;>; + runTest("method with two type parameters same as jdt"); + compareHandles(IProgramElement.Kind.METHOD, "genericMethod4(pkg.MyGenericClass2<java.lang.String,java.lang.Integer>)", + "<pkg{Java5Class.java[Java5Class~genericMethod4" + "~QMyGenericClass2\\<QString;QInteger;>;"); + } + + public void testMethodWithTwoArgsSameAsJDT_2() { + // JDT: =Java5 Handles/src<pkg{Java5Class.java[Java5Class + // ~genericMethod3~I~QList\<QString;>; + runTest("method with two args one of which is generic same as jdt"); + compareHandles(IProgramElement.Kind.METHOD, "genericMethod3(int,java.util.List<java.lang.String>)", + "<pkg{Java5Class.java[Java5Class~genericMethod3~I~QList\\<QString;>;"); + } + + /* + * Still to do; PROJECT, PACKAGE, FILE, FILE_ASPECTJ, FILE_LST, DECLARE_ERROR, DECLARE_SOFT, DECLARE_PRECEDENCE, + */ + + // ----------- helper methods --------------- + private void compareHandles(IProgramElement.Kind kind, String ipeName, String expectedHandle) { + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + IProgramElement pe = top.findElementForLabel(top.getRoot(), kind, ipeName); + String found = pe.getHandleIdentifier(); + System.err.println("expected: " + expectedHandle); + System.err.println("actual: " + found); + assertEquals("handleIdentifier - expected " + expectedHandle + ", but found " + found, expectedHandle, found); + } + + // /////////////////////////////////////// + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(JDTLikeHandleProviderTests.class); + } + + protected File getSpecFile() { + return getClassResource("jdtlikehandleprovider.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc153/LTWServer153Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc153/LTWServer153Tests.java new file mode 100644 index 000000000..b307cb30a --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc153/LTWServer153Tests.java @@ -0,0 +1,23 @@ +package org.aspectj.systemtest.ajc153; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class LTWServer153Tests extends XMLBasedAjcTestCase { + + public static Test suite() { + return loadSuite(LTWServer153Tests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc153.xml"); + } + + public void testHandleDuplicateConfiguration_pr157474 () { + runTest("TestServer with duplicate configuration"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc153/PipeliningTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc153/PipeliningTests.java new file mode 100644 index 000000000..9edd04515 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc153/PipeliningTests.java @@ -0,0 +1,89 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM + * 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.ajc153; + +import java.io.File; + +import junit.framework.Test; + +//import org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter; +import org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter; +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * testplan: (x = complete) + * + * x @AspectJ aspects - are they recognized and sorted correctly ? + * x compiling classes (various orderings) + * x compiling classes (inheritance relationships) + * x compiling aspects and classes (various orderings - aspects first/last) + * x eclipse annotation transformation logic + * x aspects extending classes + * x nested types (and aspect inside a regular class) + * x set of files that are only aspects + * x pointcuts in super classes + * - classes with errors + * - aspects with errors + * - Xterminate after compilation (now == skip weaving??) + * + * That this pipeline works OK for large systems is kind of confirmed by using it to build shadows! + * + */ +public class PipeliningTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + // straightforward compilation + public void testBuildTwoClasses() { runTest("build two classes");} + public void testBuildOneAspectTwoClasses() { runTest("build one aspect and two classes");} + public void testBuildTwoClassesOneAspect() { runTest("build two classes and one aspect");} + public void testBuildTwoAspects() { runTest("build two aspects");} + public void testBuildClassAndNestedAspect() { runTest("build one class and deeply nested aspect");} + + public void testAspectExtendsClass() { runTest("aspect extends class"); } + + // verifying the type sorting + public void testRecognizingAnnotationStyleAspects1() { + AjPipeliningCompilerAdapter.pipelineTesting=true; + runTest("recognizing annotation style aspects - 1"); + + String filesContainingAspects = AjPipeliningCompilerAdapter.getPipelineDebugOutput("filesContainingAspects"); + assertTrue("Should be one file containing aspects but it thinks there are "+filesContainingAspects,filesContainingAspects.equals("1")); + + String weaveOrder = AjPipeliningCompilerAdapter.getPipelineDebugOutput("weaveOrder"); + String expectedOrder="[AtAJAspect.java,ClassOne.java]"; + assertTrue("Expected weaving order to be "+expectedOrder+" but was "+weaveOrder,weaveOrder.equals(expectedOrder)); + } + public void testRecognizingAnnotationStyleAspects2() { + AjPipeliningCompilerAdapter.pipelineTesting=true; + runTest("recognizing annotation style aspects - 2"); + + String filesContainingAspects = AjPipeliningCompilerAdapter.getPipelineDebugOutput("filesContainingAspects"); + assertTrue("Should be one file containing aspects but it thinks there are "+filesContainingAspects,filesContainingAspects.equals("1")); + + String weaveOrder = AjPipeliningCompilerAdapter.getPipelineDebugOutput("weaveOrder"); + String expectedOrder="[AtInnerAJAspect.java,ClassOne.java]"; + assertTrue("Expected weaving order to be "+expectedOrder+" but was "+weaveOrder,weaveOrder.equals(expectedOrder)); + } + + // verifying the new code for transforming Eclipse Annotations into AspectJ ones + public void testAnnotationTransformation() { runTest("annotation transformation"); } + + // -- + protected void tearDown() throws Exception { + super.tearDown(); + //AjPipeliningCompilerAdapter.pipelineTesting=false; + } + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(PipeliningTests.class); + } + protected File getSpecFile() { + return getClassResource("pipelining.xml"); + } +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc153/ajc153.xml b/tests/src/test/java/org/aspectj/systemtest/ajc153/ajc153.xml new file mode 100644 index 000000000..c4300e9c7 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc153/ajc153.xml @@ -0,0 +1,886 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.5.3 Tests --> +<suite> + <ajc-test dir="bugs153/pr149908" title="ensure no npe due to missing type"> + <compile files="A.aj,C1.java,Tracing.aj" inpath="simple.jar"> + <message kind="error" text="can't find type MyStringBuilder"/> + <message kind="error" text="can't determine superclass of missing type MyStringBuilder"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs153/pr149908" title="ensure no npe due to missing member"> + <compile files="A.aj,C1.java,Tracing.aj" inpath="simple.jar;stringBuilder.jar"> + <message kind="warning" text="can not resolve this member: append [Xlint:unresolvableMember]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs153/pr164340" title="formal comments are set for constructor ipes"> + <compile files="C.java" options="-emacssym -XjavadocsInModel -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="bugs153/pr162135" title="bcexception in annotation style around advice"> + <compile files="Foo.java" options="-1.5"/> + <run class="Foo"> + <stdout> + <line text="In if(), is there a caller? yes"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs153/pr162657" title="complex pointcut"> + <compile files="TestAspect.aj" options="-1.4"/> + </ajc-test> + + <ajc-test dir="bugs153/pr164633" title="incompatibleclasschange"> + <compile files="Model.java"/> + <run class="test.Model"/> + </ajc-test> + + <ajc-test dir="bugs153/pr162135" title="bcexception in annotation style around advice - 2"> + <compile files="Foo2.java" options="-1.5"/> + <run class="Foo2"/> + </ajc-test> + + <ajc-test dir="bugs153/pr162135" title="bcexception in annotation style around advice - 3"> + <compile files="Foo3.java" options="-1.5"/> + <run class="Foo3"/> + </ajc-test> + + <ajc-test dir="bugs153/pr162135" title="bcexception in annotation style around advice - 4"> + <compile files="Foo4.java" options="-1.5"/> + <run class="Foo4"/> + </ajc-test> + + <ajc-test dir="bugs153/pr162135" title="bcexception in annotation style around advice - 5"> + <compile files="Foo5.java" options="-1.5"/> + <run class="Foo5"/> + </ajc-test> + + <ajc-test dir="bugs153/pr162135" title="bcexception in annotation style around advice - 6"> + <compile files="Foo6.java" options="-1.5"/> + <run class="Foo6"> + <stdout> + <line text="ProceedingJoinPoint is call(java.lang.RuntimeException(String))"/> + <line text="caller is notnull"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs153/pr162135" title="bcexception in annotation style around advice - 7"> + <compile files="Real.java" options="-1.5"/> + <run class="a.b.c.Real"> + <stdout> + <line text="advice running"/> + <line text="newmessage"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs153/pr159143" title="declare method annotations"> + <compile files="DeclareMethodAnnotation.java" options="-1.5"> + <message line="16" kind="warning" text="all"/> + <message line="17" kind="warning" text="all"/> + <message line="18" kind="warning" text="all"/> + <message line="22" kind="warning" text="all"/> + <message line="23" kind="warning" text="all"/> + <message line="24" kind="warning" text="all"/> + <message line="27" kind="warning" text="all"/> + <message line="28" kind="warning" text="all"/> + <message line="29" kind="warning" text="all"/> + <message line="33" kind="warning" text="all"/> + <message line="34" kind="warning" text="all"/> + <message line="35" kind="warning" text="all"/> + <message line="39" kind="warning" text="all"/> + <message line="40" kind="warning" text="all"/> + <message line="41" kind="warning" text="all"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs153/pr148908" title="ensure getSourceSignature correct with static field"> + <compile files="BadInterface.java" options="-1.5 -emacssym -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="bugs153/pr161502" title="generics in pointcuts"> + <compile files="Main.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-call(java.util.List Main.getElements())' in Type 'Main' (Main.java:31) advised by around advice from 'Main$Concrete' (Main.java:18)"/> + </compile> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="bugs153/pr161502" title="generics in pointcuts - 2"> + <compile files="Main2.java" options="-1.5 -showWeaveInfo"> + <message kind="warning" text="advice defined in Main2$Base has not been applied"/> + </compile> + <run class="Main2"/> + </ajc-test> + + <ajc-test dir="bugs153/pr158624" title="generics and arrays"> + <compile files="ValueChange.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs153/pr153845" title="IllegalStateException at GenericSignatureParser.java"> + <compile files="GenericType.java,Aspect.java,Aspect2.java,Interface.java" options="-1.5" outjar="blob.jar"/> + <compile files="Nothing.java" aspectpath="blob.jar" options="-1.5" outjar="bang.jar"/> + </ajc-test> + + <ajc-test dir="bugs153/pr158412" title="annotation style pointcut npe"> + <compile files="layering/Layering.aj,layering/SystemArchitektur.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs153/pr153464" title="negated annotation matching problem"> + <compile files="Bug.java" options="-1.5"> + <message kind="warning" line="99"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs153/pr158412" title="annotation style pointcut npe - 2"> + <compile files="layering/Layering.aj,layering/SystemArchitektur.java,dao/Foo.java" options="-1.5"> + <message kind="warning" line="3" text="Whatever"/> + </compile> + </ajc-test> + + <ajc-test dir="features153/ptw" title="basic usage of getWithinTypeName"> + <compile files="CaseOne.java"/> + <run class="CaseOne"> + <stdout> + <line text="AClass has an aspect instance"/> + <line text="The aspect instance thinks it is for type name AClass"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features153/ptw" title="basic usage of getWithinTypeName - annotation style"> + <compile files="CaseFive.java" options="-1.5"/> + <run class="CaseFive"> + <stdout> + <line text="AClass has an aspect instance"/> + <line text="The aspect instance thinks it is for type name AClass"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features153/ptw" title="basic usage of getWithinTypeName - multiple types"> + <compile files="CaseTwo.java"/> + <run class="CaseTwo"> + <stdout> + <line text="BClass aspect instance gives a within type name of BClass"/> + <line text="CClass aspect instance gives a within type name of CClass"/> + <line text="AClass aspect instance gives a within type name of AClass"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features153/ptw" title="basic usage of getWithinTypeName - non matching types"> + <compile files="CaseThree.java"/> + <run class="CaseThree"> + <stdout> + <line text="BClass aspect instance gives a within type name of <null>"/> + <line text="CClass aspect instance gives a within type name of CClass"/> + <line text="AClass aspect instance gives a within type name of AClass"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features153/ptw" title="basic usage of getWithinTypeName - types in packages"> + <compile files="CaseFour.java"/> + <run class="a.b.CaseFour"> + <stdout> + <line text="BClass aspect instance gives a within type name of a.b.BClass"/> + <line text="CClass aspect instance gives a within type name of a.b.CClass"/> + <line text="AClass aspect instance gives a within type name of a.b.AClass"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs153/pr158126" title="annotations, call and constructors problem"> + <compile files="A.java,B.java,MyAnnotation.java,MyAspect.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'constructor-call(void B.<init>())' in Type 'A' (A.java:5) advised by before advice from 'MyAspect' (MyAspect.java:3)"/> + <message kind="weave" text="Join point 'constructor-call(void B.<init>(int))' in Type 'A' (A.java:10) advised by before advice from 'MyAspect' (MyAspect.java:3)"/> + <message kind="weave" text="Join point 'constructor-call(void A.<init>())' in Type 'A' (A.java:14) advised by before advice from 'MyAspect' (MyAspect.java:3)"/> + <message kind="weave" text="Join point 'constructor-call(void A.<init>(int))' in Type 'A' (A.java:15) advised by before advice from 'MyAspect' (MyAspect.java:3)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs153/pr156058" title="no IllegalStateException with generic inner aspect"> + <compile files="Bug.java" options="-1.5"> + <message kind="warning" line="2" text="advice defined in MyAspect has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs153/pr156058" title="no IllegalStateException with generic inner aspect - 2"> + <compile files="Bug2.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-call(MyClass Bug2.callit())' in Type 'Bug2' (Bug2.java:15) advised by before advice from 'MyAspect' (Bug2.java:2)"/> + <message kind="warning" line="24" text="advice defined in MyAspect2 has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs153/pr153490" title="no illegal state exception from AsmDelegate - 1"> + <compile files="Foo.java" options="-1.5" classpath="jarForFoo.jar" /> + </ajc-test> + + <ajc-test dir="bugs153/pr153490" title="no illegal state exception from AsmDelegate - 2"> + <compile files="Bar.java" options="-1.5" classpath="jarForBar.jar" /> + </ajc-test> + + <ajc-test dir="bugs153/pr153490" title="no illegal state exception from AsmDelegate - 3"> + <compile files="Goo.java" options="-1.5" classpath="jarForGoo.jar" /> + </ajc-test> + + <ajc-test dir="bugs153/pr156962" title="Test Annot Method"> + <compile files="Sample.java, WarnDeprecatedMethod.aj" options="-1.5"> + <message kind="warning" line="2" text="deprecated method"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs153/pr156962" title="Test Annot Method Has Member"> + <compile files="Sample.java, LiftDeprecation.aj" options="-1.5 -XhasMember -showWeaveInfo -Xlint:ignore"> + <message kind="weave" text="'Sample' (Sample.java:1) is annotated with @Deprecated type annotation from 'LiftDeprecation' (LiftDeprecation.aj:2)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs153/pr152848" title="mixing generics"> + <compile files="PairGeneric.java" options="-1.5" outjar="pair1.jar"/> + <compile files="BaseType.java" options="-1.5" outjar="basetype.jar" classpath="pair1.jar"/> + <compile files="PairNormal.java" outjar="pair2.jar"/> + <compile files="AnAspect.java" options="-1.5 -Xset:runMinimalMemory=true" inpath="basetype.jar;pair2.jar"/> + </ajc-test> + + <ajc-test dir="bugs153/pr152871" title="parsing bytecode less"> + <compile files="MyClass.java" options="-1.5"/> + <compile files="MyAspect.java" options="-1.5 -Xlint:ignore"/> + <run class="a.MyClass" ltw="aop.xml"> + <stdout> + <line text="advice running"/> + <line text="hello"/> + <line text="advice running"/> + <line text="world"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs153/pr160674" title="turning off bcel caching"> + <compile files="MyClass.java" options="-1.5"/> + <compile files="MyAspect.java" options="-1.5 -Xlint:ignore"/> + <run class="a.MyClass" ltw="aop.xml"> + <stdout> + <line text="advice running"/> + <line text="hello"/> + <line text="advice running"/> + <line text="world"/> + </stdout> + <stderr> + <line text="info AspectJ Weaver Version"/> + <line text="info register classloader"/> + <line text="info using"/> + <line text="info [bcelRepositoryCaching=false] AspectJ will not"/> + <line text="info register aspect"/> + <line text="info processing"/> + <line text="info successfully"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs153/pr153380/case1" title="pipelining decps"> + <compile files="Ann.java,Base.java,BaseImpl.java,I1.java,Mixin.java,Runner.java,X.aj" options="-1.5"> + <message kind="error" line="1" text="The import java.lang.retention cannot be resolved"/> + <message kind="error" line="3" text="Retention cannot be resolved to a type"/> + <message kind="error" line="3" text="RetentionPolicy cannot be resolved to a variable"/> + <!-- With 1.8 don't seem to get this now - assume it is because the annotation isn't being found + <message kind="error" line="3" text="The attribute value is undefined for the annotation type Retention"/> + --> + </compile> + </ajc-test> + + <ajc-test dir="bugs153/pr154332" title="incorrect deprecated annotation processing"> + <compile files="Annot.java" options="-1.5"> + <message kind="warning" line="5" text="marker"/> + <message kind="warning" line="31" text="marker"/> + <message kind="warning" line="5" text="deprecated"/> + <message kind="warning" line="31" text="deprecated"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs153/pr148381" title="argNames and javac"> + <!--compile files="C.java" options="-1.5"/> + <compile files="A.java" options="-1.5"/--> + <compile files="Main.java,Monitor.java" options="-1.5" outjar="foo.jar" classpath="code.jar"/> + <run class="test.Main" classpath="$sandbox/code.jar" ltw="aop.xml"> + <stderr> + <line text="goo"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs153/PR148219" title="unwanted warning for pointcut"> + <compile files="MyMessages.java" options="-1.5 -Xlint:ignore -warn:+unusedArgument"/> + </ajc-test> + + <ajc-test dir="bugs153/pr148737" title="illegalstateexception for non generic type"> + <compile files="A.java" options="-source 5 -target 5"> + <message kind="warning" line="18" text="advice defined in TestAspect has not been applied"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs153/pr149096" title="cflow xml concrete aspect"> + <compile files="SimpleTracing.aj" outjar="out.jar"/> + <compile files="TestMain.aj"/> + <run class="TestMain" ltw="aop-pr149096.xml"/> + </ajc-test> + + <ajc-test dir="bugs153/pr149305/case1" title="ataj inheritance - 1"> + <compile files="AbstractOzonator.java,IdentityOzonator.java,User.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs153/pr149305/case2" title="ataj inheritance - 2"> + <compile files="com/codesrc/ozonator/identity/IdentityOzonator.java,com/codesrc/ozonator/identity/User.java,com/codesrc/ozonator/AbstractOzonator.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs153/pr149305/case2" title="ataj inheritance - 3"> + <compile files="com/codesrc/ozonator/AbstractOzonator.java,com/codesrc/ozonator/identity/IdentityOzonator.java,com/codesrc/ozonator/identity/User.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs153/pr148693" title="verification problem"> + <compile files="MyAspect.java" options="-1.5 -XterminateAfterCompilation=true"/> + </ajc-test> + + <ajc-test dir="bugs153/pr148537" title="incorrect annotation value"> + <compile files="MyClass.java" options="-1.5"> + <message kind="error" line="5" text="Type mismatch: cannot convert from RetentionPolicy[] to RetentionPolicy"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs153/pr145693" title="verifyErrNoTypeCflowField"> + <compile files="Event.java" outjar="cpath.jar"/> + <compile files="Monitor.aj" outjar="apath.jar" classpath="cpath.jar" options="-1.4"/> + <compile files="Sample.java" options="-Xlint:ignore" aspectpath="apath.jar" outjar="run.jar"> + <message kind="warning" line="8" text="Unable to determine match at this join point because the type 'Event' cannot be found"/> + </compile> + <run class="Sample" classpath="run.jar,apath.jar"> + <stderr> + <line text="method running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs153/pr145693" title="verifyErrInpathNoTypeCflowField"> + <compile files="Event.java" outjar="cpath.jar"/> + <compile files="Monitor.aj" outjar="apath.jar" classpath="cpath.jar" options="-1.4"/> + <compile files="Sample.java" options="-Xlint:ignore" inpath="cpath.jar" aspectpath="apath.jar" outjar="run.jar"/> + <run class="Sample" classpath="run.jar,apath.jar"/> + </ajc-test> + + <ajc-test dir="bugs153/pr145693" title="cpathNoTypeCflowField"> + <compile files="Event.java" outjar="cpath.jar"/> + <compile files="Monitor.aj" outjar="apath.jar" classpath="cpath.jar" options="-1.4"/> + <compile files="Sample.java" options="-Xlint:ignore" classpath="cpath.jar" aspectpath="apath.jar" outjar="run.jar"/> + <run class="Sample" classpath="run.jar,apath.jar"/> + </ajc-test> + + <ajc-test dir="bugs153/pr148409" title="generic signature problem"> + <compile files="Blurgh.java" options="-1.5"/> + <compile files="X.java" options="-1.5 -Xlint:ignore"/> + <run class="Blurgh" options="-1.5" ltw="aop.xml"/> + </ajc-test> + + <ajc-test dir="bugs153/pr149071" title="visibility problem"> + <compile files="AspectItd.java"/> + <run class="AspectItd"/> + </ajc-test> + + <ajc-test dir="bugs153/pr147841" title="advice not woven on aspectpath"> + <compile files="A.java" options="-Xlint:ignore" outjar="apath.jar"/> + <!--compile files="C.java" outjar="cpa.jar" classpath="cpath.jar"/--> + <compile files="C.java" options="-showWeaveInfo" aspectpath="apath.jar"> + <message kind="weave" text="foo"/> + </compile> + <run class="C"> + <stderr> + <line text="foo"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs153/pr150095" title="generics, inheritance and decp"> + <compile files="Foo.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs153/pr121805" title="ambiguous binding"> + <compile files="Complex.java"/> + </ajc-test> + + <ajc-test dir="bugs153/pr145442" title="missing line numbers in stacktrace before"> + <compile files="hello/HelloWorld.java hello/ThrowExceptionBefore.aj"/> + <run class="hello.HelloWorld"> + <stderr> + <line text="hello.HelloWorld.println(HelloWorld.java:14)"/> + <line text="hello.HelloWorld.testStackTrace(HelloWorld.java:19)"/> + <line text="hello.HelloWorld.main(HelloWorld.java:41)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs153/pr145442" title="missing line numbers in stacktrace before - binary"> + <compile inpath="helloworld.jar" files="hello/ThrowExceptionBefore.aj"/> + <run class="hello.HelloWorld"> + <stderr> + <line text="hello.HelloWorld.println(HelloWorld.java:14)"/> + <line text="hello.HelloWorld.testStackTrace(HelloWorld.java:19)"/> + <line text="hello.HelloWorld.main(HelloWorld.java:41)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs153/pr145442" title="missing line numbers in stacktrace after"> + <compile files="hello/HelloWorld.java hello/ThrowExceptionAfter.aj"/> + <run class="hello.HelloWorld"> + <stderr> + <line text="hello.HelloWorld.println(HelloWorld.java:15)"/> + <line text="hello.HelloWorld.testStackTrace(HelloWorld.java:19)"/> + <line text="hello.HelloWorld.main(HelloWorld.java:41)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs153/pr145442" title="missing line numbers in stacktrace around"> + <compile files="hello/HelloWorld.java hello/ThrowExceptionAround.aj" options="-XnoInline"/> + <run class="hello.HelloWorld"> + <stderr> + <line text="hello.HelloWorld.println(HelloWorld.java:13)"/> + <line text="hello.HelloWorld.testStackTrace(HelloWorld.java:19)"/> + <line text="hello.HelloWorld.main(HelloWorld.java:41)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs153/pr149322" title="can't find type on interface call 1"> + <compile files="Interface.java"/> + <compile + files="Missing.java" + outjar="missing.jar" + /> + <compile files="TestWithMissing.java" classpath="missing.jar"/> + <compile files="Aspect1.aj" options="-showWeaveInfo -inpath ." classpath="missing.jar"> + <message kind="weave" text="void Interface.interfaceMethod()"/> + <message kind="weave" text="void Missing.interfaceMethod()"/> + </compile> + <compile files="Aspect1.aj" options="-Xlint:warning -showWeaveInfo -inpath ."> + <message kind="weave" text="void Interface.interfaceMethod()"/> + <!-- + <message kind="warning" text="can't determine superclass of missing type Missing"/> + --> + </compile> + <run class="TestWithMissing"> + <stdout> + <line text="Aspect1.before() interfaceMethod"/> + <line text="Missing.interfaceMethod()"/> +<!-- + <line text="Aspect1.before() interfaceMethod"/> +--> + <line text="Missing.interfaceMethod()"/> + <line text="Missing.missingMethod()"/> + </stdout> + </run> + </ajc-test> + <ajc-test dir="bugs153/pr149322" title="can't find type on interface call 2"> + <compile files="Interface.java"/> + <compile + files="Missing.java" + outjar="missing.jar" + /> + <compile files="TestWithMissing.java" classpath="missing.jar"/> + <compile files="Aspect2.aj" options="-showWeaveInfo -inpath ." classpath="missing.jar"> + <message kind="weave" text="void Interface.interfaceMethod()"/> + <message kind="weave" text="void Missing.interfaceMethod()"/> + </compile> + <compile files="Aspect2.aj" options="-Xlint:warning -showWeaveInfo -inpath ."> + <message kind="weave" text="void Interface.interfaceMethod()"/> + <message kind="warning" text="can't determine whether missing type Missing is an instance of Interface"/> + <message kind="warning" text="can't determine superclass of missing type Missing"/> + </compile> + <run class="TestWithMissing"> + <stdout> + <line text="Aspect2.before() interfaceMethod"/> + <line text="Missing.interfaceMethod()"/> +<!-- + <line text="Aspect2.before() interfaceMethod"/> +--> + <line text="Missing.interfaceMethod()"/> + <line text="Missing.missingMethod()"/> + </stdout> + </run> + </ajc-test> + <ajc-test dir="bugs153/pr149322" title="can't find type on interface call 3"> + <compile files="Interface.java"/> + <compile + files="Missing.java" + outjar="missing.jar" + /> + <compile files="TestWithMissing.java" classpath="missing.jar"/> + <compile files="Aspect3.aj" options="-showWeaveInfo -inpath ." classpath="missing.jar"> + <message kind="weave" text="void Interface.interfaceMethod()"/> + <message kind="weave" text="void Missing.interfaceMethod()"/> + </compile> + <compile files="Aspect3.aj" options="-Xlint:warning -showWeaveInfo -inpath ."> + <message kind="weave" text="void Interface.interfaceMethod()"/> + <message kind="warning" text="can't determine whether missing type Missing is an instance of Interface"/> + <message kind="warning" text="can't determine superclass of missing type Missing"/> + </compile> + <run class="TestWithMissing"> + <stdout> + <line text="Aspect3.before() interfaceMethod"/> + <line text="Missing.interfaceMethod()"/> +<!-- + <line text="Aspect3.before() interfaceMethod"/> +--> + <line text="Missing.interfaceMethod()"/> + <line text="Missing.missingMethod()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs153" title="match volatile field"> + <compile files="pr150671.aj" options="-Xset:activateLightweightDelegates=false"> + <message kind="error" line="7" text="Changing state"/> + <message kind="error" line="8" text="test"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/ataspectj" title="Duplicate JVMTI agents"> + <compile files="HelloWorld.java"/> + <compile files="MessageHandler.java"/> +<!-- <compile files="Aspect.aj" options="-outxml"/> --> + <compile files="Aspect.aj" options="-outxml -outjar aspects.jar -1.4"/> + <ant file="ajc-ant.xml" target="Duplicate JVMTI agents" verbose="true"/> + </ajc-test> + + <ajc-test dir="bugs153/pr151978" title="generics problem"> + <compile files="IMessage.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs153/pr152631" title="decp and cflowadder munger clash"> + <compile files="EMA.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs153/pr153572" title="LTWWorld with annotation matching"> + <compile + files="Configurable.java, AnnotationMatcher.aj" + options="-1.5" + outjar="aspectlib.jar" + outxmlfile="META-INF/aop.xml"/> + <compile files="Configurable.java,Annotated.java,Main.java" options="-1.5" outjar="myapp.jar"/> + <run class="Main" ltw=""> + <stdout> + <line text="annotated type initialized"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs153/pr149560" title="incorrect staticinitialization weaving - codestyle"> + <compile files="CodeStyle.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'staticinitialization(void MyAspect.<clinit>())' in Type 'MyAspect' (CodeStyle.java:3) advised by after advice from 'MyAspect' (CodeStyle.java:4)"/> + <message kind="weave" test="Join point 'staticinitialization(void CodeStyle.<clini>())' in Type 'CodeStyle' (CodeStyle.java:9) advised by after advice from 'MyAspect' (CodeStyle.java:4)"/> + </compile> + <run class="CodeStyle"> + <stdout> + <line text="after initialization staticinitialization(MyAspect.<clinit>)"/> + <line text="after initialization staticinitialization(CodeStyle.<clinit>)"/> + <line text="InstanceExists?true"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs153/pr149560" title="incorrect staticinitialization weaving - annstyle"> + <compile files="AnnStyle.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'staticinitialization(void MyAspect.<clinit>())' in Type 'MyAspect' (AnnStyle.java:5) advised by after advice from 'MyAspect' (AnnStyle.java:7)"/> + <message kind="weave" test="Join point 'staticinitialization(void AnnStyle.<clini>())' in Type 'AnnStyle' (AnnStyle.java:12) advised by after advice from 'MyAspect' (AnnStyle.java:7)"/> + </compile> + <run class="AnnStyle"> + <stdout> + <line text="after initialization staticinitialization(MyAspect.<clinit>)"/> + <line text="after initialization staticinitialization(AnnStyle.<clinit>)"/> + <line text="InstanceExists?true"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="ltw" title="reweavableAspectNotRegistered error"> + <compile files="HelloWorldWithException.java, ExceptionHandler.aj" options="-showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void HelloWorldWithException.main(java.lang.String[]))' in Type 'HelloWorldWithException' (HelloWorldWithException.java:3) advised by around advice from 'ExceptionHandler' (ExceptionHandler.aj:2)"/> + </compile> + <compile files="EmptyAspect.aj"> + </compile> + <run class="HelloWorldWithException" ltw="aop-missingaspect.xml"> + <stdout> + <line text="Hello World!"/> + </stdout> + <stderr> + <line text="error aspect 'ExceptionHandler' woven into 'HelloWorldWithException' must be defined to the weaver (placed on the aspectpath, or defined in an aop.xml file if using LTW)."/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs153/pr155972" title="NPE in ConstructorSignatureImpl"> + <compile files="ConstructorTest.java, SignatureImplAspect.aj" options="-Xlint:ignore"/> + <run class="ConstructorTest"> + <stdout> + <line text="ConstructorTest"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs153/pr155972" title="NPE in FieldSignatureImpl"> + <compile files="FieldTest.java, SignatureImplAspect.aj" options="-Xlint:ignore"/> + <run class="FieldTest"> + <stdout> + <line text="intField"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs153/pr155972" title="NPE in InitializerSignatureImpl"> + <compile files="InitializerTest.java, SignatureImplAspect.aj" options="-Xlint:ignore"/> + <run class="InitializerTest"> + <stdout> + <line text="InitializerTest"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs153/pr155763" title="ensure LineNumberTable correct with generics, for each and continue"> + <compile files="Test.java" options="-1.5"> + <message kind="warning" line="27" text="adviceDidNotMatch"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs153/pr157474" title="TestServer with duplicate configuration" keywords="ltw,server"> + <compile files="AbstractTracing.aj" options="-outjar library.jar -outxml"/> + <compile files="HelloWorld.java" options="-outjar application.jar"/> + <ant file="ant-server.xml" target="TestServer with duplicate configuration" verbose="true"> + <stdout> + <line text="Starting ..."/> + <line text="Running HelloWorld"/> + <line text="? main"/> + <line text="Hello World!"/> + <line text="Stopping ..."/> + </stdout> + </ant> + </ajc-test> + + <ajc-test dir="bugs153/pr151772" title="ensure declare soft doesn't allow undeclared exception in anonymous inner class"> + <compile files="Softener.aj"/> + </ajc-test> + + <ajc-test dir="bugs153/pr151772" title="ensure declare soft doesn't allow undeclared exception in anonymous inner class - 2"> + <compile files="Softener2.aj"> + <message kind="error" line="18" text="Unhandled exception type SQLException"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs153/pr125981" title="declare soft and inner classes"> + <compile files="SampleTest.java"/> + </ajc-test> + + <ajc-test dir="bugs153/pr156904/inSameFile" title="ensure no invalidAbsoluteTypeName when do match - 1"> + <compile files="A.aj"/> + </ajc-test> + + <ajc-test dir="bugs153/pr156904/inDiffPkgAndImport" title="ensure no invalidAbsoluteTypeName when do match - 2"> + <compile files="A.aj,Outer.java"/> + </ajc-test> + + <ajc-test dir="bugs153/pr156904/inSamePkg" title="ensure no invalidAbsoluteTypeName when do match - 3"> + <compile files="A.aj,Outer.java"/> + </ajc-test> + + <ajc-test dir="bugs153/pr156904/inDiffPkgWithoutImport" title="ensure no invalidAbsoluteTypeName when do match - 4"> + <compile files="A.aj,Outer.java" options="-1.4"> + <message kind="warning" line="5" text="no match for this type name: Outer [Xlint:invalidAbsoluteTypeName]"/> + </compile> + </ajc-test> + + <ajc-test dir="ltw" title="NPE with custom agent" keywords="ltw"> + <compile files="java/net/URLClassLoader.java"/> + <compile files="HelloWorldWithException.java" options="-outjar hello.jar"/> + <compile files="ExceptionHandler.aj" options="-outxml -outjar handler.jar"/> + <compile files="NullSecurityManager.java" options="-outjar security.jar"/> + <ant file="ant.xml" target="NPE with custom agent" verbose="true"> + <stdout> + <line text="Hello World!"/> + </stdout> + </ant> + </ajc-test> + + <ajc-test dir="bugs153/pr158957" title="NPE with LTW, pointcut library and missing aspect dependency" keywords="ltw"> + <compile files="HelloWorld.java" options="-outjar hello.jar"/> + <compile files="Missing.java" options="-outjar missing.jar"/> + <compile files="Tracing.aj, PointcutLibrary.aj" options="-Xlint:ignore -1.5 -outxml -outjar tracing.jar" classpath="hello.jar,missing.jar"/> +<!-- + <run class="HelloWorld" ltw="aop.xml"> + <stdout> + <line text="? main"/> + <line text="Hello World!"/> + </stdout> + </run> +--> + <ant file="ant.xml" target="NPE with LTW, pointcut library and missing aspect dependency" verbose="true"> + <stdout> + <line text="? main"/> + <line text="Hello World!"/> + </stdout> + </ant> + + </ajc-test> + + <ajc-test dir="bugs153/pr132080" + title="Weave concrete sub-aspect with advice" + keywords="aop.xml"> + <compile + files="HelloWorld.java" + > + </compile> + <compile files="AbstractSuperAspect.aj" options="-1.4"/> + <compile files="TestAdvice.aj" options="-1.4"/> + <run class="HelloWorld" ltw="aop-advice.xml"> + <stdout> + <line text="? ConcreteAspectWithAdvice()"/> + <line text="? void HelloWorld.main(String[])"/> + <line text="? HelloWorld()"/> + <line text="Hello World!"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs153/pr132080" + title="Weave concrete sub-aspect with ITD" + keywords="aop.xml"> +<!-- + <compile files="AbstractSuperAspectWithInterface.aj, TestInterface.java" options="-verbose"/> + <compile files="HelloWorld.java, TestITD.aj, ConcreteAspectWithITD.aj" options="-verbose"> + <message line="3" kind="warning" text="this affected type is not exposed to the weaver: AbstractSuperAspectWithInterface"/> + </compile> + <run class="HelloWorld"> + <stdout> + <line text="? void TestITD.interfaceMethod()"/> + <line text="? void HelloWorld.main(String[])"/> + <line text="Hello World!"/> + </stdout> + </run> +--> + <compile files="HelloWorld.java"/> + <compile files="AbstractSuperAspectWithInterface.aj, TestInterface.java"/> + <compile files="TestITD.aj"> + <message line="3" kind="warning" text="this affected type is not exposed to the weaver: AbstractSuperAspectWithInterface"/> + </compile> + <run class="HelloWorld" ltw="aop-itd.xml"> + <stdout> + <line text="? void TestITD.interfaceMethod()"/> + <line text="? void HelloWorld.main(String[])"/> + <line text="Hello World!"/> + </stdout> + </run> + + </ajc-test> + + <ajc-test dir="bugs153/pr132080" title="Weave concrete sub-aspect with around closure" + keywords="aop.xml"> + + <compile files="HelloWorld.java"/> + <compile files="AbstractSuperAspect.aj" options="-1.4"/> + <compile files="TestAroundClosure.aj" options="-1.4"/> + <run class="HelloWorld" ltw="aop-aroundclosure.xml"> + <stdout> + <line text="&rt; ConcreteAspectWithAroundClosure()"/> + <line text="< ConcreteAspectWithAroundClosure()"/> + <line text="? void HelloWorld.main(String[])"/> + <line text="&rt; HelloWorld()"/> + <line text="< HelloWorld()"/> + <line text="Hello World!"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs153/pr149096" title="Weave concrete sub-aspect with cflow"> + <compile files="SimpleTracing.aj" outjar="out.jar"/> + <compile files="TestMain.aj"/> + <run class="TestMain" ltw="aop-pr149096.xml"/> + </ajc-test> + + <ajc-test dir="bugs153/pr158957" title="NPE with LTW, pointcut library and missing aspect dependency" keywords="ltw"> + <compile files="HelloWorld.java" options="-outjar hello.jar"/> + <compile files="Missing.java" options="-outjar missing.jar"/> + <compile files="Tracing.aj, PointcutLibrary.aj" options="-Xlint:ignore -1.5 -outxml -outjar tracing.jar" classpath="hello.jar,missing.jar"/> +<!-- + <run class="HelloWorld" ltw="aop.xml"> + <stdout> + <line text="? main"/> + <line text="Hello World!"/> + </stdout> + </run> +--> + <ant file="ant.xml" target="NPE with LTW, pointcut library and missing aspect dependency" verbose="true"> + <stdout> + <line text="? println"/> + <line text="Hello World!"/> + </stdout> + </ant> + + </ajc-test> + + <ajc-test dir="bugs153/pr161217" title="NPE with thrown exception warning and at aspectj"> + <compile files="AtAspectJAspect.java, C.java" options="-warn:+unusedThrown -1.5"/> + </ajc-test> + + <ajc-test dir="bugs153/pr164384" title="binary weaving into java 6 library"> + <compile files="MainClass.java, WorldAspect.aj" inpath="library.jar" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void pkg.Hello.sayHello())' in Type 'pkg.Hello' (Hello.java:7) advised by afterReturning advice from 'pack.WorldAspect' (WorldAspect.aj:9)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs153/pr164356" title="javadoc comments are set if have normal comments"> + <compile files="C.java" options="-emacssym -XjavadocsInModel -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="bugs153/pr164384" title="compliance java 6 throws usage error"> + <compile files="MainClass.java,Hello.java,MyAnnotation.java" options="-1.6"> + <!-- + <message kind="error" text="-1.6"/> + <message kind="error" text="no sources specified"/> + <message kind="abort" text="AspectJ Compiler"/> + --> + </compile> + </ajc-test> + + <ajc-test dir="bugs153/pr164384" title="source level java 6 throws usage error"> + <compile files="MainClass.java,Hello.java,MyAnnotation.java" options="-1.6"> + <!-- + <message kind="error" text="-1.6"/> + <message kind="error" text="no sources specified"/> + <message kind="abort" text="AspectJ Compiler"/> + --> + </compile> + </ajc-test> + + <ajc-test dir="bugs153/pr164384" title="target level java 6 throws usage error"> + <compile files="MainClass.java,Hello.java,MyAnnotation.java" options="-1.6"> + <!-- + <message kind="error" text="-1.6"/> + <message kind="error" text="no sources specified"/> + <message kind="abort" text="AspectJ Compiler"/> + --> + </compile> + </ajc-test> + + <ajc-test dir="bugs153/StaticImport" title="ensure static import reference have static modifier set"> + <compile files="StaticImport.java,C.java" options="-1.5 -emacssym -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="bugs153/GenericMethod" title="ensure getSourceSignature correct with generic method"> + <compile files="C.java" options="-1.5 -emacssym -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="bugs153/Annotation" title="ensure Annotations are added to import list"> + <compile files="C.java, Anno.aj, A.java" options="-1.5 -emacssym"/> + </ajc-test> +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc153/jdtlikehandleprovider.xml b/tests/src/test/java/org/aspectj/systemtest/ajc153/jdtlikehandleprovider.xml new file mode 100644 index 000000000..215240fe4 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc153/jdtlikehandleprovider.xml @@ -0,0 +1,256 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.5.2 Tests --> +<suite> + + <ajc-test dir="features153/jdtlikehandleprovider" title="More than one named pointcut"> + <compile files="HandleProvider.aj" options="-emacssym"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="aspect handle"> + <compile files="A1.aj" options="-emacssym"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="advice handle"> + <compile files="A2.aj" options="-emacssym -1.4"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="pointcut handle"> + <compile files="A4.aj" options="-emacssym"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="get IProgramElement with aspect handle"> + <compile files="A1.aj" options="-emacssym"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="advice handle with crosscutting"> + <compile files="A3.aj" options="-emacssym"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="two pieces of advice with the same signature and pointcut"> + <compile files="A5.aj" options="-emacssym -1.4"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="pointcut handle with args"> + <compile files="A6.aj" options="-emacssym"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="declare parents handle"> + <compile files="A7.aj" options="-emacssym"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="two declare parents in same file"> + <compile files="A7.aj" options="-emacssym"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="advice handle with args"> + <compile files="A8.aj" options="-emacssym -1.4"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="field itd handle"> + <compile files="A9.aj" options="-emacssym"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="method itd handle"> + <compile files="A9.aj" options="-emacssym"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="method itd with args handle"> + <compile files="A9.aj" options="-emacssym"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="constructor itd with args"> + <compile files="A13.aj" options="-emacssym"> + <message kind="warning" text="inter-type constructor"/> + </compile> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="method call handle"> + <compile files="A10.aj" options="-emacssym"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="declare warning handle"> + <compile files="A11.aj" options="-emacssym"> + <message kind="warning" text="blah"/> + <message kind="warning" text="Illegal call"/> + </compile> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="two declare warning handles"> + <compile files="A11.aj" options="-emacssym"> + <message kind="warning" text="blah"/> + <message kind="warning" text="Illegal call"/> + </compile> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="ten declare warning handles"> + <compile files="DeclareWarnings.aj" options="-emacssym"> + <message kind="warning" text="warning 1"/> + <message kind="warning" text="warning 2"/> + <message kind="warning" text="warning 3"/> + <message kind="warning" text="warning 4"/> + <message kind="warning" text="warning 5"/> + <message kind="warning" text="warning 6"/> + <message kind="warning" text="warning 7"/> + <message kind="warning" text="warning 8"/> + <message kind="warning" text="warning 9"/> + <message kind="warning" text="warning 10"/> + </compile> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="declare @type"> + <compile files="A12.aj" options="-emacssym -1.5"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="declare @field"> + <compile files="A12.aj" options="-emacssym -1.5"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="declare @method"> + <compile files="A12.aj" options="-emacssym -1.5"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="declare @constructor"> + <compile files="A12.aj" options="-emacssym -1.5"/> + </ajc-test> + + <!-- tests to ensure handle provider produces same as the jdt --> + + <ajc-test dir="features153/jdtlikehandleprovider" title="compilation unit same as jdt"> + <compile files="Demo.java" options="-emacssym -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="class same as jdt"> + <compile files="C.java" options="-emacssym -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="interface same as jdt"> + <compile files="C.java" options="-emacssym -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="constructor same as jdt"> + <compile files="C.java" options="-emacssym -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="constructor with args same as jdt"> + <compile files="C.java" options="-emacssym -Xset:minimalModel=false"/> + </ajc-test> + +<!-- <ajc-test dir="features153/jdtlikehandleprovider" title="package declaration same as jdt"> + <compile files="Demo.java" options="-emacssym"/> + </ajc-test> +--> + <ajc-test dir="features153/jdtlikehandleprovider" title="import declaration same as jdt"> + <compile files="Demo.java" options="-emacssym -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="type same as jdt"> + <compile files="Demo.java" options="-emacssym -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="field same as jdt"> + <compile files="Demo.java" options="-emacssym -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="initialization same as jdt"> + <compile files="Demo.java" options="-emacssym -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="method with string array as argument same as jdt"> + <compile files="Demo.java" options="-emacssym -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="method with int array as argument same as jdt"> + <compile files="Demo.java" options="-emacssym -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="method with no args same as jdt"> + <compile files="Demo.java" options="-emacssym -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="method with two args same as jdt"> + <compile files="Demo.java" options="-emacssym -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="method with two string args same as jdt"> + <compile files="Demo.java" options="-emacssym -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="enum same as jdt"> + <compile files="E.java" options="-emacssym -1.5 -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="enum value same as jdt"> + <compile files="E.java" options="-emacssym -1.5 -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="annotation same as jdt"> + <compile files="MyAnnotation.java" options="-emacssym -1.5 -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="method with list arg same as jdt"> + <compile files="Java5Class.java" options="-emacssym -1.5 -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="method with generic arg same as jdt"> + <compile files="Java5Class.java" options="-emacssym -1.5 -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="method with two generic args same as jdt"> + <compile files="Java5Class.java" options="-emacssym -1.5 -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="method with two type parameters same as jdt"> + <compile files="Java5Class.java" options="-emacssym -1.5 -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="method with two args one of which is generic same as jdt"> + <compile files="Java5Class.java" options="-emacssym -1.5 -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="ipes with same name have unique handles - method-call"> + <compile files="TwoMethodCalls.aj" options="-emacssym"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="ipes with different names do not have counter - method-call"> + <compile files="TwoDiffMethodCalls.aj" options="-emacssym"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="ipes with same name have unique handles - handler"> + <compile files="Handler.aj" options="-emacssym"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="ipes with same name have unique handles - get"> + <compile files="Get.aj" options="-emacssym"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="ipes with same name have unique handles - set"> + <compile files="Set.aj" options="-emacssym"/> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="advice with same name in injar aspect should have unique handles"> + <compile files="ClassForAspectpath.java" options="-emacssym" aspectpath="jarForAspectPath.jar"> + <message kind="warning" text="blah"/> + <message kind="warning" text="blah2"/> + </compile> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="declare warnings in injar aspect should have unique handles"> + <compile files="ClassForAspectpath.java" options="-emacssym" aspectpath="jarForAspectPath.jar"> + <message kind="warning" text="blah"/> + <message kind="warning" text="blah2"/> + </compile> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="dont increment counter for different declares"> + <compile files="ClassForAspectpath.java" options="-emacssym" aspectpath="declare.jar"> + <message kind="warning" text="warning"/> + <message kind="error" text="error"/> + </compile> + </ajc-test> + + <ajc-test dir="features153/jdtlikehandleprovider" title="dont increment counter for different advice kinds"> + <compile files="ClassForAspectpath.java" options="-emacssym" aspectpath="advice.jar"/> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc153/pipelining.xml b/tests/src/test/java/org/aspectj/systemtest/ajc153/pipelining.xml new file mode 100644 index 000000000..05b85d1f8 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc153/pipelining.xml @@ -0,0 +1,72 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- Pipelining tests --> +<suite> + + <!-- testing the very very basics of pipelining --> + <ajc-test dir="features153/pipelining" title="build two classes"> + <compile files="ClassOne.java,ClassTwo.java" options="-verbose"/> + </ajc-test> + + <!-- testing the basics when an aspect is included, it is placed at the front deliberately --> + <ajc-test dir="features153/pipelining" title="build one aspect and two classes"> + <compile files="SimpleAspect.java,ClassOne.java,ClassTwo.java" options="-verbose -showWeaveInfo"> + <message kind="weave" text="Join point 'staticinitialization(void SimpleAspect.<clinit>())' in Type 'SimpleAspect' (SimpleAspect.java:1) advised by before advice from 'SimpleAspect' (SimpleAspect.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void ClassOne.<clinit>())' in Type 'ClassOne' (ClassOne.java:1) advised by before advice from 'SimpleAspect' (SimpleAspect.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void ClassTwo.<clinit>())' in Type 'ClassTwo' (ClassTwo.java:1) advised by before advice from 'SimpleAspect' (SimpleAspect.java:2)"/> + </compile> + </ajc-test> + + <!-- testing the basics when an aspect is included, aspect should be moved to the front after diet parsing --> + <ajc-test dir="features153/pipelining" title="build two classes and one aspect"> + <compile files="ClassOne.java,ClassTwo.java,SimpleAspect.java" options="-verbose -showWeaveInfo"> + <message kind="weave" text="Join point 'staticinitialization(void SimpleAspect.<clinit>())' in Type 'SimpleAspect' (SimpleAspect.java:1) advised by before advice from 'SimpleAspect' (SimpleAspect.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void ClassOne.<clinit>())' in Type 'ClassOne' (ClassOne.java:1) advised by before advice from 'SimpleAspect' (SimpleAspect.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void ClassTwo.<clinit>())' in Type 'ClassTwo' (ClassTwo.java:1) advised by before advice from 'SimpleAspect' (SimpleAspect.java:2)"/> + </compile> + </ajc-test> + + <!-- just building aspects, no classes around - will the sorting behave --> + <ajc-test dir="features153/pipelining" title="build two aspects"> + <compile files="SimpleAspect.java,SimpleAspect2.java" options="-verbose -showWeaveInfo"> + <message kind="weave" text="Join point 'staticinitialization(void SimpleAspect.<clinit>())' in Type 'SimpleAspect' (SimpleAspect.java:1) advised by before advice from 'SimpleAspect2' (SimpleAspect2.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void SimpleAspect.<clinit>())' in Type 'SimpleAspect' (SimpleAspect.java:1) advised by before advice from 'SimpleAspect' (SimpleAspect.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void SimpleAspect2.<clinit>())' in Type 'SimpleAspect2' (SimpleAspect2.java:1) advised by before advice from 'SimpleAspect2' (SimpleAspect2.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void SimpleAspect2.<clinit>())' in Type 'SimpleAspect2' (SimpleAspect2.java:1) advised by before advice from 'SimpleAspect' (SimpleAspect.java:2)"/> + </compile> + </ajc-test> + + <!-- pointcut in a superclass, subaspect extends the class - pointcut class is supplied after the superclass --> + <ajc-test dir="features153/pipelining" title="aspect extends class"> + <compile files="ClassOne.java,SubAspect.java,ClassTwo.java,SuperClass.java" options="-verbose -showWeaveInfo"> + <message kind="weave" text="Join point 'staticinitialization(void SubAspect.<clinit>())' in Type 'SubAspect' (SubAspect.java:1) advised by before advice from 'SubAspect' (SubAspect.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void ClassOne.<clinit>())' in Type 'ClassOne' (ClassOne.java:1) advised by before advice from 'SubAspect' (SubAspect.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void ClassTwo.<clinit>())' in Type 'ClassTwo' (ClassTwo.java:1) advised by before advice from 'SubAspect' (SubAspect.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void SuperClass.<clinit>())' in Type 'SuperClass' (SuperClass.java:1) advised by before advice from 'SubAspect' (SubAspect.java:2)"/> + </compile> + </ajc-test> + + <!-- testing eclipse to aspectj annotation transformation --> + <ajc-test dir="features153/pipelining/annotations" title="annotation transformation"> + <compile files="AnAspect.java,Foo.java,DecoratedClass.java" options="-1.5 -verbose"/> + </ajc-test> + + <!-- does the aspect sorter recognize annotation style aspects, pass the aspects last --> + <ajc-test dir="features153/pipelining" title="recognizing annotation style aspects - 1"> + <compile files="ClassOne.java,AtAJAspect.java" options="-1.5 -verbose"/> + </ajc-test> + + <!-- does the aspect sorter recognize annotation style aspects (inner type), pass the aspects last --> + <ajc-test dir="features153/pipelining" title="recognizing annotation style aspects - 2"> + <compile files="ClassOne.java,AtInnerAJAspect.java" options="-1.5 -verbose"/> + </ajc-test> + + <!-- the aspect is multiple layers down in the class... --> + <ajc-test dir="features153/pipelining" title="build one class and deeply nested aspect"> + <compile files="ClassOne.java,DeepAspect.java" options="-1.5 -verbose -showWeaveInfo"> + <message kind="weave" text="Join point 'staticinitialization(void ClassOne.<clinit>())' in Type 'ClassOne' (ClassOne.java:1) advised by before advice from 'DeepAspect$Inner$SimpleAspect' (DeepAspect.java:4)"/> + </compile> + </ajc-test> + + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc154/Ajc154Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc154/Ajc154Tests.java new file mode 100644 index 000000000..ebba76303 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc154/Ajc154Tests.java @@ -0,0 +1,442 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM + * 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.ajc154; + +import java.io.File; +import java.lang.reflect.Field; + +import junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.ConstantPool; +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.LineNumber; +import org.aspectj.apache.bcel.classfile.LineNumberTable; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.apache.bcel.generic.MethodGen; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.weaver.tools.ContextBasedMatcher; +import org.aspectj.weaver.tools.FuzzyBoolean; +import org.aspectj.weaver.tools.MatchingContext; +import org.aspectj.weaver.tools.PointcutDesignatorHandler; + +/** + * These are tests for AspectJ1.5.4 + */ +public class Ajc154Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + // public void testNewDesignatorsReferencePointcuts_pr205907() { + // BeanDesignatorHandler beanHandler = new BeanDesignatorHandler(); + // Set set = new HashSet(); + // set.add(beanHandler); + // PatternParser.setTestDesignators(set); + // //parser.registerPointcutDesignatorHandler(beanHandler); + // runTest("new pointcut designators in a reference pointcut"); + // } + // public void testAfterThrowingAnnotationStyle_pr211674_1() { runTest("after throwing annotation style problem - 1");} + // public void testAfterThrowingAnnotationStyle_pr211674_2() { runTest("after throwing annotation style problem - 2");} + + // crappy solution - see the bug + // public void testCflowLtwProblem_pr166647_1() { + // try { + // runTest("ltw and cflow problem"); + // } catch (AssertionFailedError afe) { + // // this is OK.... sadly + // // at least lets check we warned the user it was going to happen: + // String stderr = (getLastRunResult() == null ? "" : getLastRunResult().getStdErr()); + // // Expected line: + // // [WeavingURLClassLoader] warning XML Defined aspects must be woven in cases where cflow pointcuts are involved. + // // Currently the include/exclude patterns exclude 'x.Aspect2' [Xlint:mustWeaveXmlDefinedAspects] + // assertTrue("Did not see warning about needing to weave xml defined aspects", stderr + // .indexOf("warning XML Defined aspects must be woven in cases where cflow pointcuts are involved.") != -1); + // assertTrue("Xlint warning was expected '[Xlint:mustWeaveXmlDefinedAspects]'", stderr + // .indexOf("[Xlint:mustWeaveXmlDefinedAspects]") != -1); + // } + // } + + // Testing some issues with declare at type + public void testDeclareAtTypeProblems_pr211052_1() { + runTest("declare atType problems - 1"); + } + + public void testDeclareAtTypeProblems_pr211052_2() { + runTest("declare atType problems - 2"); + } + + public void testDeclareAtTypeProblems_pr211052_3() { + runTest("declare atType problems - 3"); + } + + public void testDeclareAtTypeProblems_pr211052_4() { + runTest("declare atType problems - 4"); + } + + public void testDeclareAtTypeProblems_pr211052_5() { + runTest("declare atType problems - 5"); + } + + // declare at type and binary weaving + public void testDeclareAtTypeProblems_pr211052_6() { + runTest("declare atType problems - 6"); + } + + public void testDeclareAtTypeProblems_pr211052_7() { + runTest("declare atType problems - 7"); + } + + public void testNPEWithMissingAtAspectAnnotationInPointcutLibrary_pr162539_1() { + runTest("NPE with missing @aspect annotation in pointcut library - 1"); + } + + public void testNPEWithMissingAtAspectAnnotationInPointcutLibrary_pr162539_2() { + runTest("NPE with missing @aspect annotation in pointcut library - 2"); + } + + public void testWrongNumberOfTypeParameters_pr176991() { + runTest("wrong number of type parameters"); + } + + public void testArgNamesDoesNotWork_pr148381_1() { + runTest("argNames does not work - simple"); + } + + public void testArgNamesDoesNotWork_pr148381_2() { + runTest("argNames does not work - error1"); + } + + public void testArgNamesDoesNotWork_pr148381_3() { + runTest("argNames does not work - error2"); + } + + public void testArgNamesDoesNotWork_pr148381_4() { + runTest("argNames does not work - error3"); + } + + public void testDecpProblemWhenTargetAlreadyImplements_pr169432_1() { + runTest("declare parents problem when target already implements interface - 1"); + } + + public void testDecpProblemWhenTargetAlreadyImplements_pr169432_2() { + runTest("declare parents problem when target already implements interface - 2"); + } + + public void testDecpProblemWhenTargetAlreadyImplements_pr169432_3() { + runTest("declare parents problem when target already implements interface - 3"); + } + + public void testVariousLtwAroundProblems_pr209019_1() { + runTest("various issues with ltw and around advice - 1"); + } + + public void testVariousLtwAroundProblems_pr209019_2() { + runTest("various issues with ltw and around advice - 2"); + } + + public void testVariousLtwAroundProblems_pr209019_3() { + runTest("various issues with ltw and around advice - 3"); + } + + public void testVariousLtwAroundProblems_pr209019_4() { + runTest("various issues with ltw and around advice - 4"); + } + + public void testAbstractAnnotationStylePointcutWithContext_pr202088() { + runTest("abstract annotation style pointcut with context"); + } + + public void testNoErrorForAtDecpInNormalClass_pr169428() { + runTest("no error for atDecp in normal class"); + } + + public void testJarsZipsNonStandardSuffix_pr186673() { + runTest("jars and zips with non-standard suffix"); + } + + public void testItdOnGenericInnerInterface_pr203646() { + runTest("npe with itd on inner generic interface"); + } + + public void testItdOnGenericInnerInterface_pr203646_A() { + runTest("npe with itd on inner generic interface - exampleA"); + } + + public void testItdOnGenericInnerInterface_pr203646_B() { + runTest("npe with itd on inner generic interface - exampleB"); + } + + public void testItdOnGenericInnerInterface_pr203646_C() { + runTest("npe with itd on inner generic interface - exampleC"); + } + + public void testItdOnGenericInnerInterface_pr203646_D() { + runTest("npe with itd on inner generic interface - exampleD"); + } + + // public void testItdOnGenericInnerInterface_pr203646_E() { runTest("npe with itd on inner generic interface - exampleE");} // + // needs parser change + public void testItdOnGenericInnerInterface_pr203646_F() { + runTest("npe with itd on inner generic interface - exampleF"); + } + + public void testItdOnGenericInnerInterface_pr203646_G() { + runTest("npe with itd on inner generic interface - exampleG"); + } + + public void testItdClashForTypesFromAspectPath_pr206732() { + runTest("itd clash for types from aspectpath"); + } + + // public void testAnnotationStyleAndMultiplePackages_pr197719() { + // runTest("annotation style syntax and cross package extension"); } + + /** + * Complex test that attempts to damage a class like a badly behaved bytecode transformer would and checks if AspectJ can cope. + * + * @throws NoSuchFieldException + * @throws SecurityException + * @throws IllegalAccessException + * @throws IllegalArgumentException + */ + public void testCopingWithGarbage_pr175806_1() throws ClassNotFoundException, SecurityException, NoSuchFieldException, + IllegalArgumentException, IllegalAccessException { + + // Compile the program we are going to mess with + runTest("coping with bad tables"); + + // Load up the class and the method 'main' we are interested in + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "A"); + Method[] meths = jc.getMethods(); + Method oneWeWant = null; + for (int i = 0; i < meths.length && oneWeWant == null; i++) { + Method method = meths[i]; + if (method.getName().equals("main")) { + oneWeWant = meths[i]; + } + } + + /** + * For the main method: Stack=2, Locals=3, Args_size=1 0: iconst_5 1: istore_1 2: ldc #18; //String 3 4: astore_2 5: + * getstatic #24; //Field java/lang/System.out:Ljava/io/PrintStream; 8: aload_2 9: invokevirtual #30; //Method + * java/io/PrintStream.println:(Ljava/lang/String;)V 12: goto 23 15: pop 16: getstatic #24; //Field + * java/lang/System.out:Ljava/io/PrintStream; 19: iload_1 20: invokevirtual #33; //Method java/io/PrintStream.println:(I)V + * 23: return Exception table: from to target type 2 15 15 Class java/lang/Exception + * + * LineNumberTable: line 4: 0 line 6: 2 line 7: 5 line 8: 15 line 9: 16 line 11: 23 LocalVariableTable: Start Length Slot + * Name Signature 0 24 0 argv [Ljava/lang/String; 2 22 1 i I 5 10 2 s Ljava/lang/String; + */ + + ConstantPool cp = oneWeWant.getConstantPool(); + // ConstantPool cpg = new ConstantPool(cp); + + // Damage the line number table, entry 2 (Line7:5) so it points to an invalid (not on an instruction boundary) position of 6 + Field ff = LineNumber.class.getDeclaredField("startPC"); + ff.setAccessible(true); + ff.set(oneWeWant.getLineNumberTable().getLineNumberTable()[2], new Integer(6)); + // oneWeWant.getLineNumberTable().getLineNumberTable()[2].setStartPC(6); + + // Should be 'rounded down' when transforming it into a MethodGen, new position will be '5' + // System.out.println("BEFORE\n"+oneWeWant.getLineNumberTable().toString()); + MethodGen toTransform = new MethodGen(oneWeWant, "A", cp, false); + LineNumberTable lnt = toTransform.getMethod().getLineNumberTable(); + assertTrue("Should have been 'rounded down' to position 5 but is " + lnt.getLineNumberTable()[2].getStartPC(), lnt + .getLineNumberTable()[2].getStartPC() == 5); + // System.out.println("AFTER\n"+lnt.toString()); + } + + public void testCopingWithGarbage_pr175806_2() throws ClassNotFoundException { + + // Compile the program we are going to mess with + runTest("coping with bad tables"); + + // Load up the class and the method 'main' we are interested in + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "A"); + Method[] meths = jc.getMethods(); + Method oneWeWant = null; + for (int i = 0; i < meths.length && oneWeWant == null; i++) { + Method method = meths[i]; + if (method.getName().equals("main")) { + oneWeWant = meths[i]; + } + } + // see previous test for dump of main method + + ConstantPool cp = oneWeWant.getConstantPool(); + // ConstantPoolGen cpg = new ConstantPoolGen(cp); + + // Damage the local variable table, entry 2 (" 2 22 1 i I") so it points to an invalid start pc of 3 + oneWeWant.getLocalVariableTable().getLocalVariable(1).setStartPC(3); + + // Should be 'rounded down' when transforming it into a MethodGen, new position will be '2' + // This next line will go BANG with an NPE if we don't correctly round the start pc down to 2 + new MethodGen(oneWeWant, "A", cp, true); + } + + public void testGenericAspectGenericPointcut_pr174449() { + runTest("problem with generic aspect and generic pointcut"); + } + + public void testGenericAspectGenericPointcut_noinline_pr174449() { + runTest("problem with generic aspect and generic pointcut - noinline"); + } + + public void testGenericMethodsAndOrdering_ok_pr171953_2() { + runTest("problem with generic methods and ordering - ok"); + } + + public void testGenericMethodsAndOrdering_bad_pr171953_2() { + runTest("problem with generic methods and ordering - bad"); + } + + public void testItdAndJoinpointSignatureCollection_ok_pr171953() { + runTest("problem with itd and join point signature collection - ok"); + } + + public void testItdAndJoinpointSignatureCollection_bad_pr171953() { + runTest("problem with itd and join point signature collection - bad"); + } + + public void testGenericMethodsAndItds_pr171952() { + runTest("generic methods and ITDs"); + } + + // public void testUsingDecpAnnotationWithoutAspectAnnotation_pr169428() { + // runTest("using decp annotation without aspect annotation");} + public void testItdsParameterizedParameters_pr170467() { + runTest("itds and parameterized parameters"); + } + + public void testComplexGenerics_pr168044() { + runTest("complex generics - 1"); + } + + public void testIncorrectlyMarkingFieldTransient_pr168063() { + runTest("incorrectly marking field transient"); + } + + public void testInheritedAnnotations_pr169706() { + runTest("inherited annotations"); + } + + public void testGenericFieldNPE_pr165885() { + runTest("generic field npe"); + } + + public void testIncorrectOptimizationOfIstore_pr166084() { + runTest("incorrect optimization of istore"); + } + + public void testDualParameterizationsNotAllowed_pr165631() { + runTest("dual parameterizations not allowed"); + } + + public void testSuppressWarnings1_pr166238() { + runTest("Suppress warnings1"); + } + + public void testSuppressWarnings2_pr166238() { + runTest("Suppress warnings2"); + } + + public void testNullReturnedFromGetField_pr172107() { + runTest("null returned from getField()"); + } + + // /////////////////////////////////////// + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc154Tests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc154.xml"); + } + + // --- + private class BeanDesignatorHandler implements PointcutDesignatorHandler { + + private String askedToParse; + public boolean simulateDynamicTest = false; + + public String getDesignatorName() { + return "bean"; + } + + /* + * (non-Javadoc) + * + * @see org.aspectj.weaver.tools.PointcutDesignatorHandler#parse(java.lang.String) + */ + public ContextBasedMatcher parse(String expression) { + this.askedToParse = expression; + return new BeanPointcutExpression(expression, this.simulateDynamicTest); + } + + public String getExpressionLastAskedToParse() { + return this.askedToParse; + } + } + + private class BeanPointcutExpression implements ContextBasedMatcher { + + private final String beanNamePattern; + private final boolean simulateDynamicTest; + + public BeanPointcutExpression(String beanNamePattern, boolean simulateDynamicTest) { + this.beanNamePattern = beanNamePattern; + this.simulateDynamicTest = simulateDynamicTest; + } + + public boolean couldMatchJoinPointsInType(Class aClass) { + return true; + } + + /* + * (non-Javadoc) + * + * @see org.aspectj.weaver.tools.ContextBasedMatcher#couldMatchJoinPointsInType(java.lang.Class) + */ + public boolean couldMatchJoinPointsInType(Class aClass, MatchingContext context) { + if (this.beanNamePattern.equals(context.getBinding("beanName"))) { + return true; + } else { + return false; + } + } + + /* + * (non-Javadoc) + * + * @see org.aspectj.weaver.tools.ContextBasedMatcher#mayNeedDynamicTest() + */ + public boolean mayNeedDynamicTest() { + return this.simulateDynamicTest; + } + + public FuzzyBoolean matchesStatically(MatchingContext matchContext) { + if (this.simulateDynamicTest) { + return FuzzyBoolean.MAYBE; + } + if (this.beanNamePattern.equals(matchContext.getBinding("beanName"))) { + return FuzzyBoolean.YES; + } else { + return FuzzyBoolean.NO; + } + } + + /* + * (non-Javadoc) + * + * @see org.aspectj.weaver.tools.ContextBasedMatcher#matchesDynamically(org.aspectj.weaver.tools.MatchingContext) + */ + public boolean matchesDynamically(MatchingContext matchContext) { + return this.beanNamePattern.equals(matchContext.getBinding("beanName")); + } + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc154/AllTestsAspectJ154.java b/tests/src/test/java/org/aspectj/systemtest/ajc154/AllTestsAspectJ154.java new file mode 100644 index 000000000..625327344 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc154/AllTestsAspectJ154.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM + * 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.ajc154; + + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ154 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.5.4 tests"); + //$JUnit-BEGIN$ + suite.addTest(Ajc154Tests.suite()); + // removed for now - it keeps creating unwanted directories in the source tree rather than building into the sandbox +// suite.addTestSuite(CustomMungerExtensionTest.class); + //$JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc154/CustomMungerExtensionTest.java b/tests/src/test/java/org/aspectj/systemtest/ajc154/CustomMungerExtensionTest.java new file mode 100644 index 000000000..7c0d26d4c --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc154/CustomMungerExtensionTest.java @@ -0,0 +1,137 @@ +/* ******************************************************************* + * Copyright (c) 2007 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: + * Linton Ye https://bugs.eclipse.org/bugs/show_bug.cgi?id=193065 + * ******************************************************************/ + +package org.aspectj.systemtest.ajc154; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.aspectj.ajde.core.AjCompiler; +import org.aspectj.bridge.ISourceLocation; +import org.aspectj.systemtest.incremental.tools.AjdeInteractionTestbed; +import org.aspectj.weaver.Checker; +import org.aspectj.weaver.ConcreteTypeMunger; +import org.aspectj.weaver.CustomMungerFactory; +import org.aspectj.weaver.ResolvedType; +import org.aspectj.weaver.ResolvedTypeMunger; +import org.aspectj.weaver.Shadow; +import org.aspectj.weaver.ShadowMunger; +import org.aspectj.weaver.World; +import org.aspectj.weaver.patterns.DeclareErrorOrWarning; +import org.aspectj.weaver.patterns.IfPointcut; +import org.aspectj.weaver.patterns.Pointcut; + +public class CustomMungerExtensionTest extends AjdeInteractionTestbed { + + File oldSandBoxDir; + + protected void setUp() throws Exception { + super.setUp(); + oldSandBoxDir = sandboxDir; + sandboxDir = new File("../tests"); + } + + protected void tearDown() throws Exception { + super.tearDown(); + sandboxDir = oldSandBoxDir; + } + + public void testExtension() { + String testFileDir = "bugs/pointcutdoctor-bug193065"; + AjCompiler compiler = getCompilerForProjectWithName(testFileDir); + compiler.setCustomMungerFactory(new DumbCustomMungerFactory()); + + doBuild(testFileDir); + + CustomMungerFactory factory = (CustomMungerFactory) compiler.getCustomMungerFactory(); + assertTrue(factory.getAllCreatedCustomShadowMungers().size() > 0); + for (Iterator<ShadowMunger> i = factory.getAllCreatedCustomShadowMungers().iterator(); i.hasNext();) { + assertTrue(((DumbShadowMunger) i.next()).called); + } + + assertTrue(factory.getAllCreatedCustomTypeMungers().size() > 0); + for (Iterator<ConcreteTypeMunger> i = factory.getAllCreatedCustomTypeMungers().iterator(); i.hasNext();) { + assertTrue(((DumbTypeMunger) i.next()).called); + } + } + + class DumbCustomMungerFactory implements CustomMungerFactory { + Collection<ShadowMunger> allShadowMungers = new ArrayList<ShadowMunger>(); + Collection<ConcreteTypeMunger> allTypeMungers = new ArrayList<ConcreteTypeMunger>(); + + public Collection<ShadowMunger> createCustomShadowMungers(ResolvedType aspectType) { + List<ShadowMunger> mungers = new ArrayList<ShadowMunger>(); + Pointcut pointcut = new IfPointcut("abc"); + mungers.add(new DumbShadowMunger(new DeclareErrorOrWarning(false, pointcut, ""))); + allShadowMungers.addAll(mungers); + return mungers; + } + + public Collection<ConcreteTypeMunger> createCustomTypeMungers(ResolvedType aspectType) { + List<ConcreteTypeMunger> mungers = new ArrayList<ConcreteTypeMunger>(); + mungers.add(new DumbTypeMunger(null, aspectType)); + allTypeMungers.addAll(mungers); + return mungers; + } + + public Collection<ShadowMunger> getAllCreatedCustomShadowMungers() { + return allShadowMungers; + } + + public Collection<ConcreteTypeMunger> getAllCreatedCustomTypeMungers() { + return allTypeMungers; + } + } + + class DumbShadowMunger extends Checker { + public DumbShadowMunger(DeclareErrorOrWarning deow) { + super(deow); + } + + public ISourceLocation getSourceLocation() { + return ISourceLocation.EMPTY; + } + + boolean called; + + public boolean match(Shadow shadow, World world) { + called = true; + return false; + } + } + + class DumbTypeMunger extends ConcreteTypeMunger { + boolean called; + + public DumbTypeMunger(ResolvedTypeMunger munger, ResolvedType aspectType) { + super(munger, aspectType); + } + + public ConcreteTypeMunger parameterizedFor(ResolvedType targetType) { + return null; + } + + public boolean matches(ResolvedType onType) { + called = true; + return false; + } + + public ConcreteTypeMunger parameterizeWith(Map parameterizationMap, World world) { + // TODO Auto-generated method stub + return null; + } + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc154/ajc154.xml b/tests/src/test/java/org/aspectj/systemtest/ajc154/ajc154.xml new file mode 100644 index 000000000..9cb0eae87 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc154/ajc154.xml @@ -0,0 +1,491 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.5.4Tests --> +<suite> + + <ajc-test dir="bugs154/pr166647" title="ltw and cflow problem"> + <compile options="-1.5" files="ClassToAdvise.java,ClassWithMain.java" outjar="code.jar"/> + <compile options="-1.5 -Xlint:ignore" files="Aspect.java" outjar="aspects.jar"/> + <run class="a.ClassWithMain" classpath="aspects.jar;code.jar" ltw="aop1.xml"> + <stdout> + <line text="advice fired"/> + </stdout> + <stderr> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs154/pr211052" title="declare atType problems - 1"> + <compile options="-1.5" files="MyPojo.java"/> + <run class="MyPojo"/> + </ajc-test> + + <!-- DistantResource is explicitly mentioned as c.d.DistantResource --> + <ajc-test dir="bugs154/pr211052" title="declare atType problems - 2"> + <compile options="-1.5 -showWeaveInfo" files="SimpleAnnotation.java,SimpleAspect1.java,DistantResource.java"> + <message kind="weave" text="'c.d.DistantResource' (DistantResource.java:5) is annotated with @SimpleAnnotation(classname = "oranges")"/> + </compile> + <run class="c.d.DistantResource"> + <stdout> + <line text="Annotation is @a.b.SimpleAnnotation(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="Annotation is @a.b.SimpleAnnotation(classname="oranges")" vm="9+"/> + </stdout> + </run> + </ajc-test> + + <!-- DistantResource is imported and refered to as DistantResource --> + <ajc-test dir="bugs154/pr211052" title="declare atType problems - 3"> + <compile options="-1.5 -showWeaveInfo" files="SimpleAnnotation.java,SimpleAspect2.java,DistantResource.java"> + <message kind="weave" text="'c.d.DistantResource' (DistantResource.java:5) is annotated with @SimpleAnnotation(classname = "oranges")"/> + </compile> + <run class="c.d.DistantResource"> + <stdout> + <line text="Annotation is @a.b.SimpleAnnotation(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="Annotation is @a.b.SimpleAnnotation(classname="oranges")" vm="9+"/> + </stdout> + </run> + </ajc-test> + + <!-- Annotation is in a different package to the aspect and explicitly referenced with a fully qualified name --> + <ajc-test dir="bugs154/pr211052" title="declare atType problems - 4"> + <compile options="-1.5 -showWeaveInfo" files="SimpleAnnotation2.java,SimpleAspect3.java,DistantResource.java"> + <message kind="weave" text="'c.d.DistantResource' (DistantResource.java:5) is annotated with @e.f.SimpleAnnotation2(classname = "oranges")"/> + </compile> + <run class="c.d.DistantResource"> + <stdout> + <line text="Annotation is @e.f.SimpleAnnotation2(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="Annotation is @e.f.SimpleAnnotation2(classname="oranges")" vm="9+"/> + </stdout> + </run> + </ajc-test> + + <!-- Annotation is in a different package to the aspect and imported --> + <ajc-test dir="bugs154/pr211052" title="declare atType problems - 5"> + <compile options="-1.5 -showWeaveInfo" files="SimpleAnnotation2.java,SimpleAspect4.java,DistantResource.java"> + <message kind="weave" text="'c.d.DistantResource' (DistantResource.java:5) is annotated with @SimpleAnnotation2(classname = "oranges")"/> + </compile> + <run class="c.d.DistantResource"> + <stdout> + <line text="Annotation is @e.f.SimpleAnnotation2(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="Annotation is @e.f.SimpleAnnotation2(classname="oranges")" vm="9+"/> + </stdout> + </run> + </ajc-test> + + <!-- target for annotation is from a jar --> + <ajc-test dir="bugs154/pr211052" title="declare atType problems - 6"> + <compile options="-1.5" files="DistantResource.java" outjar="target.jar"/> + <compile options="-1.5 -showWeaveInfo" files="SimpleAnnotation2.java,SimpleAspect4.java" inpath="target.jar"> + <message kind="weave" text="'c.d.DistantResource' (DistantResource.java) is annotated with @SimpleAnnotation2(classname = "oranges")"/> + </compile> + <run class="c.d.DistantResource"> + <stdout> + <line text="Annotation is @e.f.SimpleAnnotation2(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="Annotation is @e.f.SimpleAnnotation2(classname="oranges")" vm="9+"/> + </stdout> + </run> + </ajc-test> + + <!-- target for annotation is from a jar and annotation and aspect are in a different jar--> + <ajc-test dir="bugs154/pr211052" title="declare atType problems - 7"> + <compile options="-1.5" files="DistantResource.java" outjar="target.jar"/> + <compile options="-1.5 -Xlint:ignore" files="SimpleAnnotation2.java,SimpleAspect3.java" outjar="aspect.jar"/> + <compile options="-1.5 -showWeaveInfo" aspectpath="aspect.jar" inpath="target.jar"> + <message kind="weave" text="'c.d.DistantResource' (DistantResource.java) is annotated with @e.f.SimpleAnnotation2(classname = "oranges")"/> + </compile> + <run class="c.d.DistantResource"> + <stdout> + <line text="Annotation is @e.f.SimpleAnnotation2(classname=oranges)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="Annotation is @e.f.SimpleAnnotation2(classname="oranges")" vm="9+"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs154/pr211674" title="after throwing annotation style problem - 1"> + <compile options="-1.5" files="Test.java"/> + <run class="Test"/> + </ajc-test> + + <ajc-test dir="bugs154/pr211674" title="after throwing annotation style problem - 2"> + <compile options="-1.5" files="Test2.java"/> + <run class="Test2"/> + </ajc-test> + + <ajc-test dir="bugs154/pr194314" title="broken lvt for woven at aspectj around advice"> + <compile options="-1.5" files="test/IService.java,test/Main.java,test/Service.java,test/ServiceInterceptor.java"/> + </ajc-test> + + <ajc-test dir="bugs154/pr148381/simple" title="argNames does not work - simple"> + <!-- this compile is just to get code.jar into the sandbox, all the code is already precompiled in code.jar --> + <compile options="-1.5" files="PerformanceMonitor.java" classpath="code.jar"/> + <run class="test.Main" classpath="code.jar" ltw="META-INF/aop.xml"> + <stdout> + <line text="This method was intercepted by the advice: Main.foo()"/> + </stdout> + <stderr/> + </run> + </ajc-test> + + <ajc-test dir="bugs154/pr148381/error1" title="argNames does not work - error1"> + <!-- this compile is just to get code.jar into the sandbox, all the code is already precompiled in code.jar --> + <compile options="-1.5" files="PerformanceMonitor.java" classpath="code.jar"/> + <run class="test.Main" classpath="code.jar" ltw="META-INF/aop.xml"> + <stderr> + <line text="argNames annotation value does not specify the right number of argument names for the method 'Object flagExpectationMismatch(ProceedingJoinPoint,PerformanceMonitor)'"/> + <line text="Cannot read debug info for @Aspect to handle formal binding in pointcuts (please compile with 'javac -g' or '<javac debug='true'.../>' in Ant)"/> + </stderr> + <stdout/> + </run> + </ajc-test> + + <ajc-test dir="bugs154/pr148381/error2" title="argNames does not work - error2"> + <!-- this compile is just to get code.jar into the sandbox, all the code is already precompiled in code.jar --> + <compile options="-1.5" files="PerformanceMonitor.java" classpath="code.jar"/> + <run class="test.Main" classpath="code.jar" ltw="META-INF/aop.xml"> + <stderr> + <line text="argNames annotation value does not specify the right number of argument names for the method 'Object flagExpectationMismatch(ProceedingJoinPoint,PerformanceMonitor)'"/> + <line text="Cannot read debug info for @Aspect to handle formal binding in pointcuts (please compile with 'javac -g' or '<javac debug='true'.../>' in Ant)"/> + </stderr> + <stdout/> + </run> + </ajc-test> + + <ajc-test dir="bugs154/pr148381/error3" title="argNames does not work - error3"> + <!-- this compile is just to get code.jar into the sandbox, all the code is already precompiled in code.jar --> + <compile options="-1.5" files="PerformanceMonitor.java" classpath="code.jar"/> + <run class="test.Main" classpath="code.jar" ltw="META-INF/aop.xml"> + <stderr> + <line text="argNames annotation value does not specify the right number of argument names for the method 'void a(Foo)'"/> + <line text="Cannot read debug info for @Aspect to handle formal binding in pointcuts (please compile with 'javac -g' or '<javac debug='true'.../>' in Ant)"/> + <line text="argNames annotation value does not specify the right number of argument names for the method 'void f(Foo)'"/> + <line text="Cannot read debug info for @Aspect to handle formal binding in pointcuts (please compile with 'javac -g' or '<javac debug='true'.../>' in Ant)"/> + <line text="argNames annotation value does not specify the right number of argument names for the method 'void e(Foo)'"/> + <line text="Cannot read debug info for @Aspect to handle formal binding in pointcuts (please compile with 'javac -g' or '<javac debug='true'.../>' in Ant)"/> + <line text="argNames annotation value does not specify the right number of argument names for the method 'void d(Foo)'"/> + <line text="Cannot read debug info for @Aspect to handle formal binding in pointcuts (please compile with 'javac -g' or '<javac debug='true'.../>' in Ant)"/> + <line text="argNames annotation value does not specify the right number of argument names for the method 'void c(Foo)'"/> + <line text="Cannot read debug info for @Aspect to handle formal binding in pointcuts (please compile with 'javac -g' or '<javac debug='true'.../>' in Ant)"/> + <line text="argNames annotation value does not specify the right number of argument names for the method 'void b(Foo)'"/> + <line text="Cannot read debug info for @Aspect to handle formal binding in pointcuts (please compile with 'javac -g' or '<javac debug='true'.../>' in Ant)"/> + </stderr> + <stdout/> + </run> + </ajc-test> + + <!-- very basic with all code style, should be fine --> + <ajc-test dir="bugs154/pr209019/case1" title="various issues with ltw and around advice - 1"> + <compile options="-1.5" files="A.java,DurationMethod.java,AbstractDurationMethod.java,Runner.java"/> + <run class="Runner"> + <stdout> + <line text="Proceeded at joinpoint call(Object a.b.A.m3())"/> + <line text="Proceeded at joinpoint call(Object a.b.A.m2())"/> + </stdout> + </run> + </ajc-test> + + <!-- switch from code style sub-aspect to annotation style sub aspect --> + <ajc-test dir="bugs154/pr209019/case2" title="various issues with ltw and around advice - 2"> + <compile options="-1.5 -XnoInline" files="A.java,AtDurationMethod.java,AbstractDurationMethod.java,Runner.java"/> + <run class="Runner"> + <stdout> + <line text="Proceeded at joinpoint call(Object a.b.A.m3())"/> + <line text="Proceeded at joinpoint call(Object a.b.A.m2())"/> + </stdout> + <stderr> + </stderr> + </run> + </ajc-test> + + <!-- same as case2 but without -XnoInline --> + <ajc-test dir="bugs154/pr209019/case2" title="various issues with ltw and around advice - 3"> + <compile options="-1.5" files="A.java,AtDurationMethod.java,AbstractDurationMethod.java,Runner.java"/> + <run class="Runner"> + <stdout> + <line text="Proceeded at joinpoint call(Object a.b.A.m3())"/> + <line text="Proceeded at joinpoint call(Object a.b.A.m2())"/> + </stdout> + <stderr> + </stderr> + </run> + </ajc-test> + + <!-- now loadtime weaving --> + <ajc-test dir="bugs154/pr209019/case3" title="various issues with ltw and around advice - 4"> + <compile options="-1.5" files="A.java,AbstractDurationMethod.java,Runner.java"/> + <run class="Runner" ltw="aop.xml"> + <stdout> + <line text="Proceeded at joinpoint call(Object a.b.A.m3())"/> + <line text="Proceeded at joinpoint call(Object a.b.A.m2())"/> + </stdout> + <stderr> + </stderr> + </run> + </ajc-test> + + <!-- just checking the new syntax compiles OK --> + <ajc-test dir="bugs154/pr169432/case1" title="declare parents problem when target already implements interface - 1"> + <compile options="-1.5" files="NonMarkerInterface.java,ClassThatAlreadyIncludesRequiredMethods.java,DeclareParentsForNonMarkerInterfaceToAClassThatAlreadyIncludeRequiredMethods.java"/> + </ajc-test> + + <!-- now violate the rules, the types matching the pattern do not implement the interface --> + <ajc-test dir="bugs154/pr169432/case2" title="declare parents problem when target already implements interface - 2"> + <compile options="-1.5" files="A.java"> + <message kind="error" line="20" text="@DeclareParents: No defaultImpl was specified but the type 'C1' does not implement the method 'int m()' defined on the interface 'NonMarkerInterface'"/> + <message kind="error" line="24" text="@DeclareParents: No defaultImpl was specified but the type 'C2' does not implement the method 'int m()' defined on the interface 'NonMarkerInterface'"/> + </compile> + </ajc-test> + + <!-- now they do, lets check they behave as expected --> + <ajc-test dir="bugs154/pr169432/case3" title="declare parents problem when target already implements interface - 3"> + <compile options="-1.5" files="A.java"/> + <run class="A"> + <stdout> + <line text="C1.m() returns 1"/> + <line text="C2.m() returns 2"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs154/pr202088" title="abstract annotation style pointcut with context"> + <compile options="-1.5" files="Bug.java"/> + <compile options="-1.5" files="Bug2.java"> + </compile> + <run class="tracing.Bug2"> + <stdout> + <line text="o is 'instance of C'"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs154/pr169428" title="no error for atDecp in normal class"> + <compile options="-1.5" files="CorrectError.java"> + <message kind="error" text="Advice must be declared inside an aspect type"/> + </compile> + <compile options="-1.5" files="NoError.java"> + <message kind="error" text="DeclareParents can only be used inside an aspect type"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs154/pr162539" title="NPE with missing @aspect annotation in pointcut library - 1"> + <compile files="test/ataspectj/pointcutlibrary/HelloWorld.java, test/ataspectj/pointcutlibrary/AtAspect.java" classpath="lib.jar" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs154/pr162539" title="NPE with missing @aspect annotation in pointcut library - 2"> + <compile files="test/ataspectj/pointcutlibrary/PointcutLibrary.java, test/ataspectj/pointcutlibrary/HelloWorld.java, test/ataspectj/pointcutlibrary/AtAspect.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs154/pr176991" title="wrong number of type parameters"> + <compile options="-1.5" files="AspectJBugTestCase.java"/> + </ajc-test> + + <ajc-test dir="bugs154/pr186673" title="jars and zips with non-standard suffix"> + <compile options="-1.5" files="Apple.java" outjar="apple.jar.0"/> + <compile options="-1.5" files="Orange.java" outjar="orange.zipfoo"/> + <!-- check ant and a standard compile --> + <!--ant file="ant.xml" target="default" verbose="true"> + <stdout> + <line text="Blah"/> + </stdout> + </ant--> + <compile options="-1.5" files="Main.java" classpath="orange.zipfoo,apple.jar.0"/> + </ajc-test> + + <ajc-test dir="bugs154/pr203646" title="npe with itd on inner generic interface"> + <compile options="-1.5" files="Bang.java"/> + <!--compile options="-1.5 -emacssym" files="Bang.java"/--> + </ajc-test> + + <ajc-test dir="bugs154/pr203646" title="npe with itd on inner generic interface - emacssym"> + <compile options="-1.5 -emacssym" files="Bang.java"/> + </ajc-test> + + <ajc-test dir="bugs154/pr203646" title="npe with itd on inner generic interface - exampleA"> + <compile options="-1.5" files="ExampleA.java"/> + <run class="ExampleA"/> + </ajc-test> + + <ajc-test dir="bugs154/pr203646" title="npe with itd on inner generic interface - exampleB"> + <compile options="-1.5" files="ExampleB.java"> + <message kind="error" line="20" text="The method intro(String) in the type I.J<String> is not applicable for the arguments (int)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs154/pr203646" title="npe with itd on inner generic interface - exampleC"> + <compile options="-1.5" files="ExampleC.java"/> + <run class="ExampleC"/> + </ajc-test> + + <ajc-test dir="bugs154/pr203646" title="npe with itd on inner generic interface - exampleD"> + <compile options="-1.5" files="ExampleD.java"/> + <run class="ExampleD"/> + </ajc-test> + + <ajc-test dir="bugs154/pr203646" title="npe with itd on inner generic interface - exampleE"> + <compile options="-1.5" files="ExampleE.java"/> + <run class="ExampleE"/> + </ajc-test> + + <ajc-test dir="bugs154/pr203646" title="npe with itd on inner generic interface - exampleF"> + <compile options="-1.5" files="ExampleF.java"/> + <run class="ExampleF"/> + </ajc-test> + + <ajc-test dir="bugs154/pr203646" title="npe with itd on inner generic interface - exampleG"> + <compile options="-1.5" files="ExampleG.java"/> + </ajc-test> + + <ajc-test dir="bugs154/pr206732" title="itd clash for types from aspectpath"> + <compile outjar="foo.jar" files="Advised.aj"/> + <compile files="Ref.aj" aspectpath="foo.jar"/> + </ajc-test> + + <ajc-test dir="bugs154/pr175806" title="coping with bad tables"> + <compile options="-1.5" files="A.java"/> + </ajc-test> + + <ajc-test dir="bugs154/pr174449" title="problem with generic aspect and generic pointcut"> + <compile options="-1.5" files="Foo.java"/> + <run class="Foo"> + <stderr> + <line text="around advice executing: servant class is class Boo"/> + <line text="around advice executing: servant class is class Goo"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs154/pr174449" title="problem with generic aspect and generic pointcut - noinline"> + <compile options="-1.5 -XnoInline" files="Foo.java"/> + <run class="Foo"> + <stderr> + <line text="around advice executing: servant class is class Boo"/> + <line text="around advice executing: servant class is class Goo"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs154/pr171953_2" title="problem with generic methods and ordering - ok"> + <compile options="-1.5" files="test/ListFactoryAspect.aj, test/AbstractProcessor.java,test/ListFactory.java,test/ListFactoryConsumer.java,test/Processor.java,test/SimpleListFactoryConsumer.java"> + </compile> + </ajc-test> + + <ajc-test dir="bugs154/pr171953_2" title="problem with generic methods and ordering - bad"> + <compile options="-1.5" files="test/ListFactory.java,test/ListFactoryConsumer.java,test/SimpleListFactoryConsumer.java,test/Processor.java,test/ListFactoryAspect.aj,test/AbstractProcessor.java"> + </compile> + </ajc-test> + + <ajc-test dir="bugs154/pr171953" title="problem with itd and join point signature collection - bad"> + <compile options="-1.5 -showWeaveInfo" files="test/AbstractExecutable.java,test/AnotherExecutable.java,test/Executable.java,test/ExecutionAspect.aj,test/SecondTestExecutable.java test/SubTestExecutable.java test/TestExecutable.java"> + <message kind="weave" text="Join point 'method-execution(void test.SecondTestExecutable.execute())' in Type 'test.SecondTestExecutable' (SecondTestExecutable.java:5) advised by around advice from 'test.ExecutionAspect' (ExecutionAspect.aj:9)"/> + <message kind="weave" text="Extending interface set for type 'test.AbstractExecutable' (AbstractExecutable.java) to include 'java.io.Serializable' (ExecutionAspect.aj)"/> + <message kind="weave" text="Join point 'method-execution(void test.SubTestExecutable.execute())' in Type 'test.SubTestExecutable' (SubTestExecutable.java:6) advised by around advice from 'test.ExecutionAspect' (ExecutionAspect.aj:9)"/> + <message kind="weave" text="Join point 'method-execution(void test.TestExecutable.execute())' in Type 'test.TestExecutable' (TestExecutable.java:5) advised by around advice from 'test.ExecutionAspect' (ExecutionAspect.aj:9)"/> + </compile> + <run class="test.SecondTestExecutable"/> + </ajc-test> + + <ajc-test dir="bugs154/pr171953" title="problem with itd and join point signature collection - ok"> + <compile options="-1.5 -showWeaveInfo" files="test/SecondTestExecutable.java test/AbstractExecutable.java test/AnotherExecutable.java test/Executable.java test/ExecutionAspect.aj test/RunnableAspect.aj test/SubTestExecutable.java test/TestExecutable.java"> + <message kind="weave" text="Join point 'method-execution(void test.SecondTestExecutable.execute())' in Type 'test.SecondTestExecutable' (SecondTestExecutable.java:5) advised by around advice from 'test.ExecutionAspect' (ExecutionAspect.aj:9)"/> + <message kind="weave" text="Extending interface set for type 'test.AbstractExecutable' (AbstractExecutable.java) to include 'java.io.Serializable' (ExecutionAspect.aj)"/> + <message kind="weave" text="Join point 'method-execution(void test.SubTestExecutable.execute())' in Type 'test.SubTestExecutable' (SubTestExecutable.java:6) advised by around advice from 'test.ExecutionAspect' (ExecutionAspect.aj:9)"/> + <message kind="weave" text="Join point 'method-execution(void test.TestExecutable.execute())' in Type 'test.TestExecutable' (TestExecutable.java:5) advised by around advice from 'test.ExecutionAspect' (ExecutionAspect.aj:9)"/> + </compile> + <run class="test.SecondTestExecutable"/> + </ajc-test> + + <ajc-test dir="bugs154/pr171952" title="generic methods and ITDs"> + <compile files="Foo.java,FooAspect.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs154/pr169428" title="using decp annotation without aspect annotation"> + <compile files="AnAspect.java" options="-1.5"> + <message kind="error" text="Found @AspectJ annotations in a non @Aspect type 'AnAspect'"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs154/pr170467" title="itds and parameterized parameters"> + <compile files="Bug.aj" options="-1.5"/> + <compile files="Bug2.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs154/pr169706" title="inherited annotations"> + <compile files="A.java,B.java,C.java,MyAspect.java,MyAnnotation.java,Test.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-call(void C.foo())' in Type 'Test' (Test.java:5) advised by before advice from 'MyAspect' (MyAspect.java:4)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs154/pr165885" title="generic field npe"> + <compile files="Concrete.java,Abstract.java,Aspect.java" options="-1.5"> + <message kind="warning" line="8" text="foo"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs154/pr168044" title="complex generics - 1"> + <compile files="AbstractNode.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs154/pr168063" title="incorrectly marking field transient"> + <compile files="A.java"/> + <run class="A"> + <stdout> + <line text="It worked, data preserved!"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs154/pr166084" title="incorrect optimization of istore"> + <compile files="X.java" inpath="simple.jar"/> + <run class="Simple"/> + </ajc-test> + + <ajc-test dir="bugs154/pr165631" title="dual parameterizations not allowed"> + <!-- two variations of the same situation, should fail in the same way --> + <compile files="Bug.java" options="-1.5"> + <message kind="error" line="12" text="Cannot declare parent B"/> + </compile> + <compile files="Bug2.java" options="-1.5"> + <message kind="error" line="13" text="Cannot declare parent B"/> + </compile> + </ajc-test> + + <ajc-test dir="ltw" + title="Suppress warnings1" + keywords="xlint, ltw, nowarn, pr166238"> + <compile + files="Main.java" + > + </compile> + <run class="Main" ltw="aop-noxlintfile-nowarn.xml"> + <stderr/> <!-- no warnings from missing xlint file: they are suppressed --> + </run> + </ajc-test> + + <ajc-test dir="ltw" + title="Suppress warnings2" + keywords="xlint, ltw, nowarn, pr166238"> + <compile + files="Main.java" + > + </compile> + <run class="Main" ltw="aop-noxlintfile-warnnone.xml"> + <stderr/> <!-- no warnings from missing xlint file: they are suppressed --> + </run> + </ajc-test> + + <ajc-test dir="bugs154/pr172107" title="null returned from getField()" + keywords="pr172107"> + <compile files="ReadWriteAJBug172107.java,Instrumentation.aj"/> + <run class="ReadWriteAJBug172107"/> + </ajc-test> + + <ajc-test dir="bugs154/pr197719" title="annotation style syntax and cross package extension"> + <compile files="test/aspects/C1.java,test/aspects/C3.java,test/aspects/MyAnn.java,test/aspects/MyAnnAspect.java,test/aspects2/C2.java" options="-1.5"/> + <run class="test.aspects2.C2"/> + </ajc-test> + + <ajc-test dir="bugs154/pr205907" title="new pointcut designators in a reference pointcut"> + <compile files="Test.aj"/> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc160/Ajc160Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc160/Ajc160Tests.java new file mode 100644 index 000000000..5f5162b0d --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc160/Ajc160Tests.java @@ -0,0 +1,154 @@ +/******************************************************************************* + * Copyright (c) 2007-2008 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.ajc160; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * These are tests for AspectJ1.6.0 + */ +public class Ajc160Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + // AspectJ1.6.0rc1 + // public void testPipelineCompilationGenericReturnType_pr226567() { + // runTest("pipeline compilation and generic return type"); + // } + public void testPipelineCompilationAnonymous_pr225916() { + runTest("pipeline compilation and anonymous type"); + } + + public void testGenericITDs_pr214994() { + runTest("generic itd"); + } + + public void testGenericDecpLtw_pr223605() { + runTest("generic decp ltw"); + } + + public void testDuplicateITDsNPE_pr173602() { + runTest("duplicate itd npe"); + } + + public void testLTWITDs_pr223094() { + runTest("ltw inherited itds"); + } + + // public void testBrokenIfArgsCflowAtAj_pr145018() { + // runTest("ataj crashing with cflow, if and args"); + // } + public void testClassCastOnArrayType_pr180264() { + runTest("classcastexception on array type"); + } + + // public void testITDWithArray_pr201748() { runTest("itd with array");} + public void testBadMessage() { + runTest("incorrect itd error with generics"); + } + + public void testBadMessage2() { + runTest("incorrect itd error with generics - 2"); + } + + public void testHasMethodAnnoValueInt_various() { + runTest("hasmethod anno value - I"); + } + + public void testHasMethodAnnoValueBoolean_various() { + runTest("hasmethod anno value - Z"); + } + + public void testHasMethodAnnoValueString_various() { + runTest("hasmethod anno value - S"); + } + + public void testGenericTypeParameterizedWithArrayType_pr167197() { + runTest("generic type parameterized with array type"); + } + + public void testGenericTypeParameterizedWithArrayType_pr167197_2() { + runTest("generic type parameterized with array type - 2"); + } + + // AspectJ1.6.0m2 and earlier + public void testBoundsCheckShouldFail_pr219298() { + runTest("bounds check failure"); + } + + public void testBoundsCheckShouldFail_pr219298_2() { + runTest("bounds check failure - 2"); + } + + public void testGenericMethodMatching_pr204505_1() { + runTest("generics method matching - 1"); + } + + public void testGenericMethodMatching_pr204505_2() { + runTest("generics method matching - 2"); + } + + public void testDecFieldProblem_pr218167() { + runTest("dec field problem"); + } + + public void testGenericsSuperITD_pr206911() { + runTest("generics super itd"); + } + + public void testGenericsSuperITD_pr206911_2() { + runTest("generics super itd - 2"); + } + + public void testSerializationAnnotationStyle_pr216311() { + runTest("serialization and annotation style"); + } + + public void testDecpRepetition_pr214559() { + runTest("decp repetition problem"); + } // all code in one file + + public void testDecpRepetition_pr214559_2() { + runTest("decp repetition problem - 2"); + } // all code in one file, default package + + public void testDecpRepetition_pr214559_3() { + runTest("decp repetition problem - 3"); + } // across multiple files + + public void testISEAnnotations_pr209831() { + runTest("illegal state exception with annotations"); + } + + public void testISEAnnotations_pr209831_2() { + runTest("illegal state exception with annotations - 2"); + } + + // See HasMemberTypePattern.hasMethod() + // public void testHasMethodSemantics() { runTest("hasmethod semantics"); } + + // See BcelTypeMunger line 786 relating to these + // String sig = interMethodDispatcher.getSignature();BROKE - should get the generic signature here and use that. + // public void testITDLostGenerics_pr211146() { runTest("itd lost generic signature");} + // public void testITDLostGenerics_pr211146_2() { runTest("itd lost generic signature - field");} + + // /////////////////////////////////////// + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc160Tests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc160.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc160/AllTestsAspectJ160.java b/tests/src/test/java/org/aspectj/systemtest/ajc160/AllTestsAspectJ160.java new file mode 100644 index 000000000..1a47719e6 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc160/AllTestsAspectJ160.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM + * 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.ajc160; + + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ160 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.6.0 tests"); + //$JUnit-BEGIN$ + suite.addTest(ParameterAnnotationMatchingTests.suite()); + suite.addTest(AnnotationValueMatchingTests.suite()); + suite.addTest(SanityTests.suite()); + suite.addTest(NewFeatures.suite()); + suite.addTest(Ajc160Tests.suite()); + //$JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc160/AnnotationValueMatchingTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc160/AnnotationValueMatchingTests.java new file mode 100644 index 000000000..d26cb9856 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc160/AnnotationValueMatchingTests.java @@ -0,0 +1,55 @@ +/* ******************************************************************* + * Copyright (c) 2008 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 + * ******************************************************************/ +package org.aspectj.systemtest.ajc160; + + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * Parameter value matching + * + */ +public class AnnotationValueMatchingTests extends XMLBasedAjcTestCase { + + public void testParsing() { runTest("parsing"); } + public void testBroken1() { runTest("broken - 1"); } + public void testParsingAllAnnotationValueKinds() { runTest("allkinds"); } + public void testSimpleCase() { runTest("simple"); } + public void testReferencingEnums1() { runTest("enum references - 1"); } + public void testReferencingEnums2() { runTest("enum references - 2"); } + public void testReferencingEnums3() { runTest("enum references - 3"); } + public void testIntValueMatching() { runTest("int value matching");} + public void testFloatValueMatching() { runTest("float value matching");} + public void testDoubleValueMatching() { runTest("double value matching");} + public void testByteValueMatching() { runTest("byte value matching");} + public void testLongValueMatching() { runTest("long value matching");} + public void testBooleanValueMatching() { runTest("boolean value matching");} + public void testShortValueMatching() { runTest("short value matching");} + public void testCharValueMatching() { runTest("char value matching");} + public void testStringValueMatching() { runTest("string value matching");} + public void testExampleOne() { runTest("example one");} + public void testError_InvalidValueTypes() { runTest("error case");} + public void testErrorOne_NonExistingValue() { runTest("error - non existing value");} + + ///////////////////////////////////////// + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AnnotationValueMatchingTests.class); + } + + protected File getSpecFile() { + return getClassResource("annotationValueMatching.xml"); + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc160/NewFeatures.java b/tests/src/test/java/org/aspectj/systemtest/ajc160/NewFeatures.java new file mode 100644 index 000000000..03c8d4f50 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc160/NewFeatures.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM + * 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.ajc160; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class NewFeatures extends org.aspectj.testing.XMLBasedAjcTestCase { + + // Supporting -Xset:weaveJavaPackages=true and -Xset:weaveJavaxPackages=true + public void testWeaveJavaxClassesNo() { runTest("weave javax classes - no");} + public void testWeaveJavaxClassesYes() { runTest("weave javax classes - yes");} + + ///////////////////////////////////////// + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(NewFeatures.class); + } + + protected File getSpecFile() { + return getClassResource("newfeatures-tests.xml"); + } + + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc160/ParameterAnnotationMatchingTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc160/ParameterAnnotationMatchingTests.java new file mode 100644 index 000000000..95a3f218f --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc160/ParameterAnnotationMatchingTests.java @@ -0,0 +1,98 @@ +/* ******************************************************************* + * Copyright (c) 2008 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 + * ******************************************************************/ +package org.aspectj.systemtest.ajc160; + + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * Parameter annotation matching + * + * The full implementation will require static matching, binding and possibly runtime + * matching (need to check on inheritance of annotations specified in these positions). + * The extension to the syntax for method-signatures is to require parentheses when + * specifying annotations relating to parameters and parameter types - the position of + * the parentheses enable the distinction to be made between annotations attached to + * the type of the parameter and annotations attached to the parameter itself. + * + * For example: + * + * public void goo(MyType s) {} // where MyType has annotation @B + * public void foo(@A String s) {} // String has no annotations, @A is a parameter annotation + * + * A method signature to match the former would be: + * execution(public void goo(@B MyType)) + * or execution(public void goo((@B MyType))) + * + * To match the latter: + * execution(public void foo(@A (String))) + * The parentheses around String are telling us that there are no annotations attached to the + * parameter type we are interested in, and @A should be treated as an intent to match on + * parameter annotation A. + * + * In a more complex case: + * public void hoo(@A MyType s) {} // now there are two potential annotations we are interested in + * the match expression is: + * execution(public void hoo(@A (@B MyType))) + * the parentheses associating @B with the type of the parameter leaving @A outside to be + * treated as a parameter annotation. + * + * Testplan: + * Test cases for the parameter annotation matching: + * DONE: + * 1. Basic pointcut parsing for the new method signature syntax + * 2. Expression matching with the new syntax + * 3. Real static matching with the new syntax + * 4. hasmethod should pick up the new syntax + * 5. ellipsis usage not impacted + * 6. recognizing varargs + * 7. constructor matching + * 8. binary weaving + * + * NOT DONE: + * . New pointcut designator parsing + * . Expression matching with the new syntax + * . Real matching with the new syntax + * . Binding with the new syntax. + * . complaining about annotations that dont target the right type + * . itds + * . annotation visibility tests + * . wildcarded @Ann*1 - broken (not my doing) + * . ltw + * + */ +public class ParameterAnnotationMatchingTests extends XMLBasedAjcTestCase { + + public void testDeow() { runTest("deow"); } + public void testDeow2() { runTest("deow2"); } + public void testNoWarningForWrongType() { runTest("no xlint for wrong target");} + public void testVariousCombinations() { runTest("various combinations"); } + public void testVariousCombinationsCtors() { runTest("various combinations - ctors"); } + public void testHasMethod() { runTest("hasmethod"); } + public void testBinaryWeaving() { runTest("binary weaving"); } + // this is broken and it was already broken before I added parameter annotation matching ! +// public void testWildcardedAnnotationMatching() { runTest("wildcarded matching"); } + + + ///////////////////////////////////////// + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(ParameterAnnotationMatchingTests.class); + } + + protected File getSpecFile() { + return getClassResource("parameterAnnotations.xml"); + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc160/SanityTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc160/SanityTests.java new file mode 100644 index 000000000..45eac49ce --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc160/SanityTests.java @@ -0,0 +1,163 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM + * 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.ajc160; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.Attribute; +import org.aspectj.apache.bcel.classfile.Code; +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.testing.XMLBasedAjcTestCase; + +/* + * Some very trivial tests that help verify things are OK. + * Followed by some Java6 specific checks to ensure the class files are well formed. + * A Java6 JDK is not required to run these tests as they introspect the .class files + * rather than executing them. + */ +public class SanityTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) + public void testSimpleJava_A() { + runTest("simple - a"); + } + + public void testSimpleJava_B() { + runTest("simple - b"); + } + + public void testSimpleCode_C() { + runTest("simple - c"); + } + + public void testSimpleCode_D() { + runTest("simple - d"); + } + + public void testSimpleCode_E() { + runTest("simple - e"); + } + + public void testSimpleCode_F() { + runTest("simple - f"); + } + + public void testSimpleCode_G() { + runTest("simple - g"); + } + + public void testSimpleCode_H() { + runTest("simple - h", true); + } + + public void testSimpleCode_I() { + runTest("simple - i"); + } + + // Check the version number in the classfiles is correct when Java6 options specified + public void testVersionCorrect1() throws ClassNotFoundException { + runTest("simple - j"); + checkVersion("A", 50, 0); + } + + public void testVersionCorrect2() throws ClassNotFoundException { + runTest("simple - k"); + checkVersion("A", 50, 0); + } + + public void testVersionCorrect3() throws ClassNotFoundException { + runTest("simple - l"); + checkVersion("A", 50, 0); + } + + public void testVersionCorrect4() throws ClassNotFoundException {// check it is 49.0 when -1.5 is specified + runTest("simple - m"); + checkVersion("A", 49, 0); + } + + // Check the stackmap stuff appears for methods in a Java6 file + // public void testStackMapAttributesAppear() throws ClassNotFoundException { + // runTest("simple - n"); + // checkStackMapExistence("A","<init>_<clinit>"); + // checkStackMapExistence("X","<init>_<clinit>_ajc$pointcut$$complicatedPointcut$1fe"); + // } + + /* For the specified class, check that each method has a stackmap attribute */ + @SuppressWarnings("unused") + private void checkStackMapExistence(String classname, String toIgnore) throws ClassNotFoundException { + toIgnore = "_" + (toIgnore == null ? "" : toIgnore) + "_"; + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname); + Method[] methods = jc.getMethods(); + for (int i = 0; i < methods.length; i++) { + Method method = methods[i]; + if (toIgnore.contains("_" + method.getName() + "_")) { + continue; + } + boolean hasStackMapAttribute = findAttribute(method.getAttributes(), "StackMapTable"); + if (!hasStackMapAttribute) { + fail("Could not find StackMap attribute for method " + method.getName()); + } + } + } + + private boolean findAttribute(Attribute[] attrs, String attributeName) { + if (attrs == null) { + return false; + } + for (int i = 0; i < attrs.length; i++) { + Attribute attribute = attrs[i]; + if (attribute.getName().equals(attributeName)) { + return true; + } + // System.out.println(attribute.getName()); + if (attribute.getName().equals("Code")) { + Code c = (Code) attribute; + Attribute[] codeAttributes = c.getAttributes(); + for (int j = 0; j < codeAttributes.length; j++) { + Attribute codeAttribute = codeAttributes[j]; + if (codeAttribute.getName().equals(attributeName)) { + return true; + // System.out.println(codeAttribute.getName()); + } + } + } + } + return false; + } + + private void checkVersion(String classname, int major, int minor) throws ClassNotFoundException { + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname); + if (jc.getMajor() != major) { + fail("Expected major version to be " + major + " but was " + jc.getMajor()); + } + if (jc.getMinor() != minor) { + fail("Expected minor version to be " + minor + " but was " + jc.getMinor()); + } + } + + // Check the stackmap stuff is removed when a method gets woven (for now...) + // public void testStackMapAttributesDeletedInWovenCode() { + // fail("Not implemented"); + // } + + // /////////////////////////////////////// + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(SanityTests.class); + } + + protected File getSpecFile() { + return getClassResource("sanity-tests.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc160/ajc160.xml b/tests/src/test/java/org/aspectj/systemtest/ajc160/ajc160.xml new file mode 100644 index 000000000..6e02e8903 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc160/ajc160.xml @@ -0,0 +1,187 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.6.0 Tests --> +<suite> + + <ajc-test dir="bugs160/pr226567" title="pipeline compilation and generic return type"> + <compile files="BarAspect.aj Foo.java Bar.java" options="-1.5"/> + <compile files="BarAspect.aj Bar.java Foo.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs160/pr225916" title="pipeline compilation and anonymous type"> + <compile files="Test.java TestMBean.java TestAspect.java" options="-showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(java.lang.String test.jmx.Test.test())' in Type"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs160/pr214994" title="generic itd"> + <compile files="Broke.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs160/pr223605" title="generic decp ltw"> + <compile files="GenericConfigurableBugTest.java" options="-1.5"><!-- -showWeaveInfo"--> + </compile> + <run class="test.GenericConfigurableBugTest"/> + </ajc-test> + + <ajc-test dir="bugs160/pr173602" title="duplicate itd npe"> + <compile files="X.java"> + <message kind="error" line="2" text="intertype declaration from "/> + <message kind="error" line="3" text="intertype declaration from "/> + <message kind="error" line="6" text="intertype declaration from "/> + </compile> + </ajc-test> + + <ajc-test dir="bugs160/pr223094" title="ltw inherited itds"> + <compile files="B.java" outjar="foo.jar"/> + <compile files="A.java" classpath="$sandbox/foo.jar"/> + <run class="p.A" classpath="$sandbox/foo.jar" ltw="aop.xml"> + <stdout> + <line text="ok"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs160/pr167197" title="generic type parameterized with array type"> + <compile options="-1.5" files="AspectBreaker.java"/> + </ajc-test> + + <ajc-test dir="bugs160/pr167197" title="generic type parameterized with array type - 2"> + <compile options="-1.5" files="Breaker2.java"/> + <run class="Breaker2"/> + </ajc-test> + + <ajc-test dir="bugs160/pr180264" title="classcastexception on array type"> + <compile options="-warn:+uselessTypeCheck" files="Foo.java,Main.java"/> + </ajc-test> + + <ajc-test dir="bugs160/pr145018" title="ataj crashing with cflow, if and args"> + <compile files="Broken.aj" options="-1.5"/> + <run class="Broken"> + </run> + </ajc-test> + + <ajc-test dir="bugs160/pr201748" title="itd with array"> + <compile files="Foo.java"> + <message kind="error" text="Type mismatch: cannot convert from Factory[] to Factory"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs160/various" title="incorrect itd error with generics"> + <compile options="-1.5 -showWeaveInfo" files="IncorrectMessage.java"> + <message kind="weave" text="Type 'Foo' (IncorrectMessage.java) has intertyped method from 'AspectDoWhatEver' (IncorrectMessage.java:'void Marker.doWhatEver()')"/> + <message kind="weave" text="Type 'Marker' (IncorrectMessage.java) has intertyped method from 'AspectDoWhatEver' (IncorrectMessage.java:'void Marker.doWhatEver()')"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs160/various" title="incorrect itd error with generics - 2"> + <compile options="-1.5 -showWeaveInfo" files="IncorrectMessage2.java"> + <message kind="weave" text="Type 'Foo' (IncorrectMessage2.java) has intertyped method from 'AspectDoWhatEver' (IncorrectMessage2.java:'void Marker.doWhatEver()')"/> + <message kind="weave" text="Type 'Marker' (IncorrectMessage2.java) has intertyped method from 'AspectDoWhatEver' (IncorrectMessage2.java:'void Marker.doWhatEver()')"/> + </compile> + </ajc-test> + + + <ajc-test dir="bugs160/various" title="hasmethod anno value - I"> + <compile options="-1.5 -XhasMember -showWeaveInfo" files="A.java"> + <message kind="weave" text="Extending interface set for type 'B' (A.java) to include 'java.io.Serializable' (A.java)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs160/various" title="hasmethod anno value - Z"> + <compile options="-1.5 -XhasMember -showWeaveInfo" files="Z.java"> + <message kind="weave" text="Extending interface set for type 'B' (Z.java) to include 'java.io.Serializable' (Z.java)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs160/various" title="hasmethod anno value - S"> + <compile options="-1.5 -XhasMember -showWeaveInfo" files="S.java"> + <message kind="weave" text="Extending interface set for type 'B' (S.java) to include 'java.io.Serializable' (S.java)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs160/various" title="hasmethod semantics"> + <compile options="-1.5 -XhasMember -Xlint:ignore" files="HasMethodSemantics.java"/> + <run class="HasMethodSemantics"> + <stdout> + <line text="Implements Marker? no"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs160/pr204505" title="generics method matching - 1"> + <compile options="-1.5 -showWeaveInfo" files="Bug.java"> + <message kind="weave" text="execution(void C.save(java.lang.Object))"/> + <message kind="weave" text="execution(void C.saveAll(java.util.Collection))"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs160/pr204505" title="generics method matching - 2"> + <compile options="-1.5" files="GenericInterfaceWithGenericArgumentPointcutBug.java"/> + <run class="mypackage.GenericInterfaceWithGenericArgumentPointcutBug"/> + </ajc-test> + + <ajc-test dir="bugs160/pr219298" title="bounds check failure"> + <compile options="-1.5" files="TestMarkers.java"> + <message kind="error" line="11" text="Bound mismatch: The type TestMarkers.SubGenericsType is not a valid substitute for the bounded"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs160/pr219298" title="bounds check failure - 2"> + <compile options="-1.5" files="TestMarkers2.java"/> + </ajc-test> + + <ajc-test dir="bugs160/pr218167" title="dec field problem"> + <compile options="-1.5" files="Test.java"> + <message kind="warning" text="already has an annotation of type A, cannot add a second instance"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs160/pr206911" title="generics super itd"> + <compile options="-1.5" files="VerifyError.java"/> + <run class="bugs.VerifyError"/> + </ajc-test> + + <ajc-test dir="bugs160/pr206911" title="generics super itd - 2"> + <compile options="-1.5" files="VerifyError2.java"/> + <run class="bugs.VerifyError2"/> + </ajc-test> + + <ajc-test dir="bugs160/pr216311" title="serialization and annotation style"> + <compile options="-1.5" files="PersistabilityTest.java,IPersistable.java,Persistability.java"/> + <run class="PersistabilityTest"/> + </ajc-test> + + <ajc-test dir="bugs160/pr214559" title="decp repetition problem"> + <compile files="X.java"/> + <run class="test.X"/> + </ajc-test> + + <ajc-test dir="bugs160/pr214559" title="decp repetition problem - 2"> + <compile files="Y.java"/> + <run class="Y"/> + </ajc-test> + + <ajc-test dir="bugs160/pr214559" title="decp repetition problem - 3"> + <compile files="TestClass.java Interface1.java Interface1TestClass.java DeclareParentsPrecedenceTest.java TestAspect.java"/> + <run class="DeclareParentsPrecedenceTest"/> + </ajc-test> + + <ajc-test dir="bugs160/pr209831" title="illegal state exception with annotations"> + <compile options="-1.5 -showWeaveInfo" files="Test.java"> + <message kind="weave" text="Join point 'exception-handler(void Test.<catch>(java.lang.Throwable))' in Type 'Test' (Test.java:34) advised by before advice from 'ExactAnnotationTypePatternBug' (Test.java:5)"/> + </compile> + <run class="Test"/> + </ajc-test> + + <ajc-test dir="bugs160/pr209831" title="illegal state exception with annotations - 2"> + <compile options="-Xlint:ignore -1.5 -showWeaveInfo" files="Test2.java"/> + <run class="Test2"/> + </ajc-test> + + <ajc-test dir="bugs160/pr211146" title="itd lost generic signature"> + <compile options=" -1.5" files="StringAspect.aj,StringClass.java" outjar="foo.jar"/> + <compile options=" -1.5" files="DemoUsage.java" classpath="foo.jar"/> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc160/annotationValueMatching.xml b/tests/src/test/java/org/aspectj/systemtest/ajc160/annotationValueMatching.xml new file mode 100644 index 000000000..ebcc8b4c2 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc160/annotationValueMatching.xml @@ -0,0 +1,148 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.6.0 Annotation Value Matching Tests --> +<suite> + + <ajc-test dir="features160/annotationValueMatching" title="enum references - 1"> + <compile options="-1.5 -showWeaveInfo" files="Color.java,TrafficLight.java,Fruit.java,Fruity.java,EnumTest1.java"> + <message kind="weave" text="Join point 'method-execution(void a.EnumTest1.m())' in Type 'a.EnumTest1' (EnumTest1.java:9) advised by before advice from 'a.EnumTest1' (EnumTest1.java:13)"/> + <message kind="weave" text="Join point 'method-execution(void a.EnumTest1.o())' in Type 'a.EnumTest1' (EnumTest1.java:11) advised by before advice from 'a.EnumTest1' (EnumTest1.java:13)"/> + </compile> + <run class="a.EnumTest1"/> + </ajc-test> + + <ajc-test dir="features160/annotationValueMatching" title="enum references - 2"> + <compile options="-1.5 -showWeaveInfo" files="Color.java,TrafficLight.java,Fruit.java,Fruity.java,EnumTest2.java"> + <message kind="weave" text="Join point 'method-execution(void a.EnumTest2.m())' in Type 'a.EnumTest2' (EnumTest2.java:9) advised by before advice from 'a.EnumTest2' (EnumTest2.java:13)"/> + <message kind="weave" text="Join point 'method-execution(void a.EnumTest2.o())' in Type 'a.EnumTest2' (EnumTest2.java:11) advised by before advice from 'a.EnumTest2' (EnumTest2.java:13)"/> + </compile> + <run class="a.EnumTest2"/> + </ajc-test> + + <ajc-test dir="features160/annotationValueMatching" title="enum references - 3"> + <compile options="-1.5 -showWeaveInfo" files="Color.java,TrafficLight.java,Fruit.java,Fruity.java,EnumTest3.java"> + <message kind="weave" text="Join point 'method-execution(void a.EnumTest3.m())' in Type 'a.EnumTest3' (EnumTest3.java:9) advised by before advice from 'a.EnumTest3' (EnumTest3.java:13)"/> + </compile> + <run class="a.EnumTest3"/> + </ajc-test> + + <ajc-test dir="features160/annotationValueMatching" title="broken - 1"> + <compile options="-1.5 -showWeaveInfo" files="Broken1.java"> + <message kind="error" line="28" text="Invalid annotation value 'a', expected enum value"/> + </compile> + </ajc-test> + + <ajc-test dir="features160/annotationValueMatching" title="allkinds"> + <compile options="-1.5 -showWeaveInfo" files="AllKinds.java"> + </compile> + </ajc-test> + + <ajc-test dir="features160/annotationValueMatching" title="int value matching"> + <compile options="-1.5 -showWeaveInfo" files="IntValueMatching.java"> + <message kind="weave" text="Join point 'method-execution(void IntValueMatching.b())' in Type 'IntValueMatching' (IntValueMatching.java:9) advised by before advice from 'X' (IntValueMatching.java:21)"/> + </compile> + </ajc-test> + + <ajc-test dir="features160/annotationValueMatching" title="float value matching"> + <compile options="-1.5 -showWeaveInfo" files="FloatValueMatching.java"> + <message kind="weave" text="methodTwo"/> + </compile> + <run class="FloatValueMatching"/> + </ajc-test> + + <ajc-test dir="features160/annotationValueMatching" title="double value matching"> + <compile options="-1.5 -showWeaveInfo" files="DoubleValueMatching.java"> + <message kind="weave" text="methodOne"/> + </compile> + <run class="DoubleValueMatching"/> + </ajc-test> + + <ajc-test dir="features160/annotationValueMatching" title="char value matching"> + <compile options="-1.5 -showWeaveInfo" files="CharValueMatching.java"> + <message kind="weave" text="methodTwo"/> + </compile> + <run class="CharValueMatching"/> + </ajc-test> + + <ajc-test dir="features160/annotationValueMatching" title="long value matching"> + <compile options="-1.5 -showWeaveInfo" files="LongValueMatching.java"> + <message kind="weave" text="methodOne"/> + </compile> + <run class="LongValueMatching"/> + </ajc-test> + + <ajc-test dir="features160/annotationValueMatching" title="string value matching"> + <compile options="-1.5 -showWeaveInfo" files="StringValueMatching.java"> + <message kind="weave" text="methodOne"/> + </compile> + <run class="StringValueMatching"/> + </ajc-test> + + <ajc-test dir="features160/annotationValueMatching" title="boolean value matching"> + <compile options="-1.5 -showWeaveInfo" files="BooleanValueMatching.java"> + <message kind="weave" text="methodOne"/> + </compile> + <run class="BooleanValueMatching"/> + </ajc-test> + + <ajc-test dir="features160/annotationValueMatching" title="byte value matching"> + <compile options="-1.5 -showWeaveInfo" files="ByteValueMatching.java"> + <message kind="weave" text="methodOne"/> + </compile> + <run class="ByteValueMatching"/> + </ajc-test> + + <ajc-test dir="features160/annotationValueMatching" title="short value matching"> + <compile options="-1.5 -showWeaveInfo" files="ShortValueMatching.java"> + <message kind="weave" text="methodOne"/> + </compile> + <run class="ShortValueMatching"/> + </ajc-test> + + <ajc-test dir="features160/annotationValueMatching" title="parsing"> + <compile options="-1.5 -showWeaveInfo Parsing.java"/> + </ajc-test> + + <ajc-test dir="features160/annotationValueMatching" title="simple"> + <compile options="-1.5 -showWeaveInfo Simple.java"> + <message kind="weave" text="Join point 'method-execution(void Marked.b())' in Type 'Marked' (Simple.java:18) advised by before advice from 'X' (Simple.java:28)"/> + <message kind="weave" text="Join point 'method-execution(void Marked.c())' in Type 'Marked' (Simple.java:21) advised by before advice from 'X' (Simple.java:28)"/> + </compile> + </ajc-test> + + <ajc-test dir="features160/annotationValueMatching" title="example one"> + <compile options="-1.5 -showWeaveInfo ExampleOne.java"> + <message kind="weave" text="m002"/> + <message kind="weave" text="m003"/> + <message kind="weave" text="m005"/> + </compile> + <run class="ExampleOne"> + <stderr> + <line text="tracing execution(void ExampleOne.m002())"/> + <line text="tracing execution(void ExampleOne.m003())"/> + <line text="tracing execution(void ExampleOne.m005())"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features160/annotationValueMatching" title="error case"> + <compile options="-1.5 Error.java"> + <message kind="error" text="Invalid annotation value 'Color.GREEN', expected int value"/> + <message kind="error" text="Invalid annotation value 'hello', expected float value"/> + <message kind="error" text="Invalid annotation value 'foo', expected byte value"/> + <message kind="error" text="Invalid annotation value '123', expected boolean value"/> + <message kind="error" text="Invalid annotation value '12', expected enum value"/> + <message kind="error" text="Invalid annotation value '4212312312', expected short value"/> + <message kind="error" text="Invalid annotation value 'no', expected char value"/> + <message kind="error" text="Invalid annotation value '30.0f', expected long value"/> + <message kind="error" text="Invalid annotation value 'foo', expected double value"/> + </compile> + </ajc-test> + + <ajc-test dir="features160/annotationValueMatching" title="error - non existing value"> + <compile options="-1.5 ErrorOne.java"> + <message kind="error" text="The annotation 'Anno' does not define a value named 'ival'"/> + </compile> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc160/newfeatures-tests.xml b/tests/src/test/java/org/aspectj/systemtest/ajc160/newfeatures-tests.xml new file mode 100644 index 000000000..3b00c8d15 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc160/newfeatures-tests.xml @@ -0,0 +1,37 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.6.0 Tests --> +<suite> + + <ajc-test dir="features160/weavingJavaxPackage" title="weave javax classes - no"> + <compile files="A.java B.java" /> + <compile files="X.aj" outjar="code.jar" options="-1.4"/> + <run class="javax.foo.A" classpath="code.jar" ltw="aop1.xml"> + <stderr> + <line text="AspectJ Weaver Version"/> + <line text="register classloader"/> + <line text="using configuration"/> + <line text="register aspect X"/> + <line text="not being woven"/> + </stderr> + <stdout> + <line text="(A) method running"/> + <line text="(B) method running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features160/weavingJavaxPackage" title="weave javax classes - yes"> + <compile files="A.java B.java" /> + <compile files="X.aj" outjar="code.jar" options="-1.4"/> + <run class="javax.foo.A" classpath="code.jar" ltw="aop2.xml"> + <stdout> + <line text="advised"/> + <line text="(A) method running"/> + <line text="advised"/> + <line text="(B) method running"/> + </stdout> + </run> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc160/parameterAnnotations.xml b/tests/src/test/java/org/aspectj/systemtest/ajc160/parameterAnnotations.xml new file mode 100644 index 000000000..1f06e2d82 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc160/parameterAnnotations.xml @@ -0,0 +1,149 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.6.0 Parameter Annotation Matching Tests --> +<suite> + + <ajc-test dir="features160/parameterAnnotationMatching" title="deow2"> + <compile options="-1.5" files="Test2.java"> + <message kind="warning" line="9" text="mOne"/> + <message kind="warning" line="13" text="mTwo"/> + <message kind="warning" line="15" text="mTwo"/> + </compile> + </ajc-test> + + <ajc-test dir="features160/parameterAnnotationMatching" title="deow"> + <compile options="-1.5" files="Test.java"> + <message kind="warning" line="43" text="mOne"/> + <message kind="warning" line="45" text="mOne"/> + <message kind="warning" line="43" text="mTwo"/> + <message kind="warning" line="43" text="mThree"/> + <message kind="warning" line="47" text="mFour"/> + <message kind="warning" line="49" text="mFour"/> + <message kind="warning" line="47" text="mFive"/> + <message kind="warning" line="47" text="mSix"/> + <message kind="warning" line="45" text="mSeven"/> + <message kind="warning" line="45" text="mEight"/> + <message kind="warning" line="45" text="mNine"/> + <message kind="warning" line="49" text="mTen"/> + <message kind="warning" line="49" text="mEleven"/> + <message kind="warning" line="49" text="mTwelve"/> + </compile> + </ajc-test> + + <ajc-test dir="features160/parameterAnnotationMatching" title="no xlint for wrong target"> + <compile options="-1.5" files="NonNullAssertionForcer.java"/> + </ajc-test> + + <ajc-test dir="features160/parameterAnnotationMatching" title="various combinations"> + <compile options="-1.5 -showWeaveInfo" files="TestMatching.aj Anno1.java Anno2.java AnnotatedWithAnno1.java AnnotatedWithAnno2.java"> + <message kind="weave" text="'TestMatching' (TestMatching.aj:4) advised by before advice from 'TestMatching' (TestMatching.aj:3)"/> + + <message kind="weave" text="'TestMatching' (TestMatching.aj:7) advised by before advice from 'TestMatching' (TestMatching.aj:6)"/> + + <message kind="weave" text="'TestMatching' (TestMatching.aj:11) advised by before advice from 'TestMatching' (TestMatching.aj:10)"/> + + <message kind="weave" text="'TestMatching' (TestMatching.aj:16) advised by before advice from 'TestMatching' (TestMatching.aj:15)"/> + + <message kind="weave" text="'TestMatching' (TestMatching.aj:22) advised by before advice from 'TestMatching' (TestMatching.aj:21)"/> + + <message kind="weave" text="'TestMatching' (TestMatching.aj:27) advised by before advice from 'TestMatching' (TestMatching.aj:26)"/> + <message kind="weave" text="'TestMatching' (TestMatching.aj:31) advised by before advice from 'TestMatching' (TestMatching.aj:26)"/> + + <message kind="weave" text="'TestMatching' (TestMatching.aj:34) advised by before advice from 'TestMatching' (TestMatching.aj:33)"/> + + <message kind="weave" text="'TestMatching' (TestMatching.aj:40) advised by before advice from 'TestMatching' (TestMatching.aj:39)"/> + <message kind="weave" text="'TestMatching' (TestMatching.aj:41) advised by before advice from 'TestMatching' (TestMatching.aj:39)"/> + <message kind="weave" text="'TestMatching' (TestMatching.aj:42) advised by before advice from 'TestMatching' (TestMatching.aj:39)"/> + + <message kind="weave" text="'TestMatching' (TestMatching.aj:47) advised by before advice from 'TestMatching' (TestMatching.aj:46)"/> + <message kind="weave" text="'TestMatching' (TestMatching.aj:48) advised by before advice from 'TestMatching' (TestMatching.aj:46)"/> + + <message kind="weave" text="'TestMatching' (TestMatching.aj:53) advised by before advice from 'TestMatching' (TestMatching.aj:52)"/> + <message kind="weave" text="'TestMatching' (TestMatching.aj:54) advised by before advice from 'TestMatching' (TestMatching.aj:52)"/> + + <message kind="warning" line="57" text="not been applied"/> + + <message kind="weave" text="'TestMatching' (TestMatching.aj:62) advised by before advice from 'TestMatching' (TestMatching.aj:61)"/> + + </compile> + </ajc-test> + + <ajc-test dir="features160/parameterAnnotationMatching" title="wildcarded matching"> + <compile options="-1.5 -showWeaveInfo" files="WildcardedMatching.aj Anno1.java Anno2.java AnnotatedWithAnno1.java AnnotatedWithAnno2.java"> + <!-- tbd --> + </compile> + </ajc-test> + + + <ajc-test dir="features160/parameterAnnotationMatching" title="various combinations - ctors"> + <compile options="-1.5 -showWeaveInfo" files="TestMatchingCtors.aj Anno1.java Anno2.java AnnotatedWithAnno1.java AnnotatedWithAnno2.java"> + <message kind="weave" text="(TestMatchingCtors.aj:4) advised by before advice from 'TestMatching' (TestMatchingCtors.aj:3)"/> + + <message kind="weave" text="(TestMatchingCtors.aj:7) advised by before advice from 'TestMatching' (TestMatchingCtors.aj:6)"/> + + <message kind="weave" text="(TestMatchingCtors.aj:11) advised by before advice from 'TestMatching' (TestMatchingCtors.aj:10)"/> + + <message kind="weave" text="(TestMatchingCtors.aj:16) advised by before advice from 'TestMatching' (TestMatchingCtors.aj:15)"/> + + <message kind="weave" text="(TestMatchingCtors.aj:22) advised by before advice from 'TestMatching' (TestMatchingCtors.aj:21)"/> + + <message kind="weave" text="(TestMatchingCtors.aj:27) advised by before advice from 'TestMatching' (TestMatchingCtors.aj:26)"/> + <message kind="weave" text="(TestMatchingCtors.aj:31) advised by before advice from 'TestMatching' (TestMatchingCtors.aj:26)"/> + + <message kind="weave" text="(TestMatchingCtors.aj:34) advised by before advice from 'TestMatching' (TestMatchingCtors.aj:33)"/> + + <message kind="weave" text="(TestMatchingCtors.aj:40) advised by before advice from 'TestMatching' (TestMatchingCtors.aj:39)"/> + <message kind="weave" text="(TestMatchingCtors.aj:41) advised by before advice from 'TestMatching' (TestMatchingCtors.aj:39)"/> + <message kind="weave" text="(TestMatchingCtors.aj:42) advised by before advice from 'TestMatching' (TestMatchingCtors.aj:39)"/> + + <message kind="weave" text="(TestMatchingCtors.aj:47) advised by before advice from 'TestMatching' (TestMatchingCtors.aj:46)"/> + <message kind="weave" text="(TestMatchingCtors.aj:48) advised by before advice from 'TestMatching' (TestMatchingCtors.aj:46)"/> + + <message kind="weave" text="(TestMatchingCtors.aj:53) advised by before advice from 'TestMatching' (TestMatchingCtors.aj:52)"/> + <message kind="weave" text="(TestMatchingCtors.aj:54) advised by before advice from 'TestMatching' (TestMatchingCtors.aj:52)"/> + + <message kind="warning" line="57" text="not been applied"/> + + <message kind="weave" text="(TestMatchingCtors.aj:62) advised by before advice from 'TestMatching' (TestMatchingCtors.aj:61)"/> + + </compile> + </ajc-test> + + <ajc-test dir="features160/parameterAnnotationMatching" title="hasmethod"> + <compile options="-1.5 -showWeaveInfo -XhasMember" files="HasMethodMatching.aj Anno1.java Anno2.java AnnotatedWithAnno1.java AnnotatedWithAnno2.java"> + <message kind="weave" text="Extending interface set for type 'Target1' (HasMethodMatching.aj) to include 'java.io.Serializable' (HasMethodMatching.aj)"/> + <message kind="weave" text="Extending interface set for type 'Target3' (HasMethodMatching.aj) to include 'java.io.Serializable' (HasMethodMatching.aj)"/> + <message kind="weave" text="Extending interface set for type 'Target4' (HasMethodMatching.aj) to include 'java.io.Serializable' (HasMethodMatching.aj)"/> + </compile> + <run class="HasMethodMatching"> + <stdout> + <line text="Target1? true"/> + <line text="Target2? false"/> + <line text="Target3? true"/> + <line text="Target4? true"/> + <line text="Target5? false"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features160/parameterAnnotationMatching" title="binary weaving"> + <compile options="-1.5" files="SimpleType.java Anno1.java Anno2.java AnnotatedWithAnno1.java AnnotatedWithAnno2.java AnnotatedWithBoth.java" outjar="code.jar"/> + <compile options="-1.5 -showWeaveInfo" files="SimpleAspect.java" inpath="code.jar"> + <message kind="weave" text="(SimpleType.java:2) advised by before advice from 'SimpleAspect' (SimpleAspect.java:2)"/> + <message kind="weave" text="(SimpleType.java:3) advised by before advice from 'SimpleAspect' (SimpleAspect.java:4)"/> + <message kind="weave" text="(SimpleType.java:4) advised by before advice from 'SimpleAspect' (SimpleAspect.java:6)"/> + <message kind="weave" text="(SimpleType.java:4) advised by before advice from 'SimpleAspect' (SimpleAspect.java:4)"/> + <message kind="weave" text="(SimpleType.java:4) advised by before advice from 'SimpleAspect' (SimpleAspect.java:3)"/> + <message kind="weave" text="(SimpleType.java:5) advised by before advice from 'SimpleAspect' (SimpleAspect.java:5)"/> + <message kind="weave" text="(SimpleType.java:5) advised by before advice from 'SimpleAspect' (SimpleAspect.java:4)"/> + <message kind="weave" text="(SimpleType.java:6) advised by before advice from 'SimpleAspect' (SimpleAspect.java:7)"/> + <message kind="weave" text="(SimpleType.java:6) advised by before advice from 'SimpleAspect' (SimpleAspect.java:6)"/> + <message kind="weave" text="(SimpleType.java:6) advised by before advice from 'SimpleAspect' (SimpleAspect.java:5)"/> + <message kind="weave" text="(SimpleType.java:6) advised by before advice from 'SimpleAspect' (SimpleAspect.java:4)"/> + <message kind="weave" text="(SimpleType.java:6) advised by before advice from 'SimpleAspect' (SimpleAspect.java:3)"/> + <message kind="weave" text="(SimpleType.java:6) advised by before advice from 'SimpleAspect' (SimpleAspect.java:2)"/> + </compile> + </ajc-test> + + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc160/sanity-tests.xml b/tests/src/test/java/org/aspectj/systemtest/ajc160/sanity-tests.xml new file mode 100644 index 000000000..3d5654361 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc160/sanity-tests.xml @@ -0,0 +1,76 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.6.0 Tests --> +<suite> + + <!-- empty class --> + <ajc-test dir="bugs160/simplejava" title="simple - a"> + <compile files="SimpleA.java" options="-1.5"/> + </ajc-test> + + <!-- class with one method --> + <ajc-test dir="bugs160/simplejava" title="simple - b"> + <compile files="SimpleB.java" options="-1.5"/> + <run class="SimpleB"/> + </ajc-test> + + <!-- empty aspect --> + <ajc-test dir="bugs160/simplejava" title="simple - c"> + <compile files="SimpleC.java" options="-1.5"/> + </ajc-test> + + <!-- simple before --> + <ajc-test dir="bugs160/simplejava" title="simple - d"> + <compile files="SimpleD.java" options="-1.5"/> + </ajc-test> + + <!-- simple itd field --> + <ajc-test dir="bugs160/simplejava" title="simple - e"> + <compile files="SimpleE.java" options="-1.5"/> + </ajc-test> + + <!-- aspect with main calling a static method --> + <ajc-test dir="bugs160/simplejava" title="simple - f"> + <compile files="SimpleF.java" options="-1.5"/> + </ajc-test> + + <!-- pertarget --> + <ajc-test dir="bugs160/simplejava" title="simple - g"> + <compile files="SimpleG.java" /> + </ajc-test> + + <!-- generic ctor itds --> + <ajc-test dir="bugs160/simplejava" title="simple - h"> + <compile files="SimpleH.java" options="-1.5"/> + </ajc-test> + + <!-- overriding generic itd methods --> + <ajc-test dir="bugs160/simplejava" title="simple - i"> + <compile files="SimpleI.java" options="-1.5"/> + </ajc-test> + + <!-- check class file version is 50.0 --> + <ajc-test dir="bugs160/simplejava" title="simple - j"> + <compile files="SimpleJ.java" options="-1.6"/> + </ajc-test> + + <!-- check class file version is 50.0 --> + <ajc-test dir="bugs160/simplejava" title="simple - k"> + <compile files="SimpleJ.java" options="-source 1.6"/> + </ajc-test> + + <!-- check class file version is 50.0 --> + <ajc-test dir="bugs160/simplejava" title="simple - l"> + <compile files="SimpleJ.java" options="-source 1.6 -target 1.6"/> + </ajc-test> + + <!-- check class file version is 49.0 --> + <ajc-test dir="bugs160/simplejava" title="simple - m"> + <compile files="SimpleJ.java" options="-1.5"/> + </ajc-test> + + + <ajc-test dir="bugs160/simplejava" title="simple - n"> + <compile files="SimpleN.java" options="-1.6"/> + </ajc-test> +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc161/Ajc161Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc161/Ajc161Tests.java new file mode 100644 index 000000000..cbe5e788b --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc161/Ajc161Tests.java @@ -0,0 +1,204 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc161; + +import java.io.File; +import java.util.Iterator; +import java.util.Set; + +import junit.framework.Test; + +import org.aspectj.asm.AsmManager; +import org.aspectj.asm.IRelationshipMap; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class Ajc161Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + // AspectJ1.6.1 + public void testSignatureProcessing_pr237447() { + runTest("signature processing"); + } + + public void testGenericAtAround_pr237419() { + runTest("generics ataround"); + } + + public void testGenericMarkerMatch_pr203367() { + runTest("generic marker match"); + } + + // public void testSuperItds_pr134425() { runTest("super itds"); } + public void testSuperItds_pr198196_1() { + runTest("super itds - 2"); + } + + public void testSuperItds_pr198196_2() { + runTest("super itds - 3"); + } + + public void testSuperItds_pr198196_3() { + runTest("super itds - 4"); + } + + public void testDeow_pr237381_1() { + runTest("ataspectj deow - 1"); + } + + public void testDeow_pr237381_2() { + runTest("ataspectj deow - 2"); + } + + public void testRunningBrokenCode_pr102733_2() { + runTest("running broken code - 2"); + } + + public void testRunningBrokenCode_pr102733() { + runTest("running broken code"); + } + + public void testErrorOnNonabstractGenericAtAspectJAspect_pr168982() { + runTest("error on non-abstract generic ataspectj aspect"); + } + + public void testIgnoringTypeLevelSuppression_pr234933() { + runTest("ignoring type level suppress"); + } + + public void testDuplicateMethodSignature_pr223226_2() { + runTest("duplicate method signature - 2"); + } + + public void testDuplicateMethodSignature_pr223226() { + runTest("duplicate method signature"); + } + + public void testProtectedMethodsAroundAdvice_pr197719_2() { + runTest("protected methods and around advice - again - 2"); + } + + public void testProtectedMethodsAroundAdvice_pr197719() { + runTest("protected methods and around advice - again"); + } + + public void testProtectedMethodsAroundAdvice_pr230075() { + runTest("protected methods and around advice"); + } + + public void testFinalStringsAnnotationPointcut_pr174385() { + runTest("static strings in annotation pointcuts"); + } + + public void testComplexBoundsGenericAspect_pr199130_1() { + runTest("complex bounds on generic aspect - 1"); + } + + public void testComplexBoundsGenericAspect_pr199130_2() { + runTest("complex bounds on generic aspect - 2"); + } + + public void testComplexBoundsGenericAspect_pr199130_3() { + runTest("complex bounds on generic aspect - 3"); + } + + public void testPrivilegedGenericAspect_pr235505() { + runTest("privileged generic aspect"); + } + + public void testPrivilegedGenericAspect_pr235505_2() { + runTest("privileged generic aspect - 2"); + } + + public void testParsingAroundNoReturn_pr64222() { + runTest("parsing around advice no return"); + } + + public void testParsingBeforeArrayRef_pr159268() { + runTest("before array name"); + } + + public void testGenericAspectAroundAdvice_pr226201() { + runTest("generic aspect around advice"); + } + + public void testCrazyGenericsInnerTypes_pr235829() { + runTest("crazy generics and inner types"); + } + + public void testAnnotationExposureGenerics_pr235597() { + runTest("annotation exposure and generics"); + } + + public void testIncorrectRelationship_pr235204() { + runTest("incorrect call relationship"); + IRelationshipMap irm = AsmManager.lastActiveStructureModel.getRelationshipMap(); + Set entries = irm.getEntries(); + boolean gotSomethingValid = false; + String expected = "<recursivepackage{RecursiveCatcher.java'RecursiveCatcher~recursiveCall~I?method-call(void recursivepackage.RecursiveCatcher.recursiveCall(int))"; + for (Iterator iterator = entries.iterator(); iterator.hasNext();) { + String str = (String) iterator.next(); + if (str.indexOf(expected) != -1) { + gotSomethingValid = true; + } + } + if (!gotSomethingValid) { + fail("Did not find a relationship with the expected data in '" + expected + "'"); + } + } + + public void testITDPrecedence_pr233838_1() { + runTest("itd precedence - 1"); + } + + public void testITDPrecedence_pr233838_2() { + runTest("itd precedence - 2"); + } + + public void testGetFieldGenerics_pr227401() { + runTest("getfield problem with generics"); + } + + public void testGenericAbstractAspects_pr231478() { + runTest("generic abstract aspects"); + } + + public void testFieldJoinpointsAndAnnotationValues_pr227993() { + runTest("field jp anno value"); + } + + public void testGenericsBoundsDecp_pr231187() { + runTest("generics bounds decp"); + } + + public void testGenericsBoundsDecp_pr231187_2() { + runTest("generics bounds decp - 2"); + } + + public void testLtwInheritedCflow_pr230134() { + runTest("ltw inherited cflow"); + } + + public void testAroundAdviceOnFieldSet_pr229910() { + runTest("around advice on field set"); + } + + public void testPipelineCompilationGenericReturnType_pr226567() { + runTest("pipeline compilation and generic return type"); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc161Tests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc161.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc161/AllTestsAspectJ161.java b/tests/src/test/java/org/aspectj/systemtest/ajc161/AllTestsAspectJ161.java new file mode 100644 index 000000000..d5de6f84f --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc161/AllTestsAspectJ161.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc161; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ161 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.6.1 tests"); + //$JUnit-BEGIN$ + suite.addTest(Ajc161Tests.suite()); + suite.addTest(OptimizedAnnotationFieldBinding.suite()); + //$JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc161/OptimizedAnnotationFieldBinding.java b/tests/src/test/java/org/aspectj/systemtest/ajc161/OptimizedAnnotationFieldBinding.java new file mode 100644 index 000000000..6755a3ef6 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc161/OptimizedAnnotationFieldBinding.java @@ -0,0 +1,72 @@ +/* ******************************************************************* + * Copyright (c) 2008 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 + * ******************************************************************/ +package org.aspectj.systemtest.ajc161; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * Optimising Annotation Field Binding - better code gen for the cases where the user just wants a field from the + * annotation on a method but not the whole annotation. + * + */ +public class OptimizedAnnotationFieldBinding extends XMLBasedAjcTestCase { + + public void testCaseOne_Syntax() { + runTest("case one - syntax"); + } + public void testCaseTwo_NoSuchField() { + runTest("case two - no such field"); + } + public void testCaseThree_Ambiguous() { + runTest("case three - ambiguous"); + } + public void testCaseFour_DefaultValue() { + runTest("case four - default value"); + } + public void testCaseFive_NotAnEnum_CompilerLimitation() { + runTest("case five - not an enum - compiler limitation"); + } + public void testCaseSeven_AnnosInPackagesOne() { + runTest("case seven - annos in packages one"); + } + public void testCaseEight_AnnosInPackagesTwo() { + runTest("case eight - annos in packages two"); + } + public void testCaseNine_AllInDifferentPackages() { + runTest("case nine - everything in different packages"); + } + public void testCaseTen_BindingMultipleThings() { + runTest("case ten - binding multiple things"); + } + public void testCaseEleven_BindingMultipleAnnotationFields() { + runTest("case eleven - binding multiple annotation fields"); + } + public void testCaseTwelve_BindingAnnoAndAnnoValue() { + runTest("case twelve - binding anno and anno value"); + } + public void testCaseThirteen_bugNPE() { + runTest("case thirteen - bug npe"); + } + + ///////////////////////////////////////// + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(OptimizedAnnotationFieldBinding.class); + } + + protected File getSpecFile() { + return getClassResource("annotationFieldBinding.xml"); + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc161/ajc161.xml b/tests/src/test/java/org/aspectj/systemtest/ajc161/ajc161.xml new file mode 100644 index 000000000..abc3e058e --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc161/ajc161.xml @@ -0,0 +1,321 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.6.1 Tests --> +<suite> + + + <ajc-test dir="bugs161/pr237447" title="signature processing"> + <compile files="GenericClass.java SomeClass.java GenericGenericMemberClass.java UnrelatedAspect.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs161/pr173978" title="lv table for around"> + <compile files="TestAroundAspect.java Test.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs161/pr237419" title="generics ataround"> + <compile files="problem/aspect/AnyAspect.java problem/SpecificService.java problem/Specific.java problem/GenericService.java problem/Generic.java" options="-1.5"/> + <run class="problem.SpecificService"/> + </ajc-test> + + <ajc-test dir="bugs161/pr203367" title="generic marker match"> + <compile files="CantMatchOnInterfaceIntroducedToGenericClass.java" options="-1.5"/> + <run class="bug.CantMatchOnInterfaceIntroducedToGenericClass"/> + </ajc-test> + + <ajc-test dir="bugs161/pr198196" title="super itds - 2"> + <compile files="Marker.java Foo.java MarkerAspect2.java"/> + <run class="Foo"> + <stdout> + <line text="a"/> + <line text="a"/> + <line text="a"/> + <line text="a"/> + <line text="a"/> + <line text="a"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs161/pr198196" title="super itds - 3"> + <compile files="Marker.java Foo.java MarkerAspect1.java"/> + <run class="Foo"/> + </ajc-test> + + <ajc-test dir="bugs161/pr198196" title="super itds - 4"> + <compile files="Marker.java Foo.java MarkerAspect3.java"/> + <run class="Foo"/> + </ajc-test> + + <ajc-test dir="bugs161/pr134425" title="super itds"> + <compile files="Derived.java Base.java"/> + <run class="pkg.Derived"/> + </ajc-test> + + <ajc-test dir="bugs161/pr237381" title="ataspectj deow - 1"> + <compile files="Deow1.java" options="-1.5"> + <message kind="warning" line="7" text="fromX"/> + <message kind="warning" line="15" text="fromY"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs161/pr237381" title="ataspectj deow - 2"> + <compile files="Deow2.java" options="-1.5"> + <message kind="error" line="7" text="fromX"/> + <message kind="error" line="15" text="fromY"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs161/pr102733" title="running broken code"> + <compile files="Invoker.java C.java" options="-proceedOnError"> + <message kind="error" line="2" text="Syntax error"/> + </compile> + <run class="Invoker"/> + </ajc-test> + + <ajc-test dir="bugs161/pr102733" title="running broken code - 2"> + <compile files="Invoker2.java C2.java" options="-proceedOnError"> + <message kind="error" line="5"/> + </compile> + <run class="Invoker2"/> + </ajc-test> + + <ajc-test dir="bugs161/pr168982" title="error on non-abstract generic ataspectj aspect"> + <compile files="TracingAspect2.java" options="-1.5"> + <message kind="error" line="9"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs161/pr234933" title="ignoring type level suppress"> + <compile files="Foobar.java" options="-1.5 -Xlint:error"/> + </ajc-test> + + <ajc-test dir="bugs161/pr223226" title="duplicate method signature - 2"> + <compile files="AspectX.java BInterface.java FooInterface.java AspectXMarker.java Foo.java Test.java" options="-1.5"/> + <run class="Test"/> + </ajc-test> + + <ajc-test dir="bugs161/pr223226" title="duplicate method signature"> + <compile files="AspectX.java BInterface.java FooInterface.java AspectXMarker.java Foo.java Test.java" options=""> + <message kind="error" line="1"/> + <message kind="error" line="2"/> + <message kind="error" line="3"/> + <message kind="error" line="5"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs161/pr197719" title="protected methods and around advice - again - 2"> + <compile files="test/aspects/C1.java test/aspects/C3.java test/aspects/MyAnn.java test/aspects/MyAnnAspect.java test/aspects2/C2.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-call(void test.aspects.C1.aMethod())' in Type 'test.aspects.C1' (C1.java:12) "/> + + <!-- first of these through accessor - so line number wrong and target wrong --> + <message kind="weave" text="Join point 'method-call(void test.aspects2.C2.aMethod())' in Type 'test.aspects2.C2' (C2.java:1) "/><!-- was line 18 --> + <message kind="weave" text="Join point 'method-call(void test.aspects2.C2.aMethod())' in Type 'test.aspects2.C2' (C2.java:8) "/> + <message kind="weave" text="Join point 'method-call(void test.aspects2.C2.aMethod())' in Type 'test.aspects2.C2' (C2.java:29) "/> + + <message kind="weave" text="Join point 'method-call(void test.aspects.C1.aMethod())' in Type 'test.aspects.C3' (C3.java:10) "/> + <message kind="weave" text="Join point 'method-call(void test.aspects2.C2.aMethod())' in Type 'test.aspects.C3' (C3.java:13) "/> + <message kind="weave" text="Join point 'method-call(void test.aspects.C1.aMethod())' in Type 'test.aspects.C3$InnerClass' (C3.java:24) "/> + <message kind="weave" text="Join point 'method-call(void test.aspects2.C2.aMethod())' in Type 'test.aspects.C3$InnerClass' (C3.java:27) "/> + <message kind="weave" text="Join point 'method-call(void test.aspects.C1.aMethod())' in Type 'test.aspects.C3' (C3.java:34) "/> + + </compile> + + <run class="test.aspects.C3"> + </run> + </ajc-test> + + <ajc-test dir="bugs161/pr197719" title="protected methods and around advice - again"> + <compile files="A.java B.java X.java" options="-1.5"/> + <run class="b.B"> + <stdout> + <line text="calling m()"/> + <line text="advice running"/> + <line text="m() running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs161/pr230075" title="protected methods and around advice"> + <compile files="A.java B.java C.java X.java" options="-1.5"/> + <run class="a.C"/> + </ajc-test> + + <ajc-test dir="bugs161/pr174385" title="static strings in annotation pointcuts"> + <compile files="StaticFinalStringInPointcutAspect.java" options="-1.5"/> + <run class="bug.StaticFinalStringInPointcutAspect"/> + </ajc-test> + + <ajc-test dir="bugs161/pr199130" title="complex bounds on generic aspect - 1"> + <compile files="Simple.java" options="-1.5"/> + <run class="Simple"> + </run> + </ajc-test> + + <ajc-test dir="bugs161/pr199130" title="complex bounds on generic aspect - 2"> + <compile files="Complex.java" options="-1.5"/> + <run class="Complex"> + </run> + </ajc-test> + + <ajc-test dir="bugs161/pr199130" title="complex bounds on generic aspect - 3"> + <compile files="Complex2.java" options="-1.5"/> + <run class="Complex2"> + </run> + </ajc-test> + + <ajc-test dir="bugs161/pr226201" title="generic aspect around advice"> + <compile files="IntAspTest.java" options="-1.5"/> + <run class="IntAspTest"> + </run> + </ajc-test> + + <ajc-test dir="bugs161/pr235829" title="crazy generics and inner types"> + <compile files="Main.java a/Adapter.java a/b/Adapter.java" options="-1.5"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="bugs161/pr235597" title="annotation exposure and generics"> + <compile files="AnnotationTest1.java SomeAnnotation.java SomeAspect.java" options="-1.5"/> + <run class="AnnotationTest1"> + <stdout> + <line text="@someAspect annotation parameter (call)"/> + <line text="@someAspect annotation no parameter"/> + <line text="@someAspect method name"/> + <line text="@someAspect annotation parameter (execution)"/> + <line text="test 1"/> + <line text="@someAspect annotation parameter (call)"/> + <line text="@someAspect annotation no parameter"/> + <line text="@someAspect method name"/> + <line text="@someAspect annotation parameter (execution)"/> + <line text="test 2"/> + <line text="@someAspect annotation parameter (call)"/> + <line text="@someAspect annotation no parameter"/> + <line text="@someAspect method name"/> + <line text="@someAspect annotation parameter (execution)"/> + <line text="test 3"/> + </stdout> + </run> + </ajc-test> + + + <ajc-test dir="bugs161/pr235204" title="incorrect call relationship"> + <compile files="RecursiveCatcher.java" options="-1.5 -emacssym"/> + </ajc-test> + + <ajc-test dir="bugs161/pr233838" title="itd precedence - 1"> + <compile files="Z.java" options="-1.5"/> + <run class="Z"> + <stdout> + <line text="X.test()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs161/pr233838" title="itd precedence - 2"> + <compile files="Z2.java" options="-1.5"/> + <run class="Z2"> + <stdout> + <line text="Y.test()"/> + </stdout> + </run> + </ajc-test> + + + <ajc-test dir="bugs161/pr227401" title="getfield problem with generics"> + <compile files="Instrumentation.java Fails.java" options="-1.5"/> + <run class="Fails"> + <stdout> + <line text="getField(* protS) getField()='protected java.lang.String Fails$A.protS' getDeclaringType()='class Fails$A'"/> + <line text="getField(* prot) getField()='protected int Fails$A.prot' getDeclaringType()='class Fails$A'"/> + <line text="22"/> + <line text="getField(* defS) getField()='java.lang.String Fails$A.defS' getDeclaringType()='class Fails$A'"/> + <line text="getField(* def) getField()='int Fails$A.def' getDeclaringType()='class Fails$A'"/> + <line text="11"/> + <line text="getField(* defS) getField()='java.lang.String Fails$A.defS' getDeclaringType()='class Fails$A'"/> + <line text="getField(* def) getField()='int Fails$A.def' getDeclaringType()='class Fails$A'"/> + <line text="22"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs161/pr231478" title="generic abstract aspects"> + <compile files="Base.java Sub.java AbstractComponent.java AbstractWindow.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs161/pr227993" title="field jp anno value"> + <compile files="FieldJP.java" options="-1.5"/> + <run class="FieldJP"> + <stderr> + <line text="get of YES field"/> + <line text="fone=0"/> + <line text="get of NO field"/> + <line text="ftwo=0"/> + <line text="fthr=0"/> + <line text="set of YES field"/> + <line text="set of NO field"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs161/pr231187x" title="generics bounds decp"> + <compile files="Cement.java ConcreteClass.java SuperClass.java SuperClassAspect.aj WetCement.java Main.java" options="-1.5"/> + <run class="concrete.Main"> + <stdout> + <line text="ran!"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs161/pr231187x" title="generics bounds decp - 2"> + <compile files="Cement.java ConcreteClass.java SuperClass.java WetCement.java" options="-1.5"> + <message kind="error" text="The type WetCement is not a valid substitute for the bounded parameter"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs161/pr230134" title="ltw inherited cflow"> + <compile files="HW.java"/> + <compile files="SimpleTracing.java Tracing.java HelloWorldTracing.java" outjar="foo.jar" options="-1.4"/> + <run class="hello.HW" classpath="$sandbox/foo.jar" ltw="aop.xml"> + <stdout> + <line text="Hello World"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs161/pr229910" title="around advice on field set"> + <compile files="Test.java" options="-1.5"/> + <run class="Test"/> + </ajc-test> + + <ajc-test dir="bugs161/pr226567" title="pipeline compilation and generic return type"> + <compile files="BarAspect.aj Foo.java Bar.java" options="-1.5"/> + <compile files="BarAspect.aj Bar.java Foo.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs161/pr235505" title="privileged generic aspect"> + <compile files="A.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs161/pr235505" title="privileged generic aspect - 2"> + <compile files="B.java" options="-1.5"/> + <run class="B"> + <stdout> + <line text="Hello World"/> + <line text="Hello World"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs161/pr64222" title="parsing around advice no return"> + <compile files="C.java" options="-1.5"> + <message kind="error" line="6" text="to complete around advice declaration"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs161/pr159268" title="before array name"> + <compile files="C.java" options="-1.5"/> + </ajc-test> + + + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc161/annotationFieldBinding.xml b/tests/src/test/java/org/aspectj/systemtest/ajc161/annotationFieldBinding.xml new file mode 100644 index 000000000..94b99951a --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc161/annotationFieldBinding.xml @@ -0,0 +1,127 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.6.1 Optimized Annotation Field Binding Tests --> +<suite> + + <ajc-test dir="features161/optimizedAnnotationBinding" title="case one - syntax"> + <compile options="-1.5" files="CaseOne.java"/> + <run class="CaseOne"> + <stdout> + <line text="ONE"/> + <line text="TWO"/> + <line text="THREE"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features161/optimizedAnnotationBinding" title="case two - no such field"> + <compile options="-1.5" files="CaseTwo.java"> + <message kind="error" line="30" text="No field of type 'Level' exists on annotation type 'Anno'"/> + </compile> + </ajc-test> + + <ajc-test dir="features161/optimizedAnnotationBinding" title="case three - ambiguous"> + <compile options="-1.5" files="CaseThree.java"> + <message kind="error" line="31" text="The field type 'Level' is ambiguous for annotation type 'Anno'"/> + </compile> + </ajc-test> + + <ajc-test dir="features161/optimizedAnnotationBinding" title="case four - default value"> + <compile options="-1.5" files="CaseFour.java"/> + <run class="CaseFour"> + <stdout> + <line text="ONE"/> + <line text="TWO"/> + <line text="ONE"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features161/optimizedAnnotationBinding" title="case five - not an enum - compiler limitation"> + <compile options="-1.5" files="CaseFive.java"> + <message kind="error" line="20" text="The field within the annotation must be an enum, string or int. 'float' is not"/> + </compile> + </ajc-test> + + <ajc-test dir="features161/optimizedAnnotationBinding" title="case six - not an execution join point - compiler limitation"> + <compile options="-1.5" files="CaseSix.java"> + <message kind="error" line="20" text="Annotation field binding is only supported at method-execution join points"/> + </compile> + </ajc-test> + + <ajc-test dir="features161/optimizedAnnotationBinding" title="case seven - annos in packages one"> + <compile options="-1.5" files="CaseSeven.java"/> + <run class="p.q.r.CaseSeven"> + <stdout> + <line text="ONE"/> + <line text="TWO"/> + <line text="THREE"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features161/optimizedAnnotationBinding" title="case eight - annos in packages two"> + <compile options="-1.5" files="CaseEight.java"/> + <run class="p.q.r.CaseEight"> + <stdout> + <line text="ONE"/> + <line text="TWO"/> + <line text="THREE"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features161/optimizedAnnotationBinding" title="case nine - everything in different packages"> + <compile options="-1.5" files="CaseNine.java Level.java Anno.java"/> + <run class="p.q.r.CaseNine"> + <stdout> + <line text="ONE"/> + <line text="TWO"/> + <line text="THREE"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features161/optimizedAnnotationBinding" title="case ten - binding multiple things"> + <compile options="-1.5" files="CaseTen.java"/> + <run class="CaseTen"> + <stdout> + <line text="ONE:3"/> + <line text="TWO:4"/> + <line text="THREE:5"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features161/optimizedAnnotationBinding" title="case eleven - binding multiple annotation fields"> + <compile options="-1.5" files="CaseEleven.java"/> + <run class="CaseEleven"> + <stdout> + <line text="ONE:GREEN"/> + <line text="TWO:GREEN"/> + <line text="THREE:BLUE"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features161/optimizedAnnotationBinding" title="case twelve - binding anno and anno value"> + <compile options="-1.5" files="CaseTwelve.java"/> + <run class="CaseTwelve"> + <stdout> + <line text="ONE:GREEN"/> + <line text="TWO:GREEN"/> + <line text="THREE:BLUE"/> + </stdout> + </run> + </ajc-test> + + + <ajc-test dir="features161/optimizedAnnotationBinding" title="case thirteen - bug npe"> + <compile options="-1.5" files="CaseThirteen.java"> + <message kind="error" line="31" text="No field of type 'java.lang.String'"/> + <message kind="error" line="31" text="When using @annotation"/> + <message kind="error" line="32" text="cannot be resolved"/> + </compile> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1610/Ajc1610Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1610/Ajc1610Tests.java new file mode 100644 index 000000000..80d85d9e8 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1610/Ajc1610Tests.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc1610; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class Ajc1610Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + + public void testNPE_pr363962() { + runTest("pr363962"); + } + + public void testOffset0_bug324932() { + runTest("pr324932"); + } + + public void testOffset0_bug324932_2() { + runTest("pr324932 - 2"); + } + + public void testAbstractAspectDeclareParents_322446() { + runTest("declare parents abstract aspect"); + } + + public void testAbstractAspectAndDeclares_322272_2() { + runTest("abstract aspects and declares - 2"); + } + + public void testAbstractAspectAndDeclares_322272() { + runTest("abstract aspects and declares"); + } + + // Interesting new behaviour on AspectJ 1.6.9 - probably due to initial inner type changes. + // Looks a real error (creating two annotations the same on a type is a bad thing) + // public void testDuplicateAnnotations() { + // runTest("duplicate annotation"); + // } + + public void testLoadingOldCode_319431() { + runTest("loading old code"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc1610Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc1610.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1610/AllTestsAspectJ1610.java b/tests/src/test/java/org/aspectj/systemtest/ajc1610/AllTestsAspectJ1610.java new file mode 100644 index 000000000..2dd2ebf1e --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1610/AllTestsAspectJ1610.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc1610; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ1610 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.6.10 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc1610Tests.suite()); + suite.addTest(NewFeatures.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1610/NewFeatures.java b/tests/src/test/java/org/aspectj/systemtest/ajc1610/NewFeatures.java new file mode 100644 index 000000000..588d71186 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1610/NewFeatures.java @@ -0,0 +1,152 @@ +/******************************************************************************* + * Copyright (c) 2010 Lucierna + * 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: + * Abraham Nevado - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc1610; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class NewFeatures extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testMakeSJPOptimizationLDCNo() { + this.runTest("makeSJP optimization - LDC - No"); + try { + JavaClass myClass = getMyClass("B"); + Method preClinitMethod = getPreClinitMethod(myClass); + NewFeatures.assertTrue("For 1.4 it must use classForName", preClinitMethod.getCode().toString().contains("forName")); + } catch (Exception e) { + NewFeatures.fail(e.toString()); + } + } + + @SuppressWarnings("unused") + public void testMakeSJPOptimizationCollapsedSJPYes14() { + this.runTest("makeSJP optimization - Collapsed SJP - Yes 1.4"); + try { + JavaClass myClass = getMyClass("B"); + } catch (Exception e) { + NewFeatures.fail(e.toString()); + } + } + + public void testMakeSJPOptimizationLDCYes() { + this.runTest("makeSJP optimization - LDC - Yes"); + try { + JavaClass myClass = getMyClass("B"); + Method preClinitMethod = getPreClinitMethod(myClass); + NewFeatures.assertTrue("For 1.5 it must not use classForName", !preClinitMethod.getCode().toString() + .contains("forName")); + } catch (Exception e) { + NewFeatures.fail(e.toString()); + } + } + + public void testMakeSJPOptimizationCollapsedSJPYes() { + this.runTest("makeSJP optimization - Collapsed SJP - Yes"); + try { + JavaClass myClass = getMyClass("B"); + Method preClinitMethod = getPreClinitMethod(myClass); + NewFeatures.assertTrue("MakedMethodSig MUST not be present", + !preClinitMethod.getCode().toString().contains("makeMethodSig")); + } catch (Exception e) { + NewFeatures.fail(e.toString()); + } + } + + public void testMakeSJPOptimizationCollapsedSJPNo() { + this.runTest("makeSJP optimization - Collapsed SJP - No"); + try { + JavaClass myClass = getMyClass("B"); + Method preClinitMethod = getPreClinitMethod(myClass); + NewFeatures.assertTrue("MakedMethodSig required", preClinitMethod.getCode().toString().contains("makeMethodSig")); + } catch (Exception e) { + NewFeatures.fail(e.toString()); + } + } + + public void testMakeSJPOptimizationNoExceptionNo() { + this.runTest("makeSJP optimization - No Exception - No"); + try { + JavaClass myClass = getMyClass("B"); + Method preClinitMethod = getPreClinitMethod(myClass); + NewFeatures + .assertTrue( + "MakedMethodSig required", + preClinitMethod + .getCode() + .toString() + .contains( + "invokevirtual org.aspectj.runtime.reflect.Factory.makeMethodSig (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/aspectj/lang/reflect/MethodSignature;")); + } catch (Exception e) { + NewFeatures.fail(e.toString()); + } + } + + public void testMakeSJPOptimizationNoExceptionYes() { + this.runTest("makeSJP optimization - No Exception - Yes"); + try { + JavaClass myClass = getMyClass("B"); + Method preClinitMethod = getPreClinitMethod(myClass); + NewFeatures + .assertTrue( + "MakedMethodSig required", + preClinitMethod + .getCode() + .toString() + .contains( + "org.aspectj.runtime.reflect.Factory.makeSJP (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)Lorg/aspectj/lang/JoinPoint$StaticPart;")); + } catch (Exception e) { + NewFeatures.fail(e.toString()); + } + } + + public void testMakeSJPOptimizationRemoveExtraColon() { + this.runTest("makeSJP optimization - Remove Colon"); + try { + JavaClass myClass = getMyClass("B"); + Method preClinitMethod = getPreClinitMethod(myClass); + System.out.println(preClinitMethod.getCode().toString()); + NewFeatures.assertTrue("MakedMethodSig required", + preClinitMethod.getCode().toString().contains("50: ldc \"java.lang.String\" (108)")); + } catch (Exception e) { + NewFeatures.fail(e.toString()); + } + } + + // /////////////////////////////////////// + + private Method getPreClinitMethod(JavaClass myClass) { + Method lm[] = myClass.getMethods(); + for (int i = 0; i < lm.length; i++) { + if (lm[i].getName().equals("ajc$preClinit")) { + return lm[i]; + } + } + return null; + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(NewFeatures.class); + } + + private JavaClass getMyClass(String className) throws ClassNotFoundException { + return getClassFrom(ajc.getSandboxDirectory(), className); + } + + protected File getSpecFile() { + return getClassResource("newfeatures-tests.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1610/ajc1610.xml b/tests/src/test/java/org/aspectj/systemtest/ajc1610/ajc1610.xml new file mode 100644 index 000000000..7dce456b7 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1610/ajc1610.xml @@ -0,0 +1,76 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + + <ajc-test dir="bugs1610/pr363962" title="pr363962"> + <compile files="Code.java" options="-1.5"/> + <run class="Code"> + <stdout> + <line text="OK"/> + </stdout> + </run> + </ajc-test> + + + <ajc-test dir="bugs1610/pr324932" title="pr324932"> + <compile files="A.java" options="-1.5"/> + <compile files="X.aj" options="-1.5 -Xlint:ignore" /> + <run class="A" ltw="aop.xml"> + <stdout> + <line text="It WORKS"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1610/pr324932_2" title="pr324932 - 2"> + <compile files="A.java" options="-1.5"/> + <run class="A" ltw="aop.xml"> + <stdout> + <line text="It WORKS"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1610/pr322446" title="declare parents abstract aspect"> + <compile files="Super.java I.java" outjar="aspects.jar" options="-1.5"/> + <compile files="Code.java" classpath="aspects.jar" options="-1.5 -emacssym"/> + <run class="Code"> + <stdout> + <line text="true"/> + </stdout></run> + </ajc-test> + + <ajc-test dir="bugs1610/prx" title="duplicate annotation"> + <compile files="A.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs1610/pr319431" title="loading old code"> + <compile files="Azpect2.java" inpath="builtWith168.jar" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs1610/pr322272" title="abstract aspects and declares"> + <compile files="Base.java" outjar="superaspect.jar" options="-1.5"/> + <compile files="F1.java" classpath="superaspect.jar" options="-1.5"> + </compile> + <run class="F1"> + <stdout> + <line text="@Anno()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1610/pr322272" title="abstract aspects and declares - 2"> + <compile files="Base2.java" outjar="superaspect.jar" options="-1.5"/> + <compile files="F2.java" classpath="superaspect.jar" options="-1.5"> + </compile> + <run class="F2"> + <stdout> + <line text="@Anno()"/> + </stdout> + </run> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1610/newfeatures-tests.xml b/tests/src/test/java/org/aspectj/systemtest/ajc1610/newfeatures-tests.xml new file mode 100644 index 000000000..d6a2b7652 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1610/newfeatures-tests.xml @@ -0,0 +1,113 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.6.0 Tests --> +<suite> + +"makeSJP optimization - LDC - YES + + + + <ajc-test dir="features1610/makeSJPOptimization" title="makeSJP optimization - LDC - No"> + <compile files="B.java Azpect.aj" options="-1.4"/> + <run class="B"> + <stdout> + <line text="execution(public static void B.main(java.lang.String[]))"/> + <line text="execution(public java.lang.Object B.method1(java.lang.String))"/> + <line text="execution(public java.lang.Object B.method2(java.lang.String, java.lang.Integer))"/> + <line text="execution(private void B.method3())"/> + <line text="execution(public static void B.method4())"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features1610/makeSJPOptimization" title="makeSJP optimization - LDC - Yes"> + <compile files="B.java Azpect.aj" options="-1.5"/> + <run class="B"> + <stdout> + <line text="execution(public static void B.main(java.lang.String[]))"/> + <line text="execution(public java.lang.Object B.method1(java.lang.String))"/> + <line text="execution(public java.lang.Object B.method2(java.lang.String, java.lang.Integer))"/> + <line text="execution(private void B.method3())"/> + <line text="execution(public static void B.method4())"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features1610/makeSJPOptimization" title="makeSJP optimization - Collapsed SJP - Yes"> + <compile files="B.java Azpect.aj" options="-1.5 -Xset:targetRuntime1_6_10=true"/> + <run class="B"> + <stdout> + <line text="execution(public static void B.main(java.lang.String[]))"/> + <line text="execution(public java.lang.Object B.method1(java.lang.String))"/> + <line text="execution(public java.lang.Object B.method2(java.lang.String, java.lang.Integer))"/> + <line text="execution(private void B.method3())"/> + <line text="execution(public static void B.method4())"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features1610/makeSJPOptimization" title="makeSJP optimization - Collapsed SJP - Yes 1.4"> + <compile files="B.java Azpect.aj" options="-1.4 -Xset:targetRuntime1_6_10=true"/> + <run class="B"> + <stdout> + <line text="execution(public static void B.main(java.lang.String[]))"/> + <line text="execution(public java.lang.Object B.method1(java.lang.String))"/> + <line text="execution(public java.lang.Object B.method2(java.lang.String, java.lang.Integer))"/> + <line text="execution(private void B.method3())"/> + <line text="execution(public static void B.method4())"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features1610/makeSJPOptimization" title="makeSJP optimization - Collapsed SJP - No"> + <compile files="B.java Azpect.aj" options="-1.5 -Xset:targetRuntime1_6_10=false"/> + <run class="B"> + <stdout> + <line text="execution(public static void B.main(java.lang.String[]))"/> + <line text="execution(public java.lang.Object B.method1(java.lang.String))"/> + <line text="execution(public java.lang.Object B.method2(java.lang.String, java.lang.Integer))"/> + <line text="execution(private void B.method3())"/> + <line text="execution(public static void B.method4())"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features1610/makeSJPOptimization" title="makeSJP optimization - No Exception - No"> + <compile files="B.java Azpect.aj" options="-1.5 -Xset:targetRuntime1_6_10=false"/> + <run class="B"> + <stdout> + <line text="execution(public static void B.main(java.lang.String[]))"/> + <line text="execution(public java.lang.Object B.method1(java.lang.String))"/> + <line text="execution(public java.lang.Object B.method2(java.lang.String, java.lang.Integer))"/> + <line text="execution(private void B.method3())"/> + <line text="execution(public static void B.method4())"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features1610/makeSJPOptimization" title="makeSJP optimization - No Exception - Yes"> + <compile files="B.java Azpect.aj" options="-1.5 -Xset:targetRuntime1_6_10=true"/> + <run class="B"> + <stdout> + <line text="execution(public static void B.main(java.lang.String[]))"/> + <line text="execution(public java.lang.Object B.method1(java.lang.String))"/> + <line text="execution(public java.lang.Object B.method2(java.lang.String, java.lang.Integer))"/> + <line text="execution(private void B.method3())"/> + <line text="execution(public static void B.method4())"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features1610/makeSJPOptimization" title="makeSJP optimization - Remove Colon"> + <compile files="B.java Azpect.aj" options="-1.5"/> + <run class="B"> + <stdout> + <line text="execution(public static void B.main(java.lang.String[]))"/> + <line text="execution(public java.lang.Object B.method1(java.lang.String))"/> + <line text="execution(public java.lang.Object B.method2(java.lang.String, java.lang.Integer))"/> + <line text="execution(private void B.method3())"/> + <line text="execution(public static void B.method4())"/> + </stdout> + </run> + </ajc-test> +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1611/Ajc1611Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1611/Ajc1611Tests.java new file mode 100644 index 000000000..de0c20a89 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1611/Ajc1611Tests.java @@ -0,0 +1,129 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc1611; + +import java.io.File; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.systemtest.ajc150.GenericsTests; +import org.aspectj.testing.XMLBasedAjcTestCase; + +import junit.framework.Test; + +/** + * @author Andy Clement + */ +public class Ajc1611Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + // error without the fix: + // Second.java:8:0::0 Bound mismatch: The generic method foo(R, Class<T>) of type II is not applicable for the arguments (E1, + // Class<capture#1-of ? extends E2>). The inferred type capture#1-of ? extends E2 is not a valid substitute for the bounded + // parameter <R extends I1> + public void testBoundsChecking_pr336880() { + runTest("bounds check confusion"); + } + + public void testClashingItds_pr336774() { + runTest("clashing itds"); + } + + public void testBadGenericSigAttribute_pr336745() { + runTest("incorrect signature"); + JavaClass jc = GenericsTests.getClass(ajc, "C"); + assertNotNull(jc); + Method m = getMethod(jc, "m"); + Method mitd = getMethod(jc, "mitd"); + assertEquals("<T::LI;>(TT;)V", m.getGenericSignature()); + assertEquals("<T::LI;>(TT;)V", mitd.getGenericSignature()); + } + + private Method getMethod(JavaClass jc, String name) { + for (Method m : jc.getMethods()) { + if (m.getName().equals(name)) { + return m; + } + } + return null; + } + + public void testESJP_336471() { + runTest("esjp"); + } + + public void testITIT_336136() { + runTest("itit"); + } + + public void testITIT_336136_2() { + runTest("itit - 2"); + } + + public void testDeserialization_335682() { + runTest("pr335682"); + } + + public void testDeserialization_335682_2() { + runTest("pr335682 - 2"); + } + + public void testDeserialization_335682_3() { + runTest("pr335682 - 3"); + } + + public void testDeserialization_335682_5() { + runTest("pr335682 - 5"); + } + + public void testNPEAddSerialVersionUID_bug335783() { + runTest("pr335783"); + } + + public void testGenericsAndItds_333469() { + runTest("pr333469"); + } + + public void testMissingType_332388() { + runTest("pr332388"); + } + + public void testMissingType_332388_2() { + runTest("pr332388 - 2"); + } + + public void testDeclareField_328840() { + runTest("pr328840"); + } + + // public void testAnnoStyleAdviceChain_333274() { + // runTest("anno style advice chain"); + // } + // + // public void testAnnoStyleAdviceChain_333274_2() { + // runTest("code style advice chain"); + // } + // + // public void testAnnoStyleAdviceChain_333274_3() { + // runTest("code style advice chain - no inline"); + // } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc1611Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc1611.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1611/AllTestsAspectJ1611.java b/tests/src/test/java/org/aspectj/systemtest/ajc1611/AllTestsAspectJ1611.java new file mode 100644 index 000000000..d52d22ea7 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1611/AllTestsAspectJ1611.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc1611; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ1611 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.6.11 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc1611Tests.suite()); + suite.addTest(NewFeatures.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1611/NewFeatures.java b/tests/src/test/java/org/aspectj/systemtest/ajc1611/NewFeatures.java new file mode 100644 index 000000000..58a8f0ae2 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1611/NewFeatures.java @@ -0,0 +1,77 @@ +/******************************************************************************* + * Copyright (c) 2010 Lucierna + * 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: + * Abraham Nevado - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc1611; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class NewFeatures extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testAddingRemoving() { + runTest("adding and removing"); + } + + public void testAddingRemoving2() { + runTest("adding and removing - 2"); + } + + public void testAddingRemoving3() { + runTest("adding and removing - 3"); + } + + public void testDeclareMinus() { + runTest("declare minus - 1"); + } + + public void testDeclareMinusItd() { + runTest("declare minus - itd"); + } + + public void testDeclareMinus2annos() { + runTest("declare minus - 2 annos"); + } + + public void testDeclareMinusmultifiles() { + runTest("declare minus - multifiles"); + } + + public void testDeclareMinusmultifiles2() { + runTest("declare minus - multifiles - 2"); + } + + public void testDeclareMinusmultifiles3() { + runTest("declare minus - multifiles - 3"); + } + + public void testDeclareMinusWithValues() { + runTest("declare minus - with values"); + } + + public void testDeclareMinusUnsupported() { + runTest("declare minus - unsupported"); + } + + public void testBinaryWeaving() { + runTest("binary weaving"); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(NewFeatures.class); + } + + protected File getSpecFile() { + return getClassResource("newfeatures-tests.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1611/ajc1611.xml b/tests/src/test/java/org/aspectj/systemtest/ajc1611/ajc1611.xml new file mode 100644 index 000000000..beb922924 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1611/ajc1611.xml @@ -0,0 +1,172 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs1611/pr336880" title="bounds check confusion"> + <compile files="First.java" options="-1.5"/> + <compile files="Second.java" aspectpath="." options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs1611/pr336774" title="clashing itds"> + <compile files="First.java" options="-1.5"/> + <compile files="Test.java" aspectpath="." options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs1611/pr336745" title="incorrect signature"> + <compile files="Foo.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs1611/pr336471" title="esjp"> + <compile files="Tester.aj" options="-1.5 -Xset:targetRuntime1_6_10=true"/> + <run class="Tester"> + <stdout> + <line text="execution(void Tester.main(String[]))"/> + <line text="execution(void Foo.run())"/> + <line text="hello"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1611/pr336136" title="itit"> + <compile files="Country_Roo_Op4j.java"> + <message kind="error" text="The import com.foo cannot be resolved" line="1"/> + <message kind="error" text="The import org.javaruntype cannot be resolved" line="3"/> + <message kind="error" text="The import org.op4j cannot be resolved" line="4"/> + <message kind="error" text="The import org.op4j cannot be resolved" line="5"/> + <message kind="error" text="Country cannot be resolved to a type" line="9"/> + <message kind="error" text="Function cannot be resolved to a type" line="11"/> + <message kind="error" text="can't determine modifiers of missing type Country_Roo_Op4j$Keys"/> + </compile>" + </ajc-test> + + + <ajc-test dir="bugs1611/pr336136" title="itit - 2"> + <compile files="Country_Roo_Op4j2.java" options="-1.5"> + <message kind="error" text="The import com.foo cannot be resolved" line="1"/> + <message kind="error" text="The import org.javaruntype cannot be resolved" line="3"/> + <message kind="error" text="The import org.op4j cannot be resolved" line="4"/> + <message kind="error" text="The import org.op4j cannot be resolved" line="5"/> + <message kind="error" text="Country cannot be resolved to a type" line="9"/> + <message kind="error" text="Country cannot be resolved to a type" line="11"/> + <message kind="error" text="Function cannot be resolved to a type" line="11"/> + <message kind="error" text="Get cannot be resolved" line="11"/> + <message kind="error" text="Types cannot be resolved" line="11"/> + <message kind="error" text="can't determine modifiers of missing type Country_Roo_Op4j2$Keys"/> + </compile>" + </ajc-test> + + + <ajc-test dir="bugs1611/pr335682" title="pr335682"> + <compile inpath="foo.jar" options="-1.4" outjar="bar.jar"/> + </ajc-test> + + <ajc-test dir="bugs1611/pr335682" title="pr335682 - 2"> + <compile inpath="case2.jar" options="-1.4" outjar="bar.jar"/> + </ajc-test> + + <ajc-test dir="bugs1611/pr335682" title="pr335682 - 3"> + <compile inpath="case3.jar" options="-1.4" outjar="bar.jar"/> + </ajc-test> + + <ajc-test dir="bugs1611/pr335682" title="pr335682 - 5"> + <compile inpath="case5.jar" options="-1.4" outjar="bar.jar"/> + </ajc-test> + + <ajc-test dir="bugs1611/pr335783" title="pr335783"> + <compile files="A.java" options="-1.5"/> + <compile files="X.aj" options="-1.5 -Xlint:ignore" /> + <run class="A" ltw="aop.xml"> + <stdout> + <line text="OK"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1611/pr333274" title="anno style advice chain"> + <compile files="ma/Annotation1.java ma/aspect1/Aspect1.java ma/aspect3/Aspect3.java ma/Main.java ma/Precedence.java" options="-1.5"/> + <run class="ma.Main"> + <stdout> + <line text=">In Aspect1"/> + <line text=">In Aspect3"/> + <line text="Method call"/> + <line text="<In Aspect3"/> + <line text="=In Aspect1"/> + <line text=">In Aspect3"/> + <line text="Method call"/> + <line text="<In Aspect3"/> + <line text="<In Aspect1"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1611/pr333274" title="code style advice chain - no inline"> + <compile files="ma2/Annotation1.java ma2/aspect1/Aspect1.java ma2/aspect3/Aspect3.java ma2/Main.java ma2/Precedence.java" options="-1.5 -XnoInline"/> + <run class="ma2.Main"> + <stdout> + <line text=">In Aspect1"/> + <line text=">In Aspect3"/> + <line text="Method call"/> + <line text="<In Aspect3"/> + <line text="=In Aspect1"/> + <line text=">In Aspect3"/> + <line text="Method call"/> + <line text="<In Aspect3"/> + <line text="<In Aspect1"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1611/pr333274" title="code style advice chain"> + <compile files="ma2/Annotation1.java ma2/aspect1/Aspect1.java ma2/aspect3/Aspect3.java ma2/Main.java ma2/Precedence.java" options="-1.5 "/> + <run class="ma2.Main"> + <stdout> + <line text=">In Aspect1"/> + <line text=">In Aspect3"/> + <line text="Method call"/> + <line text="<In Aspect3"/> + <line text="=In Aspect1"/> + <line text=">In Aspect3"/> + <line text="Method call"/> + <line text="<In Aspect3"/> + <line text="<In Aspect1"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1611/pr328840" title="pr328840"> + <compile files="Wibble.aj" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'field-get(XX Song.i)' in Type 'Song' (Wibble.aj:26) advised by before advice from 'Wibble' (Wibble.aj:9)"/> + <message kind="weave" text="'XX i' of type 'Song' (Wibble.aj) is annotated with @Foo field annotation from 'Wibble' (Wibble.aj:7)"/> + </compile> + <run class="Wibble"> + <stdout> + <line text="@Foo()"/> + </stdout></run> + </ajc-test> + + <ajc-test dir="bugs1611/pr332388" title="pr332388"> + <compile files="M.java" outjar="M.jar" options="-1.5"/> + <compile files="A.java B.java" classpath="M.jar" outjar="AB.jar" options="-1.5"/> + <compile files="MyAspect.java" outjar="aspects.jar" options="-1.5"/> + <compile files="" aspectpath="aspects.jar" inpath="AB.jar" options="-1.5"> + <message kind="error" text="Unable to find type for generic bound. Missing type is M [Xlint:cantFindType]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs1611/pr333469" title="pr333469"> + <compile files="MyList.java MyList_Serializable.java" options="-1.5"/> + <run class="MyList"> + <stdout><line text="ser=1"/></stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1611/pr332388_2" title="pr332388 - 2"> + <compile files="M.java" outjar="M.jar" options="-1.5"/> + <compile files="A.java" classpath="M.jar" outjar="A.jar" options="-1.5"/> + <compile files="MyAspect.java" outjar="aspects.jar" options="-1.5"/> + <compile files="" aspectpath="aspects.jar" inpath="A.jar" options="-1.5"> + <message kind="error" text="Unable to find type (for bound): M [Xlint:cantFindType]"/> + </compile> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1611/newfeatures-tests.xml b/tests/src/test/java/org/aspectj/systemtest/ajc1611/newfeatures-tests.xml new file mode 100644 index 000000000..914042633 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1611/newfeatures-tests.xml @@ -0,0 +1,139 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.6.11 Tests --> +<suite> + + <ajc-test dir="features1611/declareMinus" title="adding and removing - 3"> + <compile files="OnOffITD.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="'public int field2' of type 'OnOffITD' (OnOffITD.java) is annotated with @Anno field annotation from 'Foo' (OnOffITD.java:12)"/> + <message kind="weave" text="'public int field2' of type 'OnOffITD' (OnOffITD.java) has had @Anno field annotation removed by 'Foo' (OnOffITD.java:13)"/> + <message kind="weave" text="'public static int field' of type 'OnOffITD' (OnOffITD.java) is annotated with @Anno field annotation from 'Foo' (OnOffITD.java:9)"/> + <message kind="weave" text="'public static int field' of type 'OnOffITD' (OnOffITD.java) has had @Anno field annotation removed by 'Foo' (OnOffITD.java:8)"/> + <message kind="weave" text="Type 'OnOffITD' (OnOffITD.java) has intertyped field from 'B' (OnOffITD.java:'int OnOffITD.field')"/> + <message kind="weave" text="Type 'OnOffITD' (OnOffITD.java) has intertyped field from 'B' (OnOffITD.java:'int OnOffITD.field2')"/> + </compile> + <run class="OnOffITD"> + <stdout> + <line text="field annotated? no"/> + <line text="field2 annotated? no"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features1611/declareMinus" title="adding and removing"> + <compile files="OnOff.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="'public int field2' of type 'OnOff' (OnOff.java) is annotated with @Anno field annotation from 'Foo' (OnOff.java:12)"/> + <message kind="weave" text="'public int field2' of type 'OnOff' (OnOff.java) has had @Anno field annotation removed by 'Foo' (OnOff.java:13)"/> + <message kind="weave" text="'public static int field' of type 'OnOff' (OnOff.java) is annotated with @Anno field annotation from 'Foo' (OnOff.java:9)"/> + <message kind="weave" text="'public static int field' of type 'OnOff' (OnOff.java) has had @Anno field annotation removed by 'Foo' (OnOff.java:8)"/> + </compile> + <run class="OnOff"> + <stdout> + <line text="field annotated? no"/> + <line text="field2 annotated? no"/> + </stdout> + </run> + </ajc-test> + + + <ajc-test dir="features1611/declareMinus" title="adding and removing - 2"> + <compile files="OnOff2.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="'public int field2' of type 'OnOff2' (OnOff2.java) is annotated with @Anno field annotation from 'Foo' (OnOff2.java:8)"/> + <message kind="weave" text="'public int field2' of type 'OnOff2' (OnOff2.java) has had @Anno field annotation removed by 'Foo' (OnOff2.java:7)"/> + <message kind="weave" text="'public static int field' of type 'OnOff2' (OnOff2.java) is annotated with @Anno field annotation from 'Foo' (OnOff2.java:8)"/> + <message kind="weave" text="'public static int field' of type 'OnOff2' (OnOff2.java) has had @Anno field annotation removed by 'Foo' (OnOff2.java:7)"/> + </compile> + <run class="OnOff2"> + <stdout> + <line text="field annotated? no"/> + <line text="field2 annotated? no"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features1611/declareMinus" title="declare minus - 1"> + <compile files="Code.java" options="-1.5"/> + <run class="Code"> <stdout> + <line text="no annotation"/> + </stdout></run> + </ajc-test> + + <ajc-test dir="features1611/declareMinus" title="declare minus - itd"> + <compile files="Code2.java" options="-1.5"/> + <run class="Code2"> + <stdout> + <line text="no annotation"/> + </stdout></run> + </ajc-test> + + <ajc-test dir="features1611/declareMinus" title="declare minus - 2 annos"> + <compile files="Code3.java" options="-1.5"/> + <run class="Code3"> + <stdout> + <line text="no Anno"/> + <line text="has AnnoB"/> + </stdout></run> + </ajc-test> + + <ajc-test dir="features1611/declareMinus" title="declare minus - multifiles"> + <compile files="aspectjtest/AnnotationA.java aspectjtest/AnnotationB.java aspectjtest/ExampleItd.aj aspectjtest/HelloTest.java aspectjtest/MyEntity.java" options="-1.5"/> + <run class="aspectjtest.HelloTest"> + <stdout> + <line text="1"/> + <line text="interface aspectjtest.AnnotationB"/> + </stdout></run> + </ajc-test> + + <!-- different ordering --> + <ajc-test dir="features1611/declareMinus" title="declare minus - multifiles - 2"> + <compile files="aspectjtest/MyEntity.java aspectjtest/AnnotationA.java aspectjtest/AnnotationB.java aspectjtest/ExampleItd.aj aspectjtest/HelloTest.java" options="-1.5"/> + <run class="aspectjtest.HelloTest"> + <stdout> + <line text="1"/> + <line text="interface aspectjtest.AnnotationB"/> + </stdout></run> + </ajc-test> + + <!-- different ordering --> + <ajc-test dir="features1611/declareMinus" title="declare minus - multifiles - 3"> + <compile files="aspectjtest/ExampleItd.aj aspectjtest/AnnotationA.java aspectjtest/AnnotationB.java aspectjtest/MyEntity.java aspectjtest/HelloTest.java" options="-1.5"/> + <run class="aspectjtest.HelloTest"> + <stdout> + <line text="1"/> + <line text="interface aspectjtest.AnnotationB"/> + </stdout></run> + </ajc-test> + + <ajc-test dir="features1611/declareMinus" title="declare minus - with values"> + <compile files="WithValues.java" options="-1.5"/> + <run class="WithValues"> + <stdout> + <line text="i does not have Anno"/> + <line text="j has Banno:@Banno(hoo=abc)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="j has Banno:@Banno(hoo="abc")" vm="9+"/> + <line text="j does not have Anno"/> + </stdout></run> + </ajc-test> + + <ajc-test dir="features1611/declareMinus" title="declare minus - unsupported"> + <compile files="Unsupported.java" options="-1.5"> + <message kind="error" line="19" text="Annotation removal only supported for declare @field (compiler limitation)"/> + <message kind="error" line="20" text="Annotation removal only supported for declare @field (compiler limitation)"/> + <message kind="error" line="21" text="Annotation removal does not allow values to be specified for the annotation (compiler limitation)"/> + </compile> + </ajc-test> + + <ajc-test dir="features1611/declareMinus" title="binary weaving"> + <compile files="aspectjtest/AnnotationA.java aspectjtest/AnnotationB.java aspectjtest/MyEntity.java aspectjtest/HelloTest.java" outjar="code.jar" options="-1.5"/> + <compile files="aspectjtest/ExampleItd.aj" inpath="code.jar" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="'private String myField [RuntimeVisibleAnnotations]' of type 'aspectjtest.MyEntity' (MyEntity.java) has had @AnnotationA field annotation removed by"/> + <message kind="weave" text="'private String myField [RuntimeVisibleAnnotations]' of type 'aspectjtest.MyEntity' (MyEntity.java) is annotated with @AnnotationB field"/> + </compile> + <run class="aspectjtest.HelloTest"> + <stdout> + <line text="1"/> + <line text="interface aspectjtest.AnnotationB"/> + </stdout></run> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1612/Ajc1612Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1612/Ajc1612Tests.java new file mode 100644 index 000000000..347b63e17 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1612/Ajc1612Tests.java @@ -0,0 +1,420 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc1612; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.asm.internal.ProgramElement; +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Andy Clement + */ +public class Ajc1612Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + // public void testAnnoCopying_345515() { + // runTest("anno copying"); + // } + + // public void testDoubleITDF() throws Exception { + // runTest("double itdf"); + // } + + // public void testItdSplitCompilation_354683() throws Exception { + // runTest("itd split compilation"); + // } + + public void testClassCast_327141() { + runTest("classcast"); + } + + public void testXmlDefs() { + runTest("xml defined advice"); + } + + public void testXmlDefs2() { + runTest("xml defined advice 2"); + } + + // using a parameter + public void testXmlDefs3() { + runTest("xml defined advice 3"); + } + + // using bad parameters + public void testXmlDefs4() { + runTest("xml defined advice 4"); + } + + // binding + public void testXmlDefs5() { + runTest("xml defined advice 5"); + } + + // before and after advice + public void testXmlDefs6() { + runTest("xml defined advice 6"); + } + + // thisJoinPoint + public void testXmlDefs7() { + runTest("xml defined advice 7"); + } + + // thisJoinPointStaticPart + public void testXmlDefs8() { + runTest("xml defined advice 8"); + } + + // void around advice + public void testXmlDefs9() { + runTest("xml defined advice 9"); + } + + // non-void around advice + public void testXmlDefs10() { + runTest("xml defined advice 10"); + } + + // non-void around advice with proceed + public void testXmlDefs11() { + runTest("xml defined advice 11"); + } + + // non primitive return (that is actually used) and proceed + public void testXmlDefs12() { + runTest("xml defined advice 12"); + } + + // delegate type in package + public void testXmlDefs13() { + runTest("xml defined advice 13"); + } + + public void testCorrespondingType_357582() { + for (int i = 0; i < 100000; i++) { + assertEquals("AAA", convert("AAA")); + assertEquals("AAA", convert("a.b.c.AAA")); + assertEquals("A", convert("aa.ba.ca.A")); + assertEquals("AAA<>", convert("a.b.c.AAA<>")); + assertEquals("AAA<A>", convert("a.b.c.AAA<A>")); + assertEquals("AAA<A>", convert("a.b.c.AAA<aa.A>")); + assertEquals("AAA<A,B>", convert("a.b.c.AAA<aa.A,bb.B>")); + assertEquals("AAA<A<B>>", convert("a.b.c.AAA<aa.A<bb.B>>")); + assertEquals("AAA<A<B>,AA<GG<KK>>>", convert("a.b.c.AAA<aa.A<bb.B>,a.b.c.AA<GG<KK>>>")); + } + long time = System.currentTimeMillis(); + for (int i = 0; i < 1000000; i++) { + assertEquals("AAA", convert("AAA")); + assertEquals("AAA", convert("a.b.c.AAA")); + assertEquals("A", convert("aa.ba.ca.A")); + assertEquals("AAA<>", convert("a.b.c.AAA<>")); + assertEquals("AAA<A>", convert("a.b.c.AAA<A>")); + assertEquals("AAA<A>", convert("a.b.c.AAA<aa.A>")); + assertEquals("AAA<A,B>", convert("a.b.c.AAA<aa.A,bb.B>")); + assertEquals("AAA<A<B>>", convert("a.b.c.AAA<aa.A<bb.B>>")); + assertEquals("AAA<A<B>,AA<GG<KK>>>", convert("a.b.c.AAA<aa.A<bb.B>,a.b.c.AA<GG<KK>>>")); + } + System.out.println(System.currentTimeMillis() - time); + } + + private String convert(String totrim) { + return ProgramElement.trim(totrim); + } + + public void testPervasivePerthis_354470() throws Exception { + runTest("perthis too pervasive"); + } + + public void testPervasivePerthis_354470_2() throws Exception { + runTest("perthis too pervasive 2"); + } + + public void testPervasivePerthis_354470_3() throws Exception { + runTest("perthis too pervasive 3"); + } + + public void testNotEqualWithAnnotationValues_357013() throws Exception { + runTest("annotation values not equal"); + } + + public void testNotEqualWithAnnotationValues_357013_2() throws Exception { + runTest("annotation values not equal 2"); + } + + public void testClassRef_357012() throws Exception { + runTest("class reference in annotation value"); + } + + public void testClassRefInvalidName_357012_2() throws Exception { + runTest("class reference in annotation value - invalid typename"); + } + + public void testClassRef_357012_3() throws Exception { + runTest("class reference in annotation value 3"); + } + + public void testAnnotationFieldBindingOptimization_356612() throws Exception { + runTest("annotation field binding optimization"); + } + + public void testAnnotationFieldBindingOptimization_356612_2() throws Exception { + runTest("annotation field binding optimization - 2"); + } + + 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 void testVerifyPerthis() throws Exception { + // runTest("verify perthis"); + // } + + public void testRangeForLocalVariables_353936() throws ClassNotFoundException { + runTest("local variable tables"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X"); + Method[] meths = jc.getMethods(); + boolean checked = false; + for (int i = 0; i < meths.length; i++) { + Method method = meths[i]; + if (method.getName().equals("ajc$before$X$2$3444dde4")) { + System.out.println(method.getName()); + System.out.println(stringify(method.getLocalVariableTable())); + System.out.println(method.getCode().getLength()); + checked = true; + assertEquals("LX; this(0) start=0 len=48", stringify(method.getLocalVariableTable(), 0)); + assertEquals("Lorg/aspectj/lang/JoinPoint; thisJoinPoint(1) start=0 len=48", + stringify(method.getLocalVariableTable(), 1)); + assertEquals("I i(2) start=8 len=22", stringify(method.getLocalVariableTable(), 2)); + } + } + assertTrue(checked); + } + + public void testEmptyPattern_pr352363() { + runTest("empty pattern"); + } + + public void testGenericsIssue_pr351592() { + runTest("generics issue"); + } + + public void testGenericsIssue_pr351592_2() { + runTest("generics issue - 2"); + } + + public void testGenericsNpe_pr350800() { + runTest("generics npe"); + } + + public void testGenericsNpe_pr350800_code() { + runTest("generics npe - code"); + } + + public void testGenericsNpe_pr350800_3() { + runTest("generics npe - 3"); + } + + public void testOrdering_pr349961() { + runTest("ordering"); + } + + public void testOrdering_pr349961_2() { + runTest("ordering - 2"); + } + + /* + * public void testVerifyError_pr347395() { runTest("verifyerror - inline"); } + */ + + public void testDuplicateMethods_349398() { + runTest("duplicate methods"); + } + + public void testBindingInts_347684() { + runTest("binding ints"); + } + + public void testBindingInts_347684_2() { + runTest("binding ints - 2"); + } + + public void testBindingInts_347684_3() { + runTest("binding ints - 3"); + } + + public void testBindingInts_347684_4() { + runTest("binding ints - 4"); + } + + public void testBindingInts_347684_5() { + runTest("binding ints - 5"); + } + + public void testBindingInts_347684_6() { + runTest("binding ints - 6"); + } + + public void testIncorrectAnnos_345172() { + runTest("incorrect annos"); + } + + public void testIncorrectAnnos_345172_2() { + runTest("incorrect annos 2"); + } + + public void testIncorrectAnnos_345172_3() { + runTest("incorrect annos 3"); + } + + public void testSyntheticMethods_327867() { + runTest("synthetic methods"); + } + + // public void testSignedJarLtw_328099() { + // runTest("signed jar ltw"); + // } + + public void testVerifyError_315398() { + runTest("verifyerror"); + } + + public void testVerifyError_315398_2() { + runTest("verifyerror - 2"); + } + + public void testRawTypePointcut_327134() { + runTest("rawtype pointcut"); + } + + public void testRawTypeWarning_335810() { + runTest("rawtype warning"); + } + + // public void testDecpGenerics_344005() { + // runTest("decp generics"); + // } + + public void testIllegalAccessError_343051() { + runTest("illegalaccesserror"); + } + + public void testItitNpe_339974() { + runTest("itit npe"); + } + + // public void testNoImportError_342605() { + // runTest("noimporterror"); + // } + + public void testClashingLocalTypes_342323() { + runTest("clashing local types"); + } + + public void testITIT_338175() { + runTest("itit"); + } + + public void testThrowsClause_292239() { + runTest("throws clause"); + } + + public void testThrowsClause_292239_2() { + runTest("throws clause - 2"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc1612Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc1612.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1612/AllTestsAspectJ1612.java b/tests/src/test/java/org/aspectj/systemtest/ajc1612/AllTestsAspectJ1612.java new file mode 100644 index 000000000..702cfdc39 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1612/AllTestsAspectJ1612.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc1612; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ1612 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.6.12 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc1612Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1612/ajc1612.xml b/tests/src/test/java/org/aspectj/systemtest/ajc1612/ajc1612.xml new file mode 100644 index 000000000..38f46c7d6 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1612/ajc1612.xml @@ -0,0 +1,755 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs1612/pr327141" title="classcast"> + <compile files="AspectWithConstant.aj" options="-1.5"/> + <run class="AspectWithConstant"> + <stdout> + <line text="MAX=9"/> + <line text="@AspectWithConstant$Loggable()"/> + </stdout></run> + </ajc-test> + + <ajc-test dir="bugs1612/xmldefs" title="xml defined advice"> + <compile files="Hello.java JavaHelper.java"/> + <run class="Hello" ltw="aop.xml"> + <stdout> + <line text="Hello"/> + <line text="in advice"/> + <line text="World"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1612/xmldefs" title="xml defined advice 2"> + <compile files="Hello.java JavaHelper.java"/> + <run class="Hello" ltw="aop2.xml"> + <stdout> + <line text="Hello"/> + <line text="World"/> + </stdout> + <stderr> + <line text="info AspectJ Weaver"/> + <line text="info register classloader"/> + <line text="info using config"/> + <line text="info define aspect"/> + <line text="error Class to invoke cannot be found: 'com.DoesNotExist'"/> + <line text="info weaver operating"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs1612/xmldefs" title="xml defined advice 3"> + <compile files="Hello.java JavaHelper.java"/> + <run class="Hello" ltw="aop3.xml"> + <stdout> + <line text="Hello"/> + <line text="World"/> + </stdout> + <stderr> + <line text="info AspectJ Weaver"/> + <line text="info register classloader"/> + <line text="info using config"/> + <line text="info define aspect"/> + <line text="error Cannot find type specified as parameter: 'String' from signature '(String)'"/> + <line text="info weaver operating"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs1612/xmldefs" title="xml defined advice 4"> + <compile files="Hello.java JavaHelper.java"/> + <run class="Hello" ltw="aop4.xml"> + <stdout> + <line text="Hello"/> + <line text="World"/> + </stdout> + <stderr> + <line text="info AspectJ Weaver"/> + <line text="info register classloader"/> + <line text="info using config"/> + <line text="info define aspect"/> + <line text="error Cannot find type specified as parameter: 'java.lang.String:List' from signature '(java.lang.String:List)'"/> + <line text="info weaver operating"/> + </stderr> + </run> + </ajc-test> + + + <ajc-test dir="bugs1612/xmldefs" title="xml defined advice 5"> + <compile files="Hello2.java JavaHelper.java"/> + <run class="Hello2" ltw="aop5.xml"> + <stdout> + <line text="hello"/> + <line text="in advice: s=world"/> + <line text="world"/> + </stdout> + </run> + </ajc-test> + + + <ajc-test dir="bugs1612/xmldefs" title="xml defined advice 6"> + <compile files="Hello2.java JavaHelper.java"/> + <run class="Hello2" ltw="aop6.xml"> + <stdout> + <line text="hello"/> + <line text="in advice: s=world"/> + <line text="world"/> + <line text="in advice3: s=world"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1612/xmldefs" title="xml defined advice 7"> + <compile files="Hello2.java JavaHelper.java"/> + <run class="Hello2" ltw="aop7.xml"> + <stdout> + <line text="hello"/> + <line text="in advice4: s=world at execution(int Hello2.say2(String))"/> + <line text="world"/> + <line text="in advice5: s=world at execution(int Hello2.say2(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1612/xmldefs" title="xml defined advice 8"> + <compile files="Hello2.java JavaHelper.java"/> + <run class="Hello2" ltw="aop8.xml"> + <stdout> + <line text="hello"/> + <line text="in advice6: s=world at execution(int Hello2.say2(String))"/> + <line text="world"/> + <line text="in advice7: s=world at execution(int Hello2.say2(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1612/xmldefs" title="xml defined advice 9"> + <compile files="Hello2.java JavaHelper.java"/> + <run class="Hello2" ltw="aop9.xml"> + <stdout> + <line text="in around advice: s=hello at execution(void Hello2.say1(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1612/xmldefs" title="xml defined advice 10"> + <compile files="Hello2.java JavaHelper.java"/> + <run class="Hello2" ltw="aop10.xml"> + <stdout> + <line text="hello"/> + <line text="in around2 advice: s=world at execution(int Hello2.say2(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1612/xmldefs" title="xml defined advice 11"> + <compile files="Hello2.java JavaHelper.java"/> + <run class="Hello2" ltw="aop11.xml"> + <stdout> + <line text="hello"/> + <line text="abcde"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1612/xmldefs" title="xml defined advice 12"> + <compile files="Hello3.java JavaHelper.java"/> + <run class="Hello3" ltw="aop12.xml"> + <stdout> + <line text="hello"/> + <line text="around4 running"/> + <line text="abcde"/> + <line text="from say2=xyz"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1612/xmldefs" title="xml defined advice 13"> + <compile files="Hello2.java JavaHelper2.java"/> + <run class="Hello2" ltw="aop13.xml"> + <stdout> + <line text="in advice"/> + <line text="hello"/> + <line text="in advice"/> + <line text="world"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs1612/pr354470" title="perthis too pervasive"> +<compile files="Code.java" options="-1.5"/> +<run class="Code"> +<stdout> + <line text="AAA"/> + <line text="BBB"/> + <line text="CCC"/> + <line text="interface Code$ajcMightHaveAspect"/> + <line text="private transient Code CCC.ajc$Code$perObjectField"/> +</stdout></run> +</ajc-test> + +<ajc-test dir="bugs1612/pr354470" title="perthis too pervasive 2"> +<compile files="Code2.java" options="-1.5"/> +<run class="Code2"> +<stdout> + <line text="execution(void CCC.m())"/> +</stdout></run> +</ajc-test> + +<ajc-test dir="bugs1612/pr354470" title="perthis too pervasive 3"> +<compile files="Code3.java" options="-1.5"/> +<run class="Code3"> +<stdout> + <line text="execution(void CCC.m())"/> +</stdout></run> +</ajc-test> + +<ajc-test dir="bugs1612/prx" title="class reference in annotation value"> +<compile files="C.java" options="-1.5 -showWeaveInfo"> +<message kind="weave" text="Join point 'field-get(int C.i)' in Type 'C' (C.java:17) advised by before advice from 'X' (C.java:22)"/> +</compile> +<run class="C"> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/prx" title="annotation values not equal"> +<compile files="D.java" options="-1.5 -showWeaveInfo"> +<message kind="weave" text="Join point 'field-get(int D.i)' in Type 'D' (D.java:20) advised by before advice from 'X' (D.java:26)"/> +<message kind="weave" text="Join point 'field-get(int D.j)' in Type 'D' (D.java:21) advised by before advice from 'X' (D.java:26)"/> +</compile> +<run class="D"> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/prx" title="class reference in annotation value 3"> +<compile files="E.java" options="-1.5 -showWeaveInfo"> +<message kind="weave" text="Join point 'field-get(int E.i)' in Type 'E' (E.java:17) advised by before advice from 'X' (E.java:22)"/> +</compile> +<run class="E"> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/prx" title="annotation values not equal 2"> +<compile files="F.java" options="-1.5 -showWeaveInfo"> +<message kind="weave" text="Join point 'field-get(int F.i)' in Type 'F' (F.java:20) advised by before advice from 'X' (F.java:26)"/> +<message kind="weave" text="Join point 'field-get(int F.j)' in Type 'F' (F.java:21) advised by before advice from 'X' (F.java:26)"/> +</compile> +<run class="F"> +</run> +</ajc-test> + + +<ajc-test dir="bugs1612/prx" title="class reference in annotation value - invalid typename"> +<compile files="G.java" options="-1.5"> +<message kind="error" text="Unable to resolve type 'Foo.class' specified for value 'value'"/> +</compile> +</ajc-test> + +<ajc-test dir="bugs1612/pr356612" title="annotation field binding optimization"> +<compile files="AnnoBinding.java" options="-1.5"/> +<run class="AnnoBinding"> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr356612" title="annotation field binding optimization - 2"> +<compile files="AnnoBinding2.java" options="-1.5"/> +<run class="AnnoBinding2"> +<stdout> +<line text="get(int AnnoBinding2.field1) @Marker(message=foo)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> +<line text="get(int AnnoBinding2.field1) @Marker(message="foo")" vm="9+"/> +<line text="get(int AnnoBinding2.field2) @Marker(message=bar)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> +<line text="get(int AnnoBinding2.field2) @Marker(message="bar")" vm="9+"/> +<line text="2 ajc$anno$NNN fields"/> +</stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr354683" title="itd split compilation"> +<compile files="util/CommonData.java util/CommonDataImpl.java util/CommonDataImplementation.aj util/DerivedCommonDataInterface.java util/DerivedCommonDataInterfaceImpl.java util/DerivedCommonDataInterfaceImplementation.aj" options="-1.5" outjar="code.jar"/> +<compile files="main/AbstractBaseClass.java main/DerivedClass.java main/Whatever.java " options="-1.5" aspectpath="code.jar"/> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 1"> +<compile files="One.java" options="-1.5"/> +<run class="One"> + <stdout> + <line text="In instance check method doit()"/> + <line text="In advice()"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 2"> +<compile files="Two.java" options="-1.5"/> +<run class="Two"> + <stdout> + <line text="In instance check method, count=1 so doit returns false"/> + <line text="Method m() running"/> + <line text="In instance check method, count=2 so doit returns true"/> + <line text="In advice()"/> + <line text="Method m() running"/> + <line text="In instance check method, count=3 so doit returns false"/> + <line text="Method m() running"/> + <line text="In instance check method, count=4 so doit returns true"/> + <line text="In advice()"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 3"> +<compile files="Three.java" options="-1.5"/> +<run class="Three"> + <stdout> + <line text="Method m() running"/> + <line text="In instance check method, count=1 so doit returns false"/> + <line text="Method m() running"/> + <line text="In instance check method, count=2 so doit returns true"/> + <line text="In advice()"/> + <line text="Method m() running"/> + <line text="In instance check method, count=3 so doit returns false"/> + <line text="Method m() running"/> + <line text="In instance check method, count=4 so doit returns true"/> + <line text="In advice()"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 4"> +<compile files="Four.java" options="-1.5"/> +<run class="Four"> + <stdout> + <line text="In instance check method doit()"/> + <line text="In advice() execution(void Four.m())"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 5"> +<compile files="Five.java" options="-1.5"/> +<run class="Five"> + <stdout> + <line text="In instance check method doit()"/> + <line text="In advice() arg0=abc"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 6"> +<compile files="Six.java" options="-1.5"/> +<run class="Six"> + <stdout> + <line text="In instance check method doit()"/> + <line text="In advice() execution(void Six.main(String[]))"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 7"> +<compile files="Seven.java" options="-1.5"/> +<run class="Seven"> + <stdout> + <line text="In instance check method doit()"/> + <line text="In advice() call(void Seven.m()) execution(void Seven.main(String[]))"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 8"> +<compile files="Eight.java" options="-1.5"/> +<run class="Eight"> + <stdout> + <line text="in doit(): class=X"/> + <line text="In advice()"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 9"> +<compile files="Nine.java" options="-1.5"/> +<run class="Nine"> + <stdout> + <line text="in doit(): class=X"/> + <line text="In advice()"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 10"> +<compile files="Ten.java" options="-1.5"/> +<run class="com.foo.bar.Ten"> + <stdout> + <line text="In instance check method doit() class=com.foo.bar.X"/> + <line text="In advice()"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 11"> +<compile files="Eleven.java" options="-1.5"> +<message kind="error" text="thisAspectInstance can only be used inside an if() clause for singleton aspects (compiler limitation)"/> +</compile> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 12"> +<compile files="Twelve.java" options="-1.5"/> +<run class="Twelve"> + <stdout> + <line text="In instance check method doit()"/> + <line text="In advice() arg=abc tjpsp=execution(void Twelve.m(String))"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 13"> +<compile files="Thirteen.java" options="-1.5"/> +<run class="Thirteen"> + <stdout> + <line text="instance is X"/> + <line text="In advice() arg=abc tjpsp=execution(void Thirteen.m(String))"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 14"> +<compile files="Fourteen.java" options="-1.5"/> +<run class="Fourteen"> + <stdout> + <line text="instance is X"/> + <line text="In advice()"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 15"> +<compile files="Fifteen.java" options="-1.5"/> +<run class="Fifteen"> + <stdout> + <line text="in doit(): class=X"/> + <line text="In advice()"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/doubleITDF" title="double itdf"> +<compile files="A.java" options="-1.7"/> +<run class="A"> + <stdout> + <line text="AA"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/verify" title="verify perthis"> +<compile files="Runner.aj" inpath="code.jar" classpath="groovy-1.8.0.jar;asm-3.2.jar" options="-1.6 -Xset:generateStackMaps=true"/> +<run class="Runner"> + <stdout> + <line text="AA"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr353936" title="local variable tables"> +<compile files="Code.java" options="-1.5"/> +</ajc-test> + +<ajc-test dir="bugs1612/pr352363" title="empty pattern"> +<compile files="Code.java" options="-1.5"> + <message line="12" kind="warning" text="name is empty1"/> + <message line="13" kind="warning" text="name is empty2"/> +</compile> +</ajc-test> + +<ajc-test dir="bugs1612/pr351592" title="generics issue"> +<compile files="Test.java Fib.java FibCaching.aj Caching.aj" options="-1.5"/> +<run class="caching.Test"/> +</ajc-test> + +<ajc-test dir="bugs1612/pr351592" title="generics issue - 2"> +<compile files="Test.java Fib.java FibCaching.aj Caching.aj" options="-1.5"/> +<run class="caching.Test"/> +</ajc-test> + +<ajc-test dir="bugs1612/pr350800" title="generics npe"> +<compile files="AbstractAdapter.java AbstractProbingAspect.java Adapter.java ProbingAspect.java" options="-1.5"/> +<!-- run class="com.example.MyAspectTest" --> +</ajc-test> + +<ajc-test dir="bugs1612/pr350800_2" title="generics npe - code"> +<compile files="AbstractAdapter.java AbstractProbingAspect.java Adapter.java ProbingAspect.java" options="-1.5"/> +<!-- run class="com.example.MyAspectTest" --> +</ajc-test> + +<ajc-test dir="bugs1612/pr350800_3" title="generics npe - 3"> +<compile files="AbstractAdapter.java AbstractProbingAspect.java Adapter.java ProbingAspect.java" options="-1.5"/> +<run class="test.aop.Adapter"> +<stdout> +<line text=">hello"/> +</stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr349961" title="ordering"> +<compile files="MyParameterAnnotation.java MyAspect.java MyAspectTest.java A.java ABean.java" options="-1.5"/> +<run class="com.example.MyAspectTest"> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr349961" title="ordering - 2"> +<compile files="MyParameterAnnotation.java MyAspect.java MyAspectTest.java ABean.java A.java" options="-1.5"/> +<run class="com.example.MyAspectTest"> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr347395" title="verifyerror - inline"> +<compile files="Target.java Task.java TaskHistoryAspect.aj TaskModification.java" options="-1.5"/> +<run class="xxx.util.Target"> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr349398" title="duplicate methods"> +<compile files="DataGenerator.java CacheAspect.java DataGeneratorCacheAspect.java DataGeneratorTest.java" options="-1.5"/> +<run class="DataGeneratorTest"> +</run> +</ajc-test> + + +<ajc-test dir="bugs1612/pr347684" title="binding ints"> +<compile files="BindingInts.java" options="-1.5"/> +<run class="BindingInts"> + <stdout> + <line text="execution(void BindingInts.a()) 37"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr347684" title="binding ints - 2"> +<compile files="BindingInts2.java" options="-1.5"/> +<run class="BindingInts2"> + <stdout> + <line text="execution(void BindingInts2.a()) 99"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr347684" title="binding ints - 3"> +<compile files="BindingInts3.java" options="-1.5"/> +<run class="BindingInts3"> + <stdout> + <line text="execution(void BindingInts3.a()) abc"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr347684" title="binding ints - 4"> +<compile files="BindingInts4.java" options="-1.5"/> +<run class="BindingInts4"> + <stdout> + <line text="execution(void BindingInts4.a()) 37 48"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr347684" title="binding ints - 5"> +<compile files="BindingInts5.java" options="-1.5"/> +<run class="BindingInts5"> + <stdout> + <line text="execution(void BindingInts5.a()) 37"/> + </stdout> +</run> +</ajc-test> + + +<ajc-test dir="bugs1612/pr347684" title="binding ints - 6"> +<compile files="BindingInts6.java" options="-1.5"/> +<run class="BindingInts6"> + <stdout> + <line text="execution(void BindingInts6.a()) 37 1 99"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr345515" title="anno copying"> +<compile files="Code.java" options="-1.5"/> +<run class="Code"></run> +</ajc-test> + +<ajc-test dir="bugs1612/pr327867" title="synthetic methods"> +<compile files="Foo.java" options="-1.5 -showWeaveInfo"> +<message kind="weave" text="Join point 'method-execution(void Foo.main(java.lang.String[]))' in Type 'Foo' (Foo.java:3) advised by before advice from 'X' (Foo.java:17)"/> +<message kind="weave" text="Join point 'method-execution(void Foo.m())' in Type 'Foo' (Foo.java:7) advised by before advice from 'X' (Foo.java:17)"/> +</compile> +<run class="Foo"/> +</ajc-test> + +<ajc-test dir="bugs1612/pr345172" title="incorrect annos"> +<compile files="InterType.java" options="-1.5 -showWeaveInfo"> +<message kind="weave" text="Join point 'method-execution(void InterType$InterTypeIfc.m1(int))' in Type 'InterType' (InterType.java:21) advised by around advice from 'InterType$AroundMethod' (InterType.java:12)"/> +<!-- +<message kind="weave" text="Join point 'method-execution(void InterType$InterTypeIfc.m1(int, int))' in Type 'InterType' (InterType.java:24) advised by around advice from 'InterType$AroundMethod' (InterType.java:12)"/> +<message kind="weave" text="Join point 'method-execution(void InterType.m1(int))' in Type 'InterType' (InterType.java:28) advised by around advice from 'InterType$AroundMethod' (InterType.java:12)"/> +--> +<message kind="weave" text="Type 'InterType$InterTypeIfc' (InterType.java) has intertyped method from 'InterType' (InterType.java:'void InterType$InterTypeIfc.m1(int)')"/> +<message kind="weave" text="Type 'InterType$InterTypeIfc' (InterType.java) has intertyped method from 'InterType' (InterType.java:'void InterType$InterTypeIfc.m1(int, int)')"/> +</compile> +<run class="InterType"/> +</ajc-test> + +<ajc-test dir="bugs1612/pr345172" title="incorrect annos 2"> +<compile files="InterType2.java" options="-1.5"> +</compile> +<run class="InterType2"> +<stdout> +<line text="execution(void InterType2.InterTypeIfc.m1(int))"/> +</stdout></run> +</ajc-test> + +<ajc-test dir="bugs1612/pr345172" title="incorrect annos 3"> +<compile files="InterType3.java" options="-1.5"> +</compile> +<run class="InterType3"> +<stdout> +<line text="execution(void InterType3.InterTypeIfc.m1(int, String))"/> +</stdout></run> +</ajc-test> + + + + +<ajc-test dir="bugs1612/pr328099" title="signed jar ltw"> +<compile files="X.java" classpath="code.jar"/> +<run class="foo.bar.FooLaunch" ltw="aop.xml" classpath="$sandbox/code.jar"> +<stdout> +<line text="pre...Foo.bar()...post"/> +</stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr315398" title="verifyerror"> +<compile files="Code.java" options="-1.5"> +</compile> +<run class="Code"> +<stdout> +<line text="1"/> +<line text="advice"/> +<line text="2"/> +</stdout></run> +</ajc-test> + +<ajc-test dir="bugs1612/pr315398" title="verifyerror - 2"> +<compile files="Code2.java" options="-1.5"> +</compile> +<run class="Code2"></run> +</ajc-test> + +<ajc-test dir="bugs1612/pr335810" title="rawtype warning"> +<compile files="One.java" options="-1.5 -warn:+raw -warn:+unchecked -warn:+warningToken"> +</compile> +</ajc-test> + +<ajc-test dir="bugs1612/pr327134" title="rawtype pointcut"> +<compile files="Code.java" options="-1.5 -warn:+raw -warn:+warningToken"> +</compile> +</ajc-test> + +<ajc-test dir="bugs1612/pr344005" title="decp generics"> +<compile files="Anno.java Types.java Azpect.java" options="-1.5 -showWeaveInfo"> +<message kind="weave" text="XX"/> +</compile> +</ajc-test> + +<ajc-test dir="bugs1612/pr343051" title="illegalaccesserror"> +<compile files="Code.java Code2.java Azpect.java" options="-1.5"/> +<run class="p.Code"> +<stdout> +<line text="abc"/> +</stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr339974" title="itit npe"> +<compile files="City.java TrafficCalculator.java" options="-1.5"> +<message kind="error" text="The nested type TrafficCalculator cannot hide an enclosing type"/> +</compile> +</ajc-test> + +<ajc-test dir="bugs1612/pr342605" title="noimporterror"> +<compile files="Code.java" options="-1.5 -noImportError"/> +<run class="Code"/> +</ajc-test> + + <ajc-test dir="bugs1612/pr342323" title="clashing local types"> + <compile files="Runner.java Bean.java Azpect.java" options="-1.5"/> + <run class="ppp.Runner"> + <stdout> + <line text="Calling regular method"/> + <line text="class"/> + <line text="Calling itd method"/> + <line text="aspect foo"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs1612/pr338175" title="itit"> +<compile files="pack1/Aspect.java pack2/Java.java pack2/Java2.java" options="-1.5"> + <message kind="error" text="Duplicate nested type ITIT"/> + <message kind="error" text="can't determine modifiers"/> +</compile> +</ajc-test> + + <ajc-test dir="bugs1612/pr292239" title="throws clause"> + <compile files="Code.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void mypackage.Code.n())' in Type 'mypackage.Code' (Code.java:19) advised by afterThrowing advice from 'mypackage.Azpect' (Code.java:9)"/> + </compile> + <run class="mypackage.Code"> + <stdout> + <line text="caught it"/> + <line text="done"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1612/pr292239" title="throws clause - 2"> + <compile files="Code2.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void mypackage.Code2.n2())' in Type 'mypackage.Code2' (Code2.java:17) advised by afterThrowing advice from 'mypackage.Azpect' (Code2.java:7)"/> + </compile> + <run class="mypackage.Code2"> + <stdout> + <line text="caught it: execution(void mypackage.Code2.n2())"/> + <line text="done"/> + </stdout> + </run> + </ajc-test> +<!-- + + + <ajc-test dir="bugs1611/pr336136" title="itit"> + <compile files="Country_Roo_Op4j.java"> + <message kind="error" text="The import com.foo cannot be resolved" line="1"/> + <message kind="error" text="The import org.javaruntype cannot be resolved" line="3"/> + <message kind="error" text="The import org.op4j cannot be resolved" line="4"/> + <message kind="error" text="The import org.op4j cannot be resolved" line="5"/> + <message kind="error" text="Country cannot be resolved to a type" line="9"/> + <message kind="error" text="Function cannot be resolved to a type" line="11"/> + <message kind="error" text="can't determine modifiers of missing type Country_Roo_Op4j$Keys"/> + </compile>" + </ajc-test> + + --> + + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc162/Ajc162Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc162/Ajc162Tests.java new file mode 100644 index 000000000..fb42a6351 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc162/Ajc162Tests.java @@ -0,0 +1,223 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc162; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class Ajc162Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + // AspectJ1.6.2 + + // When faulting in the binary hierarchy: + // <root> [java source file] + // Clazz.java [java source file] C:\temp\ajcSandbox\aspectj16_2\ajcTest3344.tmp\Clazz.java:1::0 + // import declarations [import reference] + // Clazz [class] C:\temp\ajcSandbox\aspectj16_2\ajcTest3344.tmp\Clazz.java:1::13 + // foo() [method] C:\temp\ajcSandbox\aspectj16_2\ajcTest3344.tmp\Clazz.java:2::36 + // Asp.class (binary) [class] C:\temp\ajcSandbox\aspectj16_2\ajcTest3344.tmp\binaryaspect.jar!Asp.class:1::0 + // import declarations [import reference] + // Asp [aspect] C:\temp\ajcSandbox\aspectj16_2\ajcTest3344.tmp\binaryaspect.jar!Asp.class:1::0 + // before(): <anonymous pointcut> [advice] C:\temp\ajcSandbox\aspectj16_2\ajcTest3344.tmp\binaryaspect.jar!Asp.class:2::0 + // Hid:1:(targets=1) [Asp.class (binary)}Asp&before (advises) {Clazz.java[Clazz~foo + // Hid:2:(targets=1) {Clazz.java[Clazz~foo (advised by) [Asp.class (binary)}Asp&before + + // without faulting in the model they stop at the top level (the class level) + + // Hid:1:(targets=1) "{Clazz.java[Clazz~foo" (advised by) "{Asp.class" + // Hid:2:(targets=1) "{Asp.class" (advises) "{Clazz.java[Clazz~foo" + + // what I want for the hid is: + + // <somethingIndicatingBinary>"[Asp.class}Asp&before" + /* + * public void testBinaryAspectModeling() throws Exception { runTest("binary aspects model"); + * AsmManager.dumptree(AsmManager.getDefault().getHierarchy().getRoot(), 0); PrintWriter pw = new PrintWriter(System.out); + * AsmManager.getDefault().dumprels(pw); pw.flush(); } + */ + public void testPerClause() { + runTest("ltw perclause"); + } + + public void testNullDelegateForArray_pr247683() { + runTest("null delegate for array"); + } + + public void testPerClause2() { + runTest("ltw perclause - 2"); + } + + public void testPerClause3() { + runTest("ltw perclause - 3"); + } + + public void testPerClause4_IncorrectPerClause() { + runTest("ltw perclause - 4"); + } + + public void testAnnoValueBinding_pr246264() { + runTest("anno value binding"); + } + + public void testAroundAdviceProceed_pr211607() { + runTest("around advice proceed"); + } + + // public void testAdvisingInterfaces_pr163005() { runTest("advising joinpoints in interfaces"); } + public void testChainedItds_pr176905() { + runTest("chained itds"); + } + + public void testDecAtAnnoDecP_pr198341() { + runTest("dec atanno and decp"); + } + + public void testMissingMarkers_pr197720() { + runTest("missing markers on inherited annotated method"); + } + + public void testLostGenericsSigOnItd_pr211146() { + runTest("lost generic sig on itd"); + } + + public void testLostGenericsSigOnItd_pr211146_2() { + runTest("lost generic sig on itd - 2"); + } + + public void testLostGenericsSigOnItd_pr211146_3() { + runTest("lost generic sig on itd - 3"); + } + + public void testLostGenericsSigOnItd_pr211146_4() { + runTest("lost generic sig on itd - 4"); + } + + public void testLostGenericsSigOnItd_pr211146_5() { + runTest("lost generic sig on itd - 5"); + } + + public void testMissingContext_pr194429() { + runTest("missing context"); + } + + public void testWarningsForLimitations_pr210114() { + runTest("warnings for limitations"); + } + + public void testPTW_pr244830() { + runTest("ptw initFailureCause"); + } + + public void testGenericItdsOverrides_pr222648() { + runTest("generic itds - overrides"); + } + + public void testGenericItdsOverrides_pr222648_2() { + runTest("generic itds - overrides - 2"); + } + + public void testItdCallingGenericMethod_pr145391() { + runTest("itd calling generic method"); + } + + public void testItdCallingGenericMethod_pr145391_2() { + runTest("itd calling generic method - 2"); + } + + public void testPublicPointcut_pr239539() { + runTest("public pointcut"); + } + + public void testGenericDecp_pr241047() { + runTest("generic decp"); + } + + public void testGenericDecp_pr241047_2() { + runTest("generic decp - 2"); + } + + public void testGenericItds_pr242797_1() { + runTest("generic itds - 1"); + } + + public void testGenericItds_pr242797_2() { + runTest("generic itds - 2"); + } + + public void testGenericItds_pr242797_3() { + runTest("generic itds - 3"); + } + + public void testPrivilegedGenerics_pr240693() { + runTest("privileged generics"); + } + + // public void testParamAnnosPipelining_pr241847() { runTest("param annos pipelining");} + // public void testParamAnnoInner_pr241861() { + // runTest("param annotation inner class"); + // } + + // public void testParamAnnoInner_pr241861_2() { + // runTest("param annotation inner class - 2"); + // } + + // public void testParamAnnoInner_pr241861_3() { + // runTest("param annotation inner class - 3"); + // } + + public void testAnnotationDecp_pr239441() { + runTest("annotation decp"); + } + + public void testAtAspectJPerTarget_pr198181() { + runTest("ataspectj ltw pertarget"); + } + + public void testAnnotationValueDecp_pr238992() { + runTest("annotation value decp"); + } + + public void testAnnotationValueDecp_pr238992_2() { + runTest("annotation value decp - 2"); + } + + public void testAnnotationValueDecp_pr238992_3() { + runTest("annotation value decp - 3"); + } + + public void testAnnotationValueDecp_pr238992_4() { + runTest("annotation value decp - 4"); + } + + public void testAnnotationValueDecp_pr238992_5() { + runTest("annotation value decp - 5"); + } + + /* + * test plan execution((..,String,..)) args(..,String,..) + * + * @args(..,Foo,..) + */ + // public void testParameterSubsettingMatching_pr233718_Matching() { runTest("parameter subsetting - matching");} + // public void testParameterSubsettingMatching_pr233718_ArgsMatching() { runTest("parameter subsetting - args matching");} + // public void testParameterSubsettingMatching_pr233718_ArgsBinding() { runTest("parameter subsetting - args binding");} + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc162Tests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc162.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc162/AllTestsAspectJ162.java b/tests/src/test/java/org/aspectj/systemtest/ajc162/AllTestsAspectJ162.java new file mode 100644 index 000000000..409d0d670 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc162/AllTestsAspectJ162.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc162; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ162 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.6.2 tests"); + //$JUnit-BEGIN$ + suite.addTest(Ajc162Tests.suite()); + //$JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc162/ajc162.xml b/tests/src/test/java/org/aspectj/systemtest/ajc162/ajc162.xml new file mode 100644 index 000000000..d8b86f20d --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc162/ajc162.xml @@ -0,0 +1,336 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.6.2 Tests --> +<suite> + + + <ajc-test dir="bugs162/pr247683" title="null delegate for array"> + <compile options="-1.5" files="A.java"/> + </ajc-test> + + <ajc-test dir="bugs162/IntoBinary" title="binary aspects model"> + <compile options="-1.5 -emacssym" files="Clazz.java" aspectpath="binaryaspect.jar"/> + </ajc-test> + + <ajc-test dir="bugs162/pr246918" title="ltw perclause"> + <compile options="-1.5" files="Code.java Dode.java" outjar="code.jar"/> + <compile options="-1.5 -Xlint:ignore" files="Base.java" outjar="aspects.jar"/> + <run class="Code" classpath="aspects.jar;code.jar" ltw="aop1.xml"> + <stderr> + <line text="advice fired class Code"/> + <line text="advice fired class Dode"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs162/pr246918" title="ltw perclause - 2"> + <compile options="-1.5" files="Code.java Dode.java" outjar="code.jar"/> + <compile options="-1.5 -Xlint:ignore" files="Base.java" outjar="aspects.jar"/> + <run class="Code" classpath="aspects.jar;code.jar" ltw="aop2.xml"> + <stderr> + <line text="advice fired class Dode"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs162/pr246918" title="ltw perclause - 3"> + <compile options="-1.5" files="Code.java Dode.java" outjar="code.jar"/> + <compile options="-1.5 -Xlint:ignore" files="Base2.java" outjar="aspects.jar"/> + <run class="Code" classpath="aspects.jar;code.jar" ltw="aop3.xml"> + <stderr> + <line text="advice fired class Dode"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs162/pr246918" title="ltw perclause - 4"> + <compile options="-1.5" files="Code.java Dode.java" outjar="code.jar"/> + <compile options="-1.5 -Xlint:ignore" files="Base2.java" outjar="aspects.jar"/> + <run class="Code" classpath="aspects.jar;code.jar" ltw="aop4.xml"> + <stderr> + <line text="Unrecognized per clause specified"/> + <line text="Concrete-aspect 'SubAspect' could not be registered"/> + <line text="warning failure(s) registering aspects."/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs162/pr246264" title="anno value binding"> + <compile options="-1.5" files="A.java"/> + <run class="A"/> + </ajc-test> + + <ajc-test dir="bugs162/pr211607" title="around advice proceed"> + <compile options="-1.5" files="Bug.java"/> + <run class="Bug"/> + </ajc-test> + + <ajc-test dir="bugs162/pr163005" title="advising joinpoints in interfaces"> + <compile files="SomeClass.java SomeInterface.java ProblemAspect.java" options="-1.4"> + <message kind="warning" text="Cannot advise join point 'method-call(java.lang.Class java.lang.Class.forName(java.lang.String))' in interface 'SomeInterface' with around advice from 'ProblemAspect.java' line '7' as it will lead to creation of code in an interface (compiler limitation, bug 163005)"/> + </compile> + <run class="SomeClass"/> + </ajc-test> + + <ajc-test dir="bugs162/pr176905" title="chained itds"> + <compile options="-1.5" files="ChainedItd.aj"> + </compile> + <run class="ChainedItd"> + <stderr/> <!-- no errors--> + </run> + </ajc-test> + + <ajc-test dir="bugs162/pr198341" title="dec atanno and decp"> + <compile options="-1.5 -showWeaveInfo" files="AnnotationAspect.java"> + <message kind="weave" text="'Annotated' (AnnotationAspect.java:12) is annotated with @TestAnnotation2 type annotation from 'AnnotationAspect' (AnnotationAspect.java:18)"/> + <message kind="weave" text="Extending interface set for type 'Annotated' (AnnotationAspect.java) to include 'Marker' (AnnotationAspect.java)"/> + </compile> + </ajc-test> + + + <ajc-test dir="bugs162/pr197720" title="missing markers on inherited annotated method"> + <compile files="C1.java C2.java C3.java MyAnn.java MyAnnAspect.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-call(void test.aspects.C1.aMethod())' in Type 'test.aspects.C1' (C1.java:12) advised by around advice from 'test.aspects.MyAnnAspect' (MyAnnAspect.java:16)"/> + <message kind="weave" text="Join point 'method-call(void test.aspects.C2.aMethod())' in Type 'test.aspects.C2$InnerClass' (C2.java:17) advised by around advice from 'test.aspects.MyAnnAspect' (MyAnnAspect.java:16)"/> + <message kind="weave" text="Join point 'method-call(void test.aspects.C2.aMethod())' in Type 'test.aspects.C2' (C2.java:7) advised by around advice from 'test.aspects.MyAnnAspect' (MyAnnAspect.java:16)"/> + <message kind="weave" text="Join point 'method-call(void test.aspects.C2.aMethod())' in Type 'test.aspects.C2' (C2.java:28) advised by around advice from 'test.aspects.MyAnnAspect' (MyAnnAspect.java:16)"/> + <message kind="weave" text="Join point 'method-call(void test.aspects.C1.aMethod())' in Type 'test.aspects.C3$InnerClass' (C3.java:22) advised by around advice from 'test.aspects.MyAnnAspect' (MyAnnAspect.java:16)"/> + <message kind="weave" text="Join point 'method-call(void test.aspects.C2.aMethod())' in Type 'test.aspects.C3$InnerClass' (C3.java:25) advised by around advice from 'test.aspects.MyAnnAspect' (MyAnnAspect.java:16)"/> + <message kind="weave" text="Join point 'method-call(void test.aspects.C1.aMethod())' in Type 'test.aspects.C3' (C3.java:8) advised by around advice from 'test.aspects.MyAnnAspect' (MyAnnAspect.java:16)"/> + <message kind="weave" text="Join point 'method-call(void test.aspects.C2.aMethod())' in Type 'test.aspects.C3' (C3.java:11) advised by around advice from 'test.aspects.MyAnnAspect' (MyAnnAspect.java:16)"/> + <message kind="weave" text="Join point 'method-call(void test.aspects.C1.aMethod())' in Type 'test.aspects.C3' (C3.java:32) advised by around advice from 'test.aspects.MyAnnAspect' (MyAnnAspect.java:16)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs162/pr211146" title="lost generic sig on itd"> + <compile files="GenericsLost.java" options="-1.5"/> + <run class="GenericsLost"/> + </ajc-test> + + <ajc-test dir="bugs162/pr211146" title="lost generic sig on itd - 2"> + <compile files="GenericsLost2.java" outjar="code.jar" options="-1.5"/> + <compile files="GenericsLost2Dep.java" classpath="$sandbox/code.jar" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs162/pr211146" title="lost generic sig on itd - 3"> + <compile files="GenericsLost3.java" options="-1.5"/> + <run class="GenericsLost3"/> + </ajc-test> + + <ajc-test dir="bugs162/pr211146" title="lost generic sig on itd - 4"> + <compile files="GenericsLost4.java" options="-1.5"/> + <run class="GenericsLost4"/> + </ajc-test> + + <ajc-test dir="bugs162/pr211146" title="lost generic sig on itd - 5"> + <compile files="GenericsLost5.java" options="-1.5"/> + <run class="GenericsLost5"/> + </ajc-test> + + <ajc-test dir="bugs162/pr194429" title="missing context"> + <compile files="A.java" options="-1.5"> + <message kind="error" line="14" text="incompatible type, expected java.util.Set found BindingTypePattern("/> + </compile> + </ajc-test> + + <ajc-test dir="bugs162/pr210114" title="warnings for limitations"> + <compile files="TestAspect.java" options="-1.5"> + <message kind="warning" text="Only before advice is supported on handler join points (compiler limitation)"/> + <message kind="warning" text="around on initialization not supported (compiler limitation)"/> + <message kind="warning" text="around on pre-initialization not supported (compiler limitation)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs162/pr244830" title="ptw initFailureCause"> + <compile files="PTW.java" options="-1.5"/> + <run class="PTW"/> + </ajc-test> + + <ajc-test dir="bugs162/pr222648" title="generic itds - overrides"> + <compile files="DataAspect.aj DataInterface.java Foo.java FooBase.java Marker.java Resource.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs162/pr222648" title="generic itds - overrides - 2"> + <compile files="X.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs162/pr145391" title="itd calling generic method"> + <compile files="GenericType.java" options="-1.5"/> + <run class="GenericType"/> + </ajc-test> + + <ajc-test dir="bugs162/pr145391" title="itd calling generic method - 2"> + <compile files="GenericType2.java" options="-1.5"> + <message kind="error" text="The method getValue(V) in the type GenericType2<V> is not applicable for the arguments"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs162/pr241047" title="generic decp"> + <compile files="SomeAspect.java SomeBaseClass.java SomeSubClass.java SomeSubClass2.java SomeSubClass3.java SomeInterface.java SomeBaseClass2.java SomeBaseClass3.java" options=" -Xlint:ignore -1.5"> + </compile> + <run class="SomeBaseClass"> + <stdout> + <line text="correct advice :-)"/> + <line text="some base method"/> + <line text="correct advice :-)"/> + <line text="some sub method"/> + <line text="correct advice :-)"/> + <line text="some base method2"/> + <line text="correct advice :-)"/> + <line text="some sub method2"/> + <line text="correct advice :-)"/> + <line text="some base method3"/> + <line text="correct advice :-)"/> + <line text="some sub method3"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs162/pr241047/case2" title="generic decp - 2"> + <compile files="SomeAspect.java SomeBaseClass.java SomeSubClass.java SomeInterface.java" options=" -Xlint:ignore -1.5"> + </compile> + <run class="SomeBaseClass"> + <stdout> + <line text="correct advice :-)"/> + <line text="some base method"/> + <line text="correct advice :-)"/> + <line text="some sub method"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs162/pr239539" title="public pointcut"> + <compile files="PrintAround.java PrintAroundFoo.java Foo.java" options="-1.5"> + <message kind="error" line="7" text="pointcut 'bar.PrintAround.method()' is not visible from type "/> + </compile> + </ajc-test> + + <ajc-test dir="bugs162/pr242797/case1" title="generic itds - 1"> + <compile files="ClassUtils.java CMEFinder.java Finder.java H2Deployment.java Localized.java LocalizedFinder.java OnetElement.java OnetFinder.java Partitioned.java PartitionedFinder.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs162/pr242797/case2" title="generic itds - 2"> + <compile files="GenericMethodAspect.aj GenericMethodInterface.java GenericMethodImpl.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs162/pr242797/case3" title="generic itds - 3"> + <compile files="GenericMethodAspect.aj GenericMethodInterface.java GenericMethodImpl.java GenericMethodImpl2.java Type1.java Type2.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs162/pr241847" title="param annos pipelining"> + <compile files="Asp.aj Ann.java CC.java II.java LongLong.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void LongLong.m1(java.lang.String))' in Type 'LongLong' (LongLong.java:2) advised by before advice from 'Asp' (Asp.aj:5)"/> + <message kind="weave" line="3"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs162/pr239441" title="annotation decp"> + <compile files="Test3.java SampleAspect.java" options="-1.5 -showWeaveInfo -XhasMember"> + </compile> + </ajc-test> + + <ajc-test dir="bugs162/pr241861" title="param annotation inner class"> + <compile files="Outer.java Ann.java Asp.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'constructor-execution(void Outer$Inner.<init>(Outer, java.lang.String))' in Type 'Outer$Inner' (Outer.java:5) advised by before advice from 'Asp' (Asp.java:2)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs162/pr241861" title="param annotation inner class - 2"> + <compile files="X.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'constructor-execution(void Outer$Inner.<init>(Outer, java.lang.Integer))' in Type 'Outer$Inner' (X.java:7) advised by before advice from 'Asp' (X.java:2)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs162/pr241861" title="param annotation inner class - 3"> + <compile files="Y.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'constructor-execution(void Outer$Inner.<init>(Outer, java.lang.String))' in Type 'Outer$Inner' (Y.java:7) advised by before advice from 'Asp' (Y.java:2)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs162/pr240693" title="privileged generics"> + <compile files="PayloadClass.java SomeInterface.java GenericClassInAdvice.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs162/pr238992" title="annotation value decp"> + <compile files="Foo.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Extending interface set for type 'Goo'"/> + </compile> + <run class="Foo"/> + </ajc-test> + + <ajc-test dir="bugs162/pr238992" title="annotation value decp - 2"> + <compile files="Foo2.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Extending interface set for type 'Goo'"/> + <message kind="weave" text="Extending interface set for type 'Hoo'"/> + </compile> + <run class="Foo2"/> + </ajc-test> + + <ajc-test dir="bugs162/pr238992" title="annotation value decp - 3"> + <compile files="Foo3.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Extending interface set for type 'Goo'"/> + </compile> + <run class="Foo3"/> + </ajc-test> + + <ajc-test dir="bugs162/pr238992" title="annotation value decp - 4"> + <compile files="Foo4.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Extending interface set for type 'Goo'"/> + <message kind="weave" text="Extending interface set for type 'Hoo'"/> + </compile> + <run class="Foo4"/> + </ajc-test> + + <ajc-test dir="bugs162/pr238992" title="annotation value decp - 5"> + <compile files="Foo5.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Extending interface set for type 'Goo'"/> + <message kind="weave" text="Extending interface set for type 'Hoo'"/> + </compile> + <run class="Foo5"/> + </ajc-test> + + <ajc-test dir="bugs162/pr233718" title="parameter subsetting - matching"> + <compile files="Matching.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void Matching.m(java.lang.String))' in Type 'Matching' (Matching.java:3) advised by before advice from 'Matching' (Matching.java:8)"/> + <message kind="weave" text="'method-execution(void Matching.m(java.lang.String, java.lang.String))' in Type 'Matching' (Matching.java:4) advised by before advice from 'Matching' (Matching.java:8)"/> + <message kind="weave" text="'method-execution(void Matching.m(int, java.lang.String))' in Type 'Matching' (Matching.java:5) advised by before advice from 'Matching' (Matching.java:8)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs162/pr233718" title="parameter subsetting - args matching"> + <compile files="ArgsMatching.java" options="-1.5 -showWeaveInfo"> + <!-- + <message kind="weave" text="Join point 'method-execution(void Matching.m(java.lang.String))' in Type 'Matching' (Matching.java:3) advised by before advice from 'Matching' (Matching.java:8)"/> + <message kind="weave" text="'method-execution(void Matching.m(java.lang.String, java.lang.String))' in Type 'Matching' (Matching.java:4) advised by before advice from 'Matching' (Matching.java:8)"/> + <message kind="weave" text="'method-execution(void Matching.m(int, java.lang.String))' in Type 'Matching' (Matching.java:5) advised by before advice from 'Matching' (Matching.java:8)"/> + --> + </compile> + </ajc-test> + + <ajc-test dir="bugs162/pr233718" title="parameter subsetting - args binding"> + <compile files="ArgsBinding.java" options="-1.5"/> + <run class="ArgsBinding"> + <stdout> + <line text="0) a"/> + <line text="0) b"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs162/pr198181" title="ataspectj ltw pertarget"> + <compile files="M.java" outjar="code.jar"/> + <compile files="A.java" classpath="code.jar" options="-1.5 -Xlint:ignore"/> + <run class="m.M" classpath="$sandbox/code.jar" ltw="aop.xml"> + <stdout> + <line text="tick 0"/> + <line text="tick 0"/> + <line text="tick 0"/> + </stdout> + </run> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc163/Ajc163Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc163/Ajc163Tests.java new file mode 100644 index 000000000..15abc8921 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc163/Ajc163Tests.java @@ -0,0 +1,320 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc163; + +import java.io.File; +import java.util.List; + +import junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.LocalVariable; +import org.aspectj.apache.bcel.classfile.LocalVariableTable; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.asm.AsmManager; +import org.aspectj.asm.IHierarchy; +import org.aspectj.asm.IProgramElement; +import org.aspectj.testing.Utils; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class Ajc163Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + public void testGenericMethodBridging_pr251326() { + runTest("itd anonymous inner class in wrong package"); + } + + public void testOrderingRepetitive_pr259279() { + runTest("ordering repetitive method"); + } + + public void testOrderingRepetitive_pr259279_2() { + runTest("ordering repetitive method - 2"); + } + + public void testExtendingASI_pr252722() { + runTest("extending AbstractSecurityInterceptor"); + } + + public void testExtendingASI_pr252722_2() { + runTest("extending AbstractSecurityInterceptor - 2"); + } + + public void testExtendingASI_pr252722_3() { + runTest("extending AbstractSecurityInterceptor - 3"); + } + + public void testExtendingASI_pr252722_4() { + runTest("extending AbstractSecurityInterceptor - 4"); + } + + public void testGetNode_pr258653() { + runTest("getNode"); + } + + public void testAtTargetPlus_pr255856() { + runTest("attarget with plus"); + } + + public void testNonNullAtArgs_pr257833() { + runTest("param annos and at args"); + } + + public void testIncorrectArgOrdering_pr219419() { + runTest("incorrect arg ordering anno style"); + } + + public void testIncorrectArgOrdering_pr219419_2() { + runTest("incorrect arg ordering anno style - 2"); + } + + public void testIncorrectArgOrdering_pr219419_3() { + runTest("incorrect arg ordering anno style - 3"); + } + + // similar to 3 but parameters other way round + public void testIncorrectArgOrdering_pr219419_4() { + runTest("incorrect arg ordering anno style - 4"); + } + + // similar to 3 but also JoinPoint passed into advice + public void testIncorrectArgOrdering_pr219419_5() { + runTest("incorrect arg ordering anno style - 5"); + } + + public void testDecpAnnoStyle_pr257754() { + runTest("decp anno style"); + } + + public void testDecpAnnoStyle_pr257754_2() { + runTest("decp anno style - 2"); + } + + public void testPoorAtAjIfMessage_pr256458() { + runTest("poor ataj if message - 1"); + } + + public void testPoorAtAjIfMessage_pr256458_2() { + runTest("poor ataj if message - 2"); + } + + /* + * public void testInheritedAnnotations_pr128664() { runTest("inherited annotations"); } + * + * public void testInheritedAnnotations_pr128664_2() { runTest("inherited annotations - 2"); } + */ + public void testGetMethodNull_pr154427() { + runTest("getMethod returning null"); + } + + public void testItdOnAnonInner_pr171042() { + runTest("itd on anonymous inner"); + } + + public void testMixedStyles_pr213751() { + runTest("mixed styles"); + } + + public void testHandles_pr249216c24() { + runTest("handles - escaped square brackets"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + IProgramElement ipe = null; + ipe = findElementAtLine(top.getRoot(), 4);// public java.util.List<String> Ship.i(List<String>[][] u) + assertEquals("<{Handles.java'Handles)Ship.i)\\[\\[QList\\<QString;>;", ipe.getHandleIdentifier()); + + ipe = findElementAtLine(top.getRoot(), 7);// public java.util.List<String> Ship.i(Set<String>[][] u) + assertEquals("<{Handles.java'Handles)Ship.i)\\[\\[QSet\\<QString;>;", ipe.getHandleIdentifier()); + + // public java.util.Set<String> i(java.util.Set<String>[][] u) + ipe = findElementAtLine(top.getRoot(), 10); + assertEquals("<{Handles.java'Handles~i~\\[\\[Qjava.util.Set\\<QString;>;", ipe.getHandleIdentifier()); + + ipe = findElementAtLine(top.getRoot(), 13);// public java.util.Set<String> i(java.util.Set<String>[][] u,int i) { + assertEquals("<{Handles.java'Handles~i~\\[\\[Qjava.util.Set\\<QString;>;~I", ipe.getHandleIdentifier()); + + ipe = findElementAtLine(top.getRoot(), 16);// public java.util.Set<String> i2(java.util.Set<? extends + // Collection<String>>[][] u) { + assertEquals("<{Handles.java'Handles~i2~\\[\\[Qjava.util.Set\\<+QCollection\\<QString;>;>;", ipe.getHandleIdentifier()); + + ipe = findElementAtLine(top.getRoot(), 19);// public java.util.Set<String> i3(java.util.Set<? extends + // Collection<String[]>>[][] u) + assertEquals("<{Handles.java'Handles~i3~\\[\\[Qjava.util.Set\\<+QCollection\\<\\[QString;>;>;", ipe.getHandleIdentifier()); + + ipe = findElementAtLine(top.getRoot(), 22); + assertEquals("<{Handles.java'Handles~i4~Qjava.util.Set\\<+QCollection\\<QString;>;>;", ipe.getHandleIdentifier()); + + ipe = findElementAtLine(top.getRoot(), 25); + assertEquals("<{Handles.java'Handles~i5~Qjava.util.Set\\<*>;", ipe.getHandleIdentifier()); + + } + + public void testFQType_pr256937() { + runTest("fully qualified return type"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + IProgramElement itd = findElementAtLine(top.getRoot(), 10); + String type = itd.getCorrespondingType(true); + assertEquals("java.util.List<java.lang.String>", type); + + itd = findElementAtLine(top.getRoot(), 16); + type = itd.getCorrespondingType(true); + assertEquals("java.util.List<java.lang.String>", type); + } + + private IProgramElement findElementAtLine(IProgramElement whereToLook, int line) { + if (whereToLook == null) { + return null; + } + if (whereToLook.getSourceLocation() != null && whereToLook.getSourceLocation().getLine() == line) { + return whereToLook; + } + List<IProgramElement> kids = whereToLook.getChildren(); + for (IProgramElement object: kids) { + if (object.getSourceLocation() != null && object.getSourceLocation().getLine() == line) { + return object; + } + IProgramElement gotSomething = findElementAtLine(object, line); + if (gotSomething != null) { + return gotSomething; + } + } + return null; + } + + public void testParameterAnnotationsOnITDs_pr256669() { // regular itd + runTest("parameter annotations on ITDs"); + } + + public void testParameterAnnotationsOnITDs_pr256669_2() { // static itd + runTest("parameter annotations on ITDs - 2"); + } + + public void testParameterAnnotationsOnITDs_pr256669_3() { // multiple parameters + runTest("parameter annotations on ITDs - 3"); + } + + public void testParameterAnnotationsOnITDs_pr256669_4() { // itd on interface + runTest("parameter annotations on ITDs - 4"); + } + + public void testOrderingIssue_1() { + runTest("ordering issue"); + } + + public void testOrderingIssue_2() { + runTest("ordering issue - 2"); + } + + // public void testGenericPointcuts_5() { + // runTest("generic pointcuts - 5"); + // } + + public void testGenericPointcuts_1() { + runTest("generic pointcuts - 1"); + } + + public void testGenericPointcuts_2() { + runTest("generic pointcuts - 2"); + } + + public void testGenericPointcuts_3() { + runTest("generic pointcuts - 3"); + } + + public void testGenericPointcuts_4() { + runTest("generic pointcuts - 4"); + } + + public void testDontAddMethodBodiesToInterface_pr163005() { + runTest("do not add method bodies to an interface"); + } + + public void testDontAddMethodBodiesToInterface_pr163005_2() { + runTest("do not add method bodies to an interface - 2"); + } + + public void testDontAddMethodBodiesToInterface_pr163005_3() { + runTest("do not add method bodies to an interface - 3"); + } + + public void testMissingLocalVariableTableEntriesOnAroundAdvice_pr173978() throws Exception { + runTest("missing local variable table on around advice"); + JavaClass jc = Utils.getClassFrom(ajc.getSandboxDirectory().getAbsolutePath(), "Test"); + Method[] ms = jc.getMethods(); + Method m = null; + for (int i = 0; i < ms.length; i++) { + if (ms[i].getName().equals("sayHello")) { + m = ms[i]; + } + } + if (m.getLocalVariableTable() == null) { + fail("Local variable table should not be null"); + } + assertEquals(2, m.getLocalVariableTable().getLocalVariableTable().length); + // LocalVariableTable: + // Start Length Slot Name Signature + // 0 12 0 this LTest; + // 0 12 1 message Ljava/lang/String; + LocalVariable lv = m.getLocalVariableTable().getLocalVariable(0); + assertNotNull(lv); + assertEquals("this", lv.getName()); + assertEquals(0, lv.getStartPC(), 0); + assertEquals(12, lv.getLength(), 12); + assertEquals("LTest;", lv.getSignature()); + lv = m.getLocalVariableTable().getLocalVariable(1); + assertNotNull(lv); + assertEquals("message", lv.getName()); + assertEquals(0, lv.getStartPC(), 0); + assertEquals(12, lv.getLength(), 12); + assertEquals("Ljava/lang/String;", lv.getSignature()); + // print(m.getLocalVariableTable()); + } + + public void testTerminateAfterCompilation_pr249710() { + runTest("terminateAfterCompilation"); + } + + public void testItdCCE_pr250091() { + runTest("itd cce"); + } + + public void testBreakingRecovery_pr226163() { + runTest("breaking recovery"); + } + + public void testGenericMethodConversions_pr250632() { + runTest("type conversion in generic itd"); + } + + public void testGenericMethodBridging_pr250493() { + runTest("bridge methods for generic itds"); + } + + public void testGenericFieldBridging_pr252285() { + runTest("bridge methods for generic itd fields"); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc163Tests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc163.xml"); + } + + // --- + + private void print(LocalVariableTable localVariableTable) { + LocalVariable[] lvs = localVariableTable.getLocalVariableTable(); + for (int i = 0; i < lvs.length; i++) { + LocalVariable localVariable = lvs[i]; + System.out.println(localVariable); + } + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc163/AllTestsAspectJ163.java b/tests/src/test/java/org/aspectj/systemtest/ajc163/AllTestsAspectJ163.java new file mode 100644 index 000000000..f0fbbeaf6 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc163/AllTestsAspectJ163.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc163; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ163 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.6.3 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc163Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc163/ajc163.xml b/tests/src/test/java/org/aspectj/systemtest/ajc163/ajc163.xml new file mode 100644 index 000000000..c26204aa5 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc163/ajc163.xml @@ -0,0 +1,354 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + + <ajc-test dir="bugs163/pr259279" title="ordering repetitive method"> + <compile files="SomeServiceImpl.java SomeInterface.java Main.java GenericService.java GenericServiceImpl.java Aspect.java" options="-1.5"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="bugs163/pr259279" title="ordering repetitive method - 2"> + <compile files="GenericServiceImpl.java SomeServiceImpl.java SomeInterface.java Main.java GenericService.java Aspect.java" options="-1.5"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="bugs163/pr258653" title="getNode"> + <compile files="staticinit.java" options="-1.5 -emacssym"/> + </ajc-test> + + <ajc-test dir="bugs163/pr252722" title="extending AbstractSecurityInterceptor"> + <compile files="A.java" options="-1.5"/> + <run class="A"/> + </ajc-test> + + <ajc-test dir="bugs163/pr252722" title="extending AbstractSecurityInterceptor - 2"> + <compile files="ACode.java" options="-1.5"/> + <run class="ACode"/> + </ajc-test> + + <ajc-test dir="bugs163/pr252722" title="extending AbstractSecurityInterceptor - 3"> + <compile files="B.java" options="-1.5"/> + <run class="B"/> + </ajc-test> + + <ajc-test dir="bugs163/pr252722" title="extending AbstractSecurityInterceptor - 4"> + <compile files="BCode.java" options="-1.5"/> + <run class="BCode"/> + </ajc-test> + + <ajc-test dir="bugs163/pr154427" title="getMethod returning null"> + <compile files="AuthorizationImpl.java Authorization.java AuthorizationAdmin.java CallAndMethodSignatureAspect.java CallTest.java" options=""/> + <run class="CallTest"> + <stdout> + <line text="public abstract boolean Authorization.mayPerform(java.lang.String,java.lang.String)"/> + <line text="public abstract boolean AuthorizationAdmin.mayPerform(java.lang.String, java.lang.String)"/> + <line text="mayPerform() executing"/> + <line text="public abstract boolean AuthorizationAdmin.mayPerform2(java.lang.String,java.lang.String)"/> + <line text="public abstract boolean AuthorizationAdmin.mayPerform2(java.lang.String, java.lang.String)"/> + <line text="mayPerform2() executing"/> + <line text="public abstract boolean Authorization.mayPerform(java.lang.String,java.lang.String)"/> + <line text="public abstract boolean Authorization.mayPerform(java.lang.String, java.lang.String)"/> + <line text="mayPerform() executing"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs163/pr128664" title="inherited annotations"> + <compile files="Bug.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text=""/> + </compile> + <run class="Bug"/> + </ajc-test> + + <ajc-test dir="bugs163/pr128664" title="inherited annotations - 2"> + <compile files="Bug2.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text=""/> + </compile> + <run class="Bug2"/> + </ajc-test> + + <ajc-test dir="bugs163/pr257754" title="decp anno style"> + <compile files="Main.java" options="-1.5"/> + <run class="example.Main"> + <stdout> + <line text="In doFoo class example.DefaultFoo"/> + <line text="Bar"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs163/pr257754" title="decp anno style - 2"> + <compile files="Main2.java Foo.java DefaultFoo.java" options="-1.5"> + <message kind="error" text="but it is of incorrect visibility"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs163/pr219419" title="incorrect arg ordering anno style"> + <compile files="Code.java" options="-1.5"/> + <run class="Code"> + <stdout> + <line text="Catching mess. Argument was ewwww"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs163/pr219419" title="incorrect arg ordering anno style - 2"> + <compile files="Code2.java" options="-1.5"/> + <run class="Code2"> + <stdout> + <line text="Catching mess. Argument was ewwww"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs163/pr219419" title="incorrect arg ordering anno style - 3"> + <compile files="Code3.java" options="-1.5"/> + <run class="Code3"> + <stdout> + <line text="afterReturningCreateBean advice input='s' ret=37"/> + <line text="Code3.main returned from call to createBean 37"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs163/pr219419" title="incorrect arg ordering anno style - 4"> + <compile files="Code4.java" options="-1.5"/> + <run class="Code4"> + <stdout> + <line text="afterReturningCreateBean advice input='s' ret=37"/> + <line text="Code4.main returned from call to createBean 37"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs163/pr219419" title="incorrect arg ordering anno style - 5"> + <compile files="Code5.java" options="-1.5"/> + <run class="Code5"> + <stdout> + <line text="afterReturningCreateBean advice input='s' ret=37"/> + <line text="Code5.main returned from call to createBean 37"/> + </stdout> + </run> + </ajc-test> + + + + <ajc-test dir="bugs163/pr256458" title="poor ataj if message - 1"> + <compile files="Code.java" options="-1.5"> + <message kind="error" text="in annotation style, if(...) pointcuts cannot contain code"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs163/pr256458" title="poor ataj if message - 2"> + <compile files="Code2.java" options="-1.5"> + <message kind="error" text="in annotation style, if(...) pointcuts cannot contain code"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs163/pr256937" title="fully qualified return type"> + <compile files="Ship.java ShipAccessor.java" options="-emacssym -1.5"/> + </ajc-test> + + <ajc-test dir="bugs163/pr213751" title="mixed styles"> + <compile files="Foo.java" options="-emacssym -1.5"/> + </ajc-test> + + <ajc-test dir="bugs163/pr249216" title="handles - escaped square brackets"> + <compile files="Handles.java" options="-emacssym -1.5"/> + </ajc-test> + + <ajc-test dir="bugs163/pr171042" title="itd on anonymous inner"> + <compile files="TestClass.java Executable.java RunnableAspect.java" options=""/> + </ajc-test> + + <ajc-test dir="bugs163/pr254207" title="ordering issue"> + <compile files="Abstract.java Concrete.java" options="-1.5 -proceedOnError -Xset:pipelineCompilation=false"> + <message kind="error" line="1" text="Bound mismatch"/> + </compile> + <compile files="Concrete.java Abstract.java" options="-1.5 -proceedOnError -Xset:pipelineCompilation=false"> + <message kind="error" line="1" text="Bound mismatch"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs163/pr254207/case2" title="ordering issue - 2"> + <compile files="Interface.java Clazz.java Abstract.java Concrete.java" options="-1.5 -proceedOnError -Xset:pipelineCompilation=false"> + <message kind="error" line="1" text="Bound mismatch"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs163/pr256669" title="parameter annotations on ITDs"> + <compile files="Destination.java SimpleTest.java Introduction.java SomeAnnotation.java" options="-1.5"/> + <run class="SimpleTest"> + <stdout> + <line text="Parameter 0 has 1 parameter annotations"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs163/pr256669" title="parameter annotations on ITDs - 2"> + <compile files="Two.java" options="-1.5"/> + <run class="Two"> + <stdout> + <line text="Parameter 0 has 1 parameter annotations"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs163/pr256669" title="parameter annotations on ITDs - 3"> + <compile files="Three.java" options="-1.5"/> + <run class="Three"> + <stdout> + <line text="Parameter 0 has 0 parameter annotations"/> + <line text="Parameter 1 has 1 parameter annotations"/> + <line text="Parameter 2 has 0 parameter annotations"/> + <line text="Parameter 3 has 1 parameter annotations"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs163/pr256669" title="parameter annotations on ITDs - 4"> + <compile files="Four.java" options="-1.5"/> + <run class="Four"> + <stdout> + <line text="Class D parameter 0 has 1 parameter annotations"/> + <line text="Interface I parameter 0 has 1 parameter annotations"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs163/pr253109" title="generic pointcuts - 1"> + <compile files="CodeOne.java" options="-1.5"> + <message kind="warning" line="4" text="has not been applied"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs163/pr257833" title="param annos and at args"> + <compile files="NotNull.java NotNullAspect.java NotNullTest.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'constructor-execution(void patterntesting.check.runtime.NotNullTest.<init>(java.lang.String))' in Type"/> + </compile> + <run class="patterntesting.check.runtime.NotNullTest"/> + </ajc-test> + + <ajc-test dir="bugs163/pr253109" title="generic pointcuts - 2"> + <compile files="CodeTwo.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs163/pr253109" title="generic pointcuts - 3"> + <compile files="CodeThree.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="advised by before advice from 'CodeThree' (CodeThree.java:4)"/> + <message kind="weave" text="advised by before advice from 'CodeThree' (CodeThree.java:5) [with runtime test]"/> + <message kind="warning" line="6" text="has not been applied"/> + <message kind="warning" line="7" text="has not been applied"/> + <message kind="weave" text="advised by before advice from 'CodeThree' (CodeThree.java:8)"/> + <message kind="weave" text="advised by before advice from 'CodeThree' (CodeThree.java:9) [with runtime test]"/> + <message kind="warning" line="5" text="unchecked"/> + <message kind="warning" line="9" text="unchecked"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs163/pr253109" title="generic pointcuts - 4"> + <compile files="CodeFour.java" options="-1.5"> + <message kind="warning" text="has not been applied"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs163/pr255856" title="attarget with plus"> + <compile files="Bug.java" options="-1.5"> + <message kind="error" text="unexpected pointcut element"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs163/pr253109" title="generic pointcuts - 5"> + <compile files="CodeFive.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" line="55" text="advised by around advice"/> + </compile> + </ajc-test> + + + <ajc-test dir="bugs163/pr163005" title="do not add method bodies to an interface"> + <compile files="Code.java" options="-1.4"> + <message kind="warning" text="The joinpoint 'method-call(java.lang.Class java.lang.Class.forName(java.lang.String))' cannot be advised"/> + </compile> + <run class="Code"/> + </ajc-test> + + <ajc-test dir="bugs163/pr163005" title="do not add method bodies to an interface - 2"> + <compile files="Code.java" options="-1.4 -XnoInline"> + <message kind="warning" text="The joinpoint 'method-call(java.lang.Class java.lang.Class.forName(java.lang.String))' cannot be advised"/> + </compile> + <run class="Code"/> + </ajc-test> + + <ajc-test dir="bugs163/pr163005" title="do not add method bodies to an interface - 3"> + <compile files="Code2.java" options="-1.4"> + <message kind="warning" text="The joinpoint 'constructor-call(void java.lang.Object.<init>())' cannot be advised"/> + </compile> + <run class="Code2"/> + </ajc-test> + + <ajc-test dir="bugs163/pr250091" title="itd cce"> + <compile files="Demo.java" options="-1.5"/> + <run class="Demo"> + <stdout> + <line text="class A (false)"/> + <line text="class A (false)"/> + <line text="class Base (false)"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs163/pr226163" title="breaking recovery"> + <compile files="Code.java" options="-1.5"> + <message kind="error" line="4" text="Syntax error"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs163/pr173978" title="missing local variable table on around advice"> + <compile files="Test.java TestAroundAspect.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs163/pr249710" title="terminateAfterCompilation"> + <compile files="Foo.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs163/pr250632" title="type conversion in generic itd"> + <compile files="MyAspect.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs163/pr250493" title="bridge methods for generic itds"> + <compile files="Bridged.java" options="-1.5"/> + <run class="Bridged"> + <stdout> + <line text="getterA()java.lang.Object isBridged?true"/> + <line text="getterA()java.lang.String isBridged?false"/> + <line text="getterB()java.lang.Object isBridged?true"/> + <line text="getterB()java.lang.String isBridged?false"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs163/pr252285" title="bridge methods for generic itd fields"> + <compile files="Bridged.java" options="-1.5"/> + <run class="Bridged"> + <stdout> + <line text="ajc$interFieldGet$X$Super$getterA()java.lang.Integer isBridged?false"/> + <line text="ajc$interFieldGet$X$Super$getterA()java.lang.Number isBridged?true"/> + <line text="ajc$interFieldSet$X$Super$getterA()void isBridged?false"/> + <line text="ajc$interFieldSet$X$Super$getterA()void isBridged?true"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs163/pr251326" title="itd anonymous inner class in wrong package"> + <compile files="pkgA/Listener.java pkgA/Target.java pkgB/InferListener.aj" options="-1.5"/> + <run class="pkgA.Target"> + <stdout> + <line text="Simple A"/> + <line text="Inferred B"/> + </stdout> + </run> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc164/Ajc164Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc164/Ajc164Tests.java new file mode 100644 index 000000000..866fbb729 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc164/Ajc164Tests.java @@ -0,0 +1,443 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc164; + +import java.io.File; +import java.io.PrintWriter; +import java.util.Iterator; +import java.util.List; + +import org.aspectj.apache.bcel.classfile.LocalVariable; +import org.aspectj.apache.bcel.classfile.LocalVariableTable; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.asm.AsmManager; +import org.aspectj.asm.IHierarchy; +import org.aspectj.asm.IProgramElement; +import org.aspectj.asm.IRelationship; +import org.aspectj.testing.XMLBasedAjcTestCase; + +import junit.framework.Test; + +public class Ajc164Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testGenericAspectsNpe_pr268689() { + runTest("generics aspects npe"); + } + + public void testGenericAspectsNpe_pr268710() { + runTest("generics aspects incorrect error"); + } + + public void testGenericsItdNpe_pr267559() { + runTest("generics and itd npe"); + } + + public void testAnnoStyleLong_pr266564() { + runTest("annotation style long"); + } + + public void testAnnoStyleLong_pr266564_2() { + runTest("annotation style long - 2"); + } + + public void testUnusedPrivateWarning_pr266420() { + runTest("unused private warning"); + } + + public void testUnusedPrivateWarning_pr266420_2() { + runTest("unused private warning - 2"); + } + + public void testUnusedPrivateWarning_pr266420_3() { + runTest("unused private warning - 3"); + } + + /** + * This test program can be used to compare handles for faulted in binary aspects with handles that would be used if the aspect + * was available as source. There are two compile steps in the xml for the test - commenting out the first will allow the source + * handles to be seen, leaving it in will switch to binary. Effectively the only difference should be that in the binary case + * the handles are prefixed 'binaries'. + * + * Change due to bug 274558: now AJDT wants (blah.class as the 'source file' for the ITD so that is another difference when + * switching. + */ + public void testItdsAspectPathModel_pr265729_1() { + runTest("aspectpath model"); + AsmManager model = AsmManager.lastActiveStructureModel; + IHierarchy top = model.getHierarchy(); + printModel(model); + IProgramElement ipe = null; + + // ITD METHOD + // should be the ITD method from the binary aspect: + // public Color Orange.getColor() { return Color.orange; } + ipe = top.findElementForType("demo", "Orange"); + assertNotNull(ipe); + assertEquals("<demo{Orange.java[Orange", ipe.getHandleIdentifier()); + IRelationship ir = model.getRelationshipMap().get(ipe).get(0); + String itdMethodHandle = ir.getTargets().get(0); + // handle when all source: <{Aspect.java}Aspect)Orange.getColor + // assertEquals("/binaries<{Aspect.java}Aspect)Orange.getColor", itdMethodHandle); + assertEquals("/binaries<(Aspect.class'Aspect)Orange.getColor", itdMethodHandle); + IProgramElement itdpe = model.getHierarchy().findElementForHandle(itdMethodHandle); + assertEquals("java.awt.Color", itdpe.getCorrespondingType(true)); + + // ITD FIELD + // should be the ITD field from the binary aspect: + // public Color Strawberry.color + ipe = top.findElementForType("demo", "Strawberry"); + assertNotNull(ipe); + assertEquals("<demo{Strawberry.java[Strawberry", ipe.getHandleIdentifier()); + ir = model.getRelationshipMap().get(ipe).get(0); + String itdFieldHandle = ir.getTargets().get(0); + // source handle <{Aspect.java}Aspect)Strawberry.color + // assertEquals("/binaries<{Aspect.java}Aspect)Strawberry.color", itdFieldHandle); + assertEquals("/binaries<(Aspect.class'Aspect,Strawberry.color", itdFieldHandle); + IProgramElement itdfpe = model.getHierarchy().findElementForHandle(itdMethodHandle); + assertEquals("java.awt.Color", itdfpe.getCorrespondingType(true)); + + // ITD CONSTRUCTOR + // /binaries< Aspect.java}Aspect)java.awt.Color demo.Strawberry.color + ipe = top.findElementForType("demo", "Fruit"); + assertNotNull(ipe); + assertEquals("<demo{Fruit.java[Fruit", ipe.getHandleIdentifier()); + ir = model.getRelationshipMap().get(ipe).get(0); + String itdCtorHandle = ir.getTargets().get(0); + // source handle <{Aspect.java}Aspect)Fruit.Fruit_new)QColor;)QString; + // assertEquals("/binaries<{Aspect.java}Aspect)Fruit.Fruit_new)QColor;)QString;", itdCtorHandle); + assertEquals("/binaries<(Aspect.class'Aspect)Fruit.Fruit_new)QColor;)QString;", itdCtorHandle); + IProgramElement itdcpe = model.getHierarchy().findElementForHandle(itdCtorHandle); + List<char[]> ptypes = itdcpe.getParameterTypes(); + assertEquals("java.awt.Color", new String(ptypes.get(0))); + assertEquals("java.lang.String", new String(ptypes.get(1))); + } + + private void printModel(AsmManager model) { + try { + AsmManager.dumptree(model.getHierarchy().getRoot(), 0); + model.dumprels(new PrintWriter(System.out)); + } catch (Exception e) { + } + } + + public void testGenericsAopXml_pr266220() { + runTest("generics and aop.xml"); + } + + public void testOptimizingIf_pr266165_1() { + runTest("optimizing if for constant reference - 1"); + } + + public void testOptimizingIf_pr266165_2() { + runTest("optimizing if for constant reference - 2"); + } + + public void testOptimizingIf_pr266165_3() { + runTest("optimizing if for constant reference - 3"); + } + + public void testOptimizingIf_pr266165_4() { + runTest("optimizing if for constant reference - 4"); + } + + // public void testAnnoInherited_pr265695() { + // runTest("anno inherited"); + // } + // + // public void testAnnoInherited_pr265695_2() { + // runTest("new syntax for inherited anno - 1"); + // } + // + // public void testAnnoInherited_pr265695_3() { + // runTest("new syntax for inherited anno - 3"); + // } + + public void testParserProblemSubArrayPatterns_pr148508() { + runTest("parser problem for array subtypes"); + } + + public void testVarargs_pr265418() { + runTest("varargs"); + } + + public void testIncorrectDateResolution_pr265360() { + runTest("incorrect resolution of Date"); + } + + public void testDualPreClinit_pr233032() { + runTest("dual preClinit"); + } + + public void testHandles_pr263310() { + runTest("inner handles"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + IProgramElement ipe = null; + ipe = findElementAtLine(top.getRoot(), 13); + assertEquals("<p{HandleTestingAspect.java'HandleTestingAspect[InnerClass'InnerInnerAspect|1", ipe.getHandleIdentifier()); + // ipe = findElementAtLine(top.getRoot(), 29); + // assertEquals("<x*OverrideOptions.aj}OverrideOptions&around!2", + // ipe.getHandleIdentifier()); + } + + public void testHandles_pr263666() { + runTest("around advice handles"); + IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); + IProgramElement ipe = null; + ipe = findElementAtLine(top.getRoot(), 22); + assertEquals("<x*OverrideOptions.aj'OverrideOptions&around", ipe.getHandleIdentifier()); + ipe = findElementAtLine(top.getRoot(), 29); + assertEquals("<x*OverrideOptions.aj'OverrideOptions&around!2", ipe.getHandleIdentifier()); + } + + // Only one of two aspects named + public void testAopConfig1() { + runTest("aop config - 1"); + } + + // Only one of two aspects named - and named one is scoped to only affect + // one type + public void testAopConfig2() { + runTest("aop config - 2"); + } + + // Invalid scope specified - cannot be parsed as type pattern + public void testAopConfig3() { + runTest("aop config - 3"); + } + + // excluding types from weaving + public void testAopConfig4() { + runTest("aop config - 4"); + } + + // excluding types from weaving + public void testAopConfig5() { + runTest("aop config - 5"); + } + + public void testAjcThisNotRead() { + runTest("ajcthis not read"); + } + + public void testRecursiveCflow() { + runTest("recursive cflow"); + } + + public void testAnnoDecprecedence_pr256779() { + runTest("anno decprecedence"); + } + + // + public void testBrokenLVT_pr194314_1() throws Exception { + runTest("broken lvt - 1"); + Method m = getMethodFromClass(getClassFrom(ajc.getSandboxDirectory(), "Service"), "method_aroundBody1$advice"); + if (m.getLocalVariableTable() == null) { + fail("Local variable table should not be null"); + } + // Method: + // private static final void method_aroundBody1$advice(Service, long, + // JoinPoint, ServiceInterceptor, ProceedingJoinPoint); + LocalVariable[] lvt = m.getLocalVariableTable().getLocalVariableTable(); + assertEquals(7, lvt.length); // no aroundClosure compared to second + // version of this test + assertEquals("LService; ajc$this(0) start=0 len=86", stringify(m.getLocalVariableTable(), 0)); + assertEquals("J l(1) start=0 len=86", stringify(m.getLocalVariableTable(), 1)); + assertEquals("Lorg/aspectj/lang/JoinPoint; thisJoinPoint(3) start=0 len=86", stringify(m.getLocalVariableTable(), 2)); + assertEquals("LServiceInterceptor; ajc$aspectInstance(4) start=0 len=86", stringify(m.getLocalVariableTable(), 3)); + assertEquals("Lorg/aspectj/lang/ProceedingJoinPoint; pjp(5) start=0 len=86", stringify(m.getLocalVariableTable(), 4)); + assertEquals("[Ljava/lang/Object; args(6) start=9 len=77", stringify(m.getLocalVariableTable(), 5)); + assertEquals("J id(7) start=21 len=65", stringify(m.getLocalVariableTable(), 6)); + + } + + public void testBrokenLVT_pr194314_2() throws Exception { + runTest("broken lvt - 2"); + Method m = getMethodFromClass(getClassFrom(ajc.getSandboxDirectory(), "Service"), "method_aroundBody1$advice"); + if (m.getLocalVariableTable() == null) { + fail("Local variable table should not be null"); + } + System.out.println(m.getLocalVariableTable()); + LocalVariable[] lvt = m.getLocalVariableTable().getLocalVariableTable(); + assertEquals(8, lvt.length); + // private static final void method_aroundBody1$advice(Service, long, + // JoinPoint, ServiceInterceptorCodeStyle, AroundClosure, + // JoinPoint); + assertEquals("LService; ajc$this(0) start=0 len=68", stringify(m.getLocalVariableTable(), 0)); + assertEquals("J l(1) start=0 len=68", stringify(m.getLocalVariableTable(), 1)); + assertEquals("Lorg/aspectj/lang/JoinPoint; thisJoinPoint(3) start=0 len=68", stringify(m.getLocalVariableTable(), 2)); + assertEquals("LServiceInterceptorCodeStyle; ajc$aspectInstance(4) start=0 len=68", stringify(m.getLocalVariableTable(), 3)); + assertEquals("Lorg/aspectj/runtime/internal/AroundClosure; ajc$aroundClosure(5) start=0 len=68", + stringify(m.getLocalVariableTable(), 4)); + assertEquals("Lorg/aspectj/lang/JoinPoint; thisJoinPoint(6) start=0 len=68", stringify(m.getLocalVariableTable(), 5)); + assertEquals("[Ljava/lang/Object; args(7) start=9 len=59", stringify(m.getLocalVariableTable(), 6)); + assertEquals("J id(8) start=21 len=47", stringify(m.getLocalVariableTable(), 7)); + } + + /** + * This test checks that local variable table for the interMethodDispatcher is built correctly, for the related code see + * IntertypeMethodDeclaration.generateDispatchMethod(). It checks non-static and static ITDs. Once the information here is + * correct then around advice on ITDs can also be correct. + */ + public void testBrokenLVT_pr194314_3() throws Exception { + runTest("broken lvt - 3"); + // Check intermethoddispatchers have the lvts correct + // first ITD: public void I.foo(String s,int i,String[] ss) {} + + Method m = getMethodFromClass(getClassFrom(ajc.getSandboxDirectory(), "X"), "ajc$interMethodDispatch1$X$I$foo"); + LocalVariableTable lvt = m.getLocalVariableTable(); + assertNotNull(lvt); + assertEquals("LI; ajc$this_(0) start=0 len=10", stringify(lvt, 0)); + assertEquals("Ljava/lang/String; s(1) start=0 len=10", stringify(lvt, 1)); + assertEquals("I i(2) start=0 len=10", stringify(lvt, 2)); + assertEquals("[Ljava/lang/String; ss(3) start=0 len=10", stringify(lvt, 3)); + + // second ITD: public void I.fooStatic(Long l,int i,String[] ss) {} + m = getMethodFromClass(getClassFrom(ajc.getSandboxDirectory(), "X"), "ajc$interMethodDispatch1$X$C$fooStatic"); + lvt = m.getLocalVariableTable(); + assertNotNull(lvt); + assertEquals("J l(0) start=0 len=7", stringify(lvt, 0)); + assertEquals("I i(2) start=0 len=7", stringify(lvt, 1)); + assertEquals("[Ljava/lang/String; ss(3) start=0 len=7", stringify(lvt, 2)); + + // Now let's check the around advice on the calls to those ITDs + + // non-static: + + m = getMethodFromClass(getClassFrom(ajc.getSandboxDirectory(), "C"), "foo_aroundBody1$advice"); + lvt = m.getLocalVariableTable(); + assertNotNull(lvt); + + assertEquals("LC; ajc$this(0) start=0 len=0", stringify(lvt, 0)); + assertEquals("LI; target(1) start=0 len=0", stringify(lvt, 1)); + assertEquals("Ljava/lang/String; s(2) start=0 len=0", stringify(lvt, 2)); + assertEquals("I i(3) start=0 len=0", stringify(lvt, 3)); + assertEquals("[Ljava/lang/String; ss(4) start=0 len=0", stringify(lvt, 4)); + assertEquals("LX; ajc$aspectInstance(5) start=0 len=0", stringify(lvt, 5)); + assertEquals("Lorg/aspectj/runtime/internal/AroundClosure; ajc$aroundClosure(6) start=0 len=0", stringify(lvt, 6)); + + // static: + + m = getMethodFromClass(getClassFrom(ajc.getSandboxDirectory(), "C"), "fooStatic_aroundBody3$advice"); + lvt = m.getLocalVariableTable(); + assertNotNull(lvt); + + assertEquals("LC; ajc$this(0) start=0 len=0", stringify(lvt, 0)); + assertEquals("J l(1) start=0 len=0", stringify(lvt, 1)); + assertEquals("I i(3) start=0 len=0", stringify(lvt, 2)); + assertEquals("[Ljava/lang/String; ss(4) start=0 len=0", stringify(lvt, 3)); + assertEquals("LX; ajc$aspectInstance(5) start=0 len=0", stringify(lvt, 4)); + assertEquals("Lorg/aspectj/runtime/internal/AroundClosure; ajc$aroundClosure(6) start=0 len=0", stringify(lvt, 5)); + + } + + // Single piece of advice on before execution of a method with a this and a + // parameter + public void testDebuggingBeforeAdvice_pr262509() throws Exception { + runTest("debugging before advice"); + Method method = getMethodFromClass(getClassFrom(ajc.getSandboxDirectory(), "Foo"), "foo"); + assertEquals("LFoo; this(0) start=0 len=13", stringify(method.getLocalVariableTable(), 0)); + assertEquals("LBar; bar(1) start=0 len=13", stringify(method.getLocalVariableTable(), 1)); + } + + // Single piece of advice on before execution of a method with a this and a + // parameter and other various locals within it + public void testDebuggingBeforeAdvice_pr262509_2() throws Exception { + // Compile with -preserveAllLocals + runTest("debugging before advice - 2"); + Method method = getMethodFromClass(getClassFrom(ajc.getSandboxDirectory(), "Foo2"), "foo"); + // System.out.println(stringify(method.getLocalVariableTable())); + List<LocalVariable> l = sortedLocalVariables(method.getLocalVariableTable()); + assertEquals("LBar; bar(1) start=0 len=34", stringify(l, 0)); + assertEquals("Ljava/lang/Exception; e(3) start=29 len=4", stringify(l, 1)); + assertEquals("LFoo2; this(0) start=0 len=34", stringify(l, 4)); + assertEquals("Ljava/lang/String; s(2) start=15 len=19", stringify(l, 2)); + // With the 1.8 compiler looks like len=7 and not len=10 here, the goto to jump to the return is no longer included + // in the variable range + assertEquals("Ljava/lang/String; s2(3) start=18 len=7", stringify(l, 3)); + } + + // Two pieces of advice on before execution of a method with a this and a + // parameter and another local within it + public void testDebuggingBeforeAdvice_pr262509_3() throws Exception { + // Compile with -preserveAllLocals + runTest("debugging before advice - 3"); + Method method = getMethodFromClass(getClassFrom(ajc.getSandboxDirectory(), "Foo3"), "foo"); + System.out.println(stringify(method.getLocalVariableTable())); + assertEquals("LFoo3; this(0) start=0 len=35", stringify(method.getLocalVariableTable(), 0)); + assertEquals("LBar; bar(1) start=0 len=35", stringify(method.getLocalVariableTable(), 1)); + assertEquals("Ljava/lang/Exception; e(2) start=30 len=4", stringify(method.getLocalVariableTable(), 2)); + } + + public void testRogueErrors_pr246393_1() { + runTest("rogue errors - 1"); + } + + // public void testNameClash_pr262257() { + // runTest("name clash"); + // fail("incomplete"); + // } + + public void testCompilingSpring_pr260384() { + runTest("compiling spring"); + } + + public void testCompilingSpring_pr260384_2() { + runTest("compiling spring - 2"); + } + + public void testCompilingSpring_pr260384_3() { + runTest("compiling spring - 3"); + } + + public void testCompilingSpring_pr260384_4() { + runTest("compiling spring - 4"); + } + + public void testAtAspectJDecp_pr164016() { + runTest("ataspectj decp 164016"); + } + + public void testAtAspectJDecp_pr258788() { + runTest("ataspectj decp 258788"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc164Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc164.xml"); + } + + private IProgramElement findElementAtLine(IProgramElement whereToLook, int line) { + if (whereToLook == null) { + return null; + } + if (whereToLook.getSourceLocation() != null && whereToLook.getSourceLocation().getLine() == line) { + return whereToLook; + } + List<IProgramElement> kids = whereToLook.getChildren(); + for (Iterator<IProgramElement> iterator = kids.iterator(); iterator.hasNext();) { + IProgramElement object = iterator.next(); + if (object.getSourceLocation() != null && object.getSourceLocation().getLine() == line) { + return object; + } + IProgramElement gotSomething = findElementAtLine(object, line); + if (gotSomething != null) { + return gotSomething; + } + } + return null; + } +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc164/AllTestsAspectJ164.java b/tests/src/test/java/org/aspectj/systemtest/ajc164/AllTestsAspectJ164.java new file mode 100644 index 000000000..1cd45e428 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc164/AllTestsAspectJ164.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc164; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ164 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.6.4 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc164Tests.suite()); + suite.addTest(DeclareMixinTests.suite()); + suite.addTest(JointpointIdTests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc164/DeclareMixinTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc164/DeclareMixinTests.java new file mode 100644 index 000000000..a8e9b6875 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc164/DeclareMixinTests.java @@ -0,0 +1,157 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc164; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * <h4>Design and test coverage</h4><br> + * In many ways the design is similar to DeclareParents now - so we have to plug in at the same points, but the code generation for + * generating the delegate object and the choice of which interfaces (and methods within those) to mixin is different. + * + * <h4>Tested:</h4><br> + * <ul> + * <li>Factory method with void or primitive return value + * <li>Check the factory method has at most one parameter + * <li>incremental compilation + * <li>error message if mixin target instance not compatible with factory method parameter + * </ul> + * + * <h4>Still to test/explore:</h4><br> + * <ul> + * <li>model relationships + * <li>ltw + * <li>generic factory methods + * <li>showWeaveInfo + * <li>Clashing with existing methods + * <li>varying parameter type on the factory method + * </ul> + * + * @author Andy Clement + */ +public class DeclareMixinTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + // Very basics with a simple static factory method + public void testCaseA() { + runTest("casea"); + } + + // non static factory method, will need aspectOf() calling on + // the aspect before the factory is called + public void testCaseB() { + runTest("caseb"); + } + + // factory method takes the object for which the delegate exists + public void testCaseC() { + runTest("casec"); + } + + // factory method is non static and takes the object for which the delegate is being created + public void testCaseD() { + runTest("cased"); + } + + // multiple instances causing factory invocation multiple times (but is cached) + public void testCaseE() { + runTest("casee"); + } + + // Factory method directly takes the type specified in the Mixin target (strongly typed) + public void testCaseF() { + runTest("casef"); + } + + // targeting multiple types from the Mixin + public void testCaseG() { + runTest("caseg"); + } + + // Null value for mixin target pattern + public void testCaseH() { + runTest("caseh"); + } + + // Invalid interfaces annotation value entries + public void testCaseI() { + runTest("casei"); + } + + // invalid return type for factory method + public void testCaseJ() { + runTest("casej"); + } + + // too many arguments to the factory method + public void testCaseK() { + runTest("casek"); + } + + // mixin of a class - should be an error (this one reported by the compiler due to a failed cast) + public void testCaseL() { + runTest("casel"); + } + + // mixin of a class - should be an error (this one reported by the annotation processing) + public void testCaseM() { + runTest("casem"); + } + + // factory returns class but interface specified - this is OK + public void testCaseN() { + runTest("casen"); + } + + // factory returns class but interface specified - not ok as class doesn't implement interface + public void testCaseO() { + runTest("caseo"); + } + + // interface subsetting used (factory returns class) - but only one method should be delegated + public void testCaseP() { + runTest("casep"); + } + + // factory return type implements two interfaces, both should be mixed as specified + public void testCaseQ() { + runTest("caseq"); + } + + // testing a pure marker interface - no methods added + public void testCaseR() { + runTest("caser"); + } + + // factory method has incompatible return type - verifyerror if we did use that factory + public void testCaseS() { + runTest("cases"); + } + + // weave info - what happens? + public void testCaseT() { + runTest("caset"); + } + + // -- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(DeclareMixinTests.class); + } + + protected File getSpecFile() { + return getClassResource("declareMixin.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc164/JointpointIdTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc164/JointpointIdTests.java new file mode 100644 index 000000000..68f769af6 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc164/JointpointIdTests.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc164; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * + * @author Andy Clement + */ +public class JointpointIdTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testCaseA() { + runTest("casea"); + } + + // -- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(JointpointIdTests.class); + } + + protected File getSpecFile() { + return getClassResource("joinpointid.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc164/ajc164.xml b/tests/src/test/java/org/aspectj/systemtest/ajc164/ajc164.xml new file mode 100644 index 000000000..e1c8e87b4 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc164/ajc164.xml @@ -0,0 +1,278 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs164/pr268710" title="generics aspects incorrect error"> + <compile files="GenericAspect.aj ConcreteAspect.aj" options="-1.5"/> + <run class="none.ConcreteAspect"> + <stdout> + <line text="Building an object class none.C"/> + <line text="C.init"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs164/pr268689" title="generics aspects npe"> + <compile files="GenericAspect.aj ConcreteAspect.aj" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs164/pr267559" title="generics and itd npe"> + <compile files="IMarker.java ClassB.java Aspect.java ClassA.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs164/pr266564" title="annotation style long"> + <compile files="AA.java" options="-1.5"/> + <run class="business.AA"/> + </ajc-test> + + <ajc-test dir="bugs164/pr266564" title="annotation style long - 2"> + <compile files="CC.java" options="-1.5"/> + <run class="business.CC"/> + </ajc-test> + + <ajc-test dir="bugs164/pr266420" title="unused private warning"> + <compile files="A.java" options="-1.5 -warn:unusedPrivate"/> + </ajc-test> + + <ajc-test dir="bugs164/pr266420" title="unused private warning - 2"> + <compile files="B.java" options="-1.5 -warn:unusedPrivate"> + <message kind="warning" text="The value of the field B.i is not used"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs164/pr266420" title="unused private warning - 3"> + <compile files="C.java" options="-1.5 -warn:unusedPrivate"> + <message kind="warning" text="The value of the field C.j is not used"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs164/pr265729" title="aspectpath model"> + <compile files="Aspect.java Orange.java Strawberry.java Fruit.java" outjar="library.jar" options="-emacssym"/> + <compile files="Orange.java Strawberry.java Fruit.java" aspectpath="library.jar" options="-emacssym"/> + <!-- + --> + </ajc-test> + + <ajc-test dir="bugs164/pr266220" title="generics and aop.xml"> + <compile files="Code.java"/> + <compile files="Isolator.java" outjar="aspects.jar" options="-1.5"/> + <run class="Code" classpath="aspects.jar" ltw="aop.xml"> + <stdout> + <line text="execution(void Code.main(String[]))"/> + <line text="execution(void Code.run())"/> + <line text="running..."/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs164/pr266165" title="optimizing if for constant reference - 1"> + <compile files="NeverWeave.java" options="-1.5 -Xlint:ignore -showWeaveInfo"/> + </ajc-test> + + <ajc-test dir="bugs164/pr266165" title="optimizing if for constant reference - 2"> + <compile files="AlwaysWeave.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs164/pr266165" title="optimizing if for constant reference - 3"> + <compile files="NeverWeave2.java" options="-1.5 -Xlint:ignore -showWeaveInfo"/> + </ajc-test> + + <ajc-test dir="bugs164/pr266165" title="optimizing if for constant reference - 4"> + <compile files="AlwaysWeave2.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs164/pr265695" title="anno inherited"> + <compile files="Asp.aj" options="-showWeaveInfo -1.5"> + <message kind="warning" line="22" text="advice defined"/> + <message kind="warning" line="24" text="advice defined"/> + <message kind="warning" line="26" text="advice defined"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs164/pr265695" title="new syntax for inherited anno - 1"> + <compile files="AspNew.aj" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs164/pr265695" title="new syntax for inherited anno - 3"> + <compile files="AspNew2.aj" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs164/pr265418" title="varargs"> + <compile files="A.java" options="-1.5"/> + <run class="A"> + <stdout> + <line text="varargs call(void A.a(Object[]))"/> + <line text="varargs call(void A.b(String[]))"/> + <line text="varargs call(void A.c(Integer[]))"/> + <line text="arrays call(void A.d(Object[]))"/> + <line text="arrays call(void A.e(String[]))"/> + <line text="arrays call(void A.f(Integer[]))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs164" title="parser problem for array subtypes"> + <compile files="PR148508.java"/> + <run class="PR148508"> + </run> + </ajc-test> + + <ajc-test dir="bugs164/pr265360" title="incorrect resolution of Date"> + <compile files="Foo.java Main.java" options="-1.5"> + <message kind="warning" text="no match for this type name: Date "/> + <message kind="warning" test="advice defined in"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs164/pr233032" title="dual preClinit"> + <compile files="A.java" options="-1.5"/> + <run class="A"/> + </ajc-test> + + <ajc-test dir="features164/aopconfig/one" title="aop config - 1"> + <compile files="A.java A2.java B.java foo.xml" options="-1.5 -showWeaveInfo -xmlConfigured"> + <message kind="weave" text="Join point 'staticinitialization(void A.<clinit>())' in Type 'A' (A.java:1) advised by before advice from 'A' (A.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void A2.<clinit>())' in Type 'A2' (A2.java:1) advised by before advice from 'A' (A.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void B.<clinit>())' in Type 'B' (B.java:1) advised by before advice from 'A' (A.java:2)"/> + </compile> + </ajc-test> + + <ajc-test dir="features164/aopconfig/one" title="aop config - 2"> + <compile files="A.java A2.java B.java B2.java foo2.xml" options="-1.5 -showWeaveInfo -xmlConfigured"> + <message kind="weave" text="Join point 'staticinitialization(void B.<clinit>())' in Type 'B' (B.java:1) advised by before advice from 'A' (A.java:2)"/> + </compile> + </ajc-test> + + <ajc-test dir="features164/aopconfig/two" title="aop config - 3"> + <!-- type pattern in the scope in foo.xml is complete nonsense --> + <compile files="A.java B.java foo.xml" options="-1.5 -Xlint:ignore -xmlConfigured"> + <message kind="error" text="Unable to parse scope as type pattern"/> + </compile> + </ajc-test> + + <ajc-test dir="features164/aopconfig/one" title="aop config - 4"> + <!-- excluding a type --> + <compile files="A.java A2.java B.java B2.java case4.xml" options="-1.5 -Xlint:ignore -xmlConfigured -showWeaveInfo"> + <message kind="weave" text="Join point 'staticinitialization(void A.<clinit>())' in Type 'A' (A.java:1) advised by before advice from 'A2' (A2.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void A.<clinit>())' in Type 'A' (A.java:1) advised by before advice from 'A' (A.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void A2.<clinit>())' in Type 'A2' (A2.java:1) advised by before advice from 'A2' (A2.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void A2.<clinit>())' in Type 'A2' (A2.java:1) advised by before advice from 'A' (A.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void B.<clinit>())' in Type 'B' (B.java:1) advised by before advice from 'A2' (A2.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void B.<clinit>())' in Type 'B' (B.java:1) advised by before advice from 'A' (A.java:2)"/> + </compile> + </ajc-test> + + <ajc-test dir="features164/aopconfig/one" title="aop config - 5"> + <!-- excluding a type --> + <compile files="A.java A2.java B.java B2.java case5.xml" options="-1.5 -Xlint:ignore -xmlConfigured -showWeaveInfo"> + <message kind="weave" text="Join point 'staticinitialization(void A.<clinit>())' in Type 'A' (A.java:1) advised by before advice from 'A2' (A2.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void A.<clinit>())' in Type 'A' (A.java:1) advised by before advice from 'A' (A.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void A2.<clinit>())' in Type 'A2' (A2.java:1) advised by before advice from 'A2' (A2.java:2)"/> + <message kind="weave" text="Join point 'staticinitialization(void A2.<clinit>())' in Type 'A2' (A2.java:1) advised by before advice from 'A' (A.java:2)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs164/pr263310" title="inner handles"> + <compile files="HandleTestingAspect.java" options="-1.5 -emacssym -Xlint:ignore"/> + </ajc-test> + + <ajc-test dir="bugs164/pr263666" title="around advice handles"> + <compile files="x/A.java x/B.java x/OverrideOptions.aj" options="-1.5 -emacssym"/> + </ajc-test> + + <ajc-test dir="bugs164" title="ajcthis not read"> + <compile files="pr195090.java" options="-1.5 -warn:+unusedArgument"> + </compile> + </ajc-test> + + <ajc-test dir="bugs164/pr256779" title="anno decprecedence"> + <compile files="ThisAspect.java OtherAspect.java" options="-1.5"/> + <run class="com.ThisAspect" ltw="aop.xml"/> + </ajc-test> + + <ajc-test dir="bugs164/pr262905" title="recursive cflow"> + <compile files="A.java" options="-1.5"> + <message kind="warning" line="5" text="advice defined"/> + <message kind="error" line="3" text="circular"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs164/pr194314" title="broken lvt - 1"> + <compile files="Service.java IService.java Main.java ServiceInterceptor.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs164/pr194314" title="broken lvt - 2"> + <compile files="Service.java IService.java Main.java ServiceInterceptorCodeStyle.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs164/pr194314" title="broken lvt - 3"> + <compile files="ITDOne.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs164/pr262509" title="debugging before advice"> + <compile files="Foo.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs164/pr262509" title="debugging before advice - 2"> + <compile files="Foo2.java" options="-1.5 -preserveAllLocals"/> + </ajc-test> + + <ajc-test dir="bugs164/pr262509" title="debugging before advice - 3"> + <compile files="Foo3.java" options="-1.5 -preserveAllLocals"/> + </ajc-test> + + <ajc-test dir="bugs164/pr246393" title="rogue errors - 1"> + <compile files="D.java" options="-1.5"> + <message kind="error" line="2" text="error on token"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs164/pr262257" title="name clash"> + <compile files="C.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs164/pr260384" title="compiling spring"> + <compile files="Broken.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs164/pr260384" title="compiling spring - 2"> + <compile files="Broken2.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs164/pr260384" title="compiling spring - 3"> + <compile files="C.java" options="-1.5 -emacssym"/> + </ajc-test> + + <ajc-test dir="bugs164/pr260384" title="compiling spring - 4"> + <compile files="D.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs164/pr164016" title="ataspectj decp 164016"> + <compile files="Code.aj" options="-1.5"/> + <run class="test.Code"/> + </ajc-test> + + + <ajc-test dir="bugs164/pr164016" title="ataspectj decp 164016 - 2"> + <compile files="Code.java TargetBad.java TargetGood.java" aspectpath="code.jar" options="-1.5"/> + <run class="test.Code"/> + </ajc-test> + + <ajc-test dir="bugs164/pr258788" title="ataspectj decp 258788"> + <compile files="NameAware.java NameManager.java NameManagerImpl.java StartClass.java TargetClass.java TestAspect.java" options="-1.5"/> + <run class="com.StartClass"/> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc164/declareMixin.xml b/tests/src/test/java/org/aspectj/systemtest/ajc164/declareMixin.xml new file mode 100644 index 000000000..02853f93a --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc164/declareMixin.xml @@ -0,0 +1,173 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="features164/declareMixin" title="casea"> + <compile files="CaseA.java" options="-1.5"/> + <run class="CaseA"> + <stdout> + <line text="Delegate factory invoked"/> + <line text="methodOne running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features164/declareMixin" title="caseb"> + <compile files="CaseB.java" options="-1.5"/> + <run class="CaseB"> + <stdout> + <line text="Delegate factory invoked"/> + <line text="methodOne running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features164/declareMixin" title="casec"> + <compile files="CaseC.java" options="-1.5"/> + <run class="CaseC"> + <stdout> + <line text="Delegate factory invoked for CaseC instance"/> + <line text="methodOne running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features164/declareMixin" title="cased"> + <compile files="CaseD.java" options="-1.5"/> + <run class="CaseD"> + <stdout> + <line text="Delegate factory invoked for CaseD instance"/> + <line text="methodOne running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features164/declareMixin" title="casee"> + <compile files="CaseE.java" options="-1.5"/> + <run class="CaseE"> + <stdout> + <line text="Delegate factory invoked for CaseE instance: a"/> + <line text="methodOne running on CaseE instance: a"/> + <line text="Delegate factory invoked for CaseE instance: b"/> + <line text="methodTwo running on CaseE instance: b"/> + <line text="methodOne running on CaseE instance: a"/> + <line text="methodTwo running on CaseE instance: b"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features164/declareMixin" title="casef"> + <compile files="CaseF.java" options="-1.5"/> + <run class="CaseF"> + <stdout> + <line text="Delegate factory invoked for CaseF instance"/> + <line text="methodOne running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features164/declareMixin" title="caseg"> + <compile files="CaseG.java" options="-1.5"/> + <run class="CaseG"> + <stdout> + <line text="Delegate factory invoked for instance of A"/> + <line text="run() executing on behalf of A"/> + <line text="Delegate factory invoked for instance of B"/> + <line text="run() executing on behalf of B"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features164/declareMixin" title="caseh"> + <compile files="CaseH.java" options="-1.5"> + <message kind="error" text="The value for annotation attribute DeclareMixin"/> + </compile> + </ajc-test> + + <ajc-test dir="features164/declareMixin" title="casei"> + <compile files="CaseI.java" options="-1.5"> + <message kind="error" text="Types listed in the 'interfaces'"/> + </compile> + </ajc-test> + + <ajc-test dir="features164/declareMixin" title="casej"> + <compile files="CaseJ.java" options="-1.5"> + <message kind="error" text="createImplementation1"/> + <message kind="error" text="Method 'int X.createImplementation2(java.lang.Object)': factory methods "/> + </compile> + </ajc-test> + + <ajc-test dir="features164/declareMixin" title="casek"> + <compile files="CaseK.java" options="-1.5"> + <message kind="error" text="factory methods for a mixin can take a maximum of one parameter"/> + </compile> + </ajc-test> + + <ajc-test dir="features164/declareMixin" title="casel"> + <compile files="CaseL.java" options="-1.5"> + <message kind="error" text="Cannot cast from CaseL to C"/> + </compile> + </ajc-test> + + <ajc-test dir="features164/declareMixin" title="casem"> + <compile files="CaseM.java" options="-1.5"> + <message kind="error" text=": factory methods for a mixin must either return an interface type or specify interfaces in the annotation and return a class"/> + </compile> + </ajc-test> + + <ajc-test dir="features164/declareMixin" title="casen"> + <compile files="CaseN.java" options="-1.5"/> + <run class="CaseN"> + <stdout> + <line text="foo() running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features164/declareMixin" title="caseo"> + <compile files="CaseO.java" options="-1.5"> + <message kind="error" text="factory method does not return something that implements 'I'"/> + </compile> + </ajc-test> + + <ajc-test dir="features164/declareMixin" title="casep"> + <compile files="CaseP.java" options="-1.5"/> + <run class="CaseP"> + <stdout> + <line text="foo() running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features164/declareMixin" title="caseq"> + <compile files="CaseQ.java" options="-1.5"/> + <run class="CaseQ"> + <stdout> + <line text="foo() running"/> + <line text="goo() running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features164/declareMixin" title="caser"> + <compile files="CaseR.java" options="-1.5"/> + <run class="CaseR"> + <stdout> + <line text="true"/> + <line text="false"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features164/declareMixin" title="cases"> + <compile files="CaseS.java" options="-1.5"> + <message kind="error" text="not compatible"/> + </compile> + </ajc-test> + + <ajc-test dir="features164/declareMixin" title="caset"> + <compile files="CaseT.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Mixing interface 'I' (CaseT.java) into type 'CaseT' (CaseT.java)"/> + </compile> + </ajc-test> +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc164/joinpointid.xml b/tests/src/test/java/org/aspectj/systemtest/ajc164/joinpointid.xml new file mode 100644 index 000000000..6f2bdc79b --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc164/joinpointid.xml @@ -0,0 +1,19 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="features164/joinpointid" title="casea"> + <compile files="Driver.java" options="-1.5"/> + <run class="Driver"> + <stdout> + <line text="At void A.mone() id=0 state=0"/> + <line text="At void A.mtwo() id=1 state=0"/> + <line text="At void A.mone() id=0 state=1"/> + <line text="At void A.mtwo() id=1 state=1"/> + <line text="At void A.mone() id=0 state=2"/> + <line text="At void A.mtwo() id=1 state=2"/> + </stdout> + </run> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc165/Ajc165Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc165/Ajc165Tests.java new file mode 100644 index 000000000..196e07ca1 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc165/Ajc165Tests.java @@ -0,0 +1,124 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc165; + +import java.io.File; +import java.util.List; + +import org.aspectj.bridge.IMessage; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.weaver.LintMessage; + +import junit.framework.Test; + +public class Ajc165Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + +// fix is too disruptive for 1.6.5 +// public void testGenericsBridge_pr279983() { +// runTest("generics bridge"); +// } + + public void testVerifyError_pr277959() { + runTest("verifyerror"); + } + + // on the build machine (linux) - these tests don't expect the right output - i suspect due to CR/LF issues + // since that will affect the generated name of the if methods + + // public void testIfNames_pr277508() { + // runTest("if method names"); + // } + // + // public void testIfNames_pr277508_2() { + // runTest("if method names - 2"); + // } + + public void testDecAnnoMethod_pr275625() { + runTest("dec anno method"); + } + + public void testDecAnnoField_pr275625() { + runTest("dec anno field"); + } + + // check ITD can replace a generated default constructor + public void testItdDefaultCtor_pr275032() { + runTest("itd default ctor"); + } + + // check ITD can't overwrite an existing constructor + public void testItdDefaultCtor_pr275032_2() { + runTest("itd default ctor - 2"); + } + + // binary weaving version of case 2 - check ITD can't overwrite an existing constructor + public void testItdDefaultCtor_pr275032_3() { + runTest("itd default ctor - 3"); + } + + // binary weaving version of case 4 - check ITD can replace a generated default constructor + public void testItdDefaultCtor_pr275032_4() { + runTest("itd default ctor - 4"); + } + + public void testVerifyOnAnnoBind_pr273628() { + runTest("verifyerror on anno bind"); + } + + public void testFunkyPointcut_pr272233() { + runTest("funky pointcut"); + } + + public void testFunkyPointcut_pr272233_2() { + runTest("funky pointcut 2"); + } + + public void testAnnotationStyle_pr265356() { + runTest("annotation style message positions"); + List<IMessage> ms = ajc.getLastCompilationResult().getWarningMessages(); + boolean checked = true; + // Look for the message relating to 'List' and check the offsets + for (int i = 0; i < ms.size(); i++) { + LintMessage m = (LintMessage) ms.get(i); + if (m.toString().indexOf("List") != -1) { + // 225/228 on windows - 237/240 on linux + if (!(m.getSourceStart() == 225 || m.getSourceStart() == 237)) { + fail("Did not get expected start position, was:" + m.getSourceStart()); + } + if (!(m.getSourceEnd() == 228 || m.getSourceEnd() == 240)) { + fail("Did not get expected end position, was:" + m.getSourceEnd()); + } + checked = true; + } + } + assertTrue("Failed to check the message", checked); + } + + public void testAroundCall_pr271169() { + runTest("around call npe"); + } + + public void testGenericITD_pr272825() { + runTest("generic ITD"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc165Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc165.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc165/AllTestsAspectJ165.java b/tests/src/test/java/org/aspectj/systemtest/ajc165/AllTestsAspectJ165.java new file mode 100644 index 000000000..f89671e22 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc165/AllTestsAspectJ165.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc165; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ165 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.6.5 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc165Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc165/WorldTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc165/WorldTests.java new file mode 100644 index 000000000..171aee572 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc165/WorldTests.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc165; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.weaver.UnresolvedType; +import org.aspectj.weaver.bcel.BcelWorld; + +public class WorldTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testWorldSize() { + BcelWorld world = new BcelWorld("../weaver5/bin/"); + assertEquals(9, world.getFixed().size()); // 9 primitive types + assertEquals(0, world.getExpendable().size()); // nothing loaded + + world.resolve(UnresolvedType.forSignature("LMA;")); + assertEquals(9, world.getFixed().size()); + assertEquals(1, world.getExpendable().size()); + + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(WorldTests.class); + } + + protected File getSpecFile() { + return new File("../tests/src/org/aspectj/systemtest/ajc165/world.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc165/ajc165.xml b/tests/src/test/java/org/aspectj/systemtest/ajc165/ajc165.xml new file mode 100644 index 000000000..6c3b74d71 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc165/ajc165.xml @@ -0,0 +1,117 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs165/pr277959" title="verifyerror"> + <compile files="AOPTest.java CodeAspect.java" options="-1.5"/> + <run class="example.AOPTest"/> + </ajc-test> + + <ajc-test dir="bugs165/pr277508" title="if method names"> + <compile files="Basic.java" options="-1.5"/> + <run class="Basic"> + <stdout> + <line text="if method: public static final boolean X.ajc$if$1ba()"/> + <line text="if method: public static final boolean X.ajc$if$177()"/> + <line text="if method: public static final boolean X.ajc$if$165()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs165/pr277508" title="if method names - 2"> + <compile files="Basic2.java" options="-1.5"/> + <run class="Basic2"> + <stdout> + <line text="if method: public static final boolean X.ajc$if$16d()"/> + <line text="if method: public static final boolean X.ajc$if$17f()"/> + <line text="if method: public static final boolean X.ajc$if$1c0()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs165/pr275625" title="dec anno method"> + <compile files="A.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs165/pr275625" title="dec anno field"> + <compile files="F.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs165/pr275032" title="itd default ctor"> + <compile files="A.java X.java" options="-1.5 -Xlint:ignore"/> + <run class="A"> + <stdout> + <line text="itd ctor"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs165/pr275032/c2" title="itd default ctor - 2"> + <compile files="A.java X.java" options="-1.5 -Xlint:ignore"> + <message kind="error" text="inter-type declaration from X conflicts with existing"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs165/pr275032/c2" title="itd default ctor - 3"> + <compile files="A.java" options="-outjar foo.jar"/> + <compile files="X.java" options="-1.5 -Xlint:ignore" inpath="foo.jar"> + <message kind="error" text="inter-type declaration from X conflicts with existing"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs165/pr275032" title="itd default ctor - 4"> + <compile files="A.java" options="-outjar foo.jar"/> + <compile files="X.java" options="-1.5" inpath="foo.jar"> + </compile> + <run class="A"> + <stdout> + <line text="itd ctor"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs165/pr272233" title="funky pointcut"> + <compile files="Iffy.java" options="-1.5"> + <message kind="warning" text="void is not a generic type"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs165/pr272233" title="funky pointcut 2"> + <compile files="Iffy2.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="advised by before advice from 'Iffy2' (Iffy2.java:11)"/> + <message kind="weave" text="advised by before advice from 'Iffy2' (Iffy2.java:8)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs165/pr265356" title="annotation style message positions"> + <compile files="Main.java" options="-1.5"> + <message kind="warning" line="11"/> + <message kind="warning" line="13"/> + <message kind="warning" line="14"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs165/pr271169" title="around call npe"> + <compile files="HypChecksums.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs165/pr273628" title="verifyerror on anno bind"> + <compile files="AnnotationAspect.java ApiDescriptor.java AspectTargetClass.java MonitorableMethod.java TestPointcutAnnotationAspect.java" options="-1.5"/> + <run class="p.TestPointcutAnnotationAspect"/> + </ajc-test> + + <ajc-test dir="bugs165/pr272825" title="generic ITD"> + <compile files="Concrete.java GenericSuper.java ITDOfMethod.aj Main.java" options="-1.5"/> + <run class="Main"> + <stdout> + <line text="In normal method"/> + <line text="else"/> + <line text="1"/> + <line text="In ITD method"/> + <line text="with"/> + <line text="2"/> + </stdout> + </run> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc165/world.xml b/tests/src/test/java/org/aspectj/systemtest/ajc165/world.xml new file mode 100644 index 000000000..e9c113cc5 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc165/world.xml @@ -0,0 +1,5 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc166/Ajc166Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc166/Ajc166Tests.java new file mode 100644 index 000000000..4622ae492 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc166/Ajc166Tests.java @@ -0,0 +1,105 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc166; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class Ajc166Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testParentsLTW_286473_binary() { + runTest("parents ltw - binary"); + } + + public void testParentsLTW_286473_ltw() { + runTest("parents ltw - ltw"); + } + + public void testNpeForJavacBuilt_290227() { + runTest("npe for javac built"); + } + + public void testBinaryDecpSuperRewrite_290087() { + runTest("binary decp super rewrite"); + } + + public void testITDannos_288049() { + runTest("itd decanno"); + } + + public void testVerifyErrorAnnoStyle_288712() { + runTest("verifyerror anno style"); + } + + public void testMungerCCE_288635() { + runTest("munger cce"); + } + + public void testMungerCCE_288635_2() { + runTest("munger cce - 2"); + } + + public void testNPEonBadAspectDecl_286375() { + runTest("npe on bad aspect decl"); + } + + // + // public void testAnnoModifierOrdering_287597_1() { + // runTest("anno modifier ordering - 1"); + // } + // + // public void testDeclareAnnoCompoundExpression_287613() { + // runTest("dec anno compound expressions"); + // } + + public void testHasMember_284862() { + runTest("npe hasmember"); + } + + public void testHasMember_284862_2() { + runTest("npe hasmember - 2"); + } + + public void testHasMember_284862_3() { + runTest("npe hasmember - 3"); + } + + // fix is too disruptive for 1.6.5 + public void testGenericsBridge_pr279983() { + runTest("generics bridge"); + } + + public void testGenericsDecp_pr282299() { + runTest("generics and decp"); + } + + public void testGenericSigProblem_pr284297() { + runTest("generic signature problem"); + } + + public void testInterfacesSerializable_pr283229() { + runTest("interfaces and serializable"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc166Tests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc166.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc166/AllTestsAspectJ166.java b/tests/src/test/java/org/aspectj/systemtest/ajc166/AllTestsAspectJ166.java new file mode 100644 index 000000000..d15a59c0f --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc166/AllTestsAspectJ166.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc166; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ166 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.6.6 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc166Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc166/ajc166.xml b/tests/src/test/java/org/aspectj/systemtest/ajc166/ajc166.xml new file mode 100644 index 000000000..d19a3b485 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc166/ajc166.xml @@ -0,0 +1,147 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs166/pr286473" title="parents ltw - binary"> + <compile files="Anno.java Top.java Middle.java Bottom.java" outjar="code.jar" options="-1.5 -Xlint:ignore"/> + <compile files="Mark.java LTWTest.java" inpath="code.jar" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Type 'Mark$IMarker' (Mark.java) has intertyped method from 'Mark' (Mark.java:'java.lang.String Mark$IMarker.markMethod()')"/> + <message kind="weave" text="Extending interface set for type 'Top' (Top.java) to include 'Mark$IMarker' (Mark.java)"/> + <message kind="weave" text="Type 'Top' (Top.java) has intertyped method from 'Mark' (Mark.java:'java.lang.String Mark$IMarker.markMethod()')"/> + </compile> + <run class="LTWTest"> + <stdout> + <line text="Bottom.getMethods()"/> + <line text="bottom : Bottom"/> + <line text="markMethod : Top"/> + <line text="middle : Middle"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs166/pr286473" title="parents ltw - ltw"> + <compile files="Anno.java Top.java Middle.java Bottom.java" outjar="code.jar" options="-1.5 -Xlint:ignore"/> + <compile files="Mark.java LTWTest.java" classpath="code.jar" options="-1.5"> + </compile> + <run class="LTWTest" ltw="aop.xml"> + <stderr> + <line text="Extending interface set for type 'Top' (Top.java) to include 'Mark$IMarker' (Mark.java)"/> + <line text="Type 'Top' (Top.java) has intertyped method from 'Mark' (Mark.java:'java.lang.String Mark$IMarker.markMethod()')"/> + <line text="Type 'Mark$IMarker' (Mark.java) has intertyped method from 'Mark' (Mark.java:'java.lang.String Mark$IMarker.markMethod()')"/> +<!-- + <line text="Extending interface set for type 'Bottom' (Bottom.java) to include 'Mark$IMarker' (Mark.java)"/> + <line text="Type 'Bottom' (Bottom.java) has intertyped method from 'Mark' (Mark.java:'java.lang.String Mark$IMarker.markMethod()')"/> + <line text="Type 'Mark$IMarker' (Mark.java) has intertyped method from 'Mark' (Mark.java:'java.lang.String Mark$IMarker.markMethod()')"/> + <line text="Extending interface set for type 'Middle' (Middle.java) to include 'Mark$IMarker' (Mark.java)"/> + <line text="Type 'Middle' (Middle.java) has intertyped method from 'Mark' (Mark.java:'java.lang.String Mark$IMarker.markMethod()')"/> + <line text="Extending interface set for type 'Top' (Top.java) to include 'Mark$IMarker' (Mark.java)"/> + <line text="Type 'Top' (Top.java) has intertyped method from 'Mark' (Mark.java:'java.lang.String Mark$IMarker.markMethod()')"/> + --> + </stderr> + <stdout> + <line text="Bottom.getMethods()"/> + <line text="bottom : Bottom"/> + <line text="markMethod : Top"/> + <line text="middle : Middle"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs166/pr290227" title="npe for javac built"> + <compile files="" inpath="javacCode.jar" options="-1.5 -Xlint:ignore"/> + </ajc-test> + + <ajc-test dir="bugs166/pr288049" title="itd decanno"> + <compile files="org/othtests/MyClass.java org/othtests/MySubClass.java org/othtests/AddSomeAnnotation.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="'public java.lang.String org.othtests.MySubClass.doOne()' (MySubClass.java:5) is annotated with"/> + <message kind="weave" text="'public java.lang.String org.othtests.MySubClass.doTwo()' (MySubClass.java:9) is annotated with"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs166/pr288712" title="verifyerror anno style"> + <compile files="answers/Answer2h.java figures/FigureElement.java figures/Line.java figures/Point.java figures/ShapeFigureElement.java Main.java" options="-1.5"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="bugs166/pr288635" title="munger cce - 2"> + <compile files="AddAnnotation.java MakeItd.java InterceptTraceds.java TestClass.java Anno.java" options="-1.5 -XterminateAfterCompilation"/> + <run class="TestClass" ltw="aop1.xml"> + <stdout> + <line text="Executing execution(int TestClass.doAnother()) on level debug"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs166/pr288635" title="munger cce"> + <compile files="org/tests/atann/AddAnnotations.aj org/tests/atann/AddITDDoMethod.aj org/tests/atann/InterceptTraceds.aj org/tests/atann/TestClass.java org/tests/atann/Traced.java" options="-1.5"/> + <run class="org.tests.atann.TestClass"> + <stdout> + <line text="Executing execution(String org.tests.atann.TestClass.doAnnotated()) on level debug"/> + <line text="Executing execution(int org.tests.atann.TestClass.doITDAnnotation()) on level debug"/> + <line text="Executing execution(int org.tests.atann.TestClass.doAnother()) on level debug"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs166/pr286375" title="npe on bad aspect decl"> + <compile files="DatabaseOperationMonitor.java" options="-1.5" outjar="wibble.jar"/> + <compile files="" inpath="wibble.jar" options="-1.5"/> + </ajc-test> + + + <ajc-test dir="bugs166/pr290087" title="binary decp super rewrite"> + <compile files="Bean.java BeanChild.java GenericParent.java" options="-1.5" outjar="base.jar"/> + <compile files="Interface.java InterfaceParent.java BeanHasInterface.java" inpath="base.jar" options="-1.5"/> + <run class="BeanChild"/> + </ajc-test> + + <ajc-test dir="bugs166/pr287597" title="anno modifier ordering - 1"> + <compile files="A.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="foo"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs166/pr287613" title="dec anno compound expressions"> + <compile files="DeclareAnnot.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs166/pr284862" title="npe hasmember"> + <compile files="InterfaceToAdd.java AnnotatedMethodImpl.aj AspectToMatch.aj AnnotatedMethodInterface.java Entity.java EntityClass.java PresentAnnotation.java SearchAnnotation.java" options="-1.5 -XhasMember"/> + </ajc-test> + + <ajc-test dir="bugs166/pr284862" title="npe hasmember - 2"> + <compile files="AnnotatedMethodInterface.java InterfaceToAdd.java AnnotatedMethodImpl.aj AspectToMatch.aj Entity.java EntityClass.java PresentAnnotation.java SearchAnnotation.java" options="-1.5 -XhasMember"/> + </ajc-test> + + <ajc-test dir="bugs166/pr284862" title="npe hasmember - 3"> + <compile files="AnnotatedMethodInterface.java InterfaceToAdd.java AnnotatedMethodImpl.aj AspectToMatch.aj Entity.java EntityClass.java PresentAnnotation.java SearchAnnotation.java" options="-Xset:pipelineCompilation=false -1.5 -XhasMember"/> + </ajc-test> + + <ajc-test dir="bugs165/pr279983" title="generics bridge"> + <compile files="X.java" options="-1.5"/> + <run class="X"/> + </ajc-test> + + <ajc-test dir="bugs166/pr282299" title="generics and decp"> + <compile files="Code.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs166/pr284297" title="generic signature problem"> + <compile files="DomainLogic.java DomainObject.java FancyDomainLogic.java" options="-1.5" outjar="code.jar"/> + <compile files="FancyDomainLogicImpl.java" options="-1.5" classpath="code.jar"/> + </ajc-test> + + <ajc-test dir="bugs166/pr283229" title="interfaces and serializable"> + <compile files="Foo.java" options="-1.5 -XaddSerialVersionUID"/> + <run class="Foo"> + <!-- + <stdout> + <line text="if method: public static final boolean X.ajc$if$1ba()"/> + <line text="if method: public static final boolean X.ajc$if$177()"/> + <line text="if method: public static final boolean X.ajc$if$165()"/> + </stdout> + --> + </run> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc167/Ajc167Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc167/Ajc167Tests.java new file mode 100644 index 000000000..7360222ba --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc167/Ajc167Tests.java @@ -0,0 +1,89 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc167; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class Ajc167Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + // public void testGenericsItds_298665() { + // runTest("itd generics"); + // } + public void testGenericAspectSignatures_296533() { + runTest("generic aspect signatures"); + } + + public void testOptimizingAnnotationStringValueBinding() { + runTest("optimizing string anno value binding"); + } + + public void testOptimizingAnnotationBinding() { + runTest("optimizing annotation binding"); + } + + // bit flakey - can depend on machine load + // public void testOptimizingAnnotationBindingPerfTest() { + // runTest("optimizing annotation binding - 2"); + // } + + /* + * public void testPerThisLTW_295092() { runTest("perthis ltw"); } + */ + + public void testNpeOnBrokenCode_296054() { + runTest("npe on broken code"); + } + + public void testBrokenGeneratedCode_296040() { + runTest("broken generated code"); + } + + public void testHierarchyBuilderNPE_pr293457() { + runTest("hierarchy builder npe"); + } + + public void testTimers_1() { + runTest("timers - 1"); + } + + // Test harness parse of -Xset:a=b,c=d will see c=d as a second option + // public void testTimers_2() { + // runTest("timers - 2"); + // } + + public void testAnnoMatching_pr293203() { + runTest("anno matching"); + } + + public void testScalaOuterClassNames_pr288064() { + runTest("outer class names - scala"); + } + + public void testScalaOuterClassNames_pr288064_ltw() { + runTest("outer class names - scala - ltw"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc167Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc167.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc167/AllTestsAspectJ167.java b/tests/src/test/java/org/aspectj/systemtest/ajc167/AllTestsAspectJ167.java new file mode 100644 index 000000000..c587e4e2f --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc167/AllTestsAspectJ167.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc167; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ167 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.6.7 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc167Tests.suite()); + suite.addTest(OverweavingTests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc167/IntertypeTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc167/IntertypeTests.java new file mode 100644 index 000000000..5aa2d4110 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc167/IntertypeTests.java @@ -0,0 +1,77 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc167; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * Tests for the new all singing all dancing intertype syntax. + * + * @author Andy Clement + */ +public class IntertypeTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + // absolutely trivial, just parse something and dont crash + public void testSimple() { + runTest("simple"); + } + + // simple field inside the intertype scope + public void testSimpleWithField() { + runTest("simple with field"); + } + + // simple field inside the intertype scope and method after the intertype scope + public void testSimpleWithField2() { + runTest("simple with field2"); + } + + // now a method that new's up an instance of the type targetted by the intertype scope + public void testNewInstance() { + runTest("new instance"); + } + + // now aspect method attempts to new up target of the itd scope and access something introduced by it + public void testNewInstanceAndAccess() { + runTest("new instance and access"); + } + + // two fields + public void testNewInstanceAndAccess2() { + runTest("new instance and access to two fields"); + } + + // more tests: + // intertype X { int a,b,c=4; } + // intertype X { int a=4,b=3; } // can we say that? + + // extends/implements on the intertype become declare parents + // annotations on the intertype become declare @type + + // what about recovery when we have a problem leaving the scope of the intertype block? How do we make sure + // we don't accidentally use the activeScope for ordinary methods? Can we even check that... + + + // -- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(IntertypeTests.class); + } + + protected File getSpecFile() { + return new File("../tests/src/org/aspectj/systemtest/ajc167/intertype.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc167/OverweavingTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc167/OverweavingTests.java new file mode 100644 index 000000000..ebd66a0b5 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc167/OverweavingTests.java @@ -0,0 +1,84 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc167; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * Testing whether AspectJ can overweave. Overweaving is where we attempt to weave something that has already been woven. The simple + * rule followed is that aspects that applied to the type before are not applied this time around (if they are visible to the + * weaver). + * + * @author Andy Clement + */ +public class OverweavingTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testGetSet1() { + runTest("getset - 1"); // testing what should happen for get/set + } + + public void testGetSet2() { + runTest("getset - 2"); // testing what actually happens when overweaving + } + + public void testGetSetTjp1() { + runTest("getset - tjp - 1"); + } + + public void testCalls1() { + runTest("calls - 1"); // testing what should happen for calls + } + + public void testCalls2() { + runTest("calls - 2"); // testing what actually happens when overweaving + } + + public void testCallsTjp1() { + runTest("calls - tjp - 1"); + } + + public void testComplex() { + runTest("really messy"); + } + + public void testSimple() { + runTest("simple"); + } + + /** + * Now an aspect used on the original weave is mentioned in the aop.xml - we shouldn't apply it again! + */ + public void testMessy() { + runTest("messy"); + } + + /** + * Testing a shadow munger created to support cflow + */ + public void testCflow() { + runTest("cflow"); + } + + // -- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(OverweavingTests.class); + } + + protected File getSpecFile() { + return getClassResource("overweaving.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc167/ajc167.xml b/tests/src/test/java/org/aspectj/systemtest/ajc167/ajc167.xml new file mode 100644 index 000000000..c1acde861 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc167/ajc167.xml @@ -0,0 +1,143 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + + <ajc-test dir="bugs167/pr296533" title="generic aspect signatures"> + <compile files="testing/AbstractCache.aj testing/Resource.java testing/ResourceCache.aj testing/ResourceManager.java testing/TestRunner.java" options="-1.5"/> + <run class="testing.TestRunner"> + <stdout> + <line text="Cache hits: 5"/> + <line text="Cache hits: 2"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs167/pr296501" title="optimizing string anno value binding"> + <compile files="StringBinding.java" options="-1.5"/> + <run class="StringBinding"> + <stdout> + <line text="hello world"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs167/pr296484" title="optimizing annotation binding"> + <compile files="AnnoBinding.java" options="-1.5"/> + <run class="AnnoBinding"/> + </ajc-test> + + <ajc-test dir="bugs167/pr296484" title="optimizing annotation binding - 2"> + <compile files="Perf.java" options="-1.5"/> + <run class="Perf"/> + </ajc-test> + + <ajc-test dir="bugs167/pr295092" title="perthis ltw"> + <compile files="AbstractAspect.aj" options="-1.5" outjar="aspects.jar"/> + <compile files="Wibble.java"/> + <run class="Wibble" ltw="aop.xml" classpath="aspects.jar"/> + </ajc-test> + + <ajc-test dir="bugs167/pr296054" title="npe on broken code"> + <compile files="Demo.java AnnotAspect.aj" options="-1.5 -emacssym"> + <message kind="error" text="The value for"/> + <message kind="error" text="cannot convert"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs167/pr296040" title="broken generated code"> + <compile files="ErrorClass.java" options="-1.5" classpath="gc10rc4.jar"/> + <run class="ErrorClass"/> + </ajc-test> + + <ajc-test dir="bugs167/pr293457" title="hierarchy builder npe"> + <compile files="com/citi/gdos/smart/applib/service/cache/CachingIntroduction.aj org/springmodules/cache/annotations/Cacheable.java" options="-1.5 -emacssym"> + <message kind="warning" text="no match for this type name: Setter"/> + <message kind="error" text="Setter cannot be resolved to a type"/> + <message kind="error" text="The attribute modelId is undefined for the"/> + </compile> + </ajc-test> + + <ajc-test dir="features167/timers/one" title="timers - 1"> + <compile files="Code.java Code2.java" outjar="code.jar" options="-1.5 -Xlint:ignore"/> + <compile files="Asp.java" options="-1.5 -Xlint:ignore" outjar="asp.jar"/> + <run class="Code2" ltw="aop.xml" classpath="code.jar;asp.jar"> + <stderr> + <line text="info AspectJ"/> + <line text="info register"/> + <line text="info using"/> + <line text="info register"/> + <line text="info Pointcut match"/> + <line text="info Time"/> + <line text="info ---"/> + <line text="info processing"/> + <line text="info Pointcut fast"/> + <line text="info Time"/> + <line text="info ---"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="features167/timers/one" title="timers - 2"> + <compile files="Code.java Code2.java Asp.java" options="-1.5 -timers -Xset:timersPerJoinpoint=8,timersPerFastMatchCall=3"> +<!-- <line text="info AspectJ"/> + <line text="info register"/> + <line text="info using"/> + <line text="info register"/> + <line text="info processing"/> + <line text="info Pointcut fast"/> + <line text="info Time"/> + <line text="info -"/> + <line text="info Pointcut match"/> + <line text="info Time"/> + <line text="info -"/> + --> + </compile> + </ajc-test> + + + <ajc-test dir="bugs167/pr293510" title="execution fastmatch - 1"> + <compile files="CaseOne.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void pkg.C.m())' in Type 'pkg.C' (CaseOne.java:10) advised by before advice from 'pkg.X' (CaseOne.java:14)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs167/pr293510" title="execution fastmatch - 2"> + <compile files="CaseTwo.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void pkg.C.m())' in Type 'pkg.C' (CaseTwo.java:9) advised by before advice from 'pkg.X' (CaseTwo.java:13)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs167/pr293203" title="anno matching"> + <compile files="Foo.java" options="-1.5"/> + <run class="Foo"> + <stdout> + <line text="advice"/> + <line text="advice"/> + <line text="advice"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs167/pr288064" title="outer class names - scala"> + <compile files="Main.java Outer.java Aspect.java" options="-1.5"/> + <run class="test.Main"> + <stdout> + <line text="advice"/> + <line text="method"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs167/pr288064" title="outer class names - scala - ltw"> + <compile files="Main.java Outer.java" outjar="app.jar" options="-1.5"/> + <compile files="Aspect.java" outjar="asp.jar" options="-Xlint:ignore -1.5"/> + <run class="test.Main" classpath="app.jar;asp.jar" ltw="aop.xml"> + <stdout> + <line text="advice"/> + <line text="method"/> + </stdout> + </run> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc167/intertype.xml b/tests/src/test/java/org/aspectj/systemtest/ajc167/intertype.xml new file mode 100644 index 000000000..a432ee188 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc167/intertype.xml @@ -0,0 +1,41 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="features167/intertype" title="simple"> + <compile files="Simple.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="features167/intertype" title="simple with field"> + <compile files="Two.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="features167/intertype" title="simple with field2"> + <compile files="Three.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="features167/intertype" title="new instance"> + <compile files="Four.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="features167/intertype" title="new instance and access"> + <compile files="Five.java" options="-1.5"/> + <run class="Five"> + <stdout> + <line text="5"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features167/intertype" title="new instance and access to two fields"> + <compile files="Six.java" options="-1.5"/> + <run class="Six"> + <stdout> + <line text="5"/> + </stdout> + </run> + </ajc-test> + + + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc167/overweaving.xml b/tests/src/test/java/org/aspectj/systemtest/ajc167/overweaving.xml new file mode 100644 index 000000000..044223d88 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc167/overweaving.xml @@ -0,0 +1,198 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="features167/overweaving/getset" title="getset - 1"> + <compile files="A.aj B.aj Class1.java Class2.java" options="-1.5"/> + <run class="Class1"> + <stdout> + <line text="B:set(String Class1.message)"/> + <line text="A:get(PrintStream java.lang.System.out)"/> + <line text="A:get(String Class1.message)"/> + <line text="Class1.main"/> + </stdout> + </run> + + <run class="Class2"> + <stdout> + <line text="B:set(String Class2.message)"/> + <line text="A:get(PrintStream java.lang.System.out)"/> + <line text="A:get(String Class2.message)"/> + <line text="Class2.main"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features167/overweaving/getset" title="getset - 2"> + <compile files="A.aj Class1.java" options="-1.5"/> + <compile files="B.aj" options="-1.5 -Xlint:ignore"/> + <compile files="Class2.java" options="-1.5 -Xlint:ignore"/> + <run class="Class1" ltw="aop.xml"> + <stdout> + <!-- should be advised by both, but was *already* advised by A during first weave --> + <line text="B:set(String Class1.message)"/> + <line text="A:get(PrintStream java.lang.System.out)"/> + <line text="A:get(String Class1.message)"/> + <line text="Class1.main"/> + </stdout> + </run> + + <run class="Class2" ltw="aop.xml"> + <stdout> + <line text="B:set(String Class2.message)"/> + <line text="A:get(PrintStream java.lang.System.out)"/> + <line text="A:get(String Class2.message)"/> + <line text="Class2.main"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features167/overweaving/getsetTJP" title="getset - tjp - 1"> + <compile files="A.aj Class1.java" options="-1.5"/> + <compile files="B.aj" options="-1.5 -Xlint:ignore"/> + <compile files="Class2.java" options="-1.5 -Xlint:ignore"/> + <run class="Class1" ltw="aop.xml"> + <stdout> + <!-- should be advised by both, but was *already* advised by A during first weave --> + <line text="B:set(String Class1.message)"/> + <line text="A:get(PrintStream java.lang.System.out)"/> + <line text="A:get(String Class1.message)"/> + <line text="Class1.main"/> + </stdout> + </run> + + <run class="Class2" ltw="aop.xml"> + <stdout> + <line text="B:set(String Class2.message)"/> + <line text="A:get(PrintStream java.lang.System.out)"/> + <line text="A:get(String Class2.message)"/> + <line text="Class2.main"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features167/overweaving/calls" title="calls - 1"> + <compile files="A.aj B.aj Class1.java Class2.java" options="-1.5"/> + <run class="Class1"> + <stdout> + <line text="B:call(void java.io.PrintStream.println(String))"/> + <line text="A:call(void java.io.PrintStream.println(String))"/> + <line text="Class1.main"/> + </stdout> + </run> + + <run class="Class2"> + <stdout> + <line text="B:call(void java.io.PrintStream.println(String))"/> + <line text="A:call(void java.io.PrintStream.println(String))"/> + <line text="Class2.main"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features167/overweaving/calls" title="calls - 2"> + <compile files="A.aj Class1.java" options="-1.5"/> + <compile files="B.aj" options="-1.5 -Xlint:ignore"/> + <compile files="Class2.java" options="-1.5 -Xlint:ignore"/> + <run class="Class1" ltw="aop.xml"> + <stdout> + <!-- should be advised by both, but was *already* advised by A during first weave --> + <line text="A:call(void java.io.PrintStream.println(String))"/> + <line text="B:call(void java.io.PrintStream.println(String))"/> + <line text="Class1.main"/> + </stdout> + </run> + + <run class="Class2" ltw="aop.xml"> + <stdout> + <line text="B:call(void java.io.PrintStream.println(String))"/> + <line text="A:call(void java.io.PrintStream.println(String))"/> + <line text="Class2.main"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features167/overweaving/callsTJP" title="calls - tjp - 1"> + <compile files="A.aj Class1.java" options="-1.5"/> + <compile files="B.aj" options="-1.5 -Xlint:ignore"/> + <compile files="Class2.java" options="-1.5 -Xlint:ignore"/> + <run class="Class1" ltw="aop.xml"> + <stdout> + <!-- should be advised by both, but was *already* advised by A during first weave --> + <line text="A:call(void java.io.PrintStream.println(String))"/> + <line text="B:call(void java.io.PrintStream.println(String))"/> + <line text="Class1.main"/> + </stdout> + </run> + + <run class="Class2" ltw="aop.xml"> + <stdout> + <line text="B:call(void java.io.PrintStream.println(String))"/> + <line text="A:call(void java.io.PrintStream.println(String))"/> + <line text="Class2.main"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features167/overweaving/messy2" title="really messy"> + <compile files="A.aj Class1.java" options="-1.5"/> + <compile files="B.aj" options="-1.5 -Xlint:ignore"/> + <compile files="Class2.java" options="-1.5 -Xlint:ignore"/> + <run class="Class1" ltw="aop.xml"> + <stdout> + <!-- should be advised by both, but was *already* advised by A during first weave --> + <line text="B:execution(void Class1.main(String[]))"/> + <line text="A:execution(void Class1.main(String[]))"/> + <line text="Class1.main"/> + </stdout> + </run> + + <run class="Class2" ltw="aop.xml"> + <stdout> + <line text="B:execution(void Class2.main(String[]))"/> + <line text="A:execution(void Class2.main(String[]))"/> + <line text="Class2.main"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features167/overweaving" title="simple"> + <compile files="A.aj C.java" options="-1.5"/> + <compile files="X.aj" options="-1.5 -Xlint:ignore"/> + <run class="com.andy.C" ltw="aop.xml"> + <stdout> + <line text="AspectX>>execution(void com.andy.C.main(String[]))"/> + <line text="AspectA>>execution(void com.andy.C.main(String[]))"/> + <line text="AspectX>>execution(void com.andy.C.run())"/> + <line text="hello andy"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features167/overweaving/messy" title="messy"> + <compile files="A.aj C.java" options="-1.5"/> + <compile files="X.aj" options="-1.5 -Xlint:ignore"/> + <run class="com.andy.C" ltw="aop.xml"> + <stdout> + <line text="X:execution(void com.andy.C.main(String[]))"/> + <line text="A:execution(void com.andy.C.main(String[]))"/> + <line text="X:execution(void com.andy.C.run())"/> + <line text="hello andy"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features167/overweaving/cflow" title="cflow"> + <compile files="A.aj C.java" options="-1.5"/> + <compile files="X.aj" options="-1.5 -Xlint:ignore"/> + <run class="com.andy.C" ltw="aop.xml"> + <stdout> + <line text="X:execution(void com.andy.C.main(String[]))"/> + <line text="A:execution(void com.andy.C.main(String[]))"/> + <line text="X:execution(void com.andy.C.run())"/> + <line text="hello andy"/> + </stdout> + </run> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc169/Ajc169Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc169/Ajc169Tests.java new file mode 100644 index 000000000..3aff31ca8 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc169/Ajc169Tests.java @@ -0,0 +1,253 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc169; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class Ajc169Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testMessyDecp_318241() { + runTest("messy decp"); + } + + // public void testMultiAnnosRunning_pr315820_1() { + // runTest("multiple annos running - 1"); + // } + + public void testMultiAnnosParsing_pr315820() { + runTest("multiple annos parsing"); + } + + public void testDeclareAnnot_pr287613_5() { + runTest("compound declare patterns - method - 2"); + } + + public void testDeclareAnnot_pr287613_4() { + runTest("compound declare patterns - method - 1"); + } + + public void testDeclareAnnot_pr287613_3() { + runTest("compound declare patterns - methodctor - 1"); + } + + public void testDeclareAnnot_pr287613_2() { + runTest("compound declare patterns - fields - 2"); + } + + public void testDeclareAnnot_pr287613() { + runTest("compound declare patterns - fields - 1"); + } + + public void testOptionalAspects_pr310506() { + runTest("optional aspects"); + } + + public void testOptionalAspects_pr310506_2() { + runTest("optional aspects 2"); + } + + // public void testClashingDeclareAnnos_313026_1() { + // runTest("clashing declare annos"); + // } + + public void testInfiniteLoop_pr315651() { + runTest("infinite loop"); + } + + public void testAnnoType_pr314965() { + runTest("anno typo"); + } + + public void testValidateBranchRecursion_314840() { + runTest("validate branch recursion"); + } + + public void testClassFileSize_312839_1() { + runTest("class file size - 1"); + // 2531 (0x404): 1.6.9.M2 size of Class.class + // 2494 (0x3DF): first little stab, compressing aspectnames attached to type mungers + // 2370 (0x363): changed read/write sourcelocation to write path rather than File object: + // 2358 (0x357): aspects affecting type compressed (weaverstate reweavable info) + // 2102 (0x257): changed read/write sourcelocation in type munger to NOT use object streams + // 2053 (0x1EF): changed path in sourcelocation read/write to be constant pool (so shared between both mungers) + // 2019: changed resolvedMemberImpl name/signature to be compressed refs + // 1954 (0x18C) + + // Aspect size (X.class) down from 6459 to 4722 + // 4551: changed exact type pattern writing to use constant pool, and + // changed typepatternlist to not both writing/reading location + + // TODO actually test something :) + } + + // control test - weaves everything + public void testScopingLTW_122460_1() { + runTest("scoping ltw - 1"); + } + + // scoped to one type + public void testScopingLTW_122460_2() { + runTest("scoping ltw - 2"); + } + + // scope is '!*' - nothing woven + public void testScopingLTW_122460_3() { + runTest("scoping ltw - 3"); + } + + public void testDeclareSoftCall_307009_1() { + runTest("declare soft and call - 1"); + } + + public void testDeclareSoftCall_307009_2() { + runTest("declare soft and call - 2"); + } + + public void testAmbiguousMethod_298665() { + runTest("ambiguous method"); + } + + // public void testStaticallyAnalyzableIf_292262_1() { + // runTest("if with statically recognizable code"); + // } + + // public void testAdvisingPrivilegedAccessMethod_307147() { + // runTest("advising privileged access method"); + // } + + public void testRogueError_310043() { + runTest("rogue error"); + } + + public void testItdMarkerAnnotations_309743() { + runTest("itd marker annotations - 1"); + } + + public void testItdMarkerAnnotations_309743_2() { + runTest("itd marker annotations - 2"); + } + + public void testPipeliningAndGenerics_309336() { + runTest("pipelining and generics"); + } + + public void testCrashParamAnnos_309440() { + runTest("crash param annos"); + } + + // 1.6.9 M1 below here + public void testSubtleGenericsIssue_308773() { + runTest("subtle generics problem"); + } + + public void testAdvisingPrivilegedAccessMember_307120() { + runTest("advising privileged access member"); + } + + public void testAdvisingPrivilegedAccessMember_307120_2() { + runTest("advising privileged access member - 2"); + } + + public void testTypePatternCategories_44365_Class() { + runTest("type category type patterns - class"); + } + + public void testTypePatternCategories_44365_Interface() { + runTest("type category type patterns - interface"); + } + + public void testTypePatternCategories_44365_Enum() { + runTest("type category type patterns - enum"); + } + + public void testTypePatternCategories_44365_Annotation() { + runTest("type category type patterns - annotation"); + } + + public void testTypePatternCategories_44365_Anonymous() { + runTest("type category type patterns - anonymous"); + } + + public void testTypePatternCategories_44365_Inner() { + runTest("type category type patterns - inner"); + } + + public void testTypePatternCategories_44365_Inner_2() { + runTest("type category type patterns - inner - 2"); + } + + public void testTypePatternCategories_44365_Inner_3() { + runTest("type category type patterns - inner - 3"); + } + + public void testTypePatternCategories_44365_Aspect() { + runTest("type category type patterns - aspect"); + } + + public void testTypePatternCategories_44365_e1() { + runTest("type category type patterns - e1"); + } + + public void testTypePatternCategories_44365_e3() { + runTest("type category type patterns - e3"); + } + + public void testTypePatternCategories_44365_e2() { + runTest("type category type patterns - e2"); + } + + public void testChecker() { + runTest("inserts in messages"); + } + + /* + * public void testVerifyError() { runTest("verifyerror on atAj"); } + */ + public void testDeclareTypeWarning1() { + runTest("declare type warning - 1"); + } + + public void testDeclareTypeWarning2() { + runTest("declare type warning - 2"); + } + + public void testDeclareTypeWarning3() { + runTest("declare type warning - 3"); + } + + public void testDeclareTypeError1() { + runTest("declare type error - 1"); + } + + public void testPr298388() { + runTest("declare mixin and generics"); + } + + // public void testPr292584() { + // runTest("annotation around advice verifyerror"); + // } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc169Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc169.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc169/AllTestsAspectJ169.java b/tests/src/test/java/org/aspectj/systemtest/ajc169/AllTestsAspectJ169.java new file mode 100644 index 000000000..f143fca99 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc169/AllTestsAspectJ169.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc169; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ169 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.6.9 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc169Tests.suite()); + suite.addTest(TransparentWeavingTests.suite()); + suite.addTest(IntertypeTests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc169/IntertypeTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc169/IntertypeTests.java new file mode 100644 index 000000000..5099a929b --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc169/IntertypeTests.java @@ -0,0 +1,214 @@ +/******************************************************************************* + * Copyright (c) 2010 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 + *******************************************************************************/ +package org.aspectj.systemtest.ajc169; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.PrintWriter; + +import junit.framework.Test; + +import org.aspectj.asm.AsmManager; +import org.aspectj.asm.IRelationshipMap; +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * Tests exploring intertype declared inner types and the new intertype syntax. + * + * Some design notes.<br> + * <p> + * Supporting inner types is not quite as straightforward as for the other kinds of ITD like methods, fields and constructors. When + * 'resolving' methods/fields/constructors they may refer to intertyped inner types, these means they must be in place early on - + * ahead of any member resolution. In order to achieve this they are done really early (for both the cases of pulling in a + * binarytypebinding - see AjLookupEnvironment.weaveInterTypeDeclarations(), and for sourcetypebindings + * AjLookupEnvironment.completeTypeBindings() where it calls processInterTypeMemberTypes). + * <p> + * The logic in AjLookupEnvironment.weaveInterTypeDeclarations() is temporarily disabled because I can't write a testcase that + * requires it! It should be an incremental build where a class is loaded as a binary type binding on a secondary (incremental) + * compile and that class needs the inner class applying. + * <p> + * Eclipse polices the names of inner types when loading binary type data. The name of the inner is actually maintained as the + * aspect name (so an inner type of Foo in an aspect Bar will be called Bar$Foo). The compiler looks after 'attaching' the inner + * type to the target type binding when required. + * + * @author Andy Clement + */ +public class IntertypeTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + /** + * This is testing that on a secondary compile we can work out what happened in the first compile (where an inner type was + * intertyped onto another type). I think we need two conditions to be true for this to pass: <br> + * 1) we need an innerclass attribute on the target type <br> + * 2) we need the name of the innerclass to match its target rather than the declaring aspect<br> + * Line 277 in ClassScope:<br> + * + * memberTypeBindings[count++] = memberScope.buildType(sourceType, sourceType.fPackage, accessRestriction);<br> + * which then: builds the name based on the containing aspect. + * + * TypeDeclaration.generateCode() + * + */ + public void testSeparateCompilation() throws Exception { + runTest("separate compilation"); + } + + /** + * Interestingly this test makes no reference in the type Basic to the new ITD'd inner type, this causes the Basic type to be + * missing the innertype attribute! + */ + public void testSeparateCompilation2() throws Exception { + runTest("separate compilation - 2"); + } + + public void testErrorTargettingTypeThatAlreadyHasIt() { + runTest("already has it"); + } + + public void testConstruction4() { + runTest("construction4"); + } + + public void testConstruction3() { + runTest("construction3"); + } + + public void testConstruction2() { + runTest("construction2"); + } + + public void testConstruction() { + runTest("construction"); + } + + // now the itd and the itd member class are in different aspects + public void testVoteItdMixture2() { + runTest("vote - itd mixture 2"); + } + + // This test is necessary because it verifies what happens when other ITDs are around + // in addition to the itd member class. In order to apply the other ITDs the methods in a target + // may get resolved. When they are resolved their types (return,etc) are resolved. If this + // happens before the innertype has been added to the target and the types involved reference that + // member type, then a failure will occur. + public void testVoteItdMixture() { + runTest("vote - itd mixture"); + } + + public void testVoteMethodReference() { + runTest("vote - method reference"); + } + + public void testVoteFieldReference() { + runTest("vote - field reference"); + } + + public void testVoteInnerInner() { + runTest("vote - inner inner"); + } + + public void testVoteReferenceViaAnnotation2() { + runTest("vote - reference via annotation - two"); + } + + public void testVoteReferenceViaAnnotation() { + runTest("vote - reference via annotation"); + } + + public void testVoteConstruction() { + runTest("vote - construction"); + } + + public void testVoteBasic() { + runTest("vote - basic"); + } + + // inter type declared classes - working scenarios + public void testFieldAccess() throws Exception { + runTest("field access"); + } + + public void testMethodAccess() throws Exception { + runTest("method access"); + } + + public void testRooScenario() throws Exception { + runTest("choice"); + } + + public void testRooScenario2() throws Exception { + runTest("choice2"); + } + + public void testRooScenarioWeaveInfo() throws Exception { + runTest("choice - weaveinfo"); + } + + public void testModel() throws Exception { + runTest("choice - model"); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + PrintWriter pw = new PrintWriter(baos); + AsmManager.dumptree(pw, AsmManager.lastActiveStructureModel.getHierarchy().getRoot(), 0); + IRelationshipMap irm = AsmManager.lastActiveStructureModel.getRelationshipMap(); + pw.write(irm.toString()); + pw.flush(); + String model = baos.toString(); + assertTrue(model.indexOf("<{Choice.java[Choice=[aspect declarations]") != -1); + assertTrue(model.indexOf("<{Choice.java'X[Keys=[declared on]") != -1); + } + + public void testGenerics1() throws Exception { + runTest("choice - generics 1"); + } + + public void testGenerics2() throws Exception { + runTest("choice - generics 2"); + } + + // compiler limitation tests + public void testNotAllowedOnInterface() throws Exception { + runTest("on interface"); + } + + public void testNotAllowedOnEnum() throws Exception { + runTest("on enum"); + } + + public void testNotAllowedOnAnnotation() throws Exception { + runTest("on annotation"); + } + + public void testOnlyStatic() throws Exception { + runTest("only static"); + } + + // tests for alternate syntax, not yet supported in the grammar + + // intertype {} syntax + // public void testWillItParseEmptyIntertype() throws Exception { + // runTest("simplest", true); + // } + // + // public void testWithAnInnerClass() throws Exception { + // runTest("simplest 2"); + // } + // + // public void testIntertypeMethodInNewStyle() throws Exception { + // runTest("simplest 3"); + // } + // -- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(IntertypeTests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("intertype.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc169/TransparentWeavingTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc169/TransparentWeavingTests.java new file mode 100644 index 000000000..a32f4f15e --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc169/TransparentWeavingTests.java @@ -0,0 +1,244 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc169; + +import java.io.File; +import java.lang.reflect.Modifier; + +import junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.Field; +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen; +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * What would a completely transparent weave be? Is there a minimal subset that makes sense? What is the roadmap to get there? What + * needs testing + * + * --- 'Transparent' here is meaning that the resultant bytecode is more representative of the original declarations, so that it + * looks like the intertype declaration and associated constructs have been seamless added to the affected targets. + * + * + * Fully transparent weaving, what would we like to have: - ITDs appear exactly as declared: 'private int A.i' will create 'private + * int i' in A + * + * - What is the benefit? - although this isn't really in keeping with the AspectJ definition of what an ITD represents, having the + * end result look like the declaration does make it easier for users simply looking at the resultant class file or attempting + * reflection to access what they just ITD'd in place + * + * + * testing For transparent weaving of ITD fields - annotations on new fields - AJDT model - AjType support - what happens to it? - + * advice on within() how does that get affected? - visibility - accessors created when required? - handling clashes with existing + * fields - handling clashes with other aspects - generic declarations - interface declarations - initializers - static and + * non-static - accessibility from advice, for read and write + * + * Design<br> + * The intention will be 'new code' uses the new style whilst old code continues to cause the old code to be built. Whether the code + * wants to use the old or new naming should be apparent from the + * + * @author Andy Clement + */ +public class TransparentWeavingTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + // Simple private ITD onto a target + public void testSimplePrivate() throws Exception { + runTest("one - private"); + checkForField("OnePrivate", Modifier.PRIVATE, "x"); + } + + // Default visibility ITD field + public void testSimpleDefault() throws Exception { + runTest("one - default"); + checkForField("OneDefault", 0, "x"); + } + + // annotated private ITD + public void testSimplePrivateAnnotated() throws Exception { + runTest("one - private - annotated"); + Field f = checkForField("OnePrivateAnnotated", Modifier.PRIVATE, "x"); + AnnotationGen[] annos = f.getAnnotations(); + assertTrue(annos.length > 0); // 0==Anno 1==ajcITD + assertEquals("LAnno;", annos[0].getTypeSignature()); + } + + // annotated default ITD + public void testSimpleDefaultAnnotated() throws Exception { + runTest("one - default - annotated"); + Field f = checkForField("OneDefaultAnnotated", 0, "x"); + AnnotationGen[] annos = f.getAnnotations(); + assertTrue(annos.length > 0); // 0==Anno 1==ajcITD + assertEquals("LAnno;", annos[0].getTypeSignature()); + } + + // Simple private ITD with getter/setter usage + public void testSimplePrivateWithAccessors() throws Exception { + runTest("one - private - accessors"); + } + + // check initializer runs OK + public void testSimplePrivateInitializer() throws Exception { + runTest("one - private - initializer"); + } + + public void testDeclareAtOnPrivateItd() throws Exception { + runTest("declare at on private itd"); + Field f = checkForField("OneDeclareAt", Modifier.PRIVATE, "x"); + AnnotationGen[] annos = f.getAnnotations(); + assertTrue(annos.length > 0); // 1==Anno 0==ajcITD + assertEquals("LAnno;", annos[1].getTypeSignature()); + } + + // declare @field on a field that already has one + public void testDeclareAtTwo() throws Exception { + runTest("declare at two"); + Field f = checkForField("DeclareAtTwo", Modifier.PRIVATE, "x"); + AnnotationGen[] annos = f.getAnnotations(); + assertTrue(annos.length > 2); // 1==Anno 0==ajcITD + assertEquals("LAnno;", annos[0].getTypeSignature()); + assertEquals("LAnno2;", annos[2].getTypeSignature()); + } + + public void testTwoItdsOnTarget() throws Exception { + runTest("two itds on target"); + // Aspect X gets the field, aspect Y gets a mangled one + if (hasField("TwoItdsOnTarget", "ajc$interField$Y$x")) { + checkForField("TwoItdsOnTarget", Modifier.PRIVATE, "x"); + checkForField("TwoItdsOnTarget", Modifier.PUBLIC, "ajc$interField$Y$x"); + } else { + checkForField("TwoItdsOnTarget", Modifier.PRIVATE, "x"); + checkForField("TwoItdsOnTarget", Modifier.PUBLIC, "ajc$interField$X$x"); + } + } + + public void testTwoItdsOnTargetThatAlreadyHasIt() throws Exception { + runTest("two itds on target that already has it"); + // Aspect X gets the field, aspect Y gets a mangled one + checkForField("TwoItdsOnTargetHasAlready", Modifier.PUBLIC, "ajc$interField$X$x"); + checkForField("TwoItdsOnTargetHasAlready", Modifier.PUBLIC, "ajc$interField$Y$x"); + } + + public void testInteractingOldAndNew() throws Exception { + runTest("interacting old and new"); + int SYNTHETIC = 0x00001000; // 4096 + if (hasField("InteractingOldAndNew", "ajc$interField$Y$i")) { + checkForField("InteractingOldAndNew", Modifier.PRIVATE, "i"); + checkForField("InteractingOldAndNew", Modifier.PUBLIC, "ajc$interField$Y$i"); + } else { + checkForField("InteractingOldAndNew", Modifier.PRIVATE, "i"); + checkForField("InteractingOldAndNew", Modifier.PUBLIC, "ajc$interField$X$i"); + } + checkForMethod("InteractingOldAndNew", Modifier.PUBLIC | Modifier.STATIC, "main"); + checkForMethod("InteractingOldAndNew", Modifier.PUBLIC | Modifier.STATIC | SYNTHETIC, "ajc$get$i"); + checkForMethod("InteractingOldAndNew", Modifier.PUBLIC | Modifier.STATIC | SYNTHETIC, "ajc$set$i"); + checkForMethod("InteractingOldAndNew", Modifier.PUBLIC, "getI1"); + checkForMethod("InteractingOldAndNew", Modifier.PUBLIC, "getI2"); + checkForMethod("InteractingOldAndNew", Modifier.PUBLIC, "setI1"); + checkForMethod("InteractingOldAndNew", Modifier.PUBLIC, "setI2"); + } + + public void testPrivateGenerics() throws Exception { + runTest("generics - private"); + Field f = checkForField("Generics", Modifier.PRIVATE, "listOfString"); + assertEquals("Ljava/util/List<Ljava/lang/String;>;", f.getGenericSignature()); + f = checkForField("Generics", Modifier.PRIVATE, "thing"); + assertEquals("TX;", f.getGenericSignature()); + } + + // --- + + private boolean hasField(String clazzname, String name) { + try { + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), clazzname); + Field[] fs = jc.getFields(); + StringBuffer fields = new StringBuffer(); + for (Field f : fs) { + fields.append(f.getName()).append(" "); + if (f.getName().equals(name)) { + return true; + } + } + } catch (Exception e) { + return false; + } + return false; + } + + private Field checkForField(String clazzname, int modifiers, String name) throws Exception { + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), clazzname); + Field[] fs = jc.getFields(); + StringBuffer fields = new StringBuffer(); + for (Field f : fs) { + fields.append(f.getName()).append(" "); + if (f.getName().equals(name)) { + if (f.getModifiers() != modifiers) { + fail("Found field " + name + " in " + clazzname + " but modifiers were wrong, they were " + f.getModifiers()); + } + return f; + } + } + fail("Did not find field " + name + " in class " + clazzname + ". Found fields: " + fields.toString()); + return null; + } + + private Method checkForMethod(String clazzname, int modifiers, String name) throws Exception { + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), clazzname); + Method[] fs = jc.getMethods(); + StringBuffer methods = new StringBuffer(); + methods.append("\n"); + for (Method f : fs) { + methods.append(f.getName()).append("\n"); + if (f.getName().equals(name)) { + if (f.getModifiers() != modifiers) { + fail("Found method " + name + " in " + clazzname + " but modifiers were wrong, they were " + f.getModifiers()); + } + return f; + } + System.out.println(f.getGenericSignature()); + } + fail("Did not find method " + name + " in class " + clazzname + ". Found methods: " + methods.toString()); + return null; + } + + // public itd onto a target that already has a field of that name + // just to check what goes wrong and who checks it + public void testPublicClash() throws Exception { + runTest("two"); + } + + public void testPrivateClash() throws Exception { + runTest("three"); + + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "Three"); + Field[] fs = jc.getFields(); + for (Field f : fs) { + System.out.println(f); + } + + // public int ajc$interField$X$xPrivate [RuntimeVisibleAnnotations] + // public Integer ajc$interField$$yDefault [RuntimeVisibleAnnotations] + // public String zPublic [RuntimeVisibleAnnotations] + + } + + // -- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(TransparentWeavingTests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("transparentweaving.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc169/ajc169.xml b/tests/src/test/java/org/aspectj/systemtest/ajc169/ajc169.xml new file mode 100644 index 000000000..66de48191 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc169/ajc169.xml @@ -0,0 +1,413 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs169/pr318241" title="messy decp"> + <compile files="PkItd.aj Two.aj SomeClass.java Pk.java SomeAnnotation.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr287613" title="compound declare patterns - method - 2"> + <compile files="DAMethod2.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="'public void Person.foo()' (DAMethod2.java:11) is annotated with @Annot method annotation from 'DAMethod2' (DAMethod2.java:26)"/> + <message kind="weave" text="public boolean Person.bar()' (DAMethod2.java:13) is annotated with @Annot method annotation from 'DAMethod2' (DAMethod2.java:26)"/> + <message kind="weave" text="public boolean Person.isSet()' (DAMethod2.java:17) is annotated with @Annot method annotation from 'DAMethod2' (DAMethod2.java:26)"/> + <message kind="weave" text="public void Person.isNotReturningBoolean()' (DAMethod2.java:19) is annotated with @Annot method annotation from 'DAMethod2' (DAMethod2.java:26)"/> + <message kind="weave" text="'public void Person.getin()' (DAMethod2.java:21) is annotated with @Annot method annotation from 'DAMethod2' (DAMethod2.java:28)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr287613" title="compound declare patterns - method - 1"> + <compile files="DAMethod1.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="'public java.lang.String Person.getString()' (DAMethod1.java:9) is annotated with @Annot method annotation from 'DAMethod1' (DAMethod1.java:15)"/> + <message kind="weave" text="'public boolean Person.isSet()' (DAMethod1.java:10) is annotated with @Annot method annotation from 'DAMethod1' (DAMethod1.java:15)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr315820" title="multiple annos running - 1"> + <compile files="MultiAnno2.java" options="-1.5"/> + <run class="MultiAnno2"> + <stdout> + <line text="XXX"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs169/pr315820" title="multiple annos parsing"> + <compile files="MultiAnno.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs169/pr287613" title="compound declare patterns - fields - 2"> + <compile files="Target.java" options="-1.5"/> + <run class="Target"> + <stdout> + <line text="Field one"/> + <line text="@Annot1()"/> + <line text="@Annot1()"/> + <line text="Field two"/> + <line text="@Annot2()"/> + <line text="no annotations"/> + <line text="Field three"/> + <line text="@Annot3()"/> + <line text="@Annot3()"/> + </stdout></run> + </ajc-test> + + <ajc-test dir="bugs169/pr287613" title="compound declare patterns - fields - 1"> + <compile files="DeclareAnnot.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs169/pr287613" title="compound declare patterns - methodctor - 1"> + <compile files="DeclareAnnotMethodCtor.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs169/pr310506" title="optional aspects"> + <compile files="Anno.java" outjar="anno.jar" options="-1.5"/> + <compile files="AspectA.java" classpath="anno.jar" outjar="aspect.jar" options="-Xlint:ignore -1.5"/> + <compile files="AspectB.java" outjar="aspect2.jar" options="-Xlint:ignore -1.5"/> + <compile files="Code.java" classpath="aspect.jar;aspect2.jar" options="-1.5"/> + <file deletefile="anno.jar"/> + <run class="Code" ltw="META-INF/aop.xml" classpath=".;aspect.jar;aspect2.jar"> + <stderr> + <line text="AspectJ Weaver Version"/> + <line text="register classloader"/> + <line text="using configuration"/> + <line text="register aspect"/> + <line text="deactivating aspect"/> + <line text="register aspect"/> + <line text="processing reweavable"/> + </stderr> + <stdout> + <line text="staticinitialization"/> + <line text="abcde"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs169/pr310506" title="optional aspects 2"> + <compile files="Anno.java" outjar="anno.jar" options="-1.5"/> + <compile files="AspectA.java" classpath="anno.jar" outjar="aspect.jar" options="-Xlint:ignore -1.5"/> + <compile files="AspectB.java" outjar="aspect2.jar" options="-Xlint:ignore -1.5"/> + <compile files="Code.java Code2.java" classpath="anno.jar;aspect.jar;aspect2.jar" options="-1.5"/> + <run class="Code2" ltw="META-INF/aop.xml" classpath=".;aspect.jar;aspect2.jar"> + <stderr> + <line text="AspectJ Weaver Version"/> + <line text="register classloader"/> + <line text="using configuration"/> + <line text="register aspect"/> + <line text="register aspect"/> + <line text="processing reweavable"/> + <line text="processing reweavable"/> + </stderr> + <stdout> + <line text="staticinitialization"/> + <line text="A"/> + <line text="abcde"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs169/pr315651" title="infinite loop"> + <compile files="test/Profiling.aj test/Main.java" options="-1.5"/> + <run class="test.Main"/> + </ajc-test> + + <ajc-test dir="bugs169/pr314965" title="anno typo"> + <compile files="MinimalExample.java" options="-1.5"> + <message kind="warning" text="no match for this type name: AnnotationWithParamAndTypo [Xlint:invalidAbsoluteTypeName]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr314840" title="validate branch recursion"> + <compile files="Arguments.aj Test1.java Test2.java Test.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs169/pr313026/one" title="clashing declare annos"> + <compile files="Target.java Asp.java Bsp.java Wibble.java Precedence1.java" options="-1.5 -Xlint:ignore"/> + <run class="Target"> + <stdout> + <line text="@Wibble(value=abc)"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs169/pr312839/one" title="class file size - 1"> + <compile files="Class.java X.aj" options="-1.5"/> + <run class="com.wibble.foo.Class"> + <stdout> + <line text="Hello Andy"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs169/pr122460/one" title="scoping ltw - 3"> + <compile files="A.java" options="-1.5 -Xlint:ignore" outjar="aspects.jar"/> + <compile files="Code.java Runner.java"/> + <run class="code.Code" ltw="aop_none.xml" classpath="aspects.jar"> + <stdout> + <line text="running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs169/pr122460/one" title="scoping ltw - 1"> + <compile files="A.java" options="-1.5 -Xlint:ignore" outjar="aspects.jar"/> + <compile files="Code.java Runner.java"/> + <run class="code.Code" ltw="aop.xml" classpath="aspects.jar"> + <stdout> + <line text="intercepted class code.Code"/> + <line text="intercepted class runner.Runner"/> + <line text="running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs169/pr122460/one" title="scoping ltw - 2"> + <compile files="A.java" options="-1.5 -Xlint:ignore" outjar="aspects.jar"/> + <compile files="Code.java Runner.java"/> + <run class="code.Code" ltw="aop_codeonly.xml" classpath="aspects.jar"> + <stdout> + <line text="intercepted class code.Code"/> + <line text="running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs169/pr307009" title="declare soft and call - 1"> + <compile files="Test.java Test2.java Ann.java Bug.aj" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Softening exceptions in type 'Test' (Test.java:4) as defined by aspect 'Bug' (Bug.aj:3)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr307009" title="declare soft and call - 2"> + <compile files="Test2.java Test.java Ann.java Bug.aj" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Softening exceptions in type 'Test' (Test.java:4) as defined by aspect 'Bug' (Bug.aj:3)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr310043" title="rogue error"> + <compile files="B.java" classpath="code.jar" aspectpath="code.jar"/> + </ajc-test> + + <ajc-test dir="bugs169/pr309743" title="itd marker annotations - 1"> + <compile files="A.java" options="-1.5"/> + <run class="A"> + <stdout> + <line text="foo"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs169/pr309743" title="itd marker annotations - 2"> + <compile files="B.java" options="-1.5"/> + <run class="B"> + <stdout> + <line text="boo"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs169/pr309336" title="pipelining and generics"> + <compile files="NoSystemStreams.aj UseOperators.java Operators.java" options="-1.5"> + <message kind="warning" text="No system.out"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr308773" title="subtle generics problem"> + <compile files="Aspy.aj Zzz.java Top.java Middle.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs169/pr307147" title="advising privileged access method"> + <compile files="B.java Test2.java" options="-showWeaveInfo"> + <message kind="weave" text="Type 'B' (B.java) has intertyped method from 'Test'"/> + <message kind="weave" text="Join point 'field-get(int A.goo)' in Type 'Test'"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr307120" title="advising privileged access member"> + <compile files="A.java Test.java" options="-showWeaveInfo"> + <message kind="weave" text="Type 'A' (A.java) has intertyped method from 'Test'"/> <!-- getFoo and getGoo --> + <message kind="weave" text="Join point 'field-get(int A.goo)' in Type 'Test'"/> + <message kind="weave" text="Join point 'field-get(int A.foo)' in Type 'Test'"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr309440" title="crash param annos"> + <compile files="foobar/ExportMode.java" classpath="jsr305.jar" options="-1.6"/> + <compile files="foobar/CrashAspectJCompiler.java" classpath="jsr305.jar" options="-1.6"/> + </ajc-test> + + <ajc-test dir="bugs169/pr307120" title="advising privileged access member - 2"> + <compile files="Test.java A.java" options="-showWeaveInfo"> + <message kind="weave" text="Type 'A' (A.java) has intertyped method from 'Test'"/> <!-- getFoo and getGoo --> + <message kind="weave" text="Join point 'field-get(int A.goo)' in Type 'Test'"/> + <message kind="weave" text="Join point 'field-get(int A.foo)' in Type 'Test'"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr292262" title="if with statically recognizable code"> + <compile files="A.java"> + <message kind="weave" text="Join point 'staticinitialization(void SimpleClass.<clinit>())' in Type 'SimpleClass'"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr44365" title="type category type patterns - class"> + <compile files="SimpleClass.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'staticinitialization(void SimpleClass.<clinit>())' in Type 'SimpleClass'"/> + <message kind="weave" text="Join point 'staticinitialization(void Bar.<clinit>())' in Type 'Bar'"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr44365" title="type category type patterns - interface"> + <compile files="SimpleInterface.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'staticinitialization(void Foo.<clinit>())' in Type 'Foo'"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr44365" title="type category type patterns - enum"> + <compile files="SimpleEnum.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'staticinitialization(void Foo.<clinit>())' in Type 'Foo'"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr44365" title="type category type patterns - annotation"> + <compile files="SimpleAnnotation.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'staticinitialization(void WibbleAnno.<clinit>())' in Type 'WibbleAnno'"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr44365" title="type category type patterns - anonymous"> + <compile files="SimpleAnonymous.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'staticinitialization(void Bar$1.<clinit>())' in Type 'Bar$1'"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr44365" title="type category type patterns - inner"> + <compile files="SimpleInner.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'staticinitialization(void Bar$Inner.<clinit>())' in Type 'Bar$Inner'"/> + <message kind="weave" text="Join point 'staticinitialization(void Bar$1.<clinit>())' in Type 'Bar$1'"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr44365" title="type category type patterns - inner - 2"> + <compile files="SimpleInner2.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'staticinitialization(void Bar$Inner.<clinit>())' in Type 'Bar$Inner'"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr44365" title="type category type patterns - inner - 3"> + <compile files="SimpleInner3.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void Bar$Inner.foo())' in Type 'Bar$Inner' (SimpleInner3.java:12) advised"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr44365" title="type category type patterns - aspect"> + <compile files="SimpleAspect.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'staticinitialization(void X.<clinit>())' in Type 'X'"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr44365" title="type category type patterns - e1"> + <compile files="Errors1.java" options="-1.5 -showWeaveInfo"> + <message kind="error" text="Syntax error on token "(", ")"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr44365" title="type category type patterns - e2"> + <compile files="Errors5.java" options="-1.5 -showWeaveInfo"> + <message kind="error" text="Syntax error on token ")", "(" expected"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr44365" title="type category type patterns - e3"> + <compile files="Errors2.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void Errors2.is(java.lang.String))' in Type"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr48080" title="inserts in messages"> + <compile files="Warnings.java" options="-1.5"> + <message kind="warning" text="UNKNOWN_KEY{}foobar"/> + <message kind="warning" text="{}wibble"/> + <message kind="warning" text="signature name for method is m"/> + <message kind="warning" text="joinpoint declaring type is p.A"/> + <message kind="warning" text="joinpoint signature is void p.A.m()"/> + <message kind="warning" text="joinpoint line is '23'"/> + <message kind="warning" text="joinpoint kind is method-execution"/> + <message kind="warning" text="joinpoint kind is 'method-execution'"/> + <message kind="warning" text="joinpoint is method-execution(void p.A.m())"/> + <message kind="warning" text="joinpoint location is"/> + <message kind="warning" text="signature name for field is i"/> + <message kind="warning" text="joinpoint signature is int p.A.i"/> + <message kind="warning" text="aspect is p.Checker"/> + <message kind="warning" text="advice sourcelocation is"/> + <message kind="warning" text="test 18{}23"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr299062" title="verifyerror on atAj"> + <compile files="Test.java Work.java SmartAspect.java Idempotent.java" options="-1.5"/> + <run class="Test"> + </run> + </ajc-test> + + <ajc-test dir="bugs169/pr298665" title="ambiguous method"> + <compile files="Main.java" options="-1.5"/> + <run class="Main"> + </run> + </ajc-test> + + <ajc-test dir="bugs169/pr298388" title="declare mixin and generics"> + <compile files="PR298388.java" options="-1.5"/> + <run class="PR298388"> + <stdout> + <line text="done"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs169/pr295491" title="model annotation npe"> + <compile files="SpringConfigurableMixin.java" options="-1.5 -emacssym"/> + </ajc-test> + + <ajc-test dir="bugs169/pr292584" title="annotation around advice verifyerror"> + <compile files="AbstractAspect.java,ClassWithJoinPoint.java,ConcreteAspect.java" options="-1.5"/> + <run class="ClassWithJoinPoint"> + <stdout> + <line text="Testing annotation style (should print "true"):"/> + <line text="true"/> + </stdout> + </run> + </ajc-test> + + <!-- declare type warning --> + + <ajc-test dir="bugs169/pr291206" title="declare type warning - 1"> + <compile files="One.java" options="-1.5"> + <message kind="warning" line="8" text="Nothing should be"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr291206" title="declare type warning - 2"> + <compile files="Two.java" options="-1.5"> + <message kind="warning" line="7" text="Missing foo()"/> + <message kind="warning" line="13" text="Missing foo()"/> + </compile> + </ajc-test> + + <!-- testing build of model with one of these in --> + <ajc-test dir="bugs169/pr291206" title="declare type warning - 3"> + <compile files="Two.java" options="-1.5 -emacssym"> + <message kind="warning" line="7" text="Missing foo()"/> + <message kind="warning" line="13" text="Missing foo()"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs169/pr291206" title="declare type error - 1"> + <compile files="Three.java" options="-1.5"> + <message kind="error" line="7" text="Missing foo()"/> + <message kind="error" line="13" text="Missing foo()"/> + </compile> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc169/intertype.txt b/tests/src/test/java/org/aspectj/systemtest/ajc169/intertype.txt new file mode 100644 index 000000000..0fedf993f --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc169/intertype.txt @@ -0,0 +1,5 @@ +AspectDeclaration.buildInterTypeAndPerClause + +EclipseTypeMunger.mungeNewInnerClass + +EclipseTypeMunger.findOrCreateInterTypeMemberClassFinder
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc169/intertype.xml b/tests/src/test/java/org/aspectj/systemtest/ajc169/intertype.xml new file mode 100644 index 000000000..75846b05c --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc169/intertype.xml @@ -0,0 +1,249 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="features169/itdInnerTypes/separate" title="separate compilation"> + <compile files="Basic.java" options="-1.5"/> + <compile files="Basic2.java"/> + <run class="Basic2"> + <stdout> + <line text="done"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes/separate2" title="separate compilation - 2"> + <compile files="Basic.java" options="-1.5"/> + <compile files="Basic2.java"/> + <run class="Basic2"> + <stdout> + <line text="done"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes/eleven" title="already has it"> + <compile files="Target.java Aspect1.java" options="-1.5"> + <message kind="error" text="Duplicate nested type Inner"/> + <message kind="error" text="target type already declares a "/> + </compile> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes" title="construction4"> + <compile files="Construction4.java" options="-1.5"/> + <run class="Construction4"> + <stdout> + <line text="abc"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes" title="construction3"> + <compile files="Construction3.java" options="-1.5"/> + <run class="Construction3"> + <stdout> + <line text="abc"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes/ten" title="construction2"> + <compile files="Construction.java Aspect1.java Aspect2.java" options="-1.5"/> + <run class="Construction"> + <stdout> + <line text="abcde"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes" title="construction"> + <compile files="Construction.java" options="-1.5"/> + <run class="Construction"> + <stdout> + <line text="done"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes/nine" title="vote - itd mixture 2"> + <compile files="Underscorer.aj Vote.java Runner.java RelatedType.java" options="-1.5"/> + <run class="a.b.c.Runner"> + <stdout> + <line text="wibble"/> + <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9+"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes/eight" title="vote - itd mixture"> + <compile files="Underscorer.aj Vote.java Runner.java RelatedType.java" options="-1.5"/> + <run class="a.b.c.Runner"> + <stdout> + <line text="wibble"/> + <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9+"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes/seven" title="vote - method reference"> + <compile files="Underscorer.aj Vote.java Runner.java RelatedType.java" options="-1.5"/> + <run class="a.b.c.Runner"> + <stdout> + <line text="wibble"/> + <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9+"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes/six" title="vote - field reference"> + <compile files="Vote.java Vote_Amender.aj Runner.java RelatedType.java" options="-1.5"/> + <run class="a.b.c.Runner"> + <stdout> + <line text="wibble"/> + <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9+"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes/five" title="vote - inner inner"> + <compile files="Vote.java Vote_Amender.aj Runner.java RelatedType.java" options="-1.5"/> + <run class="a.b.c.Runner"> + <stdout> + <line text="wibble"/> + <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9+"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes/four" title="vote - reference via annotation - two"> + <compile files="Vote.java Vote_Amender.aj Runner.java RelatedType.java" options="-1.5"/> + <run class="a.b.c.Runner"> + <stdout> + <line text="wibble"/> + <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="@a.b.c.RelatedType(value=a.b.c.Vote$_$choice.class)" vm="9+"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes/three" title="vote - reference via annotation"> + <compile files="Vote.java Vote_Amender.aj Runner.java RelatedType.java" options="-1.5"/> + <run class="a.b.c.Runner"> + <stdout> + <line text="wibble"/> + <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="@a.b.c.RelatedType(value=a.b.c.Vote$_.class)" vm="9+"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes/two" title="vote - construction"> + <compile files="Vote.java Vote_Amender.aj Runner.java" options="-1.5"/> + <run class="a.b.c.Runner"> + <stdout> + <line text="wibble"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes/one" title="vote - basic"> + <compile files="Vote.java Vote_Amender.aj Runner.java" options="-1.5"/> + <run class="a.b.c.Runner"/> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes" title="choice - generics 1"> + <compile files="ChoiceGenerics1.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes" title="choice - generics 2"> + <compile files="ChoiceGenerics2.java" options="-1.5"> + <message kind="error" text="Type mismatch: cannot convert from String to Integer"/> + </compile> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes" title="choice"> + <compile files="Choice.java" options="-1.5"/> + <run class="Choice"> + <stdout> + <line text="null"/> + </stdout></run> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes" title="choice - weaveinfo"> + <compile files="Choice.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Type 'Choice' (Choice.java) has intertyped member class from 'X' (Choice.java)"/> + </compile> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes" title="choice - model"> + <compile files="Choice.java" options="-1.5 -emacssym"/> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes" title="choice2"> + <compile files="Choice2.java" options="-1.5"/> + <run class="Choice2"> + <stdout> + <line text="null"/> + </stdout></run> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes" title="field access"> + <compile files="FieldAccess.java" options="-1.5"/> + <run class="FieldAccess"> + <stdout> + <line text="42"/> + </stdout></run> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes" title="method access"> + <compile files="MethodCall.java" options="-1.5"/> + <run class="MethodCall"> + <stdout> + <line text="42"/> + </stdout></run> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes" title="only static"> + <compile files="OnlyStatic.java" options="-1.5"> + <message kind="error" line="5" text="Intertype declared member types can only be static (compiler limitation)"/> + </compile> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes" title="on interface"> + <compile files="OnInterface.java" options="-1.5"> + <message kind="error" line="5" text="Cannot declare new member type on 'OnInterface'. New member types can only be specified on classes (compiler limitation)"/> + </compile> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes" title="on enum"> + <compile files="OnEnum.java" options="-1.5"> + <message kind="error" line="6" text="Cannot declare new member type on 'EEE'. New member types can only be specified on classes (compiler limitation)"/> + </compile> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes" title="on annotation"> + <compile files="OnAnnotation.java" options="-1.5"> + <message kind="error" line="8" text="Cannot declare new member type on 'Anno'. New member types can only be specified on classes (compiler limitation)"/> + </compile> + </ajc-test> + + <!-- + <ajc-test dir="features169/itdInnerTypes" title="simplest 3"> + <compile files="Simplest3.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes" title="simplest 2"> + <compile files="Simplest2.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="features169/itdInnerTypes" title="simplest"> + <compile files="Simplest.java" options="-1.5"/> + </ajc-test> + --> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc169/transparentweaving.xml b/tests/src/test/java/org/aspectj/systemtest/ajc169/transparentweaving.xml new file mode 100644 index 000000000..4eb5f6d37 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc169/transparentweaving.xml @@ -0,0 +1,68 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="features169/transparent" title="one - private"> + <compile files="OnePrivate.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="features169/transparent" title="one - default"> + <compile files="OneDefault.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="features169/transparent" title="one - private - annotated"> + <compile files="OnePrivateAnnotated.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="features169/transparent" title="one - default - annotated"> + <compile files="OneDefaultAnnotated.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="features169/transparent" title="one - private - accessors"> + <compile files="OnePrivateAccessors.java" options="-1.5"/> + <run class="OnePrivateAccessors"/> + </ajc-test> + + <ajc-test dir="features169/transparent" title="interacting old and new"> + <compile files="InteractingOldAndNew.java" options="-1.5"/> + <run class="InteractingOldAndNew"/> + </ajc-test> + + <ajc-test dir="features169/transparent" title="one - private - initializer"> + <compile files="OnePrivateInitializer.java" options="-1.5"/> + <run class="OnePrivateInitializer"/> + </ajc-test> + + <ajc-test dir="features169/transparent" title="two"> + <compile files="Two.java" options="-1.5"> + <message kind="error" text="inter-type declaration from X conflicts with existing member: int Two.x"/> + </compile> + </ajc-test> + + <ajc-test dir="features169/transparent" title="two itds on target"> + <compile files="TwoItdsOnTarget.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="features169/transparent" title="two itds on target that already has it"> + <compile files="TwoItdsOnTargetHasAlready.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="features169/transparent" title="declare at on private itd"> + <compile files="OneDeclareAt.java" options="-1.5 -makeAjReflectable"/> + </ajc-test> + + <ajc-test dir="features169/transparent" title="declare at two"> + <compile files="DeclareAtTwo.java" options="-1.5 -makeAjReflectable"/> + </ajc-test> + + <ajc-test dir="features169/transparent" title="three"> + <compile files="Three.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="features169/transparent" title="generics - private"> + <compile files="Generics.java" options="-1.5"/> + <run class="Generics"/> + </ajc-test> + + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc170/Ajc170Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc170/Ajc170Tests.java new file mode 100644 index 000000000..1f1017328 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc170/Ajc170Tests.java @@ -0,0 +1,309 @@ +/******************************************************************************* + * Copyright (c) 2008-2012 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.ajc170; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.Field; +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.weaver.TypeFactory; +import org.aspectj.weaver.UnresolvedType; +import org.aspectj.weaver.World; +import org.aspectj.weaver.internal.tools.StandardPointcutExpressionImpl; +import org.aspectj.weaver.patterns.Pointcut; +import org.aspectj.weaver.patterns.PointcutRewriter; +import org.aspectj.weaver.reflect.ReflectionWorld; +import org.aspectj.weaver.tools.StandardPointcutParser; + +/** + * @author Andy Clement + */ +public class Ajc170Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + +// public void testLostAnnos_377130() { +// runTest("missing annos on priv aspects"); +// } +// +// public void testLostAnnos_377130_2() { +// runTest("missing annos on priv aspects - 2"); +// } + + public void testCovariantGenerics382435_1() { + runTest("covariant generic itds 1"); + } + + public void testCovariantGenerics382435_2() { + runTest("covariant generic itds 2"); + } + + public void testCovariantGenericsItd382189_1() { + runTest("covariant generics 1"); + } + + public void testCovariantGenericsItd382189_2() { + runTest("covariant generics 2"); + } + + public void testCovariantGenericsItd382189_3() { + runTest("covariant generics 3"); + } + + public void testCovariantGenericsItd382189() { + runTest("covariant generics"); + } + + public void testGenericAspectAround382723() { + runTest("generic aspect"); + } + + public void testGenericAspectAround382723_2() { + runTest("generic aspect 2"); + } + + public void testGenericAspectAround382723_3() { + runTest("generic aspect 3"); + } + + public void testGenericAspectAround382723_4() { + runTest("generic aspect 4"); + } + + + public void testAttributeErrorJ7() { + runTest("attribute issue with J7"); + } + + public void testSwitchOnEnum() { + runTest("switch on enum"); + } + + public void testDecAtFieldOrderingLTW1() { + runTest("dec at field ordering ltw 1"); + } + + public void testDecAtFieldOrdering1() { + runTest("dec at field ordering 1"); + } + +// public void testDecAtFieldOrdering2() { +// runTest("dec at field ordering 2"); +// } + + public void testXmlDefsDeclareAnnoType() { + runTest("xml defined dec anno - type"); + } + + public void testXmlDefsDeclareAnnoMethod() { + runTest("xml defined dec at method"); + } + + // anno not runtime vis + public void testXmlDefsDeclareAnnoMethod2() { + runTest("xml defined dec at method 2"); + } + + public void testXmlDefsDeclareAnnoField() { + runTest("xml defined dec at field"); + } + + public void testXmlDefsDeclareAnnoFieldVariants1() { + runTest("xml defined dec anno - variants 1"); + } + + public void testXmlDefsDeclareAnnoFieldVariants2() { + runTest("xml defined dec anno - variants 2"); + } + + public void testXmlDefsDeclareAnnoFieldMultipleValues() { + runTest("xml defined dec anno - multiple values"); + } + + public void testXmlDefsDeclareAnnoFieldMultipleValuesAndSpaces() { + runTest("xml defined dec anno - multiple values and spaces"); + } + + public void testPointcutExpense_374964() { + // check a declaring type being specified causes the call() to be considered cheaper than this() + + World world = new ReflectionWorld(true, getClass().getClassLoader()); + StandardPointcutParser pointcutParser = StandardPointcutParser.getPointcutParserSupportingAllPrimitives(world); + StandardPointcutExpressionImpl pointcutExpression = (StandardPointcutExpressionImpl)pointcutParser.parsePointcutExpression("call(* *(..)) && this(Object)"); + Pointcut pc = pointcutExpression.getUnderlyingPointcut(); + Pointcut newp = new PointcutRewriter().rewrite(pc); + // no declaring type so this() is considered cheaper + assertEquals("(this(java.lang.Object) && call(* *(..)))",newp.toString()); + + pointcutExpression = (StandardPointcutExpressionImpl)pointcutParser.parsePointcutExpression("call(* String.*(..)) && this(Object)"); + pc = pointcutExpression.getUnderlyingPointcut(); + newp = new PointcutRewriter().rewrite(pc); + // declaring type, so call() is cheaper + assertEquals("(call(* java.lang.String.*(..)) && this(java.lang.Object))",newp.toString()); + + pointcutExpression = (StandardPointcutExpressionImpl)pointcutParser.parsePointcutExpression("this(Object) && call(* *(..)) && call(* String.*(..))"); + pc = pointcutExpression.getUnderlyingPointcut(); + newp = new PointcutRewriter().rewrite(pc); + // more complex example, mix of them + assertEquals("((call(* java.lang.String.*(..)) && this(java.lang.Object)) && call(* *(..)))",newp.toString()); + } + + public void testBCExceptionAnnoDecp_371998() { + runTest("BCException anno decp"); + } + + public void testTransientTjpFields()throws Exception { + runTest("transient tjp fields"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "Code"); + Field[] fs = jc.getFields(); + //private static final org.aspectj.lang.JoinPoint$StaticPart ajc$tjp_0 [Synthetic] + //private static final org.aspectj.lang.JoinPoint$StaticPart ajc$tjp_1 [Synthetic] + for (Field f: fs) { + if (!f.isTransient()) { + fail("Field should be transient: "+f); + } + } + } + + public void testGenericsWithTwoTypeParamsOneWildcard() { + UnresolvedType ut; + + ut = TypeFactory.createTypeFromSignature("LFoo<**>;"); + assertEquals(2,ut.getTypeParameters().length); + + ut = TypeFactory.createTypeFromSignature("LFoo<***>;"); + assertEquals(3,ut.getTypeParameters().length); + + ut = TypeFactory.createTypeFromSignature("LFoo<TP;*+Ljava/lang/String;>;"); + assertEquals(2,ut.getTypeParameters().length); + + ut = TypeFactory.createTypeFromSignature("LFoo<*+Ljava/lang/String;TP;>;"); + assertEquals(2,ut.getTypeParameters().length); + + ut = TypeFactory.createTypeFromSignature("LFoo<*+Ljava/lang/String;TP;>;"); + assertEquals(2,ut.getTypeParameters().length); + + ut = TypeFactory.createTypeFromSignature("LFoo<*TT;>;"); + assertEquals(2,ut.getTypeParameters().length); + + ut = TypeFactory.createTypeFromSignature("LFoo<[I>;"); + assertEquals(1,ut.getTypeParameters().length); + + ut = TypeFactory.createTypeFromSignature("LFoo<[I[Z>;"); + assertEquals(2,ut.getTypeParameters().length); + } + + public void testPerThis() { + runTest("perthis"); + } + + public void testPerTarget() { + runTest("pertarget"); + } + + public void testPerCflow() { + runTest("percflow"); + } + + public void testPerTypeWithin() { + runTest("pertypewithin"); + } + + // not specifying -1.7 + public void testDiamond1() { + runTest("diamond 1"); + } + + public void testDiamond2() { + runTest("diamond 2"); + } + + public void testDiamondItd1() { + runTest("diamond itd 1"); + } + + public void testLiterals1() { + runTest("literals 1"); + } + + public void testLiterals2() { + runTest("literals 2"); + } + + public void testLiteralsItd1() { + runTest("literals itd 1"); + } + + public void testStringSwitch1() { + runTest("string switch 1"); + } + + public void testStringSwitch2() { + runTest("string switch 2"); + } + + public void testMultiCatch1() { + runTest("multi catch 1"); + } + + public void testMultiCatch2() { + runTest("multi catch 2"); + } + + public void testMultiCatchWithHandler1() { + runTest("multi catch with handler 1"); + } + + public void testMultiCatchAspect1() { + runTest("multi catch aspect 1"); + } + + // public void testMultiCatchWithHandler2() { + // runTest("multi catch with handler 2"); + // } + + public void testSanity1() { + runTest("sanity 1"); + } + + public void testMissingImpl_363979() { + runTest("missing impl"); + } + + public void testMissingImpl_363979_2() { + runTest("missing impl 2"); + } + + public void testStackOverflow_364380() { + runTest("stackoverflow"); + } + + // public void testTryResources1() { + // runTest("try resources 1"); + // } + // + // public void testTryResources2() { + // runTest("try resources 2"); + // } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc170Tests.class); + } + + @Override + protected File getSpecFile() { + return new File("../tests/src/org/aspectj/systemtest/ajc170/ajc170.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc170/AllTestsAspectJ170.java b/tests/src/test/java/org/aspectj/systemtest/ajc170/AllTestsAspectJ170.java new file mode 100644 index 000000000..fbb7cd2c9 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc170/AllTestsAspectJ170.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc170; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ170 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.7.0 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc170Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc170/IndyTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc170/IndyTests.java new file mode 100644 index 000000000..5846a66fd --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc170/IndyTests.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc170; + +import java.io.File; +import java.io.IOException; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Andy Clement + */ +public class IndyTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + // staticinitialization on bytecode containing methodtyperef/methodhandle/bootstrapmethods/invokedynamic + public void testInvokeDynamic_staticinitialization() throws IOException { + runTest("indy - 1"); + } + + // execution pointcuts on same bytecode + public void testInvokeDynamic_execution() throws IOException { + runTest("indy - 2"); + } + + // call pointcuts on same bytecode + public void testInvokeDynamic_call() throws IOException { + runTest("indy - 3"); + } + + // within(Code1) on same bytecode + public void testInvokeDynamic_target() throws IOException { + runTest("indy - 4"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(IndyTests.class); + } + + @Override + protected File getSpecFile() { + return new File("../tests/src/org/aspectj/systemtest/ajc170/indy.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc170/ajc170.xml b/tests/src/test/java/org/aspectj/systemtest/ajc170/ajc170.xml new file mode 100644 index 000000000..e379d6cab --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc170/ajc170.xml @@ -0,0 +1,398 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs170/pr382723" title="generic aspect"> + <compile files="FooAspect.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs170/pr382723" title="generic aspect 2"> + <compile files="FooAspect2.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs170/pr382723" title="generic aspect 3"> + <compile files="FooAspect3.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs170/pr382723" title="generic aspect 4"> + <compile files="Foo.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'constructor-call(void java.util.LinkedList.<init>())' in Type 'Foo' (Foo.java:41) advised by around advice from 'Bar' (Foo.java:14)"/> + </compile> + <run class="Foo"> + <stdout> + <line text="superaspect getNumber returns -2"/> + <line text="Bar.method() running"/> + <line text="abstract method returns []"/> + </stdout> + </run> + </ajc-test> + + + <!-- no declare parents, only ITD --> + <ajc-test dir="bugs170/pr382189/one" title="covariant generics 1"> + <compile files="A.java A_ITD.aj B.java SuperA.java SuperB.java" options="-1.5"/> + </ajc-test> + + <!-- now declare parents and ITD --> + <ajc-test dir="bugs170/pr382189/two" title="covariant generics 2"> + <compile files="A.java A_ITD.aj B.java SuperA.java SuperB.java" options="-1.5"/> + </ajc-test> + + <!-- now run it --> + <ajc-test dir="bugs170/pr382189/three" title="covariant generics 3"> + <compile files="A.java A_ITD.aj B.java SuperA.java SuperB.java" options="-1.5"/> + <run class="A"/> + </ajc-test> + + <ajc-test dir="bugs170/pr382435/one" title="covariant generic itds 1"> + <compile files="bug/A.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs170/pr382435/two" title="covariant generic itds 2"> + <compile files="bug/A.java" options="-1.5"/> + <run class="bug.A"/> + </ajc-test> + + <ajc-test dir="bugs170/pr382189" title="covariant generics"> + <compile files="covbug/A.java covbug/A_ITD.aj covbug/B.java covbug/SuperA.java covbug/SuperB.java" options="-1.5"/> + <!-- <run class="Foo"> + <stdout> + <line text="@Anno()"/></stdout> + </run> --> + </ajc-test> + + <ajc-test dir="bugs170/pr377130" title="missing annos on priv aspects"> + <compile files="Foo.java" options="-1.5"/> + <run class="Foo"> + <stdout> + <line text="@Anno()"/></stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs170/pr377130" title="missing annos on priv aspects - 2"> + <compile files="Foo2.java" options="-1.5"/> + <run class="Foo2"> + <stdout> + <line text="@Anno()"/></stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs170/pr376351" title="attribute issue with J7"> + <compile files="R.java R1.java" outjar="code.jar" options="-1.5"/> + <compile files="RAj.java" options="-1.7 -Xlint:ignore" outjar="aspects.jar" classpath="code.jar"/> + <compile inpath="code.jar" aspectpath="aspects.jar" options="-showWeaveInfo"> + <message kind="weave" text="Join point 'constructor-call(void R.<init>())'"/> + </compile> + <!-- + if we had a 1.7 vm we could use this: + <compile files="RAj.java" options="-1.7 -Xlint:ignore"/> + <run class="R" ltw="aop.xml"> + <stderr> + <line text="org.aspectj.weaver.tools.Jdk14Trace error"/> + <line text="Unsupported major.minor version 51.0"/> + <line text="java.lang.UnsupportedClassVersionError: RAj :"/> + </stderr> + </run> + --> + </ajc-test> + + <ajc-test dir="bugs170/pr376139" title="switch on enum"> + <compile files="Code.java" options="-1.5"/> + <run class="Code"/> + </ajc-test> + + <ajc-test dir="bugs170/ltw" title="dec at field ordering 1"> + <compile files="Anno.java TriggerAll.java MyObject.java Main.java" options="-1.5"/> + <run class="ch.tests.Main"> + <stdout> + <line text="Triggered"/> + <line text="Triggered"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs170/ltw" title="dec at field ordering 2"> + <compile files="Anno.java Main.java TriggerAll.java MyObject.java" options="-1.5"/> + <run class="ch.tests.Main"> + <stdout> + <line text="Triggered"/> + <line text="Triggered"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs170/ltw" title="dec at field ordering ltw 1"> + <compile files="Anno.java Main.java MyObject.java" options="-1.5"/> + <compile files="TriggerAll.java" options="-Xlint:ignore -1.5 "/> + <run class="ch.tests.Main" ltw="aop.xml"> + <stdout> + <line text="Triggered"/> + <line text="Triggered"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs170/xmldefs" title="xml defined dec at method"> + <compile files="Hello.java Anno.java" options="-1.5"/> + <run class="Hello" ltw="aop.xml"> + <stdout> + <line text="Hello"/> + <line text="World"/> + <line text="Annotations on sayHello? true"/> + <line text="Annotation count is 1"/> + <line text="@Anno"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs170/xmldefs" title="xml defined dec at method 2"> + <compile files="Hello.java Anno2.java" options="-1.5"/> + <run class="Hello" ltw="aop2.xml"> + <stdout> + <line text="Hello"/> + <line text="World"/> + <line text="Annotations on sayHello? false"/> + </stdout> + <stderr> + <line text="info AspectJ Weaver"/> + <line text="info register"/> + <line text="info using configuration"/> + <line text="info define aspect ConjuredUp"/> + <line text="error declare is using an annotation type that does not have runtime retention: @Anno2"/> + <line text="info weaver"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs170/xmldefs" title="xml defined dec at field"> + <compile files="Hello2.java Anno.java" options="-1.5"/> + <run class="Hello2" ltw="aop3.xml"> + <stdout> + <line text="Annotations on i? true"/> + <line text="Annotation count is 1"/> + <line text="@Anno"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs170/xmldefs" title="xml defined dec anno - variants 1"> + <compile files="Hello4.java Anno4.java" options="-1.5"/> + <run class="Hello4" ltw="aop4.xml"> + <stdout> + <line text="Annotations on field1? true"/> + <line text="Annotation count is 4"/> + <line text="@AnnoBoolean(value=true, zzz=false)"/> + <line text="@AnnoClass(value=class java.lang.Integer, ccc=class java.lang.String)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="@AnnoClass(value=java.lang.Integer.class, ccc=java.lang.String.class)" vm="9+"/> + <line text="@AnnoLong(value=999, jjj=111)"/> + <line text="@AnnoString(value=set from xml, sss=xyz)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="@AnnoString(value="set from xml", sss="xyz")" vm="9+"/> + <line text="Annotations on field2? true"/> + <line text="Annotation count is 1"/> + <line text="@AnnoClass(value=class java.lang.String, ccc=class java.lang.String)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="@AnnoClass(value=java.lang.String.class, ccc=java.lang.String.class)" vm="9+"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs170/xmldefs" title="xml defined dec anno - variants 2"> + <compile files="Hello5.java Anno5.java" options="-1.5"/> + <run class="Hello5" ltw="aop5.xml"> + <stdout> + <line text="Annotations on field1? true"/> + <line text="Annotation count is 4"/> + <line text="@AnnoChar(value=z, ccc=a)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="@AnnoChar(value='z', ccc='a')" vm="9+"/> + <line text="@AnnoDouble(value=99.0, ddd=3.0)"/> + <line text="@AnnoFloat(value=6.0, fff=4.0)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="@AnnoFloat(value=6.0f, fff=4.0f)" vm="9+"/> + <line text="@AnnoShort(value=8, sss=3)"/> + <line text="Annotations on field2? true"/> + <line text="Annotation count is 2"/> + <line text="@AnnoByte(value=88, bbb=66)"/> + <line text="@AnnoInt(iii=111, value=99)"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs170/xmldefs" title="xml defined dec anno - multiple values"> + <compile files="Hello6.java Anno6.java" options="-1.5"/> + <run class="Hello6" ltw="aop6.xml"> + <stdout> + <line text="Annotations on field1? true"/> + <line text="Annotation count is 1"/> + <line text="@Annot(a=a, fred=false, value=abc)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="@Annot(a='a', fred=false, value="abc")" vm="9+"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs170/xmldefs" title="xml defined dec anno - multiple values and spaces"> + <compile files="Hello6.java Anno6.java" options="-1.5"/> + <run class="Hello6" ltw="aop6a.xml"> + <stdout> + <line text="Annotations on field1? true"/> + <line text="Annotation count is 1"/> + <line text="@Annot(a=a, fred=false, value=abc)" vm="1.4,1.5,1.6,1.7,1.8"/> + <line text="@Annot(a='a', fred=false, value="abc")" vm="9+"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs170/xmldefs" title="xml defined dec anno - type"> + <compile files="Hello7.java Anno7.java" options="-1.5"/> + <run class="Hello7" ltw="aop7.xml"> + <stdout> + <line text="Annotations on Hello7? true"/> + <line text="Annotation count is 1"/> + <line text="@Anno"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs170/pr371998" title="BCException anno decp"> + <compile files="AspectTest.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Extending interface set for type 'Foo' (AspectTest.java) to include 'X' (AspectTest.java)"/> + <message kind="weave" text="Type 'Foo' (AspectTest.java) has intertyped method from 'AspectTest' (AspectTest.java:'void X.xxx()')"/> + <message kind="weave" text="Extending interface set for type 'Bar' (AspectTest.java) to include 'X' (AspectTest.java)"/> + <message kind="weave" text="Type 'Bar' (AspectTest.java) has intertyped method from 'AspectTest' (AspectTest.java:'void X.xxx()')"/> + </compile> + <run class="AspectTest"/> + </ajc-test> + + <ajc-test dir="bugs170/transientTjpFields" title="transient tjp fields"> + <compile files="Code.java" options="-Xset:makeTjpFieldsTransient=true"> + </compile> + </ajc-test> + + <ajc-test dir="bugs170/language" title="perthis"> + <compile files="PerThis.java" options="-1.7"> + </compile> + </ajc-test> + + <ajc-test dir="bugs170/language" title="pertarget"> + <compile files="PerTarget.java" options="-1.7"> + </compile> + </ajc-test> + + <ajc-test dir="bugs170/language" title="percflow"> + <compile files="PerCflow.java" options="-1.7"> + </compile> + </ajc-test> + + <ajc-test dir="bugs170/language" title="pertypewithin"> + <compile files="PerTypeWithin.java" options="-1.7"> + </compile> + </ajc-test> + + <ajc-test dir="bugs170/language" title="diamond 1"> + <compile files="Diamond.java" options="-1.5"> + <message kind="error" line="11" text="'<>' operator is not allowed for source level below 1.7"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs170/language" title="diamond 2"> + <compile files="Diamond.java" options="-1.7"> + </compile> + </ajc-test> + + <ajc-test dir="bugs170/language" title="diamond itd 1"> + <compile files="DiamondITD.java" options="-1.7"> + </compile> + </ajc-test> + + <ajc-test dir="bugs170/language" title="literals 1"> + <compile files="Literals.java" options="-1.5"> + <message kind="error" line="8" text="Underscores can only be used with source level 1.7 or greater"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs170/language" title="literals 2"> + <compile files="Literals.java" options="-1.7"> + </compile> + </ajc-test> + + <ajc-test dir="bugs170/language" title="literals itd 1"> + <compile files="LiteralsITD.java" options="-1.7"> + </compile> + </ajc-test> + + <ajc-test dir="bugs170/language" title="string switch 1"> + <compile files="StringSwitch.java" options="-1.5"> + <message kind="error" line="9" text="Cannot switch on a value of type String for source level below 1.7. Only convertible int values or enum variables are permitted"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs170/language" title="string switch 2"> + <compile files="StringSwitch.java" options="-1.7"> + </compile> + </ajc-test> + + <ajc-test dir="bugs170/language" title="multi catch 1"> + <compile files="MultiCatch.java" options="-1.5"> + <message kind="error" line="6" text="Multi-catch parameters are not allowed for source level below 1.7"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs170/language" title="multi catch 2"> + <compile files="MultiCatch.java" options="-1.7"> + </compile> + </ajc-test> + + <ajc-test dir="bugs170/language" title="multi catch with handler 1"> + <compile files="MultiCatchWithHandler.java" options="-1.7"> + </compile> + </ajc-test> + + <ajc-test dir="bugs170/language" title="multi catch aspect 1"> + <compile files="MultiCatchAspect.java" options="-1.7"> + </compile> + </ajc-test> + + <ajc-test dir="bugs170/language" title="try resources 1"> + <compile files="TryResources.java" options="-1.7"> + </compile> + </ajc-test> + + <ajc-test dir="bugs170/language" title="try resources 2"> + <compile files="TryResourcesAspect.java" options="-1.7"> + </compile> + </ajc-test> + + <ajc-test dir="bugs170/language" title="multi catch with handler 2"> + <compile files="MultiCatchWithHandler2.java" options="-1.7"> + </compile> + <run class="MultiCatchWithHandler2"></run> + </ajc-test> + + <ajc-test dir="bugs170/sanity" title="sanity 1"> + <compile files="DeclareAtType.java" options="-1.5"> + </compile> + </ajc-test> + + <ajc-test dir="bugs170/pr363979" title="missing impl"> + <compile files="Example.java" options="-1.5"/> + <run class="Example"> + <stdout> + <line text="yes"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs170/pr363979" title="missing impl 2"> + <compile files="Example2.java" options="-1.5"/> + <run class="Example2"> + <stdout> + <line text="yes"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs170/pr364380" title="stackoverflow"> + <compile files="X.aj" options="-1.5" outjar="foo.jar"/> + <compile files="C.java" options="-1.5" inpath="foo.jar"> + <message kind="warning" text="An advice already exists for setting an owner"/> + </compile> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc170/indy.xml b/tests/src/test/java/org/aspectj/systemtest/ajc170/indy.xml new file mode 100644 index 000000000..0c4bbe580 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc170/indy.xml @@ -0,0 +1,59 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="indy/one" title="indy - 1"> + <compile files="Code1.java,Asp.java" inpath="indy.jar" options="-1.7"/> + <run class="Invoker"> + <stdout> + <line text="staticinitialization(Invoker.<clinit>)"/> + <line text="staticinitialization(Code1.<clinit>)"/> + <line text="foo() is running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="indy/two" title="indy - 2"> + <compile files="Code1.java,Asp.java" inpath="indy.jar" options="-1.7"/> + <run class="Invoker"> + <stdout> + <line text="execution(void Invoker.main(String[]))"/> + <line text="execution(CallSite Code1.bootstrap(MethodHandles.Lookup, String, MethodType))"/> + <line text="execution(void Code1.foo())"/> + <line text="foo() is running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="indy/three" title="indy - 3"> + <compile files="Code1.java,Asp.java" inpath="indy.jar" options="-1.7"/> + <run class="Invoker"> + <stdout> + <line text="call(MethodHandles.Lookup java.lang.invoke.MethodHandles.lookup())"/> + <line text="call(Class java.lang.invoke.MethodHandles.Lookup.lookupClass())"/> + <line text="call(MethodHandle java.lang.invoke.MethodHandles.Lookup.findStatic(Class, String, MethodType))"/> + <line text="call(void java.io.PrintStream.println(String))"/> + <line text="foo() is running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="indy/four" title="indy - 4"> + <compile files="Code1.java,Asp.java" inpath="indy.jar" options="-1.7"/> + <run class="Invoker"> + <stdout> + <line text="staticinitialization(Code1.<clinit>)"/> + <line text="execution(CallSite Code1.bootstrap(MethodHandles.Lookup, String, MethodType))"/> + <line text="call(MethodHandles.Lookup java.lang.invoke.MethodHandles.lookup())"/> + <line text="call(Class java.lang.invoke.MethodHandles.Lookup.lookupClass())"/> + <line text="call(MethodHandle java.lang.invoke.MethodHandles.Lookup.findStatic(Class, String, MethodType))"/> + <line text="call(java.lang.invoke.ConstantCallSite(MethodHandle))"/> + <line text="execution(void Code1.foo())"/> + <line text="get(PrintStream java.lang.System.out)"/> + <line text="call(void java.io.PrintStream.println(String))"/> + <line text="foo() is running"/> + </stdout> + </run> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc171/Ajc171Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc171/Ajc171Tests.java new file mode 100644 index 000000000..922ac483a --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc171/Ajc171Tests.java @@ -0,0 +1,75 @@ +/******************************************************************************* + * Copyright (c) 2012 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.ajc171; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Andy Clement + */ +public class Ajc171Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testNpe_pr384401() { + runTest("npe"); + } + + public void testUnresolvableEnum_pr387568() { + runTest("unresolvable enum"); + } + + public void testAbstractItds_pr386049() { + runTest("itd abstract"); + } + + public void testPublicITDFs_pr73507_1() { + runTest("public ITDfs - 1"); + } + + public void testPublicITDFs_pr73507_2() { + runTest("public ITDfs - 2"); + } + + public void testPublicITDFs_pr73507_3() { + runTest("public ITDfs - 3"); + } + + public void testPublicITDFs_pr73507_4() { + runTest("public ITDfs - 4"); + } + + public void testPublicITDFs_pr73507_5() { + runTest("public ITDfs - 5"); + } + + public void testGenerics_384398() { + runTest("generics itds"); + } + +// public void testGenerics_384398_2() { +// runTest("generics itds 2"); +// } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc171Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc171.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc171/Ajc171Tests_need17jre.java b/tests/src/test/java/org/aspectj/systemtest/ajc171/Ajc171Tests_need17jre.java new file mode 100644 index 000000000..d6faaa516 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc171/Ajc171Tests_need17jre.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * Copyright (c) 2012 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.ajc171; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Andy Clement + */ +public class Ajc171Tests_need17jre extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testSoft17_pr387444() { + runTest("soft 17"); + } + + public void testSoft17_pr387444_2() { + runTest("soft 17 2"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc171Tests_need17jre.class); + } + + @Override + protected File getSpecFile() { + return new File("../tests/src/org/aspectj/systemtest/ajc171/ajc171.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc171/AllTestsAspectJ171.java b/tests/src/test/java/org/aspectj/systemtest/ajc171/AllTestsAspectJ171.java new file mode 100644 index 000000000..f9d309794 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc171/AllTestsAspectJ171.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc171; + +import org.aspectj.systemtest.ajc1610.NewFeatures; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ171 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.7.1 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc171Tests.suite()); + suite.addTest(NewFeatures.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc171/NewFeatures.java b/tests/src/test/java/org/aspectj/systemtest/ajc171/NewFeatures.java new file mode 100644 index 000000000..6a713e930 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc171/NewFeatures.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2012 Lucierna + * 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: + * Abraham Nevado (lucierna) - initial implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc171; + +import java.io.File; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.testing.XMLBasedAjcTestCase; + +import junit.framework.Test; + +// NOTE THIS IS ACTUALLY IN 1.7.2 - IT IS JUST THAT THE PATCH WAS CREATED AGAINST 1.7.1 +public class NewFeatures extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testSharedCache() { + this.runTest("Test Shared Cache"); + File cacheFolder = new File(ajc.getSandboxDirectory().getAbsolutePath() + File.separator + "panenka.cache"); + assertTrue("Cache folder should be written when using share cache", cacheFolder.exists()); + //Delete the cache from the ajc sandbox + deleteFolder(cacheFolder); + } + + public void testPerClassLoaderCache() { + this.runTest("Test Per ClassLoader Cache"); + File cacheFolder = new File(ajc.getSandboxDirectory().getAbsolutePath() + File.separator + "panenka.cache"); + assertFalse("Shared Cache Folder should not be present", cacheFolder.exists()); + } + + public void testDefaultCachePerClassloader() { + this.runTest("Test Default Cache Per ClassLoader"); + File cacheFolder = new File(ajc.getSandboxDirectory().getAbsolutePath() + File.separator + "panenka.cache"); + assertFalse("By Default Per ClassLoader Cache should be used and not the shared one", cacheFolder.exists()); + } + + // /////////////////////////////////////// + + private static void deleteFolder(File folder) { + File[] files = folder.listFiles(); + if(files!=null) { //some JVMs return null for empty dirs + for(File f: files) { + if(f.isDirectory()) { + deleteFolder(f); + } else { + f.delete(); + } + } + } + folder.delete(); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(NewFeatures.class); + } + + @SuppressWarnings("unused") + private JavaClass getMyClass(String className) throws ClassNotFoundException { + return getClassFrom(ajc.getSandboxDirectory(), className); + } + + @Override + protected File getSpecFile() { + return new File("../tests/src/org/aspectj/systemtest/ajc171/newfeatures-tests.xml"); + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc171/ajc171.xml b/tests/src/test/java/org/aspectj/systemtest/ajc171/ajc171.xml new file mode 100644 index 000000000..d9a7651f3 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc171/ajc171.xml @@ -0,0 +1,116 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs171/pr384401" title="npe"> + <compile files="X.java" options="-1.5"> + <message kind="error" line="9" text="the advice annotation must specify a pointcut value"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs171/pr387444" title="soft 17"> + <compile files="Code.java" options="-1.7"/> + </ajc-test> + + <ajc-test dir="bugs171/pr387444" title="soft 17 2"> + <compile files="Code2.java" options="-1.7"/> + <run class="Code2"> + <stdout> + <line text="foo"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs171/pr387568" title="unresolvable enum"> + <compile files="Color.java Code.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs171/pr386049" title="itd abstract"> + <compile files="de/scrum_master/galileo/filter/BasicFilter.java de/scrum_master/galileo/filter/JsoupFilter.java de/scrum_master/galileo/LoggingAspect.aj" options="-1.5"/> + <run class="de.scrum_master.galileo.filter.JsoupFilter"> + <stdout> + <line text="JsoupFilter.getLogMessage()"/> + <line text="run()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs171/pr73507" title="public ITDfs - 1"> + <compile files="Case1.java" options="-1.5"/> + <run class="Case1"> + <stdout> + <line text="Found a field called i"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs171/pr73507" title="public ITDfs - 2"> + <compile files="Case2.java" options="-1.5"/> + <run class="Case2"> + <stdout> + <line text="Value of C.i is 1"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs171/pr73507" title="public ITDfs - 3"> + <compile files="Case3.java" options="-1.5"/> + <run class="Case3"> + <stdout> + <line text="Value of C.i is 1"/> + <line text="Value of C.j is 1"/> + <line text="Value of C.k is 5"/> + <line text="Value of I.i is 1"/> + <line text="Value of I.j is 1"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs171/pr73507" title="public ITDfs - 4"> + <compile files="Case4.java" options="-1.5"> + <message kind="error" line="13" text="can't override java.lang.String I.i with int C.i return types don't match"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs171/pr73507" title="public ITDfs - 5"> + <compile files="Case5.java" options="-1.5"/> + <run class="Case5"> + <stdout> + <line text="public java.lang.String C.str"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs171/pr384398" title="generics itds"> + <compile files="A.java B.java BAspect.aj" options="-1.5"> + <!-- + <message kind="weave" text="Join point 'constructor-call(void java.util.LinkedList.<init>())' in Type 'Foo' (Foo.java:41) advised by around advice from 'Bar' (Foo.java:14)"/> + --> + </compile> + <!-- + <run class="Foo"> + <stdout> + <line text="superaspect getNumber returns -2"/> + <line text="Bar.method() running"/> + <line text="abstract method returns []"/> + </stdout> + </run> --> + </ajc-test> + + <ajc-test dir="bugs171/pr384398_2" title="generics itds 2"> + <compile files="A.java B.java BAspect.aj" options="-1.5"> + <!-- + <message kind="weave" text="Join point 'constructor-call(void java.util.LinkedList.<init>())' in Type 'Foo' (Foo.java:41) advised by around advice from 'Bar' (Foo.java:14)"/> + --> + </compile> + <!-- + <run class="Foo"> + <stdout> + <line text="superaspect getNumber returns -2"/> + <line text="Bar.method() running"/> + <line text="abstract method returns []"/> + </stdout> + </run> --> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc171/newfeatures-tests.xml b/tests/src/test/java/org/aspectj/systemtest/ajc171/newfeatures-tests.xml new file mode 100644 index 000000000..32f0f1845 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc171/newfeatures-tests.xml @@ -0,0 +1,41 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.7.1 Features Tests --> +<suite> + <ajc-test dir="features171/pr386341" title="Test Shared Cache"> + <compile files="A.java" options="-1.5"/> + <compile files="X.aj" options="-1.5 -Xlint:ignore" /> + <run class="A" ltw="aop.xml" usefullltw="true" vmargs="-Daj.weaving.cache.enabled=true -Daj.weaving.cache.dir=./ -Daj.weaving.cache.impl=shared" > + <stdout> + <line text="It Worked-before"/> + <line text="It Worked-after"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features171/pr386341" title="Test Per ClassLoader Cache"> + <compile files="A.java" options="-1.5"/> + <compile files="X.aj" options="-1.5 -Xlint:ignore" /> + <run class="A" ltw="aop.xml" usefullltw="true" vmargs="-Daj.weaving.cache.enabled=true -Daj.weaving.cache.dir=./ -Daj.weaving.cache.impl=perloader" > + <stdout> + <line text="It Worked-before"/> + <line text="It Worked-after"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features171/pr386341" title="Test Default Cache Per ClassLoader"> + <compile files="A.java" options="-1.5"/> + <compile files="X.aj" options="-1.5 -Xlint:ignore" /> + <run class="A" ltw="aop.xml" usefullltw="true" vmargs="-Daj.weaving.cache.enabled=true -Daj.weaving.cache.dir=./" > + <stdout> + <line text="It Worked-before"/> + <line text="It Worked-after"/> + </stdout> + </run> + </ajc-test> + + + + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc172/Ajc172Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc172/Ajc172Tests.java new file mode 100644 index 000000000..c4c10d1fa --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc172/Ajc172Tests.java @@ -0,0 +1,210 @@ +/******************************************************************************* + * Copyright (c) 2012 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.ajc172; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Andy Clement + */ +public class Ajc172Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testUnsupportedShouldBeNormalError_pr391384() { + runTest("unsupported should be normal error"); + } + + // if the test is failing because the classes won't run, remove the run blocks from the ajc172.xml entry and re-run to check signatures. + public void testSignatures_pr394535() throws Exception { + runTest("signatures"); + + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"Bug2$ClassA2"); // the working one + String sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T::LBug2$Interface12;:LBug2$Interface22;>Ljava/lang/Object;Ljava/io/Serializable;", sss); + + jc = getClassFrom(ajc.getSandboxDirectory(),"Bug$ClassA"); + sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T::LBug$Interface1;:LBug$Interface2;>Ljava/lang/Object;Ljava/io/Serializable;", sss); + } + + // extends + public void testPSignatures_pr399590() throws Exception { + runTest("p signatures 1"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"Cage"); + String sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T:LAnimal<+LCage<TT;>;>;>LBar;", sss); + jc = getClassFrom(ajc.getSandboxDirectory(),"Cage2"); + sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T:LAnimal2<+LCage2<TT;>;>;>LBar2;Ljava/io/Serializable;", sss); + } + + // extends two classes + public void testPSignatures_pr399590_2() throws Exception { + runTest("p signatures 2"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"Cage"); + String sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T:LAnimal<+LCage<TT;LIntf;>;LIntf;>;Q:Ljava/lang/Object;>LBar;", sss); + jc = getClassFrom(ajc.getSandboxDirectory(),"Cage2"); + sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T:LAnimal2<+LCage2<TT;LIntf2;>;LIntf2;>;Q:Ljava/lang/Object;>LBar2;Ljava/io/Serializable;", sss); + } + + // super + public void testPSignatures_pr399590_3() throws Exception { + runTest("p signatures 3"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"Cage"); + String sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T:LAnimal<-LXXX<TT;>;>;>LBar;", sss); + jc = getClassFrom(ajc.getSandboxDirectory(),"Cage2"); + sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T:LAnimal2<-LXXX2<TT;>;>;>LBar2;Ljava/io/Serializable;", sss); + } + + // super + public void testPSignatures_pr399590_4() throws Exception { + runTest("p signatures 4"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"Cage"); + String sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T:LAnimal<-LXXX<TT;>;LYYY;>;>LBar;", sss); + jc = getClassFrom(ajc.getSandboxDirectory(),"Cage2"); + sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T:LAnimal2<-LXXX2<TT;>;LYYY2;>;>LBar2;Ljava/io/Serializable;", sss); + } + + // unbound + public void testPSignatures_pr399590_5() throws Exception { + runTest("p signatures 5"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"Cage"); + String sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T:LAnimal<*>;>LBar;", sss); + jc = getClassFrom(ajc.getSandboxDirectory(),"Cage2"); + sss = jc.getSignatureAttribute().getSignature(); + assertEquals("<T:LAnimal2<*>;>LBar2;Ljava/io/Serializable;", sss); + } + + public void testIfPointcutNames_pr398246() throws Exception { + runTest("if pointcut names"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X"); + Method m = getMethodStartsWith(jc, "ajc$if"); + assertEquals("ajc$if$andy", m.getName()); + } + + public void testIfPointcutNames_pr398246_2() throws Exception { + runTest("if pointcut names 2"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X"); + Method m = getMethodStartsWith(jc, "ajc$if"); + assertEquals("ajc$if$fred", m.getName()); + } + + // fully qualified annotation name is used + public void testIfPointcutNames_pr398246_3() throws Exception { + runTest("if pointcut names 3"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X"); + Method m = getMethodStartsWith(jc, "ajc$if"); + assertEquals("ajc$if$barney", m.getName()); + } + + // compiling a class later than the initial build - does it pick up the + // right if clause name? + public void testIfPointcutNames_pr398246_4() throws Exception { + runTest("if pointcut names 4"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X"); + Method m = getMethodStartsWith(jc, "ajc$if"); + assertEquals("ajc$if$sid", m.getName()); + } + + // new style generated names + public void testIfPointcutNames_pr398246_5() throws Exception { + runTest("if pointcut names 5"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X"); + Method m = getMethodStartsWith(jc, "ajc$if"); + assertEquals("ajc$if$ac0cb804", m.getName()); + + jc = getClassFrom(ajc.getSandboxDirectory(), "X2"); + m = getMethodStartsWith(jc, "ajc$if"); + assertEquals("ajc$if$ac0cb804", m.getName()); + } + + // new style generated names - multiple ifs in one pointcut + public void testIfPointcutNames_pr398246_6() throws Exception { + runTest("if pointcut names 6"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X"); + Method m = getMethodStartsWith(jc, "ajc$if",1); + assertEquals("ajc$if$aac93da8", m.getName()); + m = getMethodStartsWith(jc, "ajc$if",2); + assertEquals("ajc$if$1$ae5e778a", m.getName()); + } + + // new style generated names - multiple ifs in one advice + public void testIfPointcutNames_pr398246_7() throws Exception { + runTest("if pointcut names 7"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "X"); + Method m = getMethodStartsWith(jc, "ajc$if",1); + assertEquals("ajc$if$1$ac0607c", m.getName()); + m = getMethodStartsWith(jc, "ajc$if",2); + assertEquals("ajc$if$1$1$4d4baf36", m.getName()); + } + + public void testOptionalAspects_pr398588() { + runTest("optional aspects"); + } + + public void testInconsistentClassFile_pr389750() { + runTest("inconsistent class file"); + } + + public void testInconsistentClassFile_pr389750_2() { + runTest("inconsistent class file 2"); + } + + public void testInconsistentClassFile_pr389750_3() { + runTest("inconsistent class file 3"); + } + + public void testInconsistentClassFile_pr389750_4() { + runTest("inconsistent class file 4"); + } + + public void testAnnotationValueError_pr389752_1() { + runTest("annotation value error 1"); + } + + public void testAnnotationValueError_pr389752_2() { + runTest("annotation value error 2"); + } + + // this needs some cleverness to fix... the annotation value is parsed as a + // string and then not checked + // to see if the user is accidentally supplying, for example, an enum value. + // Due to the use of strings, it + // is hard to check. The verification code might go here: + // WildAnnotationTypePattern, line 205 (the string case) + // public void testAnnotationValueError_pr389752_3() { + // runTest("annotation value error 3"); + // } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc172Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc172.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc172/AllTestsAspectJ172.java b/tests/src/test/java/org/aspectj/systemtest/ajc172/AllTestsAspectJ172.java new file mode 100644 index 000000000..b79cc40fa --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc172/AllTestsAspectJ172.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc172; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ172 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.7.2 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc172Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc172/ajc172.xml b/tests/src/test/java/org/aspectj/systemtest/ajc172/ajc172.xml new file mode 100644 index 000000000..3eb4f2cb3 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc172/ajc172.xml @@ -0,0 +1,204 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs172/pr391384" title="unsupported should be normal error"> + <compile files="Code.java" options="-1.5"> + <message kind="error" text="Compiler limitation: annotation value support not implemented for type java.lang.String[]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs172/pr394535" title="signatures"> + <compile files="Bug.java" options="-1.5"/> + <compile files="Bug2.java" options="-1.5"/> + <run class="Bug2"/> + <run class="Bug"/> + </ajc-test> + + <ajc-test dir="bugs172/pr399590" title="p signatures 1"> + <compile files="Cage.java" options="-1.5"/> + <compile files="Cage2.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs172/pr399590/two" title="p signatures 2"> + <compile files="Cage.java" options="-1.5"/> + <compile files="Cage2.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs172/pr399590/three" title="p signatures 3"> + <compile files="Cage.java" options="-1.5"/> + <compile files="Cage2.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs172/pr399590/four" title="p signatures 4"> + <compile files="Cage.java" options="-1.5"/> + <compile files="Cage2.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs172/pr399590/five" title="p signatures 5"> + <compile files="Cage.java" options="-1.5"/> + <compile files="Cage2.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs172/pr398588" title="optional aspects"> + <compile files="Anno.java Anno2.java" outjar="anno.jar" options="-1.5"/> + <compile files="AspectA.java" classpath="anno.jar" outjar="aspect.jar" options="-Xlint:ignore -1.5"/> + <compile files="AspectB.java" outjar="aspect2.jar" options="-Xlint:ignore -1.5"/> + <compile files="Code.java Blah.java" classpath="aspect.jar;aspect2.jar" options="-1.5"/> + <compile files="AspectC.java" classpath="$sandbox" outjar="aspect3.jar" options="-Xlint:ignore -1.5"/> + <compile files="AspectD.java" classpath="anno.jar" outjar="aspect4.jar" options="-Xlint:ignore -1.5"/> + + <file deletefile="anno.jar"/> + <run class="Code" ltw="META-INF/aop.xml" classpath=".;aspect.jar;aspect2.jar;aspectj3.jar;aspect4.jar"> + <stderr> + <line text="AspectJ Weaver Version"/> + <line text="register classloader"/> + <line text="using configuration"/> + <line text="register aspect AspectA"/> + <line text="deactivating aspect"/> + <line text="register aspect AspectB"/> + <line text="register aspect AspectC"/> + <line text="register aspect AspectD"/> + <line text="deactivating aspect 'AspectD' as it requires type 'a.b.c.Anno2' which cannot be found on the classpath"/> + <line text="Join point 'method-execution(void Code.main(java.lang.String[]))' in Type 'Code' (Code.java:7) advised by before advice from 'AspectC'"/> + <line text="Join point 'staticinitialization(void Code.<clinit>())' in Type 'Code' (Code.java) advised by before advice from 'AspectB'"/> + <line text="processing reweavable"/> + <line text="processing reweavable"/> + </stderr> + <stdout> + <line text="staticinitialization"/> + <line text="C"/> + <line text="abcde"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs172/pr398246" title="if pointcut names"> + <compile files="Code.java" options="-1.5"> + </compile> + <run class="Code" options="-1.5"> + <stdout> + <line text="advice"/> + <line text="advice"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs172/pr398246" title="if pointcut names 2"> + <compile files="Code2.java" options="-1.5"> + </compile> + <run class="Code2" options="-1.5"> + <stdout> + <line text="advice"/> + <line text="advice"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs172/pr398246" title="if pointcut names 3"> + <compile files="Code3.java" options="-1.5"> + </compile> + <run class="Code3" options="-1.5"> + <stdout> + <line text="advice"/> + <line text="advice"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs172/pr398246" title="if pointcut names 4"> + <compile files="Code4.java" options="-1.5"></compile> + <compile files="Code4.java" options="-1.5" outjar="aspects.jar"/> + <run class="Code4" options="-1.5"> + <stdout> + <line text="advice"/> + <line text="advice"/> + </stdout> + </run> + <compile files="CodeExtra4.java" aspectpath="aspects.jar" options="-1.5"></compile> + <run class="CodeExtra4" options="-1.5"> + <stdout> + <line text="advice"/> + <line text="advice"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs172/pr398246" title="if pointcut names 5"> + <compile files="Code5.java Code5a.java" options="-1.5"> + </compile> + <run class="Code5" options="-1.5"> + <stdout> + <line text="advice"/> + <line text="advice"/> + <line text="advice"/> + <line text="advice"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs172/pr398246" title="if pointcut names 6"> + <compile files="Code6.java" options="-1.5"> + </compile> + <run class="Code6" options="-1.5"> + <stdout> + <line text="advice"/> + <line text="advice"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs172/pr398246" title="if pointcut names 7"> + <compile files="Code7.java" options="-1.5"> + </compile> + <run class="Code7" options="-1.5"> + <stdout> + <line text="advice"/> + <line text="advice"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs172/pr389750" title="inconsistent class file"> + <compile files="Code.aj" options="-1.5"> + </compile> + <compile files="Clazz.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs172/pr389750" title="inconsistent class file 2"> + <compile files="Code2.aj" outjar="azpect.jar" options="-1.5"> + </compile> + <compile files="Clazz2.java" aspectpath="azpect.jar" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs172/pr389750" title="inconsistent class file 3"> + <compile files="Code3.aj" outjar="azpect.jar" options="-1.5"> + </compile> + <compile files="Clazz3.java" aspectpath="azpect.jar" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs172/pr389750" title="inconsistent class file 4"> + <compile files="Code4.aj" outjar="azpect.jar" options="-1.5"> + </compile> + <compile files="Clazz4.java" aspectpath="azpect.jar" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs172/pr389752" title="annotation value error 1"> + <compile files="Code.java" options="-1.5"> + <message kind="error" text="Invalid annotation value 'AA', expected enum value"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs172/pr389752" title="annotation value error 2"> + <compile files="Code2.java" options="-1.5"> + <message kind="error" text="Invalid annotation value 'AA', expected enum value"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs172/pr389752" title="annotation value error 3"> + <compile files="Code3.java" options="-1.5"> + <message kind="error" text="Invalid annotation value 'AA', expected enum value"/> + </compile> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc173/Ajc173Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc173/Ajc173Tests.java new file mode 100644 index 000000000..5e007441f --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc173/Ajc173Tests.java @@ -0,0 +1,84 @@ +/******************************************************************************* + * Copyright (c) 2013 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.ajc173; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen; +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Andy Clement + */ +public class Ajc173Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testAddRemoveAnnos_407739() throws Exception { + runTest("add remove annos"); + } + +// public void testOrdering_407966() throws Exception { +// runTest("ordering"); +// } +// +// public void testInnerInterfaceMixin_408014() throws Exception { +// runTest("inner interface mixin"); +// } + + public void testClassAnnoValue_405016_1() throws Exception { + // test that class literals allowed + runTest("class anno value 1"); + } + + public void testInnerNames_407494() throws Exception { + runTest("inner names"); + } + + public void testInnerNames_407494_2() throws Exception { + runTest("inner names 2"); + } + +// public void testClassAnnoValue_405016() throws Exception { +// runTest("class anno value"); +// } + + public void testAbstractMethodError_404601() throws Exception { + runTest("abstract method error"); + } + + public void testDeclareAnnoOnItd() throws Exception { + runTest("declare anno on itd"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"C"); + Method m = getMethodStartsWith(jc, "getName"); + assertNotNull(m); + AnnotationGen[] ags = m.getAnnotations(); + for (int i=0;i<ags.length;i++) { + System.out.println(ags[i]); + } + assertEquals(1,ags.length); + assertEquals("LFoo;",ags[0].getTypeSignature()); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc173Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc173.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc173/AllTestsAspectJ173.java b/tests/src/test/java/org/aspectj/systemtest/ajc173/AllTestsAspectJ173.java new file mode 100644 index 000000000..d29869f58 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc173/AllTestsAspectJ173.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ajc173; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ173 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.7.3 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc173Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc173/ajc173.xml b/tests/src/test/java/org/aspectj/systemtest/ajc173/ajc173.xml new file mode 100644 index 000000000..398fae62f --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc173/ajc173.xml @@ -0,0 +1,90 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs173/pr407739" title="add remove annos"> + <compile files="MyAnnotation.java Hello.java Aspect.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="'private String dummy [RuntimeVisibleAnnotations]' of type 'Hello' (Hello.java) has had @MyAnnotation field annotation removed by 'Aspect' (Aspect.java:3)"/> + <message kind="weave" text="'private String dummy [RuntimeVisibleAnnotations]' of type 'Hello' (Hello.java) is annotated with @MyAnnotation(dummy2 = "korte") field annotation from 'Aspect' (Aspect.java:4)"/> + </compile> + <run class="Hello"> + <stdout> + <line text="@MyAnnotation(dummy1=, dummy2=korte)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="@MyAnnotation(dummy1="", dummy2="korte")" vm="9+"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs173/pr408014" title="inner interface mixin"> + <compile files="IdentifiableMixin.java" options="-1.5 -showWeaveInfo"> + </compile> + </ajc-test> + + <ajc-test dir="bugs173/pr407966" title="ordering"> + <compile files="Aspect.aj Use.java Def.java" options="-1.5 -showWeaveInfo"> + </compile> + </ajc-test> + + <ajc-test dir="bugs173/pr407494" title="inner names"> + <compile files="A.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'staticinitialization(void a.b.c.A$B.<clinit>())' in Type 'a.b.c.A$B' (A.java:4) advised by before advice from 'a.b.c.X' (A.java:13)"/> + <message kind="weave" text="Join point 'staticinitialization(void a.b.c.A.<clinit>())' in Type 'a.b.c.A' (A.java:3) advised by before advice from 'a.b.c.X' (A.java:13)"/> + <message kind="weave" text="Join point 'staticinitialization(void a.b.c.A$$C.<clinit>())' in Type 'a.b.c.A$$C' (A.java:6) advised by before advice from 'a.b.c.X' (A.java:13)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs173/pr407494" title="inner names 2"> + <compile files="A2.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Join point 'staticinitialization(void a.b.c.A$$B$$C.<clinit>())' in Type 'a.b.c.A$$B$$C' (A2.java:10) advised by before advice from 'a.b.c.X' (A2.java:14)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs173/pr405016/one" title="class anno value 1"> + <compile files="Gimme.java Thingy.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Extending interface set for type 'Thingy' (Thingy.java) to include 'java.io.Serializable' (Thingy.java)"/> + </compile> + <run class="Thingy"> + <stdout> + <line text="I am serializable? true"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs173/pr405016" title="class anno value"> + <compile files="Gimme.java Thingy.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Extending interface set for type 'Thingy' (Thingy.java) to include 'java.io.Serializable' (Thingy.java)"/> + </compile> + <run class="Thingy"> + <stdout> + <line text="I am serializable? true"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs173/pr404601" title="abstract method error"> + <compile files="user/IUser.java user/Test.java user/UserTrait.java user/Youser.java" options="-1.5"> + <message kind="error" text="private intertype declaration 'void UserTrait$I.testSetUsername(java.lang.String)' clashes with public member 'void Youser.testSetUsername(java.lang.String)'"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs173/lyor" title="declare anno on itd"> + <compile files="Code.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="'public void Intface.getName()' (Code.java) is annotated with @Foo method annotation from 'A' (Code.java:7)"/> + <message kind="weave" text="Type 'C' (Code.java) has intertyped method from 'A' (Code.java:'void Intface.getName()')"/> + <message kind="weave" text="Type 'Intface' (Code.java) has intertyped method from 'A' (Code.java:'void Intface.getName()')"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs173/lyor/2" title="declare anno on itd 2"> + <compile files="A1.java" outjar="aspects1.jar" options="-1.5 -Xlint:ignore"/> + <compile files="Intface.java A2.java" aspectpath="aspects1.jar" outjar="aspects2.jar" options="-1.5"/> + <compile files="Code.java" aspectpath="aspects1.jar;aspects2.jar" options="-1.5"/> + + <!-- + <message kind="weave" text="'public void Intface.getName()' (A2.java) is annotated with @Foo method annotation from 'A1' (A1.java:7)"/> + <message kind="weave" text="Type 'C' (Code.java) has intertyped method from 'A2' (A2.java:'void Intface.getName()')"/> + <message kind="weave" text="Type 'Intface' (Code.java) has intertyped method from 'A2' (A2.java:'void Intface.getName()')"/> + --> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc174/Ajc174Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc174/Ajc174Tests.java new file mode 100644 index 000000000..274fc892c --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc174/Ajc174Tests.java @@ -0,0 +1,96 @@ +/******************************************************************************* + * Copyright (c) 2013 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.ajc174; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Andy Clement + */ +public class Ajc174Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + +/* wip + public void testAjdtMarkers() throws Exception { + runTest("ajdt markers"); + } +*/ + + public void testExtraInserts() throws Exception { + runTest("extra inserts"); + } + + public void testMoreConfigurableLint_419279() throws Exception { + runTest("more configurable lint"); + } + + public void testAnnotatedItd_418129() throws Exception { + runTest("annotated itd"); + } + + public void testAnnotatedItd_418129_2() throws Exception { + runTest("annotated itd 2"); + } + + public void testAnnotatedItd_418129_3() throws Exception { + runTest("annotated itd 3"); + } + + public void testAnnotatedItd_418129_4() throws Exception { + runTest("annotated itd 4"); + } + + public void testSuperItdCtor_413378() throws Exception { + runTest("super itd ctor"); + } + + // no exclusion, this is how it should work + public void testCLExclusion_pr368046_1_noskippedloaders() { + runTest("classloader exclusion - 1"); + } + + public void testCLExclusion_pr368046_1_syspropset() { + try { + System.setProperty("aj.weaving.loadersToSkip", "foo"); + runTest("classloader exclusion - 2"); + } finally { + System.setProperty("aj.weaving.loadersToSkip", ""); + } + } + + // final repeat this test, to confirm no lingering static + public void testCLExclusion_pr368046_1_again_noskippedloaders() { + runTest("classloader exclusion - 3"); + } + + public void testCLExclusion_pr368046_2_usingaopxml() { + runTest("classloader exclusion - 4"); + } + + public void testCLExclusion_pr368046_2_usingaopxmlReal() { + runTest("classloader exclusion - 5"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc174Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc174.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc174/AllTestsAspectJ174.java b/tests/src/test/java/org/aspectj/systemtest/ajc174/AllTestsAspectJ174.java new file mode 100644 index 000000000..01a9525ec --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc174/AllTestsAspectJ174.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2013 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.ajc174; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ174 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.7.4 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc174Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc174/ajc174.xml b/tests/src/test/java/org/aspectj/systemtest/ajc174/ajc174.xml new file mode 100644 index 000000000..456fb412f --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc174/ajc174.xml @@ -0,0 +1,212 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs174/ajdt_markers" title="ajdt markers"> + <compile files="Code.java" options="-1.5 -showWeaveInfo"> + </compile> + </ajc-test> + + + <ajc-test dir="bugs174/extra_inserts" title="extra inserts"> + <compile files="Code.java" options="-1.5"> + <message kind="warning" line="8" text="Call to foo made inside class Bar"/> + <message kind="warning" line="15" text="Call to foo made inside class Boo"/> + <message kind="warning" line="8" text="Call to foo made inside member booble"/> + <message kind="warning" line="15" text="Call to foo made inside member m"/> + <message kind="warning" line="8" text="Call to foo made inside member void Bar.booble()"/> + <message kind="warning" line="15" text="Call to foo made inside member void Boo.m()"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs174/pr419279" title="more configurable lint"> + <compile files="Code.java" options="-1.5"> + <message kind="warning" text="advice defined in Code has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + <compile files="Code.java" options="-1.5 -Xlint:adviceDidNotMatch=ignore"> + </compile> + <compile files="Code.java" options="-1.5 -Xlint:adviceDidNotMatch=error"> + <message kind="error" text="advice defined in Code has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + <compile files="Code.java" options="-1.5 -Xlint:foo=bar"> + <message kind="error" text="invalid Xlint key: foo"/> + </compile> + <compile files="Code.java" options="-1.5 -Xlint:adviceDidNotMatch=wibble"> + <message kind="error" text="invalid Xlint message kind (must be one of ignore, warning, error): wibble"/> + </compile> + <compile files="Code.java" options="-1.5 -Xlint:adviceDidNotMatch=ignore{adviceDidNotMatch=error"> + <message kind="error" text="advice defined in Code has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + <compile files="Code.java" options="-1.5 -Xlint:adviceDidNotMatch=error{noGuardForLazyTjp=error"> + <message kind="error" text="advice defined in Code has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="error" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard [Xlint:noGuardForLazyTjp]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs174/pr418129" title="annotated itd"> + <compile files="Target.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Type 'Behavior' (Target.java) has intertyped method from 'Trait' (Target.java:'java.lang.String Behavior.hello()')"/> + <message kind="weave" text="Type 'Target' (Target.java) has intertyped method from 'Trait' (Target.java:'java.lang.String Behavior.hello()')"/> + <message kind="weave" text="'public java.lang.String Target.hello()' (Target.java) is annotated with @Tagged method annotation from 'Target$A' (Target.java:18)"/> + </compile> + <run class="Target"> + <stdout> + <line text="@Tagged()"/> + </stdout> + </run> + </ajc-test> + + <!-- declared with throws exception --> + <ajc-test dir="bugs174/pr418129" title="annotated itd 2"> + <compile files="Target2.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Type 'Behavior' (Target2.java) has intertyped method from 'Trait' (Target2.java:'java.lang.String Behavior.hello()')"/> + <message kind="weave" text="Type 'Target2' (Target2.java) has intertyped method from 'Trait' (Target2.java:'java.lang.String Behavior.hello()')"/> + <message kind="weave" text="'public java.lang.String Target2.hello()' (Target2.java) is annotated with @Tagged method annotation from 'Target2$A' (Target2.java:18)"/> + </compile> + <run class="Target2"> + <stdout> + <line text="@Tagged()"/> + </stdout> + </run> + </ajc-test> + + <!-- already annotated with another annotation --> + <ajc-test dir="bugs174/pr418129" title="annotated itd 3"> + <compile files="Target3.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Type 'Behavior' (Target3.java) has intertyped method from 'Trait' (Target3.java:'java.lang.String Behavior.hello()')"/> + <message kind="weave" text="Type 'Target3' (Target3.java) has intertyped method from 'Trait' (Target3.java:'java.lang.String Behavior.hello()')"/> + <message kind="weave" text="'public java.lang.String Target3.hello()' (Target3.java) is annotated with @Tagged method annotation from 'Target3$A' (Target3.java:16)"/> + </compile> + <run class="Target3"> + <stdout> + <line text="2"/> + <line text="@Wibble()"/> + <line text="@Tagged()"/> + </stdout> + </run> + </ajc-test> + + <!-- already annotated with the same annotation --> + <ajc-test dir="bugs174/pr418129" title="annotated itd 4"> + <compile files="Target4.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Type 'Behavior' (Target4.java) has intertyped method from 'Trait' (Target4.java:'java.lang.String Behavior.hello()')"/> + <message kind="weave" text="Type 'Target4' (Target4.java) has intertyped method from 'Trait' (Target4.java:'java.lang.String Behavior.hello()')"/> + <!-- warning turned off as it gets confusing - when the itd on the interface is hit by a deca --> + <!-- + <message kind="warning" text="java.lang.String Target4.hello() - already has an annotation of type Tagged, cannot add a second instance [Xlint:elementAlreadyAnnotated]"/> + --> + </compile> + <run class="Target4"> + <stdout> + <line text="1"/> + <line text="@Tagged(value=31)"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs174/pr413378" title="super itd ctor"> + <compile files="Code.java" options="-1.5 -showWeaveInfo"> + <message kind="weave" text="Type 'Child' (Code.java) has intertyped constructor from 'MyTest' (Code.java:'void Child.<init>(java.lang.String, int)')"/> + </compile> + <run class="Code"> + <stdout> + <line text="Get Age:50"/> + <line text="Child Name:Andy"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs174/pr368046" title="classloader exclusion - 1"> + <compile files="Azpect.java" outjar="foo.jar" options="-1.4"/> + <compile files="Code.java" classpath="$sandbox/foo.jar"/> + <run class="Code" classpath="$sandbox/foo.jar" ltw="aop1.xml"> + <stdout> + <line text="advice"/> + <line text="running"/> + </stdout> + <stderr> + <line text="AspectJ Weaver"/> + <line text="register classloader"/> + <line text="using configuration"/> + <line text="register aspect"/> + <line text="processing reweavable"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs174/pr368046" title="classloader exclusion - 2"> + <compile files="Azpect.java" outjar="foo.jar" options="-1.4"/> + <compile files="Code.java" classpath="$sandbox/foo.jar"/> + <run class="Code" classpath="$sandbox/foo.jar" ltw="aop1.xml"> + <stdout> + <line text="advice"/> + <line text="running"/> + </stdout> + <stderr> + <line text="AspectJ Weaver"/> + <line text="register classloader"/> + <line text="using configuration"/> + <line text="no longer creating weavers for these classloaders: [foo]"/> + <line text="register aspect"/> + <line text="processing reweavable"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs174/pr368046" title="classloader exclusion - 3"> + <compile files="Azpect.java" outjar="foo.jar" options="-1.4"/> + <compile files="Code.java" classpath="$sandbox/foo.jar"/> + <run class="Code" classpath="$sandbox/foo.jar" ltw="aop1.xml"> + <stdout> + <line text="advice"/> + <line text="running"/> + </stdout> + <stderr> + <line text="AspectJ Weaver"/> + <line text="register classloader"/> + <line text="using configuration"/> + <line text="register aspect"/> + <line text="processing reweavable"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs174/pr368046" title="classloader exclusion - 4"> + <compile files="Azpect.java" outjar="foo.jar" options="-1.4"/> + <compile files="Code.java" classpath="$sandbox/foo.jar"/> + <run class="Code" classpath="$sandbox/foo.jar" ltw="aop2.xml"> + <stdout> + <line text="advice"/> + <line text="running"/> + </stdout> + <stderr> + <line text="AspectJ Weaver"/> + <line text="register classloader"/> + <line text="using configuration"/> + <line text="no longer creating weavers for these classloaders: [com.foo.Bar]"/> + <line text="register aspect"/> + <line text="processing reweavable"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs174/pr368046" title="classloader exclusion - 5"> + <compile files="Azpect.java" outjar="foo.jar" options="-1.4"/> + <compile files="Code.java" classpath="$sandbox/foo.jar"/> + <run class="Code" classpath="$sandbox/foo.jar" ltw="aop3.xml"> + <stdout> + <line text="advice"/> + <line text="running"/> + </stdout> + <stderr> + <line text="AspectJ Weaver"/> + <line text="register classloader"/> + <line text="using configuration"/> + <line text="no longer creating weavers for these classloaders: [org.aspectj.weaver.loadtime.WeavingURLClassLoader]"/> + <line text="register aspect"/> + <line text="processing reweavable"/> + </stderr> + </run> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc175/Ajc175Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc175/Ajc175Tests.java new file mode 100644 index 000000000..2296c8e59 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc175/Ajc175Tests.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2013 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.ajc175; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Andy Clement + */ +public class Ajc175Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + +// public void testIllegalAccessError_430243() throws Exception { +// runTest("illegalaccesserror"); +// } + + public void testVertxVerifyError_423257() throws Exception { + runTest("vertx verify error"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc175Tests.class); + } + + protected File getSpecFile() { + return getClassResource("ajc175.xml"); + } + + public static void main(String[] args) { + + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc175/AllTestsAspectJ175.java b/tests/src/test/java/org/aspectj/systemtest/ajc175/AllTestsAspectJ175.java new file mode 100644 index 000000000..7be7c3bac --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc175/AllTestsAspectJ175.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2013 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.ajc175; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ175 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.7.5 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc175Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc175/ajc175.xml b/tests/src/test/java/org/aspectj/systemtest/ajc175/ajc175.xml new file mode 100644 index 000000000..2db4a984a --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc175/ajc175.xml @@ -0,0 +1,19 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs175/pr430243" title="illegalaccesserror"> + <compile files="PackageManagerAspect.java PolicyManager.java PolicyProviderConstants.java PolicyProviderInterface.java" options="-1.6"> + </compile> + <run class="com.test2.PolicyManager"> + </run> + </ajc-test> + + <ajc-test dir="bugs175/pr423257" title="vertx verify error"> + <compile files="Test.java AspectX.java" options="-1.7"> + </compile> + <run class="com.foo.bar.Test"> + </run> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc180/Ajc180Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc180/Ajc180Tests.java new file mode 100644 index 000000000..558179f0a --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc180/Ajc180Tests.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2013-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.ajc180; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Andy Clement + */ +public class Ajc180Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testPercflowLtw_432178() { + runTest("percflow ltw"); + } + + public void testStackmapframe_431976() { + runTest("stackmapframe"); + } + + public void testThisJoinPointNotInitialized_431976() { + runTest("thisJoinPoint not initialized"); + } + + public void testNullAnnotationMatching_431541() { + runTest("NullAnnotationMatching exception"); + } + + public void testAnnosWith18Flags_415957() { + runTest("annotations with 1.8 flags"); + } + + public void testJava8Code() throws Exception { + runTest("first advised java 8 code"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc180Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc180.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc180/AllTestsAspectJ180.java b/tests/src/test/java/org/aspectj/systemtest/ajc180/AllTestsAspectJ180.java new file mode 100644 index 000000000..453c057eb --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc180/AllTestsAspectJ180.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2013 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.ajc180; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ180 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.8.0 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc180Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc180/ajc180.xml b/tests/src/test/java/org/aspectj/systemtest/ajc180/ajc180.xml new file mode 100644 index 000000000..257f5972c --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc180/ajc180.xml @@ -0,0 +1,55 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs180/432178" title="percflow ltw"> + <compile options="-1.8" files="A.java B.java"/> + <compile options="-1.8" files="PerCFlowBug.java"/> + <run class="A" ltw="aop.xml"> + <stdout> + <line text="foo"/> + <line text="bar"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs180/pr432714" title="stackmapframe"> + <compile options="-1.8" files="Code.java"/> + <run class="Code"/> + </ajc-test> + + <ajc-test dir="bugs180/pr431976" title="thisJoinPoint not initialized"> + <compile options="-1.8" files="Code.java"/> + </ajc-test> + + <ajc-test dir="bugs180/pr431541" title="NullAnnotationMatching exception"> + <compile options="-1.8" files="Test.aj"/> + </ajc-test> + + <ajc-test dir="bugs180/415957" title="annotations with 1.8 flags"> + <compile files="MyAspect.aj MyClass.java Resource.java" options="-1.8 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void MyClass.method())' in Type 'MyClass' (MyClass.java:3) advised by before advice from 'MyAspect' (MyAspect.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs180/firstprogram" title="first advised java 8 code"> + <compile files="C.java" options="-1.8"> + </compile> + <run class="C"> + <stdout> + <line text="Clazz staticinitialization(I.<clinit>)"/> + <line text="Clazz staticinitialization(C.<clinit>)"/> + <line text="I.foo running"/> + <line text="ABC"/> + <line text="hello world!"/> + <line text="Clazz staticinitialization(MyClass.<clinit>)"/> + <line text="Clazz staticinitialization(Utils.<clinit>)"/> + <line text="1"/> + <line text="22"/> + <line text="333"/> + <line text="4444"/> + </stdout> + </run> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc181/Ajc181Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc181/Ajc181Tests.java new file mode 100644 index 000000000..3aa41837e --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc181/Ajc181Tests.java @@ -0,0 +1,62 @@ +/******************************************************************************* + * 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.ajc181; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Andy Clement + */ +public class Ajc181Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testParameterNamesAttribute_436531() { + runTest("parameter names attribute"); + } + + public void testVariableNotInitialized_431976() { + runTest("variable not initialized"); + } + + public void testThisEnclosingJoinPointStaticPartNotInitialized_431976() { + runTest("thisEnclosingJoinPointStaticPart not initialized"); + } + + public void testLvarTable_435446() throws Exception { + runTest("lvartable"); + } + + public void testBrokenAnnotations_377096() throws Exception { + runTest("broken annotations"); + Method method = getMethodFromClass(getClassFrom(ajc.getSandboxDirectory(), "C"), "xxx"); + method.getAnnotations(); + } + + public void testDefaultMethods_433744() { + runTest("default methods"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc181Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc181.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc181/AllTestsAspectJ181.java b/tests/src/test/java/org/aspectj/systemtest/ajc181/AllTestsAspectJ181.java new file mode 100644 index 000000000..a6c89f895 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc181/AllTestsAspectJ181.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.ajc181; + +import junit.framework.Test; +import junit.framework.TestSuite; +import org.aspectj.systemtest.apt.AptTests; + +public class AllTestsAspectJ181 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.8.1 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc181Tests.suite()); + suite.addTest(AptTests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc181/ajc181.xml b/tests/src/test/java/org/aspectj/systemtest/ajc181/ajc181.xml new file mode 100644 index 000000000..1a8b1acfc --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc181/ajc181.xml @@ -0,0 +1,34 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs181/436531" title="parameter names attribute"> + <compile options="-1.8" files="Azpect.java" inpath="code.jar"/> + </ajc-test> + + <ajc-test dir="bugs181/431976" title="variable not initialized"> + <compile options="-1.8" files="AbstractDependencyInjectionAspect.aj"/> + </ajc-test> + + <ajc-test dir="bugs181/431976" title="thisEnclosingJoinPointStaticPart not initialized"> + <compile options="-1.8" files="Code.java"/> + </ajc-test> + + <ajc-test dir="bugs181/435446" title="lvartable"> + <compile options="-1.8" files="Application.java MyAspect.java"> + </compile> + <run class="de.scrum_master.app.Application"> + </run> + </ajc-test> + + <ajc-test dir="bugs181/377096" title="broken annotations"> + <compile options="-1.5 -proceedOnError" files="A.java"> + <message kind="error" text="The attribute wibble is undefined for the annotation type A"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs181/433744" title="default methods"> + <compile options="-1.8" files="AnIterator.java"/> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java new file mode 100644 index 000000000..37896b42f --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java @@ -0,0 +1,177 @@ +/******************************************************************************* + * Copyright (c) 2016 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.ajc1810; + +import java.io.File; + +import org.aspectj.apache.bcel.Constants; +import org.aspectj.apache.bcel.classfile.Attribute; +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.testing.XMLBasedAjcTestCase; + +import junit.framework.Test; + +/** + * @author Andy Clement + */ +public class Ajc1810Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testBinding_508661() { + runTest("various ltw"); + } + + public void testBinding_500035() { + runTest("ataspectj binding"); + } + + public void testBinding_500035_2() { + runTest("ataspectj binding 2"); + } + + public void testBinding_500035_3() { + runTest("ataspectj binding 3 -XnoInline"); + } + + public void testBinding_500035_4() { + runTest("ataspectj binding 4"); + } + + public void testGenericsException_501656() { + runTest("generics exception"); + } + + public void testAIOOBE_502807() { + runTest("unexpected aioobe"); + } + + public void testInvokeDynamic_490315() { + runTest("indy"); + } + + public void testAmbigMessage17() throws Exception { + runTest("ambiguous message - 17"); + } + + public void testAmbigMessage18() throws Exception { + runTest("ambiguous message - 18"); + } + + // http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.6 + public void testInnerClassesAttributeStructure_493554() throws Exception { + runTest("pertarget"); + + // Testcode commented out below is for full analysis of the inner class attribute but under + // 493554 we are going to remove that attribute for this class + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "example/aspect/FooAspect$ajcMightHaveAspect"); + assertNotNull(jc); + assertEquals(Constants.ACC_PUBLIC | Constants.ACC_INTERFACE | Constants.ACC_ABSTRACT,jc.getModifiers()); + Attribute[] attributes = jc.getAttributes(); + for (Attribute attribute: attributes) { + if (attribute.getName().equals("InnerClasses")) { + fail("Did not expect to find InnerClasses attribute"); + } + } + +// // Is InnerClasses attribute well formed for the pertarget interface? +// JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "example/aspect/FooAspect$ajcMightHaveAspect"); +// assertNotNull(jc); +// assertEquals(Constants.ACC_PUBLIC | Constants.ACC_INTERFACE | Constants.ACC_ABSTRACT,jc.getModifiers()); +// Attribute attr = getAttributeStartsWith(jc.getAttributes(), "InnerClasses"); +// assertNotNull(attr); +// InnerClasses innerClasses = (InnerClasses)attr; +// InnerClass[] innerClassArray = innerClasses.getInnerClasses(); +// assertEquals(1,innerClassArray.length); +// InnerClass innerClass = innerClassArray[0]; +// ConstantPool cp = jc.getConstantPool(); +// +// // The value of the inner_class_info_index item must be a valid index into the +// // constant_pool table. The constant_pool entry at that index must be a CONSTANT_Class_info +// // structure representing C. +// int innerClassIndex = innerClass.getInnerClassIndex(); +// ConstantClass cc = (ConstantClass)cp.getConstant(innerClassIndex); +// ConstantUtf8 utf8 = cp.getConstantUtf8(cc.getNameIndex()); +// assertEquals("example/aspect/FooAspect$ajcMightHaveAspect",utf8.getStringValue()); +// +// // The remaining items in the classes array entry give information about C. +// // The value of the outer_class_info_index item must be a valid index into the +// // constant_pool table, and the entry at that index must be a CONSTANT_Class_info +// // structure representing the class or interface of which C is a member. +// int outerClassIndex = innerClass.getOuterClassIndex(); +// cc = (ConstantClass)cp.getConstant(outerClassIndex); +// utf8 = cp.getConstantUtf8(cc.getNameIndex()); +// assertEquals("example/aspect/FooAspect",utf8.getStringValue()); +// +// // The value of the inner_name_index item must be a valid index into the constant_pool table, +// // and the entry at that index must be a CONSTANT_Utf8_info structure (§4.4.7) that represents +// // the original simple name of C, as given in the source code from which this class file was compiled. +// int innerNameIndex = innerClass.getInnerNameIndex(); +// utf8 = cp.getConstantUtf8(innerNameIndex); +// assertEquals("ajcMightHaveAspect",utf8.getStringValue()); +// +// int innerAccessFlags = innerClass.getInnerAccessFlags(); +// assertEquals(Constants.ACC_PUBLIC | Constants.ACC_ABSTRACT | Constants.ACC_INTERFACE | Constants.ACC_STATIC,innerAccessFlags); +// +// // Is InnerClasses attribute well formed for the containing type? +// jc = getClassFrom(ajc.getSandboxDirectory(), "example/aspect/FooAspect"); +// assertNotNull(jc); +// attr = getAttributeStartsWith(jc.getAttributes(), "InnerClasses"); +// assertNotNull(attr); +// innerClasses = (InnerClasses)attr; +// innerClassArray = innerClasses.getInnerClasses(); +// assertEquals(1,innerClassArray.length); +// innerClass = innerClassArray[0]; +// cp = jc.getConstantPool(); +// System.out.println(innerClass); +// +// // inner class name +// innerClassIndex = innerClass.getInnerClassIndex(); +// cc = (ConstantClass)cp.getConstant(innerClassIndex); +// utf8 = cp.getConstantUtf8(cc.getNameIndex()); +// assertEquals("example/aspect/FooAspect$ajcMightHaveAspect",utf8.getStringValue()); +// +// // outer class name +// outerClassIndex = innerClass.getOuterClassIndex(); +// cc = (ConstantClass)cp.getConstant(outerClassIndex); +// utf8 = cp.getConstantUtf8(cc.getNameIndex()); +// assertEquals("example/aspect/FooAspect",utf8.getStringValue()); +// +// // Simple name +// innerNameIndex = innerClass.getInnerNameIndex(); +// utf8 = cp.getConstantUtf8(innerNameIndex); +// assertEquals("ajcMightHaveAspect",utf8.getStringValue()); +// +// // inner modifiers +// innerAccessFlags = innerClass.getInnerAccessFlags(); +// assertEquals(Constants.ACC_ABSTRACT | Constants.ACC_INTERFACE | Constants.ACC_STATIC,innerAccessFlags); +// +// // Reflection work getDeclaredClasses? +// +// // What about other interfaces? + } + + + +// public void testOverweaving_352389() throws Exception { +// runTest("overweaving"); +// } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc1810Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc1810.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1810/AllTestsAspectJ1810.java b/tests/src/test/java/org/aspectj/systemtest/ajc1810/AllTestsAspectJ1810.java new file mode 100644 index 000000000..b4fe6a8f3 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1810/AllTestsAspectJ1810.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2016 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.ajc1810; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ1810 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.8.10 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc1810Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1810/ajc1810.xml b/tests/src/test/java/org/aspectj/systemtest/ajc1810/ajc1810.xml new file mode 100644 index 000000000..0171f5b55 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1810/ajc1810.xml @@ -0,0 +1,110 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs1810/508661" title="various ltw"> + <compile options="-1.8" files="CacheMethodResult.java A_yes.java B_no.java Run.java" outjar="classes.jar"/> + <compile options="-1.8 -Xlint:ignore" files="CacheMethodResultAspect.java" outjar="aspects.jar"/> + <run class="Run" ltw="aop.xml"> + <stdout> + <line text="around: void A_yes.m()"/> + <line text="A_yes.m()"/> + <line text="A_yes has interface? CacheMethodResultAspect$ajcMightHaveAspect"/> + <line text="B_no.m()"/> + <line text="B_no has interface? no"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1810/500035" title="ataspectj binding"> + <compile options="-1.8" files="Code.java"/> + <run class="Code"> + <stdout> + <line text="targetObject = hello"/> + <line text="regex = l"/> + <line text="replacement = 7"/> + <line text="he7lo"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1810/500035" title="ataspectj binding 2"> + <compile options="-1.8" files="Code2.java"/> + <run class="Code2"> + <stdout> + <line text="targetObject = hello"/> + <line text="regex = l"/> + <line text="replacement = 8"/> + <line text="he8lo"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1810/500035" title="ataspectj binding 3 -XnoInline"> + <compile options="-1.8 -XnoInline" files="Code3.java"/> + <run class="Code3"> + <stdout> + <line text="first: binding target, just passing everything through: target=Foo(1)"/> + <line text="Executing run(abc) on Foo(i=1)"/> + <line text="second: binding this and target, just passing everything through: this=Foo(0) target=Foo(1)"/> + <line text="Executing run(abc) on Foo(i=1)"/> + <line text="third: binding this, just passing everything through: this=Foo(0)"/> + <line text="Executing run(abc) on Foo(i=1)"/> + <line text="fourth: binding this, switching from Foo(0) to Foo(3)"/> + <line text="Executing run(abc) on Foo(i=1)"/> + <line text="fifth: binding target, switching from Foo(1) to Foo(4)"/> + <line text="Executing run(abc) on Foo(i=4)"/> + <line text="sixth: binding this and target, switching them around (before this=Foo(0) target=Foo(1))"/> + <line text="Executing run(abc) on Foo(i=0)"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1810/500035" title="ataspectj binding 4"> + <compile options="-1.8" files="Code3.java"/> + <run class="Code3"> + <stdout> + <line text="first: binding target, just passing everything through: target=Foo(1)"/> + <line text="Executing run(abc) on Foo(i=1)"/> + <line text="second: binding this and target, just passing everything through: this=Foo(0) target=Foo(1)"/> + <line text="Executing run(abc) on Foo(i=1)"/> + <line text="third: binding this, just passing everything through: this=Foo(0)"/> + <line text="Executing run(abc) on Foo(i=1)"/> + <line text="fourth: binding this, switching from Foo(0) to Foo(3)"/> + <line text="Executing run(abc) on Foo(i=1)"/> + <line text="fifth: binding target, switching from Foo(1) to Foo(4)"/> + <line text="Executing run(abc) on Foo(i=4)"/> + <line text="sixth: binding this and target, switching them around (before this=Foo(0) target=Foo(1))"/> + <line text="Executing run(abc) on Foo(i=0)"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1810/501656" title="generics exception"> + <compile options="-1.8 -parameters" files="ApplicationException.java ApplicationExceptionHandler.java"/> + </ajc-test> + + <ajc-test dir="bugs1810/490315" title="indy"> + <compile options="-1.8" files="FailingAspect.java SomeAnno.java SomeContext.java SomeCriteria.java SomeDTO.java SomeEnum.java SomePiece.java SomePropertyDTO.java SomeService.java SomeServiceImpl.java"/> + </ajc-test> + + <ajc-test dir="bugs1810/493554" title="pertarget"> + <compile options="-1.8" files="Dep.java FooAspect.aj Cmd.java"/> + <run class="example.kusedep.Cmd"></run> + </ajc-test> + + <ajc-test dir="bugs1810/ambig" title="ambiguous message - 18"> + <compile options="-1.8" files="X.java"/> + </ajc-test> + + <ajc-test dir="bugs1810/ambig" title="ambiguous message - 17"> + <compile options="-1.7" files="X.java"/> + </ajc-test> + + <ajc-test dir="bugs1810/502807" title="unexpected aioobe"> + <compile options="-1.8" files="TestCollectors.java"> + <message kind="error" text="The method toList() in the type Collectors is not applicable for the arguments (Inner::getId)"/> + </compile> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1811/Ajc1811Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1811/Ajc1811Tests.java new file mode 100644 index 000000000..9aa1bff94 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1811/Ajc1811Tests.java @@ -0,0 +1,90 @@ +/******************************************************************************* + * Copyright (c) 2016 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.ajc1811; + +import java.io.File; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.weaver.ResolvedMember; +import org.aspectj.weaver.ResolvedType; +import org.aspectj.weaver.UnresolvedType; +import org.aspectj.weaver.bcel.BcelWorld; + +import junit.framework.Test; + +/** + * @author Andy Clement + */ +public class Ajc1811Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testParameterizedWithInner() throws Exception { + runTest("parameterized with inner"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "Outer"); + assertNotNull(jc); + BcelWorld world = new BcelWorld(ajc.getSandboxDirectory().toString()); + + ResolvedType outerType = world.resolve(UnresolvedType.forName("Outer")); + ResolvedMember m = findMethod(outerType,"m"); + + UnresolvedType type = m.getReturnType(); + assertEquals("LOuter$Inner;",type.getSignature()); + + type = m.getGenericReturnType(); + assertEquals("LOuter$Inner;",type.getSignature()); + + ResolvedType resolvedType = world.resolve(type); + ResolvedType outerResolvedType = resolvedType.getOuterClass(); + assertEquals("LOuter;",outerResolvedType.getSignature()); + + ResolvedMember m2 = findMethod(outerType,"m2"); + type = m2.getReturnType(); + assertEquals("LOuter$Inner;",type.getSignature()); + + type = m2.getGenericReturnType(); + assertEquals("LOuter$Inner;",type.getSignature()); + + // public Inner m() { ... } +// Method m = findMethod(jc,"m"); +// System.out.println(m); +// System.out.println(">"+m.getReturnType()); +// assertNotNull(returnType); + + // public Outer<String>.Inner m2() { ... } + } + +// +// public void testMultiArgs_509235() { +// runTest("multiargs"); +// } +// +// public void testMultiArgs_509235_2() { +// runTest("multiargs - no ellipsis"); +// } + + // 1.8.13: + + public void testAjcGenerics() { + runTest("generics"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc1811Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc1811.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1811/AllTestsAspectJ1811.java b/tests/src/test/java/org/aspectj/systemtest/ajc1811/AllTestsAspectJ1811.java new file mode 100644 index 000000000..b8aca6712 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1811/AllTestsAspectJ1811.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2016 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.ajc1811; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ1811 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.8.11 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc1811Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1811/ajc1811.xml b/tests/src/test/java/org/aspectj/systemtest/ajc1811/ajc1811.xml new file mode 100644 index 000000000..fe59c3595 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc1811/ajc1811.xml @@ -0,0 +1,46 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs1811/parameterizedWithInner" title="parameterized with inner"> + <compile options="-1.8" files="Code.java"/> + </ajc-test> + + <ajc-test dir="bugs1813/generics" title="generics"> + <!-- this order works reliably --> + <compile options="-1.8 -showWeaveInfo" files="A.java AlreadyImplementsA.java BaseI.java BaseT.java BindInterfaceA.aj ConcreteIImpl.java ConcreteTImpl.java Runner.java"> + <message kind="weave" text="Extending interface set for type 'AlreadyImplementsA' (AlreadyImplementsA.java) to include 'A<ConcreteTImpl,ConcreteIImpl>' (BindInterfaceA.aj)"/> + </compile> + + <!-- this order was failing --> + <compile options="-1.8 -showWeaveInfo" files="AlreadyImplementsA.java BaseI.java BaseT.java BindInterfaceA.aj ConcreteIImpl.java ConcreteTImpl.java A.java Runner.java "> + <message kind="weave" text="Extending interface set for type 'AlreadyImplementsA' (AlreadyImplementsA.java) to include 'A<ConcreteTImpl,ConcreteIImpl>' (BindInterfaceA.aj)"/> + </compile> + <run class="Runner"> + <stdout> + <line text="ok"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1811/509235" title="multiargs"> + <compile options="-1.8" files="Code.java"/> + <run class="Code"> + <stdout> + <line text="username = fooname"/> + <line text="username = barname"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs1811/509235" title="multiargs - no ellipsis"> + <compile options="-1.8" files="Code2.java"/> + <run class="Code2"> + <stdout> + <line text="username = fooname"/> + <line text="username = barname"/> + </stdout> + </run> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc182/Ajc182Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc182/Ajc182Tests.java new file mode 100644 index 000000000..545def45d --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc182/Ajc182Tests.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * 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.ajc182; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.apache.bcel.classfile.annotation.RuntimeInvisTypeAnnos; +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Andy Clement + */ +public class Ajc182Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testInvisTypeAnnos_440983() throws ClassNotFoundException { + runTest("invis type annos"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "Code"); + Method m = getMethodStartsWith(jc, "xxx"); + RuntimeInvisTypeAnnos rita = (RuntimeInvisTypeAnnos)getAttributeStartsWith(m.getCode().getAttributes(),"RuntimeInvisibleTypeAnnotations"); + assertEquals("AnnotationGen:[Anno #0 {}]",rita.getTypeAnnotations()[0].getAnnotation().toString()); + } + + public void testInvisTypeAnnos_440983_2() throws ClassNotFoundException { + runTest("invis type annos 2"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc182Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("tests.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc182/AllTestsAspectJ182.java b/tests/src/test/java/org/aspectj/systemtest/ajc182/AllTestsAspectJ182.java new file mode 100644 index 000000000..c0323f0ef --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc182/AllTestsAspectJ182.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * 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.ajc182; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ182 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.8.2 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc182Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc182/tests.xml b/tests/src/test/java/org/aspectj/systemtest/ajc182/tests.xml new file mode 100644 index 000000000..9b7383810 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc182/tests.xml @@ -0,0 +1,18 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs182/440983" title="invis type annos"> + <compile options="-1.8" files="Code.java"/> + </ajc-test> + + <ajc-test dir="bugs182/440983" title="invis type annos 2"> + <compile options="-1.8" files="X.java" inpath="code.jar"/> + <run class="Code"> + <stdout> + <line text="works"/> + </stdout> + </run> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc183/Ajc183Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc183/Ajc183Tests.java new file mode 100644 index 000000000..db6878e15 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc183/Ajc183Tests.java @@ -0,0 +1,99 @@ +/******************************************************************************* + * 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.ajc183; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Andy Clement + */ +public class Ajc183Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testSuperCalls_443355() { + runTest("super calls"); + } + + public void testSuppressTypeNotFoundAbstract_436653_2() { + runTest("suppress type not found - abstract 2"); + } + + public void testSuppressTypeNotFoundAbstract_436653_1() { + runTest("suppress type not found - abstract 1"); + } + + public void testSuppressTypeNotFound_436653() { + runTest("suppress type not found"); + } + + public void testSuppressTypeNotFound_436653_2() { + runTest("suppress type not found 2"); + } + + public void testSuppressTypeNotFound_436653_3() { + runTest("suppress type not found 3"); + } + + public void testSuppressTypeNotFound_436653_4() { + runTest("suppress type not found 4"); + } + + public void testSuppressTypeNotFound_436653_5() { + runTest("suppress type not found 5"); + } + + public void testSuppressTypeNotFound_436653_6() { + runTest("suppress type not found 6"); + } + + public void testSuppressTypeNotFound_436653_7() { + runTest("suppress type not found 7"); + } + + public void testSuppressTypeNotFound_436653_8() { + runTest("suppress type not found 8"); + } + + public void testConstantPool_445395_0() { + runTest("constant pool 0"); + } + + public void testConstantPool_445395() { + runTest("constant pool"); + } + + public void testAbstractAspectNPE_444398() { + runTest("abstract aspect npe"); + } + + public void testVerifyError_443447() { + runTest("verifyerror"); + } +// +// public void testAnnoStyleDecp_442425() { +// runTest("anno style decp"); +// } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc183Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc183.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc183/AllTestsAspectJ183.java b/tests/src/test/java/org/aspectj/systemtest/ajc183/AllTestsAspectJ183.java new file mode 100644 index 000000000..8b68b8e40 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc183/AllTestsAspectJ183.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * 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.ajc183; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ183 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.8.3 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc183Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc183/ajc183.xml b/tests/src/test/java/org/aspectj/systemtest/ajc183/ajc183.xml new file mode 100644 index 000000000..e1c40ae72 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc183/ajc183.xml @@ -0,0 +1,182 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs183/443355" title="super calls"> + <compile options="-1.8" files="Demo.java"/> + <run class="Demo"> + <stdout> + <line text="HW"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs183/436653/abstract" title="suppress type not found - abstract 2"> + <compile options="-1.8 -Xlint:ignore" files="A.java" outjar="codeA.jar"/> + <compile options="-1.8" files="X.java AA.java" classpath="codeA.jar" outjar="aspects.jar"/> + <compile options="-1.8" files="Code.java" aspectpath="aspects.jar"/> + <run class="Code"> + <stdout> + <!-- + These don't come out because AA is missing required type A in the last compile step + <line text="X.before"/> + <line text="X.before"/> + --> + <line text="Code.m()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs183/436653/abstract" title="suppress type not found - abstract 1"> + <compile options="-1.8 -Xlint:ignore" files="A.java" outjar="codeA.jar"/> + <compile options="-1.8" files="AA.java X.java" classpath="codeA.jar" outjar="aspects.jar"/> + <compile options="-1.8" files="Code.java" aspectpath="aspects.jar"/> + <run class="Code"> + <stdout> + <!-- + These don't come out because AA is missing required type A in the last compile step. + Difference between this test and the previous one is that this is a different order + of aspects (addOrReplaceAspects called with the abstract aspect first here). + <line text="X.before"/> + <line text="X.before"/> + --> + <line text="Code.m()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs183/436653" title="suppress type not found 4"> + <compile options="-1.8 -Xlint:ignore" files="X.java" outjar="aspects.jar"/> + <compile options="-1.8" files="Runner.java"/> + <run class="Runner" ltw="aop.xml"> + <stdout> + <line text="Code.m() running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs183/436653" title="suppress type not found 5"> + <compile options="-1.8 -Xlint:ignore" files="X.java" outjar="aspects.jar"/> + <compile class="-1.8" files="A.java"/> + <compile options="-1.8" files="Runner.java"/> + <run class="Runner" ltw="aop.xml"> + <stdout> + <line text="x"/> + <line text="Code.m() running"/> + </stdout> + </run> + </ajc-test> + + <!-- annotation style aspect, missing type so deactivated --> + <ajc-test dir="bugs183/436653" title="suppress type not found 6"> + <compile options="-1.8 -Xlint:ignore" files="AnnoX.java" outjar="aspects.jar"/> + <compile options="-1.8" files="Runner.java"/> + <run class="Runner" ltw="aop2.xml"> + <stdout> + <line text="Code.m() running"/> + </stdout> + </run> + </ajc-test> + + <!-- annotation style aspect, type not missing so not deactivated --> + <ajc-test dir="bugs183/436653" title="suppress type not found 7"> + <compile options="-1.8 -Xlint:ignore" files="AnnoX.java A.java" outjar="aspects.jar"/> + <compile options="-1.8" files="Runner.java"/> + <run class="Runner" ltw="aop2.xml"> + <stdout> + <line text="x"/> + <line text="Code.m() running"/> + </stdout> + </run> + </ajc-test> + + <!-- annotation style aspect, type not missing so not deactivated --> + <ajc-test dir="bugs183/436653" title="suppress type not found 8"> + <compile options="-1.8 -Xlint:ignore" files="AnnoX.java A.java" outjar="aspects.jar"/> + <compile options="-1.8 -showWeaveInfo" files="Runner.java" aspectpath="aspects.jar"> + <message kind="weave" text="Join point 'method-execution(void Code.m())' in Type 'Code' (Runner.java:8) advised by before advice from 'X' (aspects.jar!AnnoX.class(from AnnoX.java))"/> + </compile> + <run class="Runner"> + <stdout> + <line text="x"/> + <line text="Code.m() running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs183/436653" title="suppress type not found 3"> + <compile options="-1.8" files="A.java" outjar="typeA.jar"/> + <compile options="-1.8" files="B.java" outjar="typeB.jar"/> + <!-- adviceDidNotMatch messages are suppressed here --> + <compile options="-1.8" files="XA3.java XCode.java" outjar="aspects.jar" classpath="typeA.jar"/> + <compile options="-1.8 -verbose" files="Code.java" classpath="typeA.jar" aspectpath="aspects.jar"> + <!-- '*' is a hint that we care about only this message, not other messages. avoids needing to list them all --> + <message kind="info" text="*deactivating aspect 'XA2' as it requires type 'B' which cannot be found on the classpath"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs183/436653" title="suppress type not found 2"> + <compile options="-1.8" files="A.java" outjar="typeA.jar"/> + <!-- adviceDidNotMatch messages are suppressed here --> + <compile options="-1.8" files="XA2.java XCode.java" outjar="aspects.jar" classpath="typeA.jar"/> + <compile options="-1.8" files="Code.java" aspectpath="aspects.jar"> + </compile> + </ajc-test> + + <ajc-test dir="bugs183/436653" title="suppress type not found"> + <compile options="-1.8" files="A.java" outjar="typeA.jar"/> + <!-- adviceDidNotMatch messages are suppressed here --> + <compile options="-1.8" files="XA.java XCode.java" outjar="aspects.jar" classpath="typeA.jar"/> + <compile options="-1.8" files="Code.java" aspectpath="aspects.jar"> + <message kind="error" text="can't determine modifiers of missing type A"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs183/445395" title="constant pool 0"> + <compile options="-1.8" files="Code.java"> + </compile> + <run class="Code"> + <stdout> + <line text="4"/> + <line text="5"/> + <line text="6"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs183/445395" title="constant pool"> + <compile options="-1.8" files="ControlFlow.java ForReplacer.java ControlFlowCommand.java ControlFlowDriver.java"> + </compile> + </ajc-test> + + <ajc-test dir="bugs183/444398" title="abstract aspect npe"> + <compile options="-1.8" files="Bottom.java Middle.java Top.java"> + </compile> + </ajc-test> + + <ajc-test dir="bugs183/442425" title="anno style decp"> + <compile options="-1.8" files="EntityController.java IEntityController.java MyAnnotatedController.java EntityControllerAspect.java EntityMongoController.java"> + <message kind="error" line="23" text="Type mismatch: cannot convert from MyAnnotatedController<String> to IEntityController<String>"/> + <message kind="error" line="30" text="Cannot infer type arguments for MyAnnotatedController<>"/> + </compile> + <!-- + <run class="de.scrum_master.app.MyAnnotatedController"> + <stdout> + <line text="Doing something"/> + <line text="public static void de.scrum_master.app.MyAnnotatedController.main(java.lang.String[])"/> + <line text="public void de.scrum_master.app.MyAnnotatedController.doSomething()"/> + <line text="public java.lang.Object de.scrum_master.app.MyAnnotatedController.getEntity()"/> + <line text="public void de.scrum_master.app.MyAnnotatedController.setEntity(java.lang.Object)"/> + <line text="Entity value = foo"/> + <line text="Entity value = 123"/> + </stdout> + </run> + --> + </ajc-test> + + <ajc-test dir="bugs183/443477" title="verifyerror"> + <compile options="-1.7" files="Coo.java"/> + <run class="Coo"/> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc184/Ajc184Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc184/Ajc184Tests.java new file mode 100644 index 000000000..7e1265a0b --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc184/Ajc184Tests.java @@ -0,0 +1,120 @@ +/******************************************************************************* + * 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 void testIsFinal_449739() { + runTest("is final"); + } + + public void testIsFinal_449739_2() { + runTest("is final - 2"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc184Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc184.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc184/AllTestsAspectJ184.java b/tests/src/test/java/org/aspectj/systemtest/ajc184/AllTestsAspectJ184.java new file mode 100644 index 000000000..be0b12112 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc184/AllTestsAspectJ184.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * 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; + +public class AllTestsAspectJ184 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.8.4 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc184Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc184/ajc184.xml b/tests/src/test/java/org/aspectj/systemtest/ajc184/ajc184.xml new file mode 100644 index 000000000..3010ce169 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc184/ajc184.xml @@ -0,0 +1,198 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 1"> +<compile files="One.java" options="-1.8"/> +<run class="One"> + <stdout> + <line text="In instance check method doit()"/> + <line text="In advice()"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 2"> +<compile files="Two.java" options="-1.8"/> +<run class="Two"> + <stdout> + <line text="In instance check method, count=1 so doit returns false"/> + <line text="Method m() running"/> + <line text="In instance check method, count=2 so doit returns true"/> + <line text="In advice()"/> + <line text="Method m() running"/> + <line text="In instance check method, count=3 so doit returns false"/> + <line text="Method m() running"/> + <line text="In instance check method, count=4 so doit returns true"/> + <line text="In advice()"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 3"> +<compile files="Three.java" options="-1.8"/> +<run class="Three"> + <stdout> + <line text="Method m() running"/> + <line text="In instance check method, count=1 so doit returns false"/> + <line text="Method m() running"/> + <line text="In instance check method, count=2 so doit returns true"/> + <line text="In advice()"/> + <line text="Method m() running"/> + <line text="In instance check method, count=3 so doit returns false"/> + <line text="Method m() running"/> + <line text="In instance check method, count=4 so doit returns true"/> + <line text="In advice()"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 4"> +<compile files="Four.java" options="-1.8"/> +<run class="Four"> + <stdout> + <line text="In instance check method doit()"/> + <line text="In advice() execution(void Four.m())"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 5"> +<compile files="Five.java" options="-1.8"/> +<run class="Five"> + <stdout> + <line text="In instance check method doit()"/> + <line text="In advice() arg0=abc"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 6"> +<compile files="Six.java" options="-1.8"/> +<run class="Six"> + <stdout> + <line text="In instance check method doit()"/> + <line text="In advice() execution(void Six.main(String[]))"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 7"> +<compile files="Seven.java" options="-1.8"/> +<run class="Seven"> + <stdout> + <line text="In instance check method doit()"/> + <line text="In advice() call(void Seven.m()) execution(void Seven.main(String[]))"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 8"> +<compile files="Eight.java" options="-1.8"/> +<run class="Eight"> + <stdout> + <line text="in doit(): class=X"/> + <line text="In advice()"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 9"> +<compile files="Nine.java" options="-1.8"/> +<run class="Nine"> + <stdout> + <line text="in doit(): class=X"/> + <line text="In advice()"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 10"> +<compile files="Ten.java" options="-1.8"/> +<run class="com.foo.bar.Ten"> + <stdout> + <line text="In instance check method doit() class=com.foo.bar.X"/> + <line text="In advice()"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 11"> +<compile files="Eleven.java" options="-1.8"> +<message kind="error" text="thisAspectInstance can only be used inside an if() clause for singleton aspects (compiler limitation)"/> +</compile> +</ajc-test> + +<ajc-test dir="bugs184/449739" title="is final"> +<compile files="Code.java" options="-1.8"/> +<run class="Code"> + <stdout> + <line text="execution(void Code.run())"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs184/449739" title="is final - 2"> +<compile files="Code2.java" options="-1.8"/> +<run class="Code2"> + <stdout> + <line text="execution(void Helper.run())"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 12"> +<compile files="Twelve.java" options="-1.8"/> +<run class="Twelve"> + <stdout> + <line text="In instance check method doit()"/> + <line text="In advice() arg=abc tjpsp=execution(void Twelve.m(String))"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 13"> +<compile files="Thirteen.java" options="-1.8"/> +<run class="Thirteen"> + <stdout> + <line text="instance is X"/> + <line text="In advice() arg=abc tjpsp=execution(void Thirteen.m(String))"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 14"> +<compile files="Fourteen.java" options="-1.8"/> +<run class="Fourteen"> + <stdout> + <line text="instance is X"/> + <line text="In advice()"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs1612/pr239649" title="thisAspectInstance - 15"> +<compile files="Fifteen.java" options="-1.8"/> +<run class="Fifteen"> + <stdout> + <line text="in doit(): class=X"/> + <line text="In advice()"/> + <line text="Method m() running"/> + </stdout> +</run> +</ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc185/Ajc185Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc185/Ajc185Tests.java new file mode 100644 index 000000000..77b453188 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc185/Ajc185Tests.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * 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.ajc185; + +import java.io.File; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +import junit.framework.Test; + +/** + * @author Andy Clement + */ +public class Ajc185Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testUnresolvableMember_456357() throws Exception { + runTest("unresolvable member"); + } + + // Waiting on JDT fix. Second test is a 'variant' that is also causing me issues but not JDT it seems. Let's + // see what happens when we pick up the real fixes. +// public void testBadAnnos_455608() throws Exception { +// runTest("bad annos"); +// JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "Code2"); +// File f = new File(ajc.getSandboxDirectory(), "Code2.class"); +// byte[] data = loadFileAsByteArray(f); +// // Will throw ClassFormatException if there is a problem +// new ClassFileReader(data, null); +// } +// +// public void testBadAnnos_455608_2() throws Exception { +// runTest("bad annos 2"); +// JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "Code3"); +// File f = new File(ajc.getSandboxDirectory(), "Code3.class"); +// byte[] data = loadFileAsByteArray(f); +// // Will throw ClassFormatException if there is a problem +// new ClassFileReader(data, null); +// } + + public void testITDInterface_451966() throws Exception { + runTest("itd interface"); + } + + public void testITDInterface_451966_2() throws Exception { + // call made from inner type + runTest("itd interface - 2"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc185Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc185.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc185/AllTestsAspectJ185.java b/tests/src/test/java/org/aspectj/systemtest/ajc185/AllTestsAspectJ185.java new file mode 100644 index 000000000..0cd580fce --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc185/AllTestsAspectJ185.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * 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.ajc185; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ185 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.8.5 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc185Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc185/ajc185.xml b/tests/src/test/java/org/aspectj/systemtest/ajc185/ajc185.xml new file mode 100644 index 000000000..15fee4e84 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc185/ajc185.xml @@ -0,0 +1,34 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + +<ajc-test dir="bugs185/456357" title="unresolvable member"> +<compile files="DummyClass.java LogMe.java SampleAspect.java SampleUtil.java" options="-1.7"> +</compile> +</ajc-test> + +<ajc-test dir="bugs185/455608" title="bad annos"> +<compile files="Code2.java" options="-1.8 -proceedOnError"> + <message kind="error" text="String cannot be resolved to a variable"/> +</compile> +</ajc-test> + +<ajc-test dir="bugs185/455608" title="bad annos 2"> +<compile files="Code3.java" options="-1.8 -proceedOnError"> + <message kind="error" text="String cannot be resolved to a variable"/> +</compile> +</ajc-test> + +<ajc-test dir="bugs185/451966" title="itd interface"> +<compile files="Code.java" options="-1.8"/> +<run class="Code"> +</run> +</ajc-test> + +<ajc-test dir="bugs185/451966" title="itd interface - 2"> +<compile files="Code2.java" options="-1.8"/> +<run class="Code2"> +</run> +</ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc186/Ajc186Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc186/Ajc186Tests.java new file mode 100644 index 000000000..1625f96d1 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc186/Ajc186Tests.java @@ -0,0 +1,162 @@ +/******************************************************************************* + * 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.ajc186; + +import java.io.File; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.weaver.tools.ContextBasedMatcher; +import org.aspectj.weaver.tools.DefaultMatchingContext; +import org.aspectj.weaver.tools.FuzzyBoolean; +import org.aspectj.weaver.tools.MatchingContext; +import org.aspectj.weaver.tools.PointcutDesignatorHandler; +import org.aspectj.weaver.tools.PointcutExpression; +import org.aspectj.weaver.tools.PointcutParser; + +/** + * @author Andy Clement + */ +public class Ajc186Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + private class FooDesignatorHandler implements PointcutDesignatorHandler { + + private String askedToParse; + public boolean simulateDynamicTest = false; + + public String getDesignatorName() { + return "foo"; + } + + public ContextBasedMatcher parse(String expression) { + this.askedToParse = expression; + return new FooPointcutExpression(expression, this.simulateDynamicTest); + } + + public String getExpressionLastAskedToParse() { + return this.askedToParse; + } + } + + private class FooPointcutExpression implements ContextBasedMatcher { + + private final String beanNamePattern; + private final boolean simulateDynamicTest; + + public FooPointcutExpression(String beanNamePattern, + boolean simulateDynamicTest) { + this.beanNamePattern = beanNamePattern; + this.simulateDynamicTest = simulateDynamicTest; + } + + public boolean couldMatchJoinPointsInType(Class aClass) { + System.out.println("wubble?"); + return true; + } + + public boolean couldMatchJoinPointsInType(Class aClass, + MatchingContext context) { + System.out.println("wibble?"); + if (this.beanNamePattern.equals(context.getBinding("beanName"))) { + return true; + } else { + return false; + } + } + + public boolean mayNeedDynamicTest() { + return this.simulateDynamicTest; + } + + public FuzzyBoolean matchesStatically(MatchingContext matchContext) { + System.out.println("wobble?"); + if (this.simulateDynamicTest) + return FuzzyBoolean.MAYBE; + if (this.beanNamePattern + .equals(matchContext.getBinding("beanName"))) { + return FuzzyBoolean.YES; + } else { + return FuzzyBoolean.NO; + } + } + + public boolean matchesDynamically(MatchingContext matchContext) { + System.out.println("wabble?"); + return this.beanNamePattern.equals(matchContext + .getBinding("beanName")); + } + } + + public void testLambdaBeans() throws Exception { + runTest("lambda beans"); + + // Load the 1.8 compiled code + URLClassLoader ucl = new URLClassLoader(new URL[] {ajc.getSandboxDirectory().toURI().toURL()},this.getClass().getClassLoader()); + Class<?> applicationClass = Class.forName("Application",false,ucl); + assertNotNull(applicationClass); + Object instance = applicationClass.newInstance(); + Method works = applicationClass.getDeclaredMethod("fromInnerClass"); + works.setAccessible(true); + Runnable r = (Runnable) works.invoke(instance); + // r.getClass().getName() == Application$1 + + Method fails = applicationClass.getDeclaredMethod("fromLambdaExpression"); + fails.setAccessible(true); + Runnable r2 = (Runnable) fails.invoke(instance); + // r2.getClass().getName() == Application$$Lambda$1/1652149987 + +// JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "Application"); + PointcutParser parser = PointcutParser + .getPointcutParserSupportingAllPrimitivesAndUsingSpecifiedClassloaderForResolution(ucl); + FooDesignatorHandler beanHandler = new FooDesignatorHandler(); + parser.registerPointcutDesignatorHandler(beanHandler); + PointcutExpression pc = parser.parsePointcutExpression("foo(myBean)"); + DefaultMatchingContext context = new DefaultMatchingContext(); + pc.setMatchingContext(context); + + context.addContextBinding("beanName", "myBean"); + assertTrue(pc.couldMatchJoinPointsInType(r.getClass())); + + context.addContextBinding("beanName", "yourBean"); + assertFalse(pc.couldMatchJoinPointsInType(r.getClass())); + + context.addContextBinding("beanName", "myBean"); + assertTrue(pc.couldMatchJoinPointsInType(r2.getClass())); + + context.addContextBinding("beanName", "yourBean"); + assertFalse(pc.couldMatchJoinPointsInType(r2.getClass())); + } + + + public void testMissingExtends() throws Exception { + runTest("missing extends on generic target"); + } + + public void testMissingMethod_462821() throws Exception { + runTest("missing method"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc186Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc186.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc186/AllTestsAspectJ186.java b/tests/src/test/java/org/aspectj/systemtest/ajc186/AllTestsAspectJ186.java new file mode 100644 index 000000000..ff67705de --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc186/AllTestsAspectJ186.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * 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.ajc186; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ186 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.8.6 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc186Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc186/ajc186.xml b/tests/src/test/java/org/aspectj/systemtest/ajc186/ajc186.xml new file mode 100644 index 000000000..4f1394a95 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc186/ajc186.xml @@ -0,0 +1,25 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + +<ajc-test dir="bugs186/lambdaBeans" title="lambda beans"> +<compile files="Foo.java Application.java" options="-1.8"> +</compile> +</ajc-test> + +<ajc-test dir="bugs186/462821" title="missing method"> +<compile files="FooService.java AbstractLoggerAspect.java FooServiceLoggerAspect.java" options="-1.8"> +</compile> +</ajc-test> + +<ajc-test dir="bugs186/romain" title="missing extends on generic target"> +<compile files="Code.java SubCode.java" options="-1.5" outjar="code.jar"/> +<compile files="X.java Runner1.java" options="-1.5" inpath="code.jar"/> +<run class="Runner1"> +<stdout> +<line text="foo"/> +</stdout> +</run> +</ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc187/Ajc187Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc187/Ajc187Tests.java new file mode 100644 index 000000000..4ff34b28e --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc187/Ajc187Tests.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * 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.ajc187; + +import java.io.File; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +import junit.framework.Test; + +/** + * @author Andy Clement + */ +public class Ajc187Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testCompileError_476245() throws Exception { + runTest("compile error"); + } + + public void testMissingJoinpoint_307147() throws Exception { + runTest("missing joinpoint"); + } + + public void testMissingJoinpoint_307147_2() throws Exception { + runTest("missing joinpoint 2"); + } + + public void testInfiniteLoop_475152() throws Exception { + runTest("infinite loop"); + } + + public void testAnnoConversion_474165() throws Exception { + runTest("anno conversion"); + } + + public void testLambda_470633() throws Exception { + runTest("lambda"); + } + +// public void testBrokenJava_469889() throws Exception { +// runTest("broken java"); +// } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc187Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc187.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc187/AllTestsAspectJ187.java b/tests/src/test/java/org/aspectj/systemtest/ajc187/AllTestsAspectJ187.java new file mode 100644 index 000000000..ef8ff0a1c --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc187/AllTestsAspectJ187.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * 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.ajc187; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ187 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.8.7 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc187Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc187/ajc187.xml b/tests/src/test/java/org/aspectj/systemtest/ajc187/ajc187.xml new file mode 100644 index 000000000..dfa22f696 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc187/ajc187.xml @@ -0,0 +1,67 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + +<ajc-test dir="bugs187/476245" title="compile error"> +<compile files="Testing.java" options="-1.8"/> +</ajc-test> + +<ajc-test dir="bugs187/307147" title="missing joinpoint"> +<compile files="Test.java TestAspect.aj ITDAspect.aj" options="-1.8"/> +<run class="test.Test"> +<stdout> +<line text="Around call(void test.Test.function())"/> +<line text="Normal function"/> +<line text="Around call(void test.Test.privateMethod())"/> +<line text="private method"/> +<line text="Around call(void test.Test.publicMethod())"/> +<line text="public method"/> +<line text="Around call(void test.Test.itdFunction())"/> +<line text="ITD function"/> +<line text="Around call(void test.Test.privateMethod())"/> +<line text="private method"/> +<line text="Around call(void test.Test.publicMethod())"/> +<line text="public method"/> +</stdout></run> +</ajc-test> + +<ajc-test dir="bugs187/307147_2" title="missing joinpoint 2"> +<compile files="Test.java TestAspect.aj ITDAspect.aj" options="-1.8"/> +<run class="test.Test"> +<stdout> +<line text="ITD function"/> +<line text="Around call(void test.Test.privateMethod(String))"/> +<line text="Captured Foo"/> +<line text="hello FOO"/> +</stdout></run> +</ajc-test> + +<ajc-test dir="bugs187/475152" title="infinite loop"> +<compile files="AbstractAspect.aj, BaseAspect.aj, TestClass.java, AjTarget.java, TestAspect.aj" options="-1.8"/> +</ajc-test> + +<ajc-test dir="bugs187/469889" title="broken java"> +<!-- +<compile files="A.java B.java AbstractA.java BImpl.java Main.java" options="-1.8"/> +--> +<compile files="Code.java" options="-1.8"/> +<run class="Code"> +<stdout> +<line text="B"/> +</stdout> +</run> +</ajc-test> + + +<ajc-test dir="bugs187/470633" title="lambda"> +<compile files="Maps.java" options="-1.8"/> +</ajc-test> + +<ajc-test dir="bugs187/474165" title="anno conversion"> +<compile files="B.java" options="-XhasMember -1.8 -showWeaveInfo"> +<message kind="weave" text="Extending interface set for type 'B' (B.java) to include 'java.io.Serializable' (B.java)"/> +</compile> +<run class="B"></run> +</ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc188/Ajc188Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc188/Ajc188Tests.java new file mode 100644 index 000000000..c2f5e888c --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc188/Ajc188Tests.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2015 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.ajc188; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Andy Clement + */ +public class Ajc188Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testClassCast() throws Exception { + runTest("classcast"); + } + + public void testAnnotationDiscoveryNpe() throws Exception { + runTest("annotation discovery npe"); + } + + public void testDefaultMethodsWithXnoInline() throws Exception { + runTest("default methods 1"); + } + + public void testDefaultMethodsWithoutXnoInline() throws Exception { + runTest("default methods 2"); + } + + public void testCompileError_478003() throws Exception { + runTest("compile error"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc188Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc188.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc188/AllTestsAspectJ188.java b/tests/src/test/java/org/aspectj/systemtest/ajc188/AllTestsAspectJ188.java new file mode 100644 index 000000000..32d3c12bf --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc188/AllTestsAspectJ188.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * 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.ajc188; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ188 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.8.8 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc188Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc188/ajc188.xml b/tests/src/test/java/org/aspectj/systemtest/ajc188/ajc188.xml new file mode 100644 index 000000000..685b50240 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc188/ajc188.xml @@ -0,0 +1,44 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + + <ajc-test dir="bugs188/485055" title="classcast"> + <compile files="AspectWithConstant.aj" options="-1.5"/> + <run class="AspectWithConstant"> + <stdout> + <line text="MAXS=hello"/> + <line text="@AspectWithConstant$Loggable()"/> + </stdout></run> + </ajc-test> + +<ajc-test dir="bugs188/484941" title="annotation discovery npe"> +<compile files="Test2.java" options="-1.8 -XnoInline"/> +</ajc-test> + +<ajc-test dir="bugs188/defaultmethods" title="default methods 1"> +<compile files="Code.java" options="-1.8 -XnoInline"/> +<run class="Code"> +<stdout> +<line text="a"/> +<line text="b"/> +</stdout> +</run> +</ajc-test> + + +<ajc-test dir="bugs188/defaultmethods" title="default methods 2"> +<compile files="Code2.java" options="-1.8"/> +<run class="Code2"> +<stdout> +<line text="a"/> +<line text="b"/> +</stdout> +</run> +</ajc-test> + +<ajc-test dir="bugs188/478003" title="compile error"> +<compile files="OrientDBKeyIO.java" options="-1.8"/> +</ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc189/Ajc189Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc189/Ajc189Tests.java new file mode 100644 index 000000000..456c4a41f --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc189/Ajc189Tests.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2016 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.ajc189; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Andy Clement + */ +public class Ajc189Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testJarWeaving_433351() { + runTest("jar weaving"); + } + + public void testJarWeaving_433351_4() { + runTest("jar weaving 4"); + } + + public void testJarWeaving_433351_3() { + runTest("jar weaving 3"); + } + + public void testJarWeaving_433351_2() { + runTest("jar weaving 2"); + } + + public void testNPEAtAspectJ() throws Exception { + runTest("NPE at aspectj"); + } + + public void testLostBounds() throws Exception { + runTest("lost bounds"); + // This type has I added via declare parents + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "B"); + assertEquals("<T:LSomeClass;:LSomeInterface;>LC<TT;>;Ljava/io/Serializable;LI;",jc.getGenericSignature()); + jc = getClassFrom(ajc.getSandboxDirectory(), "D"); + assertEquals("<T::LSomeInterface;:LSomeOtherInterface;>Ljava/lang/Object;LI;",jc.getGenericSignature()); + } + + public void testWhileNPE_486203() throws Exception { + runTest("while npe"); + } + +// public void testOverweaving_352389() throws Exception { +// runTest("overweaving"); +// } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc189Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc189.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc189/AllTestsAspectJ189.java b/tests/src/test/java/org/aspectj/systemtest/ajc189/AllTestsAspectJ189.java new file mode 100644 index 000000000..546ef02de --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc189/AllTestsAspectJ189.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2016 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.ajc189; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ189 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.8.9 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc189Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc189/ajc189.out.xml b/tests/src/test/java/org/aspectj/systemtest/ajc189/ajc189.out.xml new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc189/ajc189.out.xml diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc189/ajc189.xml b/tests/src/test/java/org/aspectj/systemtest/ajc189/ajc189.xml new file mode 100644 index 000000000..8693c1e24 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc189/ajc189.xml @@ -0,0 +1,102 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs189/433351" title="jar weaving"> + <compile options="-1.5" files="InterfaceProj1.java" outjar="code.jar"/> + <compile options="-1.5 -showWeaveInfo" inpath="code.jar" files="Extender.aj InterfaceProj2.java"> + <message kind="weave" text="Extending interface set for type 'test.InterfaceProj1' (InterfaceProj1.java) to include 'test.extender.InterfaceProj2' (Extender.aj)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs189/433351" title="jar weaving 2"> + <compile options="-1.5" files="InterfaceProj1.java ClassProj1.java" outjar="code.jar"/> + <compile options="-1.5 -showWeaveInfo" inpath="code.jar" files="Extender2.aj" outjar="code2.jar"> + <message kind="weave" text="Extending interface set for type 'test.InterfaceProj1' (InterfaceProj1.java) to include 'java.io.Serializable' (Extender2.aj)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs189/433351" title="jar weaving 3"> + <compile options="-1.5" files="InterfaceProj1.java ClassProj1.java" outjar="code.jar"/> + <compile options="-1.5 -showWeaveInfo" inpath="code.jar" files="Extender3.aj InterfaceProj2.java ClassProj2.java" outjar="code2.jar"> + <message kind="weave" text="Setting superclass of type 'test.ClassProj1' (ClassProj1.java) to 'test.extender.ClassProj2' (Extender3.aj)"/> + <message kind="weave" text="Extending interface set for type 'test.InterfaceProj1' (InterfaceProj1.java) to include 'test.extender.InterfaceProj2' (Extender3.aj)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs189/433351" title="jar weaving 4"> + <compile options="-1.5" files="ClassProj1.java InterfaceProj1.java" outjar="code.jar"/> + <compile options="-1.5 -showWeaveInfo" inpath="code.jar" files="Extender2.aj" outjar="code2.jar"> + <message kind="weave" text="Extending interface set for type 'test.InterfaceProj1' (InterfaceProj1.java) to include 'java.io.Serializable' (Extender2.aj)"/> + </compile> + </ajc-test> + +<ajc-test dir="bugs189/485583" title="NPE at aspectj"> + <compile files="Foo.aj Bar.aj" options="-1.8"> + <message kind="error" text="The abstract pointcut deprecatedCode can only be defined in an aspect"/> + </compile> +</ajc-test> + +<ajc-test dir="bugs189/486612" title="lost bounds"> + <compile files="Code.java Azpect.java" options="-1.8"/> +</ajc-test> + + +<ajc-test dir="bugs189/486203" title="while npe"> +<compile files="While.java" options="-1.8"/> +</ajc-test> + +<ajc-test dir="bugs189/352389" title="overweaving"> + + <compile files="A.java Code.java" outjar="one.jar" options="-1.8 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void Code.m())' in Type 'Code' (Code.java:6) advised by before advice from 'A' (A.java:2)"/> + </compile> + <run class="Code" classpath="$sandbox/one.jar"> + <stdout> + <line text="a"/> + </stdout> + </run> + + <!-- The non overweaving case would look like this --> + <compile files="B.java" inpath="one.jar" options="-1.8 -showWeaveInfo" outjar="two.jar"> + <message kind="weave" text="Join point 'method-execution(void Code.m())' in Type 'Code' (Code.java:6) advised by before advice from 'B' (B.java:2)"/> + <message kind="weave" text="Join point 'method-execution(void Code.m())' in Type 'Code' (Code.java:6) advised by before advice from 'A' (one.jar!A.class:2(from A.java))"/> + </compile> + + <!-- With overweaving it looks like the advice from A isn't applying but it just isn't applying during this weave step, it + remains in the bytecode applied from before. --> + <compile files="B.java" inpath="one.jar" options="-1.8 -Xset:pipelineCompilation=false{overWeaving=true -showWeaveInfo" outjar="two.jar"> + <message kind="warning" text="advice defined in A has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="weave" text="Join point 'method-execution(void Code.m())' in Type 'Code' (Code.java:6) advised by before advice from 'B' (B.java:2)"/> + </compile> + <!-- Note: with overweaving output is b>a without overweaving it is a>b --> + <run class="Code" classpath="$sandbox/two.jar"> + <stdout> + <line text="b"/> + <line text="a"/> + </stdout> + </run> + + <compile files="C.java" inpath="two.jar" options="-1.8 -Xset:overWeaving=true -showWeaveInfo" outjar="three.jar"> + <message kind="warning" text="advice defined in A has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="warning" text="advice defined in B has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="weave" text="Join point 'method-execution(void Code.m())' in Type 'Code' (Code.java:6) advised by before advice from 'C' (C.java:2)"/> + </compile> + <!-- + <compile files="C.java" inpath="two.jar" options="-1.8 -showWeaveInfo" outjar="three.jar"> + <message kind="weave" text="Join point 'method-execution(void Code.m())' in Type 'Code' (Code.java:6) advised by before advice from 'C' (C.java:2)"/> + <message kind="weave" text="Join point 'method-execution(void Code.m())' in Type 'Code' (Code.java:6) advised by before advice from 'B' (two.jar!B.class:2(from B.java))"/> + <message kind="weave" text="Join point 'method-execution(void Code.m())' in Type 'Code' (Code.java:6) advised by before advice from 'A' (two.jar!A.class:2(from A.java))"/> + </compile> + --> + <!-- Note: with overweaving c>b>a but without overweaving a>b>c --> + <run class="Code" classpath="$sandbox/three.jar"> + <stdout> + <line text="c"/> + <line text="b"/> + <line text="a"/> + </stdout> + </run> +</ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc190/Ajc190Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc190/Ajc190Tests.java new file mode 100644 index 000000000..3d3659f77 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc190/Ajc190Tests.java @@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) 2016 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.ajc190; + +import java.io.File; + +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.testing.XMLBasedAjcTestCaseForJava9OrLater; + +import junit.framework.Test; + +/** + * @author Andy Clement + */ +public class Ajc190Tests extends XMLBasedAjcTestCaseForJava9OrLater { + + public void testParamAnnosNegative() { + runTest("param annos negative"); + } + + public void testAnnotMethodHasMember_pr156962_1() { // From similar in Ajc153Tests + runTest("Test Annot Method Has Member 1"); + } + + public void testAnnotMethodHasMember_pr156962_2() { // From similar in Ajc153Tests + runTest("Test Annot Method Has Member 1"); + } + + public void testFunnySignature() { + runTest("funny signature with method reference"); + } + + // Weave a module with code that isn't in a module + public void testWeaveModule() throws Exception { + runTest("weave module"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc190Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc190.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc190/AllTestsAspectJ190.java b/tests/src/test/java/org/aspectj/systemtest/ajc190/AllTestsAspectJ190.java new file mode 100644 index 000000000..d0f7734f3 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc190/AllTestsAspectJ190.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.ajc190; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ190 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.9.0 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc190Tests.suite()); + suite.addTest(SanityTests19.suite()); + suite.addTest(EfficientTJPTests.suite()); + suite.addTest(ModuleTests.suite()); + suite.addTest(Annotations.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc190/Annotations.java b/tests/src/test/java/org/aspectj/systemtest/ajc190/Annotations.java new file mode 100644 index 000000000..b2f8c267e --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc190/Annotations.java @@ -0,0 +1,176 @@ +/******************************************************************************* + * Copyright (c) 2004, 2017 IBM + * 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 + *******************************************************************************/ +package org.aspectj.systemtest.ajc190; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * A copy of the 1.5.0 Annotations test but with compliance set to 1.9 + * The testdata is referenced in the 150 test folder but the XML file indicates compliance of 1.9. + * + * @author Andy Clement + */ +public class Annotations extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Annotations.class); + } + + protected File getSpecFile() { + return new File("../tests/src/org/aspectj/systemtest/ajc190/ajc190_from150.xml"); + } + + public void testCompilingAnnotation() { + runTest("compiling an annotation"); + } + + public void testCompilingAnnotatedFile() { + runTest("compiling annotated file"); + } + + public void testCompilingUsingWithinAndAnnotationTypePattern() { + runTest("annotations and within (src)"); + } + + /** + * We had a bug where annotations were not present in the output class file for + * methods that got woven. This was due to unpacking bugs in LazyMethodGen. This + * test compiles a simple program then checks the annotations were copied + * across. + */ + public void testBugWithAnnotationsLostOnWovenMethods() throws ClassNotFoundException { + runTest("losing annotations..."); + if (getCurrentTest().canRunOnThisVM()) { + + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "Program"); + Method[] meths = jc.getMethods(); + for (int i = 0; i < meths.length; i++) { + Method method = meths[i]; + if (method.getName().equals("m1")) { + assertTrue("Didn't have annotations - were they lost? method=" + method.getName(), + method.getAnnotations().length == 1); + } + } + } + } + + public void testAnnotatedAnnotations() { + runTest("annotated annotations (@Target)"); + } + + public void testSimpleAnnotatedAspectMembers() { + runTest("simple annotated aspect members"); + } + + public void testAnnotatedAspectMembersWithWrongAnnotationType() { + runTest("simple annotated aspect members with bad target"); + } + + // more implementation work needed before this test passes + public void testAnnotatedITDs() { + runTest("annotated itds"); + } + + public void testAnnotatedITDs2() { + runTest("annotated public itds"); + } + + public void testAnnotatedITDs3() { + runTest("annotated public itds - values"); + } + + public void testAnnotatedITDs4() { + runTest("annotated public itds - multiple complex annotations"); + } + + public void testAnnotatedITDsWithWrongAnnotationType() { + runTest("annotated itds with bad target"); + } + + public void testAnnotatedAdvice() { + runTest("annotated advice"); + } + + public void testAnnotatedAdviceWithWrongAnnotationType() { + runTest("annotated advice with bad target"); + } + + public void testAnnotatedPointcut() { + runTest("annotated pointcut"); + } + + // FIXME asc uncomment this test when parser is opened up + // public void testAnnotatedDeclareStatements() { + // runTest("annotated declare statements"); + // } + + public void testBasicDeclareAnnotation() { + runTest("basic declare annotation parse test"); + } + + public void testAJDKAnnotatingAspects() { + runTest("ajdk: annotating aspects chapter"); + } + + public void testAJDKAnnotatingAspects2() { + runTest("ajdk: annotating aspects chapter, ex 2"); + } + + public void testAnnotationPatterns() { + runTest("ajdk: annotation pattern matching"); + } + + public void testAnnotationTypePatterns() { + runTest("ajdk: annotation type pattern matching"); + } + + public void testAnnotationSigPatterns() { + runTest("ajdk: annotations in sig patterns"); + } + + public void testAnnotationRuntimeMatching() { + runTest("ajdk: runtime annotations"); + } + + public void testAnnotationRetentionChecking() { + runTest("ajdk: @retention checking"); + } + + public void testAnnotationInheritance() { + runTest("ajdk: @inherited"); + } + + public void testAnnotationDEOW() { + runTest("ajdk: deow-ann"); + } + + public void testAnnotationDecp() { + runTest("ajdk: decp-ann"); + } + + public void testAnnotationDecPrecedence() { + runTest("ajdk: dec precedence"); + } + + public void testAnnotationDecAnnotation() { + runTest("ajdk: dec annotation"); + } + + public void testAnnotationsAndITDs() { + runTest("nasty annotation and itds test"); + } + + // helper methods..... + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc190/EfficientTJPTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc190/EfficientTJPTests.java new file mode 100644 index 000000000..3564f9469 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc190/EfficientTJPTests.java @@ -0,0 +1,126 @@ +/******************************************************************************* + * Copyright (c) 2018 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 + *******************************************************************************/ +package org.aspectj.systemtest.ajc190; + +import java.io.File; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.testing.XMLBasedAjcTestCase; + +import junit.framework.Assert; +import junit.framework.Test; + +/** + * + * @author Andy Clement + */ +public class EfficientTJPTests extends XMLBasedAjcTestCase { + + public void testThisJoinPointMethodExecution() { + // Test setting it via sys props rather than passing the option directly + try { + System.setProperty("ASPECTJ_OPTS", "-Xajruntimetarget:1.9"); + runTest("tjp 1"); + checkPreClinitContains("One","Factory.makeMethodSJP"); + } finally { + System.setProperty("ASPECTJ_OPTS", ""); + } + } + + public void testThisEnclosingJoinPointMethodExecution() { + runTest("tjp 2"); + checkPreClinitContains("Two","Factory.makeMethodESJP"); + } + + public void testThisJoinPointConstructorExecution() { + runTest("tjp 3"); + checkPreClinitContains("Three","Factory.makeConstructorSJP"); + } + + public void testThisEnclosingJoinPointConstructorExecution() { + runTest("tjp 3a"); + checkPreClinitContains("ThreeA","Factory.makeConstructorESJP"); + } + + public void testThisJoinPointHandler() { + runTest("tjp 4"); + checkPreClinitContains("Four","Factory.makeCatchClauseSJP"); + } + + public void testThisEnclosingJoinPointHandler() { + runTest("tjp 4a"); + checkPreClinitContains("FourA","Factory.makeMethodESJP"); + } + + public void testThisJoinPointFieldGet() { + runTest("tjp get fields"); + checkPreClinitContains("Fields","Factory.makeFieldSJP"); + } + + public void testThisEnclosingJoinPointFieldGet() { + runTest("tjp get fieldsE"); + checkPreClinitContains("FieldsE","Factory.makeMethodESJP"); + } + + public void testThisJoinPointFieldSet() { + runTest("tjp set fields"); + checkPreClinitContains("Fields2","Factory.makeFieldSJP"); + } + + public void testThisJoinPointClinit() { + runTest("tjp clinit"); + checkPreClinitContains("Clinit","Factory.makeInitializerSJP"); + } + + public void testThisEnclosingJoinPointClinit() { + runTest("tejp clinit"); + checkPreClinitContains("ClinitE","Factory.makeInitializerESJP"); + } + + public void testThisJoinPointAdvice() { + // covers enclosing joinpoint too + runTest("tjp advice"); + checkPreClinitContains("X","Factory.makeAdviceESJP"); + } + + public void testThisJoinPointInitialization() { + runTest("tjp init"); + checkPreClinitContains("A","Factory.makeConstructorESJP"); + checkPreClinitContains("B","Factory.makeConstructorESJP"); + } + + // /////////////////////////////////////// + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(EfficientTJPTests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("features190.xml"); + } + + public void checkPreClinitContains(String classname, String text) { + try { + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname); + Method[] meths = jc.getMethods(); + for (int i = 0; i < meths.length; i++) { + Method method = meths[i]; + if (method.getName().equals("ajc$preClinit")) { + String code = method.getCode().getCodeString(); + assertTrue("Expected to contain '"+text+"':\n"+code,code.contains(text)); + return; + } + } + Assert.fail("Unable to find ajc$preClinit in class "+classname); + } catch (Exception e) { + Assert.fail(e.toString()); + } + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc190/ModuleTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc190/ModuleTests.java new file mode 100644 index 000000000..08d7f500f --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc190/ModuleTests.java @@ -0,0 +1,179 @@ +/******************************************************************************* + * Copyright (c) 2017 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 + *******************************************************************************/ +package org.aspectj.systemtest.ajc190; + +import java.io.File; + +import org.aspectj.apache.bcel.classfile.Attribute; +import org.aspectj.apache.bcel.classfile.Code; +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.testing.XMLBasedAjcTestCaseForJava9OrLater; +import org.aspectj.util.LangUtil; + +import junit.framework.Test; + +/** + * Building and weaving with modules in the picture. + * + * Module options from http://openjdk.java.net/jeps/261 + * + * @author Andy Clement + * + */ +public class ModuleTests extends XMLBasedAjcTestCaseForJava9OrLater { + + public void testBuildAModule() { + runTest("build a module"); + } + + public void testRunModuleClassPath() { + runTest("run a module - classpath"); + } + + public void testRunModuleModulePath() { + runTest("run a module - modulepath"); + } + + public void testPackageAndRunModuleFromModulePath() { + runTest("package and run a module - modulepath"); + } + + public void testBuildModuleIncludingAspects() { + runTest("compile module including aspects"); + } + + public void testBuildModuleAndApplyAspectsFromAspectPath() { + runTest("compile module and apply aspects via aspectpath"); + } + + public void testBinaryWeavingAModuleJar() { + // Pass a module on inpath, does it weave ok with a source aspect, does it run afterwards? + runTest("binary weaving module"); + } + + public void testModulepathClasspathResolution1() { + runTest("module path vs classpath 1"); + } + +// public void testModulepathClasspathResolution2() { +// runTest("module path vs classpath 2"); +// } + + // --add-modules + + // This tests that when using --add-modules with one of the JDK modules (in the jmods subfolder of the JDK) + // that it can be found without needing to set --module-path (this seems to be implicitly included by javac too) + public void testAddModules1() { + if (LangUtil.is11VMOrGreater()) { + // java.xml.bind is gone in Java11 + return; + } + runTest("compile use of java.xml.bind"); + } + + // This tests that we can use add-modules to pull in something from the JDK jmods package and that + // when subsequently weaving we can see types from those modules + public void testWovenAfterAddModules() { + if (LangUtil.is11VMOrGreater()) { + // java.xml.bind is gone in Java11 + return; + } + runTest("weave use of java.xml.bind"); + } + + // --limit-modules + public void testLimitModules1() { + if (LangUtil.is11VMOrGreater()) { + // java.xml.bind is gone in Java11 + return; + } + runTest("limit modules 1"); + } + + // --add-reads + public void testAddReads1() { + if (LangUtil.is11VMOrGreater()) { + // java.xml.bind is gone in Java11 + return; + } + runTest("add reads 1"); + } + + + // --- + + /* For the specified class, check that each method has a stackmap attribute */ + private void checkStackMapExistence(String classname, String toIgnore) throws ClassNotFoundException { + toIgnore = "_" + (toIgnore == null ? "" : toIgnore) + "_"; + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname); + Method[] methods = jc.getMethods(); + for (int i = 0; i < methods.length; i++) { + Method method = methods[i]; + if (toIgnore.contains("_" + method.getName() + "_")) { + continue; + } + boolean hasStackMapAttribute = findAttribute(method.getAttributes(), "StackMapTable"); + if (!hasStackMapAttribute) { + fail("Could not find StackMap attribute for method " + method.getName()); + } + } + } + + private boolean findAttribute(Attribute[] attrs, String attributeName) { + if (attrs == null) { + return false; + } + for (int i = 0; i < attrs.length; i++) { + Attribute attribute = attrs[i]; + if (attribute.getName().equals(attributeName)) { + return true; + } + // System.out.println(attribute.getName()); + if (attribute.getName().equals("Code")) { + Code c = (Code) attribute; + Attribute[] codeAttributes = c.getAttributes(); + for (int j = 0; j < codeAttributes.length; j++) { + Attribute codeAttribute = codeAttributes[j]; + if (codeAttribute.getName().equals(attributeName)) { + return true; + // System.out.println(codeAttribute.getName()); + } + } + } + } + return false; + } + + private void checkVersion(String classname, int major, int minor) throws ClassNotFoundException { + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname); + if (jc.getMajor() != major) { + fail("Expected major version to be " + major + " but was " + jc.getMajor()); + } + if (jc.getMinor() != minor) { + fail("Expected minor version to be " + minor + " but was " + jc.getMinor()); + } + } + + // Check the stackmap stuff is removed when a method gets woven (for now...) + // public void testStackMapAttributesDeletedInWovenCode() { + // fail("Not implemented"); + // } + + // /////////////////////////////////////// + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(ModuleTests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc190.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc190/SanityTests19.java b/tests/src/test/java/org/aspectj/systemtest/ajc190/SanityTests19.java new file mode 100644 index 000000000..5544022c4 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc190/SanityTests19.java @@ -0,0 +1,153 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM + * 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.ajc190; + +import java.io.File; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.testing.XMLBasedAjcTestCase; + +import junit.framework.Test; + +/* + * Some very trivial tests that help verify things are OK. + * These are a copy of the earlier Sanity Tests created for 1.6 but these supply the -1.9 option + * to check code generation and modification with that version specified. + */ +public class SanityTests19 extends org.aspectj.testing.XMLBasedAjcTestCase { + + // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) + public void testSimpleJava_A() { + runTest("simple - a"); + } + + public void testSimpleJava_B() { + runTest("simple - b"); + } + + public void testSimpleCode_C() { + runTest("simple - c"); + } + + public void testSimpleCode_D() { + runTest("simple - d"); + } + + public void testSimpleCode_E() { + runTest("simple - e"); + } + + public void testSimpleCode_F() { + runTest("simple - f"); + } + + public void testSimpleCode_G() { + runTest("simple - g"); + } + + public void testSimpleCode_H() { + runTest("simple - h", true); + } + + public void testSimpleCode_I() { + runTest("simple - i"); + } + + // Check the version number in the classfiles is correct when Java6 options specified + public void testVersionCorrect1() throws ClassNotFoundException { + runTest("simple - j"); + checkVersion("A", 53, 0); + } + + public void testVersionCorrect2() throws ClassNotFoundException { + runTest("simple - k"); + checkVersion("A", 53, 0); + } + + public void testVersionCorrect4() throws ClassNotFoundException { // check it is 49.0 when -1.5 is specified + runTest("simple - m"); + checkVersion("A", 49, 0); + } + + // Check the stackmap stuff appears for methods in a Java6 file + // public void testStackMapAttributesAppear() throws ClassNotFoundException { + // runTest("simple - n"); + // checkStackMapExistence("A","<init>_<clinit>"); + // checkStackMapExistence("X","<init>_<clinit>_ajc$pointcut$$complicatedPointcut$1fe"); + // } + + /* For the specified class, check that each method has a stackmap attribute */ +// private void checkStackMapExistence(String classname, String toIgnore) throws ClassNotFoundException { +// toIgnore = "_" + (toIgnore == null ? "" : toIgnore) + "_"; +// JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname); +// Method[] methods = jc.getMethods(); +// for (int i = 0; i < methods.length; i++) { +// Method method = methods[i]; +// if (toIgnore.contains("_" + method.getName() + "_")) { +// continue; +// } +// boolean hasStackMapAttribute = findAttribute(method.getAttributes(), "StackMapTable"); +// if (!hasStackMapAttribute) { +// fail("Could not find StackMap attribute for method " + method.getName()); +// } +// } +// } + +// private boolean findAttribute(Attribute[] attrs, String attributeName) { +// if (attrs == null) { +// return false; +// } +// for (int i = 0; i < attrs.length; i++) { +// Attribute attribute = attrs[i]; +// if (attribute.getName().equals(attributeName)) { +// return true; +// } +// // System.out.println(attribute.getName()); +// if (attribute.getName().equals("Code")) { +// Code c = (Code) attribute; +// Attribute[] codeAttributes = c.getAttributes(); +// for (int j = 0; j < codeAttributes.length; j++) { +// Attribute codeAttribute = codeAttributes[j]; +// if (codeAttribute.getName().equals(attributeName)) { +// return true; +// // System.out.println(codeAttribute.getName()); +// } +// } +// } +// } +// return false; +// } + + private void checkVersion(String classname, int major, int minor) throws ClassNotFoundException { + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname); + if (jc.getMajor() != major) { + fail("Expected major version to be " + major + " but was " + jc.getMajor()); + } + if (jc.getMinor() != minor) { + fail("Expected minor version to be " + minor + " but was " + jc.getMinor()); + } + } + + // Check the stackmap stuff is removed when a method gets woven (for now...) + // public void testStackMapAttributesDeletedInWovenCode() { + // fail("Not implemented"); + // } + + // /////////////////////////////////////// + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(SanityTests19.class); + } + + protected File getSpecFile() { + return getClassResource("sanity-tests-19.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc190/ajc190.xml b/tests/src/test/java/org/aspectj/systemtest/ajc190/ajc190.xml new file mode 100644 index 000000000..d6507dace --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc190/ajc190.xml @@ -0,0 +1,216 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + + <ajc-test dir="bugs190/paramannos" title="param annos negative"> + <compile files="Code.java" options="-1.9 -showWeaveInfo"> + <message kind="weave" text="Join point 'constructor-execution(void Code.<init>(java.lang.Object))' in Type 'Code' (Code.java:8) advised by before advice from 'X' (Code.java:12)"/> + </compile> + </ajc-test> + + + <ajc-test dir="bugs190/modules/aaa" title="build a module"> + <compile files="module-info.java com/foo1/C1.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs190/modules/bbb" title="run a module - classpath"> + <compile files="module-info.java aaa/bbb/A.java" options="-1.9"/> + <run class="aaa.bbb.A"> + <stdout> + <line text="A running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs190/modules/bbb" title="run a module - modulepath"> + <compile files="module-info.java aaa/bbb/A.java" options="-1.9"/> + <run modulepath="$sandbox" module="my.module/aaa.bbb.A"> + <stdout> + <line text="A running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs190/modules/bbb" title="package and run a module - modulepath"> + <compile files="module-info.java aaa/bbb/A.java" options="-1.9" outjar="my.module.jar"/> + <file deletefile="module-info.java"/> + <file deletefile="aaa"/> + <run modulepath="my.module.jar" module="my.module/aaa.bbb.A"> + <stdout> + <line text="A running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs190/modules/ccc" title="compile regular code using module code"> + <compile files="module-info.java aaa/bbb/A.java" options="-1.9" outjar="modules/my.module.jar"/> + <file deletefile="module-info.java"/> + <file deletefile="aaa"/> + <compile files="InvokeA.java" options="-1.9" modulepath="$sandbox/modules/my.module.jar"/> + </ajc-test> + + <ajc-test dir="bugs190/modules/ddd" title="compile regular code using module code that isn't visible"> + <compile files="module-info.java aaa/bbb/A.java" options="-1.9" outjar="modules/my.module.jar"/> + <compile files="InvokeA.java" options="-1.9" modulepath="$sandbox/modules/my.module.jar"> + <message kind="error" text="package aaa.bbb is not visible"/> + </compile> + </ajc-test> + + + <ajc-test dir="bugs190/modules/eee" title="binary weaving module"> + <compile files="module-info.java aaa/bbb/A.java" options="-1.9" outjar="my.module.jar"/> + <file deletefile="module-info.java"/> + <file deletefile="aaa"/> + <compile files="Azpect.java" inpath="my.module.jar" outjar="my.module.woven.jar"/> + <run modulepath="my.module.woven.jar" module="my.module/aaa.bbb.A"> + <stdout> + <line text="Azpect running"/> + <line text="A running"/> + </stdout> + </run> + </ajc-test> + + + <ajc-test dir="bugs190/520135" title="funny signature with method reference"> + <compile files="FailsApectJ.java" options="-1.8"/> + </ajc-test> + + <ajc-test dir="bugs190/modules/fff" title="compile module including aspects"> + <compile files="module-info.java pkg/Demo.java otherpkg/Azpect.java" modulepath="$runtime" outjar="demomodule.jar" options="-1.9"/> + <run modulepath="$runtime:demomodule.jar" module="demo/pkg.Demo"> + <stdout> + <line text="Azpect running"/> + <line text="Demo running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs190/modules/eee" title="compile module and apply aspects via aspectpath"> + <compile files="module-info.java aaa/bbb/A.java" options="-1.9" outjar="my.module.jar"/> + <file deletefile="module-info.java"/> + <file deletefile="aaa"/> + <compile files="Azpect.java" outjar="azpects.jar" options="-1.4"/> + <compile options="-showWeaveInfo" inpath="my.module.jar" aspectpath="azpects.jar" outjar="my.module.woven.jar"> + <message kind="weave" text="Join point 'method-execution(void aaa.bbb.A.main(java.lang.String[]))' in Type 'aaa.bbb.A' (A.java:4) advised by before advice from 'aspects.Azpect' (azpects.jar!Azpect.class:4(from Azpect.java))"/> + </compile> + <file deletefile="my.module.jar"/> + <run classpath="my.module.woven.jar:azpects.jar" class="aaa.bbb.A"> + <stdout> + <line text="Azpect running"/> + <line text="A running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs190/modules/ggg" title="module path vs classpath 1"> + <!-- build some simple code into a jar we can depend on *not a module* --> + <compile files="ddd/D.java" options="-1.9" outjar="foo.jar"/> + <file deletefile="ddd/D.java"/> + <!-- compile a module that depends on that --> + <!-- this fails because if you start working with modules you commit to the modules story and classpath + becomes irrelevant --> + <compile files="module-info.java aaa/bbb/A.java" options="-1.9" outjar="module.jar" classpath="foo.jar"> + <message kind="error" text="The import ddd cannot be resolved"/> + <message kind="error" text="D cannot be resolved"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs190/modules/hhh" title="module path vs classpath 2"> + <!-- build some simple code into a jar we can depend on *not a module* --> + <file renamefrom="module-info-a.java" renameto="module-info.java"/> + <compile files="module-info.java ddd/D.java" options="-1.9" outjar="my.module.a.jar"/> + <!-- + <file renamefrom="module-info-b.java" renameto="module-info.java"/> + <compile files="module-info.java aaa/bbb/A.java" options="-1.9" outjar="my.module.b.jar" modulepath="my.module.a.jar"/> + --> + </ajc-test> + + <ajc-test dir="bugs190/modules/iii" title="compile use of java.xml.bind"> + <compile files="UsesJAXB.java" options="--add-modules java.xml.bind -1.9"/> + <run class="UsesJAXB" vmargs="--add-modules java.xml.bind"> + <stdout> + <line text="UsesJAXB.running..."/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs190/modules/iii" title="weave use of java.xml.bind"> + <compile files="UsesJAXB.java Azpect.java" options="--add-modules java.xml.bind -1.9"/> + <run class="UsesJAXB" vmargs="--add-modules java.xml.bind"> + <stdout> + <line text="UsesJAXB.running..."/> + <line text="null"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs190/modules/iii" title="limit modules 1"> + <compile files="UsesJAXB.java Azpect.java" options="--limit-modules java.xml.bind -1.9"/> + <run class="UsesJAXB" vmargs="--limit-modules java.xml.bind"> + <stdout> + <line text="UsesJAXB.running..."/> + <line text="null"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs190/modules/iii" title="add reads 1"> + <compile files="UsesJAXB.java Azpect.java" options="--add-reads java.sql=java.xml.bind --add-modules java.sql -1.9"/> + <run class="UsesJAXB" vmargs="--add-modules java.xml.bind "> + <stdout> + <line text="UsesJAXB.running..."/> + <line text="null"/> + </stdout> + </run> + </ajc-test> + + <!-- + <compile files="module-info.java aaa/bbb/A.java" options="-1.9" outjar="module.jar" aspectpath="foo.jar"/> + <compile files="module-info.java aaa/bbb/A.java" options="-1.9" outjar="my.module.jar"/> + <file deletefile="module-info.java"/> + <file deletefile="aaa"/> + <compile files="Azpect.java" outjar="azpects.jar"/> + <compile options="-showWeaveInfo" inpath="my.module.jar" aspectpath="azpects.jar" outjar="my.module.woven.jar"> + <message kind="weave" text="Join point 'method-execution(void aaa.bbb.A.main(java.lang.String[]))' in Type 'aaa.bbb.A' (A.java:4) advised by before advice from 'aspects.Azpect' (azpects.jar!Azpect.class:4(from Azpect.java))"/> + </compile> + <file deletefile="my.module.jar"/> + <run classpath="my.module.woven.jar:azpects.jar" class="aaa.bbb.A"> + <stdout> + <line text="Azpect running"/> + <line text="A running"/> + </stdout> + </run> + </ajc-test> + --> + + <ajc-test dir="bugs190/modules" title="weave module"> + <compile files="aspect1/Azpect1.java" inpath="module1/module-one.jar" outjar="runner.jar" options="-1.8"/> + <java classpath="runner.jar" class="a.b.c.Code"/> + </ajc-test> + + <ajc-test dir="bugs190/various" title="setting static final outside clinit"> + <compile files="Code.java" options="-1.9"/> + <run class="Code"> + <stdout> + <line text="call(void java.io.PrintStream.println(String))"/> + <line text="running"/> + </stdout> + </run> + </ajc-test> + + <!-- from ajc153 --> + <ajc-test dir="bugs153/pr156962" title="Test Annot Method Has Member 1"> + <compile files="Sample.java, LiftDeprecation.aj" options="-1.9 -XhasMember -showWeaveInfo -Xlint:ignore"> + <message kind="weave" text="'Sample' (Sample.java:1) is annotated with @Deprecated type annotation from 'LiftDeprecation' (LiftDeprecation.aj:2)"/> + </compile> + </ajc-test> + + <!-- from ajc153 --> + <ajc-test dir="bugs153/pr156962" title="Test Annot Method Has Member 2"> + <compile files="Sample.java, LiftDeprecation.aj" options="-1.8 -XhasMember -showWeaveInfo -Xlint:ignore"> + <message kind="weave" text="'Sample' (Sample.java:1) is annotated with @Deprecated type annotation from 'LiftDeprecation' (LiftDeprecation.aj:2)"/> + </compile> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc190/ajc190_from150.xml b/tests/src/test/java/org/aspectj/systemtest/ajc190/ajc190_from150.xml new file mode 100644 index 000000000..24d683928 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc190/ajc190_from150.xml @@ -0,0 +1,6290 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.5.0 Tests --> +<suite> + + <ajc-test dir="bugs150" title="abstract perthis in @AspectJ"> + <compile files="pr121197.aj" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150" title="different numbers of type vars"> + <compile files="pr121575.aj" options="-1.9"/> + <run class="pr121575"/> + </ajc-test> + + + <ajc-test dir="bugs150/pr121385" title="mixing aspect styles"> + <compile files="A.java" options="-1.9"/> + <run class="A"/> + </ajc-test> + + <ajc-test dir="java5/generics/tvars" title="different numbers of type vars - 2"> + <compile files="Case1.aj" options="-1.9 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void MyClass.read(java.lang.String))' in Type 'MyClass' (Case1.aj:13) advised by before advice from 'MyAspect' (Case1.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/tvars" title="different numbers of type vars - 3"> + <compile files="Case2.aj" options="-1.9 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void MyClass.read(java.lang.Number))' in Type 'MyClass' (Case2.aj:13) advised by before advice from 'MyAspect' (Case2.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/tvars" title="different numbers of type vars - 4"> + <compile files="Case3.aj" options="-1.9 -showWeaveInfo"> + <message kind="error" line="9" text="The type MyClass<T,E> must implement the inherited abstract method MyInterface<T>.read(T)"/> + </compile> + </ajc-test> + + + <ajc-test dir="bugs150" title="access to private ITD from nested type"> + <compile files="pr118698.aj"/> + <run class="pr118698"/> + </ajc-test> + + <ajc-test dir="bugs150" title="modifier overrides"> + <compile files="pr119749.aj" options="-1.9"> + <message kind="warning" line="26" text="C E.*()"/> + <message kind="warning" line="25" text="D E.*()"/> + <message kind="warning" line="17" text="aa @Me void m()"/> + <message kind="warning" line="17" text="aa void m() throws Exception"/> + <message kind="warning" line="17" text="aa * *(..) throws Exception"/> + <message kind="warning" line="37" text="aa call void m() throws Exception"/> + <message kind="warning" line="38" text="aa call void m() throws Exception"/> + </compile> + <run class="pr119749"> + <stdout> + <line text="execution(void pr119749.C.m()): execMe[Me]"/> + <line text="execution(void pr119749.C.m()): execEx"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr120826" pr="120826" title="varargs NPE"> + <compile files="TestVarargs.java" options="-1.9"/> + </ajc-test> + + + <ajc-test dir="bugs150/pr112476/case1" title="binary weaving decp broken"> + <compile files="lib/A.java,lib/B.java,lib/C.java" outjar="library.jar" options="-1.9"/> + <!-- library.jar on the aspectpath here just for resolution when compiling SuperC --> + <compile aspectpath="library.jar" files="weaved/SuperC.java" outjar="newsuper.jar" options="-1.9"/> + <compile inpath="library.jar;newsuper.jar" files="weaved/DeclareAspect.aj" options="-1.9 -showWeaveInfo"> + <message kind="weave" text="Setting superclass of type 'lib.C' (C.java) to 'weaved.SuperC' (DeclareAspect.aj)"/> + </compile> + <run class="weaved.SuperC"> + <stdout> + <line text="Is [class lib.C] subcass of [class weaved.SuperC]? true"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr114005" title="Annotated ITDFs - 1"> + <compile files="Declaration1.java" options="-1.9"/> + <run class="Declaration1"> + <stdout> + <line text="public java.lang.String Test.firstProperty has annotation:true"/> + <line text="public java.lang.String Test.secondProperty has annotation:true"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="114495" title="parameterized pointcut and advice"> + <compile files="Pr114495.aj" options="-1.9"> + <message kind="warning" line="3" text="going()"/> + </compile> + <run class="Pr114495"> + <stdout> + <line text="A.going()"/> + <line text="AA.going()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="112880" title="double parameter generic abstract type"> + <compile files="Pr112880.aj" options="-1.9"> + </compile> + <run class="Pr112880"> + <stdout> + <line text="method returning C1 or C2"/> + <line text="method returning C1 or C2"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr114005" title="Annotated ITDFs - 2"> + <compile files="Declaration2.java" options="-1.9"/> + <run class="Declaration2"> + <stdout> + <line text="public java.lang.String Test.firstProperty has annotation:true"/> + <line text="public java.lang.String Test.secondProperty has annotation:true"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="114054" title="pertarget and negated pointcut"> + <compile files="Pr114054.aj" options=""/> + <run class="Pr114054"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="121385" title="mixing styles"> + <compile files="pr121385.aj" options="-1.9"/> + </ajc-test> + + <ajc-test dir="java5/decps" title="decps - 1"> + <compile files="Basic1.java" options="-1.9"/> + <run class="Basic1"/> + </ajc-test> + + <ajc-test dir="java5/decps" title="decps - 1b"> + <compile files="Basic1b.java" options="-1.9"/> + <run class="Basic1b"/> + </ajc-test> + + <ajc-test dir="java5/decps" title="decps - 2"> + <compile files="Basic2.java" options="-1.9 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void X$I.m2())' in Type 'X' (Basic2.java:15) advised by before advice from 'X' (Basic2.java:23)"/> + <message kind="weave" text="Type 'X$I' (Basic2.java) has intertyped method from 'X' (Basic2.java:'void X$I.m2()')"/> + <message kind="weave" text="Extending interface set for type 'Basic2' (Basic2.java) to include 'X$I' (Basic2.java)"/> + <message kind="weave" text="Type 'Basic2' (Basic2.java) has intertyped method from 'X' (Basic2.java:'void X$I.m2()')"/> + <message kind="weave" text="Join point 'method-execution(void Basic2.main(java.lang.String[]))' in Type 'Basic2' (Basic2.java:2) advised by before advice from 'X' (Basic2.java:23)"/> + </compile> + <run class="Basic2"/> + </ajc-test> + + <ajc-test dir="java5/decps" title="decps - 2b"> + <compile files="Basic2b.java" options="-1.9 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void X$IIimpl.m2())' in Type 'X$IIimpl' (Basic2b.java:18) advised by before advice from 'X' (Basic2b.java:27)"/> + <message kind="weave" text="Extending interface set for type 'Basic2b' (Basic2b.java) to include 'X$I' (Basic2b.java)"/> + <message kind="weave" text="Join point 'method-execution(void Basic2b.main(java.lang.String[]))' in Type 'Basic2b' (Basic2b.java:4) advised by before advice from 'X' (Basic2b.java:27)"/> + </compile> + <run class="Basic2b"/> + </ajc-test> + + <ajc-test dir="java5/decps" title="decps - 3"> + <compile files="Basic3.java" options="-1.9 -showWeaveInfo"> + <message kind="weave" text="Extending interface set for type 'Basic3' (Basic3.java) to include 'X$I' (Basic3.java)"/> + <message kind="weave" text="Type 'Basic3' (Basic3.java) has intertyped method from 'X' (Basic3.java:'void X$I.m2()')"/> + <message kind="weave" text="Type 'Basic3' (Basic3.java) has intertyped method from 'X' (Basic3.java:'void X$I.m3()')"/> + <message kind="weave" text="Type 'Basic3' (Basic3.java) has intertyped method from 'X' (Basic3.java:'void X$I.m4()')"/> + <message kind="weave" text="Join point 'method-call(void X$I.m2())' in Type 'Basic3' (Basic3.java:7) advised by before advice from 'X' (Basic3.java:29)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m3())' in Type 'Basic3' (Basic3.java:8) advised by before advice from 'X' (Basic3.java:29)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m2())' in Type 'Basic3' (Basic3.java:9) advised by before advice from 'X' (Basic3.java:29)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m4())' in Type 'Basic3' (Basic3.java:10) advised by before advice from 'X' (Basic3.java:29)"/> + <message kind="weave" text="Type 'X$I' (Basic3.java) has intertyped method from 'X' (Basic3.java:'void X$I.m2()')"/> + <message kind="weave" text="Type 'X$I' (Basic3.java) has intertyped method from 'X' (Basic3.java:'void X$I.m3()')"/> + <message kind="weave" text="Type 'X$I' (Basic3.java) has intertyped method from 'X' (Basic3.java:'void X$I.m4()')"/> + </compile> + <run class="Basic3"/> + </ajc-test> + + <ajc-test dir="java5/decps" title="decps - 3b"> + <compile files="Basic3b.java" options="-1.9 -showWeaveInfo"> + <message kind="weave" text="Extending interface set for type 'Basic3b' (Basic3b.java) to include 'X$I' (Basic3b.java)"/> + <message kind="weave" text="Type 'Basic3b' (Basic3b.java) has intertyped method from 'X' (Basic3b.java:'void X$I.m2()')"/> + <message kind="weave" text="Type 'Basic3b' (Basic3b.java) has intertyped method from 'X' (Basic3b.java:'void X$I.m3()')"/> + <message kind="weave" text="Type 'Basic3b' (Basic3b.java) has intertyped method from 'X' (Basic3b.java:'void X$I.m4()')"/> + <message kind="weave" text="Join point 'method-call(void X$I.m2())' in Type 'Basic3b' (Basic3b.java:7) advised by before advice from 'X' (Basic3b.java:35)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m3())' in Type 'Basic3b' (Basic3b.java:8) advised by before advice from 'X' (Basic3b.java:35)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m2())' in Type 'Basic3b' (Basic3b.java:9) advised by before advice from 'X' (Basic3b.java:35)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m4())' in Type 'Basic3b' (Basic3b.java:10) advised by before advice from 'X' (Basic3b.java:35)"/> + </compile> + <run class="Basic3b"/> + </ajc-test> + + <ajc-test dir="java5/decps" title="decps - 3c"> + <compile files="Basic3c.java" options="-1.9"> + <message kind="error" text="@DeclareParents: defaultImpl="X$IImpl" has a no argument constructor, but it is of incorrect visibility"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr119570" pr="119570" title="spurious override method warning"> + <compile files="NodeImpl.java,INode.java,ParameterizedDP.java" options="-1.9"/> + <run class="bugs.ParameterizedDP"/> + </ajc-test> + + <ajc-test dir="bugs150/pr119570" pr="119570" title="spurious override method warning - 2"> + <compile files="ParameterizedDP.java,NodeImpl.java,INode.java" options="-1.9"/> + <run class="bugs.ParameterizedDP"/> + </ajc-test> + + <ajc-test dir="bugs150/pr119570" pr="119570" title="spurious override method warning - 3"> + <compile files="SimpleTest.java" options="-1.9"/> + <run class="SimpleTest"/> + </ajc-test> + + <ajc-test dir="bugs150/pr120521" pr="120521" title="named pointcut not resolved in pertarget pointcut"> + <compile files="PerTargetSubaspectError.java"/> + </ajc-test> + + <ajc-test dir="bugs150/pr119210" pr="119210" title="autoboxing around advice - 1"> + <compile files="TestLib.java,ThreadAspectLib.java" options="-1.9"/> + <run class="TestLib"> + <stderr> + <line text="obtaining five, got 3"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119210" pr="119210" title="autoboxing around advice - 2"> + <compile files="TestLib2.java,ThreadAspectLib2.java" options="-1.9"/> + <run class="TestLib2"> + <stderr> + <line text="obtaining five, got 3"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119210" pr="119210" title="autoboxing around advice - 3"> + <compile files="TestLib2.java,ThreadAspectLib2.java"> + <message kind="error" line="16" text="incompatible return type applying to method-call(java.lang.Integer TestLib2.getFive())"/> + <message kind="error" line="4" text="incompatible return type applying to method-call(java.lang.Integer TestLib2.getFive())"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr119539" pr="119539" title="generic pertypewithin aspect - 1"> + <compile files="GenericPerTypeWithin.java" options="-1.9 -showWeaveInfo"> + <message kind="weave" text="Join point 'constructor-execution(void bugs.C.<init>())' in Type 'bugs.C' (GenericPerTypeWithin.java:10) advised by before advice from 'bugs.A' (GenericPerTypeWithin.java:21)"/> + <message kind="weave" text="Join point 'constructor-execution(void bugs.C.<init>())' in Type 'bugs.C' (GenericPerTypeWithin.java:10) advised by before advice from 'bugs.A' (GenericPerTypeWithin.java:20)"/> + </compile> + <run class="bugs.GenericPerTypeWithin"/> + </ajc-test> + + <ajc-test dir="bugs150/pr119539" pr="119539" title="generic pertypewithin aspect - 2"> + <compile files="GenericPerTypeWithin2.java" options="-1.9 -showWeaveInfo"> + <message kind="error" line="24" text="a generic super-aspect must be fully parameterized in an extends clause"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr119539" pr="119539" title="generic pertypewithin aspect - 3"> + <compile files="GenericPerTypeWithin3.java" options="-1.9 -showWeaveInfo"> + <message kind="weave" text="Join point 'constructor-execution(void bugs.GenericPerTypeWithin3$C.<init>())' in Type 'bugs.GenericPerTypeWithin3$C' (GenericPerTypeWithin3.java:15) advised by before advice from 'bugs.GenericPerTypeWithin3$A' (GenericPerTypeWithin3.java:10)"/> + <message kind="warning" line="15" text="Singleton.creation()"/> + </compile> + <run class="bugs.GenericPerTypeWithin3"/> + </ajc-test> + + <ajc-test dir="bugs150/pr117854" pr="117854" title="broken switch transform"> + <compile files="BrokenSwitch.java" options=""/> + <run class="BrokenSwitch"/> + </ajc-test> + + <ajc-test dir="bugs150/pr119749" pr="119749" title="incorrect exception signature matching"> + <compile files="InheritedThrows.java" options="-showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void InheritedThrows$NestedClassBoth.m())' in Type 'InheritedThrows$NestedClassBoth' (InheritedThrows.java:24) advised by afterThrowing advice from 'InheritedThrows$A' (InheritedThrows.java:4)"/> + <message kind="weave" text="Join point 'method-execution(void InheritedThrows$NestedClass1.m())' in Type 'InheritedThrows$NestedClass1' (InheritedThrows.java:16) advised by afterThrowing advice from 'InheritedThrows$A' (InheritedThrows.java:4)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr118599" pr="118599" title="ambiguous method when binary weaving - 1"> + <!-- separate compilation was failing --> + <compile files="Attributable.java" outjar="foo.jar" options="-1.9"/> + <compile files="AnAttributedClass.java" aspectpath="foo.jar" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150/pr118599" pr="118599" title="ambiguous method when binary weaving - 2"> + <!-- complete compilation works --> + <compile files="Attributable.java,AnAttributedClass.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="104220" title="adviceexecution join point toString forms"> + <compile files="Pr104220.aj"/> + <run class="Pr104220"> + <stdout> + <line text="adviceexecution"/> + <line text="adviceexecution(void SomeAspect.before())"/> + <line text="adviceexecution(SomeAspect.before())"/> + <line text="adviceexecution(void SomeAspect.before())"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="112756" title="pointcut expression containing 'assert'"> + <compile files="Pr112756.aj" options="-warn:assertIdentifier -Xdev:Pinpoint"/> + </ajc-test> + + <ajc-test dir="bugs150/pr118781" pr="118781" title="verify error with around advice array sigs"> + <compile files="MyMain.java,MyAspect.java,MyClass.java" options="-XnoInline"/> + <run class="blah.MyMain"/> + </ajc-test> + + <ajc-test dir="bugs150/pr117681" pr="117681" title="at declare parents"> + <compile files="Test.java,TestAspect.java,Audit.java,AuditImpl.java" options="-1.9"/> + <run class="Test"/> + </ajc-test> + + <ajc-test dir="bugs150/pr120474" pr="120474" title="Dollar classes"> + <compile files="$ProxyPr120474.java"/> + <compile files="X.aj" options="-outxml"/> + <run class="$ProxyPr120474" ltw="aop.xml"> + <stdout> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr111667" pr="111667" title="lint for advice sorting"> + <compile files="A.java,X.java,Y.java" options="-1.9 -Xlint:warning"> + <message kind="warning" line="9" text="at this shadow method-execution(void A.m1()) no precedence is specified between advice applying from aspect X and aspect Y [Xlint:unorderedAdviceAtShadow]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr118326" pr="118326" title="illegal initialization - 1"> + <compile files="Foo.java,Bar.java"> + <message kind="error" line="2" text="Type mismatch: cannot convert from null to int"/> + <message kind="error" line="6" text="Type mismatch: cannot convert from Integer to int"/> + <message kind="error" line="8" text="Type mismatch: cannot convert from String to int"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr118326" pr="118326" title="illegal initialization - 2"> + <compile files="Foo.java,Bar.java" options="-1.9"> + <message kind="error" line="2" text="Type mismatch: cannot convert from null to int"/> + <message kind="error" line="8" text="Type mismatch: cannot convert from String to int"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr117296" pr="117296" title="self bounding generic types"> + <compile files="PropertySupport.java" options="-1.9"/> + <run class="PropertySupport"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="113368" title="thisJoinPointStaticPart in if test"> + <compile files="Pr113368.aj"/> + <run class="Pr113368"> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr87525" pr="87525" title="privilege problem with switch"> + <compile files="A.java,B.java"> + <message kind="error" line="5" text="Fields accessible due to an aspect being privileged can not be used in switch statements"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/reflection" title="pointcut parsing with ajc compiled pointcut references"> + <compile files="PointcutLibrary.aj,ReflectOnAjcCompiledPointcuts.java" options="-1.9"></compile> + <run class="ReflectOnAjcCompiledPointcuts" classpath="../lib/bcel/bcel.jar"/> + </ajc-test> + + <ajc-test dir="java5/reflection" title="reflection on itds"> + <compile files="InterTypeDeclarations.aj,ReflectOnCodeStyleITDs.java" options="-1.9 -Xlint:ignore -makeAjReflectable"></compile> + <run class="ReflectOnCodeStyleITDs" classpath="../lib/bcel/bcel.jar"> + <stdout> + <line text="public C.new(int, int, int)"/> + <line text="C.new(int, int)"/> + <line text="private C.new(int)"/> + <line text="private C.new(int)"/> + <line text="public C.new(int, int, int)"/> + <line text="public C.new(int, int, int)"/> + <line text="int C.getY()"/> + <line text="int I.getY()"/> + <line text="public int C.getZ()"/> + <line text="public int I.getZ()"/> + <line text="private int C.getX()"/> + <line text="private int I.getX()"/> + <line text="private int C.getX()"/> + <line text="public int C.getZ()"/> + <line text="public int I.getZ()"/> + <line text="public int C.getZ()"/> + <line text="int C.y"/> + <line text="int I.y"/> + <line text="public int C.z"/> + <line text="public int I.z"/> + <line text="private int C.x"/> + <line text="private int I.x"/> + <line text="private int C.x"/> + <line text="public int C.z"/> + <line text="public int I.z"/> + <line text="public int C.z"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/reflection" title="reflection on @DeclareParents"> + <compile files="AtAspectJDeclareParents.aj,ReflectOnAtAspectJDeclareParents.java" options="-1.9 -Xlint:ignore"></compile> + <run class="ReflectOnAtAspectJDeclareParents" classpath="../lib/bcel/bcel.jar"> + <stdout> + <line text="declare parents : C implements I"/> + <line text="public int I.getX()"/> + <line text="public void I.setX(int)"/> + <line text="public int I.getX()"/> + <line text="public int I.getX()"/> + <line text="public void I.setX(int)"/> + <line text="public int I.getX()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="compatibility/case1" title="generating code for a 1.2.1 runtime - 1"> + <compile files="Simple.java" options="-Xajruntimetarget:1.2"/> + <run class="Simple" classpath="../lib/aspectj/lib/aspectjrt121.jar"/> + </ajc-test> + + <ajc-test dir="compatibility/case2" title="generating code for a 1.2.1 runtime - 2"> + <compile files="TrackingErrors.aj,A.java" options="-Xajruntimetarget:1.2 -Xlint:ignore"/> + <run class="A" classpath="../lib/aspectj/lib/aspectjrt121.jar"/> + </ajc-test> + + <ajc-test dir="java5/reflection" title="arg names in advice annotations"> + <compile files="AdviceWithArgs.aj" options="-1.9"></compile> + <run class="AdviceWithArgs"/> + </ajc-test> + + + <ajc-test dir="java5/reflection" pr="114322" title="reflection on abstract ITDs (Billing example)"> + <compile files="ReflectBilling.java,Billing.aj" options="-1.9 -makeAjReflectable"/> + <run class="ReflectBilling"> + <stdout> + <line text="public void Customer.addCharge(long)"/> + <line text="public long Local.callRate()"/> + <line text="public long LongDistance.callRate()"/> + <line text="public abstract long Connection.callRate()"/> + <line text="public Customer Connection.payer"/> + <line text="public long Customer.totalCharge"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="103157" title="returning(Object) binding"> + <compile files="Pr103157.aj"/> + <run class="Pr103157"> + <stdout> + <line text="returning from staticinit"/> + <line text="returning from preinit"/> + <line text="returning from set"/> + <line text="returning from cons exe"/> + <line text="returning from init"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" title="declare soft and adviceexecution" pr="103051"> + <compile files="Pr103051.aj" options="-Xdev:Pinpoint"/> + </ajc-test> + + <ajc-test dir="bugs150" title="declare soft and exclusions" pr="103097"> + <compile files="Pr103097.aj" options="-Xlint:ignore"/> + <run class="Pr103097"/> + </ajc-test> + + + <ajc-test dir="bugs150" title="Range problem"> + <compile files="pr109614.java"/> + <run class="pr109614"/> + </ajc-test> + + <ajc-test dir="bugs150/pr114436" title="ClassFormatError binary weaving perthis"> + <compile files="SimpleTrace.aj,ConcreteSimpleTracing.aj" outjar="aspects.jar"/> + <compile files="TestClass.java" aspectpath="aspects.jar"/> + <run class="TestClass"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113066" title="possible static imports bug - 1"> + <compile files="Consts.java,TestNPE.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150" title="parameterized type and around advice"> + <compile files="pr115250.aj" options="-1.9 -Xlint:ignore"> + <!-- this first error happens twice, once for each piece of around advice --> + <message kind="error" line="10" text="incompatible return type applying to constructor-execution(void pr115250$C.<init>())"/> + <message kind="error" line="17" text="incompatible return type applying to constructor-execution(void pr115250$C.<init>())"/> + <message kind="error" line="27" text="incompatible return type applying to constructor-execution(void pr115250$C.<init>())"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="parameterized type and around advice - 2"> + <compile files="pr115250_2.aj" options="-1.9 -Xlint:ignore -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(pr115250_2$C pr115250_2$C.foo())' in Type 'pr115250_2$C' (pr115250_2.aj:7) advised by around advice from 'pr115250_2$A' (pr115250_2.aj:22)"/> + <message kind="weave" text="Join point 'method-execution(pr115250_2$C pr115250_2$C.foo())' in Type 'pr115250_2$C' (pr115250_2.aj:7) advised by around advice from 'pr115250_2$Normal' (pr115250_2.aj:12)"/> + </compile> + <run class="pr115250_2"> + <stderr> + <line text="funky advice running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr115788" title="parser exception"> + <compile files="AAA.java"> + <message kind="warning" line="3" text="no match for this type name: Screen"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr113066" title="possible static imports bug - 2"> + <compile files="Consts2.java,TestNPE2.java" options="-1.9"> + <message kind="error" line="2" text="The field Consts2.a.Consts2.A_CONST is not visible"/> + <!-- message has changed with 3.3 compiler upgrade, it used to be this: --> + <!-- message kind="error" line="2" text="The import a.Consts2.A_CONST cannot be resolved"/--> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr113066" title="possible static imports bug - 3"> + <compile files="Consts3.java,TestNPE3.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="java5/staticImports" title="import static java.lang.System.out"> + <compile files="StaticImport.aj" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150" title="Problem with constructor ITDs"> + <compile files="pr112783.aj" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150" title="NPE in ensureScopeSetup"> + <compile files="pr115038.aj" options="-1.9"> + <message kind="error" line="2" text="Cannot make inter-type declarations on type variables"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="ITDC with no explicit cons call"> + <compile files="Pr62606.aj" options="-1.9"> + <message kind="warning" line="6" text="[Xlint:noExplicitConstructorCall]"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/bugs" title="using same type variable in ITD"> + <compile files="SameTypeVariable.aj" options="-1.9"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="capturebinding wildcard problem"> + <compile files="pr114744.aj" options="-1.9"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="Anonymous types and nome matching"> + <compile files="Pr73050.aj" outjar="jar1.jar"> + <message kind="warning" line="16" text="anonymous types should be matched by a * wild card"/> + </compile> + <compile inpath="jar1.jar"> + <message kind="warning" line="0" text="anonymous types should be matched by a * wild card"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr86903" title="bcelrenderer bad"> + <compile files="GenericService.java,Service.java,Main.java,BadWormhole.java"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="bugs150/pr114343" title="field-get, generics and around advice"> + <compile files="Test.java,Test1.java,Test2.java,TestAspect.aj" options="-1.9"> + <message kind="warning" line="7" text="unchecked conversion when advice applied at shadow field-get(java.util.Set Test1.intsSet), expected java.util.Set<java.lang.Integer> but advice uses java.util.Set"/> + <message kind="warning" line="8" text="unchecked conversion when advice applied at shadow field-get(java.util.Set Test2.doubSet), expected java.util.Set<java.lang.Double> but advice uses java.util.Set"/> + </compile> + <run class="TestAspect"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113947/case1" title="maws generic aspect - 1"> + <compile files="AbstractListSupport.java,AnotherItem.java,Item.java,LinkedList.java,LinkedListItem.java,ListItem.java,StringList.java" options="-1.9"> + <message kind="error" line="6" text="Cannot make inter-type declarations on type variables"/> + <message kind="error" line="8" text="Cannot make inter-type declarations on type variables"/> + <message kind="error" line="12" text="Cannot make inter-type declarations on type variables"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="aspectOf and generic aspects"> + <compile files="pr115237.aj" options="-1.9"/> + <run class="pr115237"/> + </ajc-test> + + <ajc-test dir="bugs150/pr114343/case2" title="field-get, generics and around advice - 2"> + <compile files="Test.java,TTT.java,TestAspect.java" options="-1.9"/> + <run class="TestAspect"> + <stderr> + <line text="TestAspect.main: Calling foo"/> + <line text="Creating Test<Integer> instance"/> + <line text="Calling toArray"/> + <line text="In around advice"/> + <line text="In toArray()"/> + <line text="done"/> + <line text="TestAspect.main: done"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr114343/case3" title="field-get, generics and around advice - 3"> + <compile files="Test.java,TTT.java,TestAspect.java" options="-1.9"/> + <run class="TestAspect"> + <stderr> + <line text="TestAspect.main: Calling foo"/> + <line text="Creating Test<Integer> instance"/> + <line text="Calling toArray"/> + <line text="In around advice"/> + <line text="In toArray()"/> + <line text="done"/> + <line text="Creating Test<Integer> instance"/> + <line text="Calling getFirst"/> + <line text="around on getFirstExec(): running"/> + <line text="done"/> + <line text="TestAspect.main: done"/> + </stderr> + </run> + </ajc-test> + + + <ajc-test dir="bugs150/pr113947/case2" title="maws generic aspect - 2"> + <compile files="AbstractListSupport.java,AnotherItem.java,Item.java,LinkedList.java,LinkedListItem.java,ListItem.java,StringList.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113861" title="field-get problems with generic field"> + <compile files="Test.java,TestAspect.java" options="-1.9"/> + <run class="com.Test"/> + </ajc-test> + + + <ajc-test dir="bugs150/pr99191" title="declare annotation on non existent type - 1"> + <compile files="pr99191_1.java" options="-1.9"> + <message kind="error" line="4" text="The field 'int C.noSuchField' does not exist"/> + <message kind="error" line="5" text="The field 'int B.noSuchField' does not exist"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/bugs/lists/case1" title="generics and ITD overrides - 1"> + <compile files="Identifiable.java,Bean.java,LongIdentifiable.java,IdentifiableAspect.java" options="-1.9"> + </compile> + <run class="IdentifiableAspect"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs/lists/case2" title="generics and ITD overrides - 2"> + <compile files="Identifiable.java,Bean.java,LongIdentifiable.java,IdentifiableAspect.java" options="-1.9"> + </compile> + <run class="IdentifiableAspect"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs/lists/case3" title="generics and ITD overrides - 3"> + <compile files="Identifiable.java,Bean.java,LongIdentifiable.java,IdentifiableAspect.java" options="-1.9"> + </compile> + <run class="IdentifiableAspect"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs/lists/case4" title="generics and ITD overrides - 4"> + <compile files="Identifiable.java,Bean.java,LongIdentifiable.java,IdentifiableAspect.java" options="-1.9"> + </compile> + <run class="IdentifiableAspect"/> + </ajc-test> + + <!-- Currently a warning doesn't occur if the annotation is already on the field + (see bug 113029). If this is fixed, need to add check for this warning to this + test as in test "declare annotation on non existent type - 4" --> + <ajc-test dir="bugs150/pr99191" title="declare annotation on non existent type - 2"> + <compile files="pr99191_2.java" options="-1.9"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr99191" title="declare annotation on non existent type - 3"> + <compile files="pr99191_3.java" options="-1.9"> + <message kind="error" line="4" text="The method 'public * C.noSuchMethod(..)' does not exist"/> + <message kind="error" line="5" text="The method '* B.noSuchMethod(..)' does not exist"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr99191" title="declare annotation on non existent type - 4"> + <compile files="pr99191_4.java" options="-1.9"> + <message kind="warning" text="void C.amethod() - already has an annotation of type Annotation, cannot add a second instance [Xlint:elementAlreadyAnnotated]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr99191" title="declare annotation on non existent type - 5"> + <compile files="pr99191_5.java" options="-1.9"> + <message kind="error" line="4" text="The method 'C.new(java.lang.String)' does not exist"/> + <message kind="error" line="5" text="The method 'B.new(int)' does not exist"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr99191" title="declare annotation on non existent type - 6"> + <compile files="pr99191_6.java" options="-1.9"> + <message kind="warning" text="void C.<init>(int) - already has an annotation of type Annotation, cannot add a second instance [Xlint:elementAlreadyAnnotated]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr113630/case1" title="IncompatibleClassChangeError - errorscenario"> + <compile files="Bean.java,BeanTestCase.java,javaBean.java,propertyChanger.java,PropertySupportAspect5.aj" options="-1.9"> + <message kind="warning" line="9" text="Failing match because annotation 'javaBean' on type 'Bean' has SOURCE retention. Matching allowed when RetentionPolicy is CLASS or RUNTIME"/> + <message kind="error" line="18" text="The method addPropertyChangeListener(String, BeanTestCase) is undefined for the type Bean"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr113630/case2" title="IncompatibleClassChangeError - workingscenario"> + <compile files="Bean.java,BeanTestCase.java,javaBean.java,propertyChanger.java,PropertySupportAspect5.aj" options="-1.9"/> + <run class="BeanTestCase"/> + </ajc-test> + + <ajc-test dir="bugs150" title="Generics ClassCastException"> + <compile files="pr113445.aj" options="-1.9,-emacssym"/> + </ajc-test> + + <ajc-test dir="bugs150" title="test illegal change to pointcut declaration"> + <compile files="pr111915.java" options="-1.9 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void SomeClass.doSomething())' in Type 'SomeClass' (pr111915.java:4) advised by around advice from 'DoesntCompile' (pr111915.java:15)"/> + <message kind="weave" text="Extending interface set for type 'SomeClass' (pr111915.java) to include 'java.io.Serializable' (pr111915.java)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/bridgeMethods" pr="72766" title="Ignore bridge methods"> + <compile files="AspectX.aj" inpath="testcode.jar" options="-showWeaveInfo"> + <!-- <message kind="warning" line="7" text="pointcut did not match on the method call to a bridge method."/> + <message kind="warning" line="7" text="does not match because declaring type is Number"/>--> + <message kind="weave" text="(AspectX.aj:18) advised by before advice from 'AspectX'"/> + <message kind="weave" text="(AspectX.aj:19) advised by before advice from 'AspectX'"/> + <message kind="weave" text="(Number.java:5) advised by before advice from 'AspectX'"/> + </compile> + </ajc-test> + + <ajc-test title="intermediate annotation matching" dir="bugs150"> + <compile files="AnnotationPlusPatternMatchingError.aj" options="-1.9"> + <message kind="warning" line="28" text="matched"/> + </compile> + <run class="AnnotationPlusPatternMatchingError"> + <stdout> + <line text="In advice"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="migration" title="load aspectj 1.2.1 aspects in aspectj 5"> + <compile files="Program.java" aspectpath="aspects121.jar"> + </compile> + <run class="Program"/> + </ajc-test> + + <ajc-test dir="bugs/java5/arrayCloning" pr="72150" vm="1.5" + title="AJC possible bug with static nested classes"> + <compile files="A.java,C.java" options="-1.9,-showWeaveInfo"> + <message kind="weave" text="Type 'C' (C.java:14) advised by around advice from 'A' (A.java:2)"/> + </compile> + <run class="C"/> + </ajc-test> + + <ajc-test dir="java5/pseudoKeywords" + title="method called around in class"> + <compile files="MethodCalledAround.java"> + </compile> + </ajc-test> + + <ajc-test dir="java5/pseudoKeywords" + title="method called around in aspect"> + <compile files="MethodCalledAroundAspect.java"> + <message kind="error" line="2"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="64568" title="clear error message on itd with type pattern"> + <compile files="pr64568.aj"> + <message line="4" kind="error" text="Syntax error on token "*", delete this token"/> + <message line="4" kind="error" text="foo cannot be resolved to a type"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="74562" title="before and after are valid identifiers in classes"> + <compile files="pr74562.aj"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="107486" title="anonymous inner classes"> + <compile files="pr107486.aj"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="102210" title="NullPointerException trying to compile"> + <compile files="PR102210.java"/> + <run class="PR102210"> + <stderr> + <line text="List size is 1"/> + <line text="m1 running"/> + <line text="List size is 2"/> + <line text="m2 running"/> + <line text="List size is 3"/> + <line text="m3 running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="107486" title="multiple anonymous inner classes"> + <compile files="pr107486part2.aj"> + </compile> + <run class="pr107486part2"> + <stdout> + <line text="[advised] f"/> + <line text="[advised] g"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/compliance" title="java 5 pointcuts and declares at pre-java 5 compliance levels"> + <compile files="AJ5FeaturesAtJ14.aj" options="-1.4"> + <message kind="error" line="3" text="the @annotation pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="11" text="the @within pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="13" text="the @withincode pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="5" text="the @this pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="7" text="the @target pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="9" text="the @args pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="15" text="declare @type is only supported at Java 5 compliance level or above"/> + <message kind="error" line="15" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="15" text="cannot convert from Foo to Annotation"/> + <message kind="error" line="17" text="declare @method is only supported at Java 5 compliance level or above"/> + <message kind="error" line="17" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="17" text="cannot convert from Foo to Annotation"/> + <message kind="error" line="19" text="declare @field is only supported at Java 5 compliance level or above"/> + <message kind="error" line="19" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="19" text="cannot convert from Foo to Annotation"/> + <message kind="error" line="21" text="declare @constructor is only supported at Java 5 compliance level or above"/> + <message kind="error" line="21" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="21" text="cannot convert from Foo to Annotation"/> + <message kind="error" line="25" text="annotation type patterns are only supported at Java 5 compliance level or above"/> + <message kind="error" line="27" text="annotation type patterns are only supported at Java 5 compliance level or above"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/compliance" title="java 5 pointcuts and declares at pre-java 5 compliance levels - 1.7"> + <compile files="AJ5FeaturesAtJ14.aj" options="-1.4"> + <message kind="error" line="3" text="the @annotation pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="11" text="the @within pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="13" text="the @withincode pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="5" text="the @this pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="7" text="the @target pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="9" text="the @args pointcut expression is only supported at Java 5 compliance level or above"/> + <message kind="error" line="15" text="declare @type is only supported at Java 5 compliance level or above"/> + <message kind="error" line="15" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="15" text="Foo is not an annotation type"/> + <message kind="error" line="17" text="declare @method is only supported at Java 5 compliance level or above"/> + <message kind="error" line="17" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="17" text="Foo is not an annotation type"/> + <message kind="error" line="19" text="declare @field is only supported at Java 5 compliance level or above"/> + <message kind="error" line="19" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="19" text="Foo is not an annotation type"/> + <message kind="error" line="21" text="declare @constructor is only supported at Java 5 compliance level or above"/> + <message kind="error" line="21" text="annotations are only available if source level is 1.5 or greater"/> + <message kind="error" line="21" text="Foo is not an annotation type"/> + <message kind="error" line="25" text="annotation type patterns are only supported at Java 5 compliance level or above"/> + <message kind="error" line="27" text="annotation type patterns are only supported at Java 5 compliance level or above"/> + </compile> + </ajc-test> + + + <ajc-test dir="bugs150" pr="91114" title="before and after are valid identifiers in classes, part 2"> + <compile files="pr91114.aj"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="78621" title="void field type in pointcut expression"> + <compile files="pr78261.aj"> + <message line="3" kind="error" text="fields cannot have a void type"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="86057" title="overriding final pointcut from super-aspect"> + <compile files="pr86057.aj"> + <message line="9" kind="error" text="can't override final pointcut Base.foo()"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="78707" title="before returning advice not allowed!"> + <compile files="pr78707.aj"> + <message line="3" kind="error" text="Syntax error on token "returning", delete this token"/> + <message line="3" kind="error" text="Syntax error on token "throwing", delete this token"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="104529" title="@SuppressWarnings should suppress"> + <compile files="pr104529.aj" options = "-1.9 -warn:+unchecked"> + <message line="11" kind="warning" text="needs unchecked conversion"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="79523" title="declare warning : foo(str) : ...;"> + <compile files="pr79523.aj"> + <message line="4" kind="warning" text="no match for this type name: str"/> + <message line="4" kind="error" text="bad parameter"/> + <message line="4" kind="error" text="args() pointcut designator cannot be used in declare statement"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="107059" title="parser crashes on call(void (@a *)(..)"> + <compile files="pr107059.aj"> + <message line="3" kind="error" text="Syntax error on token "(", "name pattern" expected"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="107059" title="target(@Foo *)"> + <compile files="pr107059_2.aj" options="-1.9"> + <message kind="error" line="4" text="wildcard type pattern not allowed"></message> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="varargs with type variable"> + <compile files="ParameterizedVarArgMatch.aj" options="-1.9"> + </compile> + </ajc-test> + + + <ajc-test dir="bugs150" pr="108104" title="multiple anonymous inner classes 2"> + <compile files="pr108104.aj" options="-1.9"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="108050" title="signature matching in override scenario"> + <compile files="pr108050.aj" options="-1.9"> + <message kind="warning" line = "2" text="servlet request"></message> + <message kind="warning" line = "7" text="servlet request"></message> + <message kind="warning" line = "21" text="servlet request"></message> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr108425" pr="108245" title="wildcard annotation matching - pr108245"> + <compile files="package1/Bean.java,package2/Bean.java,package2/propertyChanger.java,package3/pr108425.aj" options="-1.9 -Xlint:ignore"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/" pr="108104" title="inner types and type variables"> + <compile files="ShapeCommandMap.java" options="-1.9"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/" pr="107953" title="@AfterThrowing with no formal specified"> + <compile files="pr107953.java" options="-1.9"> + <message kind="error" line="8" text="throwing formal 'RuntimeException' must be declared as a parameter in the advice signature"></message> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr106130" pr="106130" title="test weaving with > 256 locals"> + <compile files="AroundLotsOfVars.java LotsOfVars.java" options="-preserveAllLocals"/> + <run class="LotsOfVars"> + <stdout> + <line text="hello"/> + <line text="2"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr87376" title="structure model npe on type not found"> + <compile files="I.java,NPE.aj" options="-emacssym"> + <message kind="error" line="8" text="I cannot be resolved to a type"/> + <message kind="error" line="10" text="I cannot be resolved to a type"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="83311" title="overriding/polymorphism error on interface method introduction"> + <compile files="pr83311.aj"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="103266" title="NPE on syntax error"> + <compile files="pr103266.aj"> + <message kind="error" line="41" text="ConnectionRequestContext cannot be resolved to a type"/> + <!-- this next message is new in e37 --> + <message kind="error" line="41" text="Type mismatch: cannot convert from new ConnectionRequestContext(){} to WorkerExample.RequestContext"/> + </compile> + </ajc-test> + + <ajc-test title="itd override with no exception clause" dir="bugs150"> + <compile files="pr83377.aj"></compile> + </ajc-test> + + <ajc-test dir="bugs150/pr84260" vm="1.5" title="static import failures"> + <compile files="A.java,I1.java,I2.java" options="-1.9"/> + <run class="I1"> + <stderr> + <line text="static method running"/> + </stderr> + </run> + <run class="I2"> + <stderr> + <line text="static method running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test title="anonymous inner class with method returning type parameter" pr="107898" dir="bugs150"> + <compile files="pr107898.aj" options="-1.9"></compile> + </ajc-test> + + <ajc-test title="matching against Object[]" pr="72668" dir="bugs150"> + <compile files="pr72668.aj" options="-1.9"> + <message kind="error" line="3" text="incompatible return type applying to method-execution(java.lang.Number[] pr72668.getThoseInts())"></message> + <message kind="error" line="10" text="incompatible return type applying to method-execution(java.lang.Number[] pr72668.getThoseInts())"></message> + </compile> + </ajc-test> + + <ajc-test dir="decp" pr="80249" title="Order of types passed to compiler determines weaving behavior"> + <compile files="A.java,B.java,AspectX.java"/> + <run class="B"/> + <compile files="B.java,A.java,AspectX.java"/> + <run class="B"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="99228" vm="1.5" title="ITD of a field into a generic class"> + <compile files="PR99228.aj" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="98320" vm="1.5" title="intertype with nested generic type"> + <compile files="PR98320.aj" options="-1.9"/> + </ajc-test> + + <ajc-test dir="decs" pr="42743" title="declare soft of runtime exception"> + <compile files="DeclareSoftRuntimeException.aj"> + <message kind="warning" line="3" text="MyRuntimeException will not be softened as it is already a RuntimeException"/> + </compile> + <run class="DeclareSoftRuntimeException"> + <stdout> + <line text="MyRuntimeException"/> + <line text="org.aspectj.lang.SoftException"/> + <line text="MyRuntimeException"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="decs" pr="42743" title="declare soft w. catch block"> + <compile files="VerifyError.aj" options="-Xlint:ignore"> + </compile> + <run class="VerifyError"/> + </ajc-test> + + <ajc-test dir="bugs" pr="61568" title="Various kinds of ambiguous bindings"> + <compile files="AmbiguousBindings.aj"> + <message line="17" text="ambiguous binding of parameter(s) foo across '||' in pointcut"></message> + <message line="19" text="ambiguous binding of parameter(s) foo across '||' in pointcut"></message> + <message line="21" text="ambiguous binding of parameter(s) foo across '||' in pointcut"></message> + <message line="23" text="ambiguous binding of parameter(s) x across '||' in pointcut"></message> + <message line="25" text="ambiguous binding of parameter(s) foo across '||' in pointcut"></message> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="61658" title="ambiguous args"> + <compile files="PR61658.java"> + <message line="17" text="ambiguous binding of parameter(s) a, b across '||' in pointcut"></message> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="78021" title="Injecting exception into while loop with break statement causes catch block to be ignored"> + <compile files="PR78021.java"/> + <run class="PR78021"/> + </ajc-test> + + <ajc-test dir="bugs150/pr99089" vm="1.5" pr="99089" title="ArrayIndexOutOfBoundsException - Generics in privileged aspects"> + <compile files="DataClass.java,TracingAspect.java" options="-1.9"/> + <run class="DataClass"> + <stderr> + <line text="before:Length of v=1"/> + <line text="after:Length of v=2"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="79554" title="Return in try-block disables catch-block if final-block is present"> + <compile files="PR79554.java"/> + <run class="PR79554"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="82570" title="Weaved code does not include debug lines"> + <compile files="PR82570_1.java"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="83303" title="compiler error when mixing inheritance, overriding and polymorphism"> + <compile files="PR83303.java"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="83563" title="pertypewithin() handing of inner classes (1)"> + <compile files="PR83563_1.java"/> + <run class="PR83563_1"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="83563" title="pertypewithin() handing of inner classes (2)"> + <compile files="PR83563_2.java"/> + <run class="PR83563_2"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="83645" title="pertypewithin({interface}) illegal field modifier"> + <compile files="PR83645.java" options="-Xlint:ignore"/> + <run class="PR83645"/> + </ajc-test> + + <ajc-test dir="bugs150" title="bad asm for enums" vm="1.5"> + <compile files="Rainbow.java" options="-emacssym,-1.9,-Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="10461" title="missing name pattern"> + <compile files="PR106461.aj"> + <message kind="error" line="3" text="Syntax error on token "(", "name pattern" expected"/> + <message kind="error" line="5" text="Syntax error on token ")", "name pattern" expected"/> + <message kind="error" line="7" text="Syntax error on token ".", "name pattern" expected"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="106634" title="IllegalStateException unpacking signature of nested parameterized type"> + <compile files="pr106634.aj" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150" title="(@Foo *)+ type pattern parse error"> + <compile files="AnnotationPlusPatternParseError.aj" options="-1.9"/> + <!-- next line needs the change for inherited anno matching... --> + <!--compile files="AnnotationPlusPatternParseError.aj" options="-1.9"> + <message kind="warning" line="19"/> + </compile--> + </ajc-test> + + <ajc-test dir="bugs150" pr="80571" title="around advice on interface initializer"> + <compile files="pr80571.aj"> + <message kind="warning" text="The joinpoint 'constructor-call(void pr80571.<init>())' cannot be advised"/> + </compile> + <run class="pr80571"> + <stdout> + <line text="before"/> + <line text="after"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="78314" title="good error message for unmatched member syntax"> + <compile files="pr78314.aj" options="-1.9"> + <message kind="error" line="5" text="Syntax error on token "foo", no accurate correction available"/> + </compile> + <compile files="pr78314.aj"> + <message kind="error" line="5" text="Syntax error on token "foo", no accurate correction available"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="108377" title="itd field access inside itd method"> + <compile files="pr108377.aj"/> + <run class="pr108377"/> + </ajc-test> + + <ajc-test dir="bugs150/pr108054" pr="108054" title="type variable with type variable bound"> + <compile files="pr108054.aj" options="-1.9"/> + <compile files="ISequence.java,ICounter.java,ASequence.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150/pr108370" pr="108370" title="switch on enum inside ITD method"> + <compile files="et/Q.java" options="-1.9"/> + <compile files="EnumTest.aj" options="-1.9 -inpath et"/> + <run class="EnumTest"> + <stdout> + <line text="B!"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="95992" title="inner type of generic interface reference from parameterized type"> + <compile files="pr95992.aj" options="-1.9"/> + </ajc-test> + + + <ajc-test dir="bugs150" pr="104024" title="inner class passed as argument to varargs method"> + <compile files="pr104024.aj" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="107858" title="inlined field access in proceed call"> + <compile files="pr107858.aj" options="-1.9"> + <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> + + <ajc-test dir="bugs150/pr71159" pr="71159" title="visibility in signature matching with overrides - 1"> + <compile files="pr71159.aj"> + <message kind="warning" line="26" text="should match"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr71159" pr="71159" title="visibility in signature matching with overrides - 2"> + <compile files="PrivateITD.aj"> + <message kind="warning" line="28" text="should match"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr71159" pr="71159" title="visibility in signature matching with overrides - 3"> + <compile files="pkg1/A.java,pkg1/B.java,pkg1/C.java,pkg2/ITDInDiffPackage.aj"> + <message kind="warning" line="10" text="should match"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="59196" title="args generated correctly for advice execution join point"> + <compile files="pr59196.aj" options="-XnoInline -1.9"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="74048" title="no unused warnings on aspect types"> + <compile files="pr74048.aj" options="-warn:unusedPrivate"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="59397" title="synthetic arguments on itd cons are not used in matching"> + <compile files="pr59397.aj"> + <message line="6" kind="warning" text="should match"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="108602" title="parse generic type signature with parameterized type in interface"> + <compile files="pr108602.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="105479" title="declare parents introducing override with covariance"> + <compile files="pr105479.aj" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="105479" title="override and covariance with decp - runtime"> + <compile files="pr105479part2.aj" options="-1.9"/> + <run class="pr105479part2"> + <stdout> + <line text="in Test.hashCode()"/> + <line text="in Test.hashCode()"/> + <line text="id"/> + <line text="in Test.hashCode()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr105479/case1" pr="105479" title="override and covariance with decp - runtime separate files"> + <compile files="ReturnTypeTest.aj,ReturnTypeTester.java,Driver.java" options="-1.9"/> + <run class="Driver"> + <stdout> + <line text="in Test.hashCode()"/> + <line text="in Test.hashCode()"/> + <line text="id"/> + <line text="in Test.hashCode()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr105479/case2" pr="105479" title="override and covariance with decp - binary weaving"> + <compile files="ReturnTypeTest.java" outjar="jar1.jar" options="-1.9 -Xlint:ignore"/> + <compile files="ReturnTypeTester.java" outjar="jar2.jar" options="-1.9"/> + <compile inpath="jar1.jar;jar2.jar" options="-1.9"/> + <run class="ReturnTypeTester"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="102212" title="abstract synchronized itdms not detected"> + <compile files="pr102212.aj"> + <message line="7" kind="error" text="The abstract method _abstract in type Parent can only set a visibility modifier, one of public or protected"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="102212" title="synchronized itd interface methods"> + <compile files="SynchronizedInterfaceMethods.aj" options="-1.9"> + </compile> + <run class="SynchronizedInterfaceMethods"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="101606" title="unused private pointcuts"> + <compile files="pr101606.aj" options="-warn:unusedPrivate"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr99125" pr="99125" title="itd interface method already existing on interface"> + <compile files="p/pr99125.aj,p/I.java,p/J.java" options="-1.9"> + </compile> + <compile files="Aspects.aj" options="-inpath p"/> + <run class="p.pr99125"/> + <compile files="p2/pr99125.aj,p/I.java,p/J.java"/> <!-- actually in package p, introduces incompatible change --> + <compile files="Aspects.aj" options="-inpath p"> + <message kind="error" line="7" text="inter-type declaration from X conflicts with existing member"/> + <!-- 275032 - new error at affected member location too --> + <message kind="error" line="10" text="inter-type declaration from X conflicts with existing member"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr87530" pr="87530" title="final itd methods on interfaces"> + <compile files="FinalITDMOnInterface.aj"> + <message kind="error" line="12" text="Cannot override the final method from A.TestInterface"></message> + </compile> + <compile files="FinalITDMOnInterface2.aj"> + <!--message kind="error" line="8" text="Cannot override the final method from A.TestInterface"></message--> + <message kind="error" line="8" text="can't override final void A$TestInterface.m()"></message> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="108818" title="can't override private pointcut in abstract aspect"> + <compile files="PrivatePointcutOverriding.aj"> + <message kind="warning" line="19" text="matched join point from super advice"/> + <message kind="warning" line="21" text="matched join point from sub advice"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="108816" title="advising cflow advice execution"> + <compile files="pr108816.aj" > + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr108902" pr="108902" title="no type mismatch on generic types in itds"> + <compile files="Subject.java,Observer.java,ObserverProtocol.aj" > + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="108903" title="super call in ITD"> + <compile files="pr108903.aj" > + <message kind="error" line="14" text="The method print() is undefined for the type Object"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="109042" title="no unused parameter warnings for synthetic advice args"> + <compile files="pr109042.aj" options="-warn:+unusedArgument -warn:+unusedPrivate -warn:+unusedImport -1.9"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="109486" title="Internal compiler error (ClassParser.java:242)"> + <compile files="PR109486.java" > + <message kind="error" line="1" text="The class PR109486 can be either abstract or final, not both"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="109124" title="no verify error with set on inner type"> + <compile files="VerifyErrorOnSet.aj" options="-1.9" > + </compile> + <run class="test.VerifyErrorOnSet"/> + <compile files="pr106874.aj" options="-1.9" > + </compile> + <run class="pr106874"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="108826" title="cant find type error with generic return type or parameter"> + <compile files="pr108826.aj" options="-1.9 -emacssym" > + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="105181" title="no verify error on generic collection member access"> + <compile files="pr105181.aj" options="-1.9"> + </compile> + <run class="pr105181"/> + </ajc-test> + + <ajc-test dir="bugs150/pr108903" pr="108903" title="super call in ITD - part 2"> + <compile files="com/designpattern/decorator/HeaderDecorator.aj,com/designpattern/decorator/Main.java,com/designpattern/decorator/Order.java,com/designpattern/decorator/OrderDecorator.aj,com/designpattern/decorator/SalesOrder.java" options="-1.9" > + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr103740" pr="103740" title="Compiler failure on at_annotation"> + <compile files="AroundAdvice.aj" options="-1.9,-showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void C.m1())' in Type 'C' (AroundAdvice.aj:12) advised by before advice from 'ErrorHandling' (AroundAdvice.aj:8)"/> + <message kind="weave" text="Join point 'method-execution(void C.m3())' in Type 'C' (AroundAdvice.aj:14) advised by before advice from 'ErrorHandling' (AroundAdvice.aj:8)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr106554" pr="106554" title="Problem in staticinitialization with pertypewithin aspect"> + <compile files="A.aj" options="-showWeaveInfo"> + <message kind="weave" text="Join point 'staticinitialization(void A.<clinit>())' in Type 'A' (A.aj:1) advised by before advice from 'StopsInit' (A.aj:21)"/> + </compile> + <run class="A"> + <stdout> + <line text="test = 1"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/SimpleInsuranceFailure" title="raw and generic type conversion with itd cons"> + <compile files="" options=" -emacssym, -sourceroots ." > + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="@annotation binding with around advice"> + <compile files="AnnotationBinding.aj" options="-1.9"/> + <run class="AnnotationBinding"/> + </ajc-test> + + <ajc-test dir="bugs150" title="declare parents on a missing type"> + <compile files="Pr76374.aj" options="-1.9"> + <message kind="warning" line="3" text="no match for this type name"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="parameterized generic methods"> + <compile files="Pr109283.aj" options="-1.9 -warn:indirectStatic"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="call join points in anonymous inner classes"> + <compile files="pr104229.aj" options="-1.9"> + <message kind="warning" line="54" text="bingo"/> + <message kind="warning" line="115" text="bingo"/> + <message kind="warning" line="130" text="bingo"/> + </compile> + <run class="pr104229"> + <stdout> + <line text="call match class pr104229"/> + <line text="OK it worked!"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" title="default impl of Runnable"> + <compile files="pr88900.aj" options="-Xdev:Pinpoint"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="array clone call join points in 1.4 vs 1.3"> + <compile files="pr102933.aj" options="-1.3"> + <message kind="warning" line="7" text="a call within pr102933"/> + </compile> + <compile files="pr102933.aj" options="-1.4"> + <message kind="warning" line="7" text="a call within pr102933"/> + </compile> + <compile files="pr102933.aj" options="-1.9"> + <message kind="warning" line="7" text="a call within pr102933"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" pr="100195" title="debug info in around advice inlining"> + <compile files="pr100195.aj"> + </compile> + <run class="pr100195"/> + </ajc-test> + + <ajc-test dir="bugs150" title="weaveinfo message for declare at method on an ITDd method"> + <compile files="pr113073.java" options="-1.9 -showWeaveInfo"> + <message kind="weave" text="Type 'C' (pr113073.java) has intertyped method from 'D' (pr113073.java:'void C.anotherMethod()')"/> + <message kind="weave" text="'public void C.anotherMethod()' (pr113073.java) is annotated with @Annotation method annotation from 'B' (pr113073.java:3)"/> + <message kind="weave" text="Type 'C' (pr113073.java) has intertyped method from 'D' (pr113073.java:'void C.anotherMethod(java.lang.String)')"/> + <message kind="weave" text="'public void C.anotherMethod(String)' (pr113073.java) is annotated with @Annotation method annotation from 'B' (pr113073.java:3)"/> + <message kind="weave" text="Type 'C' (pr113073.java) has intertyped constructor from 'D' (pr113073.java:'void C."/> + <message kind="weave" text="'public void C.new(String)' (pr113073.java) is annotated with @Annotation constructor annotation from 'B' (pr113073.java:4)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr113447" title="no verify error with two this pcds"> + <compile files="PR113447.java"> + </compile> + <run class="PR113447"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113447" title="no verify error with two at this pcds"> + <compile files="PR113447a.java" options="-1.9"> + </compile> + <run class="PR113447a"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113447" title="no verify error with at within pcds"> + <compile files="PR113447b.java" options="-1.9"> + </compile> + <run class="PR113447b"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113447" title="no verify error with at withincode pcds"> + <compile files="PR113447c.java" options="-1.9"> + </compile> + <run class="PR113447c"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113447" title="no verify error with at annotation pcds"> + <compile files="PR113447d.java" options="-1.9"> + </compile> + <run class="PR113447d"/> + </ajc-test> + + <ajc-test dir="bugs150/pr113447" title="no verify error with two args pcds"> + <compile files="PR113447e.java" options="-1.9"> + </compile> + <run class="PR113447e"/> + </ajc-test> + + <ajc-test dir="bugs150" title="no StackOverflowError with circular pcd in generic aspect"> + <compile files="pr115235.aj" options="-1.9"> + <message kind="warning" line="3" text="advice defined in GenericAbstractAspect has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="error" text="circular pointcut declaration involving: pc()"/> + <message kind="error" line="20" text="circular pointcut declaration involving: pc2()"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="no StackOverflowError with circular pcd in generic aspect - 2"> + <compile files="pr115235b.aj" options="-1.9"> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for improper exact annotation type"> + <compile files="ExactAnnotationTypePattern.java" options="-1.9"> + <message kind="warning" line="20" text="field blah"/> + <message kind="warning" line="28" text="does not match because annotation @TypeAnnotation has @Target{ElementType.TYPE} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="37" text="does not match because annotation @FieldAnnotation has @Target{ElementType.FIELD} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="46" text="does not match because annotation @MethodAnnotation has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for improper annotation type inside OR"> + <compile files="OrTypePattern.java" options="-1.9"> + <message kind="warning" line="26" text="does not match because annotation @FieldAnnotation has @Target{ElementType.FIELD} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="31" text="does not match because annotation @TypeAnnotation has @Target{ElementType.TYPE} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="31" text="does not match because annotation @FieldAnnotation has @Target{ElementType.FIELD} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for improper annotation type inside AND"> + <compile files="AndTypePattern.java" options="-1.9"> + <message kind="warning" line="23" text="does not match because annotation @FieldAnnotation has @Target{ElementType.FIELD} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for improper annotated return type"> + <compile files="AnnotationReturnType.java" options="-1.9"> + <!-- warnings coming from matching pointcuts and corresponding declare warnings --> + <message kind="warning" line="12" text="(@TypeAnnotation *) *(..)"/> + <message kind="warning" line="12" text="(@(TypeAnnotation || MethodAnnotation) *) *(..)"/> + <!-- xlint warnings that were put in as part of fix for pr115252 --> + <message kind="warning" line="32" text="does not match because annotation @MethodAnnotation has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="37" text="does not match because annotation @MethodAnnotation has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for improper annotated declaring type"> + <compile files="AnnotationDeclaringType.java" options="-1.9"> + <!-- warning coming from matching pointcuts and corresponding declare warnings --> + <message kind="warning" line="13" text="* (@TypeAnnotation *).*(..)"/> + <!-- xlint warning that was put in as part of fix for pr115252 --> + <message kind="warning" line="27" text="does not match because annotation @MethodAnnotation has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for improper annotated parameter type"> + <compile files="AnnotationParameterType.java" options="-1.9"> + <!-- warning coming from matching pointcuts and corresponding declare warnings --> + <message kind="warning" line="12" text="* *(@TypeAnnotation *)"/> + <!-- xlint warning that was put in as part of fix for pr115252 --> + <message kind="warning" line="31" text="does not match because annotation @MethodAnnotation has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for improper annotated throws pattern"> + <compile files="AnnotationThrowsPattern.java" options="-1.9"> + <!-- warnings coming from matching pointcuts and corresponding declare warnings --> + <message kind="warning" line="12" text="(* *.*(..) throws (@TypeAnnotation *))"/> + <message kind="warning" line="12" text="* *.*(..) throws !(@MethodAnnotation *)"/> + <message kind="warning" line="14" text="(* *.*(..) throws !(@TypeAnnotation *))"/> + <message kind="warning" line="14" text="* *.*(..) throws !(@MethodAnnotation *)"/> + <!-- xlint warnings that were put in as part of fix for pr115252 --> + <message kind="warning" line="40" text="does not match because annotation @MethodAnnotation has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="46" text="does not match because annotation @MethodAnnotation has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr115252" title="xlint message for more than one improper annotated parameter type"> + <compile files="MoreThanOneTargetAnnotation.java" options="-1.9"> + <!-- xlint warning that was put in as part of fix for pr115252 --> + <message kind="warning" line="28" text="does not match because annotation @MethodAndFieldAnnotation has @Target{ElementType.FIELD,ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="38" text="does not match because annotation @TypeAndMethodAnnotation has @Target{ElementType.METHOD,ElementType.TYPE} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr119019" title="no NPE when inaccessible method is called within itd"> + <compile files="bar/TargetITDClass.java,foo/ITDWithACall.aj"/> + <run class="foo.ITDWithACall"/> + </ajc-test> + + <ajc-test dir="bugs150" title="no NPE with or pointcut and more than one args"> + <compile files="PR118149.aj"/> + </ajc-test> + + <ajc-test dir="bugs150" title="no StringOutOfBoundsException with generic inner aspects"> + <compile files="PR119543.java" options="-1.9"> + <message kind="warning" line="8" text="advice defined in PR119543$A has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + </ajc-test> + + <!-- ============================================================================ --> + <!-- ============================================================================ --> + + <!-- atOverride tests with ITDs --> + + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs"> + <compile files="AtOverride.aj" options="-1.9"/> + </ajc-test> + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 1"> + <compile files="AtOverride1.aj" options="-1.9"> + <message kind="error" line="9" text="The method method() of type Child must override a superclass method"/> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 2"> + <compile files="AtOverride2.aj" options="-1.9"/> + </ajc-test> + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 3"> + <compile files="AtOverride3.aj" options="-1.9"/> + </ajc-test> + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 4"> + <compile files="AtOverride4.aj" options="-1.9"/> + </ajc-test> + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 5"> + <compile files="AtOverride5.aj" options="-1.9"> + <message kind="error" line="11" text="The method method() of type Child must override a superclass method"/> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 6"> + <compile files="AtOverride6.aj" options="-1.9"/> + </ajc-test> + <ajc-test dir="java5/generics/itds" pr="106630" title="atOverride used with ITDs - 7"> + <compile files="AtOverride7.aj" options="-1.9"/> + </ajc-test> + + <!-- end of atOverride tests with ITDs --> + + <ajc-test dir="../docs/dist/doc/examples/introduction" title="introduction sample" vm="1.5"> + <compile files="CloneablePoint.java,ComparablePoint.java,HashablePoint.java,Point.java" options="-1.9 -Xlint:ignore"/> + </ajc-test> + + <ajc-test dir="java5/varargs" title="varargs in constructor sig" vm="1.5"> + <compile files="Pr88652.aj" options="-1.9"> + <message kind="warning" line="8" text="should match"/> + <message kind="warning" line="9" text="should match"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs" title="Varargs with .. in pointcut" vm="1.5"> + <compile files="pr93356.aj" options="-1.9"> + <message kind="warning" line="5" text="a"/> + <message kind="warning" line="5" text="b"/> + <message kind="warning" line="5" text="c"/> + <message kind="warning" line="5" text="d"/> + <message kind="warning" line="5" text="e"/> + <message kind="warning" line="5" text="k"/> + <message kind="warning" line="5" text="l"/> + + <message kind="warning" line="4" text="f"/> + <message kind="warning" line="4" text="g"/> + <message kind="warning" line="4" text="h"/> + <message kind="warning" line="4" text="i"/> + <message kind="warning" line="4" text="j"/> + + <message kind="warning" line="7" text="f"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs" title="star varargs pattern" vm="1.5"> + <compile files="StarVarargsPattern.aj" options="-1.9"> + <message kind="warning" line="5" text="you used a varargs signature"/> + <message kind="warning" line="7" text="you used a varargs signature"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations" title="invalid cons syntax" vm="1.5"> + <compile files="SyntaxError.aj" options="-1.9"> + <message kind="error" line="3" text="Syntax error on token "new", "method name (not constructor)" expected"/> + </compile> + </ajc-test> + + <!-- hasmethod / hasfield tests --> + + <ajc-test title="declare parents : hasmethod(..) - 1" dir="hasmember"> + <compile files="HasMethod.aj"> + <message kind="error" line="5" text="the type pattern hasmethod(* print(..)) can only be used when the -XhasMember option is set"/> + </compile> + </ajc-test> + + <ajc-test title="declare parents : hasmethod(..) - 1" dir="hasmember"> + <compile files="HasMethod.aj" options="-XhasMember"> + </compile> + <run class="HasMethod"></run> + </ajc-test> + + <ajc-test title="declare parents : hasmethod(..) - 2" dir="hasmember"> + <compile files="HasMethodInherited.aj" options="-XhasMember"> + </compile> + <run class="HasMethodInherited"></run> + </ajc-test> + + <ajc-test title="declare parents : hasmethod(..) - 3" dir="hasmember"> + <compile files="HasPrivateMethodInherited.aj" options="-XhasMember"> + </compile> + <run class="HasPrivateMethodInherited"></run> + </ajc-test> + + <ajc-test title="declare parents : hasmethod(..) - 4" dir="hasmember"> + <compile files="HasMethodViaITD.aj" options="-XhasMember"> + <message kind="warning" line="15" text="hasmethod matched on ITD ok"/> + </compile> + </ajc-test> + + <ajc-test title="declare parents : hasfield(..) - 1" dir="hasmember"> + <compile files="HasField.aj" options="-XhasMember"> + </compile> + <run class="HasField"></run> + </ajc-test> + + <ajc-test title="declare parents : hasfield(..) - 2" dir="hasmember"> + <compile files="HasFieldInherited.aj" options="-XhasMember"> + </compile> + <run class="HasFieldInherited"></run> + </ajc-test> + + <ajc-test title="declare parents : hasfield(..) - 3" dir="hasmember"> + <compile files="HasPrivateFieldInherited.aj" options="-XhasMember"> + </compile> + <run class="HasPrivateFieldInherited"></run> + </ajc-test> + + <!-- Annotation binding tests --> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 1"> + <compile files="CallAnnBinding.aj" options="-1.9"/> + <run class="CallAnnBinding"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 2"> + <compile files="CallAnnBinding2.aj" options="-1.9"/> + <run class="CallAnnBinding2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 3"> + <compile files="CallAnnBinding3.aj" options="-1.9"/> + <run class="CallAnnBinding3"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 4"> + <compile files="CallAnnBinding4.aj" options="-1.9"/> + <run class="CallAnnBinding4"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 5"> + <compile files="CallAnnBinding5.aj" options="-1.9"/> + <run class="CallAnnBinding5"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 6"> + <compile files="CallAnnBinding6.aj" options="-1.9"/> + <run class="CallAnnBinding6"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="call annotation binding 7"> + <compile files="CallAnnBinding7.aj" options="-1.9"/> + <run class="CallAnnBinding7"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@target annotation binding 1"> + <compile files="AtTarget1.aj" options="-1.9"/> + <run class="AtTarget1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@target annotation binding 2"> + <compile files="AtTarget2.aj" options="-1.9"/> + <run class="AtTarget2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@target annotation binding 3"> + <compile files="AtTarget3.aj" options="-1.9"/> + <run class="AtTarget3"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@target annotation binding 4"> + <compile files="AtTarget4.aj" options="-1.9"/> + <run class="AtTarget4"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding/usingPackageNames" vm="1.5" title="@target annotation binding 5"> + <compile files="MyAspect.aj,MyAnnotation.java,MyClass.java" options="-1.9"/> + <run class="test.MyClass"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@this annotation binding 1"> + <compile files="AtThis1.aj" options="-1.9"/> + <run class="AtThis1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@this annotation binding 2"> + <compile files="AtThis2.aj" options="-1.9"/> + <run class="AtThis2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@this annotation binding 3"> + <compile files="AtThis3.aj" options="-1.9"/> + <run class="AtThis3"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@this annotation binding 4"> + <compile files="AtThis4.aj" options="-1.9"/> + <run class="AtThis4"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@this annotation binding 5"> + <compile files="AtThis5.aj" options="-1.9"/> + <run class="AtThis5"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@args annotation binding 1"> + <compile files="AtArgs1.aj" options="-1.9"/> + <run class="AtArgs1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@args annotation binding 2"> + <compile files="AtArgs2.aj" options="-1.9"/> + <run class="AtArgs2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@args annotation binding 3"> + <compile files="AtArgs3.aj" options="-1.9"/> + <run class="AtArgs3"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@args annotation binding 4"> + <compile files="AtArgs4.aj" options="-1.9"/> + <run class="AtArgs4"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@args annotation binding 5"> + <compile files="AtArgs5.aj" options="-1.9"/> + <run class="AtArgs5"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="execution and @annotation"> + <compile files="ExecutionAnnBinding1.aj" options="-1.9"/> + <run class="ExecutionAnnBinding1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="set and @annotation"> + <compile files="FieldAnnBinding1.aj" options="-1.9"/> + <run class="FieldAnnBinding1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="get and @annotation"> + <compile files="FieldAnnBinding2.aj" options="-1.9"/> + <run class="FieldAnnBinding2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="get and @annotation with arrays"> + <compile files="FieldAnnBinding3.aj" options="-1.9"/> + <run class="FieldAnnBinding3"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="cons call and @annotation"> + <compile files="CtorAnnBinding1.aj" options="-1.9"/> + <run class="CtorAnnBinding1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="cons exe and @annotation"> + <compile files="CtorAnnBinding2.aj" options="-1.9"/> + <run class="CtorAnnBinding2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="staticinit and @annotation"> + <compile files="StaticInitBinding.aj" options="-1.9"/> + <run class="StaticInitBinding"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="preinit and @annotation"> + <compile files="PreInitBinding.aj" options="-1.9"/> + <run class="PreInitBinding"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="init and @annotation"> + <compile files="InitBinding.aj" options="-1.9"/> + <run class="InitBinding"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="adviceexecution and @annotation"> + <compile files="AdviceExecBinding.aj" options="-1.9"/> + <run class="AdviceExecBinding"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="handler and @annotation"> + <compile files="HandlerBinding.aj" options="-1.9"/> + <run class="HandlerBinding"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@withincode() and call(* println(..))"> + <compile files="WithinCodeBinding1.aj" options="-1.9"/> + <run class="WithinCodeBinding1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@within"> + <compile files="WithinBinding1.aj" options="-1.9"/> + <run class="WithinBinding1"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="@within - multiple types"> + <compile files="WithinBinding2.aj" options="-1.9"/> + <run class="WithinBinding2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding/complexExample" vm="1.5" title="packages and no binding"> + <compile files="A.java,B.java,Color.java,X.java" options="-1.9"/> + <run class="a.b.c.A"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding/complexExample" vm="1.5" title="packages and binding"> + <compile files="A.java,B.java,Color.java,X2.java" options="-1.9"/> + <run class="a.b.c.A"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" vm="1.5" title="binding with static methods"> + <compile files="StaticMethods.java" options="-1.9"/> + <run class="StaticMethods"/> + </ajc-test> + + <ajc-test dir="java5/annotations" vm="1.5" title="annotation matching on call"> + <weave classesFiles="AnnotatedType.java,SimpleAnnotation.java,SimpleAnnotation2.java" + aspectsFiles="AnnotationAspect02.aj" + options="-1.9,-showWeaveInfo"> + <message kind="weave" text="Type 'AnnotatedType' (AnnotatedType.java:3) advised by before advice from 'AnnotationAspect02' (aspects.jar!AnnotationAspect02.class:4(from AnnotationAspect02.aj))"/> + <message kind="weave" text="Type 'AnnotatedType' (AnnotatedType.java:3) advised by before advice from 'AnnotationAspect02' (aspects.jar!AnnotationAspect02.class:2(from AnnotationAspect02.aj))"/> + <message kind="weave" text="Type 'AnnotatedType' (AnnotatedType.java:4) advised by before advice from 'AnnotationAspect02' (aspects.jar!AnnotationAspect02.class:4(from AnnotationAspect02.aj))"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/annotations" vm="1.5" title="at annotation matching"> + <weave classesFiles="AnnotatedType.java,SimpleAnnotation.java,SimpleAnnotation2.java" + aspectsFiles="AnnotationAspect03.aj" + options="-1.9,-showWeaveInfo"> + <message kind="warning" line="8" text="@annotation matched here"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/annotations/within_code" vm="1.5" title="annotations and within(code)"> + <weave classesFiles="TestingAnnotations.java" + aspectsFiles="WithinAndWithinCodeTests.java" + options="-1.9,-showWeaveInfo"> + <message kind="warning" line="31" text="@within match on non-inherited annotation"/> + <message kind="warning" line="39" text="@within match on non-inherited annotation"/> + <message kind="warning" line="39" text="@within match on inheritable annotation"/> + <message kind="warning" line="43" text="@within match on inheritable annotation"/> + <message kind="warning" line="32" text="@withincode match"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/annotations/within" vm="1.5" title="annotations and within"> + <weave classesFiles="PlainWithin.java" + aspectsFiles="PlainWithinTests.java" + options="-1.9,-showWeaveInfo"> + <message kind="warning" line="21" text="positive within match on annotation"/> + <message kind="warning" line="25" text="negative within match on annotation"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/annotations/thisOrtarget" vm="1.5" title="must have runtime retention"> + <compile options="-1.9" files="NotRuntimeRetention.aj"> + <message kind="error" line="20" text="Annotation type MySourceAnnotation does not have runtime retention"/> + <message kind="error" line="21" text="Annotation type MyClassAnnotation does not have runtime retention"/> + <message kind="error" line="22" text="Annotation type MyAnnotation does not have runtime retention"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/thisOrtarget" vm="1.5" title="inheritable or not"> + <compile options="-1.9" files="TestingAnnotations.java,ThisOrTargetTests.aj"> + </compile> + <run class="TestingAnnotations"/> + </ajc-test> + + <ajc-test dir="java5/annotations/thisOrtarget" vm="1.5" title="use of @this/target in deow"> + <compile options="-1.9" files="TestingAnnotations.java,DeclareEoW.java"> + <message kind="error" line="3" text="this() pointcut designator cannot be used in declare statement"/> + <message kind="error" line="5" text="target() pointcut designator cannot be used in declare statement"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/args" vm="1.5" title="@args tests"> + <compile options="-1.9" files="TestingArgsAnnotations.java,AtArgsAspect.java"> + </compile> + <run class="TestingArgsAnnotations"/> + </ajc-test> + + <ajc-test dir="java5/annotations/args" vm="1.5" title="use of @args in deow"> + <compile options="-1.9" files="TestingArgsAnnotations.java,DeclareEoW.java"> + <message kind="error" line="3" text="args() pointcut designator cannot be used in declare statement"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations" vm="1.5" title="compiling an annotation"> + <compile options="-1.9" files="SimpleAnnotation.java"> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations" vm="1.5" title="compiling annotated file"> + <compile options="-1.9" files="SimpleAnnotation.java,AnnotatedType.java"> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/within" vm="1.5" title="annotations and within (src)"> + <compile files="PlainWithin.java,PlainWithinTests.java" + aspectsFiles="PlainWithinTests.java" + options="-1.9"> + <message kind="warning" line="21" text="positive within match on annotation"/> + <message kind="warning" line="25" text="negative within match on annotation"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/attarget" vm="1.5" title="losing annotations..."> + <compile options="-1.9" files="Program.java,AtTargetAspect.java"> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations" vm="1.5" title="no itds on annotation types"> + <compile files="AnnotatedType.java,SimpleAnnotation.java,SimpleAnnotation2.java,AnnotationAspect01.aj" + options="-1.9"> + <message kind="error" line="4" text="can't make inter-type constructor declarations"/> + <message kind="error" line="8" text="can't make inter-type method declarations"/> + <message kind="error" line="13" text="can't make inter-type field declarations"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations" vm="1.5" title="no declare parents on annotation types"> + <compile files="AnnotatedType.java,SimpleAnnotation.java,SimpleAnnotation2.java,AnnotationAspect04.aj" + options="-1.9"> + <message kind="error" line="7" text="can't use declare parents to alter supertype of annotation type SimpleAnnotation"/> + <message kind="error" line="10" text="can't use declare parents to make 'java.lang.annotation.Annotation' the parent of type"/> + <message kind="error" line="4" text="can't use declare parents to make annotation type SimpleAnnotation implement an interface"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations" vm="1.5" title="declare parents wildcards matching annotation types"> + <compile files="AnnotatedType.java,SimpleAnnotation.java,SimpleAnnotation2.java,AnnotationAspect05.aj" + options="-1.9"> + <message kind="warning" line="4" text="annotation type SimpleAnnotation2 matches a declare parents type pattern but is being ignored"/> + <message kind="warning" line="4" text="annotation type SimpleAnnotation matches a declare parents type pattern but is being ignored"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/binding/complexExample" vm="1.5" title="annotated any pattern"> + <compile files="A.java,B.java,C.java,Color.java,X3.java" + options="-1.9"> + </compile> + <run class="g.h.i.C"/> + <run class="a.b.c.A"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding/complexExample" vm="1.5" title="annotation not imported"> + <compile files="A.java,B.java,C.java,Color.java,X4.java" + options="-1.9"> + <message kind="warning" line="6" text="no match for this type name: Color"/> + </compile> + <run class="a.b.c.A"/> + </ajc-test> + + <ajc-test dir="java5/annotations/itds" vm="1.5" title="annotated public itds"> + <compile files="AtItd2.aj" options="-1.9"/> + <run class="AtItd2"/> + </ajc-test> + + <ajc-test dir="java5/annotations/itds" vm="1.5" title="annotated public itds - values"> + <compile files="AtItd3.aj" options="-1.9"/> + <run class="AtItd3"/> + </ajc-test> + + <ajc-test dir="java5/annotations/itds" vm="1.5" title="annotated public itds - multiple complex annotations"> + <compile files="AtItd4.aj" options="-1.9"/> + <run class="AtItd4"/> + </ajc-test> + + + <ajc-test dir="java5/annotations/itds" vm="1.5" title="nasty annotation and itds test"> + <compile files="AnnotationsAndITDs.aj" options="-1.9"> + <!-- first two are ITCs, second two are ITCs annotated via declare @ctor, third is default ctor --> + <message kind="warning" line="17" text="execution(@SomeAnnotation ...new(..)"/> + <message kind="warning" line="20" text="execution(@SomeAnnotation ...new(..)"/> + <message kind="warning" line="45" text="execution(@SomeAnnotation ...new(..)"/> + <message kind="warning" line="46" text="execution(@SomeAnnotation ...new(..)"/> + <message kind="warning" line="180" text="execution(@SomeAnnotation ...new(..)"/> + + <!-- first four are fields annotated via declare, last two are directly annotated ITDs --> + <message kind="warning" line="59" text="set(@SomeAnnotation...)"/> + <message kind="warning" line="60" text="set(@SomeAnnotation...)"/> + <message kind="warning" line="70" text="set(@SomeAnnotation...)"/> + <message kind="warning" line="71" text="set(@SomeAnnotation...)"/> + <message kind="warning" line="76" text="set(@SomeAnnotation...)"/> + <message kind="warning" line="77" text="set(@SomeAnnotation...)"/> + + <!-- annotations added via declare --> + <message kind="warning" line="175" text="si(@SomeAnnotation...)"/> + <message kind="warning" line="180" text="si(@SomeAnnotation...)"/> + + <message kind="warning" line="25" text="execution(@SomeAnnotation ...)"/> + <message kind="warning" line="28" text="execution(@SomeAnnotation ...)"/> + <message kind="warning" line="52" text="execution(@SomeAnnotation ...)"/> + <message kind="warning" line="53" text="execution(@SomeAnnotation ...)"/> + <!--message kind="warning" line="70" text="set(@SomeAnnotation...)"/> + <message kind="warning" line="71" text="set(@SomeAnnotation...)"/--> + </compile> + <run class="AnnotationsAndITDs"> + <stderr> + <line text="@type java.lang.System (AnnotationsAndITDs.aj:0)"/> + <line text="hello AnnotationsAndITDs (AnnotationsAndITDs.aj:17)"/> + <line text="goodbye java.lang.String (AnnotationsAndITDs.aj:20)"/> + <line text="goodbye java.lang.String (AnnotationsAndITDs.aj:20)"/> + <line text="y java.lang.Integer (AnnotationsAndITDs.aj:28)"/> + <line text="d java.lang.Double (AnnotationsAndITDs.aj:70)"/> + <line text="f java.lang.Double (AnnotationsAndITDs.aj:71)"/> + <line text="@type java.lang.System (AnnotationsAndITDs.aj:0)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:59)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:60)"/> + <line text="@cons java.lang.String (AnnotationsAndITDs.aj:45)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:59)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:60)"/> + <line text="@cons java.lang.String (AnnotationsAndITDs.aj:46)"/> + <line text="@cons java.lang.String (AnnotationsAndITDs.aj:46)"/> + <line text="@method ITDMe2 (AnnotationsAndITDs.aj:53)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:76)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:77)"/> + + <!-- + <line text="method bar has 1 params, first param annotation is @ParamAnnotation"/> + --> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" pr="91858" title="declare @Type (should be @type)"> + <compile files="DeathByPoorSpelling.aj" options="-1.9"> + <message kind="error" line="6" text="Syntax error on token ":", "one of type, method, field, constructor" expected"/> + </compile> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- Autoboxing tests --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="simple boxing test"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,SimpleAutoboxingAspect.aj" + options="-1.9,-showWeaveInfo"> + <message kind="weave" text="Type 'SimpleAutoboxing' (SimpleAutoboxing.java:7) advised by before advice from 'SimpleAutoboxingAspect' (SimpleAutoboxingAspect.aj:8)"/> + <message kind="weave" text="Type 'SimpleAutoboxing' (SimpleAutoboxing.java:7) advised by before advice from 'SimpleAutoboxingAspect' (SimpleAutoboxingAspect.aj:4)"/> + </compile> + <run class="SimpleAutoboxing"> + <stderr> + <line text="Matching by Integer:20000"/> + <line text="Matching by int:20000"/> + <line text="method_takes_Integer=20000"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="integer boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectInteger.aj" + options="-1.9,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:11) advised by before advice from 'AspectInteger' (AspectInteger.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:11) advised by before advice from 'AspectInteger' (AspectInteger.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:12) advised by before advice from 'AspectInteger' (AspectInteger.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:12) advised by before advice from 'AspectInteger' (AspectInteger.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:13) advised by before advice from 'AspectInteger' (AspectInteger.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:13) advised by before advice from 'AspectInteger' (AspectInteger.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:14) advised by before advice from 'AspectInteger' (AspectInteger.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingI' (AutoboxingI.java:14) advised by before advice from 'AspectInteger' (AspectInteger.aj:4)"/> + </compile> + <run class="AutoboxingI"> + <stderr> + <line text="Matching by Integer:10000"/> + <line text="Matching by int:10000"/> + <line text="method_takes_Integer=10000"/> + <line text="Matching by Integer:20000"/> + <line text="Matching by int:20000"/> + <line text="method_takes_Integer=20000"/> + <line text="Matching by Integer:30000"/> + <line text="Matching by int:30000"/> + <line text="method_takes_int=30000"/> + <line text="Matching by Integer:40000"/> + <line text="Matching by int:40000"/> + <line text="method_takes_int=40000"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="char boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectChar.aj" + options="-1.9,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:11) advised by before advice from 'AspectChar' (AspectChar.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:11) advised by before advice from 'AspectChar' (AspectChar.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:12) advised by before advice from 'AspectChar' (AspectChar.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:12) advised by before advice from 'AspectChar' (AspectChar.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:13) advised by before advice from 'AspectChar' (AspectChar.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:13) advised by before advice from 'AspectChar' (AspectChar.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:14) advised by before advice from 'AspectChar' (AspectChar.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingC' (AutoboxingC.java:14) advised by before advice from 'AspectChar' (AspectChar.aj:4)"/> + </compile> + <run class="AutoboxingC"> + <stderr> + <line text="Character:1"/> + <line text="char:1"/> + <line text="method_takes_Character=1"/> + <line text="Character:2"/> + <line text="char:2"/> + <line text="method_takes_Character=2"/> + <line text="Character:3"/> + <line text="char:3"/> + <line text="method_takes_char=3"/> + <line text="Character:4"/> + <line text="char:4"/> + <line text="method_takes_char=4"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="double boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectDouble.aj" + options="-1.9,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:11) advised by before advice from 'AspectDouble' (AspectDouble.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:11) advised by before advice from 'AspectDouble' (AspectDouble.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:12) advised by before advice from 'AspectDouble' (AspectDouble.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:12) advised by before advice from 'AspectDouble' (AspectDouble.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:13) advised by before advice from 'AspectDouble' (AspectDouble.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:13) advised by before advice from 'AspectDouble' (AspectDouble.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:14) advised by before advice from 'AspectDouble' (AspectDouble.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingD' (AutoboxingD.java:14) advised by before advice from 'AspectDouble' (AspectDouble.aj:4)"/> + </compile> + <run class="AutoboxingD"> + <stderr> + <line text="Double:100.0"/> + <line text="double:100.0"/> + <line text="method_takes_Double=100.0"/> + <line text="Double:200.0"/> + <line text="double:200.0"/> + <line text="method_takes_Double=200.0"/> + <line text="Double:300.0"/> + <line text="double:300.0"/> + <line text="method_takes_double=300.0"/> + <line text="Double:400.0"/> + <line text="double:400.0"/> + <line text="method_takes_double=400.0"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="float boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectFloat.aj" + options="-1.9,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:11) advised by before advice from 'AspectFloat' (AspectFloat.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:11) advised by before advice from 'AspectFloat' (AspectFloat.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:12) advised by before advice from 'AspectFloat' (AspectFloat.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:12) advised by before advice from 'AspectFloat' (AspectFloat.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:13) advised by before advice from 'AspectFloat' (AspectFloat.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:13) advised by before advice from 'AspectFloat' (AspectFloat.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:14) advised by before advice from 'AspectFloat' (AspectFloat.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingF' (AutoboxingF.java:14) advised by before advice from 'AspectFloat' (AspectFloat.aj:4)"/> + </compile> + <run class="AutoboxingF"> + <stderr> + <line text="Float:100.0"/> + <line text="float:100.0"/> + <line text="method_takes_Float=100.0"/> + <line text="Float:200.0"/> + <line text="float:200.0"/> + <line text="method_takes_Float=200.0"/> + <line text="Float:300.0"/> + <line text="float:300.0"/> + <line text="method_takes_float=300.0"/> + <line text="Float:400.0"/> + <line text="float:400.0"/> + <line text="method_takes_float=400.0"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="short boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectShort.aj" + options="-1.9,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:11) advised by before advice from 'AspectShort' (AspectShort.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:11) advised by before advice from 'AspectShort' (AspectShort.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:12) advised by before advice from 'AspectShort' (AspectShort.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:12) advised by before advice from 'AspectShort' (AspectShort.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:13) advised by before advice from 'AspectShort' (AspectShort.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:13) advised by before advice from 'AspectShort' (AspectShort.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:14) advised by before advice from 'AspectShort' (AspectShort.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingS' (AutoboxingS.java:14) advised by before advice from 'AspectShort' (AspectShort.aj:4)"/> + </compile> + <run class="AutoboxingS"> + <stderr> + <line text="Short:100"/> + <line text="short:100"/> + <line text="method_takes_Short=100"/> + <line text="Short:200"/> + <line text="short:200"/> + <line text="method_takes_Short=200"/> + <line text="Short:300"/> + <line text="short:300"/> + <line text="method_takes_short=300"/> + <line text="Short:400"/> + <line text="short:400"/> + <line text="method_takes_short=400"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="long boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectLong.aj" + options="-1.9,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:11) advised by before advice from 'AspectLong' (AspectLong.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:11) advised by before advice from 'AspectLong' (AspectLong.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:12) advised by before advice from 'AspectLong' (AspectLong.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:12) advised by before advice from 'AspectLong' (AspectLong.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:13) advised by before advice from 'AspectLong' (AspectLong.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:13) advised by before advice from 'AspectLong' (AspectLong.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:14) advised by before advice from 'AspectLong' (AspectLong.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingJ' (AutoboxingJ.java:14) advised by before advice from 'AspectLong' (AspectLong.aj:4)"/> + </compile> + <run class="AutoboxingJ"> + <stderr> + <line text="Long:1000000"/> + <line text="long:1000000"/> + <line text="method_takes_Long=1000000"/> + <line text="Long:2000000"/> + <line text="long:2000000"/> + <line text="method_takes_Long=2000000"/> + <line text="Long:3000000"/> + <line text="long:3000000"/> + <line text="method_takes_long=3000000"/> + <line text="Long:4000000"/> + <line text="long:4000000"/> + <line text="method_takes_long=4000000"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="boolean boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectBoolean.aj" + options="-1.9,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:9) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:9) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:10) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:10) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:11) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:11) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:12) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingZ' (AutoboxingZ.java:12) advised by before advice from 'AspectBoolean' (AspectBoolean.aj:4)"/> + </compile> + <run class="AutoboxingZ"> + <stderr> + <line text="Boolean:false"/> + <line text="boolean:false"/> + <line text="method_takes_Boolean=false"/> + <line text="Boolean:false"/> + <line text="boolean:false"/> + <line text="method_takes_Boolean=false"/> + <line text="Boolean:false"/> + <line text="boolean:false"/> + <line text="method_takes_boolean=false"/> + <line text="Boolean:false"/> + <line text="boolean:false"/> + <line text="method_takes_boolean=false"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="byte boxing"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectByte.aj" + options="-1.9,-showWeaveInfo"> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:11) advised by before advice from 'AspectByte' (AspectByte.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:11) advised by before advice from 'AspectByte' (AspectByte.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:12) advised by before advice from 'AspectByte' (AspectByte.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:12) advised by before advice from 'AspectByte' (AspectByte.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:13) advised by before advice from 'AspectByte' (AspectByte.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:13) advised by before advice from 'AspectByte' (AspectByte.aj:4)"/> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:14) advised by before advice from 'AspectByte' (AspectByte.aj:8)"/> + <message kind="weave" text="Type 'AutoboxingB' (AutoboxingB.java:14) advised by before advice from 'AspectByte' (AspectByte.aj:4)"/> + </compile> + <run class="AutoboxingB"> + <stderr> + <line text="Byte:1"/> + <line text="byte:1"/> + <line text="method_takes_Byte=1"/> + <line text="Byte:50"/> + <line text="byte:50"/> + <line text="method_takes_Byte=50"/> + <line text="Byte:3"/> + <line text="byte:3"/> + <line text="method_takes_byte=3"/> + <line text="Byte:52"/> + <line text="byte:52"/> + <line text="method_takes_byte=52"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/autoboxing" vm="1.5" title="boxing in after returning"> + <compile files="AutoboxingB.java,AutoboxingC.java,AutoboxingD.java,AutoboxingF.java,AutoboxingI.java,AutoboxingJ.java,AutoboxingS.java,AutoboxingZ.java,SimpleAutoboxing.java,AspectAfterReturning.aj" + options="-1.9,-showWeaveInfo"> + <message kind="weave" text="Type 'AspectAfterReturning' (AspectAfterReturning.aj:18) advised by afterReturning advice from 'AspectAfterReturning' (AspectAfterReturning.aj:4)"/> + <message kind="weave" text="Type 'AspectAfterReturning' (AspectAfterReturning.aj:18) advised by afterReturning advice from 'AspectAfterReturning' (AspectAfterReturning.aj:8)"/> + <message kind="weave" text="Type 'AspectAfterReturning' (AspectAfterReturning.aj:18) advised by afterReturning advice from 'AspectAfterReturning' (AspectAfterReturning.aj:12)"/> + <message kind="weave" text="Type 'AspectAfterReturning' (AspectAfterReturning.aj:19) advised by afterReturning advice from 'AspectAfterReturning' (AspectAfterReturning.aj:4)"/> + <message kind="weave" text="Type 'AspectAfterReturning' (AspectAfterReturning.aj:19) advised by afterReturning advice from 'AspectAfterReturning' (AspectAfterReturning.aj:8)"/> + <message kind="weave" text="Type 'AspectAfterReturning' (AspectAfterReturning.aj:19) advised by afterReturning advice from 'AspectAfterReturning' (AspectAfterReturning.aj:12)"/> + </compile> + <run class="AspectAfterReturning"> + <stderr> + <line text="Returning I=5"/> + <line text="Returning Integer=5"/> + <line text="Returning Object=5"/> + <line text="Returning I=10"/> + <line text="Returning Integer=10"/> + <line text="Returning Object=10"/> + </stderr> + </run> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- Covariance tests --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 1"> + <compile options="-1.9,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect01.aj"> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:26) advised by before advice from 'CovAspect01' (CovAspect01.aj:5)"/> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect01' (CovAspect01.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 2"> + <compile options="-1.9,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect02.aj"> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:26) advised by before advice from 'CovAspect02' (CovAspect02.aj:5)"/> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect02' (CovAspect02.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 3"> + <compile options="-1.9,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect03.aj"> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:26) advised by before advice from 'CovAspect03' (CovAspect03.aj:5)"/> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect03' (CovAspect03.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 4"> + <compile options="-1.9,-showWeaveInfo" files="CovBaseProgram02.java,CovAspect04.aj"> + <message kind="weave" text="Type 'CovBaseProgram02' (CovBaseProgram02.java:30) advised by before advice from 'CovAspect04' (CovAspect04.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 5"> + <compile options="-1.9,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect05.aj"> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:26) advised by before advice from 'CovAspect05' (CovAspect05.aj:5)"/> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect05' (CovAspect05.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 6"> + <compile options="-1.9,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect06.aj"> + <message kind="warning" line="3" text="does not match because declaring type is Super"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 7"> + <compile options="-1.9,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect07.aj"> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect07' (CovAspect07.aj:5)"/> + <message kind="warning" line="3" text="does not match because declaring type is Super"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 8"> + <compile options="-1.9,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect08.aj"> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect08' (CovAspect08.aj:11)"/> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect08' (CovAspect08.aj:5)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 9"> + <compile options="-1.9,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect09.aj"> + </compile> + </ajc-test> + + <ajc-test dir="java5/covariance" vm="1.5" title="covariance 10"> + <compile options="-1.9,-showWeaveInfo" files="CovBaseProgram01.java,CovAspect10.aj"> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:26) advised by before advice from 'CovAspect10' (CovAspect10.aj:5)"/> + <message kind="weave" text="Type 'CovBaseProgram01' (CovBaseProgram01.java:27) advised by before advice from 'CovAspect10' (CovAspect10.aj:5)"/> + </compile> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- Enum tests --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/enums" vm="1.5" title="cant itd constructor on enum"> + <compile files="SimpleEnum.java,SimpleEnum2.java,EnumAspect01.aj" options="-1.9"> + <message kind="error" line="2" text="can't make inter-type constructor declarations on enum types"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/enums" vm="1.5" title="cant itd field or method on enum"> + <compile files="SimpleEnum.java,SimpleEnum2.java,EnumAspect02.aj" options="-1.9"> + <message kind="error" line="2" text="can't make inter-type method declarations on enum types"/> + <message kind="error" line="6" text="can't make inter-type field declarations on enum types"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/enums" vm="1.5" title="declare parents and enums"> + <compile files="SimpleEnum.java,SimpleEnum2.java,EnumAspect03.aj" options="-1.9"> + <message kind="error" line="5" text="can't use declare parents to make enum type SimpleEnum implement an interface"/> + <message kind="error" line="8" text="can't use declare parents to alter supertype of enum type SimpleEnum"/> + <message kind="error" line="11" text="can't use declare parents to make 'java.lang.Enum' the parent of type EnumAspect03$D"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/enums" vm="1.5" title="wildcard enum match in itd"> + <compile files="SimpleEnum.java,SimpleEnum2.java,EnumAspect04.aj" options="-1.9"> + <message kind="warning" line="5" text="enum type SimpleEnum2 matches a declare parents type pattern but is being ignored"/> + <message kind="warning" line="5" text="enum type SimpleEnum matches a declare parents type pattern but is being ignored"/> + </compile> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- pertypewithin tests --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/pertypewithin" title="basic ptw test"> + <compile files="A.java,B.java,C.java,D.java,Main.java,X.java" options="-Xlint:ignore"/> + <run class="p.A"> + <stderr> + <line text="hi from A"/> + <line text="after() returning from a method call to sayhi()"/> + <line text="hi from A"/> + <line text="after() returning from a method call to sayhi()"/> + <line text="Tests in A have passed"/> + <line text="callcount = 2"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/pertypewithin" title="ptw hasAspect"> + <compile files="A.java,B.java,C.java,D.java,Main.java,X.java" options="-Xlint:ignore"/> + <run class="p.B"> + <stderr> + <line text="hi from B"/> + <line text="after() returning from a method call to sayhi()"/> + <line text="hi from B"/> + <line text="after() returning from a method call to sayhi()"/> + <line text="hi from B"/> + <line text="after() returning from a method call to sayhi()"/> + <line text="callcount = 3"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/pertypewithin" title="ptw aspectOf"> + <compile files="A.java,B.java,C.java,D.java,Main.java,X.java" options="-Xlint:ignore"/> + <run class="p.C"/> + </ajc-test> + + <ajc-test dir="java5/pertypewithin" title="ptw multi-aspects"> + <compile files="P.java,Q.java,R.java"/> + <run class="P"> + <stderr> + <line text="Q reporting 2"/> + <line text="R reporting 3"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/pertypewithin" title="ptw binary"> + <weave classesFiles="G.java" aspectsFiles="H.java"/> + <run class="G"> + <stderr> + <line text="advice running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/pertypewithin" title="ptw binary aspect"> + <compile files="H.java" outjar="aspects.jar"> + <message kind="warning" line="1" text="no match for this type name: G"/> + </compile> + <compile files="G.java" aspectpath="aspects.jar"/> + <run class="G"> + <stderr> + <line text="advice running"/> + </stderr> + </run> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- varargs tests --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/varargs" vm="1.5" title="varargs not matched by Object[] (call)"> + <compile files="SimpleVarargs.java,VarargsAspect01.aj" options="-1.9,-showWeaveInfo"> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs" vm="1.5" title="varargs not matched by Object[] (exe)"> + <compile files="SimpleVarargs.java,VarargsAspect02.aj" options="-1.9,-showWeaveInfo"> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs" vm="1.5" title="varargs not matched by Object[] (init)"> + <compile files="SimpleVarargs.java,VarargsAspect03.aj" options="-1.9,-showWeaveInfo"> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs" vm="1.5" title="varargs not matched by Object[] (withincode)"> + <compile files="SimpleVarargs.java,VarargsAspect04.aj" options="-1.9,-showWeaveInfo"> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs" vm="1.5" title="call with varargs signature"> + <compile files="SimpleVarargs.java,VarargsAspect05.aj" options="-1.9,-showWeaveInfo"> + <message kind="weave" text="Type 'SimpleVarargs' (SimpleVarargs.java:20) advised by before advice from 'VarargsAspect05' (VarargsAspect05.aj:3)"/> + <message kind="weave" text="Type 'SimpleVarargs' (SimpleVarargs.java:21) advised by before advice from 'VarargsAspect05' (VarargsAspect05.aj:3)"/> + <message kind="weave" text="Type 'SimpleVarargs' (SimpleVarargs.java:22) advised by before advice from 'VarargsAspect05' (VarargsAspect05.aj:3)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs" vm="1.5" title="call with varargs multi-signature"> + <compile files="SimpleVarargs.java,VarargsAspect06.aj" options="-1.9,-showWeaveInfo"> + <message kind="weave" text="Type 'SimpleVarargs' (SimpleVarargs.java:25) advised by before advice from 'VarargsAspect06' (VarargsAspect06.aj:3)"/> + <message kind="weave" text="Type 'SimpleVarargs' (SimpleVarargs.java:26) advised by before advice from 'VarargsAspect06' (VarargsAspect06.aj:3)"/> + <message kind="weave" text="Type 'SimpleVarargs' (SimpleVarargs.java:27) advised by before advice from 'VarargsAspect06' (VarargsAspect06.aj:3)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/suppressedWarnings" vm="1.5" title="suppressing non-matching advice warnings"> + <compile files="Suppression1.aj" options="-1.9,-showWeaveInfo"> + <message kind="warning" line="13"/> + <message kind="warning" line="21"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/suppressedWarnings" vm="1.5" title="suppressing non-matching advice warnings when multiple source files involved"> + <compile files="A.java,A1.aj,A2.aj,A3.aj" options="-1.9,-showWeaveInfo"> + <message kind="warning" line="4" file="A1.aj"/> + <message kind="warning" line="4" file="A2.aj"/> + <message kind="warning" line="11" file="A2.aj"/> + <message kind="warning" line="4" file="A3.aj"/> + <message kind="warning" line="11" file="A3.aj"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="XLint warning for advice not applied with cflow(execution)" pr="93345"> + <compile options="-Xlint,-1.9" files="PR93345.aj" > + <message kind="warning" line="9" text="advice defined in AnAspect has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150" title="NPE in reflect implementation" pr="94167"> + <compile files="PR94167.java"/> + <run class="reflect.PR94167"/> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- annotated aspect members --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/annotations/aspectMembers" title="annotated annotations (@Target)"> + <compile files="a/Annotations.java,a/Foo.java" options="-1.9"> + <message kind="error" line="16" text="The annotation @MethodAnnotation is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="simple annotated aspect members"> + <compile files="a/Annotations.java,a/AnnotatedAspect.aj" options="-1.9"> + <message kind="warning" line="4" text="annotated type"/> + <message kind="warning" line="6" text="annotated field"/> + <message kind="warning" line="8" text="annotated method"/> + <message kind="warning" line="11" text="annotated constructor"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="simple annotated aspect members with bad target"> + <compile files="a/Annotations.java,a/AnnotatedAspect02.aj" options="-1.9"> + <message kind="error" line="3" text="The annotation @MethodAnnotation is disallowed for this location"/> + <message kind="error" line="6" text="The annotation @TypeAnnotation is disallowed for this location"/> + <message kind="error" line="8" text="The annotation @FieldAnnotation is disallowed for this location"/> + <message kind="error" line="10" text="The annotation @AnnotationAnnotation is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="annotated itds"> + <compile files="a/Annotations.java,a/AnnotatedAspect03.aj" options="-1.9"> + <message kind="warning" line="4" text="annotated type"/> + <message kind="warning" line="6" text="annotated field"/> + <message kind="warning" line="8" text="annotated field"/> + <message kind="warning" line="10" text="annotated method"/> + <message kind="warning" line="12" text="annotated constructor"/> + <message kind="warning" line="12" text="annotated field"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="annotated itds with bad target"> + <compile files="a/Annotations.java,a/AnnotatedAspect04.aj" options="-1.9"> + <message kind="error" line="6" text="The annotation @ConstructorAnnotation is disallowed for this location"/> + <message kind="error" line="8" text="The annotation @FieldAnnotation is disallowed for this location"/> + <message kind="error" line="10" text="The annotation @TypeAnnotation is disallowed for this location"/> + <!-- known limitation... + <message kind="error" line="12" text="The annotation @MethodAnnotation is disallowed for this location"/> + --> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="annotated advice"> + <compile files="a/Annotations.java,a/AnnotatedAspect05.aj" options="-1.9"> + <message kind="warning" line="17"/> + </compile> + <run class="a.AnnotatedAspect05"/> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="annotated advice with bad target"> + <compile files="a/Annotations.java,a/AnnotatedAspect06.aj" options="-1.9"> + <message kind="error" line="6" text="The annotation @ConstructorAnnotation is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="annotated pointcut"> + <compile files="a/Annotations.java,a/AnnotatedAspect07.aj" options="-1.9"> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/aspectMembers" title="annotated declare statements"> + <compile files="a/Annotations.java,a/AnnotatedAspect08.aj" options="-1.9"> + </compile> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- ajdk examples --> + <!-- ======================================================================================= --> + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: annotating aspects chapter"> + <compile files="AnnotatingAspects.aj" options="-1.9"> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: annotating aspects chapter, ex 2"> + <compile files="SuppressAj.aj" options="-1.9"> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: annotation pattern matching"> + <compile files="AnnotationPatternMatching.aj,org/xyz/OrgXYZAnnotation.java" options="-1.9"> + <message kind="warning" line="25" text="@Immutable"/> + <message kind="warning" line="25" text="!@Persistent"/> + <message kind="warning" line="29" text="!@Persistent"/> + <message kind="warning" line="31" text="!@Persistent"/> + <message kind="warning" line="33" text="!@Persistent"/> + <message kind="warning" line="29" text="@Foo @Goo"/> + <message kind="warning" line="29" text="@(Foo || Goo)"/> + <message kind="warning" line="31" text="@(Foo || Goo)"/> + <message kind="warning" line="33" text="@(org.xyz..*)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: annotation type pattern matching"> + <compile files="AnnotationsInTypePatterns.aj,org/xyz/OrgXYZAnnotation.java,org/xyz/Types.java,org/abc/Types.java,anns/Immutable.java,anns/NonPersistent.java" options="-1.9"> + <message kind="warning" line="23" text="(@Immutable *)"/> + <message kind="warning" line="32" text="(@Immutable *)"/> + <message kind="warning" line="3" text="(@Immutable *)"/> + <message kind="warning" line="5" text="(@Immutable *)"/> + <message kind="warning" line="8" text="(@Immutable *)"/> + <message kind="warning" line="25" text="(!@Immutable *)"/> + <message kind="warning" line="27" text="(!@Immutable *)"/> + <message kind="warning" line="29" text="(!@Immutable *)"/> + <message kind="warning" line="5" text="(!@Immutable *)"/> + <message kind="warning" line="6" text="(!@Immutable *)"/> + <message kind="warning" line="2" text="(!@Immutable *)"/> + <message kind="warning" line="2" text="(!@Immutable *)"/> + <message kind="warning" line="5" text="(!@Immutable *)"/> + <message kind="warning" line="3" text="@Immutable (org.xyz.* || org.abc.*)"/> + <message kind="warning" line="5" text="@Immutable (org.xyz.* || org.abc.*)"/> + <message kind="warning" line="8" text="@Immutable (org.xyz.* || org.abc.*)"/> + <message kind="warning" line="32" text="((@Immutable Foo+) || Goo)"/> + <message kind="warning" line="27" text="((@Immutable Foo+) || Goo)"/> + <message kind="warning" line="3" text="@(Immutable || NonPersistent) org.xyz..*"/> + <message kind="warning" line="6" text="@(Immutable || NonPersistent) org.xyz..*"/> + <message kind="warning" line="8" text="@(Immutable || NonPersistent) org.xyz..*"/> + <message kind="warning" line="8" text="@Immutable @NonPersistent org.xyz..*"/> + <message kind="warning" line="6" text="@(@Inherited *) org.xyz..*"/> + <message kind="warning" line="8" text="@(@Inherited *) org.xyz..*"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: annotations in sig patterns"> + <compile files="AnnotationsInSignaturePatterns.aj,anns/Cachable.java,anns/SensitiveData.java,anns/Persisted.java,Classified.java,anns/Immutable.java,Secure.java,Catastrophic.java,Oneway.java,anns/Transaction.java,org/xyz/SignatureTypes.java" options="-1.9"> + <message kind="warning" line="32" text="@SensitiveData * *"/> + <message kind="warning" line="7" text="@SensitiveData * *"/> + <message kind="warning" line="13" text="@SensitiveData * *"/> + <message kind="warning" line="7" text="@SensitiveData List org.xyz..*.*"/> + <message kind="warning" line="11" text="(@SensitiveData *) org.xyz..*.*"/> + <message kind="warning" line="13" text="(@SensitiveData *) org.xyz..*.*"/> + <message kind="warning" line="50" text="@Foo (@Goo *) (@Hoo *).*"/> + <message kind="warning" line="38" text="@Persisted @Classified * *"/> + + <message kind="warning" line="44" text="@Oneway * *(..)"/> + <message kind="warning" line="18" text="@Transaction * (@Persisted org.xyz..*).*(..)"/> + <message kind="warning" line="52" text="* *.*(@Immutable *,..)"/> + <message kind="warning" line="53" text="* *.*(@Immutable *,..)"/> + <message kind="warning" line="54" text="* *.*(@Immutable *,..)"/> + + <message kind="warning" line="62" text="within(@Secure *)"/> + <message kind="warning" line="63" text="within(@Secure *)"/> + <message kind="warning" line="66" text="staticinitialization(@Persisted *)"/> + <message kind="warning" line="17" text="staticinitialization(@Persisted *)"/> + <message kind="warning" line="56" text="call(@Oneway * *(..))"/> + <message kind="warning" line="28" text="execution(public (@Immutable *) org.xyz..*.*(..))"/> + <message kind="warning" line="26" text="set(@Cachable * *)"/> + <message kind="warning" line="80" text="handler(!@Catastrophic *)"/> + + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: runtime annotations"> + <compile files="RuntimeTypeMatching.aj" options="-1.9"> + <message kind="warning" line="121" text="@within(Foo)"/> + <message kind="warning" line="122" text="@within(Foo)"/> + </compile> + <run class="RuntimeTypeMatching"> + <stdout> + <line text="This information is TOP-SECRET"/> + <line text="@target(Classified) at call(void A.a())"/> + <line text="@this(Foo) at execution(void B.b())"/> + <line text="Classified data being passed at call(void B.callA(A))"/> + <line text="Classified data being passed at execution(void B.callA(A))"/> + <line text="This information is TOP-SECRET"/> + <line text="@target(Classified) at call(Class java.lang.Object.getClass())"/> + <line text="1 @Foo()"/> + <line text="1 @Foo()"/> + <line text="1 @Classified(classification=TOP-SECRET)" vm="1.2,1.3,1.4,1.5,1.6,1.7,1.8"/> + <line text="1 @Classified(classification="TOP-SECRET")" vm="9+"/> + <line text="This information is TOP-SECRET"/> + <line text="Entering critical join point with priority 3"/> + <line text="Entering critical join point with reflectively obtained priority 3"/> + <line text="@target(Classified) at call(void A.a())"/> + <line text="@this(Foo) at execution(void B.callA(A))"/> + <line text="(Class) Transaction required at execution(void ByeByeEJB.method1())"/> + <line text="(Method) Transaction required at execution(void ByeByeEJB.method1())"/> + <line text="(Class) Transaction required at execution(void ByeByeEJB.method2())"/> + <line text="(Method) Transaction required at execution(void ByeByeEJB.method2())"/> + <line text="(Class) Transaction required at execution(void ByeByeEJB.method3())"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: @retention checking"> + <compile files="RetentionTime.aj" options="-1.9"> + <message kind="error" line="8" text="Annotation type Goo does not have runtime retention"/> + <message kind="error" line="13" text="Annotation type Goo does not have runtime retention"/> + <message kind="error" line="18" text="Annotation type Goo does not have runtime retention"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: @inherited"> + <compile files="AnnotationInheritance.aj" options="-1.9"> + <message kind="warning" line="16" text="annotatedMethodCall()"/> + <!-- <message kind="warning" line="17" text="annotatedMethodCall()"/> --> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: deow-ann"> + <compile files="DeclaresWithAnnotations.aj,org/xyz/model/Model.java" options="-1.9"> + <message kind="warning" line="27" text="Expensive operation called from within performance critical section"/> + <message kind="error" line="26" text="Untrusted code should not call the model classes directly"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: decp-ann"> + <compile files="DecpAnnotations.aj" options="-1.9"> + </compile> + <run class="DecpAnnotations"> + <stdout> + <line text="Test Foo is not secured: PASS"/> + <line text="Test Goo is secured: PASS"/> + <line text="goo credentials: none"/> + <line text="Test BankAccount is not secured: PASS"/> + <line text="Test PrivateBankAccount is not secured: PASS"/> + <line text="Test BusinessBankAccount is secured: PASS"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: dec precedence"> + <compile files="PrecedenceAnnotations.aj" options="-1.9"> + </compile> + <run class="PrecedenceAnnotations"> + <stdout> + <line text="@Security S2"/> + <line text="S1"/> + <line text="@Performance P2"/> + <line text="P1"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: dec annotation"> + <compile files="DeclareAnnotation.aj,org/xyz/model/Model.java" options="-1.9"> + <message kind="warning" line="3" text="@BusinessDomain"/> + <message kind="warning" line="43" text="@Secured"/> + <message kind="warning" line="44" text="@Secured"/> + <message kind="warning" line="55" text="@Secured"/> + <message kind="warning" line="62" text="@Persisted"/> + <message kind="warning" line="68" text="@Persisted"/> + <message kind="warning" line="41" text="@Secured"/> + <message kind="warning" line="51" text="@Secured"/> + </compile> + <run class="DeclareAnnotation"/> + </ajc-test> + + <ajc-test dir="java5/covariance/ajdk" title="ajdk: covariance"> + <compile files="AJDKExamples.aj" options="-1.9"> + <message kind="warning" line="43" text="call(* whoAreYou())"/> + <message kind="warning" line="44" text="call(* whoAreYou())"/> + <message kind="warning" line="43" text="call(* A.whoAreYou())"/> + <message kind="warning" line="44" text="call(* A.whoAreYou())"/> + <message kind="warning" line="43" text="call(A whoAreYou())"/> + <message kind="warning" line="44" text="call(A whoAreYou())"/> + <message kind="warning" line="44" text="call(A+ B.whoAreYou())"/> + <message kind="warning" line="44" text="call(B whoAreYou())"/> + <message kind="warning" line="44" text="call(B B.whoAreYou())"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/varargs/ajdk" title="ajdk: varargs"> + <compile files="AJDKExamples.aj,org/xyz/Foo.java,org/xyz/Goo.java,org/xyz/Hoo.java" options="-1.9"> + <message kind="warning" line="8" text="call vararg match"/> + <message kind="warning" line="14" text="execution vararg match"/> + <message kind="warning" line="5" text="init vararg match"/> + <message kind="warning" line="6" text="init vararg match"/> + <message kind="warning" line="27" text="single vararg"/> + <message kind="warning" line="28" text="single String[]"/> + <message kind="warning" line="18" text="single String[]"/> + </compile> + <run class="AJDKExamples"> + <stdout> + <line text="Matched at call(void X.foo(int, String[]))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/pertypewithin/ajdk" title="ajdk: ptw"> + <compile files="AJDKExamples.aj" options="-1.9 -showWeaveInfo"> + <message kind="weave" text="Join point 'constructor-execution(void org.xyz.foo.B.<init>())' in Type 'org.xyz.foo.B' (AJDKExamples.aj:38) advised by afterReturning advice from 'org.xyz.foo.AJDKExamples' (AJDKExamples.aj:11)"/> + <message kind="weave" text="Join point 'constructor-execution(void org.xyz.foo.A.<init>())' in Type 'org.xyz.foo.A' (AJDKExamples.aj:36) advised by afterReturning advice from 'org.xyz.foo.AJDKExamples' (AJDKExamples.aj:11)"/> + </compile> + <run class="org.xyz.foo.AJDKExamples"> + <stdout> + <line text="Aspect instance constructed"/> + <line text="Aspect instance constructed"/> + <line text="true"/> + <line text="true"/> + <line text="There are 2 As"/> + <line text="There are 3 Bs"/> + </stdout> + </run> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- declare annotation --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/annotations/declare" title="basic declare annotation parse test"> + <compile files="BasicParseTest.aj" options="-1.9"> + </compile> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- declare annotation (@type) --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/annotations/declare" title="declare @type 1"> + <compile files="DecaType1.java" options="-1.9"/> + <run class="DecaType1"> + <stderr> + <line text="annotation is @MyAnnotation()"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type 2"> + <compile files="DecaType2.java" options="-1.9,-Xlint:ignore" > + </compile> + <run class="DecaType2"> + <stderr> + <line text="annotation on DecaType2 is @MyAnnotation()"/> + <line text="annotation on X is @MyAnnotation()"/> + <line text="annotation on MyAnnotation is @MyAnnotation()"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - with matching pointcut"> + <compile files="DecaType3.java" options="-1.9"/> + <run class="DecaType3"> + <stderr> + <line text="hello world"/> + <line text="advice running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - binary weaving"> + <weave classesFiles="BaseTypes.java" + aspectsFiles="DecaTypeBin1.aj,Colored.java" + options="-1.9" xlintfile="ignoreTypeNotExposed.properties"> + </weave> + <run class="BaseTypes"> + <stderr> + <line text="Color identified on class X"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - complex annotation - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaTypeBin2.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="BaseTypes"> + <stderr> + <line text="ComplexAnnotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - complex annotation - source weaving"> + <compile files="BaseTypes.java,DecaTypeBin2.aj" options="-1.9"/> + <run class="BaseTypes"> + <stderr> + <line text="ComplexAnnotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - two annotations hit one type - source weaving"> + <compile files="BaseTypes.java,DecaTypeBin3.aj" options="-1.9"/> + <run class="BaseTypes"> + <stderr> + <line text="Color identified on execution(void A.m())"/> + <line text="Fruit identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - two annotations hit one type - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaTypeBin3.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="BaseTypes"> + <stderr> + <line text="Color identified on execution(void A.m())"/> + <line text="Fruit identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 1) - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaDecpInteractions1.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 1) - source weaving"> + <compile files="BaseTypes.java,DecaDecpInteractions1.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 2) - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaDecpInteractions2.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 2) - source weaving"> + <compile files="BaseTypes.java,DecaDecpInteractions2.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 3) - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaDecpInteractions3.aj" options="-1.9,-Xlint:ignore"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 3) - source weaving"> + <compile files="BaseTypes.java,DecaDecpInteractions3.aj" options="-1.9,-Xlint:ignore"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 4) - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaDecpInteractions4.aj" options="-1.9,-Xlint:ignore"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + <ajc-test dir="java5/annotations/declare" title="declare @type - declare parents interactions (order 4) - source weaving"> + <compile files="BaseTypes.java,DecaDecpInteractions4.aj" options="-1.9,-Xlint:ignore"/> + <run class="BaseTypes"> + <stderr> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Marker interface identified on execution(void A.m())"/> + <line text="Color annotation identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - annotating an already annotated type - binary weaving"> + <weave classesFiles="AnnotatedType.java" aspectsFiles="DecaTypeBin4.aj" options="-1.9,-Xlint:ignore"/> + <run class="AnnotatedType"> + <stderr> + <line text="Color identified on execution(void AnnotatedType.m())"/> + <line text="Fruit identified on execution(void AnnotatedType.m())"/> + <line text="m() running"/> + </stderr> + </run> + </ajc-test> + <ajc-test dir="java5/annotations/declare" title="declare @type - annotating an already annotated type - source weaving"> + <compile files="AnnotatedType.java,DecaTypeBin4.aj" options="-1.9,-Xlint:ignore"/> + <run class="AnnotatedType"> + <stderr> + <line text="Color identified on execution(void AnnotatedType.m())"/> + <line text="Fruit identified on execution(void AnnotatedType.m())"/> + <line text="m() running"/> + </stderr> + </run> + </ajc-test> + + + <!--ajc-test dir="java5/annotations/declare" title="declare @type - annotations with different targets - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaTypeBin5.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="error" line="15" text="The annotation @ColorM is disallowed for this location"/> + <message kind="error" line="16" text="The annotation @ColorC is disallowed for this location"/> + <message kind="error" line="18" text="The annotation @ColorF is disallowed for this location"/> + <message kind="error" line="19" text="The annotation @ColorP is disallowed for this location"/> + <message kind="error" line="20" text="The annotation @ColorL is disallowed for this location"/> + <message kind="error" line="21" text="The annotation @ColorPkg is disallowed for this location"/> + </weave> + <run class="BaseTypes"> + <stderr> + <line text="ColorT identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test--> + + <ajc-test dir="java5/annotations/declare" title="declare @type - annotations with different targets - source weaving"> + <compile files="BaseTypes.java,DecaTypeBin5.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="error" line="15" text="The annotation @ColorM is disallowed for this location"/> + <message kind="error" line="16" text="The annotation @ColorC is disallowed for this location"/> + <message king="error" line="17" text="A is not a valid target for annotation ColorA"/> + <message kind="error" line="18" text="The annotation @ColorF is disallowed for this location"/> + <message kind="error" line="19" text="The annotation @ColorP is disallowed for this location"/> + <message kind="error" line="20" text="The annotation @ColorL is disallowed for this location"/> + <message kind="error" line="21" text="The annotation @ColorPkg is disallowed for this location"/> + </compile> + </ajc-test> + + <!--ajc-test dir="java5/annotations/declare" title="declare @type - annotations with different targets (using type patterns) - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaTypeBin6.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="warning" line="15" text="A is not a valid target for annotation ColorM"/> + <message kind="warning" line="16" text="A is not a valid target for annotation ColorC"/> + <message kind="warning" line="17" text="A is not a valid target for annotation ColorL"/> + <message kind="warning" line="17" text="B is not a valid target for annotation ColorL"/> + <message kind="warning" line="17" text="C is not a valid target for annotation ColorL"/> + </weave> + <run class="BaseTypes"> + <stderr> + <line text="ColorT identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="ColorT identified on execution(void A.m())"/> + <line text="A.m() running"/> + <line text="ColorT identified on execution(void A.m())"/> + <line text="A.m() running"/> + </stderr> + </run> + </ajc-test--> + + <ajc-test dir="java5/annotations/declare" title="declare @type - annotations with different targets (using type patterns) - source weaving"> + <compile files="BaseTypes.java,DecaTypeBin6.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="error" line="15" text="The annotation @ColorM is disallowed for this location"/> + <message kind="error" line="16" text="The annotation @ColorC is disallowed for this location"/> + <message kind="error" line="17" text="The annotation @ColorL is disallowed for this location"/> + <message kind="error" line="18" text="The annotation @ColorF is disallowed for this location"/> + </compile> + </ajc-test> + + + <ajc-test dir="java5/annotations/declare" title="declare @type - complex decp decAtType interactions - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaTypeBin7.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"> + </weave> + <run class="BaseTypes"> + <stderr> + <line text="Color identified on execution(void A.m())"/> + <line text="Fruit identified on execution(void A.m())"/> + <line text="Chocolate identified on execution(void A.m())"/> + <line text="M1 at execution(void A.m())"/> + <line text="M2 at execution(void A.m())"/> + <line text="M3 at execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Fruit identified on execution(void B.m())"/> + <line text="Chocolate identified on execution(void B.m())"/> + <line text="M1 at execution(void B.m())"/> + <line text="M2 at execution(void B.m())"/> + <line text="M3 at execution(void B.m())"/> + <line text="B.m() running"/> + <line text="Fruit identified on execution(void C.m())"/> + <line text="Chocolate identified on execution(void C.m())"/> + <line text="M1 at execution(void C.m())"/> + <line text="M2 at execution(void C.m())"/> + <line text="M3 at execution(void C.m())"/> + <line text="C.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - complex decp decAtType interactions - source weaving"> + <compile files="BaseTypes.java,DecaTypeBin7.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="BaseTypes"> + <stderr> + <line text="Color identified on execution(void A.m())"/> + <line text="Fruit identified on execution(void A.m())"/> + <line text="Chocolate identified on execution(void A.m())"/> + <line text="M1 at execution(void A.m())"/> + <line text="M2 at execution(void A.m())"/> + <line text="M3 at execution(void A.m())"/> + <line text="A.m() running"/> + <line text="Fruit identified on execution(void B.m())"/> + <line text="Chocolate identified on execution(void B.m())"/> + <line text="M1 at execution(void B.m())"/> + <line text="M2 at execution(void B.m())"/> + <line text="M3 at execution(void B.m())"/> + <line text="B.m() running"/> + <line text="Fruit identified on execution(void C.m())"/> + <line text="Chocolate identified on execution(void C.m())"/> + <line text="M1 at execution(void C.m())"/> + <line text="M2 at execution(void C.m())"/> + <line text="M3 at execution(void C.m())"/> + <line text="C.m() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - trying to put annotation targetting annos on normal types - source weaving"> + <compile files="BaseTypes.java,DecaTypeBin8.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="error" line="8" text="A is not a valid target for annotation ColorA"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - trying to put annotation targetting annos on normal types - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaTypeBin8.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="error" line="8" text="A is not a valid target for annotation ColorA"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - trying to put annotation targetting annos on normal types (uses pattern) - source weaving"> + <compile files="BaseTypes.java,DecaTypeBin9.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="warning" line="8" text="A is not a valid target for annotation ColorA"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - trying to put annotation targetting annos on normal types (uses pattern) - binary weaving"> + <weave classesFiles="BaseTypes.java" aspectsFiles="DecaTypeBin9.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="warning" line="8" text="A is not a valid target for annotation ColorA"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - covering enum and class element values - source weaving"> + <compile files="EnumAndClassValues.aj,FunkyAnnotations.java" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="FunkyAnnotations"> + <stderr> + <line text="hello world"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare @type - covering enum and class element values - binary weaving"> + <weave aspectsFiles="EnumAndClassValues.aj" classesFiles="FunkyAnnotations.java" options="-1.9 -Xdev:Pinpoint" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="FunkyAnnotations"> + <stderr> + <line text="advice running: Red"/> + <line text="advice running: class java.lang.Integer"/> + <line text="method running"/> + </stderr> + </run> + </ajc-test> + + + <!-- ======================================================================================= --> + <!-- declare annotation (@field) --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - simple source weaving"> + <compile files="Base.java,Colored.java,AtField1.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - simple binary weaving"> + <weave classesFiles="Base.java,Colored.java" aspectsFiles="AtField1.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - two the same on one - source weaving"> + <compile files="Base.java,Colored.java,TwoOnOneField.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="warning" text="int Base.publicIntField - already has an annotation of type Colored"/> + </compile> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - two the same on one - binary weaving"> + <weave classesFiles="Base.java,Colored.java" aspectsFiles="TwoOnOneField.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="warning" text="int Base.publicIntField - already has an annotation of type Colored"/> + </weave> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - two different on one - source weaving"> + <compile files="Base.java,Colored.java,Fruit.java,TwoOnOneField2.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"> + </compile> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + <line text="Fruit field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - two different on one - binary weaving"> + <weave classesFiles="Base.java,Colored.java,Fruit.java" aspectsFiles="TwoOnOneField2.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"> + </weave> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + <line text="Fruit field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - wrong target - source weaving"> + <compile files="Base.java,Colored.java,WrongTarget.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="error" line="8" text="The annotation @MethodColoring is disallowed for this location"/> + <message kind="error" line="9" text="The annotation @TypeColoring is disallowed for this location"/> + <!-- xlint warnings that were put in as part of fix for pr115252 --> + <message kind="warning" line="13" text="does not match because annotation @MethodColoring has @Target{ElementType.METHOD} [Xlint:unmatchedTargetKind]"/> + <message kind="warning" line="16" text="does not match because annotation @TypeColoring has @Target{ElementType.TYPE} [Xlint:unmatchedTargetKind]"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - right target - source weaving"> + <compile files="Base.java,Colored.java,RightTarget.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - right target - binary weaving"> + <weave classesFiles="Base.java,Colored.java" aspectsFiles="RightTarget.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - recursive application - source weaving"> + <compile files="Base.java,Colored.java,Fruit.java,RecursiveFields.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Fruit field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - recursive application - binary weaving"> + <weave classesFiles="Base.java,Colored.java,Fruit.java" aspectsFiles="RecursiveFields.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Fruit field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - recursive application (other order) - source weaving"> + <compile files="Base.java,Colored.java,Fruit.java,RecursiveFields2.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Fruit field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atfield" title="declare @field - recursive application (other order) - binary weaving"> + <weave classesFiles="Base.java,Colored.java,Fruit.java" aspectsFiles="RecursiveFields2.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Fruit field access at set(int Base.publicIntField)"/> + </stderr> + </run> + </ajc-test> + <!-- incorrect target type for annotation on field --> + + <!-- incorrect target type for annotation on method --> + <!-- two annotations on one method --> + <!-- two of the same annotation on one method - error --> + <!-- two of the same on one using pattern spec - lint --> + +<!-- need some incorrect signatures in the declare @statements - e.g. declare @constructor: public Base(int): XXX; will blow things up as it uses Base rather than new --> + <!-- incorrect target type for annotation on ctor --> + <!-- two annotations on one ctor --> + <!-- two of the same annotation on one ctor - error --> + <!-- two of the same on one using pattern spec - lint --> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method - simple source weaving"> + <compile files="Base.java,Colored.java,AtMethod1.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored method invocation at call(void Base.m1())"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method - simple binary weaving"> + <weave classesFiles="Base.java,Colored.java" aspectsFiles="AtMethod1.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored method invocation at call(void Base.m1())"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @constructor - simple source weaving"> + <compile files="Base.java,Colored.java,AtCtor1.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored constructor invocation at call(Base(int))"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @constructor - simple binary weaving"> + <weave classesFiles="Base.java,Colored.java" aspectsFiles="AtCtor1.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored constructor invocation at call(Base(int))"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + + + <!-- These tests verify both @method and @ctor behavior - they are so similar it is OK to have them together... --> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method @ctor - wrong target - source weaving"> + <compile files="Base.java,Colored.java,WrongTarget.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="error" line="8" text="The annotation @MethodColoring is disallowed for this location"/> + <message kind="error" line="9" text="The annotation @TypeColoring is disallowed for this location"/> + <message kind="error" line="10" text="The annotation @MethodColoring is disallowed for this location"/> + <message kind="error" line="11" text="The annotation @TypeColoring is disallowed for this location"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method @ctor - right target - source weaving"> + <compile files="Base.java,Colored.java,RightTarget.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored ctor call at call(Base(int))"/> + <line text="Colored method call at call(void Base.m1())"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method @ctor - right target - binary weaving"> + <weave classesFiles="Base.java,Colored.java" aspectsFiles="RightTarget.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="Base"> + <stderr> + <line text="Colored ctor call at call(Base(int))"/> + <line text="Colored method call at call(void Base.m1())"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + +<!-- check @method/@ctor/@field recursively applying, can only happen if a pattern for one of them includes an annotation --> + + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method @ctor - two the same on one - source weaving"> + <compile files="Base.java,Colored.java,TwoOnOneMember.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="warning" text="void Base.m1() - already has an annotation of type Colored"/> + <message kind="warning" text="void Base.<init>(int) - already has an annotation of type Colored"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method @ctor - two the same on one - binary weaving"> + <weave classesFiles="Base.java,Colored.java" aspectsFiles="TwoOnOneMember.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"> + <message kind="warning" text="void Base.m1() - already has an annotation of type Colored"/> + <message kind="warning" text="void Base.<init>(int) - already has an annotation of type Colored"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method @ctor - two different on one - source weaving"> + <compile files="Base.java,Colored.java,Fruit.java,TwoOnOneMember2.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"> + </compile> + <run class="Base"> + <stderr> + <line text="Colored ctor call at Base.java:11"/> + <line text="Fruit ctor call at Base.java:11"/> + <line text="Colored method call at Base.java:15"/> + <line text="Fruit method call at Base.java:15"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare/atmethodctor" title="declare @method @ctor - two different on one - binary weaving"> + <weave classesFiles="Base.java,Colored.java,Fruit.java" aspectsFiles="TwoOnOneMember2.aj" options="-1.9" xlintfile="ignoreTypeNotExposed.properties"> + </weave> + <run class="Base"> + <stderr> + <line text="Colored ctor call at Base.java:11"/> + <line text="Fruit ctor call at Base.java:11"/> + <line text="Colored method call at Base.java:15"/> + <line text="Fruit method call at Base.java:15"/> + <line text="m1() running"/> + <line text="m2() running"/> + <line text="m3() running"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/declare" title="declare all annotations on one class - source weaving"> + <compile files="DeathByAnnotations.aj" options="-1.9,-emacssym" xlintfile="ignoreTypeNotExposed.properties"/> + <run class="p.q.DeathByAnnotations"/> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- annotation binding with ITDs --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd method is annotated"> + <compile files="BindingWithAnnotatedItds1.aj" options="-1.9"/> + <run class="BindingWithAnnotatedItds1"> + <stderr> + <line text="Found apple at jp execution(int A.m()) (BindingWithAnnotatedItds1.aj:8)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd field is annotated"> + <compile files="BindingWithAnnotatedItds2.aj" options="-1.9"/> + <run class="BindingWithAnnotatedItds2"> + <stderr> + <line text="Found banana at jp set(int A.i) (BindingWithAnnotatedItds2.aj:16)"/> + <line text="Found apple at jp set(String A.j) (BindingWithAnnotatedItds2.aj:17)"/> + <line text="Found orange at jp set(int[] A.k) (BindingWithAnnotatedItds2.aj:18)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd ctor is annotated"> + <compile files="BindingWithAnnotatedItds3.aj" options="-1.9"/> + <run class="BindingWithAnnotatedItds3"> + <stderr> + <line text="Found pear at jp execution(A(String)) (BindingWithAnnotatedItds3.aj:8)"/> + <line text="Found orange at jp execution(A(int)) (BindingWithAnnotatedItds3.aj:10)"/> + <line text="Found tomato at jp execution(A(boolean)) (BindingWithAnnotatedItds3.aj:12)"/> + </stderr> + </run> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- declare annotation targetting ITDs --> + <!-- ======================================================================================= --> + + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd method is annotated via declare"> + <compile files="BindingWithDeclaredAnnotationItds1.aj" options="-1.9,-emacssym"/> + <run class="BindingWithDeclaredAnnotationItds1"> + <stderr> + <line text="Found orange at jp call(int A.m()) (BindingWithDeclaredAnnotationItds1.aj:16)"/> + <line text="Found orange at jp execution(int A.m()) (BindingWithDeclaredAnnotationItds1.aj:8)"/> + <line text="Found banana at jp call(int A.n()) (BindingWithDeclaredAnnotationItds1.aj:17)"/> + <line text="Found banana at jp execution(int A.n()) (BindingWithDeclaredAnnotationItds1.aj:10)"/> + <line text="Found tomato at jp call(int A.o()) (BindingWithDeclaredAnnotationItds1.aj:18)"/> + <line text="Found tomato at jp execution(int A.o()) (BindingWithDeclaredAnnotationItds1.aj:12)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd field is annotated via declare"> + <compile files="BindingWithDeclaredAnnotationItds2.aj" options="-1.9,-emacssym"/> + <run class="BindingWithDeclaredAnnotationItds2"> + <stderr> + <line text="Found orange at jp set(int A.i) (BindingWithDeclaredAnnotationItds2.aj:16)"/> + <line text="Found banana at jp set(String A.j) (BindingWithDeclaredAnnotationItds2.aj:17)"/> + <line text="Found apple at jp set(boolean[] A.k) (BindingWithDeclaredAnnotationItds2.aj:18)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd field is annotated multiple times via declare"> + <compile files="BindingWithDeclaredAnnotationItds3.aj" options="-1.9,-emacssym"/> + <run class="BindingWithDeclaredAnnotationItds3"> + <stderr> + <line text="Found fruit orange at jp set(int A.i) (BindingWithDeclaredAnnotationItds3.aj:13)"/> + <line text="Found drink margarita at jp set(int A.i) (BindingWithDeclaredAnnotationItds3.aj:13)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd ctor is annotated via declare"> + <compile files="BindingWithDeclaredAnnotationItds4.aj" options="-1.9,-emacssym"/> + <run class="BindingWithDeclaredAnnotationItds4"> + <stderr> + <line text="Found pear at jp execution(A(String)) (BindingWithDeclaredAnnotationItds4.aj:8)"/> + <line text="Found orange at jp execution(A(int)) (BindingWithDeclaredAnnotationItds4.aj:10)"/> + <line text="Found tomato at jp execution(A(boolean)) (BindingWithDeclaredAnnotationItds4.aj:12)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/suppressedWarnings" title="SuppressAjWarnings raised during matching"> + <compile files="SuppressionDuringMatching.aj" options="-1.9"> + </compile> + </ajc-test> + + <!-- ============================================================== --> + + <ajc-test dir="options/aspectpath" title="dirs on aspectpath"> + <compile files="MyAspect.aj" options="-d out"/> + <compile files="MyClass.java" options="-aspectpath out"> + <message kind="warning" line="3" text="a method"/> + </compile> + </ajc-test> + + <!-- ============================================================== --> + <!-- Start of generics tests --> + <!-- ============================================================== --> + + <ajc-test dir="java5/generics" title="ITD with parameterized type" vm="1.5"> + <compile files="ITDReturningParameterizedType.aj" options="-1.9"/> + <run class="ITDReturningParameterizedType"/> + </ajc-test> + + <ajc-test dir="java5/annotations/binding/bugs" title="AtArgs causes a VerifyError: Unable to pop operand off an empty stack" vm="1.5"> + <compile files="Test3.java" options="-1.9"/> + <run class="Test3"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs/pr91267" title="NPE using generic methods in aspects 1" vm="1.5"> + <compile files="TestBug1.aj" options="-1.9"/> + <run class="TestBug1"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs/pr91267" title="NPE using generic methods in aspects 2" vm="1.5"> + <compile files="TestBug2.aj" options="-1.9"/> + <run class="TestBug2"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs" title="Generics problem with Set" vm="1.5"> + <compile files="PR91053.aj" options="-1.9"/> + <run class="PR91053"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs" title="Compilation error on generic member introduction" vm="1.5"> + <compile files="PR87282.aj" options="-1.9"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs" title="Parameterized types on introduced fields not correctly recognized" vm="1.5"> + <compile files="PR88606.aj" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150" title="enum called Enum, annotation called Annotation, etc"> + <compile files="PR90827.aj" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150" title="Internal compiler error"> + <compile files="PR86832.aj" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150" title="Exploding compile time with if() statements in pointcut"> + <compile files="PR94086.aj" options="-1.9"/> + </ajc-test> + + <!-- generic abstract aspects... --> + + <ajc-test dir="java5/generics/genericaspects" title="static pointcut parameterization suite"> + <compile files="GenericAspectPointcuts.aj" options="-1.9"> + <message kind="warning" line="62" text="kinded-returning-ok"/> + <message kind="warning" line="52" text="kinded-declaring-ok"/> + <message kind="warning" line="67" text="kinded-declaring-ok"/> + <message kind="warning" line="50" text="kinded-params-ok"/> + <message kind="warning" line="56" text="kinded-throws-ok"/> + <message kind="warning" line="64" text="and-ok"/> + <message kind="warning" line="60" text="or-ok"/> + <message kind="warning" line="64" text="or-ok"/> + <message kind="warning" line="67" text="or-ok"/> + <message kind="warning" line="1" text="not-ok"/> + <message kind="warning" line="42" text="not-ok"/> + <message kind="warning" line="72" text="not-ok"/> + <message kind="warning" line="59" text="within-ok"/> + <message kind="warning" line="64" text="withincode-ok"/> + <message kind="warning" line="53" text="handler-ok"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="dynamic pointcut parameterization suite"> + <compile files="GenericAspectRuntimePointcuts.aj" options="-1.9"> + </compile> + <run class="GenericAspectRuntimePointcuts"> + <stdout> + <line text="target-ok an X execution(void X.foo())"/> + <line text="@this-ok @MyAnnotation(value=my-value) execution(void X.foo())"/> + <line text="@target-ok @MyAnnotation(value=my-value) execution(void X.foo())"/> + <line text="@within-ok @MyAnnotation(value=my-value) execution(void X.foo())"/> + <line text="cflow-ok an X a Y set(Y X.y)"/> + <line text="@annotation-ok-sub @MyAnnotation(value=bar) execution(void X.bar())"/> + <line text="@annotation-ok @MyAnnotation(value=bar) execution(void X.bar())"/> + <line text="target-ok an X execution(void X.bar())"/> + <line text="@this-ok @MyAnnotation(value=my-value) execution(void X.bar())"/> + <line text="@target-ok @MyAnnotation(value=my-value) execution(void X.bar())"/> + <line text="@within-ok @MyAnnotation(value=my-value) execution(void X.bar())"/> + <line text="@args-ok @MyAnnotation(value=my-value) execution(void Y.foo(X))"/> + <line text="args-ok an X execution(void Y.foo(X))"/> + <line text="this-ok a Y execution(void Y.foo(X))"/> + <line text="@this-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))"/> + <line text="@target-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))"/> + <line text="@within-ok @MyAnnotation(value=on Y) execution(void Y.foo(X))"/> + <line text="@annotation-ok-sub @MyAnnotation(value=my-value) execution(X Y.bar())"/> + <line text="@annotation-ok @MyAnnotation(value=my-value) execution(X Y.bar())"/> + <line text="this-ok a Y execution(X Y.bar())"/> + <line text="@this-ok @MyAnnotation(value=on Y) execution(X Y.bar())"/> + <line text="@target-ok @MyAnnotation(value=on Y) execution(X Y.bar())"/> + <line text="@within-ok @MyAnnotation(value=on Y) execution(X Y.bar())"/> + <line text="@withincode-ok @MyAnnotation(value=my-value) get(X Y.x)"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="reference to pointcut in generic class"> + <compile files="PointcutsInGenericClasses.aj" options="-1.9"> + <message kind="warning" line="16" text="a match"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="reference to non-parameterized pointcut in generic class"> + <compile files="PointcutsInGenericClasses2.aj" options="-1.9"> + <message kind="error" line="10" text="cannot use a raw type reference to refer to a pointcut in a generic type (use a parameterized reference instead)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="declare parents parameterized"> + <compile files="DecPGenericTest.aj" options="-1.9"> + <message kind="warning" line="16" text="success"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="declare precedence parameterized"> + <compile files="DecPrecedenceGenericTest.aj" options="-1.9 -Xdev:Pinpoint"> + </compile> + <run class="DecPrecedenceGenericTest"> + <stdout> + <line text="A1"/> + <line text="A2"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="declare annotation parameterized"> + <compile files="DecAnnGenericTest.aj" options="-1.9"> + <message kind="warning" line="18" text="@type ok"/> + <message kind="warning" line="20" text="@field ok"/> + <message kind="warning" line="22" text="@constructor ok"/> + <message kind="warning" line="24" text="@method ok"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="multi-level generic abstract aspects"> + <compile files="MultiLevelGenericTest.aj" options="-1.9"> + <message kind="warning" line="23" text="base match"/> + <message kind="warning" line="23" text="middle match"/> + <message kind="warning" line="23" text="top match"/> + </compile> + </ajc-test> + <!-- generic bugs --> + + <ajc-test dir="java5/generics/bugs" title="ITD method with generic arg"> + <compile files="PR97763.aj" options="-1.9"/> + <run class="PR97763"> + <stderr> + <line text="Number of entries=2"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150" title="NPE at ClassScope.java:660 when compiling generic class"> + <compile files="PR95993.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="java5/generics/bugs" title="Problems resolving type name inside generic class"> + <compile files="PR95992.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150" pr="100227" title="inner class with generic enclosing class"> + <compile files="pr100227.aj" options="-1.9"/> + <run class="pr100227"> + <stderr> + <line text="Outer.Inner.inner=2"/> + <line text="Outer.Inner.p() executing"/> + <line text="Generic_Outer.Inner.inner=4"/> + <line text="Generic_Outer.Inner.p() executing"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="bugs150" pr="100260" title="methods inherited from a generic parent"> + <compile files="pr100260.aj" options="-1.9"/> + <run class="pr100260"/> + </ajc-test> + + <!-- end of generic bugs --> + + <!-- generic aspects --> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspects - 1"> + <compile files="GenericAspect1.aj" options="-1.9"> + <message kind="error" line="2" text="only abstract aspects can have type parameters"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspects - 2"> + <compile files="GenericAspect2.aj" options="-1.9"> + <message kind="error" line="9" text="a generic super-aspect must be fully parameterized in an extends clause"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspects - 3"> + <compile files="GenericAspect3.aj" options="-1.9"/> + <run class="GenericAspect3"> + <stderr> + <line text="A"/> + <line text="B"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspects - 4"> + <compile files="ParentChildRelationship.aj" options="-1.9"/> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspect with declare warning using type vars"> + <compile files="DeclareWarningInGenericAspect.aj" options="-1.9"> + <message kind="warning" line="16" text="this method takes a T!"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspect with execution advice using type vars"> + <compile files="ExecutionAdviceInGenericAspect.aj" options="-1.9"> + </compile> + <run class="ExecutionAdviceInGenericAspect"> + <stdout> + <line text="I matched at execution(void C.foo(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspect with anonymous pointcut"> + <compile files="AnonymousPointcutInGenericAspect.aj" options="-1.9"> + </compile> + <run class="AnonymousPointcutInGenericAspect"> + <stdout> + <line text="I matched at execution(void C.foo(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspect declare parents"> + <compile files="DeclareParentsWithTypeVars.aj" options="-1.9"> + </compile> + <run class="DeclareParentsWithTypeVars"> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/genericaspects" title="generic aspect declare soft"> + <compile files="DeclareSoftWithTypeVars.aj" options="-1.9"> + </compile> + <run class="DeclareSoftWithTypeVars"> + <stderr> + <line text="handled exception: io, io, it's off to work we go..."/> + <line text="Successfully converted to domain exception"/> + </stderr> + </run> + </ajc-test> + + <!-- ajdk example --> + <ajc-test dir="java5/generics/genericaspects" title="generic aspects - 5 (ajdk)"> + <compile files="Blob.java,BlobContainment.aj,ParentChildRelationship.aj" options="-1.9"/> + <run class="BlobContainment"/> + </ajc-test> + + <!-- same as above but all types in one file --> + <ajc-test dir="java5/generics/genericaspects" title="generic aspects - 6 (ajdk)"> + <compile files="TheBigOne.java" options="-1.9"/> + <run class="TheBigOne"/> + </ajc-test> + + <!-- end of generic aspects --> + + <!-- generic ITDs --> + + <ajc-test dir="java5/generics/itds" title="ITDs on generic type"> + <compile files="Parse5.java" options="-1.9"> + <message kind="error" line="9"/> + <message kind="error" line="11"/> + <message kind="error" line="13"/> + <message kind="error" line="15"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="itd of non static member"> + <compile files="A.java" options="-1.9"/> + <run class="A"> + <stderr> + <line text="min(2,4)=>2"/> + <line text="max(2,4)=>4"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="itd of static member"> + <compile files="B.java" options="-1.9"/> + <run class="B"> + <stderr> + <line text="min(2,4)=>2"/> + <line text="max(2,4)=>4"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="itd using type parameter"> + <compile files="C.java" options="-1.9"/> + <run class="C"> + <stderr> + <line text="fillthisin..."/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="itd incorrectly using type parameter"> + <compile files="D.java" options="-1.9"/> + <run class="D"> + <stderr> + <line text="fillthisin..."/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="static generic method itd"> + <compile files="StaticGenericMethodITD.aj" options="-1.9"/> + <run class="StaticGenericMethodITD"> + <stderr> + <line text="First=10"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic ctor itd - 1"> + <compile files="GenericCtorITD1.aj" options="-1.9"/> + <run class="GenericCtorITD1"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic ctor itd - 2"> + <compile files="GenericCtorITD2.aj" options="-1.9"/> + <run class="GenericCtorITD2"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic ctor itd - 3"> + <compile files="GenericCtorITD3.aj" options="-1.9"/> + <run class="GenericCtorITD3"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="parameterized method itd - 1"> + <compile files="ParameterizedMethodITD1.aj" options="-1.9"/> + <run class="ParameterizedMethodITD1"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="parameterized method itd - 2"> + <compile files="ParameterizedMethodITD2.aj" options="-1.9"> + <message kind="error" line="9" text="The method simple(List<? extends Number>) in the type Base is not applicable for the arguments (List<A>)"/> + </compile> + </ajc-test> + + + <ajc-test dir="java5/generics/itds" title="parameterized method itd - 3"> + <compile files="ParameterizedMethodITD3.aj" options="-1.9"> + <message kind="error" line="9" text="The method simple(List<? super A>) in the type Base is not applicable for the arguments (List<B>)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="parameterized method itd - 4"> + <compile files="ParameterizedMethodITD4.aj" options="-1.9"/> + <run class="ParameterizedMethodITD4"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 1"> + <compile files="GenericMethodITD1.aj" options="-1.9"/> + <run class="GenericMethodITD1"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 2"> + <compile files="GenericMethodITD2.aj" options="-1.9"> + <message kind="error" line="9" text="Bound mismatch: The generic method simple(List<? extends E>) of type Base is not applicable for the arguments (List<A>). The inferred type A is not a valid substitute for the bounded parameter <E extends Number>"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 3"> + <compile files="GenericMethodITD3.aj" options="-1.9"/> + <run class="GenericMethodITD3"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 4"> + <compile files="GenericMethodITD4.aj" options="-1.9"/> + <run class="GenericMethodITD4"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 5"> + <compile files="GenericMethodITD5.aj" options="-1.9"> + <message kind="error" line="10" text="The method simple(List<E>, List<E>) in the type Base is not applicable for the arguments (List<A>, List<B>)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 6"> + <compile files="GenericMethodITD6.aj" options="-1.9"/> + <run class="GenericMethodITD6"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 7"> + <compile files="GenericMethodITD7.aj" options="-1.9"/> + <run class="GenericMethodITD7"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 8"> + <compile files="GenericMethodITD8.aj" options="-1.9"> + <message kind="error" line="10" text="The method simple(List<E>, List<? extends E>) in the type Base is not applicable for the arguments (List<Number>, List<String>)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 9"> + <compile files="GenericMethodITD9.aj" options="-1.9"/> + <run class="GenericMethodITD9"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 10"> + <compile files="GenericMethodITD10.aj" options="-1.9"> + <message kind="error" line="10" text="Bound mismatch: The generic method crazy(List<R>) of type Base is not applicable for the arguments (List<A>). The inferred type A is not a valid substitute for the bounded parameter <R extends Comparable<? super R>>"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 11"> + <compile files="GenericMethodITD11.aj" options="-1.9"/> + <run class="GenericMethodITD11"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 12"> + <compile files="GenericMethodITD12.aj" options="-1.9"> + <message kind="error" line="10" text="Bound mismatch: The generic method crazy(List<R>) of type Base is not applicable for the arguments (List<A>). The inferred type A is not a valid substitute for the bounded parameter <R extends Foo<? extends R>>"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 13"> + <compile files="GenericMethodITD13.aj" options="-1.9"/> + <run class="GenericMethodITD13"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 14"> + <compile files="GenericMethodITD14.aj" options="-1.9"> + <message kind="error" line="10" text="Bound mismatch: The generic method crazy(List<R>) of type Base is not applicable for the arguments (List<A>). The inferred type A is not a valid substitute for the bounded parameter <R extends Foo<? super R>>"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic method itd - 15"> + <compile files="GenericMethodITD15.aj" options="-1.9"/> + <run class="GenericMethodITD15"/> + </ajc-test> + + <!-- visibility --> + + <ajc-test dir="java5/generics/itds/visibility" title="public itds"> + <compile files="PublicITDs.aj" options="-1.9"/> + <run class="PublicITDs"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/visibility" title="private itds"> + <compile files="PrivateITDs.aj" options="-1.9"/> + <run class="PrivateITDs"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/visibility" title="package itds"> + <compile files="PackageITDs.aj" options="-1.9"/> + <run class="PackageITDs"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/visibility" title="public itds with errors"> + <compile files="PublicITDsErrors.aj" options="-1.9"> + <message kind="error" line="13" text="The method publicMethod2(List<R>, List<R>) in the type Base is not applicable for the arguments (List<Double>, List<Float>)"/> + <message kind="error" line="15" text="The constructor Base(List<Double>, Map<Integer,String>) is undefined"/> + </compile> + </ajc-test> + + <!-- targetting different types --> + + <ajc-test dir="java5/generics/itds/differingTargets" title="targetting interface"> + <compile files="TargettingInterface.aj" options="-1.9"/> + <run class="TargettingInterface"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/differingTargets" title="targetting aspect"> + <compile files="TargettingAspect.aj" options="-1.9"/> + <run class="TargettingAspect"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/differingTargets" title="targetting class"> + <compile files="TargettingClass.aj" options="-1.9"/> + <run class="TargettingClass"/> + </ajc-test> + + <!-- sharing type variables between the ITD and the generic type --> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 1"> + <compile files="FieldA.aj" options="-1.9"/> + <run class="FieldA"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 2"> + <compile files="FieldB.aj" options="-1.9"> + <message kind="error" line="16" text="Incorrect number of type parameters supplied. The generic type Base<N,M> has 2 type parameters, not 1."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 3"> + <compile files="FieldC.aj" options="-1.9"/> + <run class="FieldC"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 4"> + <compile files="FieldD.aj" options="-1.9"/> + <run class="FieldD"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 5"> + <compile files="FieldE.aj" options="-1.9"/> + <run class="FieldE"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 6"> + <compile files="FieldF.aj" options="-1.9"/> + <run class="FieldF"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 7"> + <compile files="FieldG.aj" options="-1.9"/> + <run class="FieldG"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 8"> + <compile files="FieldH.aj" options="-1.9"/> + <run class="FieldH"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type - 9"> + <compile files="FieldI.aj" options="-1.9"> + <message kind="error" line="7" text="Type mismatch: cannot convert from List<String> to List<Integer>"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -10"> + <compile files="FieldJ.aj" options="-1.9"/> + <run class="FieldJ"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -11"> + <compile files="FieldK.aj" options="-1.9"/> + <run class="FieldK"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -12"> + <compile files="FieldL.aj" options="-1.9"/> + <run class="FieldL"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -13"> + <compile files="FieldM.aj" options="-1.9"/> + <run class="FieldM"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -14"> + <compile files="FieldN.aj" options="-1.9"> + <message kind="error" line="11" text="Type parameters can not be specified in the ITD target type - the target type I is not generic."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -15"> + <compile files="FieldO.aj" options="-1.9"> + <message kind="error" line="11" text="Intertype declarations can only be made on the generic type, not on a parameterized type. The name 'String' cannot be used as a type parameter, since it refers to a real type."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -16"> + <compile files="FieldP.aj" options="-1.9"> + <message kind="error" line="10" text="static intertype field declarations cannot refer to type variables from the target generic type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd using type variable from target type -17"> + <compile files="FieldQ.aj" options="-1.9"/> + <run class="FieldQ"/> + </ajc-test> + + <!-- Now intertype declared methods on generic types that use the target types type vars --> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - A1"> + <compile files="MethodA.aj" options="-1.9"/> + <run class="MethodA"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - A2"> + <compile files="MethodA2.aj" options="-1.9"/> + <run class="MethodA2"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - A3"> + <compile files="MethodA3.aj" options="-1.9"/> + <run class="MethodA3"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - A4"> + <compile files="MethodA4.aj" options="-1.9"/> + <run class="MethodA4"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - B1"> + <compile files="MethodB.aj" options="-1.9"> + <message kind="error" line="16" text="Incorrect number of type parameters supplied. The generic type Base<N,M> has 2 type parameters, not 1."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - C1"> + <compile files="MethodC.aj" options="-1.9"/> + <run class="MethodC"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - D1"> + <compile files="MethodD.aj" options="-1.9"/> + <run class="MethodD"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - E1"> + <compile files="MethodE.aj" options="-1.9"/> + <run class="MethodE"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - F1"> + <compile files="MethodF.aj" options="-1.9"/> + <run class="MethodF"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - G1"> + <compile files="MethodG.aj" options="-1.9"/> + <run class="MethodG"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - H1"> + <compile files="MethodH.aj" options="-1.9"/> + <run class="MethodH"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - I1"> + <compile files="MethodI.aj" options="-1.9"> + <message kind="error" line="6" text="Type mismatch: cannot convert from List<Integer> to List<String>"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - I2"> + <compile files="MethodI2.aj" options="-1.9"> + <message kind="error" line="7" text="The method m(List<Integer>) in the type Base<Integer> is not applicable for the arguments (List<String>)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - J1"> + <compile files="MethodJ.aj" options="-1.9"/> + <run class="MethodJ"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - K1"> + <compile files="MethodK.aj" options="-1.9"/> + <run class="MethodK"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - L1"> + <compile files="MethodL.aj" options="-1.9"/> + <run class="MethodL"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - M1"> + <compile files="MethodM.aj" options="-1.9"/> + <run class="MethodM"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - M2"> + <compile files="MethodM2.aj" options="-1.9"/> + <run class="MethodM2"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - N1"> + <compile files="MethodN.aj" options="-1.9"> + <message kind="error" line="11" text="Type parameters can not be specified in the ITD target type - the target type I is not generic."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - O1"> + <compile files="MethodO.aj" options="-1.9"> + <message kind="error" line="11" text="Intertype declarations can only be made on the generic type, not on a parameterized type. The name 'String' cannot be used as a type parameter, since it refers to a real type."/> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - O2"> + <compile files="MethodO2.aj" options="-1.9"> + <message kind="error" line="11" text="Intertype declarations can only be made on the generic type, not on a parameterized type. The name 'String' cannot be used as a type parameter, since it refers to a real type."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - P1"> + <compile files="MethodP.aj" options="-1.9"/> + <run class="MethodP"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd using type variable from target type - Q1"> + <compile files="MethodQ.aj" options="-1.9"/> + <run class="MethodQ"/> + </ajc-test> + + <!-- Now intertype declared constructors on generic types that use the target types type vars --> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - A1"> + <compile files="CtorA.aj" options="-1.9"/> + <run class="CtorA"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - B1"> + <compile files="CtorB.aj" options="-1.9"> + <message kind="error" line="15" text="Incorrect number of type parameters supplied. The generic type Base<N,M> has 2 type parameters, not 1."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - C1"> + <compile files="CtorC.aj" options="-1.9"/> + <run class="CtorC"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - D1"> + <compile files="CtorD.aj" options="-1.9"/> + <run class="CtorD"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - E1"> + <compile files="CtorE.aj" options="-1.9"/> + <run class="CtorE"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - F1"> + <compile files="CtorF.aj" options="-1.9"/> + <run class="CtorF"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - G1"> + <compile files="CtorG.aj" options="-1.9"/> + <run class="CtorG"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - H1"> + <compile files="CtorH.aj" options="-1.9"/> + <run class="CtorH"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="ctor itd using type variable from target type - I1"> + <compile files="CtorI.aj" options="-1.9"/> + <run class="CtorI"/> + </ajc-test> + + <!-- putting it all together, fields/methods/ctors and decps --> + + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - A"> + <compile files="GenericAspectA.aj" options="-1.9"/> + <run class="GenericAspectA"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - B"> + <compile files="GenericAspectB.aj" options="-1.9"/> + <run class="GenericAspectB"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - C"> + <compile files="GenericAspectC.aj" options="-1.9"/> + <run class="GenericAspectC"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - D"> + <compile files="GenericAspectD.aj" options="-1.9"/> + <run class="GenericAspectD"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - E"> + <compile files="GenericAspectE.aj" options="-1.9"/> + <run class="GenericAspectE"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - F"> + <compile files="GenericAspectF.aj" options="-1.9"/> + <run class="GenericAspectF"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - G"> + <compile files="GenericAspectG.aj" options="-1.9"/> + <run class="GenericAspectG"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - H"> + <compile files="GenericAspectH.aj" options="-1.9"> + <message kind="error" line="7" text="Type java.lang.String does not meet the specification for type parameter 1 (N extends java.lang.Number) in generic type GenericAspect$SimpleI"/> + <!-- see pr133307, shame about this --> + <!--message kind="error" line="16" text="The method m4(String) is undefined for the type Base"/--> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - I"> + <compile files="GenericAspectI.aj" options="-1.9"/> + <run class="GenericAspectI"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - J"> + <compile files="GenericAspectJ.aj" options="-1.9"/> + <run class="GenericAspectJ"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - K"> + <compile files="GenericAspectK.aj" options="-1.9"> + <message kind="error" line="7" text="B does not meet the specification for type parameter 1 (L extends java.lang.Number) in generic type GenericAspect$SimpleI"/> + <message kind="error" line="16" text="The method m4(String) is undefined for the type Base"/> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - K2"> + <compile files="GenericAspectK2.aj" options="-1.9"> + <message kind="error" line="13" text="The type String is not a valid substitute"/> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - L"> + <compile files="GenericAspectL.aj" options="-1.9"/> + <run class="GenericAspectL"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - M"> + <compile files="GenericAspectM.aj" options="-1.9"> + <message kind="error" line="23" text="The method m0(Integer) in the type GenericAspect.SimpleI<Integer> is not applicable for the arguments (String)"/> + <message kind="error" line="24" text="The method m1(List<Integer>) in the type GenericAspect.SimpleI<Integer> is not applicable for the arguments (List<String>)"/> + <message kind="error" line="25" text="Type mismatch: cannot convert from String to Integer"/> + <message kind="error" line="26" text="Type mismatch: cannot convert from List<String> to List<Integer>"/> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - N"> + <compile files="GenericAspectN.aj" options="-1.9"/> + <run class="GenericAspectN"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - O"> + <compile files="GenericAspectO.aj" options="-1.9"> + <message kind="error" line="24" text="Cannot make a static reference to the non-static field Bottom.parent"/> + <message kind="error" line="26" text="The method add(Bottom) in the type List<Bottom> is not applicable for the arguments (Top)"/> + <message kind="error" line="27" text="Cannot make a static reference to the non-static field Top.children"/> + </compile> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - P"> + <compile files="GenericAspectP.aj" options="-1.9"/> + <run class="GenericAspectP"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - Q"> + <compile files="GenericAspectQ.aj" options="-1.9"/> + <run class="GenericAspectQ"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - R"> + <compile files="GenericAspectR.aj" options="-1.9"/> + <run class="GenericAspectR"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - S"> + <compile files="GenericAspectS.aj" options="-1.9"/> + <run class="GenericAspectS"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - T"> + <compile files="GenericAspectT.aj" options="-1.9"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - U"> + <compile files="GenericAspectU.aj" options="-1.9"/> + <run class="GenericAspectU"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - V"> + <compile files="GenericAspectV.aj" options="-1.9"/> + <run class="GenericAspectV"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - W"> + <compile files="GenericAspectW.aj" options="-1.9"/> + <run class="GenericAspectW"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - X"> + <compile files="GenericAspectX.aj" options="-1.9"/> + <run class="GenericAspectX"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - Y"> + <compile files="GenericAspectY.aj" options="-1.9 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void ParentChildRelationship$ParentHasChildren.addChild(C))' in Type 'ParentChildRelationship' (GenericAspectY.aj:53) advised by before advice from 'GenericAspectY' (GenericAspectY.aj:101) [with runtime test]"/> + <message kind="weave" text="Extending interface set for type 'Top' (GenericAspectY.aj) to include 'ParentChildRelationship$ParentHasChildren<Bottom>' (GenericAspectY.aj)"/> + <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<Bottom> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<Bottom> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.addChild(Bottom)')"/> + <message kind="weave" text="Type 'Top' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(Bottom)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.addChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'P ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'P ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/> + <message kind="weave" text="Extending interface set for type 'Bottom' (GenericAspectY.aj) to include 'ParentChildRelationship$ChildHasParent<Top>' (GenericAspectY.aj)"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectY.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectY.aj:'Top ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'Top ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectY.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectY.aj:'void ParentChildRelationship$ChildHasParent.setParent(Top)')"/> + </compile> + <run class="GenericAspectY"/> + </ajc-test> + <ajc-test dir="java5/generics/genericaspects/" title="uberaspects - Z"> + <compile files="GenericAspectZ.aj" options="-1.9 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void ParentChildRelationship$ParentHasChildren.addChild(C))' in Type 'ParentChildRelationship' (GenericAspectZ.aj:53) advised by before advice from 'GenericAspectZ' (GenericAspectZ.aj:95) [with runtime test]"/> + <message kind="weave" text="Join point 'method-execution(void ParentChildRelationship$ParentHasChildren.removeChild(C))' in Type 'ParentChildRelationship' (GenericAspectZ.aj:65) advised by before advice from 'GenericAspectZ' (GenericAspectZ.aj:96) [with runtime test]"/> + + <message kind="weave" text="Extending interface set for type 'Top' (GenericAspectZ.aj) to include 'ParentChildRelationship$ParentHasChildren<Bottom>' (GenericAspectZ.aj)"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<Bottom> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<Bottom> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.addChild(Bottom)')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(Bottom)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.addChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'P ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'P ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/> + <message kind="weave" text="Extending interface set for type 'Bottom' (GenericAspectZ.aj) to include 'ParentChildRelationship$ChildHasParent<Top>' (GenericAspectZ.aj)"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'Top ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'Top ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ChildHasParent.setParent(Top)')"/> + + <!--message kind="weave" text="Extending interface set for type 'Top' (GenericAspectZ.aj) to include 'ParentChildRelationship$ParentHasChildren<Bottom>' (GenericAspectZ.aj)"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.addChild(C)')"/> + <message kind="weave" text="Type 'Top' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.children')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'java.util.List<C> ParentChildRelationship$ParentHasChildren.getChildren()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.addChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ParentHasChildren' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ParentHasChildren.removeChild(C)')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'ParentChildRelationship$ChildHasParent' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/> + <message kind="weave" text="Extending interface set for type 'Bottom' (GenericAspectZ.aj) to include 'ParentChildRelationship$ChildHasParent<Top>' (GenericAspectZ.aj)"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped field from 'ParentChildRelationship' (GenericAspectZ.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.parent')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'ParentChildRelationship$ParentHasChildren ParentChildRelationship$ChildHasParent.getParent()')"/> + <message kind="weave" text="Type 'Bottom' (GenericAspectZ.aj) has intertyped method from 'ParentChildRelationship' (GenericAspectZ.aj:'void ParentChildRelationship$ChildHasParent.setParent(P)')"/--> + </compile> + <run class="GenericAspectZ"/> + </ajc-test> + + <ajc-test dir="java5/generics/binaryBridging" title="binary bridge methods - two"> + <compile files="TwoA.java" outjar="twoa.jar" options="-1.9"/> + <compile files="TwoB.java" outjar="twob.jar" options="-1.9"/> + <compile files="TwoX.java" inpath="twoa.jar;twob.jar" options="-1.9"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="method itd sharing type variable with generic type"> + <compile files="Simple.aj" options="-1.9"/> + <run class="Simple"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/sharing" title="field itd sharing type variable with generic type"> + <compile files="Simple2.aj" options="-1.9"/> + <run class="Simple2"/> + </ajc-test> + + + <ajc-test dir="java5/generics/itds" title="non static generic method itd - 2"> + <compile files="NonstaticGenericCtorITD2.aj" options="-1.9"/> + <run class="NonstaticGenericCtorITD2"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="reusing type variable letters"> + <compile files="ReusingLetters.aj" options="-1.9"/> + <run class="ReusingLetters"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="multiple generic itds in one file"> + <compile files="BizarroSignatures.aj" options="-1.9"/> + <run class="BizarroSignatures"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="generic intertype field declaration, sharing type variable"> + <compile files="FieldITDOnGenericType.aj" options="-1.9"/> + <run class="FieldITDOnGenericType"> + <stderr> + <line text=">42"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="Parsing generic ITDs - 1"> + <compile files="Parse1.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="Parsing generic ITDs - 2"> + <compile files="Parse2.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="Parsing generic ITDs - 3"> + <compile files="Parse3.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="Parsing generic ITDs - 4"> + <compile files="Parse4.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="Parsing generic ITDs - 5"> + <compile files="Parse5.java" options="-1.9"> + <message kind="error" line="11" text="Incorrect number of type parameters supplied. The generic type Parse5<T,S> has 2 type parameters, not 3."/> + <message kind="error" line="13" text="Incorrect number of type parameters supplied. The generic type Parse5<T,S> has 2 type parameters, not 1."/> + <message kind="error" line="15" text="Intertype declarations can only be made on the generic type, not on a parameterized type. The name 'String' cannot be used as a type parameter, since it refers to a real type."/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/itds" title="Parsing generic ITDs - 6"> + <compile files="Parse6.java" options="-1.9"/> + </ajc-test> + + <!-- end of generic ITDs --> + + <!-- generic decps --> + + <ajc-test dir="java5/generics/decp" title="generic decp - simple"> + <compile files="Basic.aj" options="-1.9"/> + <run class="Basic"/> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - implementing two variants #1"> + <compile files="Basic2.aj" options="-1.9"> + <message kind="error" line="11" text="Cannot declare parent I<java.lang.Integer> onto type Basic2 since it already has I<java.lang.String> in its hierarchy"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - implementing two variants #2"> + <compile files="Basic2b.aj" options="-1.9"> + <message kind="error" line="10" text="Cannot declare parent I<java.lang.Integer> onto type Basic2b since it already has I in its hierarchy"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - implementing two variants #3"> + <compile files="Basic2c.aj" options="-1.9"> + <message kind="error" line="10" text="Cannot declare parent I onto type Basic2c since it already has I<java.lang.Double> in its hierarchy"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - implementing two variants #4"> + <compile files="Basic2d.aj" options="-1.9"/> + </ajc-test> + + <ajc-test dir="java5/generics/decp/binary" title="generic decp binary - implementing two variants #1"> + <weave classesFiles="Base1.java" aspectsFiles="Asp1.aj" options="-1.9,-showWeaveInfo"> + <message kind="error" line="2" text="Cannot declare parent I<java.lang.Integer> onto type Base1 since it already has I<java.lang.String> in its hierarchy"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/generics/decp/binary" title="generic decp binary - implementing two variants #2"> + <weave classesFiles="Base2.java" aspectsFiles="Asp2.aj" options="-1.9,-showWeaveInfo"> + <message kind="error" line="2" text="Cannot declare parent I<java.lang.Integer> onto type Base2 since it already has I in its hierarchy"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/generics/decp/binary" title="generic decp binary - implementing two variants #3"> + <weave classesFiles="Base3.java" aspectsFiles="Asp3.aj" options="-1.9,-showWeaveInfo"> + <message kind="error" line="2" text="Cannot declare parent I onto type Base3 since it already has I<java.lang.Double> in its hierarchy"/> + </weave> + </ajc-test> + + <ajc-test dir="java5/generics/decp/binary" title="generic decp binary - implementing two variants #4"> + <weave classesFiles="Base4.java" aspectsFiles="Asp4.aj" options="-1.9,-showWeaveInfo"/> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - incorrect number of type parameters"> + <compile files="Basic3.aj" options="-1.9"> + <message kind="error" line="10" text="Type pattern does not match because the wrong number of type parameters are specified: Type I requires 1 parameter(s)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - specifying bounds"> + <compile files="Basic4.aj" options="-1.9"/> + <run class="Basic4"/> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - specifying bounds but breaking them"> + <compile files="Basic5.aj" options="-1.9"> + <message kind="error" line="7" text="Type java.lang.String does not meet the specification for type parameter 1 (T extends java.lang.Number) in generic type I"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/decp" title="generic decp - with parameterized on the target"> + <compile files="Basic6.aj" options="-1.9,-showWeaveInfo"> + <message kind="weave" text="Extending interface set for type 'Basic6' (Basic6.aj) to include 'K<java.lang.Integer>' (Basic6.aj)"/> + </compile> + <run class="Basic6"/> + </ajc-test> + + <!-- end of generic decps --> + + <!-- generics/itds and binary weaving --> + + <ajc-test dir="java5/generics/itds/binaryweaving" vm="1.5" title="binary weaving ITDs - A"> + <compile files="TestA_generictype.java" outjar="code.jar" options="-1.9"/> + <compile files="TestA_aspect.aj,TestA_class.java" inpath="code.jar" options="-1.9"/> + <run class="TestA_class"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/binaryweaving" vm="1.5" title="binary weaving ITDs - B"> + <compile files="TestB_generictype.java" outjar="code.jar" options="-1.9"/> + <compile files="TestB_aspect1.aj,TestB_aspect2.aj,TestB_class.java" inpath="code.jar" options="-1.9"/> + <run class="TestB_class"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/binaryweaving" vm="1.5" title="binary weaving ITDs - 1"> + <compile files="BaseClass.java" outjar="code.jar" options="-1.9"/> + <compile files="A1.aj" inpath="code.jar" options="-1.9"/> + <run class="BaseClass"> + <stderr> + <line text="Advice count=1"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds/binaryweaving" vm="1.5" title="binary weaving ITDs - 2"> + <compile files="BaseClass.java,A1.aj" outjar="code.jar" options="-1.9,-showWeaveInfo"> + <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A1' (A1.aj:'java.util.List<java.lang.String> BaseClass.list1')"/> + <message kind="weave" text="Type 'BaseClass' (BaseClass.java:12) advised by after advice from 'A1' (A1.aj:7)"/> + </compile> + <compile files="A2.aj" inpath="code.jar" options="-1.9,-showWeaveInfo"> + <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A1' (A1.aj:'java.util.List<java.lang.String> BaseClass.list1')"/> + <message kind="weave" text="Type 'BaseClass' (BaseClass.java:12) advised by after advice from 'A1' (code.jar!A1.class:7(from A1.aj))"/> + <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A2' (A2.aj:'java.util.List<N> BaseClass.list2')"/> + <message kind="weave" text="Type 'BaseClass' (BaseClass.java:13) advised by after advice from 'A2' (A2.aj:8)"/> + </compile> + <run class="BaseClass"> + <stderr> + <line text="Advice count=2"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds/binaryweaving" vm="1.5" title="binary weaving ITDs - 3"> + <compile files="BaseClass.java,A1.aj,A2.aj" outjar="code.jar" options="-1.9"/> + <compile files="A3.aj" inpath="code.jar" options="-1.9"/> + <run class="BaseClass"> + <stderr> + <line text="Advice count=3"/> + </stderr> + </run> + </ajc-test> + + <!-- end of generics/itds and binary weaving --> + + <!-- generics/itds and bridge methods --> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 1"> + <compile files="Sub1.java,Super1.java,X1.aj" options="-1.9"/> + <run class="X1"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 1 - binary"> + <compile files="Sub1.java,Super1.java" outjar="code.jar" options="-1.9"/> + <compile files="X1.aj" inpath="code.jar" options ="-1.9"/> + <run class="X1"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 2"> + <compile files="Sub2.java,Super2.java,X2.aj" options="-1.9"/> + <run class="X2"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 2 - binary"> + <compile files="Sub2.java,Super2.java" outjar="code.jar" options="-1.9"/> + <compile files="X2.aj,Util.java" inpath="code.jar" options ="-1.9"/> + <run class="X2"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 3"> + <compile files="Sub3.java,Super3.java,X3.aj" options="-1.9"/> + <run class="X3"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 3 - binary"> + <compile files="Sub3.java,Super3.java" outjar="code.jar" options="-1.9"/> + <compile files="X3.aj" inpath="code.jar" options ="-1.9"/> + <run class="X3"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 4"> + <compile files="Sub4.java,Super4.java,X4.aj" options="-1.9"/> + <run class="X4"/> + </ajc-test> + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridge methods - 4 - binary"> + <compile files="Sub4.java,Super4.java" outjar="code.jar" options="-1.9"/> + <compile files="X4.aj" inpath="code.jar" options ="-1.9"/> + <run class="X4"/> + </ajc-test> + + <ajc-test dir="java5/generics/binaryBridging" title="binary bridge methods - one"> + <compile files="OneA.java" outjar="onea.jar" options="-1.9"/> + <compile files="OneB.java" outjar="oneb.jar" options="-1.9"/> + <compile files="OneX.java" inpath="onea.jar;oneb.jar" options="-1.9"/> + </ajc-test> + + <ajc-test dir="java5/generics/binaryBridging" title="binary bridge methods - two"> + <compile files="TwoA.java" outjar="twoa.jar" options="-1.9"/> + <compile files="TwoB.java" outjar="twob.jar" options="-1.9"/> + <compile files="TwoX.java" inpath="twoa.jar;twob.jar" options="-1.9"/> + </ajc-test> + + <ajc-test dir="java5/generics/binaryBridging" title="binary bridge methods - three"> + <compile files="ThreeA.java" outjar="threea.jar" options="-1.9"/> + <compile files="ThreeB.java" outjar="threeb.jar" options="-1.9"/> + <compile files="ThreeX.java" inpath="threea.jar;threeb.jar" options="-1.9"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="abstract intertype methods and covariant returns"> + <compile files="pr91381.aj" options="-1.9"/> + <run class="pr91381"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" title="abstract intertype methods and covariant returns - error"> + <compile files="pr91381_2.aj"> + <message kind="error" line="15" text="The return type is incompatible with A.foo()"/> + </compile> + </ajc-test> + + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridging with covariance 1 - normal"> + <compile files="Bridging1.aj,Util.java" options="-1.9"/> + <run class="Bridging1"> + <stderr> + <line text="Number of methods defined for D is 2"/> + <line text="C D.method1() [BridgeMethod]"/> + <line text="D D.method1()"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="bridging with covariance 1 - itd"> + <compile files="BridgingITD1.aj,Util.java" options="-1.9"/> + <run class="BridgingITD1"> + <stderr> + <line text="Number of methods defined for D is 2"/> + <line text="C D.method1() [BridgeMethod]"/> + <line text="D D.method1()"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="basic bridging with type vars - 1 - normal"> + <compile files="Bridging2.aj,Util.java" options="-1.9"/> + <run class="Bridging2"> + <stderr> + <line text="Number of methods defined for D is 2"/> + <line text="java.lang.Object D.next() [BridgeMethod]"/> + <line text="java.lang.String D.next()"/> + </stderr> + </run> + </ajc-test> + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="basic bridging with type vars - 1 - itd"> + <compile files="BridgingITD2.aj,Util.java" options="-1.9"/> + <run class="BridgingITD2"> + <stderr> + <line text="Number of methods defined for D is 2"/> + <line text="java.lang.Object D.next() [BridgeMethod]"/> + <line text="java.lang.String D.next()"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="basic bridging with type vars - 2 - normal"> + <compile files="Bridging3.aj,Util.java" options="-1.9"/> + <run class="Bridging3"> + <stderr> + <line text="Number of methods defined for D is 2"/> + <line text="java.lang.Object D.id(java.lang.Object) [BridgeMethod]"/> + <line text="java.lang.String D.id(java.lang.String)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="basic bridging with type vars - 2 - itd"> + <compile files="BridgingITD3.aj,Util.java" options="-1.9"/> + <run class="BridgingITD3"> + <stderr> + <line text="Number of methods defined for D is 2"/> + <line text="java.lang.Object D.id(java.lang.Object) [BridgeMethod]"/> + <line text="java.lang.String D.id(java.lang.String)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/itds/bridgeMethods" vm="1.5" title="Abstract intertype method and covariant returns" pr="91381"> + <compile files="pr91381.aj" options="-1.9,-showWeaveInfo"> + <message kind="weave" text="Type 'A' (pr91381.aj) has intertyped method from 'pr91381' (pr91381.aj:'java.lang.Object A.foo()')"/> + </compile> + <run class="pr91381"/> + </ajc-test> + <!-- end of generics/itds and bridge methods --> + + + <!-- generics and pointcuts --> + + <ajc-test dir="java5/generics/pointcuts" title="handler pcd and generics / type vars"> + <compile files="GenericInterface.java,HandlerPointcutTests.aj" options="-1.9"> + <message kind="error" line="4" text="Syntax error on token"/> + <message kind="error" line="8" text="a parameterized type pattern may not be used in a handler pointcut expression"/> + <message kind="warning" line="8" text="no match for this type name: T"/> + <message kind="error" line="11" text="a parameterized type pattern may not be used in a handler pointcut expression"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="pointcuts that dont allow type vars"> + <compile files="PointcutsThatDontAllowTypeVars.aj" options="-1.9"> + <message kind="error" line="3" text="Syntax error on token"/> + <message kind="error" line="5" text="Syntax error on token"/> + <message kind="error" line="7" text="Syntax error on token"/> + <message kind="error" line="9" text="Syntax error on token"/> + <message kind="error" line="11" text="Syntax error on token"/> + <message kind="error" line="13" text="Syntax error on token"/> + <message kind="error" line="15" text="Syntax error on token"/> + <message kind="error" line="17" text="Syntax error on token"/> + <message kind="error" line="19" text="Syntax error on token"/> + <message kind="error" line="21" text="Syntax error on token"/> + <message kind="error" line="23" text="Syntax error on token"/> + <message kind="error" line="25" text="Syntax error on token"/> + <message kind="error" line="27" text="Syntax error on token"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="annotation pcds with parameterized types"> + <compile files="ParameterizedTypesInAtPCDs.aj" options="-1.9"> + <message kind="error" line="3" text="Syntax error on token"/> + <message kind="error" line="5" text="Syntax error on token"/> + <message kind="error" line="7" text="Syntax error on token"/> + <message kind="error" line="9" text="Syntax error on token"/> + <message kind="error" line="11" text="Syntax error on token"/> + <message kind="error" line="13" text="Syntax error on token"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="annotation patterns with parameterized types"> + <compile files="ParameterizedTypesInAnnotationPatterns.aj" options="-1.9"> + <message kind="error" line="5" text="is not an annotation type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="staticinitialization and parameterized types"> + <compile files="GenericInterface.java,GenericImplementingClass.java,StaticInitializationWithParameterizedTypes.aj" options="-1.9"> + <message kind="error" line="4" text="no static initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="6" text="no static initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="9" text="no static initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="11" text="no static initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="14" text="no static initialization join points for parameterized types, use raw type instead"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="staticinitialization and parameterized type matching"> + <compile files="GenericInterface.java,GenericImplementingClass.java,ConcreteImplementingClass.java,ConcreteExtendingClass.java,StaticInitializationWithParameterizedTypesMatching.aj" options="-1.9"> + <message kind="warning" line="1" text="clinit(GenericInterface<Double>+)"/> + <message kind="warning" line="3" text="clinit(GenericInterface<Double>+)"/> + <message kind="warning" line="3" text="clinit(GenericImplementingClass<Double>+)"/> + <message kind="warning" line="15" text="Type java.lang.String does not meet the specification for type parameter 1 (N extends java.lang.Number) in generic type GenericInterface"/> + <message kind="warning" line="19" text="Type pattern does not match because the wrong number of type parameters are specified: Type GenericInterface requires 1 parameter(s)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="staticinitialization with generic types"> + <compile files="GenericInterface.java,GenericImplementingClass.java,StaticInitializationWithGenericTypes.aj" options="-1.9"> + <message kind="warning" line="1" text="one generic param, correct bounds"/> + <message kind="warning" line="1" text="doesn't matter what type variable name you use"/> + <message kind="warning" line="1" text="works with classes too"/> + <message kind="warning" line="4" text="Type T does not meet the specification for type parameter 1 (N extends java.lang.Number) in generic type GenericInterface"/> + <message kind="warning" line="20" text="Type pattern does not match because the wrong number of type parameters are specified: Type GenericImplementingClass requires 1 parameter(s)"/> + <message kind="warning" line="24" text="Type N extends java.lang.Number & java.lang.Comparable does not meet the specification for type parameter 1 (N extends java.lang.Number) in generic type GenericImplementingClass"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="staticinitialization with generic types - advanced"> + <compile files="StaticInitializationWithGenericTypesAdvanced.aj" options="-1.9"> + <message kind="warning" line="76" text="simple match"/> + <message kind="warning" line="76" text="matches since R and R extends Object are equivalent"/> + <message kind="warning" line="63" text="raw type should match"/> + <message kind="warning" line="63" text="matches all bounds"/> + <message kind="warning" line="63" text="still matches with interfaces specified in a different order"/> + <message kind="warning" line="69" text="matches with type variable inter-dependencies"/> + <message kind="warning" line="76" text="matches any generic type with one unbound type var"/> + <message kind="warning" line="82" text="any generic type with one type var bound to Number or subtype"/> + <message kind="warning" line="63" text="matches a generic type with any upper bound and i/f bounds"/> + <message kind="warning" line="76" text="matches a generic type with any upper bound and i/f bounds"/> + <message kind="warning" line="82" text="matches a generic type with any upper bound and i/f bounds"/> + <message kind="warning" line="19" text="Type X does not meet the specification for type parameter 1 (T extends java.lang.Number & java.lang.Comparable & java.io.Serializable) in generic type ClassWithInterfaceBounds"/> + <message kind="warning" line="23" text="Type Y extends java.lang.Number does not meet the specification for type parameter 1 (T extends java.lang.Number & java.lang.Comparable & java.io.Serializable) in generic type ClassWithInterfaceBounds"/> + <message kind="warning" line="27" text="Type Z extends java.lang.Number & java.lang.Comparable does not meet the specification for type parameter 1 (T extends java.lang.Number & java.lang.Comparable & java.io.Serializable) in generic type ClassWithInterfaceBounds"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="within pcd with various parameterizations and generic types - errors"> + <compile files="WithinPointcutMatching.aj" options="-1.9"> + <message kind="warning" line="4" text="no match for this type name: T"/> + <message kind="error" line="4" text="parameterized type pattern not supported by 'within', use a raw type pattern instead"/> + <message kind="error" line="5" text="parameterized type pattern not supported by 'within', use a raw type pattern instead"/> + <message kind="error" line="6" text="parameterized type pattern not supported by 'within', use a raw type pattern instead"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="within pcd with various parameterizations and generic types - warnings"> + <compile files="WithinPointcutMatchingWarnings.aj" options="-1.9"> + <message kind="warning" line="16" text="matched set correctly"/> + <message kind="warning" line="18" text="matched execution correctly"/> + <message kind="warning" line="24" text="init matched correctly"/> + <message kind="warning" line="32" text="matched parameterization ok"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="this and target with various parameterizations and generic types - errors"> + <compile files="ThisAndTargetPointcutMatching.aj" options="-1.9"> + <message kind="warning" line="4" text="no match for this type name: T"/> + <message kind="warning" line="5" text="no match for this type name: T"/> + <message kind="error" line="4" text="parameterized types not supported for this and target pointcuts (erasure limitation)"/> + <message kind="error" line="5" text="parameterized types not supported for this and target pointcuts (erasure limitation)"/> + <message kind="error" line="6" text="parameterized types not supported for this and target pointcuts (erasure limitation)"/> + <message kind="error" line="7" text="parameterized types not supported for this and target pointcuts (erasure limitation)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="this and target with various parameterizations and generic types - runtime"> + <compile files="ThisAndTargetPointcutMatchingRuntime.aj" options="-1.9"> + </compile> + <run class="ThisAndTargetPointcutMatchingRuntime"> + <stdout> + <line text="set and this matched ok"/> + <line text="set and target matched ok"/> + <line text="call and target matched ok"/> + <line text="execution and this matched ok"/> + <line text="execution and target matched ok"/> + <line text="parameterized call and target matched ok"/> + <line text="parameterized call and this matched ok"/> + <line text="parameterized call and target matched ok"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="get and set with various parameterizations and generic types - errors"> + <compile files="GetAndSetPointcutMatching.aj" options="-1.9"> + <message kind="warning" line="4" text="no match for this type name: T"/> + <message kind="warning" line="5" text="no match for this type name: T"/> + <message kind="error" line="4" text="can't use parameterized type patterns for the declaring type of a get or set pointcut expression (use the raw type instead)"/> + <message kind="error" line="5" text="can't use parameterized type patterns for the declaring type of a get or set pointcut expression (use the raw type instead)"/> + <message kind="error" line="6" text="can't use parameterized type patterns for the declaring type of a get or set pointcut expression (use the raw type instead)"/> + <message kind="error" line="7" text="can't use parameterized type patterns for the declaring type of a get or set pointcut expression (use the raw type instead)"/> + <message kind="error" line="8" text="can't use parameterized type patterns for the declaring type of a get or set pointcut expression (use the raw type instead)"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="get and set with various parameterizations and generic declaring types"> + <compile files="GetAndSetPointcutMatchingDeclaringType.aj" options="-1.9"> + <message kind="warning" line="15" text="generic/param get matching ok"/> + <message kind="warning" line="33" text="generic/param get matching ok"/> + <message kind="warning" line="12" text="generic/param set matching ok"/> + <message kind="warning" line="32" text="generic/param set matching ok"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="get and set with various parameterizations and generic field types"> + <compile files="GetAndSetPointcutMatchingFieldType.aj" options="-1.9"> + <message kind="warning" line="13" text="raw field type matching in get ok"/> + <message kind="warning" line="14" text="raw field type matching in set ok"/> + <message kind="warning" line="49" text="erasure matching in get ok"/> + <message kind="warning" line="45" text="erasure matching in set ok"/> + <message kind="warning" line="53" text="erasure matching in get with params ok"/> + <message kind="warning" line="46" text="erasure matching in set with params ok"/> + <message kind="warning" line="72" text="parameterized type matching in set ok"/> + <message kind="warning" line="73" text="parameterized type matching in get ok"/> + <message kind="warning" line="74" text="parameterized type matching in set ok x2"/> + <message kind="warning" line="75" text="parameterized type matching in get ok x2"/> + <message kind="warning" line="83" text="wildcard set matching ok"/> + <message kind="warning" line="84" text="wildcard get matching ok"/> + <message kind="warning" line="85" text="wildcard extends set matching ok"/> + <message kind="warning" line="86" text="wildcard extends get matching ok"/> + <message kind="warning" line="87" text="wildcard super set matching ok"/> + <message kind="warning" line="88" text="wildcard super get matching ok"/> + <message kind="warning" line="73" text="the really wild show"/> + <message kind="warning" line="84" text="the really wild show"/> + <message kind="warning" line="86" text="the really wild show"/> + <message kind="warning" line="88" text="the really wild show"/> + <message kind="warning" line="53" text="the really wild show"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="init and preinit with parameterized declaring types"> + <compile files="InitializationPointcutMatching.aj" options="-1.9"> + <message kind="warning" line="4" text="no match for this type name: T"/> + <message kind="warning" line="5" text="no match for this type name: T"/> + <message kind="error" line="4" text="no [pre]initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="5" text="no [pre]initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="6" text="no [pre]initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="7" text="no [pre]initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="8" text="no [pre]initialization join points for parameterized types, use raw type instead"/> + <message kind="error" line="9" text="invalid throws pattern: a generic class may not be a direct or indirect subclass of Throwable"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="init and preinit with raw declaring type pattern"> + <compile files="InitializationPointcutMatchingDeclaringType.aj" options="-1.9"> + <message kind="warning" line="10" text="generic/param init matching ok"/> + <message kind="warning" line="10" text="generic/param preinit matching ok"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="init and preinit with parameterized parameter types"> + <compile files="InitializationPointcutMatchingParamTypes.aj" options="-1.9"> + <message kind="warning" line="36" text="raw param type matching in init ok"/> + <message kind="warning" line="36" text="raw param type matching in preinit ok"/> + <message kind="warning" line="37" text="erasure matching in init ok"/> + <message kind="warning" line="37" text="erasure matching in preinit ok"/> + <message kind="warning" line="38" text="erasure matching in init with params ok"/> + <message kind="warning" line="38" text="erasure matching in preinit with params ok"/> + <message kind="warning" line="48" text="parameterized type matching in init ok"/> + <message kind="warning" line="48" text="parameterized type matching in preinit ok"/> + <message kind="warning" line="49" text="parameterized type matching in init ok x2"/> + <message kind="warning" line="49" text="parameterized type matching in preinit ok x2"/> + <message kind="warning" line="50" text="wildcard init matching ok"/> + <message kind="warning" line="50" text="wildcard preinit matching ok"/> + <message kind="warning" line="51" text="wildcard extends init matching ok"/> + <message kind="warning" line="51" text="wildcard extends preinit matching ok"/> + <message kind="warning" line="52" text="wildcard super init matching ok"/> + <message kind="warning" line="52" text="wildcard super preinit matching ok"/> + <message kind="warning" line="48" text="the really wild show"/> + <message kind="warning" line="50" text="the really wild show"/> + <message kind="warning" line="51" text="the really wild show"/> + <message kind="warning" line="52" text="the really wild show"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="withincode with various parameterizations and generic types - errors"> + <compile files="WithincodePointcutMatching.aj" options="-1.9"> + <message kind="warning" line="4" text="no match for this type name: T"/> + <message kind="error" line="4" text="can't use parameterized type patterns for the declaring type of a withincode pointcut expression (use the raw type instead)"/> + <message kind="error" line="5" text="can't use parameterized type patterns for the declaring type of a withincode pointcut expression (use the raw type instead)"/> + <message kind="error" line="6" text="invalid throws pattern: a generic class may not be a direct or indirect subclass of Throwable"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="withincode with various parameterizations and generic types - matching"> + <compile files="WithinCodePointcutMatchingParamAndReturnTypes.aj" options="-1.9"> + <message kind="warning" line="35" text="raw param type matching in withincode ok"/> + <message kind="warning" line="36" text="raw param type matching in withincode ok"/> + <message kind="warning" line="67" text="raw return type matching in withincode ok"/> + <message kind="warning" line="38" text="erasure type matching in withincode ok"/> + <message kind="warning" line="39" text="erasure type matching in withincode ok"/> + <message kind="warning" line="42" text="erasure type matching in withincode ok"/> + <message kind="warning" line="62" text="withincode and parameterized method ok"/> + <message kind="warning" line="62" text="withincode and generic interface ok"/> + <message kind="warning" line="65" text="withincode and interface control test"/> + <message kind="warning" line="35" text="match on parameterized args"/> + <message kind="warning" line="36" text="match on parameterized args"/> + <message kind="warning" line="67" text="match on parameterized return type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="withincode with overriding of inherited generic members"> + <compile files="WithinCodeOverriding.aj" options="-1.9"> + <message kind="warning" line="37" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="50" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="63" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="37" text="base declaring type match on erasure"/> + <message kind="warning" line="50" text="base declaring type match on erasure"/> + <message kind="warning" line="63" text="base declaring type match on erasure"/> + <message kind="warning" line="50" text="sub type match on erasure"/> + <message kind="warning" line="63" text="parameterized match on erasure"/> + <message kind="warning" line="80" text="erasure match on base interface"/> + <message kind="warning" line="80" text="wildcard match on erasure"/> + <message kind="warning" line="80" text="parameterized match"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="execution pcd with raw type matching"> + <compile files="GenericInterface.java,ConcreteImplementingClass.java,GenericImplementingClass.java,RawTypeMatching.aj" options="-1.9"> + <message kind="warning" line="4" text="execution(* GenericInterface.*(..))"/> + <message kind="warning" line="5" text="execution(* GenericInterface.*(..))"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="execution pcd with raw signature matching"> + <compile files="GenericInterface.java,ConcreteImplementingClass.java,GenericImplementingClass.java,RawSignatureMatching.aj" options="-1.9"> + <message kind="warning" line="4" text="execution(* GenericInterface.asInt(Number))"/> + <message kind="warning" line="5" text="execution(* GenericInterface.asInt(Number))"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="execution with various parameterizations and generic types - errors"> + <compile files="ExecutionPointcutMatchingErrorCases.aj" options="-1.9"> + <message kind="warning" line="4" text="no match for this type name: T"/> + <message kind="error" line="4" text="can't use parameterized type patterns for the declaring type of an execution pointcut expression (use the raw type instead)"/> + <message kind="error" line="5" text="can't use parameterized type patterns for the declaring type of an execution pointcut expression (use the raw type instead)"/> + <message kind="error" line="6" text="invalid throws pattern: a generic class may not be a direct or indirect subclass of Throwable"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="execution with various parameterizations and generic types - matching"> + <compile files="ExecutionPointcutMatchingParamAndReturnTypes.aj" options="-1.9"> + <message kind="warning" line="35" text="raw param type matching in execution ok"/> + <message kind="warning" line="67" text="raw return type matching in execution ok"/> + <message kind="warning" line="38" text="erasure type matching in execution ok"/> + <message kind="warning" line="42" text="erasure type matching in execution ok"/> + <message kind="warning" line="61" text="execution and parameterized method ok"/> + <message kind="warning" line="61" text="execution and generic interface ok"/> + <message kind="warning" line="65" text="execution and interface control test"/> + <message kind="warning" line="35" text="match on parameterized args"/> + <message kind="warning" line="67" text="match on parameterized return type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="execution with overriding of inherited generic members"> + <compile files="ExecutionOverriding.aj" options="-1.9"> + <message kind="warning" line="36" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="49" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="62" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="36" text="base declaring type match on erasure"/> + <message kind="warning" line="49" text="base declaring type match on erasure"/> + <message kind="warning" line="62" text="base declaring type match on erasure"/> + <message kind="warning" line="49" text="sub type match on erasure"/> + <message kind="warning" line="62" text="parameterized match on erasure"/> + <message kind="warning" line="79" text="erasure match on base interface"/> + <message kind="warning" line="79" text="wildcard match on erasure"/> + <message kind="warning" line="79" text="parameterized match"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="execution pcd with generic declaring type and erased parameter types"> + <compile files="GenericInterface.java,ConcreteImplementingClass.java,GenericImplementingClass.java,GenericDeclaringTypeWithParameterErasure.aj" options="-1.9"> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="execution pcd with generic signature matching"> + <compile files="GenericInterface.java,ConcreteImplementingClass.java,GenericImplementingClass.java,GenericSignatureMatching.aj" options="-1.9"> + <message kind="warning" line="4" text="execution<T>(* GenericInterface<T extends Number>.asInt(T))"/> + <message kind="warning" line="5" text="execution<T>(* GenericInterface<T extends Number>.asInt(T))"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="call with various parameterizations and generic types - errors"> + <compile files="CallPointcutMatchingErrorCases.aj" options="-1.9"> + <message kind="warning" line="4" text="no match for this type name: T"/> + <message kind="error" line="4" text="can't use parameterized type patterns for the declaring type of a call pointcut expression (use the raw type instead)"/> + <message kind="error" line="5" text="can't use parameterized type patterns for the declaring type of a call pointcut expression (use the raw type instead)"/> + <message kind="error" line="6" text="invalid throws pattern: a generic class may not be a direct or indirect subclass of Throwable"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="call with various parameterizations and generic types - matching"> + <compile files="CallPointcutMatchingParamAndReturnTypes.aj" options="-1.9"> + <message kind="warning" line="7" text="raw param type matching in call ok"/> + <message kind="warning" line="8" text="raw return type matching in call ok"/> + <message kind="warning" line="9" text="erasure type matching in call ok"/> + <message kind="warning" line="10" text="erasure type matching in call ok"/> + <message kind="warning" line="11" text="call and parameterized method ok"/> + <message kind="warning" line="11" text="call and generic interface ok"/> + <message kind="warning" line="12" text="call and interface control test"/> + <message kind="warning" line="7" text="match on parameterized args"/> + <message kind="warning" line="8" text="match on parameterized return type"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="call with overriding of inherited generic members"> + <compile files="CallOverriding.aj" options="-1.9"> + <message kind="warning" line="8" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="9" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="10" text="wildcard declaring type match on erasure"/> + <message kind="warning" line="8" text="base declaring type match on erasure"/> + <message kind="warning" line="9" text="base declaring type match on erasure"/> + <message kind="warning" line="10" text="base declaring type match on erasure"/> + <message kind="warning" line="9" text="sub type match on erasure"/> + <message kind="warning" line="10" text="parameterized match on erasure"/> + <message kind="warning" line="87" text="erasure match on base interface"/> + <message kind="warning" line="87" text="wildcard match on erasure"/> + <message kind="warning" line="87" text="parameterized match"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="call with bridge methods"> + <compile files="CallWithBridgeMethods.aj" options="-1.9"> + <!-- see testcode + <message kind="warning" line="23" text="should match call to bridge method on L23, this is a real call!"/> + --> + </compile> + </ajc-test> + + + <ajc-test dir="java5/generics/pointcuts" title="args with raw type and generic / parameterized sigs"> + <compile files="RawArgs.aj" options="-1.9"> + </compile> + <run class="RawArgs"> + <stdout> + <line text="args(List) match at call(void Generic.foo(List))"/> + <line text="args(List) match at call(void Generic.bar(List))"/> + <line text="args(List) match at call(void Generic.tada(List))"/> + <line text="args(List) match at call(void Generic.tada(List))"/> + <line text="args(List) match at call(void Generic.tada(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="args with parameterized type and generic / parameterized sigs"> + <compile files="ArgsParameterized.aj" options="-1.9"> + <message kind="warning" line="28" text="unchecked match of List<String> with List"/> + </compile> + <run class="ArgsParameterized"> + <stdout> + <line text="args(List<String> matched at call(void Generic.foo(List))"/> + <line text="args(List<String> matched at call(void Generic.bar(List))"/> + <line text="args(List<String> matched at call(void Generic.tada(List))"/> + <line text="args(List<String> matched at call(void Generic.something(List))"/> + <line text="args(List<String> matched at call(void MustBeString.listit(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="args with parameterized type and wildcards"> + <compile files="ArgsParameterizedWithWildcards.aj" options="-1.9"> + <message kind="warning" line="10" text="unchecked match of List<Double> with List when argument is an instance of List"/> + <message kind="warning" line="10" text="unchecked match of List<Double> with List<? extends Double> when argument is an instance of List"/> + <message kind="warning" line="10" text="unchecked match of List<Double> with List<? extends Number> when argument is an instance of List"/> + <message kind="warning" line="10" text="unchecked match of List<Double> with List<?> when argument is an instance of List"/> + </compile> + <run class="ArgsParameterizedWithWildcards"> + <stdout> + <line text="List<Double> matched at execution(void C.rawList(List))"/> + <line text="List<Double> matched at execution(void C.listOfSomething(List))"/> + <line text="List<Double> matched at execution(void C.listOfSomeNumber(List))"/> + <line text="List<Double> matched at execution(void C.listOfDouble(List))"/> + <line text="List<Double> matched at execution(void C.listOfSomeDouble(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="args with generic wildcard"> + <compile files="ArgsListOfSomething.aj" options="-1.9 -Xlint:ignore"> + </compile> + <run class="ArgsListOfSomething"> + <stdout> + <line text="List<?> matches execution(void ArgsListOfSomething.rawList(List))"/> + <line text="List<?> matches execution(void ArgsListOfSomething.listOfString(List))"/> + <line text="List<?> matches execution(void ArgsListOfSomething.listOfSomething(List))"/> + <line text="List<?> matches execution(void ArgsListOfSomething.listOfSomethingExtends(List))"/> + <line text="List<?> matches execution(void ArgsListOfSomething.listOfSomethingSuper(List))"/> + <line text="wild map matches execution(void ArgsListOfSomething.mapit(Map))"/> + <line text="exact wild map matches execution(void ArgsListOfSomething.mapit(Map))"/> + <line text="super type exact matches execution(void ArgsListOfSomething.setOf(HashSet))"/> + <line text="super wild type matches execution(void ArgsListOfSomething.setOf(HashSet))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="args with generic wildcard extends"> + <compile files="ArgsListOfSomethingExtends.aj" options="-1.9"> + <message kind="warning" line="27" text="unchecked match of List<? extends Number> with List"/> + <message kind="warning" line="27" text="unchecked match of List<? extends Number> with List<?>"/> + </compile> + <run class="ArgsListOfSomethingExtends"> + <stdout> + <line text="List<? extends Number> matches execution(void ArgsListOfSomethingExtends.rawList(List))"/> + <line text="List<? extends Number> matches execution(void ArgsListOfSomethingExtends.listOfNumber(List))"/> + <line text="List<? extends Number> matches execution(void ArgsListOfSomethingExtends.listOfDouble(List))"/> + <line text="List<? extends Number> matches execution(void ArgsListOfSomethingExtends.listOfSomething(List))"/> + <line text="List<? extends Number> matches execution(void ArgsListOfSomethingExtends.listOfSomethingExtends(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="args with generic wildcard super"> + <compile files="ArgsListOfSomethingSuper.aj" options="-1.9"> + <message kind="warning" line="32" text="unchecked match of List<? super Number> with List"/> + <message kind="warning" line="32" text="unchecked match of List<? super Number> with List<?>"/> + <message kind="warning" line="32" text="unchecked match of List<? super Number> with List<? extends Number>"/> + </compile> + <run class="ArgsListOfSomethingSuper"> + <stdout> + <line text="List<? super Number> matches execution(void ArgsListOfSomethingSuper.rawList(List))"/> + <line text="List<? super Number> matches execution(void ArgsListOfSomethingSuper.listOfObject(List))"/> + <line text="List<? super Number> matches execution(void ArgsListOfSomethingSuper.listOfNumber(List))"/> + <line text="List<? super Number> matches execution(void ArgsListOfSomethingSuper.listOfSomething(List))"/> + <line text="List<? super Number> matches execution(void ArgsListOfSomethingSuper.listOfSomethingSuper(List))"/> + <line text="List<? super Number> matches execution(void ArgsListOfSomethingSuper.listOfSomethingExtendsNumber(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="generic method matching"> + <compile files="GenericMethods.aj" options="-1.9"> + <message kind="warning" line="19" text="static generic method match"/> + <message kind="warning" line="34" text="static generic method match"/> + <message kind="warning" line="24" text="instance generic method match"/> + <message kind="warning" line="39" text="instance generic method match"/> + </compile> + </ajc-test> + + <ajc-test dir="java5/generics/pointcuts" title="generic wildcards in signature matching"> + <compile files="GenericWildcardsInSignatureMatching.aj" options="-1.9"> + <message kind="warning" line="5" text="set of a list"/> + <message kind="warning" line="7" text="exact nested wildcard match"/> + <message kind="warning" line="7" text="wildcard nested wildcard match"/> + <message kind="warning" line="11" text="super"/> + <message kind="warning" line="15" text="super wild match"/> + </compile> + </ajc-test> + + <!-- end of generics and pointcuts tests --> + + <ajc-test dir="java5/generics/afterAdvice" title="after throwing with parameterized throw type"> + <compile files="AfterThrowing.aj" options="-1.9"> + <message kind="error" line="6" text="cannot convert from List<String> to Throwable"/> + </compile> + </ajc-test> + + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with raw type and generic / parameterized sigs"> + <compile files="AfterReturningRawType.aj" options="-1.9"> + </compile> + <run class="AfterReturningRawType"> + <stdout> + <line text="returning(List) match at call(List Generic.foo(List))"/> + <line text="returning(List) match at call(List Generic.bar(List))"/> + <line text="returning(List) match at call(List Generic.tada(List))"/> + <line text="returning(List) match at call(List Generic.tada(List))"/> + <line text="returning(List) match at call(List Generic.tada(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with parameterized type and generic / parameterized sigs"> + <compile files="AfterReturningParameterized.aj" options="-1.9"> + <message kind="warning" line="28" text="unchecked match of List<String> with List"/> + </compile> + <run class="AfterReturningParameterized"> + <stdout> + <line text="returning(List<String> matched at call(List Generic.foo(List))"/> + <line text="returning(List<String> matched at call(List Generic.bar(List))"/> + <line text="returning(List<String> matched at call(List Generic.tada(List))"/> + <line text="returning(List<String> matched at call(List Generic.something(List))"/> + <line text="returning(List<String> matched at call(List MustBeString.listit(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with parameterized type and wildcards"> + <compile files="AfterReturningParameterizedWithWildcards.aj" options="-1.9"> + <message kind="warning" line="10" text="unchecked match of List<Double> with List when argument is an instance of List"/> + <message kind="warning" line="10" text="unchecked match of List<Double> with List<? extends Double> when argument is an instance of List"/> + <message kind="warning" line="10" text="unchecked match of List<Double> with List<? extends Number> when argument is an instance of List"/> + <message kind="warning" line="10" text="unchecked match of List<Double> with List<?> when argument is an instance of List"/> + </compile> + <run class="AfterReturningParameterizedWithWildcards"> + <stdout> + <line text="List<Double> matched at call(List C.rawList(List))"/> + <line text="List<Double> matched at call(List C.listOfSomething(List))"/> + <line text="List<Double> matched at call(List C.listOfSomeNumber(List))"/> + <line text="List<Double> matched at call(List C.listOfDouble(List))"/> + <line text="List<Double> matched at call(List C.listOfSomeDouble(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with generic wildcard"> + <compile files="AfterReturningListOfSomething.aj" options="-1.9"> + <!-- warning is unchecked match of List<?> from line 28 onto line 15. --> + <!-- some sets may be lists unless the set is final, so as a cast is allowed, the match is allowed --> + <message kind="warning" line="28"/> + <message kind="warning" line="44"/> + <message kind="warning" line="48"/> + </compile> + <run class="AfterReturningListOfSomething"> + <stdout> + <line text="List<?> matches execution(List AfterReturningListOfSomething.rawList(List))"/> + <line text="List<?> matches execution(List AfterReturningListOfSomething.listOfString(List))"/> + <line text="List<?> matches execution(List AfterReturningListOfSomething.listOfSomething(List))"/> + <line text="List<?> matches execution(List AfterReturningListOfSomething.listOfSomethingExtends(List))"/> + <line text="List<?> matches execution(List AfterReturningListOfSomething.listOfSomethingSuper(List))"/> + <line text="wild map matches execution(Map AfterReturningListOfSomething.mapit(Map))"/> + <line text="exact wild map matches execution(Map AfterReturningListOfSomething.mapit(Map))"/> + <line text="super type exact matches execution(HashSet AfterReturningListOfSomething.setOf(HashSet))"/> + <line text="super wild type matches execution(HashSet AfterReturningListOfSomething.setOf(HashSet))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with generic wildcard extends"> + <compile files="AfterReturningListOfSomethingExtends.aj" options="-1.9"> + <message kind="warning" line="27" text="unchecked match of List<? extends Number> with List"/> + <message kind="warning" line="27" text="unchecked match of List<? extends Number> with List<?>"/> + </compile> + <run class="AfterReturningListOfSomethingExtends"> + <stdout> + <line text="List<? extends Number> matches execution(List AfterReturningListOfSomethingExtends.rawList(List))"/> + <line text="List<? extends Number> matches execution(List AfterReturningListOfSomethingExtends.listOfNumber(List))"/> + <line text="List<? extends Number> matches execution(List AfterReturningListOfSomethingExtends.listOfDouble(List))"/> + <line text="List<? extends Number> matches execution(List AfterReturningListOfSomethingExtends.listOfSomething(List))"/> + <line text="List<? extends Number> matches execution(List AfterReturningListOfSomethingExtends.listOfSomethingExtends(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="java5/generics/afterAdvice" title="after returning with generic wildcard super"> + <compile files="AfterReturningListOfSomethingSuper.aj" options="-1.9"> + <message kind="warning" line="32" text="unchecked match of List<? super Number> with List"/> + <message kind="warning" line="32" text="unchecked match of List<? super Number> with List<?>"/> + <message kind="warning" line="32" text="unchecked match of List<? super Number> with List<? extends Number>"/> + </compile> + <run class="AfterReturningListOfSomethingSuper"> + <stdout> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.rawList(List))"/> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.listOfObject(List))"/> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.listOfNumber(List))"/> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.listOfSomething(List))"/> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.listOfSomethingSuper(List))"/> + <line text="List<? super Number> matches execution(List AfterReturningListOfSomethingSuper.listOfSomethingExtendsNumber(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test title="ajdk notebook: erasure matching examples" dir="java5/generics/ajdk"> + <compile files="ErasureMatching.aj" options="-1.9"> + <message kind="warning" line="18" text="static generic method match"/> + <message kind="warning" line="21" text="instance generic method match"/> + <message kind="warning" line="31" text="method in generic type match"/> + <message kind="warning" line="28" text="field in generic type match"/> + </compile> + </ajc-test> + + <ajc-test title="ajdk notebook: simple parameterized type matching examples" dir="java5/generics/ajdk"> + <compile files="SimpleParameterizedTypeExamples.aj" options="-1.9"> + <message kind="warning" line="34" text="get myStrings 1"/> + <message kind="warning" line="34" text="get myStrings 2"/> + <message kind="warning" line="38" text="get myStrings 1"/> + <message kind="warning" line="38" text="get myStrings 2"/> + <message kind="warning" line="35" text="get myFloats 1"/> + <message kind="warning" line="35" text="get myFloats 2"/> + <message kind="warning" line="35" text="get myFloats 3"/> + <message kind="warning" line="34" text="getter 1"/> + <message kind="warning" line="35" text="getter 1"/> + <message kind="warning" line="34" text="getter 2"/> + <message kind="warning" line="35" text="getter 2"/> + <message kind="warning" line="34" text="getter 3"/> + <message kind="warning" line="35" text="getter 4"/> + <message kind="warning" line="25" text="call 1"/> + <message kind="warning" line="25" text="call 2"/> + </compile> + </ajc-test> + + <ajc-test title="ajdk notebook: mixed parameterized types and generic methods" dir="java5/generics/ajdk"> + <compile files="MixedParameterizedAndTypeVariables.aj" options="-1.9"> + <message kind="warning" line="13" text="erasure match"/> + <message kind="warning" line="13" text="mixed match"/> + <message kind="warning" line="13" text="params only match"/> + </compile> + </ajc-test> + + <ajc-test title="ajdk notebook: signature matching with generic wildcards" dir="java5/generics/ajdk"> + <compile files="SignatureWildcards.aj" options="-1.9"> + <message kind="warning" line="13" text="any list"/> + <message kind="warning" line="15" text="any list"/> + <message kind="warning" line="17" text="any list"/> + <message kind="warning" line="13" text="only foo"/> + <message kind="warning" line="15" text="some list"/> + <message kind="warning" line="13" text="any list with upper bound"/> + <message kind="warning" line="15" text="any list with upper bound"/> + </compile> + </ajc-test> + + <ajc-test title="ajdk notebook: bridge method examples" dir="java5/generics/ajdk"> + <compile files="BridgeMethodExamples.aj" options="-1.9"> + <message kind="warning" line="17" text="double match"/> + <message kind="warning" line="25" text="double match"/> + <message kind="warning" line="9" text="match"/> + <message kind="warning" line="11" text="match"/> + </compile> + </ajc-test> + + <ajc-test title="ajdk notebook: args examples" dir="java5/generics/ajdk"> + <compile files="ArgsExamples.aj" options="-1.9"> + <message kind="warning" line="15" text="unchecked match of List<Double> with List<? extends Number> when argument is an instance of List at join point method-execution(void C.goo(List<? extends Number>)) [Xlint:uncheckedArgument]"/> + <message kind="warning" line="53" text="unchecked match"/> + </compile> + <run class="ArgsExamples"> + <stdout> + <line text="args(List)"/> + <line text="args List of String"/> + <line text="args(List)"/> + <line text="args List of Double"/> + <line text="args(List)"/> + <line text="args List of Double"/> + </stdout> + </run> + </ajc-test> + + <ajc-test title="ajdk notebook: after returning examples" dir="java5/generics/ajdk"> + <compile files="AfterReturningExamples.aj" options="-1.9"> + <message kind="warning" line="20" text="unchecked match of List<Double> with List<? extends Number>"/> + </compile> + <run class="AfterReturningExamples"> + <stdout> + <line text="execution(List C.foo(List))"/> + <line text="raw s1"/> + <line text="raw s2"/> + <line text="execution(List C.bar(List))"/> + <line text="raw 5.0"/> + <line text="raw 10.0"/> + <line text="a1 5.0"/> + <line text="a1 10.0"/> + <line text="a2 5.0"/> + <line text="a2 10.0"/> + <line text="a3 5.0"/> + <line text="a3 10.0"/> + <line text="execution(List C.goo(List))"/> + <line text="raw 5.0"/> + <line text="raw 10.0"/> + <line text="a1 5.0"/> + <line text="a1 10.0"/> + <line text="a3 5.0"/> + <line text="a3 10.0"/> + </stdout> + </run> + </ajc-test> + + <ajc-test title="ajdk notebook: args and wildcards examples" dir="java5/generics/ajdk"> + <compile files="WildcardArgsExamples.aj" options="-1.9"> + <message kind="warning" line="6" text="unchecked match of List<? extends Number> with List"/> + </compile> + <run class="WildcardArgsExamples"> + <stdout> + <line text="advice match at call(void C.foo(Object))"/> + <line text="advice match at call(void C.foo(Object))"/> + <line text="advice match 2 at call(void C.goo1(List))"/> + <line text="advice match 2 at call(void C.goo2(List))"/> + <line text="advice match 2 at call(void C.goo4(List))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test title="ajdk notebook: pointcut in generic class example" dir="java5/generics/ajdk"> + <compile files="PointcutInGenericClassExample.aj" options="-1.9"> + <message kind="warning" line="23" text="parameterized with C"/> + <message kind="warning" line="29" text="parameterized with D"/> + </compile> + </ajc-test> + + <!-- ============================================================== --> + <!-- End of generics tests --> + <!-- ============================================================== --> + + <ajc-test dir="bugs150/pr98901" title="public method with declare @method"> + <compile files="Case01.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B01"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" title="Compiler error due to a wrong exception check in try blocks"> + <compile files="pr82989.aj" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150/pr98901" title="public method on the aspect that declares @method on it"> + <compile files="Case02.aj" options="-1.9 -Xlint:error"/> + <run class="B02"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr98901" title="public annotated method"> + <compile files="Case03.aj" options="-1.9 -Xlint:error"/> + <run class="B03"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public ITD method with declare @method"> + <compile files="Case04.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B04"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public annotated ITD method"> + <compile files="Case05.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B05"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public ITD-on-itself method with declare @method"> + <compile files="Case06.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B06"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public annotated ITD-on-itself method"> + <compile files="Case07.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B07"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public method on an Interface with declare @method"> + <compile files="Case08.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B08"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public annotated method on an Interface"> + <compile files="Case09.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B09"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public ITD method onto an Interface with declare @method"> + <compile files="Case10.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B10"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public annotated ITD method onto an Interface"> + <compile files="Case11.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B11"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract method with declare @method"> + <compile files="Case12.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B12"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract method on the aspect that declares @method on it"> + <compile files="Case13.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B13"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract annotated method"> + <compile files="Case14.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B14"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract ITD method with declare @method"> + <compile files="Case15.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B15"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract annotated ITD method"> + <compile files="Case16.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B16"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract ITD-on-itself method with declare @method"> + <compile files="Case17.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B17"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract annotated ITD-on-itself method"> + <compile files="Case18.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B18"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract method on an Interface with declare @method"> + <compile files="Case19.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B19"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract annotated method on an Interface"> + <compile files="Case20.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B20"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract ITD method onto an Interface with declare @method"> + <compile files="Case21.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B21"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public abstract annotated ITD method onto an Interface"> + <compile files="Case22.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B22"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public field with declare @field"> + <compile files="Case23.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B23"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + +<ajc-test dir="bugs150/pr98901" title="public field on the aspect that declares @field on it"> + <compile files="Case24.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B24"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + +<ajc-test dir="bugs150/pr98901" title="public annotated field"> + <compile files="Case25.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B25"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr98901" title="public ITD field with declare @field"> + <compile files="Case26.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B26"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr98901" title="public annotated ITD field"> + <compile files="Case27.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B27"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr98901" title="public ITD-on-itself field with declare @field"> + <compile files="Case28.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B28"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr98901" title="public annotated ITD-on-itself field"> + <compile files="Case29.aj" options="-1.9 -Xlint:error -Xdev:NoAtAspectJProcessing"/> + <run class="B29"> + <stdout> + <line text="@anInterface()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" title="Unable to build shadows"> + <compile files="pr109728.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150/pr110788" title="bad generic decp - 1"> + <compile files="Case1.java" options="-1.9"> + <message kind="error" line="10" text="Cannot declare parent B<java.lang.Number> onto type C since it already has A<java.lang.String> in its hierarchy"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr110788" title="bad generic decp - 2"> + <compile files="Case2.java" options="-1.9"> + <message kind="error" line="8" text="Cannot declare parent A<java.lang.Number> onto type C since it already has A<java.lang.String> in its hierarchy"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr110788" title="bad generic decp - 3"> + <compile files="Case3.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150/pr110788" title="bad generic decp - 4"> + <compile files="Case4.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150/pr110927" title="cant create signature attribute"> + <compile files="Case1.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150/pr72834" title="broken dispatch"> + <compile files="Trouble.java"> + <message kind="error" line="7" text="package visible abstract inter-type declarations are not allowed"/> + <message kind="error" line="9" text="The method getName() is undefined for the type A"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr73856" title="missing accessor"> + <compile files="MissingAccessor.java"/> + <run class="MissingAccessor"/> + </ajc-test> + + <ajc-test dir="bugs150/pr90143" title="cant call super methods"> + <compile files="A.aj"/> + </ajc-test> + + <ajc-test dir="bugs150" title="cunning declare parents"> + <compile files="pr92311.aj"/> + </ajc-test> + + <ajc-test dir="bugs150" title="ITD varargs problem"> + <compile files="pr110906.aj" options="-1.9"/> + <run class="pr110906"> + <stdout> + <line text="a"/> + <line text="a"/> + <line text="a"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150" title="generic itds and abstract method error"> + <compile files="pr102357.aj"/> + <run class="pr102357"/> + </ajc-test> + + <ajc-test dir="bugs150" title="unexpected error unboundFormalInPC"> + <compile files="pr112027.aj"/> + </ajc-test> + + <ajc-test dir="bugs150" title="ITD varargs in constructor"> + <compile files="pr111481.aj" options="-1.9"/> + <run class="pr111481"> + <stdout> + <line text="a"/> + <line text="a"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr112602" title="ClassCastException with generic wildcard"> + <compile files="GenericInterface.java,Implementation.java" options="-1.9,-emacssym"/> + </ajc-test> + + <ajc-test dir="bugs150/pr110307" title="Cant provide default implementation via ITD - 1"> + <compile files="Case1.java" options="-1.9"> + <message kind="warning" line="27" text="no match for this type name: Branch [Xlint:invalidAbsoluteTypeName]"/> + <message kind="error" line="26" text="can't bind type name 'Branch'"/> + <message kind="error" line="27" text="can't bind type name 'Revision'"/> + <message kind="error" line="33" text="List cannot be resolved to a type"/> + <message kind="error" line="38" text="List cannot be resolved to a type"/> + <message kind="error" line="39" text="List cannot be resolved to a type"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr110307" title="Cant provide default implementation via ITD - 2"> + <compile files="Case2.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150/pr110307" title="Cant provide default implementation via ITD - 3"> + <compile files="Case3.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150/pr110307" title="Cant provide default implementation via ITD - 4"> + <compile files="Case4.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150/pr110307" title="Cant provide default implementation via ITD - 5"> + <compile files="Case5.java" options="-1.9"> + <!-- might possibly need more diagnostics in this case to explain what has happened --> + <message kind="error" line="10" text="can't override java.util.List<java.lang.String> I.foo() with java.util.List<java.lang.Integer> A.foo() return types don't match"/> + <message kind="error" line="15" text="can't override java.util.List<java.lang.String> I.foo() with java.util.List<java.lang.Integer> A.foo() return types don't match"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr110307" title="Cant provide default implementation via ITD - 6"> + <compile files="Case6.java" options="-1.9"> + <message kind="error" line="8" text="N cannot be resolved to a type"/> + <!--message kind="error" line="7" text="T cannot be resolved to a type"/--> + </compile> + </ajc-test> + + <ajc-test dir="bugs150/pr110307" title="Cant provide default implementation via ITD - 7"> + <compile files="Case7.java" options="-1.9"/> + <run class="Case7"> + <stderr> + <line text="in=hello out=hello"/> + <line text="in=35 out=35"/> + <line text="in=[] out=[]"/> + </stderr> + </run> + </ajc-test> + + <!-- generic ITDs --> + + <ajc-test dir="java5/generics/itds/design" title="generic itds - design A"> + <compile files="DesignA.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/design" title="generic itds - design B"> + <compile files="DesignB.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/design" title="generic itds - design C"> + <compile files="DesignC.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/design" title="generic itds - design D"> + <compile files="DesignD.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/design" title="generic itds - design E"> + <compile files="DesignE.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/design" title="generic itds - design F"> + <compile files="DesignF.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="java5/generics/itds/design" title="generic itds - design G"> + <compile files="DesignG.java" options="-1.9"/> + </ajc-test> + + <ajc-test dir="bugs150/pr116626" title="NPE in WeavingAdaptor"> + <compile files="com/foo/bar/Test.java, TestAspect.aj" options="-1.9"/> + <run class="com.foo.bar.Test" ltw="aop.xml" + > + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119657" title="IllegalAccessError with around advice on interface method call"> + <compile files="services/account/StockQuoteServiceTest.java, services/accountdata/StockAccount.java, services/stockquote/StockQuoteService.java, services/stockquote/StockQuoteServiceImpl.java, services/account/AccountReport.java, accounts/recovery/Recovery.aj"/> + <run class="services.account.StockQuoteServiceTest"> + <stdout> + <line text="Recovery.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + <run class="services.account.StockQuoteServiceTest" ltw="aop.xml"> + <stdout> + <line text="Recovery.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119657" title="IllegalAccessError with around advice on interface method call not self"> + <compile files="services/account/StockQuoteServiceTest.java, services/accountdata/StockAccount.java, services/stockquote/StockQuoteService.java, services/stockquote/StockQuoteServiceImpl.java, services/account/AccountReport.java, accounts/recovery/RecoveryNotSelf.aj"/> + <run class="services.account.StockQuoteServiceTest"> + <stdout> + <line text="RecoveryNotSelf.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + <run class="services.account.StockQuoteServiceTest" ltw="aop-notself.xml"> + <stdout> + <line text="RecoveryNotSelf.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119657" title="IllegalAccessError with around advice on interface method call using -XterminateAfterCompilation and LTW"> + <compile files="services/account/StockQuoteServiceTest.java, services/accountdata/StockAccount.java, services/stockquote/StockQuoteService.java, services/stockquote/StockQuoteServiceImpl.java, services/account/AccountReport.java"/> + <compile files="accounts/recovery/Recovery.aj" options="-XterminateAfterCompilation"/> + <run class="services.account.StockQuoteServiceTest" ltw="aop.xml"> + <stdout> + <line text="Recovery.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119657" title="IllegalAccessError with around advice on interface method call using LTW"> + <compile files="services/account/StockQuoteServiceTest.java, services/accountdata/StockAccount.java, services/stockquote/StockQuoteService.java, services/stockquote/StockQuoteServiceImpl.java, services/account/AccountReport.java"/> + <compile files="accounts/recovery/Recovery.aj"/> + <run class="services.account.StockQuoteServiceTest" ltw="aop.xml"> + <stdout> + <line text="Recovery.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119657" title="IllegalAccessError with around advice on interface method call not self using LTW"> + <compile files="services/account/StockQuoteServiceTest.java, services/accountdata/StockAccount.java, services/stockquote/StockQuoteService.java, services/stockquote/StockQuoteServiceImpl.java, services/account/AccountReport.java"/> + <compile files="accounts/recovery/RecoveryNotSelf.aj"/> + <run class="services.account.StockQuoteServiceTest" ltw="aop-notself.xml"> + <stdout> + <line text="RecoveryNotSelf.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119657" title="IllegalAccessError with around advice on interface method call self and not self using LTW"> + <compile files="services/account/StockQuoteServiceTest.java, services/accountdata/StockAccount.java, services/stockquote/StockQuoteService.java, services/stockquote/StockQuoteServiceImpl.java, services/account/AccountReport.java"/> + <compile files="accounts/recovery/Recovery.aj, accounts/recovery/RecoveryNotSelf.aj"/> + <run class="services.account.StockQuoteServiceTest" ltw="aop-selfandnotself.xml"> + <stdout> + <line text="Recovery.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + <line text="RecoveryNotSelf.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr119657" title="IllegalAccessError with around advice on interface method call using LTW and -XnoInline"> + <compile files="services/account/StockQuoteServiceTest.java, services/accountdata/StockAccount.java, services/stockquote/StockQuoteService.java, services/stockquote/StockQuoteServiceImpl.java, services/account/AccountReport.java"/> + <compile files="accounts/recovery/Recovery.aj"/> + <run class="services.account.StockQuoteServiceTest" ltw="aop-noinline.xml"> + <stdout> + <line text="Recovery.around() call(float services.stockquote.StockQuoteService.getQuote(String))"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs150/pr121385" title="override protected pointcut in aop.xml concrete aspect"> + <compile files="Hello.java"/> + <compile files="World.aj, ConcreteWorld.aj"/> + <run class="Hello" ltw="aop.xml"> + <stdout> + <line text="around start!"/> + <line text="Hello"/> + <line text="around start!"/> + <line text="World"/> + <line text="around end!"/> + <line text="around end!"/> + </stdout> + </run> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc190/features190.xml b/tests/src/test/java/org/aspectj/systemtest/ajc190/features190.xml new file mode 100644 index 000000000..1fb931e97 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc190/features190.xml @@ -0,0 +1,172 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="features190/efficientTJP" title="tjp 1"> + <compile files="One.java" options="-1.8"/> + <run class="One"> + <stdout> + <line text="void One.main(String[])"/> + <line text="One running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features190/efficientTJP" title="tjp 2"> + <compile files="Two.java" options="-Xajruntimetarget:1.9 -1.8"/> + <run class="Two"> + <stdout> + <line text="void Two.main(String[])"/> + <line text="Two running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features190/efficientTJP" title="tjp 3"> + <compile files="Three.java" options="-Xajruntimetarget:1.9 -1.8"/> + <run class="Three"> + <stdout> + <line text="Three running"/> + <line text="Three()"/> + <line text="Three(String)"/> + <line text="Three(int, String)"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features190/efficientTJP" title="tjp 3a"> + <compile files="ThreeA.java" options="-Xajruntimetarget:1.9 -1.8"/> + <run class="ThreeA"> + <stdout> + <line text="ThreeA running"/> + <line text="ThreeA()"/> + <line text="ThreeA(String)"/> + <line text="ThreeA(int, String)"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features190/efficientTJP" title="tjp 4"> + <compile files="Four.java" options="-Xajruntimetarget:1.9 -1.8"/> + <run class="Four"> + <stdout> + <line text="run() running"/> + <line text="catch(Throwable)"/> + <line text="caught something"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features190/efficientTJP" title="tjp 4a"> + <compile files="FourA.java" options="-Xajruntimetarget:1.9 -1.8"/> + <run class="FourA"> + <stdout> + <line text="run() running"/> + <line text="void FourA.run()"/> + <line text="caught something"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features190/efficientTJP" title="tjp get fields"> + <compile files="Fields.java" options="-Xajruntimetarget:1.9 -1.8"/> + <run class="Fields"> + <stdout> + <line text="int Fields.a"/> + <line text="String Fields.s"/> + <line text="double Fields.d"/> + <line text="Fields.Inner Fields.obj"/> + <line text="short Fields.ps"/> + <line text="float Fields.fs"/> + <line text="long Fields.ls"/> + <line text="byte Fields.bs"/> + <line text="char Fields.cs"/> + <line text="int Fields.as"/> + <line text="String Fields.ss"/> + <line text="double Fields.ds"/> + <line text="Fields.Inner Fields.objs"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features190/efficientTJP" title="tjp get fieldsE"> + <compile files="FieldsE.java" options="-Xajruntimetarget:1.9 -1.8"/> + <run class="FieldsE"> + <stdout> + <line text="void FieldsE.main(String[])"/> + <line text="void FieldsE.main(String[])"/> + <line text="void FieldsE.main(String[])"/> + <line text="void FieldsE.main(String[])"/> + <line text="void FieldsE.main(String[])"/> + <line text="void FieldsE.main(String[])"/> + <line text="void FieldsE.main(String[])"/> + <line text="void FieldsE.main(String[])"/> + <line text="void FieldsE.main(String[])"/> + <line text="void FieldsE.main(String[])"/> + <line text="void FieldsE.main(String[])"/> + <line text="void FieldsE.main(String[])"/> + <line text="void FieldsE.main(String[])"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features190/efficientTJP" title="tjp set fields"> + <compile files="Fields2.java" options="-Xajruntimetarget:1.9 -1.8"/> + <run class="Fields2"> + <stdout> + <line text="int Fields2.a"/> + <line text="short Fields2.ps"/> + <line text="double Fields2.d"/> + <line text="Fields2.Inner Fields2.obj"/> + <line text="String Fields2.s"/> + <line text="float Fields2.fs"/> + <line text="long Fields2.ls"/> + <line text="byte Fields2.bs"/> + <line text="char Fields2.cs"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features190/efficientTJP" title="tjp clinit"> + <compile files="Clinit.java" options="-Xajruntimetarget:1.9 -1.8"/> + <run class="Clinit"> + <stdout> + <line text="Clinit.<clinit>"/> + <line text="Clinit.Inner.<clinit>"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features190/efficientTJP" title="tejp clinit"> + <compile files="ClinitE.java" options="-Xajruntimetarget:1.9 -1.8"/> + <run class="ClinitE"> + <stdout> + <line text="ClinitE.<clinit>"/> + <line text="ClinitE.Inner.<clinit>"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features190/efficientTJP" title="tjp advice"> + <compile files="Advice.java" options="-Xajruntimetarget:1.9 -1.8"/> + <run class="Advice"> + <stdout> + <line text="tjp:void X.before()"/> + <line text="tejp:void X.before()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="features190/efficientTJP" title="tjp init"> + <compile files="Init.java" options="-Xajruntimetarget:1.9 -1.8"/> + <run class="Init"> + <stdout> + <line text="A()"/> + <line text="A()"/> + <line text="B()"/> + <line text="B()"/> + </stdout> + </run> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc190/sanity-tests-19.xml b/tests/src/test/java/org/aspectj/systemtest/ajc190/sanity-tests-19.xml new file mode 100644 index 000000000..4965b448a --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc190/sanity-tests-19.xml @@ -0,0 +1,70 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.6.0 Tests --> +<suite> + + <!-- empty class --> + <ajc-test dir="bugs160/simplejava" title="simple - a"> + <compile files="SimpleA.java" options="-1.9"/> + </ajc-test> + + <!-- class with one method --> + <ajc-test dir="bugs160/simplejava" title="simple - b"> + <compile files="SimpleB.java" options="-1.9"/> + <run class="SimpleB"/> + </ajc-test> + + <!-- empty aspect --> + <ajc-test dir="bugs160/simplejava" title="simple - c"> + <compile files="SimpleC.java" options="-1.9"/> + </ajc-test> + + <!-- simple before --> + <ajc-test dir="bugs160/simplejava" title="simple - d"> + <compile files="SimpleD.java" options="-1.9"/> + </ajc-test> + + <!-- simple itd field --> + <ajc-test dir="bugs160/simplejava" title="simple - e"> + <compile files="SimpleE.java" options="-1.9"/> + </ajc-test> + + <!-- aspect with main calling a static method --> + <ajc-test dir="bugs160/simplejava" title="simple - f"> + <compile files="SimpleF.java" options="-1.9"/> + </ajc-test> + + <!-- pertarget --> + <ajc-test dir="bugs160/simplejava" title="simple - g"> + <compile files="SimpleG.java" options="-1.9"/> + </ajc-test> + + <!-- generic ctor itds --> + <ajc-test dir="bugs160/simplejava" title="simple - h"> + <compile files="SimpleH.java" options="-1.9"/> + </ajc-test> + + <!-- overriding generic itd methods --> + <ajc-test dir="bugs160/simplejava" title="simple - i"> + <compile files="SimpleI.java" options="-1.9"/> + </ajc-test> + + <!-- check class file version is 53.0 --> + <ajc-test dir="bugs160/simplejava" title="simple - j"> + <compile files="SimpleJ.java" options="-1.9"/> + </ajc-test> + + <!-- check class file version is 53.0 --> + <ajc-test dir="bugs160/simplejava" title="simple - k"> + <compile files="SimpleJ.java" options="-source 1.9"/> + </ajc-test> + + <!-- check class file version is 49.0 --> + <ajc-test dir="bugs160/simplejava" title="simple - m"> + <compile files="SimpleJ.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs160/simplejava" title="simple - n"> + <compile files="SimpleN.java" options="-1.9"/> + </ajc-test> +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc191/Ajc191Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc191/Ajc191Tests.java new file mode 100644 index 000000000..230a9128d --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc191/Ajc191Tests.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2018 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.ajc191; + +import java.io.File; + +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.testing.XMLBasedAjcTestCaseForJava10OrLater; + +import junit.framework.Test; + +/** + * @author Andy Clement + */ +public class Ajc191Tests extends XMLBasedAjcTestCaseForJava10OrLater { + + public void testVar1() { + runTest("var 1"); + } + + public void testVar2() { + runTest("var 2"); + } + + public void testVarIncludesAspect3() { + runTest("var 3"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc191Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc191.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc191/AllTestsAspectJ191.java b/tests/src/test/java/org/aspectj/systemtest/ajc191/AllTestsAspectJ191.java new file mode 100644 index 000000000..8588b845b --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc191/AllTestsAspectJ191.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2018 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.ajc191; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ191 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.9.1 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc191Tests.suite()); + suite.addTest(SanityTestsJava10.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc191/SanityTestsJava10.java b/tests/src/test/java/org/aspectj/systemtest/ajc191/SanityTestsJava10.java new file mode 100644 index 000000000..f4b8f3698 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc191/SanityTestsJava10.java @@ -0,0 +1,98 @@ +/******************************************************************************* + * Copyright (c) 2006, 2081 IBM and 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 + *******************************************************************************/ +package org.aspectj.systemtest.ajc191; + +import java.io.File; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.testing.XMLBasedAjcTestCase; + +import junit.framework.Test; + +/* + * Some very trivial tests that help verify things are OK. + * These are a copy of the earlier Sanity Tests created for 1.6 but these supply the -10 option + * to check code generation and modification with that version specified. + * + * @author Andy Clement + */ +public class SanityTestsJava10 extends org.aspectj.testing.XMLBasedAjcTestCase { + + // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) + public void testSimpleJava_A() { + runTest("simple - a"); + } + + public void testSimpleJava_B() { + runTest("simple - b"); + } + + public void testSimpleCode_C() { + runTest("simple - c"); + } + + public void testSimpleCode_D() { + runTest("simple - d"); + } + + public void testSimpleCode_E() { + runTest("simple - e"); + } + + public void testSimpleCode_F() { + runTest("simple - f"); + } + + public void testSimpleCode_G() { + runTest("simple - g"); + } + + public void testSimpleCode_H() { + runTest("simple - h", true); + } + + public void testSimpleCode_I() { + runTest("simple - i"); + } + + public void testVersionCorrect1() throws ClassNotFoundException { + runTest("simple - j"); + checkVersion("A", 54, 0); + } + + public void testVersionCorrect2() throws ClassNotFoundException { + runTest("simple - k"); + checkVersion("A", 54, 0); + } + + public void testVersionCorrect4() throws ClassNotFoundException { // check it is 49.0 when -1.5 is specified + runTest("simple - m"); + checkVersion("A", 49, 0); + } + + private void checkVersion(String classname, int major, int minor) throws ClassNotFoundException { + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname); + if (jc.getMajor() != major) { + fail("Expected major version to be " + major + " but was " + jc.getMajor()); + } + if (jc.getMinor() != minor) { + fail("Expected minor version to be " + minor + " but was " + jc.getMinor()); + } + } + + // /////////////////////////////////////// + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(SanityTestsJava10.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("sanity-tests-10.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc191/ajc191.xml b/tests/src/test/java/org/aspectj/systemtest/ajc191/ajc191.xml new file mode 100644 index 000000000..3a87375e9 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc191/ajc191.xml @@ -0,0 +1,36 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs191/var" title="var 1"> + <compile files="Code1.java" options="-10"> + </compile> + <run class="Code1"> + <stdout> + <line text="class java.lang.String"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs191/var" title="var 2"> + <compile files="Code2.java" options="-10"> + </compile> + <run class="Code2"> + <stdout> + <line text="class java.util.ArrayList"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs191/var" title="var 3"> + <compile files="Code3.java" options="-10"> + </compile> + <run class="Code3"> + <stdout> + <line text="call(Class java.lang.Object.getClass())"/> + <line text="class java.lang.String"/> + </stdout> + </run> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc191/sanity-tests-10.xml b/tests/src/test/java/org/aspectj/systemtest/ajc191/sanity-tests-10.xml new file mode 100644 index 000000000..a6bdbd938 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc191/sanity-tests-10.xml @@ -0,0 +1,70 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ v1.6.0 Tests --> +<suite> + + <!-- empty class --> + <ajc-test dir="bugs160/simplejava" title="simple - a"> + <compile files="SimpleA.java" options="-10"/> + </ajc-test> + + <!-- class with one method --> + <ajc-test dir="bugs160/simplejava" title="simple - b"> + <compile files="SimpleB.java" options="-10"/> + <run class="SimpleB"/> + </ajc-test> + + <!-- empty aspect --> + <ajc-test dir="bugs160/simplejava" title="simple - c"> + <compile files="SimpleC.java" options="-10"/> + </ajc-test> + + <!-- simple before --> + <ajc-test dir="bugs160/simplejava" title="simple - d"> + <compile files="SimpleD.java" options="-10"/> + </ajc-test> + + <!-- simple itd field --> + <ajc-test dir="bugs160/simplejava" title="simple - e"> + <compile files="SimpleE.java" options="-10"/> + </ajc-test> + + <!-- aspect with main calling a static method --> + <ajc-test dir="bugs160/simplejava" title="simple - f"> + <compile files="SimpleF.java" options="-10"/> + </ajc-test> + + <!-- pertarget --> + <ajc-test dir="bugs160/simplejava" title="simple - g"> + <compile files="SimpleG.java" options="-10"/> + </ajc-test> + + <!-- generic ctor itds --> + <ajc-test dir="bugs160/simplejava" title="simple - h"> + <compile files="SimpleH.java" options="-10"/> + </ajc-test> + + <!-- overriding generic itd methods --> + <ajc-test dir="bugs160/simplejava" title="simple - i"> + <compile files="SimpleI.java" options="-10"/> + </ajc-test> + + <!-- check class file version is 54.0 --> + <ajc-test dir="bugs160/simplejava" title="simple - j"> + <compile files="SimpleJ.java" options="-10"/> + </ajc-test> + + <!-- check class file version is 54.0 --> + <ajc-test dir="bugs160/simplejava" title="simple - k"> + <compile files="SimpleJ.java" options="-source 10"/> + </ajc-test> + + <!-- check class file version is 49.0 --> + <ajc-test dir="bugs160/simplejava" title="simple - m"> + <compile files="SimpleJ.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs160/simplejava" title="simple - n"> + <compile files="SimpleN.java" options="-10"/> + </ajc-test> +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc192/Ajc192Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc192/Ajc192Tests.java new file mode 100644 index 000000000..ea1215b2d --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc192/Ajc192Tests.java @@ -0,0 +1,98 @@ +/******************************************************************************* + * Copyright (c) 2018 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.ajc192; + +import java.io.File; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.NestHost; +import org.aspectj.apache.bcel.classfile.NestMembers; +import org.aspectj.testing.XMLBasedAjcTestCase; + +import junit.framework.Test; + +/** + * @author Andy Clement + */ +public class Ajc192Tests extends XMLBasedAjcTestCase { + + public void testITDLambdas() throws Exception { + runTest("itd lambdas"); + } + + public void test11Flags() throws Exception { + runTest("11flags"); + } + + public void testNestmates() throws Exception { + runTest("nestmates"); + JavaClass outer = getClassFrom(ajc.getSandboxDirectory(), "Outer"); + JavaClass inner = getClassFrom(ajc.getSandboxDirectory(), "Outer$Inner"); + NestMembers nestMembers = (NestMembers) getAttributeStartsWith(outer.getAttributes(),"NestMembers"); + assertEquals(1,nestMembers.getClasses().length); + assertEquals("Outer$Inner",nestMembers.getClassesNames()[0]); + NestHost nestHost = (NestHost) getAttributeStartsWith(inner.getAttributes(),"NestHost"); + assertEquals("Outer",nestHost.getHostClassName()); + } + + // Verifying not destroyed on weaving + public void testNestmates2() throws Exception { + runTest("nestmates 2"); + JavaClass outer = getClassFrom(ajc.getSandboxDirectory(), "Outer2"); + JavaClass inner = getClassFrom(ajc.getSandboxDirectory(), "Outer2$Inner2"); + NestMembers nestMembers = (NestMembers) getAttributeStartsWith(outer.getAttributes(),"NestMembers"); + assertEquals(1,nestMembers.getClasses().length); + assertEquals("Outer2$Inner2",nestMembers.getClassesNames()[0]); + NestHost nestHost = (NestHost) getAttributeStartsWith(inner.getAttributes(),"NestHost"); + assertEquals("Outer2",nestHost.getHostClassName()); + } + + public void testCflowFinal() { + runTest("no final on cflow elements"); + } + + // TODO Still to be fixed, the workaround to not mix style is good enough for now... + public void xtestAroundAdvice_AnnoStyle() { + runTest("around advice"); + } + + public void testAroundAdvice_CodeStyle() { + runTest("around advice - 2"); + } + + public void testPTW_nonPrivileged() { + runTest("ptw"); + } + + public void testPTW_nonPrivilegedSamePackage() { + runTest("ptw - same package"); + } + + public void testPTW_privileged() { + runTest("ptw - privileged"); + } + + public void testPTWW_privilegedSamePackage() { + runTest("ptw - privileged same package"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc192Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc192.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc192/AllTestsAspectJ192.java b/tests/src/test/java/org/aspectj/systemtest/ajc192/AllTestsAspectJ192.java new file mode 100644 index 000000000..e47b11632 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc192/AllTestsAspectJ192.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2018 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.ajc192; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ192 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.9.2 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc192Tests.suite()); + suite.addTest(SanityTestsJava11.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc192/SanityTestsJava11.java b/tests/src/test/java/org/aspectj/systemtest/ajc192/SanityTestsJava11.java new file mode 100644 index 000000000..e14ec33df --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc192/SanityTestsJava11.java @@ -0,0 +1,99 @@ +/******************************************************************************* + * Copyright (c) 2006, 2018 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 + *******************************************************************************/ +package org.aspectj.systemtest.ajc192; + +import java.io.File; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.testing.XMLBasedAjcTestCaseForJava11OrLater; + +import junit.framework.Test; + +/* + * Some very trivial tests that help verify things are OK. + * These are a copy of the earlier Sanity Tests created for 1.6 but these supply the -10 option + * to check code generation and modification with that version specified. + * + * @author Andy Clement + */ +public class SanityTestsJava11 extends XMLBasedAjcTestCaseForJava11OrLater { + + // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) + public void testSimpleJava_A() { + runTest("simple - a"); + } + + public void testSimpleJava_B() { + runTest("simple - b"); + } + + public void testSimpleCode_C() { + runTest("simple - c"); + } + + public void testSimpleCode_D() { + runTest("simple - d"); + } + + public void testSimpleCode_E() { + runTest("simple - e"); + } + + public void testSimpleCode_F() { + runTest("simple - f"); + } + + public void testSimpleCode_G() { + runTest("simple - g"); + } + + public void testSimpleCode_H() { + runTest("simple - h", true); + } + + public void testSimpleCode_I() { + runTest("simple - i"); + } + + public void testVersionCorrect1() throws ClassNotFoundException { + runTest("simple - j"); + checkVersion("A", 55, 0); + } + + public void testVersionCorrect2() throws ClassNotFoundException { + runTest("simple - k"); + checkVersion("A", 55, 0); + } + + public void testVersionCorrect4() throws ClassNotFoundException { // check it is 49.0 when -1.5 is specified + runTest("simple - m"); + checkVersion("A", 49, 0); + } + + private void checkVersion(String classname, int major, int minor) throws ClassNotFoundException { + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname); + if (jc.getMajor() != major) { + fail("Expected major version to be " + major + " but was " + jc.getMajor()); + } + if (jc.getMinor() != minor) { + fail("Expected minor version to be " + minor + " but was " + jc.getMinor()); + } + } + + // /////////////////////////////////////// + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(SanityTestsJava11.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("sanity-tests-11.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc192/ajc192.xml b/tests/src/test/java/org/aspectj/systemtest/ajc192/ajc192.xml new file mode 100644 index 000000000..095c3978a --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc192/ajc192.xml @@ -0,0 +1,140 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs192/513528" title="itd lambdas"> + <compile files="Apple.java AppleController.java AppleControllerITDAspect.java" options="-11"> + </compile> + <run class="de.scrum_master.app.AppleController"> + </run> + </ajc-test> + + <ajc-test dir="bugs192/11flags" title="11flags"> + <compile files="A.java" options="-11 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void A.foo())' in Type 'A' (A.java:8) advised by before advice from 'X' (A.java:12)"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs192/nestmates" title="nestmates"> + <compile files="Outer.java" options="-11"> + </compile> + </ajc-test> + + <ajc-test dir="bugs192/nestmates" title="nestmates 2"> + <compile files="Outer2.java" options="-11"> + </compile> + <run class="Outer2"> + <stdout> + <line text="Before main()"/> + <line text="Before i"/> + <line text="0"/> + </stdout></run> + </ajc-test> + + <ajc-test dir="bugs192/537825" title="no final on cflow elements"> + <compile files="Code.java" options="-9"> + </compile> + <run class="Code"> + <stdout> + <line text="call(void B.methodB())"/> + <line text="staticinitialization(B.<clinit>)"/> + <line text="execution(void B.methodB())"/> + <line text="call(void C.methodC())"/> + <line text="staticinitialization(C.<clinit>)"/> + <line text="execution(void C.methodC())"/> + <line text="call(void D.methodD())"/> + <line text="staticinitialization(D.<clinit>)"/> + <line text="execution(void D.methodD())"/> + <line text="get(PrintStream java.lang.System.out)"/> + <line text="call(void java.io.PrintStream.println(int))"/> + <line text="3"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs192/535156" title="around advice"> + <compile files="DemoApp.java" options="-8 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-call(void DemoApp.say())' in Type 'DemoApp' (DemoApp.java:6) advised by around advice from 'X' (DemoApp.java:14)"/> + </compile> + <run class="DemoApp"> + </run> + </ajc-test> + + <ajc-test dir="bugs192/535156" title="around advice - 2"> + <compile files="DemoApp2.java" options="-8 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-call(void DemoApp2.say())' in Type 'DemoApp2' (DemoApp2.java:6) advised by around advice from 'X' (DemoApp2.java:13)"/> + </compile> + <run class="DemoApp2"> + </run> + </ajc-test> + + <ajc-test dir="bugs192/ptw" title="ptw"> + <compile files="a/b/c/Code.java a/b/d/Foo.java" options="-8"> + </compile> + <run class="a.b.c.Code"> + <stdout> + <line text="staticinitialization(a.b.c.Code.PublicInner.<clinit>) getWithinTypeName() = a.b.c.Code$PublicInner"/> + <line text="staticinitialization(a.b.c.Code.PublicInner.<clinit>) aspectOf(a.b.c.Code$PublicInner) = a.b.d.Foo"/> + <line text="PublicInner.run()"/> + <line text="DefaultInner.run()"/> + <line text="PrivateInner.run()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs192/ptw" title="ptw - same package"> + <compile files="a/b/c/Code.java a/b/c/Foo.java" options="-8"> + </compile> + <run class="a.b.c.Code"> + <stdout> + <line text="staticinitialization(a.b.c.Code.PublicInner.<clinit>) getWithinTypeName() = a.b.c.Code$PublicInner"/> + <line text="staticinitialization(a.b.c.Code.PublicInner.<clinit>) aspectOf(a.b.c.Code$PublicInner) = a.b.c.Foo"/> + <line text="PublicInner.run()"/> + <line text="staticinitialization(a.b.c.Code.DefaultInner.<clinit>) getWithinTypeName() = a.b.c.Code$DefaultInner"/> + <line text="staticinitialization(a.b.c.Code.DefaultInner.<clinit>) aspectOf(a.b.c.Code$DefaultInner) = a.b.c.Foo"/> + <line text="DefaultInner.run()"/> + <line text="staticinitialization(a.b.c.Code.PrivateInner.<clinit>) getWithinTypeName() = a.b.c.Code$PrivateInner"/> + <line text="staticinitialization(a.b.c.Code.PrivateInner.<clinit>) aspectOf(a.b.c.Code$PrivateInner) = a.b.c.Foo"/> + <line text="PrivateInner.run()"/> + </stdout> + </run> + </ajc-test> + + + <ajc-test dir="bugs192/ptw" title="ptw - privileged"> + <compile files="a/b/c/Code.java a/b/d/FooPrivileged.java" options="-8"> + </compile> + <run class="a.b.c.Code"> + <stdout> + <line text="getWithinTypeName() = a.b.c.Code$PublicInner"/> + <line text="Aspect instance = a.b.d.Foo"/> + <line text="PublicInner.run()"/> + <line text="getWithinTypeName() = a.b.c.Code$DefaultInner"/> + <line text="Aspect instance = a.b.d.Foo"/> + <line text="DefaultInner.run()"/> + <line text="getWithinTypeName() = a.b.c.Code$PrivateInner"/> + <line text="Aspect instance = a.b.d.Foo"/> + <line text="PrivateInner.run()"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs192/ptw" title="ptw - privileged same package"> + <compile files="a/b/c/Code.java a/b/c/FooPrivileged.java" options="-8"> + </compile> + <run class="a.b.c.Code"> + <stdout> + <line text="staticinitialization(a.b.c.Code.PublicInner.<clinit>) getWithinTypeName() = a.b.c.Code$PublicInner"/> + <line text="staticinitialization(a.b.c.Code.PublicInner.<clinit>) aspectOf(a.b.c.Code$PublicInner) = a.b.c.Foo"/> + <line text="PublicInner.run()"/> + <line text="staticinitialization(a.b.c.Code.DefaultInner.<clinit>) getWithinTypeName() = a.b.c.Code$DefaultInner"/> + <line text="staticinitialization(a.b.c.Code.DefaultInner.<clinit>) aspectOf(a.b.c.Code$DefaultInner) = a.b.c.Foo"/> + <line text="DefaultInner.run()"/> + <line text="staticinitialization(a.b.c.Code.PrivateInner.<clinit>) getWithinTypeName() = a.b.c.Code$PrivateInner"/> + <line text="staticinitialization(a.b.c.Code.PrivateInner.<clinit>) aspectOf(a.b.c.Code$PrivateInner) = a.b.c.Foo"/> + <line text="PrivateInner.run()"/> + </stdout> + </run> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc192/sanity-tests-11.xml b/tests/src/test/java/org/aspectj/systemtest/ajc192/sanity-tests-11.xml new file mode 100644 index 000000000..cdce29082 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc192/sanity-tests-11.xml @@ -0,0 +1,69 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <!-- empty class --> + <ajc-test dir="bugs160/simplejava" title="simple - a"> + <compile files="SimpleA.java" options="-11"/> + </ajc-test> + + <!-- class with one method --> + <ajc-test dir="bugs160/simplejava" title="simple - b"> + <compile files="SimpleB.java" options="-11"/> + <run class="SimpleB"/> + </ajc-test> + + <!-- empty aspect --> + <ajc-test dir="bugs160/simplejava" title="simple - c"> + <compile files="SimpleC.java" options="-11"/> + </ajc-test> + + <!-- simple before --> + <ajc-test dir="bugs160/simplejava" title="simple - d"> + <compile files="SimpleD.java" options="-11"/> + </ajc-test> + + <!-- simple itd field --> + <ajc-test dir="bugs160/simplejava" title="simple - e"> + <compile files="SimpleE.java" options="-11"/> + </ajc-test> + + <!-- aspect with main calling a static method --> + <ajc-test dir="bugs160/simplejava" title="simple - f"> + <compile files="SimpleF.java" options="-11"/> + </ajc-test> + + <!-- pertarget --> + <ajc-test dir="bugs160/simplejava" title="simple - g"> + <compile files="SimpleG.java" options="-11"/> + </ajc-test> + + <!-- generic ctor itds --> + <ajc-test dir="bugs160/simplejava" title="simple - h"> + <compile files="SimpleH.java" options="-11"/> + </ajc-test> + + <!-- overriding generic itd methods --> + <ajc-test dir="bugs160/simplejava" title="simple - i"> + <compile files="SimpleI.java" options="-11"/> + </ajc-test> + + <!-- check class file version is 54.0 --> + <ajc-test dir="bugs160/simplejava" title="simple - j"> + <compile files="SimpleJ.java" options="-11"/> + </ajc-test> + + <!-- check class file version is 54.0 --> + <ajc-test dir="bugs160/simplejava" title="simple - k"> + <compile files="SimpleJ.java" options="-source 11"/> + </ajc-test> + + <!-- check class file version is 49.0 --> + <ajc-test dir="bugs160/simplejava" title="simple - m"> + <compile files="SimpleJ.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs160/simplejava" title="simple - n"> + <compile files="SimpleN.java" options="-11"/> + </ajc-test> +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc193/Ajc193Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc193/Ajc193Tests.java new file mode 100644 index 000000000..e0d6a2ede --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc193/Ajc193Tests.java @@ -0,0 +1,144 @@ +/******************************************************************************* + * Copyright (c) 2018-2019 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 + *******************************************************************************/ +package org.aspectj.systemtest.ajc193; + +import java.io.File; + +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.testing.XMLBasedAjcTestCaseForJava10OrLater; +import org.aspectj.weaver.WeaverStateInfo; + +import junit.framework.Test; + +/** + * @author Andy Clement + */ +public class Ajc193Tests extends XMLBasedAjcTestCaseForJava10OrLater { + + public void testDeclareMixinOverweavingControl() { + runTest("overweaving decm - control"); + } + + public void testDeclareMixinOverweavingReweaving() { + runTest("overweaving decm - reweaving"); + } + + public void testDeclareMixinOverweaving() { + runTest("overweaving decm - 1"); + } + + public void xtestDeclareMixinOverweaving2() { + runTest("overweaving decm - 2"); + } + + public void xtestOverweavingDeclareMixinTargetingAspect() { + runTest("mood indicator 4"); + } + + public void testOverweavingAtDecPControl() { + runTest("overweaving atdecp - control"); + } + + public void testOverweavingAtDecP() { + runTest("overweaving atdecp"); + } + + public void testComplexOverweaving1() { + // This is the same code as the other test but overweaving OFF + runTest("overweaving"); + } + + public void testComplexOverweaving2() throws Exception { + // This is the same code as the other test but overweaving ON + runTest("overweaving 2"); + // Asserting the weaver state info in the tests that will drive overweaving behaviour: + + // After step 1 of the test, MyAspect will have been applied. + JavaClass jc = getClassFrom(new File(ajc.getSandboxDirectory(),"ow1.jar"), "Application"); + WeaverStateInfo wsi = getWeaverStateInfo(jc); + assertEquals("[LMyAspect;]", wsi.getAspectsAffectingType().toString()); + assertTrue(wsi.getUnwovenClassFileData().length>0); + + // After overweaving, MyAspect2 should also be getting applied but the unwovenclassfile + // data has been blanked out - because we can no longer use it, only overweaving is possible + // once one overweaving step is done + jc = getClassFrom(ajc.getSandboxDirectory(), "Application"); + wsi = getWeaverStateInfo(jc); + assertEquals("[LMyAspect2;, LMyAspect;]", wsi.getAspectsAffectingType().toString()); + assertEquals(0,wsi.getUnwovenClassFileData().length); + } + + // Two steps of overweaving + public void testComplexOverweaving3() throws Exception { + // This is the same code as the other test but overweaving ON + runTest("overweaving 3"); + // Asserting the weaver state info in the tests that will drive overweaving behaviour: + + // After step 1 of the test, MyAspect will have been applied. + JavaClass jc = getClassFrom(new File(ajc.getSandboxDirectory(),"ow1.jar"), "Application"); + WeaverStateInfo wsi = getWeaverStateInfo(jc); + assertEquals("[LMyAspect;]", wsi.getAspectsAffectingType().toString()); + assertTrue(wsi.getUnwovenClassFileData().length>0); + + // After overweaving, MyAspect2 should also be getting applied but the unwovenclassfile + // data has been blanked out - because we can no longer use it, only overweaving is possible + // once one overweaving step is done + jc = getClassFrom(new File(ajc.getSandboxDirectory(),"ow3.jar"), "Application"); + wsi = getWeaverStateInfo(jc); + assertEquals("[LMyAspect2;, LMyAspect;]", wsi.getAspectsAffectingType().toString()); + assertEquals(0,wsi.getUnwovenClassFileData().length); + + jc = getClassFrom(ajc.getSandboxDirectory(), "Application"); + wsi = getWeaverStateInfo(jc); + assertEquals("[LMyAspect3;, LMyAspect2;, LMyAspect;]", wsi.getAspectsAffectingType().toString()); + assertEquals(0,wsi.getUnwovenClassFileData().length); + } + + // overweaving then attempt non overweaving - should fail + public void testComplexOverweaving4() throws Exception { + // This is the same code as the other test but overweaving ON + runTest("overweaving 4"); + // Asserting the weaver state info in the tests that will drive overweaving behaviour: + + // After step 1 of the test, MyAspect will have been applied. + JavaClass jc = getClassFrom(new File(ajc.getSandboxDirectory(),"ow1.jar"), "Application"); + WeaverStateInfo wsi = getWeaverStateInfo(jc); + assertEquals("[LMyAspect;]", wsi.getAspectsAffectingType().toString()); + assertTrue(wsi.getUnwovenClassFileData().length>0); + } + + // Altered version of this test from org.aspectj.systemtest.ajc150.Enums for 542682 + public void testDecpOnEnumNotAllowed_xlints() { + runTest("wildcard enum match in itd"); + } + + public void testEnumDecmixinMessage() { + runTest("declare mixin a"); + } + + public void testIsAbstractType() { + runTest("is abstract"); + } + + public void testIsAbstractType2() { + runTest("is abstract - 2"); + } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc193Tests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("ajc193.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java b/tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java new file mode 100644 index 000000000..62cfcccb2 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc193/AllTestsAspectJ193.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2018 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.ajc193; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ193 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.9.3 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc193Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc193/ajc193.xml b/tests/src/test/java/org/aspectj/systemtest/ajc193/ajc193.xml new file mode 100644 index 000000000..7d64d493e --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc193/ajc193.xml @@ -0,0 +1,326 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="bugs193/543657" vm="1.8" title="overweaving decm - control"> + <compile files="MoodIndicator.java,Code1.java" options="-showWeaveInfo -1.8"> + <message kind="weave" text="Mixing interface 'MoodIndicator$Moody' (MoodIndicator.java) into type 'Code1' (Code1.java)"/> + <message kind="weave" text="Type 'Code1' (Code1.java) has intertyped method from 'MoodIndicator' (MoodIndicator.java:'Mood MoodIndicator$Moody.getMood()')"/> + <message kind="weave" text="Join point 'method-execution(void Code1.run())' in Type 'Code1' (Code1.java:2) advised by before advice from 'MoodIndicator' (MoodIndicator.java:21)"/> + </compile> + <run class="Code1"> + <stdout> + <line text="I'm feeling HAPPY"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs193/543657" vm="1.8" title="overweaving decm - reweaving"> + <compile files="MoodIndicator.java,Code1.java" options="-showWeaveInfo -1.8" outjar="one.jar"> + <message kind="weave" text="Mixing interface 'MoodIndicator$Moody' (MoodIndicator.java) into type 'Code1' (Code1.java)"/> + <message kind="weave" text="Type 'Code1' (Code1.java) has intertyped method from 'MoodIndicator' (MoodIndicator.java:'Mood MoodIndicator$Moody.getMood()')"/> + <message kind="weave" text="Join point 'method-execution(void Code1.run())' in Type 'Code1' (Code1.java:2) advised by before advice from 'MoodIndicator' (MoodIndicator.java:21)"/> + </compile> + <compile inpath="one.jar" options="-showWeaveInfo -1.8"> + <message kind="weave" text="Mixing interface 'MoodIndicator$Moody' (MoodIndicator.java) into type 'Code1' (Code1.java)"/> + <message kind="weave" text="Type 'Code1' (Code1.java) has intertyped method from 'MoodIndicator' (MoodIndicator.java:'Mood MoodIndicator$Moody.getMood()')"/> + <message kind="weave" text="Join point 'method-execution(void Code1.run())' in Type 'Code1' (Code1.java:2) advised by before advice from 'MoodIndicator' (one.jar!MoodIndicator.class(from MoodIndicator.java))"/> + </compile> + <run class="Code1"> + <stdout> + <line text="I'm feeling HAPPY"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs193/543657" vm="1.8" title="overweaving decm - 1"> + <compile files="MoodIndicator.java,Code1.java" options="-showWeaveInfo -1.8" outjar="one.jar"> + <message kind="weave" text="Mixing interface 'MoodIndicator$Moody' (MoodIndicator.java) into type 'Code1' (Code1.java)"/> + <message kind="weave" text="Type 'Code1' (Code1.java) has intertyped method from 'MoodIndicator' (MoodIndicator.java:'Mood MoodIndicator$Moody.getMood()')"/> + <message kind="weave" text="Join point 'method-execution(void Code1.run())' in Type 'Code1' (Code1.java:2) advised by before advice from 'MoodIndicator' (MoodIndicator.java:21)"/> + </compile> + <compile files="MoodIndicator2.java" inpath="one.jar" options="-showWeaveInfo -1.8 -Xset:overWeaving=true"> + <message kind="warning" text="advice defined in MoodIndicator has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="weave" text="Mixing interface 'MoodIndicator2$Moody2' (MoodIndicator2.java) into type 'Code1' (Code1.java)"/> + <message kind="weave" text="Type 'Code1' (Code1.java) has intertyped method from 'MoodIndicator2' (MoodIndicator2.java:'Mood MoodIndicator2$Moody2.getMood2()')"/> + <message kind="weave" text="Join point 'method-execution(void Code1.run())' in Type 'Code1' (Code1.java:2) advised by before advice from 'MoodIndicator2' (MoodIndicator2.java:20)"/> + </compile> + <run class="Code1"> + <stdout> + <line text="I'm feeling SAD"/> + <line text="I'm feeling HAPPY"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs193/543657" vm="1.8" title="overweaving decm - 2"> + <compile files="MoodIndicator.java,Code1.java" options="-showWeaveInfo -1.8" outjar="one.jar"> + <message kind="weave" text="Mixing interface 'MoodIndicator$Moody' (MoodIndicator.java) into type 'Code1' (Code1.java)"/> + <message kind="weave" text="Type 'Code1' (Code1.java) has intertyped method from 'MoodIndicator' (MoodIndicator.java:'Mood MoodIndicator$Moody.getMood()')"/> + <message kind="weave" text="Join point 'method-execution(void Code1.run())' in Type 'Code1' (Code1.java:2) advised by before advice from 'MoodIndicator' (MoodIndicator.java:21)"/> + </compile> + <compile files="MoodIndicator3.java" inpath="one.jar" options="-showWeaveInfo -1.8 -Xset:overWeaving=true"> + <message kind="warning" text="advice defined in MoodIndicator has not been applied [Xlint:adviceDidNotMatch]"/> + <message kind="weave" text="Mixing interface 'MoodIndicator2$Moody2' (MoodIndicator2.java) into type 'Code1' (Code1.java)"/> + <message kind="weave" text="Type 'Code1' (Code1.java) has intertyped method from 'MoodIndicator2' (MoodIndicator2.java:'Mood MoodIndicator2$Moody2.getMood2()')"/> + <message kind="weave" text="Join point 'method-execution(void Code1.run())' in Type 'Code1' (Code1.java:2) advised by before advice from 'MoodIndicator2' (MoodIndicator2.java:20)"/> + </compile> + <run class="Code1"> + <stdout> + <line text="I'm feeling SAD"/> + <line text="I'm feeling HAPPY"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs193/543657" vm="1.8" title="mood indicator 4"> + <compile files="MoodIndicator4.java" options="-1.8" outjar="one.jar"> + </compile> + <compile inpath="one.jar" options="-1.8 -Xset:overWeaving=true"> + </compile> + <run class="Code1"> + <stdout> + <line text="I'm feeling SAD"/> + <line text="I'm feeling HAPPY"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs193/543657" vm="1.8" title="overweaving atdecp - control"> + <compile files="Basic3b.java" options="-showWeaveInfo -1.8" outjar="ow1.jar"> + <message kind="weave" text="Extending interface set for type 'Basic3b' (Basic3b.java) to include 'X$I' (Basic3b.java)"/> + <message kind="weave" text="Type 'Basic3b' (Basic3b.java) has intertyped method from 'X' (Basic3b.java:'void X$I.m2()')"/> + <message kind="weave" text="Type 'Basic3b' (Basic3b.java) has intertyped method from 'X' (Basic3b.java:'void X$I.m3()')"/> + <message kind="weave" text="Type 'Basic3b' (Basic3b.java) has intertyped method from 'X' (Basic3b.java:'void X$I.m4()')"/> + <message kind="weave" text="Join point 'method-call(void X$I.m2())' in Type 'Basic3b' (Basic3b.java:7) advised by before advice from 'X' (Basic3b.java:33)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m3())' in Type 'Basic3b' (Basic3b.java:8) advised by before advice from 'X' (Basic3b.java:33)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m2())' in Type 'Basic3b' (Basic3b.java:9) advised by before advice from 'X' (Basic3b.java:33)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m4())' in Type 'Basic3b' (Basic3b.java:10) advised by before advice from 'X' (Basic3b.java:33)"/> + <message kind="weave" text="Join point 'method-call(void java.io.PrintStream.println(java.lang.String))' in Type 'X$IIimpl' (Basic3b.java:23) advised by before advice from 'X' (Basic3b.java:33)"/> + <message kind="weave" text="Join point 'method-call(void java.io.PrintStream.println(java.lang.String))' in Type 'Basic3b' (Basic3b.java:11) advised by before advice from 'X' (Basic3b.java:33)"/> + </compile> + <compile files="Y.java" inpath="ow1.jar" options=" -1.8"> + </compile> + <run class="Basic3b"> + <stdout> + <!-- BUG: one of these should be YImpl --> + <line text="X.IImpl.m2() ran"/> + <line text="X.IImpl.m2() ran"/> + <line text="Basic3b.main ran"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs193/543657" vm="1.8" title="overweaving atdecp"> + <compile files="Basic3b.java" options="-showWeaveInfo -1.8" outjar="ow1.jar"> + <message kind="weave" text="Extending interface set for type 'Basic3b' (Basic3b.java) to include 'X$I' (Basic3b.java)"/> + <message kind="weave" text="Type 'Basic3b' (Basic3b.java) has intertyped method from 'X' (Basic3b.java:'void X$I.m2()')"/> + <message kind="weave" text="Type 'Basic3b' (Basic3b.java) has intertyped method from 'X' (Basic3b.java:'void X$I.m3()')"/> + <message kind="weave" text="Type 'Basic3b' (Basic3b.java) has intertyped method from 'X' (Basic3b.java:'void X$I.m4()')"/> + <message kind="weave" text="Join point 'method-call(void X$I.m2())' in Type 'Basic3b' (Basic3b.java:7) advised by before advice from 'X' (Basic3b.java:33)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m3())' in Type 'Basic3b' (Basic3b.java:8) advised by before advice from 'X' (Basic3b.java:33)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m2())' in Type 'Basic3b' (Basic3b.java:9) advised by before advice from 'X' (Basic3b.java:33)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m4())' in Type 'Basic3b' (Basic3b.java:10) advised by before advice from 'X' (Basic3b.java:33)"/> + <message kind="weave" text="Join point 'method-call(void java.io.PrintStream.println(java.lang.String))' in Type 'X$IIimpl' (Basic3b.java:23) advised by before advice from 'X' (Basic3b.java:33)"/> + <message kind="weave" text="Join point 'method-call(void java.io.PrintStream.println(java.lang.String))' in Type 'Basic3b' (Basic3b.java:11) advised by before advice from 'X' (Basic3b.java:33)"/> + </compile> + <compile files="Y.java" inpath="ow1.jar" options="-showWeaveInfo -1.8 -Xset:overWeaving=true"> + + <message kind="weave" text="Join point 'method-call(void java.io.PrintStream.println(java.lang.String))' in Type 'Y$IIimpl' (Y.java:10) advised by before advice from 'Y' (Y.java:17)"/> + <message kind="weave" text="Join point 'method-call(void java.io.PrintStream.println(java.lang.String))' in Type 'Y$IIimpl' (Y.java:10) advised by before advice from 'X' (ow1.jar!X.class(from Basic3b.java))"/> + <message kind="weave" text="Join point 'method-call(void X.advice1())' in Type 'X$IIimpl' (Basic3b.java:23) advised by before advice from 'Y' (Y.java:17)"/> + <message kind="weave" text="Join point 'method-call(void java.io.PrintStream.println(java.lang.String))' in Type 'X$IIimpl' (Basic3b.java:23) advised by before advice from 'Y' (Y.java:17)"/> + <message kind="weave" text="Extending interface set for type 'Basic3b' (Basic3b.java) to include 'Y$I' (Y.java)"/> + <message kind="weave" text="Join point 'method-call(void X.advice1())' in Type 'Basic3b' (Basic3b.java:7) advised by before advice from 'Y' (Y.java:17)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m2())' in Type 'Basic3b' (Basic3b.java:7) advised by before advice from 'Y' (Y.java:17)"/> + <message kind="weave" text="Join point 'method-call(void X.advice1())' in Type 'Basic3b' (Basic3b.java:8) advised by before advice from 'Y' (Y.java:17)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m3())' in Type 'Basic3b' (Basic3b.java:8) advised by before advice from 'Y' (Y.java:17)"/> + <message kind="weave" text="Join point 'method-call(void X.advice1())' in Type 'Basic3b' (Basic3b.java:9) advised by before advice from 'Y' (Y.java:17)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m2())' in Type 'Basic3b' (Basic3b.java:9) advised by before advice from 'Y' (Y.java:17)"/> + <message kind="weave" text="Join point 'method-call(void X.advice1())' in Type 'Basic3b' (Basic3b.java:10) advised by before advice from 'Y' (Y.java:17)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m4())' in Type 'Basic3b' (Basic3b.java:10) advised by before advice from 'Y' (Y.java:17)"/> + <message kind="weave" text="Join point 'method-call(void X.advice1())' in Type 'Basic3b' (Basic3b.java:11) advised by before advice from 'Y' (Y.java:17)"/> + <message kind="weave" text="Join point 'method-call(void java.io.PrintStream.println(java.lang.String))' in Type 'Basic3b' (Basic3b.java:11) advised by before advice from 'Y' (Y.java:17)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m2())' in Type 'Basic3b' (Basic3b.java:1) advised by before advice from 'Y' (Y.java:17)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m3())' in Type 'Basic3b' (Basic3b.java:1) advised by before advice from 'Y' (Y.java:17)"/> + <message kind="weave" text="Join point 'method-call(void X$I.m4())' in Type 'Basic3b' (Basic3b.java:1) advised by before advice from 'Y' (Y.java:17)"/> + </compile> + <run class="Basic3b"> + <stdout> + <!-- BUG: one of these should be YImpl --> + <line text="X.IImpl.m2() ran"/> + <line text="X.IImpl.m2() ran"/> + <line text="Basic3b.main ran"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs193/389678" vm="1.8" title="overweaving"> + <compile files="OverWeave_1/src/Application.java,OverWeave_1/src/MyAspect.aj" options="-showWeaveInfo -1.8" outjar="ow1.jar"> + <message kind="weave" text="Join point 'method-execution(void Application.main(java.lang.String[]))' in Type 'Application' (Application.java:2) advised by before advice from 'MyAspect' (MyAspect.aj:2)"/> + <message kind="weave" text="Join point 'method-execution(void Application.sayHelloTo(java.lang.String))' in Type 'Application' (Application.java:6) advised by before advice from 'MyAspect' (MyAspect.aj:2)"/> + </compile> + <compile files="OverWeave_2/src/MyAspect2.aj" options="-1.8" outjar="ow2.jar"> + <message kind="warning" text="advice defined in MyAspect2 has not been applied"/> + </compile> + <compile inpath="ow1.jar" aspectpath="ow2.jar" options="-1.8 -showWeaveInfo"> + <message kind="weave" text="Join point 'method-execution(void Application.main(java.lang.String[]))' in Type 'Application' (Application.java:2) advised by before advice from 'MyAspect2' (ow2.jar!MyAspect2.class:2(from MyAspect2.aj))"/> + <message kind="weave" text="Join point 'method-execution(void Application.main(java.lang.String[]))' in Type 'Application' (Application.java:2) advised by before advice from 'MyAspect' (ow1.jar!MyAspect.class:2(from MyAspect.aj))"/> + <message kind="weave" text="Join point 'method-execution(void Application.sayHelloTo(java.lang.String))' in Type 'Application' (Application.java:6) advised by before advice from 'MyAspect2' (ow2.jar!MyAspect2.class:2(from MyAspect2.aj))"/> + <message kind="weave" text="Join point 'method-execution(void Application.sayHelloTo(java.lang.String))' in Type 'Application' (Application.java:6) advised by before advice from 'MyAspect' (ow1.jar!MyAspect.class:2(from MyAspect.aj))"/> + </compile> + <run class="Application" classpath="ow2.jar"> + <stdout> + <line text="MyAspect -> execution(void Application.main(String[]))"/> + <line text="MyAspect2 -> execution(void Application.main(String[]))"/> + <line text="MyAspect -> execution(void Application.sayHelloTo(String))"/> + <line text="MyAspect2 -> execution(void Application.sayHelloTo(String))"/> + <line text="Hello world!"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs193/389678" vm="1.8" title="overweaving 2"> + <compile files="OverWeave_1/src/Application.java,OverWeave_1/src/MyAspect.aj" options="-showWeaveInfo -1.8" outjar="ow1.jar"> + <message kind="weave" text="Join point 'method-execution(void Application.main(java.lang.String[]))' in Type 'Application' (Application.java:2) advised by before advice from 'MyAspect' (MyAspect.aj:2)"/> + <message kind="weave" text="Join point 'method-execution(void Application.sayHelloTo(java.lang.String))' in Type 'Application' (Application.java:6) advised by before advice from 'MyAspect' (MyAspect.aj:2)"/> + </compile> + <compile files="OverWeave_2/src/MyAspect2.aj" options="-1.8" outjar="ow2.jar"> + <message kind="warning" text="advice defined in MyAspect2 has not been applied"/> + </compile> + <compile inpath="ow1.jar" aspectpath="ow2.jar" options="-showWeaveInfo -1.8 -Xset:overWeaving=true"> + <!-- this is a bit unfortunate, basically MyAspect is not being re-applied because of overweaving + so we get a message that it hasn't been applied. But really it doesn't need to be. --> + <message kind="warning" text="advice defined in MyAspect has not been applied"/> +<!-- These two don't come out because we are using overweaving to apply MyAspect2 where MyAspect is already applied. + <message kind="weave" text="Join point 'method-execution(void Application.sayHelloTo(java.lang.String))' in Type 'Application' (Application.java:6) advised by before advice from 'MyAspect' (ow1.jar!MyAspect.class:2(from MyAspect.aj))"/> + <message kind="weave" text="Join point 'method-execution(void Application.main(java.lang.String[]))' in Type 'Application' (Application.java:2) advised by before advice from 'MyAspect' (ow1.jar!MyAspect.class:2(from MyAspect.aj))"/> +--> + <message kind="weave" text="Join point 'method-execution(void Application.main(java.lang.String[]))' in Type 'Application' (Application.java:2) advised by before advice from 'MyAspect2' (ow2.jar!MyAspect2.class:2(from MyAspect2.aj))"/> + <message kind="weave" text="Join point 'method-execution(void Application.sayHelloTo(java.lang.String))' in Type 'Application' (Application.java:6) advised by before advice from 'MyAspect2' (ow2.jar!MyAspect2.class:2(from MyAspect2.aj))"/> + </compile> + <run class="Application" classpath="ow2.jar"> + <stdout> + <!-- notice order change to overweaving usage --> + <line text="MyAspect2 -> execution(void Application.main(String[]))"/> + <line text="MyAspect -> execution(void Application.main(String[]))"/> + <line text="MyAspect2 -> execution(void Application.sayHelloTo(String))"/> + <line text="MyAspect -> execution(void Application.sayHelloTo(String))"/> + <line text="Hello world!"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs193/389678" vm="1.8" title="overweaving 3"> + <compile files="OverWeave_1/src/Application.java,OverWeave_1/src/MyAspect.aj" options="-showWeaveInfo -1.8" outjar="ow1.jar"> + <message kind="weave" text="Join point 'method-execution(void Application.main(java.lang.String[]))' in Type 'Application' (Application.java:2) advised by before advice from 'MyAspect' (MyAspect.aj:2)"/> + <message kind="weave" text="Join point 'method-execution(void Application.sayHelloTo(java.lang.String))' in Type 'Application' (Application.java:6) advised by before advice from 'MyAspect' (MyAspect.aj:2)"/> + </compile> + <compile files="OverWeave_2/src/MyAspect2.aj" options="-1.8" outjar="ow2.jar"> + <message kind="warning" text="advice defined in MyAspect2 has not been applied"/> + </compile> + <compile files="OverWeave_4/src/MyAspect3.aj" options="-1.8" outjar="ow4.jar"> + <message kind="warning" text="advice defined in MyAspect3 has not been applied"/> + </compile> + <compile inpath="ow1.jar" aspectpath="ow2.jar" options="-showWeaveInfo -1.8 -Xset:overWeaving=true" outjar="ow3.jar"> + <!-- this is a bit unfortunate, basically MyAspect is not being re-applied because of overweaving + so we get a message that it hasn't been applied. But really it doesn't need to be. --> + <message kind="warning" text="advice defined in MyAspect has not been applied"/> + <message kind="weave" text="Join point 'method-execution(void Application.main(java.lang.String[]))' in Type 'Application' (Application.java:2) advised by before advice from 'MyAspect2' (ow2.jar!MyAspect2.class:2(from MyAspect2.aj))"/> + <message kind="weave" text="Join point 'method-execution(void Application.sayHelloTo(java.lang.String))' in Type 'Application' (Application.java:6) advised by before advice from 'MyAspect2' (ow2.jar!MyAspect2.class:2(from MyAspect2.aj))"/> + </compile> + <compile inpath="ow3.jar" aspectpath="ow4.jar" options="-showWeaveInfo -1.8 -Xset:overWeaving=true"> + <!-- this is a bit unfortunate, basically MyAspect is not being re-applied because of overweaving + so we get a message that it hasn't been applied. But really it doesn't need to be. --> + <message kind="warning" text="advice defined in MyAspect has not been applied"/> + <message kind="weave" text="Join point 'method-execution(void Application.main(java.lang.String[]))' in Type 'Application' (Application.java:2) advised by before advice from 'MyAspect3' (ow4.jar!MyAspect3.class:2(from MyAspect3.aj))"/> + <message kind="weave" text="Join point 'method-execution(void Application.sayHelloTo(java.lang.String))' in Type 'Application' (Application.java:6) advised by before advice from 'MyAspect3' (ow4.jar!MyAspect3.class:2(from MyAspect3.aj))"/> + </compile> + <run class="Application" classpath="ow2.jar"> + <stdout> + <line text="MyAspect3 -> execution(void Application.main(String[]))"/> + <line text="MyAspect2 -> execution(void Application.main(String[]))"/> + <line text="MyAspect -> execution(void Application.main(String[]))"/> + <line text="MyAspect3 -> execution(void Application.sayHelloTo(String))"/> + <line text="MyAspect2 -> execution(void Application.sayHelloTo(String))"/> + <line text="MyAspect -> execution(void Application.sayHelloTo(String))"/> + <line text="Hello world!"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs193/389678" vm="1.8" title="overweaving 4"> + <compile files="OverWeave_1/src/Application.java,OverWeave_1/src/MyAspect.aj" options="-showWeaveInfo -1.8" outjar="ow1.jar"> + <message kind="weave" text="Join point 'method-execution(void Application.main(java.lang.String[]))' in Type 'Application' (Application.java:2) advised by before advice from 'MyAspect' (MyAspect.aj:2)"/> + <message kind="weave" text="Join point 'method-execution(void Application.sayHelloTo(java.lang.String))' in Type 'Application' (Application.java:6) advised by before advice from 'MyAspect' (MyAspect.aj:2)"/> + </compile> + <compile files="OverWeave_2/src/MyAspect2.aj" options="-1.8" outjar="ow2.jar"> + <message kind="warning" text="advice defined in MyAspect2 has not been applied"/> + </compile> + <compile files="OverWeave_4/src/MyAspect3.aj" options="-1.8" outjar="ow4.jar"> + <message kind="warning" text="advice defined in MyAspect3 has not been applied"/> + </compile> + <compile inpath="ow1.jar" aspectpath="ow2.jar" options="-showWeaveInfo -1.8 -Xset:overWeaving=true" outjar="ow3.jar"> + <!-- this is a bit unfortunate, basically MyAspect is not being re-applied because of overweaving + so we get a message that it hasn't been applied. But really it doesn't need to be. --> + <message kind="warning" text="advice defined in MyAspect has not been applied"/> + <message kind="weave" text="Join point 'method-execution(void Application.main(java.lang.String[]))' in Type 'Application' (Application.java:2) advised by before advice from 'MyAspect2' (ow2.jar!MyAspect2.class:2(from MyAspect2.aj))"/> + <message kind="weave" text="Join point 'method-execution(void Application.sayHelloTo(java.lang.String))' in Type 'Application' (Application.java:6) advised by before advice from 'MyAspect2' (ow2.jar!MyAspect2.class:2(from MyAspect2.aj))"/> + </compile> + <compile inpath="ow3.jar" aspectpath="ow4.jar:ow2.jar" options="-1.8"> + <message kind="error" text="the type Application was previously subject to overweaving and after that can only be woven again in overweaving mode"/> + <message kind="error" text="the type MyAspect was previously subject to overweaving and after that can only be woven again in overweaving mode"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs193/542682" vm="1.5" title="wildcard enum match in itd"> + <compile files="SimpleEnum.java,SimpleEnum2.java,EnumAspect04.aj" options="-1.5"> + <message kind="warning" line="8" text="enum type SimpleEnum2 matches a declare parents type pattern but is being ignored"/> + <message kind="warning" line="8" text="enum type SimpleEnum matches a declare parents type pattern but is being ignored"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs193/542682" title="declare mixin a"> + <compile files="CaseA.java" options="-1.8"> + <message kind="warning" line="1" text="enum type Color matches a declare parents type pattern but is being ignored"/> + </compile> + <run class="CaseA"> + <stdout> + <line text="Delegate factory invoked"/> + <line text="methodOne running"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs193/isAbstractType" title="is abstract"> + <compile files="Code.java" options="-1.8"/> + <run class="Code"> + <stdout> + <line text="execution(void Code.run())"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs193/isAbstractType" title="is abstract - 2"> + <compile files="Code2.java" options="-1.8"/> + <run class="Code2"> + <stdout> + <line text="execution(void Helper.run())"/> + </stdout> + </run> + </ajc-test> + +<!-- + <ajc-test dir="bugs191/var" title="var 3"> + <compile files="Code3.java" options="-10"> + </compile> + <run class="Code3"> + <stdout> + <line text="call(Class java.lang.Object.getClass())"/> + <line text="class java.lang.String"/> + </stdout> + </run> + </ajc-test> +--> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/apt/AllTestsApt.java b/tests/src/test/java/org/aspectj/systemtest/apt/AllTestsApt.java new file mode 100644 index 000000000..fbba0be31 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/apt/AllTestsApt.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * 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.apt; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsApt { + + public static Test suite() { + TestSuite suite = new TestSuite("Annotation processing tests"); + // $JUnit-BEGIN$ + suite.addTest(AptTests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/apt/AptTests.java b/tests/src/test/java/org/aspectj/systemtest/apt/AptTests.java new file mode 100644 index 000000000..01ab16ca0 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/apt/AptTests.java @@ -0,0 +1,65 @@ +/******************************************************************************* + * Copyright (c) 2014,2018 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.apt; + +import java.io.File; + +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.util.LangUtil; + +import junit.framework.Test; + +/** + * Annotation processing tool tests. + * + * @author Sergey Stupin. + */ +public class AptTests extends XMLBasedAjcTestCase { + + public void testAptWithSpecifiedProcessor() { + if (LangUtil.is19VMOrGreater()) { + return; + } + runTest("annotation processing with specified processor"); + } + + /** + * SPI - http://docs.oracle.com/javase/tutorial/sound/SPI-intro.html + */ + public void testAptUsingSPI() { + if (LangUtil.is19VMOrGreater()) { + return; + } + runTest("annotation processing in action using SPI"); + } + + public void testDisabledApt() { + if (LangUtil.is11VMOrGreater()) { + // javax.annotation.Generated not in Java11 + return; + } + runTest("disabled annotation processing"); + } + + public void testAptWithJavaFilesAsAspects() { + runTest("annotation processing generating java files with aspects"); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AptTests.class); + } + + @Override + protected File getSpecFile() { + return getClassResource("apt-spec.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/apt/apt-spec.xml b/tests/src/test/java/org/aspectj/systemtest/apt/apt-spec.xml new file mode 100644 index 000000000..0ce327c49 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/apt/apt-spec.xml @@ -0,0 +1,101 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <ajc-test dir="apt/test1" title="annotation processing with specified processor"> + <compile options="-1.8" files="Event.java SimpleProcessor.java" + outjar="annotation_processor.jar"/> + <!-- + SimpleProcessor should generate 2 files for each java class that utilizes @Event annotation: + - {className}EventsAspect.aj - this file describes aspect with advices to weaving method annotated with @Event. + - {className}Callbacks.java - this file contains callback interfaces for methods annotated with @Event. Example: + public final class SomeCallbacks { + public interface OnMethod1 { + void changed(Some emmiter); + } + } + --> + <!-- believe fails on JDK9 because of split packages and unable to find @Generated --> + <compile options="-1.8 -processor test.SimpleProcessor -s generated -showWeaveInfo" files="Some.java" + classpath="annotation_processor.jar" outjar="code.jar"> + <message kind="weave" + text="Type 'test.Some' (Some.java) has intertyped field from 'test.SomeEventsAspect' (SomeEventsAspect.aj:'test.SomeEventsAspect$SomeOnMethod1Event test.Some.OnMethod1Event')"/> + <message kind="weave" + text="Join point 'method-execution(void test.Some.method1())' in Type 'test.Some' (Some.java:14) advised by before advice from 'test.SomeEventsAspect' (SomeEventsAspect.aj:44)"/> + </compile> + <run class="test.Some"> + <stdout> + <line text="callback registered from before aspect"/> + <line text="method1 is invoked"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="apt/test1" title="annotation processing in action using SPI"> + <!-- + what is SPI is described here - http://docs.oracle.com/javase/tutorial/sound/SPI-intro.html + --> + <!--<compile options="-1.8" files="Event.java SimpleProcessor.java" outjar="annotation_processors_with_spi.jar"/>--> + <compile options="-1.8" files="Event.java SimpleProcessor.java" outjar="annotation_processor.jar"/> + <!-- + SimpleProcessor should generate 2 files for each java class that utilizes @Event annotation: + - {className}EventsAspect.aj - this file describes aspect with advices to weaving method annotated with @Event. + - {className}Callbacks.java - this file contains callback interfaces for methods annotated with @Event. Example: + public final class SomeCallbacks { + public interface OnMethod1 { + void changed(Some emitter); + } + } + --> + + <!--apt_service_description.jar contains only SPI description file - META-INF/services/javax.annotation.processing.Processor--> + <compile options="-1.8 -s generated -showWeaveInfo" files="Some.java" + classpath="annotation_processor.jar;apt_service_description.jar" outjar="code.jar"> + <message kind="weave" + text="Type 'test.Some' (Some.java) has intertyped field from 'test.SomeEventsAspect' (SomeEventsAspect.aj:'test.SomeEventsAspect$SomeOnMethod1Event test.Some.OnMethod1Event')"/> + <message kind="weave" + text="Join point 'method-execution(void test.Some.method1())' in Type 'test.Some' (Some.java:14) advised by before advice from 'test.SomeEventsAspect' (SomeEventsAspect.aj:44)"/> + </compile> + + <run class="test.Some"> + <stdout> + <line text="callback registered from before aspect"/> + <line text="method1 is invoked"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="apt/test1" title="disabled annotation processing"> + <compile options="-1.8" files="Event.java SimpleProcessor.java" + outjar="annotation_processor.jar"/> + <!-- + SimpleProcessor should generate 2 files for each java class that utilizes @Event annotation: + - {className}EventsAspect.aj - this file describes aspect with advices to weaving method annotated with @Event. + - {className}Callbacks.java - this file contains callback interfaces for methods annotated with @Event. Example: + public final class SomeCallbacks { + public interface OnMethod1 { + void changed(Some emmiter); + } + } + --> + + <compile options="-1.8 -s generated -showWeaveInfo -proc:none" files="Some.java" + classpath="annotation_processor.jar" outjar="code.jar"> + <!--field was not injected, so error should occur--> + <message kind="error" text="OnMethod1Event cannot be resolved or is not a field"/> + </compile> + </ajc-test> + + <ajc-test dir="apt/test2" title="annotation processing generating java files with aspects"> + <compile options="-1.6" files="DemoProcessor.java Marker.java" /> + <compile options="-1.6 -showWeaveInfo -processor DemoProcessor" files="Code.java"> + <message kind="warning" text="Generated aspect to advise too"/> + <message kind="warning" text="Generated aspect to advise boo"/> + <message kind="weave" + text="Join point 'method-execution(void Code.boo())' in Type 'Code' (Code.java:6) advised by before advice from 'Advise_boo' (Advise_boo.java:2)"/> + <message kind="weave" + text="Join point 'method-execution(void Code.too())' in Type 'Code' (Code.java:9) advised by before advice from 'Advise_too' (Advise_too.java:2)"/> + </compile> + </ajc-test> + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/aspectpath/AspectPathTests.java b/tests/src/test/java/org/aspectj/systemtest/aspectpath/AspectPathTests.java new file mode 100644 index 000000000..3a77d2778 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/aspectpath/AspectPathTests.java @@ -0,0 +1,112 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM Corporation + * 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 + * + * ******************************************************************/ +package org.aspectj.systemtest.aspectpath; + +import java.io.File; +import junit.framework.Test; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class AspectPathTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AspectPathTests.class); + } + + protected File getSpecFile() { + return getClassResource("aspectpath.xml"); + } + + + public void test001(){ + runTest("testing new options"); + } + + public void test002(){ + runTest("aspect-declared interface members in libraries - baseline"); + } + + public void test003(){ + runTest("aspect-declared interface members in libraries - interfaceOnly.jar"); + } + + public void test004(){ + runTest("aspect-declared interface members in libraries - aspectOnly.jar"); + } + + public void test005(){ + runTest("aspect-declared interface members in libraries - aspectedInterfaceOnly.jar"); + } + + public void test006(){ + runTest("aspect-declared interface members in libraries - aspectedInterfaceOnly.jar,aspectOnly.jar"); + } + + public void test007(){ + runTest("aspect-declared interface members in libraries - aspectedInterfaceOnlyBinary.jar,aspectOnly.jar"); + } + + public void test008(){ + runTest("aspect-declared interface members in libraries - aspectedInterfaceOnly.jar,aspectpath=aspectOnly.jar"); + } + + public void test009(){ + runTest("aspect-declared interface members in libraries - aspectedInterfaceOnly.jar,aspectpath=aspectOnly.jar"); + } + + public void test010(){ + runTest("exception clause for aspect-declared interface methods - positive"); + } + + public void test011(){ + runTest("exception clause for aspect-declared interface methods - negative"); + } + + public void test012(){ + runTest("exception clause for aspect-declared class methods - positive"); + } + + public void test013(){ + runTest("exception clause for aspect-declared class methods - negative"); + } + + public void test014(){ + runTest("exception clause for aspect-declared interface methods - positive binary"); + } + + public void test015(){ + runTest("exception clause for aspect-declared interface methods - negative binary"); + } + + public void test016(){ + runTest("exception clause for aspect-declared class methods - positive binary"); + } + + public void test017(){ + runTest("exception clause for aspect-declared class methods - negative binary"); + } + + public void test018(){ + runTest("percflow aspects compiled from jars share one instance for all entry points"); + } + + public void test019(){ + runTest("(using aspectpath) percflow aspects compiled from jars share one instance for all entry points"); + } + + public void test020(){ + runTest("Introduced abstract method on abstract class not implemented by subtype"); + } + + public void test021(){ + runTest("Introduced abstract method on interface not implemented by subtype (aspectpath)"); + } + +} + diff --git a/tests/src/test/java/org/aspectj/systemtest/aspectpath/aspectpath-tests.xml b/tests/src/test/java/org/aspectj/systemtest/aspectpath/aspectpath-tests.xml new file mode 100644 index 000000000..5f201b355 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/aspectpath/aspectpath-tests.xml @@ -0,0 +1,192 @@ +<!-- Aspectpath Tests --> + + <!-- .................................... aspectpath tests --> + <!-- The jars used by this test can be regenerated with + org.aspectj.ajdt.core/testsrc/org.aspectj.ajdt.internal.compiler.batch.BcweaverJarMaker + --> + <ajc-test dir="new/options11" + comment="XXX not validated correct yet" + title="testing new options"> + <compile files="Main.java,injar.jar,Aspect.java" + aspectpath="aspectlib1.jar,aspectlib2.jar"/> + <!-- can't run until we support classpath including the above jars + <run class="Main"/> + --> + </ajc-test> + + <ajc-test dir="new/interfaceLibrary" + title="aspect-declared interface members in libraries - baseline"> + <compile files="lib/LibraryInterface.java, + Client.java, + LibraryAspect.java"/> + <run class="Client"/> + </ajc-test> + + <ajc-test dir="new/interfaceLibrary" + comment="prove that LibraryAspect is required" + title="aspect-declared interface members in libraries - interfaceOnly.jar"> + <compile + files="Client.java" + aspectpath="interfaceOnly.jar"> + <message kind="error" line="5"/> + </compile> + </ajc-test> + + <ajc-test dir="new/interfaceLibrary" + title="aspect-declared interface members in libraries - aspectOnly.jar"> + <compile + files="lib/LibraryInterface.java, + Client.java" + aspectpath="aspectOnly.jar"/> + <run class="Client"/> + </ajc-test> + + <ajc-test dir="new/interfaceLibrary" + title="aspect-declared interface members in libraries - aspectedInterfaceOnly.jar" + comment="prove aspect is required even if interface is woven" + > + <compile + files="Client.java" + classpath="aspectedInterfaceOnly.jar"> + <message kind="error" line="0" text="LibraryAspect"/> + <message kind="error" line="9" text="LibraryInterface"/> + </compile> + </ajc-test> + + <ajc-test dir="new/interfaceLibrary" + title="aspect-declared interface members in libraries - aspectedInterfaceOnly.jar,aspectOnly.jar" + comment="weaving required for implementations of interface? + XXX Would prefer to support javac compiles of Client here, mimicked with classpath only" + > + <compile + files="Client.java" + classpath="aspectedInterfaceOnly.jar,aspectOnly.jar"> + <message kind="error" line="9"/> + </compile> + </ajc-test> + + <ajc-test dir="new/interfaceLibrary" + title="aspect-declared interface members in libraries - aspectedInterfaceOnlyBinary.jar,aspectOnly.jar" + comment="works if aspect is only on the classpath?, i.e., no weaving XXX need javac run" + > + <compile + files="Client.java" + classpath="aspectedInterfaceOnlyBinary.jar,aspectOnly.jar"> + <message kind="error" line="9"/> + </compile> + </ajc-test> + + <ajc-test dir="new/interfaceLibrary" + title="aspect-declared interface members in libraries - aspectedInterfaceOnly.jar,aspectpath=aspectOnly.jar" + comment="can weave to create library, and then weave clients" + > + <compile + files="Client.java" + classpath="aspectedInterfaceOnly.jar" + aspectpath="aspectOnly.jar"/> + <run class="Client"/> + </ajc-test> + + <ajc-test dir="new/interfaceLibrary" + title="aspect-declared interface members in libraries - aspectedInterfaceOnly.jar,aspectpath=aspectOnly.jar" + comment="works if source aspect and binary classpath woven with aspect? + should NOT warn about affected type not since affected type is already woven?" + > + <compile + files="Client.java,LibraryAspect.java" + classpath="aspectedInterfaceOnly.jar"/> + + <run class="Client"/> + </ajc-test> + + <ajc-test + dir="bugs/interfaceLibrary" + title="exception clause for aspect-declared interface methods - positive"> + <compile files="Client.java,LibraryAspect.java,lib/LibraryInterface.java" options="-Xlint:ignore"/> + <run class="Client"/> + </ajc-test> + + <ajc-test + dir="bugs/interfaceLibrary" + title="exception clause for aspect-declared interface methods - negative"> + <compile files="ClientCE.java,LibraryAspect.java,lib/LibraryInterface.java"> + <message kind="error" file="ClientCE.java" line="5"/> + </compile> + </ajc-test> + + <ajc-test + dir="bugs/interfaceLibrary" + title="exception clause for aspect-declared class methods - positive"> + <compile files="ClassClient.java,LibraryClassAspect.java,lib/LibraryClass.java" options="-Xlint:ignore"/> + <run class="ClassClient"/> + </ajc-test> + + <ajc-test + dir="bugs/interfaceLibrary" + title="exception clause for aspect-declared class methods - negative"> + <compile files="ClassClientCE.java,LibraryClassAspect.java,lib/LibraryClass.java"> + <message kind="error" file="ClassClientCE.java" line="5"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/interfaceLibrary" + pr="41175" + title="exception clause for aspect-declared interface methods - positive binary"> + <compile files="Client.java" aspectpath="lib.jar" options="-Xlint:ignore"/> + <run class="Client"/> + </ajc-test> + + <ajc-test dir="bugs/interfaceLibrary" + pr="41175" + title="exception clause for aspect-declared interface methods - negative binary"> + <compile files="ClientCE.java" aspectpath="lib.jar"> + <message kind="error" file="ClientCE.java" line="5"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/interfaceLibrary" + pr="41175" + title="exception clause for aspect-declared class methods - positive binary"> + <compile files="ClassClient.java" aspectpath="libClass.jar" options="-Xlint:ignore"/> + <run class="ClassClient"/> + </ajc-test> + + <ajc-test dir="bugs/interfaceLibrary" + pr="41175" + title="exception clause for aspect-declared class methods - negative binary"> + <compile files="ClassClientCE.java" aspectpath="libClass.jar"> + <message kind="error" file="ClassClientCE.java" line="5"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/perCflowAndJar" + pr="41359" + title="percflow aspects compiled from jars share one instance for all entry points"> + <compile files="PerCFlowCompileFromJar.java,PerCFlowCompileFromJarTest.java"/> + <run class="PerCFlowCompileFromJarTest"/> + </ajc-test> + + <ajc-test dir="bugs/perCflowAndJar" + pr="41359" + title="(using aspectpath) percflow aspects compiled from jars share one instance for all entry points"> + <compile files="PerCFlowCompileFromJarTest.java" + aspectpath="lib.jar"/> + <run class="PerCFlowCompileFromJarTest"/> + </ajc-test> + + <ajc-test dir="bugs/abstractMethods" pr="49784" + title="Introduced abstract method on abstract class not implemented by subtype"> + <compile files="abstractClass/C.java" + aspectpath="abstractClass/jars/AandB.jar"> + <message kind="error" line="1"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/abstractMethods" pr="49784" + title="Introduced abstract method on interface not implemented by subtype (aspectpath)"> + <compile files="interface/C.java" + aspectpath="interface/jars/AandB.jar" /> + <run class="C"/> + </ajc-test> + + diff --git a/tests/src/test/java/org/aspectj/systemtest/aspectpath/aspectpath.xml b/tests/src/test/java/org/aspectj/systemtest/aspectpath/aspectpath.xml new file mode 100644 index 000000000..ba587fe9e --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/aspectpath/aspectpath.xml @@ -0,0 +1,12 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[ +<!ENTITY tests SYSTEM "../tests/src/org/aspectj/systemtest/aspectpath/aspectpath-tests.xml"> +]> + +<!-- Aspectpath Tests --> + +<suite> + +&tests; + +</suite> + diff --git a/tests/src/test/java/org/aspectj/systemtest/base/BaseTests.java b/tests/src/test/java/org/aspectj/systemtest/base/BaseTests.java new file mode 100644 index 000000000..e85d327c7 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/base/BaseTests.java @@ -0,0 +1,188 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM Corporation + * 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 + * + * ******************************************************************/ +package org.aspectj.systemtest.base; + +import java.io.File; +import junit.framework.Test; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class BaseTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(BaseTests.class); + } + + protected File getSpecFile() { + return getClassResource("baseTests.xml"); + } + + + public void test001(){ + runTest("static and non-static before methods -- one file"); + } + + public void test002(){ + runTest("static and non-static before methods -- many files"); + } + + public void test003(){ + runTest("this redirection in non-static before methods"); + } + + public void test004(){ + runTest("DEPRECATED: introductions"); + } + + public void test005(){ + runTest("before constructors -- one file"); + } + + public void test006(){ + runTest("advise weaves find methods typed to builtins or non-woven classes"); + } + + public void test007(){ + runTest("make sure new weaves work inside of packages"); + } + + public void test008(){ + runTest("make sure new weaves work inside of packages (again)"); + } + + public void test009(){ + runTest("Inheritance of class and aspect vars in weaves"); + } + + public void test010(){ + runTest("Accessibility of class and aspect members from inside weaves"); + } + + public void test011(){ + runTest("Packaged aspects referring to packaged classes"); + } + + public void test012(){ + runTest("Inheritance of methods advised by aspects"); + } + + public void test013(){ + runTest("Inherited weaves on constructor"); + } + + public void test014(){ + runTest("Initializers in Aspect and Class Bodies"); + } + + public void test015(){ + runTest("Weaver Resolution of method names in method calls passed as args"); + } + + public void test016(){ + runTest("DEPRECATED: Introduce constructor with class inheritance"); + } + + public void test017(){ + runTest("empty and singular patterns on modifiers and throws"); + } + + public void test018(){ + runTest("DEPRECATED: Introduce of constructors"); + } + + public void test019(){ + runTest("Local declarations in advise bodies"); + } + + public void test020(){ + runTest("advises on introduced methods and constructors"); + } + + public void test021(){ + runTest("DEPRECATED: Method introduction into interface implemented by abstract class"); + } + + public void test022(){ + runTest("Crossing super calls in constructors"); + } + + public void test023(){ + runTest("empty modifier pattern"); + } + + public void test024(){ + runTest("Alpha conversion of argument names in designators"); + } + + public void test025(){ + runTest("advice uses its own formals to get actuals"); + } + + public void test026(){ + runTest("DEPRECATED: introduce weaves can use this"); + } + + public void test027(){ + runTest("DEPRECATED: introduce of abstract methods works"); + } + + public void test028(){ + runTest("multiple arounds successfully intercept and return own values"); + } + + public void test029(){ + runTest("proper matching of overloaded constructors"); + } + + public void test030(){ + runTest("proper handling of formals in catch advice"); + } + + public void test031(){ + runTest("proper values for thisJoinPoint attributes"); + } + + public void test032(){ + runTest("supers, supers, supers"); + } + + public void test033(){ + runTest("operations on private and protected aspect members (++, -- in partciular)"); + } + + public void test034(){ + runTest("only register things once"); + } + + public void test035(){ + runTest("inner aspects and around"); + } + + public void test036(){ + runTest("aspect inheritance and advice, introduction"); + } + + public void test037(){ + runTest("thisResultObject for primitives"); + } + + public void test038(){ + runTest("introductions calling super."); + } + + public void test039(){ + runTest("allow one argument calls even when there's a comma in the arglist"); + } + + public void test040(){ + runTest("advice on calls to static methods even works when called on super"); + } + +} + diff --git a/tests/src/test/java/org/aspectj/systemtest/bringup/BringUpTests.java b/tests/src/test/java/org/aspectj/systemtest/bringup/BringUpTests.java new file mode 100644 index 000000000..3eb98775e --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/bringup/BringUpTests.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2004 IBM + * 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.bringup; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * These are tests that will run on Java 1.4 and use the old harness format for test specification. + */ +public class BringUpTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(BringUpTests.class); + } + + protected File getSpecFile() { + return new File("../tests/src/org/aspectj/systemtest/bringup/bringup.xml"); + } + + public void testEmptyClass() { + runTest("empty class"); + } + + public void testEmptyAspect() { + runTest("empty aspect"); + } +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/bringup/bringup.xml b/tests/src/test/java/org/aspectj/systemtest/bringup/bringup.xml new file mode 100644 index 000000000..6009c9484 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/bringup/bringup.xml @@ -0,0 +1,14 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- AspectJ Bring-up Tests --> +<suite> + + <ajc-test title="empty class" dir="bringup"> + <compile files="EmptyClass.java"></compile> + </ajc-test> + + <ajc-test title="empty aspect" dir="bringup"> + <compile files="EmptyAspect.aj"></compile> + </ajc-test> + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/design/DesignTests.java b/tests/src/test/java/org/aspectj/systemtest/design/DesignTests.java new file mode 100644 index 000000000..3a19663a6 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/design/DesignTests.java @@ -0,0 +1,84 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM Corporation + * 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 + * + * ******************************************************************/ +package org.aspectj.systemtest.design; + +import java.io.File; +import junit.framework.Test; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class DesignTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(DesignTests.class); + } + + protected File getSpecFile() { + return getClassResource("design.xml"); + } + + + public void test001(){ + runTest("initial tests for new introduction style"); + } + + public void test002(){ + runTest("overriding of introduced methods and accessibility"); + } + + public void test003(){ + runTest("within and introductions behaves correctly"); + } + + public void test004(){ + runTest("correct inheritance of multiple concrete methods"); + } + + public void test005(){ + runTest("errors in inheritance of multiple concrete methods"); + } + + public void test006(){ + runTest("declared exceptions are checked correctly on intros (errors)"); + } + + public void test007(){ + runTest("declared exceptions are checked correctly on intros"); + } + + public void test008(){ + runTest("Joinpoint is not created for foo(String) when before() advice is present."); + } + + public void test009(){ + runTest("more tests of eachobject with some difficult typing issues"); + } + + public void test010(){ + runTest("eachobject: eachobject(receptions(...)) [eachobject]"); + } + + public void test011(){ + runTest("Checking new joinpoints"); + } + + public void test012(){ + runTest("eachobject: simple test [eachobject] (still)"); + } + + public void test013(){ + runTest("scope issues with introduction (needs more work)"); + } + +// uncomment this test if we implement 42743 +// public void test014_DeclareSoft(){ +// runTest("declare soft limitation"); +// } +} + diff --git a/tests/src/test/java/org/aspectj/systemtest/design/design.xml b/tests/src/test/java/org/aspectj/systemtest/design/design.xml new file mode 100644 index 000000000..51cc93173 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/design/design.xml @@ -0,0 +1,11 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd" [ +<!ENTITY designTests SYSTEM "../tests/src/org/aspectj/systemtest/design/designtest.xml"> +]> + +<!-- Language Design Tests --> + +<suite> + +&designTests; + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/design/designtest.xml b/tests/src/test/java/org/aspectj/systemtest/design/designtest.xml new file mode 100644 index 000000000..21be1943c --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/design/designtest.xml @@ -0,0 +1,106 @@ + <ajc-test dir="design/intro" + title="initial tests for new introduction style" keywords="from-design"> + <compile files="Simple.java"/> + <run class="Simple"/> + </ajc-test> + + <ajc-test dir="design/intro" + title="overriding of introduced methods and accessibility" + keywords="from-design"> + <compile files="Overriding.java"/> + <run class="Overriding"/> + </ajc-test> + + <ajc-test dir="design/intro" + title="within and introductions behaves correctly" keywords="from-design"> + <compile files="Within.java" options="-1.4"/> + <run class="Within"/> + </ajc-test> + + <ajc-test dir="design/intro" pr="570" + title="correct inheritance of multiple concrete methods" + keywords="from-design"> + <compile files="MultiInheritCP.java"/> + <run class="MultiInheritCP"/> + </ajc-test> + + <ajc-test dir="design/intro" pr="570" + title="errors in inheritance of multiple concrete methods" + keywords="from-design"> + <compile files="MultiInheritCF.java"> +<!-- the error is: error at java\lang\Object.java::0 can't override int I2.toString() with java.lang.String java.lang.Object.toString() return types don't match--> + <message kind="error" line="0"/> + <message kind="error" line="17"/> + <message kind="error" line="18"/> + <message kind="error" line="21"/> + <message kind="error" line="41"/> + <message kind="error" line="42"/> + <message kind="error" line="43"/> + <message kind="error" line="45"/> + <message kind="error" line="46"/> + </compile> + </ajc-test> + + <ajc-test dir="design/intro" + title="declared exceptions are checked correctly on intros (errors)"> + <compile files="ExceptionsCF.java"> + <message kind="error" line="8"/> + <message kind="error" line="23"/> + </compile> + </ajc-test> + + <ajc-test dir="design/intro" + title="declared exceptions are checked correctly on intros"> + <compile files="ExceptionsCP.java"> + </compile> + <run class="ExceptionsCP"/> + </ajc-test> + + <ajc-test dir="design/reflect" + title="Joinpoint is not created for foo(String) when before() advice is present." + keywords="from-design"> + <compile files="SimpleAround1.java"/> + <run class="SimpleAround1"/> + </ajc-test> + + <ajc-test dir="design/eachobject" + title="more tests of eachobject with some difficult typing issues" + keywords="from-design"> + <compile files="Tricky3.java" options="-1.4"/> + <run class="Tricky3"/> + </ajc-test> + + <ajc-test dir="design/eachobject" + title="eachobject: eachobject(receptions(...)) [eachobject]" + keywords="from-design"> + <compile files="Tricky1.java"/> + <run class="Tricky1"/> + </ajc-test> + + <ajc-test dir="design/reflect" title="Checking new joinpoints" + keywords="from-design"> + <compile files="Coverage.java" options="-Xlint:ignore"/> + <run class="Coverage"/> + </ajc-test> + + <ajc-test dir="design/eachobject" + title="eachobject: simple test [eachobject] (still)" + keywords="from-design"> + <compile files="Simple.java"/> + <run class="Simple"/> + </ajc-test> + + <ajc-test dir="design/intro" + title="scope issues with introduction (needs more work)" + keywords="from-design"> + <compile files="p1/ScopeIssues.java,p1/C1.java"/> + <run class="p1.ScopeIssues"/> + </ajc-test> + +<!-- uncomment this test if we decide to implement 42743 + <ajc-test dir="design/soft" pr="42743" + title="declare soft limitation"> + <compile files="DeclareSoft.aj"/> + <run class="DeclareSoft"/> + </ajc-test> +--> diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/IncrementalTests.java b/tests/src/test/java/org/aspectj/systemtest/incremental/IncrementalTests.java new file mode 100644 index 000000000..a499e1421 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/IncrementalTests.java @@ -0,0 +1,309 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM Corporation + * 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 + * + * ******************************************************************/ +package org.aspectj.systemtest.incremental; + +import java.io.File; +import java.util.List; + +import junit.framework.Test; + +import org.aspectj.ajdt.internal.core.builder.AbstractStateListener; +import org.aspectj.ajdt.internal.core.builder.AjState; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class IncrementalTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(IncrementalTests.class); + } + + protected File getSpecFile() { + return getClassResource("incremental.xml"); + } + + + /* (non-Javadoc) + * @see org.aspectj.testing.XMLBasedAjcTestCase#setUp() + */ + protected void setUp() throws Exception { + super.setUp(); + AjState.FORCE_INCREMENTAL_DURING_TESTING = true; + } + + protected void tearDown() throws Exception { + super.tearDown(); + AjState.FORCE_INCREMENTAL_DURING_TESTING = false; + } + + public void test001() throws Exception { + runTest("expect class added in initial incremental tests"); + nextIncrement(false); + copyFileAndDoIncrementalBuild("src.20/main/Main.java","src/main/Main.java"); + assertAdded("main/Target.class"); + run("main.Main"); + } + + public void test002() throws Exception { + runTest("expect class removed in initial incremental tests"); + nextIncrement(false); + assertAdded("main/Target.class"); + copyFileAndDoIncrementalBuild("src.20/main/Main.java","src/main/Main.java"); + assertDeleted("main/Target.class"); + run("main.Main"); + } + + public void test003() throws Exception { + runTest("expect class updated in initial incremental tests"); + long lastTime = nextIncrement(true); + copyFileAndDoIncrementalBuild("src.20/main/Main.java","src/main/Main.java"); + assertUpdated("main/Main.class",lastTime); + run("main.Main"); + } + + public void test004() throws Exception { + runTest("add file with class"); + nextIncrement(false); + copyFileAndDoIncrementalBuild("src.20/main/Target.java","src/main/Target.java"); + assertAdded("main/Target.class"); + long lastTime = nextIncrement(true); + copyFileAndDoIncrementalBuild("src.30/main/Main.java","src/main/Main.java"); + assertUpdated("main/Main.class",lastTime); + run("main.Main"); + } + + public void test005()throws Exception { + runTest("delete source file before incremental compile"); + nextIncrement(false); + MessageSpec messageSpec = new MessageSpec(null,newMessageList(new Message(6,"delete/Target.java",null,null))); + deleteFileAndDoIncrementalBuild("src/delete/DeleteMe.java",messageSpec); + nextIncrement(false); + copyFileAndDoIncrementalBuild("src.30/delete/Target.java","src/delete/Target.java"); + run("delete.Main"); + } + + public void test006() throws Exception { + runTest("do everything in default package (sourceroots)"); + nextIncrement(false); + copyFileAndDoIncrementalBuild("changes/Target.20.java","src/Target.java"); + run("Target"); + long lastTime = nextIncrement(true); + copyFileAndDoIncrementalBuild("changes/Main.30.java","src/Main.java"); + assertUpdated("Main.class",lastTime); + nextIncrement(false); + MessageSpec messageSpec = new MessageSpec(null,newMessageList(new Message(6,"Main.java",null,null))); + deleteFileAndDoIncrementalBuild("src/Target.java",messageSpec); + nextIncrement(false); + copyFileAndDoIncrementalBuild("changes/Main.50.java","src/Main.java"); + run("Main"); + } + + public void test007() throws Exception { + runTest("change sources in default package"); + nextIncrement(false); + copyFileAndDoIncrementalBuild("changes/Main.20.java","src/Main.java"); + run("Main"); + } + + public void test008() throws Exception { + runTest("change source"); + nextIncrement(false); + copyFileAndDoIncrementalBuild("changes/Main.20.java","src/app/Main.java"); + run("app.Main"); + } + + /** + * See bug report 85297. We plugged a hole so that we check whether the contents of + * directories on the classpath have changed when deciding whether we can do an + * incremental build or not - the implementation didn't allow for the output location + * being on the classpath. This test verifies the fix is OK + */ + public void testIncrementalOKWithOutputPathOnClasspath() throws Exception { + class MyStateListener extends AbstractStateListener { + public boolean pathChange = false; + public void pathChangeDetected() {pathChange = true;} + public void aboutToCompareClasspaths(List oldClasspath, List newClasspath) {} + public void detectedClassChangeInThisDir(File f) {} + public void buildSuccessful(boolean wasFullBuild) {} + }; + MyStateListener sl = new MyStateListener(); + try { + AjState.stateListener = sl; + runTest("change source"); + nextIncrement(false); + copyFileAndDoIncrementalBuild("changes/Main.20.java","src/app/Main.java"); + assertTrue("Did not expect a path change to be detected ",!sl.pathChange); + run("app.Main"); + } finally { + AjState.stateListener=null; + } + } + + public void test009() throws Exception { + runTest("incrementally change only string literal, still expect advice"); + long lastTime = nextIncrement(true); + copyFileAndDoIncrementalBuild("changes/Main.20.java","src/packageOne/Main.java"); + assertUpdated("packageOne/Main.class",lastTime); + run("packageOne.Main",new String[] {"in longer packageOne.Main.main(..)", + "before main packageOne.Main"}, + null); + } + + public void test010() throws Exception { + runTest("add aspect source file and check world is rewoven"); + nextIncrement(false); + copyFileAndDoIncrementalBuild("changes/Detour.20.java","src/Detour.java"); + assertAdded("Detour.class"); + run("Main"); + } + + public void test011() throws Exception { + runTest("make sure additional classes generated during weave are deleted with src class file"); + nextIncrement(false); + assertTrue("AdviceOnIntroduced$AjcClosure1.class exists", + new File(ajc.getSandboxDirectory(),"AdviceOnIntroduced$AjcClosure1.class").exists()); + deleteFileAndDoIncrementalBuild("src/AdviceOnIntroduced.java"); + assertDeleted("AdviceOnIntroduced$AjcClosure1.class"); + } + + public void test012() throws Exception { + runTest("incremental with aspect-driven full rebuild"); + nextIncrement(false); + MessageSpec messageSpec = new MessageSpec(newMessageList(new Message(3,"Main.java",null,null)),null); + copyFileAndDoIncrementalBuild("changes/Aspect.20.java","src/Aspect.java",messageSpec); + run("Main"); + } + + public void testIncrementalResourceAdditionToInPath() throws Exception { + runTest("incremental with addition of resource to inpath directory"); + RunResult result = run("Hello"); + assertTrue("Should have been advised",result.getStdOut().indexOf("World") != -1); + nextIncrement(false); + assertFalse("Resource file should not exist yet",new File(ajc.getSandboxDirectory(),"AResourceFile.txt").exists()); + copyFileAndDoIncrementalBuild("changes/AResourceFile.txt", "indir/AResourceFile.txt"); + // resources are *NOT* copied from inpath directories + assertFalse("Resource file should not exist yet",new File(ajc.getSandboxDirectory(),"AResourceFile.txt").exists()); + } + + public void testAdditionOfResourceToInJar() throws Exception { + runTest("incremental with addition of resource to inpath jar"); + nextIncrement(true); + assertFalse("Resource file should not exist yet",new File(ajc.getSandboxDirectory(),"AResourceFile.txt").exists()); + copyFileAndDoIncrementalBuild("changes/MyJar.20.jar", "MyJar.jar"); + // resources *are* copied from inpath jars + assertAdded("AResourceFile.txt"); + } + + public void testRemovalOfResourceFromInJar() throws Exception { + runTest("incremental with removal of resource from inpath jar"); + nextIncrement(true); + assertAdded("AResourceFile.txt"); + copyFileAndDoIncrementalBuild("changes/MyJar.20.jar", "MyJar.jar"); + // resources *are* copied from inpath jars + assertDeleted("AResourceFile.txt"); + } + + public void testAdditionOfClassToInPathJar() throws Exception { + runTest("incremental with addition of class to inpath jar"); + nextIncrement(true); + assertFalse("Hello2.class should not exist yet",new File(ajc.getSandboxDirectory(),"Hello2.class").exists()); + copyFileAndDoIncrementalBuild("changes/MyJar.20.jar", "MyJar.jar"); + assertAdded("Hello2.class"); + } + + public void testRemovalOfClassFromInPathJar() throws Exception { + runTest("incremental with removal of class from inpath jar"); + nextIncrement(true); + assertAdded("Hello2.class"); + copyFileAndDoIncrementalBuild("changes/MyJar.20.jar", "MyJar.jar"); + assertDeleted("Hello2.class"); + } + + public void testAdditionOfClassToInJarJar() throws Exception { + runTest("incremental with addition of class to injar jar"); + nextIncrement(true); + assertFalse("Hello2.class should not exist yet",new File(ajc.getSandboxDirectory(),"Hello2.class").exists()); + copyFileAndDoIncrementalBuild("changes/MyJar.20.jar", "MyJar.jar"); + assertAdded("Hello2.class"); + } + + public void testRemovalOfClassFromInJarJar() throws Exception { + runTest("incremental with removal of class from injar jar"); + nextIncrement(true); + assertAdded("Hello2.class"); + copyFileAndDoIncrementalBuild("changes/MyJar.20.jar", "MyJar.jar"); + assertDeleted("Hello2.class"); + } + + public void testAdditionOfClassToInPathDir() throws Exception { + runTest("incremental with addition of class to inpath dir"); + nextIncrement(true); + assertFalse("Hello2.class should not exist yet",new File(ajc.getSandboxDirectory(),"Hello2.class").exists()); + copyFileAndDoIncrementalBuild("changes/Hello2.20.class", "indir/Hello2.class"); + assertAdded("Hello2.class"); + } + + public void testRemovalOfClassFromInPathDir() throws Exception { + runTest("incremental with removal of class from inpath dir"); + nextIncrement(true); + assertAdded("Hello2.class"); + deleteFileAndDoIncrementalBuild("indir/Hello2.class"); + assertDeleted("Hello2.class"); + } + + public void testUpdateOfClassInInPathDir() throws Exception { + runTest("incremental with update of class in inpath dir"); + nextIncrement(true); + RunResult before = run("Hello"); + assertTrue("Should say hello",before.getStdOut().startsWith("hello")); + copyFileAndDoIncrementalBuild("changes/Hello.20.class", "indir/Hello.class"); + RunResult after = run("Hello"); + assertTrue("Should say updated hello",after.getStdOut().startsWith("updated hello")); + } + + public void testUsesPointcutRelsWhenReferringToPCTIn2ndFile_pr90806() throws Exception { + runTest("NPE in genHandleIdentifier"); + nextIncrement(true); + copyFileAndDoIncrementalBuild("changes/X.20.aj","src/X.aj"); + } + + public void testPersistingDeow_pr84033() throws Exception { + runTest("incremental declare error persists after fix"); + copyFileAndDoIncrementalBuild("changes/Aspect.20.java", "src/pack/Aspect.java"); + nextIncrement(true); + RunResult before = run("pack.Main"); + } + + public void testIncrementalUpdateOfBodyInAroundAdvice_pr154054() throws Exception { + runTest("incremental update of body in around advice"); + nextIncrement(true); + RunResult before = run("MyClass"); + assertTrue("value should be 13 but was " + before.getStdOut(), + before.getStdOut().startsWith("13")); + // update value added to proceed + copyFileAndDoIncrementalBuild("changes/MyAspect.20.aj","src/MyAspect.aj"); + RunResult after = run("MyClass"); + assertTrue("value should be 14 but was " + after.getStdOut(), + after.getStdOut().startsWith("14")); + } + + public void testIncrementalUpdateOfBodyInAroundAdviceWithString_pr154054() throws Exception { + runTest("incremental update of body in around advice with string"); + nextIncrement(true); + RunResult before = run("MyClass"); + assertTrue("expected 'Fred and George' in output but found " + before.getStdOut(), + before.getStdOut().startsWith("Fred and George")); + // update value added to proceed + copyFileAndDoIncrementalBuild("changes/MyAspect.30.aj","src/MyAspect.aj"); + RunResult after = run("MyClass"); + assertTrue("expected 'Fred and Harry' in output but found " + after.getStdOut(), + after.getStdOut().startsWith("Fred and Harry")); + } +} + diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/incremental-junit-tests.xml b/tests/src/test/java/org/aspectj/systemtest/incremental/incremental-junit-tests.xml new file mode 100644 index 000000000..659abff47 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/incremental-junit-tests.xml @@ -0,0 +1,409 @@ +<!-- Incremental compilation Tests --> + + <ajc-test dir="incrementalju/initialTests/classAdded" + title="expect class added in initial incremental tests" + keywords="incremental-test" > + <compile staging="true" + options="-incremental" + sourceroots="src"/> + <run class="main.Main"/> + <!-- + <inc-compile tag="20" > + <dir-changes added="main.Target"/> + </inc-compile> + <run class="main.Main" skipTester="true"/> + --> + </ajc-test> + + <ajc-test dir="incrementalju/initialTests/classRemoved" + title="expect class removed in initial incremental tests" + keywords="incremental-test" > + <compile staging="true" + options="-incremental" + sourceroots="src"/> + <run class="main.Main"/> + <!-- + <inc-compile tag="20"> + <dir-changes removed="main.Target"/> + </inc-compile> + <run class="main.Main"/> + --> + </ajc-test> + + <ajc-test dir="incrementalju/initialTests/classUpdated" + title="expect class updated in initial incremental tests" + keywords="incremental-test" > + <compile staging="true" + options="-incremental" + sourceroots="src"/> + <run class="main.Main"/> + <!-- + <inc-compile tag="20"> + <dir-changes updated="main.Main"/> + </inc-compile> + <run class="main.Main"/> + --> + </ajc-test> + + <ajc-test dir="incrementalju/initialTests/sourceAdded" + title="add file with class" + comment="only expecting pickup if sourceroots" + keywords="incremental-test" > + <compile staging="true" + options="-incremental" + sourceroots="src"/> + <run class="main.Main"/> + <!-- + <inc-compile tag="20"> + <dir-changes added="main.Target"/> + </inc-compile> + <inc-compile tag="30"> + <dir-changes updated="main.Main"/> + </inc-compile> + <run class="main.Main"/> + --> + </ajc-test> + + <ajc-test dir="incrementalju/initialTests/sourceDeleted" + title="delete source file before incremental compile" + comment="build config should permit file deletions for incremental (sourceroots)" + keywords="incremental-test" > + <compile staging="true" + options="-incremental" + sourceroots="src"/> + <run class="delete.Main"/> + <!-- + <inc-compile tag="20"> + <dir-changes removed="delete.DeleteMe"/> + <message kind="error" line="6" file="delete/Target.java"/> + </inc-compile> + <inc-compile tag="30"/> + <run class="delete.Main"/> + --> + </ajc-test> + + <ajc-test dir="incrementalju/initialTests/defaultPackage" + title="do everything in default package (sourceroots)" + keywords="incremental-test" > + <compile staging="true" + options="-incremental" + sourceroots="src"/> + <run class="Main"/> + <!-- + <inc-compile tag="20"> + <dir-changes added="Target"/> + </inc-compile> + <run class="Target" skipTester="true"/> + <inc-compile tag="30"> + <dir-changes updated="Main"/> + </inc-compile> + <run class="Main" skipTester="true"/> + <inc-compile tag="40"> + <message kind="error" line="6" file="Main.java"/> + </inc-compile> + <inc-compile tag="50"/> + <run class="Main"/> + --> + </ajc-test> + + <ajc-test dir="incrementalju/defaultPackage" + keywords="incremental-test" + title="change sources in default package"> + <compile + staging="true" + options="-incremental" + sourceroots="src"/> + <run class="Main"/> + <!-- + <inc-compile tag="20"/> + <run class="Main"/> + --> + </ajc-test> + + <ajc-test dir="incrementalju/interPackage" + keywords="incremental-test" + title="change source"> + <compile + staging="true" + options="-incremental" + sourceroots="src"/> + <run class="app.Main"/> + <!-- + <inc-compile tag="20"/> + <run class="app.Main"/> + --> + </ajc-test> + + <ajc-test dir="incrementalju/stringliteral" + keywords="incremental-test" + title="incrementally change only string literal, still expect advice"> + <compile staging="true" options="-incremental" + sourceroots="src"/> + <run class="packageOne.Main" + options="in packageOne.Main.main(..),before main packageOne.Main"/> + <!-- + <inc-compile tag="20"> + <dir-changes updated="packageOne.Main"/> + </inc-compile> + <run class="packageOne.Main" + options="in longer packageOne.Main.main(..), + before main packageOne.Main"/> + --> + </ajc-test> + + <ajc-test dir="incrementalju/initialTests/aspectSourceAdded" + title="add aspect source file and check world is rewoven" + keywords="incremental-test" > + <compile staging="true" + options="-incremental" + sourceroots="src"/> + <!-- + <inc-compile tag="20"> + <dir-changes added="Detour"/> + </inc-compile> + <run class="Main"/> + --> + </ajc-test> + + <ajc-test dir="incrementalju/initialTests/classWAroundClosureRemoved" + title="make sure additional classes generated during weave are deleted with src class file" + keywords="incremental-test"> + <compile staging="true" + options="-incremental" + sourceroots="src"/> + <!-- + <inc-compile tag="20" > + <dir-changes removed="AdviceOnIntroduced$AjcClosure1"/> + </inc-compile> + --> + </ajc-test> + + <ajc-test dir="incrementalju/full-rebuild" + pr="59895" + title="incremental with aspect-driven full rebuild"> + <compile + staging="true" + sourceroots="src" + options="-incremental"> + <message kind="error" line="3" file="Aspect.java"/> + </compile> + <!-- + <inc-compile tag="20"> + <message kind="warning" line="3" file="Main.java"/> + </inc-compile> + <run class="Main"/> + --> + </ajc-test> + + <ajc-test dir="incrementalju/resourceTests/resourceAdded" + pr="54622" + title="incremental with addition of resource to inpath directory"> + <compile + staging="true" + sourceroots="src" + options="-incremental" + inpath="indir"> + </compile> + <!-- + <inc-compile tag="20"> + </inc-compile> + <run class="Main"/> + --> + </ajc-test> + + + <ajc-test dir="incrementalju/resourceTests/resourceAdded" + pr="54622" + title="incremental with addition of resource to inpath jar"> + <compile + staging="true" + sourceroots="src" + options="-incremental" + inpath="MyJar.jar"> + </compile> + <!-- + <inc-compile tag="20"> + <dir-changes added="AResourceFile.txt"/> + </inc-compile> + <run class="Main"/> + --> + </ajc-test> + + + <ajc-test dir="incrementalju/resourceTests/resourceRemoved" + pr="54622" + title="incremental with removal of resource from inpath jar"> + <compile + staging="true" + sourceroots="src" + options="-incremental" + inpath="MyJar.jar"> + </compile> + <!-- + <inc-compile tag="20"> + <dir-changes removed="AResourceFile.txt"/> + </inc-compile> + <run class="Main"/> + --> + </ajc-test> + + + <ajc-test dir="incrementalju/injarTests/classAdded" + pr="54621" + title="incremental with addition of class to inpath jar"> + <compile + staging="true" + sourceroots="src" + options="-incremental" + inpath="MyJar.jar"> + </compile> + <!-- + <inc-compile tag="20"> + <dir-changes added="Hello2"/> + </inc-compile> + <run class="Main"/> + --> + </ajc-test> + + + <ajc-test dir="incrementalju/injarTests/classRemoved" + pr="54621" + title="incremental with removal of class from inpath jar"> + <compile + staging="true" + sourceroots="src" + options="-incremental" + inpath="MyJar.jar"> + </compile> + <!-- + <inc-compile tag="20"> + <dir-changes removed="Hello2"/> + </inc-compile> + <run class="Main"/> + --> + </ajc-test> + + <ajc-test dir="incrementalju/injarTests/classAdded" + pr="54621" + title="incremental with addition of class to injar jar"> + <compile + staging="true" + sourceroots="src" + options="-incremental,-injars,MyJar.jar"> + </compile> + <!-- + <inc-compile tag="20"> + <dir-changes added="Hello2"/> + </inc-compile> + <run class="Main"/> + --> + </ajc-test> + + + <ajc-test dir="incrementalju/injarTests/classRemoved" + pr="54621" + title="incremental with removal of class from injar jar"> + <compile + staging="true" + sourceroots="src" + options="-incremental,-injars,MyJar.jar" + inpath="MyJar.jar"> + </compile> + <!-- + <inc-compile tag="20"> + <dir-changes removed="Hello2"/> + </inc-compile> + <run class="Main"/> + --> + </ajc-test> + + + + <ajc-test dir="incrementalju/inpathDirTests/classAdded" + pr="54621" + title="incremental with addition of class to inpath dir"> + <compile + staging="true" + sourceroots="src" + options="-incremental" + inpath="indir"> + </compile> + <!-- + <inc-compile tag="20"> + <dir-changes added="Hello2"/> + </inc-compile> + <run class="Main"/> + --> + </ajc-test> + + + <ajc-test dir="incrementalju/inpathDirTests/classRemoved" + pr="54621" + title="incremental with removal of class from inpath dir"> + <compile + staging="true" + sourceroots="src" + options="-incremental" + inpath="indir"> + </compile> + <!-- + <inc-compile tag="20"> + <dir-changes removed="Hello2"/> + </inc-compile> + <run class="Main"/> + --> + </ajc-test> + + <ajc-test dir="incrementalju/inpathDirTests/classUpdated" + pr="54621" + title="incremental with update of class in inpath dir"> + <compile + staging="true" + sourceroots="src" + options="-incremental" + inpath="indir"> + </compile> + <!-- + <inc-compile tag="20"> + </inc-compile> + <run class="Main"/> + --> + </ajc-test> + + <ajc-test dir="incremental/structureModel" + pr="90806" + keywords="incremental-test" + title="NPE in genHandleIdentifier"> + <compile staging="true" options="-incremental,-verbose,-emacssym,-1.4" sourceroots="src"/> + <!--inc-compile tag="20"/--> + </ajc-test> + + <ajc-test dir="bugs/incremental-declare-error" pr="84033" + title="incremental declare error persists after fix"> + <compile staging="true" + options="-incremental,-verbose" + sourceroots="src"> + <message kind="error" line="6" text="main"/> + </compile> + <!--inc-compile tag="20"/--> + <!--run class="pack.Main"/--> + </ajc-test> + + <ajc-test dir="bugs153/pr154054" pr="154054" + title="incremental update of body in around advice"> + <compile staging="true" + options="-incremental,-verbose" + sourceroots="src"/> + <!--inc-compile tag="20"/--> + <!--run class="MyClass"/--> + </ajc-test> + + <ajc-test dir="bugs153/pr154054_2" pr="154054" + title="incremental update of body in around advice with string"> + <compile staging="true" + options="-incremental,-verbose" + sourceroots="src"/> + <!--inc-compile tag="30"/--> + <!--run class="MyClass"/--> + </ajc-test> +
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/incremental-tests.xml b/tests/src/test/java/org/aspectj/systemtest/incremental/incremental-tests.xml new file mode 100644 index 000000000..1ce24711e --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/incremental-tests.xml @@ -0,0 +1,185 @@ +<!-- Incremental compilation Tests --> + + <ajc-test dir="incremental/initialTests/classAdded" + title="expect class added in initial incremental tests" + keywords="incremental-test" > + <compile staging="true" + options="-incremental" + sourceroots="."/> + <run class="main.Main"/> + <inc-compile tag="20" > + <dir-changes added="main.Target"/> + </inc-compile> + <run class="main.Main" skipTester="true"/> + </ajc-test> + + <ajc-test dir="incremental/initialTests/classRemoved" + title="expect class removed in initial incremental tests" + keywords="incremental-test" > + <compile staging="true" + options="-incremental" + sourceroots="."/> + <run class="main.Main"/> + <inc-compile tag="20"> + <dir-changes removed="main.Target"/> + </inc-compile> + <run class="main.Main"/> + </ajc-test> + + <ajc-test dir="incremental/initialTests/classUpdated" + title="expect class updated in initial incremental tests" + keywords="incremental-test" > + <compile staging="true" + options="-incremental" + sourceroots="."/> + <run class="main.Main"/> + <inc-compile tag="20"> + <dir-changes updated="main.Main"/> + </inc-compile> + <run class="main.Main"/> + </ajc-test> + + <ajc-test dir="incremental/initialTests/sourceAdded" + title="add file with class" + comment="only expecting pickup if sourceroots" + keywords="incremental-test" > + <compile staging="true" + options="-incremental" + sourceroots="."/> + <run class="main.Main"/> + <inc-compile tag="20"> + <dir-changes added="main.Target"/> + </inc-compile> + <inc-compile tag="30"> + <dir-changes updated="main.Main"/> + </inc-compile> + <run class="main.Main"/> + </ajc-test> + + <ajc-test dir="incremental/initialTests/sourceDeleted" + title="delete source file before incremental compile" + comment="build config should permit file deletions for incremental (sourceroots)" + keywords="incremental-test" > + <compile staging="true" + options="-incremental" + sourceroots="."/> + <run class="delete.Main"/> + <inc-compile tag="20"> + <dir-changes removed="delete.DeleteMe"/> + <message kind="error" line="6" file="delete/Target.java"/> + </inc-compile> + <inc-compile tag="30"/> + <run class="delete.Main"/> + </ajc-test> + +<!-- this test cannot pass with the new AjAttribute.MethodDeclarationLineNumberAttribute + <ajc-test dir="incremental/initialTests/expClasses" + title="expected class tree" > + <compile files="Main.java"> + <dir-changes expDir="expected"/> + </compile> + <run class="Main"/> + </ajc-test> + --> + + <ajc-test dir="incremental/initialTests/defaultPackage" + title="do everything in default package (sourceroots)" + keywords="incremental-test" > + <compile staging="true" + options="-incremental" + sourceroots="."/> + <run class="Main"/> + <inc-compile tag="20"> + <dir-changes added="Target"/> + </inc-compile> + <run class="Target" skipTester="true"/> + <inc-compile tag="30"> + <dir-changes updated="Main"/> + </inc-compile> + <run class="Main" skipTester="true"/> + <inc-compile tag="40"> + <message kind="error" line="6" file="Main.java"/> + </inc-compile> + <inc-compile tag="50"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="incremental/defaultPackage" + keywords="incremental-test" + title="change sources in default package"> + <compile + staging="true" + options="-incremental" + sourceroots="src"/> + <run class="Main"/> + <inc-compile tag="20"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="incremental/interPackage" + keywords="incremental-test" + title="change source"> + <compile + staging="true" + options="-incremental" + sourceroots="src"/> + <run class="app.Main"/> + <inc-compile tag="20"/> + <run class="app.Main"/> + </ajc-test> + + + <ajc-test dir="incremental/stringliteral" + keywords="incremental-test" + title="incrementally change only string literal, still expect advice"> + <compile staging="true" options="-incremental" + sourceroots="src"/> + <run class="packageOne.Main" + options="in packageOne.Main.main(..), + before main packageOne.Main"/> + <inc-compile tag="20"> + <dir-changes updated="packageOne.Main"/> + </inc-compile> + <run class="packageOne.Main" + options="in longer packageOne.Main.main(..), + before main packageOne.Main"/> + </ajc-test> + + <ajc-test dir="incremental/initialTests/aspectSourceAdded" + title="add aspect source file and check world is rewoven" + keywords="incremental-test" > + <compile staging="true" + options="-incremental" + sourceroots="."/> + <inc-compile tag="20"> + <dir-changes added="Detour"/> + </inc-compile> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="incremental/initialTests/classWAroundClosureRemoved" + title="make sure additional classes generated during weave are deleted with src class file" + keywords="incremental-test"> + <compile staging="true" + options="-incremental" + sourceroots="."/> + <inc-compile tag="20" > + <dir-changes removed="AdviceOnIntroduced$AjcClosure1"/> + </inc-compile> + </ajc-test> + + <ajc-test dir="incremental/full-rebuild" + pr="59895" + title="incremental with aspect-driven full rebuild"> + <compile + staging="true" + sourceroots="src" + options="-incremental"> + <message kind="error" line="3" file="Aspect.java"/> + </compile> + <inc-compile tag="20"> + <message kind="warning" line="3" file="Main.java"/> + </inc-compile> + <run class="Main"/> + </ajc-test> + diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/incremental.xml b/tests/src/test/java/org/aspectj/systemtest/incremental/incremental.xml new file mode 100644 index 000000000..39d6a6823 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/incremental.xml @@ -0,0 +1,10 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[ +<!ENTITY tests SYSTEM "../tests/src/org/aspectj/systemtest/incremental/incremental-junit-tests.xml"> +]> +<!-- Incremental compilation Tests --> + +<suite> + +&tests; + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/model/IncrementalModelTests.java b/tests/src/test/java/org/aspectj/systemtest/incremental/model/IncrementalModelTests.java new file mode 100644 index 000000000..a2ce02c0c --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/model/IncrementalModelTests.java @@ -0,0 +1,187 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM Corporation + * 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 + * + * ******************************************************************/ +package org.aspectj.systemtest.incremental.model; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.asm.AsmManager; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.testing.util.StructureModelUtil; + +public class IncrementalModelTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(IncrementalModelTests.class); + } + + protected File getSpecFile() { + return getClassResource("incremental-model.xml"); + } + + // This first test doesnt do a lot currently, but is ready too... + public void test001() throws Exception { + runTest("Testing incremental structure model: Intertype declarations (and a declare parents)"); + nextIncrement(true); + copyFileAndDoIncrementalBuild("changes/CloneablePoint.20.java", "src/introduction/CloneablePoint.java"); + nextIncrement(true); + copyFile("changes/Point.30.java", "src/introduction/Point.java"); + copyFileAndDoIncrementalBuild("changes/HashablePoint.30.java", "src/introduction/HashablePoint.java"); + StructureModelUtil.checkModel("declare parents=2"); + } + + public void test002() throws Exception { + runTest("Testing incremental structure model: Intertype field declarations"); + + nextIncrement(true); + copyFileAndDoIncrementalBuild("changes/secondary/BetaA.20.java", "src/secondary/BetaA.java"); + StructureModelUtil.checkModel("inter-type field=2,RelationshipMapSize=3"); + + nextIncrement(true); + copyFileAndDoIncrementalBuild("changes/secondary/BetaA.30.java", "src/secondary/BetaA.java"); + // TODO Andy - fix this test, what should the real results be in the model? + // when we go slow it seems to be relmapsize=0 + // StructureModelUtil.checkModel("inter-type field=1,RelationshipMapSize=2"); + } + + public void test003() throws Exception { + runTest("Testing incremental structure model: Weaving handlers"); + + // <!-- BetaA has a new piece of handler advice added --> + nextIncrement(true); + copyFileAndDoIncrementalBuild("changes/primary/BetaA.20.java", "src/primary/BetaA.java"); + // if (AsmHierarchyBuilder.shouldAddUsesPointcut) { + // StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=3"); + // } else { + StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=2"); + // } + + // <!-- secondary.GammaA added, also advises the same handler --> + nextIncrement(true); + copyFileAndDoIncrementalBuild("changes/secondary/GammaA.30.java", "src/secondary/GammaA.java"); + // if (AsmHierarchyBuilder.shouldAddUsesPointcut) { + // StructureModelUtil.checkModel("code=1,advice=2,RelationshipMapSize=5"); + // } else { + StructureModelUtil.checkModel("code=1,advice=2,RelationshipMapSize=3"); + // } + + // <!-- primary.BetaA deleted --> + nextIncrement(true); + deleteFileAndDoIncrementalBuild("src/primary/BetaA.java"); + // if (AsmHierarchyBuilder.shouldAddUsesPointcut) { + // StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=3"); + // } else { + StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=2"); + // } + + } + + public void test004() throws Exception { + runTest("Testing incremental structure model: Weaving"); + + // <!-- BetaA has a new piece of advice added --> + nextIncrement(true); + copyFileAndDoIncrementalBuild("changes/primary/BetaA.20.java", "src/primary/BetaA.java"); + // if (AsmHierarchyBuilder.shouldAddUsesPointcut) { + // StructureModelUtil.checkModel("code=2,advice=2,java source file=3,RelationshipMapSize=6"); + // } else { + StructureModelUtil.checkModel("code=2,advice=2,java source file=3,RelationshipMapSize=4"); + // } + + // <!-- BetaA has a piece of advice removed --> + nextIncrement(true); + copyFileAndDoIncrementalBuild("changes/primary/BetaA.30.java", "src/primary/BetaA.java"); + // if (AsmHierarchyBuilder.shouldAddUsesPointcut) { + // StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=3"); + // } else { + StructureModelUtil.checkModel("code=1,advice=1,RelationshipMapSize=2"); + // } + + // <!-- BetaA other piece of advice removed (now empty) --> + nextIncrement(true); + copyFileAndDoIncrementalBuild("changes/primary/BetaA.40.java", "src/primary/BetaA.java"); + StructureModelUtil.checkModel("code=0,RelationshipMapSize=0,advice=0"); + } + + public void test005() throws Exception { + runTest("Testing incremental structure model: Updating files"); + + // <!-- Beta changed, method added --> + nextIncrement(true); + copyFileAndDoIncrementalBuild("changes/primary/Beta.20.java", "src/primary/Beta.java"); + StructureModelUtil.checkModel("java source file=5,method=4,class=3,FileMapSize=4"); + + // <!-- Delta changed, class added --> + nextIncrement(true); + copyFileAndDoIncrementalBuild("changes/secondary/Delta.30.java", "src/secondary/Delta.java"); + StructureModelUtil.checkModel("java source file=5,method=4,class=4,advice=1"); + + // <!-- Gamma changed, advice added --> + nextIncrement(true); + copyFileAndDoIncrementalBuild("changes/secondary/Gamma.40.java", "src/secondary/Gamma.java"); + StructureModelUtil.checkModel("advice=2"); + + // <!-- Gamma changed, pointcut added --> + nextIncrement(true); + copyFileAndDoIncrementalBuild("changes/secondary/Gamma.50.java", "src/secondary/Gamma.java"); + StructureModelUtil.checkModel("advice=2,pointcut=1"); + + // <!-- Gamma changed, both advice removed --> + nextIncrement(true); + copyFileAndDoIncrementalBuild("changes/secondary/Gamma.60.java", "src/secondary/Gamma.java"); + StructureModelUtil.checkModel("advice=0,pointcut=1"); + + } + + public void test006() throws Exception { + runTest("Testing incremental structure model: Adding and removing files"); + + // <!-- Adds primary.Beta class --> + nextIncrement(true); + copyFileAndDoIncrementalBuild("changes/primary/Beta.20.java", "src/primary/Beta.java"); + StructureModelUtil.checkModel("java source file=3,FileMapSize=2"); + + // <!-- Adds secondary.Gamma aspect --> + nextIncrement(true); + copyFileAndDoIncrementalBuild("changes/secondary/Gamma.30.java", "src/secondary/Gamma.java"); + StructureModelUtil.checkModel("java source file=4"); + + // <!-- Adds secondary.Delta class --> + nextIncrement(true); + copyFileAndDoIncrementalBuild("changes/secondary/Delta.40.java", "src/secondary/Delta.java"); + StructureModelUtil.checkModel("java source file=5,package=2,FileMapSize=4"); + + // <!-- Deletes Gamma aspect --> + nextIncrement(true); + deleteFileAndDoIncrementalBuild("src/secondary/Gamma.java"); + StructureModelUtil.checkModel("java source file=4,package=2"); + + // <!-- Deletes Beta and Delta classes --> + nextIncrement(true); + deleteFile("src/primary/Beta.java"); + deleteFileAndDoIncrementalBuild("src/secondary/Delta.java"); + StructureModelUtil.checkModel("java source file=2,FileMapSize=1"); + } + + protected void setUp() throws Exception { + super.setUp(); + AsmManager.attemptIncrementalModelRepairs = true; + } + + protected void tearDown() throws Exception { + // To see the model after a test, uncomment these lines... + // AsmManager.ModelInfo mi = AsmManager.ModelInfo.summarizeModel(); + // System.err.println(mi.toString()); + super.tearDown(); + + AsmManager.attemptIncrementalModelRepairs = false; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/model/incremental-model-tests.xml b/tests/src/test/java/org/aspectj/systemtest/incremental/model/incremental-model-tests.xml new file mode 100644 index 000000000..ae9e6be31 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/model/incremental-model-tests.xml @@ -0,0 +1,98 @@ + + +<!-- + In order for these tests to pass you have to flip this flag to true: + AsmManager.attemptIncrementalModelRepairs + + If you want to debug the output from the tests, you might want uncomment + the static initializer in AsmManager which will enable you to collect + detailed information on model processing. +--> + +<!-- + These tests utilise the inc-compile test harness option but I've extended it + with a checkModel option which enables me to check information about the model + after a incremental compilation step. +--> + +<!-- + asm relationships for inter type declarations are tricky things. + Today, because type mungers don't remember where they came from in attribute form, + the relationships for ITDs are created during source compilation. When building incrementally, + we are really doing a binary weave of 'everything else' with the source for the file that + has changed. In this case the relationships for ITDs are not added. This makes managing + them incrementally in the model rather tough! + + The solution is to make them remember where they came from. This would mean we can create + the relationships during weave time and so they will be created when either doing a + source compilation or a binary weave. The support is in ResolvedTypeMunger to remember + where they came from (you just have to flick a switch) but I haven't switched it on + because we need to version *all* aspectj attributes properly so that we don't end up with + a migration nightmare. If ITD attributes remembered their location in a particular version + of AspectJ then everyone would need to recompile their code from source with that version. + If we keep changing the attributes, we keep having this problem. If we include a *version* + number in every attribute we can make the compiler more robust to coping with 'old' attributes + that might be missing certain options or values. + + Hence the first test here is not complete... + +--> + <ajc-test dir="incremental/model/introduction" + title="Testing incremental structure model: Intertype declarations (and a declare parents)" + keywords="incremental-test,model-test" > + <compile staging="true" options="-incremental,-emacssym -Xlint:ignore" sourceroots="src"/> + <inc-compile tag="20"/> <!-- Just 'touched' one file --> + <inc-compile tag="30"/> <!-- Just 'touched another aspect --> + </ajc-test> + + <ajc-test dir="incremental/model/intertype" + title="Testing incremental structure model: Intertype field declarations" + keywords="incremental-test,model-test" > + <compile staging="true" options="-incremental,-emacssym" sourceroots="src"/> + <inc-compile tag="20" checkModel="inter-type field=2,RelationshipMapSize=3"/> <!-- BetaA intertypes int i and String s --> + <inc-compile tag="30" checkModel="inter-type field=1,RelationshipMapSize=2"/> <!-- BetaA takes the String intertype away --> + </ajc-test> + + <ajc-test dir="incremental/model/weaving2" + title="Testing incremental structure model: Weaving handlers" + keywords="incremental-test,model-test" > + <compile staging="true" options="-incremental,-emacssym, -XnotReweavable" sourceroots="src"/> + <inc-compile tag="20" checkModel="code=1,advice=1,RelationshipMapSize=2"/> <!-- BetaA has a new piece of handler advice added --> + <inc-compile tag="30" checkModel="code=1,advice=2,RelationshipMapSize=3"/> <!-- secondary.GammaA added, also advises the same handler --> + <inc-compile tag="40" checkModel="code=1,advice=1,RelationshipMapSize=2"/> <!-- primary.BetaA deleted --> + </ajc-test> + + <ajc-test dir="incremental/model/weaving" + title="Testing incremental structure model: Weaving" + keywords="incremental-test,model-test" > + <compile staging="true" options="-incremental,-emacssym" sourceroots="src"/> + <inc-compile tag="20" checkModel="code=2,advice=2,java source file=3,RelationshipMapSize=4"/> <!-- BetaA has a new piece of advice added --> + <inc-compile tag="30" checkModel="code=1,advice=1,RelationshipMapSize=2"/> <!-- BetaA has a piece of advice removed --> + <inc-compile tag="40" checkModel="code=0,RelationshipMapSize=0,advice=0"/> <!-- BetaA other piece of advice removed (now empty) --> + </ajc-test> + + + <ajc-test dir="incremental/model/sourcefiles_updating" + title="Testing incremental structure model: Updating files" + keywords="incremental-test,model-test" > + <compile staging="true" options="-incremental,-emacssym,-Xset:minimalModel=false,-1.4" sourceroots="src"/> + <!-- On first compile, 5 source files in model, 'root','Alpha','Beta','Gamma','Delta' --> + <inc-compile tag="20" checkModel="java source file=5,method=4,class=3,FileMapSize=4"/> <!-- Beta changed, method added --> + <inc-compile tag="30" checkModel="java source file=5,method=4,class=4,advice=1"/> <!-- Delta changed, class added --> + <inc-compile tag="40" checkModel="advice=2"/> <!-- Gamma changed, advice added --> + <inc-compile tag="50" checkModel="advice=2,pointcut=1"/> <!-- Gamma changed, pointcut added --> + <inc-compile tag="60" checkModel="advice=0,pointcut=1"/> <!-- Gamma changed, both advice removed --> + </ajc-test> + + <ajc-test dir="incremental/model/sourcefiles_addremove" + title="Testing incremental structure model: Adding and removing files" + keywords="incremental-test,model-test" > + <compile staging="true" options="-incremental,-emacssym, -XnotReweavable,-Xset:minimalModel=false" sourceroots="src"/> + <!-- On first compile, two source files in model, 'root' and 'Alpha' --> + <inc-compile tag="20" checkModel="java source file=3,FileMapSize=2"/> <!-- Adds primary.Beta class --> + <inc-compile tag="30" checkModel="java source file=4"/> <!-- Adds secondary.Gamma aspect --> + <inc-compile tag="40" checkModel="java source file=5,package=2,FileMapSize=4"/> <!-- Adds seconday.Delta class --> + <inc-compile tag="50" checkModel="java source file=4,package=2"/> <!-- Deletes Gamma aspect --> + <inc-compile tag="60" checkModel="java source file=2,FileMapSize=1"/> <!-- Deletes Beta and Delta classes --> + </ajc-test> +
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/model/incremental-model.xml b/tests/src/test/java/org/aspectj/systemtest/incremental/model/incremental-model.xml new file mode 100644 index 000000000..1768ea102 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/model/incremental-model.xml @@ -0,0 +1,10 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[ +<!ENTITY tests SYSTEM "../tests/src/org/aspectj/systemtest/incremental/model/incremental-model-tests.xml"> +]> +<!-- Incremental structure model compilation Tests --> + +<suite> + +&tests; + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java new file mode 100644 index 000000000..229a22a5d --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java @@ -0,0 +1,284 @@ +/******************************************************************** + * Copyright (c) 2006 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Adrian Colyer initial implementation + * Helen Hawkins Converted to new interface (bug 148190) + *******************************************************************/ +package org.aspectj.systemtest.incremental.tools; + +import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import org.aspectj.ajdt.internal.core.builder.AjState; +import org.aspectj.asm.IProgramElement; +import org.aspectj.asm.IRelationship; +import org.aspectj.asm.IRelationshipMap; +import org.aspectj.testing.util.FileUtil; + +public class AbstractMultiProjectIncrementalAjdeInteractionTestbed extends AjdeInteractionTestbed { + + public static boolean VERBOSE = false; + + public static void dumptree(IProgramElement node, int indent) { + for (int i = 0; i < indent; i++) { + System.out.print(" "); + } + String loc = ""; + if (node != null) { + if (node.getSourceLocation() != null) { + loc = Integer.toString(node.getSourceLocation().getLine()); + } + } + // System.out.println(node + " [" + (node == null ? "null" : node.getKind().toString()) + "] " + loc); + System.out.println(node + " [" + (node == null ? "null" : node.getKind().toString()) + "] " + loc + + (node == null ? "" : " hid:" + node.getHandleIdentifier())); + if (node != null) { + // for (int i = 0; i < indent; i++) + // System.out.print(" "); + // System.out.println(" hid is " + node.getHandleIdentifier()); + // Map m = ((ProgramElement) node).kvpairs; + // if (m != null) { + // Set keys = m.keySet(); + // for (Iterator iterator = keys.iterator(); iterator.hasNext();) { + // Object object = (Object) iterator.next(); + // + // for (int i = 0; i < indent; i++) + // System.out.print(" "); + // System.out.println("kvp: " + object + " = " + m.get(object)); + // } + // } + for (Iterator<IProgramElement> i = node.getChildren().iterator(); i.hasNext();) { + dumptree( i.next(), indent + 2); + } + } + } + + protected void setUp() throws Exception { + super.setUp(); + AjdeInteractionTestbed.VERBOSE = VERBOSE; + AjState.FORCE_INCREMENTAL_DURING_TESTING = true; + } + + protected void tearDown() throws Exception { + super.tearDown(); + AjState.FORCE_INCREMENTAL_DURING_TESTING = false; + } + + protected String runMethod(String projectName, String classname, String methodname) throws Exception { + File f = getProjectOutputRelativePath(projectName, ""); + ClassLoader cl = new URLClassLoader(new URL[] { f.toURI().toURL() }); + Class<?> clazz = Class.forName(classname, false, cl); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + PrintStream realOut = System.out; + try { + System.setOut(new PrintStream(baos)); + clazz.getDeclaredMethod(methodname).invoke(null); + } finally { + System.setOut(realOut); + } + return new String(baos.toByteArray()); + } + + protected File getProjectOutputRelativePath(String p, String filename) { + File projDir = new File(getWorkingDir(), p); + return new File(projDir, "bin" + File.separator + filename); + } + + public void build(String projectName) { + constructUpToDateLstFile(projectName, "build.lst"); + doBuild(projectName); + if (AjdeInteractionTestbed.VERBOSE) + printBuildReport(projectName); + } + + public int getRelationshipCount(String project) { + IRelationshipMap relmap = getModelFor(project).getRelationshipMap(); + int ctr = 0; + Set<String> entries = relmap.getEntries(); + for (Iterator<String> iter = entries.iterator(); iter.hasNext();) { + String hid = (String) iter.next(); + List<IRelationship> rels = relmap.get(hid); + for (Iterator<IRelationship> iterator = rels.iterator(); iterator.hasNext();) { + ctr+=iterator.next().getTargets().size(); + } + } + return ctr; + } + + public void fullBuild(String projectName) { + constructUpToDateLstFile(projectName, "build.lst"); + doFullBuild(projectName); + if (AjdeInteractionTestbed.VERBOSE) + printBuildReport(projectName); + } + + private void constructUpToDateLstFile(String pname, String configname) { + File projectBase = new File(sandboxDir, pname); + File toConstruct = new File(projectBase, configname); + List<String> filesForCompilation = new ArrayList<String>(); + collectUpFiles(projectBase, projectBase, filesForCompilation); + + try { + FileOutputStream fos = new FileOutputStream(toConstruct); + DataOutputStream dos = new DataOutputStream(fos); + for (String file: filesForCompilation) { + dos.writeBytes(file + "\n"); + } + dos.close(); + } catch (IOException ioe) { + ioe.printStackTrace(); + } + } + + private void collectUpFiles(File location, File base, List<String> collectionPoint) { + String contents[] = location.list(); + if (contents == null) + return; + for (int i = 0; i < contents.length; i++) { + String string = contents[i]; + File f = new File(location, string); + if (f.isDirectory()) { + collectUpFiles(f, base, collectionPoint); + } else if (f.isFile() && (f.getName().endsWith(".aj") || f.getName().endsWith(".java"))) { + String fileFound; + try { + fileFound = f.getCanonicalPath(); + String toRemove = base.getCanonicalPath(); + if (!fileFound.startsWith(toRemove)) + throw new RuntimeException("eh? " + fileFound + " " + toRemove); + collectionPoint.add(fileFound.substring(toRemove.length() + 1));// +1 captures extra separator + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + /** + * Fill in the working directory with the project base files, from the 'base' folder. + */ + protected void initialiseProject(String p) { + File projectSrc = new File(testdataSrcDir + File.separatorChar + p + File.separatorChar + "base"); + File destination = new File(getWorkingDir(), p); + if (!destination.exists()) { + destination.mkdir(); + } + copy(projectSrc, destination);// ,false); + // create the AjCompiler instance associated with this project + // (has id of the form c:\temp\ajcSandbox\<workspace_name>\<project_name>) + CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + p); + } + + /** + * Applies an overlay onto the project being tested - copying the contents of the specified overlay directory. + */ + public void alter(String projectName, String overlayDirectory) { + File projectSrc = new File(testdataSrcDir + File.separatorChar + projectName + File.separatorChar + overlayDirectory); + File destination = new File(getWorkingDir(), projectName); + + if (AjdeInteractionTestbed.VERBOSE) + System.out.println("Altering project " + projectName); + copy(projectSrc, destination); + } + + /** + * Copy the contents of some directory to another location - the copy is recursive. + */ + protected void copy(File from, File to) { + String contents[] = from.list(); + if (contents == null) + return; + for (int i = 0; i < contents.length; i++) { + String string = contents[i]; + File f = new File(from, string); + File t = new File(to, string); + + if (f.isDirectory() && !f.getName().startsWith("inc")) { + t.mkdir(); + copy(f, t); + } else if (f.isFile()) { + StringBuffer sb = new StringBuffer(); + // if (VERBOSE) System.err.println("Copying "+f+" to "+t); + FileUtil.copyFile(f, t, sb); + if (sb.length() != 0) { + System.err.println(sb.toString()); + } + } + } + } + + /** + * Count the number of times a specified aspectName appears in the default aop.xml file and compare with the expected number of + * occurrences. If just want to count the number of aspects mentioned within the file then pass "" for the aspectName, + * otherwise, specify the name of the aspect interested in. + */ + protected void checkXMLAspectCount(String projectName, String aspectName, int expectedOccurrences, String outputDir) { + int aspectCount = 0; + File aopXML = new File(outputDir + File.separatorChar + "META-INF" + File.separatorChar + "aop-ajc.xml"); + + if (!aopXML.exists()) { + fail("Expected file " + aopXML.getAbsolutePath() + " to exist but it doesn't"); + } + try { + BufferedReader reader = new BufferedReader(new FileReader(aopXML)); + String line = reader.readLine(); + while (line != null) { + if (aspectName.equals("") && line.indexOf("aspect name=\"") != -1) { + aspectCount++; + } else if (line.indexOf("aspect name=\"" + aspectName + "\"") != -1) { + aspectCount++; + } + line = reader.readLine(); + } + reader.close(); + } catch (IOException ie) { + ie.printStackTrace(); + } + if (aspectCount != expectedOccurrences) { + fail("Expected aspect " + aspectName + " to appear " + expectedOccurrences + " times" + + " in the aop.xml file but found " + aspectCount + " occurrences"); + } + } + + protected void assertContains(String expectedSubstring, Object object) { + String actualString = object.toString(); + if (actualString.indexOf(expectedSubstring) == -1) { + fail("Expected to find '" + expectedSubstring + "' in '" + actualString + "'"); + } + } + + /** @return the number of relationship pairs */ + protected void printModel(String projectName) throws Exception { + dumptree(getModelFor(projectName).getHierarchy().getRoot(), 0); + PrintWriter pw = new PrintWriter(System.out); + getModelFor(projectName).dumprels(pw); + pw.flush(); + } + + protected File getProjectRelativePath(String p, String filename) { + File projDir = new File(getWorkingDir(), p); + return new File(projDir, filename); + } + + protected void assertNoErrors(String projectName) { + assertTrue("Should be no errors, but got " + getErrorMessages(projectName), getErrorMessages(projectName).size() == 0); + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java new file mode 100644 index 000000000..01426d923 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java @@ -0,0 +1,559 @@ +/******************************************************************** + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement initial implementation + * Helen Hawkins Converted to new interface (bug 148190) + *******************************************************************/ +package org.aspectj.systemtest.incremental.tools; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import junit.framework.TestCase; + +import org.aspectj.ajde.core.AjCompiler; +import org.aspectj.ajde.core.IBuildMessageHandler; +import org.aspectj.ajde.core.ICompilerConfiguration; +import org.aspectj.ajde.core.IOutputLocationManager; +import org.aspectj.ajdt.internal.core.builder.AbstractStateListener; +import org.aspectj.ajdt.internal.core.builder.AjState; +import org.aspectj.ajdt.internal.core.builder.IncrementalStateManager; +import org.aspectj.asm.AsmManager; +import org.aspectj.bridge.IMessage; +import org.aspectj.tools.ajc.Ajc; + +/** + * This class uses Ajde in the same way that an IDE (e.g. AJDT) does. + * + * The build is driven through 'doBuild(projectName)' but the build can be configured by the methods beginning 'configure***'. + * Information about what happened during a build is accessible through the get*, was*, print* public methods... + * + */ +public class AjdeInteractionTestbed extends TestCase { + + public static boolean VERBOSE = false; // do you want the gory details? + + public static String testdataSrcDir = "../tests/multiIncremental"; + protected static File sandboxDir; + + private static boolean buildModel; + + // Methods for configuring the build + public void configureNewProjectDependency(String fromProjectName, String projectItDependsOn) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + fromProjectName); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).addDependancy(projectItDependsOn); + } + + public void addSourceFolderForSourceFile(String projectName, File f, String sourceFolder) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + ((MultiProjTestOutputLocationManager) ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()) + .getOutputLocationManager()).setSourceFolderFor(f, sourceFolder); + } + + public void setNextChangeResponse(String projName, int flags) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projName); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).changed = flags; + } + + public void setProjectEncoding(String projName, String encoding) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projName); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setProjectEncoding(encoding); + } + + public void addProjectSourceFileChanged(String projectName, File changedFile) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).addProjectSourceFileChanged(changedFile); + } + + public void addXmlConfigFile(String projectName, String xmlfile) { + List<String> l = new ArrayList<String>(); + l.add(xmlfile); + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setProjectXmlConfigFiles(l); + } + + public void addClasspathEntry(String projectName, File classpathEntry) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + MultiProjTestCompilerConfiguration config = ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()); + config.setClasspath(config.getClasspath() + File.pathSeparator + classpathEntry.toString()); + } + + public void addClasspathEntryChanged(String projectName, String changedDir) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).addClasspathEntryChanged(changedDir); + } + + public void configureNonStandardCompileOptions(String projectName, String options) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setNonStandardOptions(options); + } + + public void configureAspectPath(String projectName, Set<File> aspectpath) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setAspectPath(aspectpath); + } + + public void configureProcessor(String projectName, String processor) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setProcessor(processor); + } + + public void configureProcessorPath(String projectName, String processorPath) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setProcessorPath(processorPath); + } + + public void configureAspectPath(String projectName, File aspectpath) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + Set<File> s = new HashSet<File>(); + s.add(aspectpath); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setAspectPath(s); + } + + public void configureResourceMap(String projectName, Map<String,File> resourcesMap) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setSourcePathResources(resourcesMap); + } + + public void configureJavaOptionsMap(String projectName, Map<String,String> options) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setJavaOptions(options); + } + + public static void configureInPath(String projectName, Set<File> inpath) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setInpath(inpath); + } + + public static void configureInPath(String projectName, File inpath) { + Set<File> s = new HashSet<File>(); + s.add(inpath); + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setInpath(s); + } + + public static void configureOutputLocationManager(String projectName, IOutputLocationManager mgr) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setOutputLocationManager(mgr); + } + + public void configureShowWeaveInfoMessages(String projectName, boolean showWeaveInfo) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + IBuildMessageHandler handler = compiler.getMessageHandler(); + if (showWeaveInfo) { + handler.dontIgnore(IMessage.WEAVEINFO); + } else { + handler.ignore(IMessage.WEAVEINFO); + } + } + + // End of methods for configuring the build + + public AjCompiler getCompilerForProjectWithName(String projectName) { + return CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + } + + protected File getWorkingDir() { + return sandboxDir; + } + + protected void setUp() throws Exception { + super.setUp(); + // need this line because otherwise reset in previous tests + AsmManager.attemptIncrementalModelRepairs = true; + if (AjState.stateListener == null) { + AjState.stateListener = MyStateListener.getInstance(); + + } + MyStateListener.reset(); + // Create a sandbox in which to work + sandboxDir = Ajc.createEmptySandbox(); + } + + protected void tearDown() throws Exception { + super.tearDown(); + AjState.stateListener = null; + CompilerFactory.clearCompilerMap(); + IncrementalStateManager.clearIncrementalStates(); + } + + /** Drives a build */ + public boolean doBuild(String projectName) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + resetCompilerRecords(compiler); + addSourceFilesToBuild(projectName, compiler); + // addXmlConfigFilesToBuild(projectName, compiler); + pause(1000); // delay to allow previous runs build stamps to be OK + lognoln("Building project '" + projectName + "'"); + compiler.build(); + log(""); + checkForErrors(compiler); + log("Build finished, time taken = " + + ((MultiProjTestBuildProgressMonitor) compiler.getBuildProgressMonitor()).getTimeTaken() + "ms"); + return true; + } + + // public AsmManager getStructureModelFor(String projectName) { + // AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + // returnc compiler.getStructureModelFor(projectName) + // } + + /** Drives a full build **/ + public boolean doFullBuild(String projectName) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + resetCompilerRecords(compiler); + addSourceFilesToBuild(projectName, compiler); + addXmlConfigFilesToBuild(projectName, compiler); + pause(1000); // delay to allow previous runs build stamps to be OK + lognoln("Building project '" + projectName + "'"); + compiler.buildFresh(); + log(""); + checkForErrors(compiler); + log("Build finished, time taken = " + + ((MultiProjTestBuildProgressMonitor) compiler.getBuildProgressMonitor()).getTimeTaken() + "ms"); + return true; + } + + /** + * Clears any maps associated with the compiler + */ + private void resetCompilerRecords(AjCompiler compiler) { + ((MultiProjTestBuildProgressMonitor) compiler.getBuildProgressMonitor()).reset(); + ((MultiProjTestMessageHandler) compiler.getMessageHandler()).reset(); + } + + /** + * Find the source files associated with the given project and add them to the list of projectSourceFiles in the + * MultiProjTestCompilerConfiguration to be used in the subsequent build + */ + private void addSourceFilesToBuild(String pname, AjCompiler compiler) { + File projectBase = new File(sandboxDir, pname); + ICompilerConfiguration icc = compiler.getCompilerConfiguration(); + List<String> currentFiles = icc.getProjectSourceFiles(); + List<String> filesForCompilation = new ArrayList<String>(); + collectUpFiles(projectBase, projectBase, filesForCompilation); + boolean changed = false; + for (int i = 0; i < filesForCompilation.size(); i++) { + if (!currentFiles.contains(filesForCompilation.get(i))) { + changed = true; + } + } + for (int i = 0; i < currentFiles.size(); i++) { + if (!filesForCompilation.contains(currentFiles.get(i))) { + changed = true; + } + } + if (changed) { + ((MultiProjTestCompilerConfiguration) icc).setProjectSourceFiles(filesForCompilation); + } + } + + private void addXmlConfigFilesToBuild(String pname, AjCompiler compiler) { + File projectBase = new File(sandboxDir, pname); + ICompilerConfiguration icc = compiler.getCompilerConfiguration(); + List<String> currentXmlFiles = icc.getProjectXmlConfigFiles(); + List<String> collector = new ArrayList<String>(); + collectUpXmlFiles(projectBase, projectBase, collector); + boolean changed = false; + for (int i = 0; i < collector.size(); i++) { + if (!currentXmlFiles.contains(collector.get(i))) { + changed = true; + } + } + for (int i = 0; i < currentXmlFiles.size(); i++) { + if (!collector.contains(currentXmlFiles.get(i))) { + changed = true; + } + } + if (changed) { + ((MultiProjTestCompilerConfiguration) icc).setProjectXmlConfigFiles(collector); + } + } + + private void collectUpFiles(File location, File base, List<String> collectionPoint) { + String contents[] = location.list(); + if (contents == null) { + return; + } + for (int i = 0; i < contents.length; i++) { + String string = contents[i]; + File f = new File(location, string); + if (f.isDirectory()) { + collectUpFiles(f, base, collectionPoint); + } else if (f.isFile() && (f.getName().endsWith(".aj") || f.getName().endsWith(".java"))) { + String fileFound; + try { + fileFound = f.getCanonicalPath(); + collectionPoint.add(fileFound); + // String toRemove = base.getCanonicalPath(); + // if (!fileFound.startsWith(toRemove)) throw new RuntimeException("eh? "+fileFound+" "+toRemove); + // collectionPoint.add(fileFound.substring(toRemove.length()+1));//+1 captures extra separator + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + private void collectUpXmlFiles(File location, File base, List<String> collectionPoint) { + String contents[] = location.list(); + if (contents == null) { + return; + } + for (int i = 0; i < contents.length; i++) { + String string = contents[i]; + File f = new File(location, string); + if (f.isDirectory()) { + collectUpXmlFiles(f, base, collectionPoint); + } else if (f.isFile() && f.getName().endsWith(".xml")) { + String fileFound; + try { + fileFound = f.getCanonicalPath(); + collectionPoint.add(fileFound); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + /** + * Make sure no errors have been recorded + */ + private void checkForErrors(AjCompiler compiler) { + MultiProjTestMessageHandler handler = (MultiProjTestMessageHandler) compiler.getMessageHandler(); + if (handler.hasErrorMessages()) { + System.err.println("Build errors:"); + for (IMessage message: handler.getErrorMessages()) { + System.err.println(message); + } + System.err.println("---------"); + } + } + + public List<IMessage> getErrorMessages(String projectName) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + return ((MultiProjTestMessageHandler) compiler.getMessageHandler()).getErrorMessages(); + } + + public List<IMessage> getWarningMessages(String projectName) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + return ((MultiProjTestMessageHandler) compiler.getMessageHandler()).getWarningMessages(); + } + + public List<IMessage> getWeavingMessages(String projectName) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + return ((MultiProjTestMessageHandler) compiler.getMessageHandler()).getWeavingMessages(); + } + + public List<String> getCompilerErrorMessages(String projectName) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + return ((MultiProjTestMessageHandler) compiler.getMessageHandler()).getCompilerErrors(); + } + + public void checkForError(String projectName, String anError) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + List<IMessage> messages = ((MultiProjTestMessageHandler) compiler.getMessageHandler()).getErrorMessages(); + for (Iterator<IMessage> iter = messages.iterator(); iter.hasNext();) { + IMessage element = iter.next(); + if (element.getMessage().indexOf(anError) != -1) { + return; + } + } + fail("Didn't find the error message:\n'" + anError + "'.\nErrors that occurred:\n" + messages); + } + + private void pause(int millis) { + try { + Thread.sleep(millis); + } catch (InterruptedException ie) { + } + } + + // Methods for querying what happened during a build and accessing information + // about the build: + + /** + * Helper method for dumping info about which files were compiled and woven during the last build. + */ + public String printCompiledAndWovenFiles(String projectName) { + StringBuffer sb = new StringBuffer(); + if (getCompiledFiles(projectName).size() == 0 && getWovenClasses(projectName).size() == 0) { + sb.append("No files were compiled or woven\n"); + } + for (String element: getCompiledFiles(projectName)) { + sb.append("compiled: " + element + "\n"); + } + for (String element: getWovenClasses(projectName)) { + sb.append("woven: " + element + "\n"); + } + return sb.toString(); + } + + /** + * Summary report on what happened in the most recent build + */ + public void printBuildReport(String projectName) { + System.out.println("\n====== BUILD REPORT (Project " + projectName + ") ==========="); + System.out.println("Build took: " + getTimeTakenForBuild(projectName) + "ms"); + List<String> compiled = getCompiledFiles(projectName); + System.out.println("Compiled: " + compiled.size() + " files"); + for (Iterator<String> iter = compiled.iterator(); iter.hasNext();) { + System.out.println(" :" + iter.next()); + } + List<String> woven = getWovenClasses(projectName); + System.out.println("Wove: " + woven.size() + " files"); + for (Iterator<String> iter = woven.iterator(); iter.hasNext();) { + System.out.println(" :" + iter.next()); + } + if (wasFullBuild()) { + System.out.println("It was a batch (full) build"); + } + System.out.println("============================================="); + } + + /** + * Check we compiled/wove the right number of files, passing '-1' indicates you don't care about that number. + */ + public void checkCompileWeaveCount(String projectName, int expCompile, int expWoven) { + if (expCompile != -1 && getCompiledFiles(projectName).size() != expCompile) { + fail("Expected compilation of " + expCompile + " files but compiled " + getCompiledFiles(projectName).size() + "\n" + + printCompiledAndWovenFiles(projectName)); + } + if (expWoven != -1 && getWovenClasses(projectName).size() != expWoven) { + fail("Expected weaving of " + expWoven + " files but wove " + getWovenClasses(projectName).size() + "\n" + + printCompiledAndWovenFiles(projectName)); + } + } + + public void checkWasntFullBuild() { + assertTrue("Shouldn't have been a full (batch) build", !wasFullBuild()); + } + + public void checkWasFullBuild() { + assertTrue("Should have been a full (batch) build", wasFullBuild()); + } + + public boolean wasFullBuild() { + // alternatives: statelistener is debug interface, progressmonitor is new proper interface (see pr145689) + // return MyBuildProgressMonitor.wasFullBuild(); + return MyStateListener.wasFullBuild(); + } + + public long getTimeTakenForBuild(String projectName) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + return ((MultiProjTestBuildProgressMonitor) compiler.getBuildProgressMonitor()).getTimeTaken(); + } + + public List<String> getCompiledFiles(String projectName) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + return ((MultiProjTestBuildProgressMonitor) compiler.getBuildProgressMonitor()).getCompiledFiles(); + } + + public AsmManager getModelFor(String projectName) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + return compiler.getModel(); + } + + public List<String> getWovenClasses(String projectName) { + AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName); + return ((MultiProjTestBuildProgressMonitor) compiler.getBuildProgressMonitor()).getWovenClasses(); + } + + // Infrastructure below here + + private static void log(String msg) { + if (VERBOSE) { + System.out.println(msg); + } + } + + private static void lognoln(String msg) { + if (VERBOSE) { + System.out.print(msg); + } + } + + /** Return the *full* path to this file which is taken relative to the project dir */ + protected static String getFile(String projectName, String path) { + return new File(sandboxDir, projectName + File.separatorChar + path).getAbsolutePath(); + } + + static class MyStateListener extends AbstractStateListener { + + private static MyStateListener _instance = new MyStateListener(); + + private MyStateListener() { + reset(); + } + + public static MyStateListener getInstance() { + return _instance; + } + + public static boolean informedAboutKindOfBuild; + public static boolean fullBuildOccurred; + public static List<String> detectedDeletions = new ArrayList<String>(); + public static StringBuffer decisions = new StringBuffer(); + + public static void reset() { + informedAboutKindOfBuild = false; + decisions = new StringBuffer(); + fullBuildOccurred = false; + if (detectedDeletions != null) { + detectedDeletions.clear(); + } + } + + public boolean pathChange = false; + + public void pathChangeDetected() { + pathChange = true; + } + + public void aboutToCompareClasspaths(List oldClasspath, List newClasspath) { + } + + public void detectedClassChangeInThisDir(File f) { + recordDecision("Detected class change in this directory: " + f.toString()); + } + + public void detectedAspectDeleted(File f) { + detectedDeletions.add(f.toString()); + } + + public void buildSuccessful(boolean wasFullBuild) { + informedAboutKindOfBuild = true; + fullBuildOccurred = wasFullBuild; + } + + public static String getDecisions() { + return decisions.toString(); + } + + public static boolean wasFullBuild() { + if (!informedAboutKindOfBuild) { + throw new RuntimeException("I never heard about what kind of build it was!!"); + } + return fullBuildOccurred; + } + + // not needed just yet... + // public void recordInformation(String s) { decisions.append(s).append("\n");} + public void recordDecision(String s) { + decisions.append(s).append("\n"); + log(s); + } + }; +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbedLauncher.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbedLauncher.java new file mode 100644 index 000000000..6b431c1df --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbedLauncher.java @@ -0,0 +1,47 @@ +/******************************************************************** + * Copyright (c) 2006 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Adrian Colyer Initial implementation + * Helen Hawkins Converted to new interface (bug 148190) + *******************************************************************/ +package org.aspectj.systemtest.incremental.tools; + + +/** + * command-line launcher for Ajde-like aspectj runs for use with + * profiling tools. + */ +public class AjdeInteractionTestbedLauncher extends + MultiProjectIncrementalTests { + + /** + * usage: AjdeInteractionTestbedLauncher srcDir projectName + * @param args workspace_root_dir project_name + */ + public static void main(String[] args) throws Exception { + AjdeInteractionTestbedLauncher.testdataSrcDir = args[0]; + AjdeInteractionTestbedLauncher launcher = new AjdeInteractionTestbedLauncher(args[1]); + launcher.setUp(); + launcher.buildProject(args[1]); + //launcher.printBuildReport(); + launcher.tearDown(); + } + + public AjdeInteractionTestbedLauncher(String projectName) { + String classPath = System.getProperty("java.class.path"); + ((MultiProjTestCompilerConfiguration)getCompilerForProjectWithName(projectName) + .getCompilerConfiguration()).setClasspath(classPath); + } + + private void buildProject(String projectName) { + initialiseProject(projectName); + build(projectName); + } + + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AnnotationProcessingTests.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AnnotationProcessingTests.java new file mode 100644 index 000000000..78d671946 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/AnnotationProcessingTests.java @@ -0,0 +1,169 @@ +/******************************************************************************* + * 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.incremental.tools; + +import java.io.File; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; + +import org.aspectj.util.FileUtil; + +public class AnnotationProcessingTests extends AbstractMultiProjectIncrementalAjdeInteractionTestbed { + + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + new File("Advise_aaa.java").delete(); + new File("Advise_ccc.java").delete(); + new File("Advise_boo.java").delete(); + new File("Advise_too.java").delete(); + new File("AroundAdvise_aaa.java").delete(); + new File("AroundAdvise_ccc.java").delete(); + if (new File("../run-all-junit-tests/generated/test/SomeCallbacks.java").exists()) { + FileUtil.deleteContents(new File("../run-all-junit-tests/generated")); + new File("../run-all-junit-tests/generated").delete(); + } + } + + // Basic test: turns on annotation processing and tries to run the DemoProcessor + public void testAnnotationProcessing1() throws Exception { + createAndBuildAnnotationProcessorProject("ProcessorProject"); + initialiseProject("ProcessorConsumer1"); + configureProcessorOptions("ProcessorConsumer1","DemoProcessor"); + configureNonStandardCompileOptions("ProcessorConsumer1", "-showWeaveInfo"); + + Hashtable<String, String> javaOptions = new Hashtable<String, String>(); + javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6"); + javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6"); + javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.6"); + javaOptions.put("org.eclipse.jdt.core.compiler.processAnnotations","enabled"); + configureJavaOptionsMap("ProcessorConsumer1", javaOptions); + + configureNewProjectDependency("ProcessorConsumer1", "ProcessorProject"); + configureNonStandardCompileOptions("ProcessorConsumer1", "-showWeaveInfo"); + build("ProcessorConsumer1"); + checkWasFullBuild(); + checkCompiledFiles("ProcessorConsumer1","Advise_ccc.java","Advise_aaa.java","Code.java"); + assertEquals(2,getWeavingMessages("ProcessorConsumer1").size()); + String out = runMethod("ProcessorConsumer1", "Code", "runner"); + assertEquals("aaa running\nccc running\n",out); + } + + // services file in processor project + public void testAnnotationProcessing2() throws Exception { + createAndBuildAnnotationProcessorProject("ProcessorProject2"); // This has a META-INF services entry for DemoProcessor + + initialiseProject("ProcessorConsumer2"); + // Paths here are the path to DemoProcessor (compiled into the output folder of the ProcessorProject2) and the path to + // the META-INF file declaring DemoProcessor (since it is not copied to that same output folder) - this exists in the test src + // folder for ProcessorProject2 + configureProcessorPath("ProcessorConsumer2", getCompilerForProjectWithName("ProcessorProject2").getCompilerConfiguration().getOutputLocationManager().getDefaultOutputLocation().toString()+File.pathSeparator+ + new File(testdataSrcDir + File.separatorChar + "ProcessorProject2" + File.separatorChar + "base"+File.separatorChar+"src").toString()); + + Hashtable<String, String> javaOptions = new Hashtable<String, String>(); + javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6"); + javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6"); + javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.6"); + javaOptions.put("org.eclipse.jdt.core.compiler.processAnnotations","enabled"); + configureJavaOptionsMap("ProcessorConsumer2", javaOptions); + initialiseProject("ProcessorConsumer2"); + configureNewProjectDependency("ProcessorConsumer2", "ProcessorProject"); + configureNonStandardCompileOptions("ProcessorConsumer2", "-showWeaveInfo"); + build("ProcessorConsumer2"); + checkWasFullBuild(); + checkCompiledFiles("ProcessorConsumer2","Advise_ccc.java","Advise_aaa.java","Code.java"); + assertEquals(2,getWeavingMessages("ProcessorConsumer2").size()); + String out = runMethod("ProcessorConsumer2", "Code", "runner"); + assertEquals("aaa running\nccc running\n",out); + } + + // Two processors + public void testAnnotationProcessing3() throws Exception { + createAndBuildAnnotationProcessorProject("ProcessorProject2"); + createAndBuildAnnotationProcessorProject("ProcessorProject3"); + initialiseProject("ProcessorConsumer1"); + // Paths here are the path to DemoProcessor/DemoProcessor2 compiled code and the path to + // the META-INF file declaring DemoProcessor/DemoProcessor2 (since they are not copied to that same output folder) - + // these exists in the test src folders for ProcessorProject2/ProcessorProject3 + configureProcessorPath("ProcessorConsumer1", + getCompilerForProjectWithName("ProcessorProject3").getCompilerConfiguration().getOutputLocationManager().getDefaultOutputLocation().toString()+File.pathSeparator+ + new File(testdataSrcDir + File.separatorChar + "ProcessorProject3" + File.separatorChar + "base"+File.separatorChar+"src").toString() + +File.pathSeparator+ + getCompilerForProjectWithName("ProcessorProject2").getCompilerConfiguration().getOutputLocationManager().getDefaultOutputLocation().toString()+File.pathSeparator+ + new File(testdataSrcDir + File.separatorChar + "ProcessorProject2" + File.separatorChar + "base"+File.separatorChar+"src").toString() + ); + + // The order here is DemoProcessor2 then DemoProcessor - to get the second one to run I changed DemoProcessor2 to operate on a + // specific annotation (java.lang.SuppressWarnings) and return false at the end + + configureNonStandardCompileOptions("ProcessorConsumer1", "-showWeaveInfo"); + + Hashtable<String, String> javaOptions = new Hashtable<String, String>(); + javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6"); + javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6"); + javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.6"); + javaOptions.put("org.eclipse.jdt.core.compiler.processAnnotations","enabled"); + configureJavaOptionsMap("ProcessorConsumer1", javaOptions); + + configureNewProjectDependency("ProcessorConsumer1", "ProcessorProject"); + configureNonStandardCompileOptions("ProcessorConsumer1", "-showWeaveInfo"); + build("ProcessorConsumer1"); + checkWasFullBuild(); + checkCompiledFiles("ProcessorConsumer1","Advise_ccc.java","Advise_aaa.java","Code.java","AroundAdvise_ccc.java","AroundAdvise_aaa.java"); + assertEquals(4,getWeavingMessages("ProcessorConsumer1").size()); + String out = runMethod("ProcessorConsumer1", "Code", "runner"); + assertEquals("aaa running\nAround advice on aaa running\nccc running\nAround advice on ccc running\n",out); + } + + // Tests: + // TODO Incremental compilation - what does that mean with annotation processors? + + // --- + + private void createAndBuildAnnotationProcessorProject(String processorProjectName) { + initialiseProject(processorProjectName); + build(processorProjectName); + checkWasFullBuild(); + assertNoErrors(processorProjectName); + } + + private void configureProcessorOptions(String projectName, String processor) { + configureProcessor(projectName, "DemoProcessor"); + // Assume all processors from processor project + configureProcessorPath(projectName, getCompilerForProjectWithName("ProcessorProject").getCompilerConfiguration().getOutputLocationManager().getDefaultOutputLocation().toString()); + } + + private void checkCompiledFiles(String projectName, String... expectedCompiledFiles) { + List<String> compiledFiles = new ArrayList<String>(getCompiledFiles(projectName)); + if (compiledFiles.size()!=expectedCompiledFiles.length) { + fail("Expected #"+expectedCompiledFiles.length+" files to be compiled but found that #"+compiledFiles.size()+" files were compiled.\nCompiled="+compiledFiles); + } + for (String expectedCompiledFile: expectedCompiledFiles) { + String toRemove = null; + for (String compiledFile: compiledFiles) { + String cfile = compiledFile.substring(compiledFile.lastIndexOf("/")+1); + if (cfile.equals(expectedCompiledFile)) { + toRemove = compiledFile; + break; + } + } + if (toRemove!=null) compiledFiles.remove(toRemove); + } + // Anything left in compiledFiles wasn't expected to be built + if (compiledFiles.size()!=0) { + fail("These were not expected to be compiled: "+compiledFiles); + } + } + + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/CompilerFactory.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/CompilerFactory.java new file mode 100644 index 000000000..3b243d5b8 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/CompilerFactory.java @@ -0,0 +1,58 @@ +/******************************************************************** + * Copyright (c) 2006 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://eclipse.org/legal/epl-v10.html + * + * Contributors: IBM Corporation - initial API and implementation + * Helen Hawkins - initial version (bug 148190) + *******************************************************************/ +package org.aspectj.systemtest.incremental.tools; + +import java.util.Collection; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Map; + +import org.aspectj.ajde.core.AjCompiler; + +/** + * Manages the different compilers for the different projects within one test run + */ +public class CompilerFactory { + + private static Map<String,AjCompiler> compilerMap = new Hashtable<>(); + + /** + * If an AjCompiler exists for the given projectDir then returns + * that, otherwise creates a new one. + */ + public static AjCompiler getCompilerForProjectWithDir(String projectDir) { + if (compilerMap.containsKey(projectDir)) { + return (AjCompiler) compilerMap.get(projectDir); + } + + AjCompiler compiler = new AjCompiler( + projectDir, + new MultiProjTestCompilerConfiguration(projectDir), + new MultiProjTestBuildProgressMonitor(), + new MultiProjTestMessageHandler()); + compilerMap.put(projectDir,compiler); + return compiler; + } + + /** + * Clears the current map - before doing so clears the state of + * each compiler (this ensures everything is cleaned up in the + * IncrementalStateManager) + */ + public static void clearCompilerMap() { + Collection<AjCompiler> compilers = compilerMap.values(); + for (AjCompiler compiler: compilers) { + compiler.clearLastState(); + } + compilerMap.clear(); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java new file mode 100644 index 000000000..c3e44bcbc --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java @@ -0,0 +1,994 @@ +/******************************************************************** + * Copyright (c) 2010 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement (SpringSource) initial implementation + *******************************************************************/ +package org.aspectj.systemtest.incremental.tools; + +import java.io.File; +import java.util.List; +import java.util.Set; + +import org.aspectj.ajde.core.AjCompiler; +import org.aspectj.ajde.core.internal.AjdeCoreBuildManager; +import org.aspectj.ajdt.internal.core.builder.AjBuildManager; +import org.aspectj.asm.IProgramElement; +import org.aspectj.asm.internal.AspectJElementHierarchy; +import org.aspectj.weaver.AnnotationAJ; +import org.aspectj.weaver.ReferenceType; +import org.aspectj.weaver.ReferenceTypeDelegate; +import org.aspectj.weaver.ResolvedMember; +import org.aspectj.weaver.ResolvedType; +import org.aspectj.weaver.UnresolvedType; +import org.aspectj.weaver.World; +import org.aspectj.weaver.World.TypeMap; + +/** + * Incremental compilation tests. MultiProjectIncrementalTests was getting unwieldy - started this new test class for 1.6.10. + * + * @author Andy Clement + * @since 1.6.10 + */ +public class IncrementalCompilationTests extends AbstractMultiProjectIncrementalAjdeInteractionTestbed { + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + TypeMap.useExpendableMap = true; + } + + public void testAdditionalDependencies328649_1() throws Exception { + String p = "pr328649_1"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + checkCompileWeaveCount(p, 2, 2); + assertEquals(0, getErrorMessages(p).size()); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + checkCompileWeaveCount(p, 1, 1); + assertEquals(0, getErrorMessages(p).size()); + alter(p, "inc2"); + AjCompiler compiler = getCompilerForProjectWithName(p); + String s = getFile(p, "src/B.java"); + assertNotNull(s); + // add in a dependency where there really isn't one... + boolean b = compiler.addDependencies(new File(s), new String[] { "A" }); + assertTrue(b); + build(p); + checkWasntFullBuild(); + // now A rebuilds, then A and B rebuild due to that extra dependency + checkCompileWeaveCount(p, 3, 3); + assertEquals(0, getErrorMessages(p).size()); + alter(p, "inc2"); + compiler = getCompilerForProjectWithName(p); + s = getFile(p, "src/B.java"); + assertNotNull(s); + } + + /** + * Build a pair of files, then change the throws clause in the first one (add a throws clause where there wasnt one). The second + * file should now have a 'unhandled exception' error on it. + */ + public void testModifiedThrowsClauseShouldTriggerError_318884() throws Exception { + String p = "pr318884_1"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + checkCompileWeaveCount(p, 2, 2); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + assertEquals(1, getErrorMessages(p).size()); + assertContains("B.java:4:0::0 Unhandled exception type IOException", getErrorMessages(p).get(0)); + } + + public void testITIT_336158() throws Exception { + String p = "pr336158"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + assertNoErrors(p); + checkCompileWeaveCount(p, 3, 4); + } + + public void testITIT_336147() throws Exception { + String p = "pr336147"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + assertNoErrors(p); + checkCompileWeaveCount(p, 1, 3); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + assertNoErrors(p); + checkCompileWeaveCount(p, 1, 1); + } + + public void testITIT_336147_2() throws Exception { + String p = "pr336147_2"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + assertNoErrors(p); + checkCompileWeaveCount(p, 2, 3); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + assertNoErrors(p); + checkCompileWeaveCount(p, 1, 1); + } + + public void testITIT_336147_3() throws Exception { + AjdeInteractionTestbed.VERBOSE = true; + String p = "pr336147_3"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + assertNoErrors(p); + checkCompileWeaveCount(p, 3, 4); + } + + public void testDeclareFieldMinus() throws Exception { + String p = "annoRemoval"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + AspectJElementHierarchy model = (AspectJElementHierarchy) getModelFor(p).getHierarchy(); + IProgramElement ipe = null; + ipe = model.findElementForHandleOrCreate("=annoRemoval<a{Code.java'Remover`declare \\@field", false); + System.out.println(ipe); + assertTrue(ipe.isAnnotationRemover()); + String[] annos = ipe.getRemovedAnnotationTypes(); + assertEquals(1, annos.length); + assertEquals("a.Anno", annos[0]); + assertNull(ipe.getAnnotationType()); + ipe = model.findElementForHandleOrCreate("=annoRemoval<a{Code.java'Remover`declare \\@field!2", false); + System.out.println(ipe); + assertFalse(ipe.isAnnotationRemover()); + assertEquals("a.Anno", ipe.getAnnotationType()); + assertNull(ipe.getRemovedAnnotationTypes()); + } + + /** + * Build a pair of files, then change the throws clause in the first one (change the type of the thrown exception). The second + * file should now have a 'unhandled exception' error on it. + */ + public void testModifiedThrowsClauseShouldTriggerError_318884_2() throws Exception { + String p = "pr318884_2"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + checkCompileWeaveCount(p, 2, 2); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + assertEquals(1, getErrorMessages(p).size()); + assertContains("B.java:4:0::0 Unhandled exception type Exception", getErrorMessages(p).get(0)); + } + + /** + * Checking if we have the right information on the member nodes. + */ + public void testModelStructure_333123() throws Exception { + String p = "pr333123"; + initialiseProject(p); + configureNonStandardCompileOptions(p, "-Xset:minimalModel=false"); + build(p); + checkWasFullBuild(); + printModel(p); + + AspectJElementHierarchy model = (AspectJElementHierarchy) getModelFor(p).getHierarchy(); + + IProgramElement ipe = null; + // fieldInt [field] 10 hid:=pr333123<a.b{Code.java[Code^fieldInt + // fieldString [field] 12 hid:=pr333123<a.b{Code.java[Code^fieldString + // fieldCode [field] 14 hid:=pr333123<a.b{Code.java[Code^fieldCode + ipe = model.findElementForHandle("=pr333123<a.b{Code.java[Code^fieldInt"); + assertEquals("I", ipe.getCorrespondingTypeSignature()); + assertEquals("int", ipe.getCorrespondingType(true)); + ipe = model.findElementForHandle("=pr333123<a.b{Code.java[Code^fieldString"); + assertEquals("Ljava/lang/String;", ipe.getCorrespondingTypeSignature()); + assertEquals("java.lang.String", ipe.getCorrespondingType(true)); + // assertEquals("Ljava/lang/String;", ipe.getBytecodeSignature()); + ipe = model.findElementForHandle("=pr333123<a.b{Code.java[Code^fieldCode"); + assertEquals("La/b/Code;", ipe.getCorrespondingTypeSignature()); + assertEquals("a.b.Code", ipe.getCorrespondingType(true)); + ipe = model.findElementForHandle("=pr333123<a.b{Code.java[Code^fieldList"); + // assertEquals("La/b/Code;", ipe.getBytecodeSignature()); + assertEquals("Ljava/util/List<La/b/Code;>;", ipe.getCorrespondingTypeSignature()); + assertEquals("java.util.List<a.b.Code>", ipe.getCorrespondingType(true)); + + // method(java.lang.String) [method] 4 hid:=pr333123<a.b{Code.java[Code~method~QString; + // getInt() [method] 6 hid:=pr333123<a.b{Code.java[Code~getInt + // transform(a.b.Code,java.lang.String,long) [method] 8 hid:=pr333123<a.b{Code.java[Code~transform~QCode;~QString;~J + ipe = model.findElementForHandle("=pr333123<a.b{Code.java[Code~method~QString;"); + assertEquals("(Ljava/lang/String;)V", ipe.getBytecodeSignature()); + ipe = model.findElementForHandle("=pr333123<a.b{Code.java[Code~getInt"); + assertEquals("()I", ipe.getBytecodeSignature()); + + ipe = model.findElementForHandle("=pr333123<a.b{Code.java[Code~transform~QCode;~QString;~J"); + assertEquals("(La/b/Code;Ljava/lang/String;J)La/b/Code;", ipe.getBytecodeSignature()); + + List<char[]> paramSigs = ipe.getParameterSignatures(); + assertEquals("La/b/Code;", new String(paramSigs.get(0))); + assertEquals("Ljava/lang/String;", new String(paramSigs.get(1))); + assertEquals("J", new String(paramSigs.get(2))); + + assertEquals("a.b.Code", ipe.getCorrespondingType(true)); + assertEquals("La/b/Code;", ipe.getCorrespondingTypeSignature()); + + ipe = model.findElementForHandle("=pr333123<a.b{Code.java[Code~transform2~QList\\<QString;>;"); + assertEquals("(Ljava/util/List;)Ljava/util/List;", ipe.getBytecodeSignature()); + paramSigs = ipe.getParameterSignatures(); + assertEquals("Ljava/util/List<Ljava/lang/String;>;", new String(paramSigs.get(0))); + assertEquals("java.util.List<a.b.Code>", ipe.getCorrespondingType(true)); + assertEquals("Ljava/util/List<La/b/Code;>;", ipe.getCorrespondingTypeSignature()); + + } + + // changing method return type parameterization + public void testModifiedMethodReturnTypeGenericTypeParameterShouldTriggerError_318884_3() throws Exception { + String p = "pr318884_3"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + checkCompileWeaveCount(p, 2, 2); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + assertEquals(1, getErrorMessages(p).size()); + assertContains("The return type is incompatible with B.foo()", getErrorMessages(p).get(0)); + } + + // changing method parameter type parameterization + public void testModifiedMethodParameterGenericTypeParameterShouldTriggerError_318884_4() throws Exception { + String p = "pr318884_4"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + checkCompileWeaveCount(p, 2, 2); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + assertEquals(1, getErrorMessages(p).size()); + assertContains( + "Name clash: The method foo(List<String>) of type A has the same erasure as foo(List<Integer>) of type B but does not override it", + getErrorMessages(p).get(0)); + } + + // changing constructor parameter type parameterization + public void testModifiedConstructorParameterGenericTypeParameterShouldTriggerError_318884_5() throws Exception { + String p = "pr318884_5"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + checkCompileWeaveCount(p, 2, 2); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + assertEquals(1, getErrorMessages(p).size()); + assertContains("The constructor B(List<String>) is undefined", getErrorMessages(p).get(0)); + } + + // changing field type parameterization + public void testModifiedFieldTypeGenericTypeParameterShouldTriggerError_318884_6() throws Exception { + String p = "pr318884_6"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + checkCompileWeaveCount(p, 2, 2); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + assertEquals(1, getErrorMessages(p).size()); + assertContains("Type mismatch: cannot convert from element type Integer to String", getErrorMessages(p).get(0)); + } + + // removing static inner class + public void testInnerClassChanges_318884_7() throws Exception { + String p = "pr318884_7"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + checkCompileWeaveCount(p, 2, 3); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + assertEquals(1, getErrorMessages(p).size()); + assertContains("B.C cannot be resolved to a type", getErrorMessages(p).get(0)); + } + + // removing constructor from a static inner class + public void testInnerClassChanges_318884_9() throws Exception { + String p = "pr318884_9"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + checkCompileWeaveCount(p, 2, 3); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + assertEquals(1, getErrorMessages(p).size()); + assertContains("The constructor B.C(String) is undefined", getErrorMessages(p).get(0)); + } + + // removing class + public void testInnerClassChanges_318884_10() throws Exception { + String p = "pr318884_10"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + checkCompileWeaveCount(p, 2, 2); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + assertEquals(2, getErrorMessages(p).size()); + assertContains("B cannot be resolved to a type", getErrorMessages(p).get(0)); + } + + // deleting unaffected model entries + public void testDeletion_278496() throws Exception { + String p = "PR278496_1"; + initialiseProject(p); + configureNonStandardCompileOptions(p, "-Xset:minimalModel=true"); + build(p); + checkWasFullBuild(); + // Here is the model without deletion. The node for 'Code.java' can safely be deleted as it contains + // no types that are the target of relationships. + // PR278496_1 [build configuration file] hid:=PR278496_1 + // a.b.c [package] hid:=PR278496_1<a.b.c + // Azpect.java [java source file] 1 hid:=PR278496_1<a.b.c{Azpect.java + // a.b.c [package declaration] 1 hid:=PR278496_1<a.b.c{Azpect.java%a.b.c + // [import reference] hid:=PR278496_1<a.b.c{Azpect.java# + // Azpect [aspect] 3 hid:=PR278496_1<a.b.c{Azpect.java}Azpect + // before(): <anonymous pointcut> [advice] 4 hid:=PR278496_1<a.b.c{Azpect.java}Azpect&before + // Code.java [java source file] 1 hid:=PR278496_1<a.b.c{Code.java + // a.b.c [package declaration] 1 hid:=PR278496_1<a.b.c{Code.java%a.b.c + // [import reference] hid:=PR278496_1<a.b.c{Code.java# + // java.util.ArrayList [import reference] 3 hid:=PR278496_1<a.b.c{Code.java#java.util.ArrayList + // java.util.List [import reference] 2 hid:=PR278496_1<a.b.c{Code.java#java.util.List + // Code [class] 5 hid:=PR278496_1<a.b.c{Code.java[Code + // m() [method] 6 hid:=PR278496_1<a.b.c{Code.java[Code~m + // Code2.java [java source file] 1 hid:=PR278496_1<a.b.c{Code2.java + // a.b.c [package declaration] 1 hid:=PR278496_1<a.b.c{Code2.java%a.b.c + // [import reference] hid:=PR278496_1<a.b.c{Code2.java# + // java.util.ArrayList [import reference] 3 hid:=PR278496_1<a.b.c{Code2.java#java.util.ArrayList + // java.util.List [import reference] 2 hid:=PR278496_1<a.b.c{Code2.java#java.util.List + // Code2 [class] 5 hid:=PR278496_1<a.b.c{Code2.java[Code2 + // m() [method] 6 hid:=PR278496_1<a.b.c{Code2.java[Code2~m + // Hid:1:(targets=1) =PR278496_1<a.b.c{Azpect.java}Azpect&before (advises) =PR278496_1<a.b.c{Code2.java[Code2 + // Hid:2:(targets=1) =PR278496_1<a.b.c{Code2.java[Code2 (advised by) =PR278496_1<a.b.c{Azpect.java}Azpect&before + + // deletion turned on: + // PR278496_1 [build configuration file] hid:=PR278496_1 + // a.b.c [package] hid:<a.b.c + // Azpect.java [java source file] 1 hid:<a.b.c{Azpect.java + // a.b.c [package declaration] 1 hid:<a.b.c{Azpect.java%a.b.c + // [import reference] hid:<a.b.c{Azpect.java# + // Azpect [aspect] 3 hid:<a.b.c{Azpect.java}Azpect + // before(): <anonymous pointcut> [advice] 4 hid:<a.b.c{Azpect.java}Azpect&before + // Code2.java [java source file] 1 hid:<a.b.c{Code2.java + // a.b.c [package declaration] 1 hid:<a.b.c{Code2.java%a.b.c + // [import reference] hid:<a.b.c{Code2.java# + // java.util.ArrayList [import reference] 3 hid:<a.b.c{Code2.java#java.util.ArrayList + // java.util.List [import reference] 2 hid:<a.b.c{Code2.java#java.util.List + // Code2 [class] 5 hid:<a.b.c{Code2.java[Code2 + // m() [method] 6 hid:<a.b.c{Code2.java[Code2~m + // Hid:1:(targets=1) <a.b.c{Azpect.java}Azpect&before (advises) <a.b.c{Code2.java[Code2 + // Hid:2:(targets=1) <a.b.c{Code2.java[Code2 (advised by) <a.b.c{Azpect.java}Azpect&before + + AspectJElementHierarchy model = (AspectJElementHierarchy) getModelFor(p).getHierarchy(); + // Node for "Code.java" should not be there: + IProgramElement ipe = model.findElementForHandleOrCreate("=PR278496_1<a.b.c{Code.java", false); + assertNull(ipe); + } + + // inner classes + public void testDeletion_278496_9() throws Exception { + String p = "PR278496_9"; + initialiseProject(p); + configureNonStandardCompileOptions(p, "-Xset:minimalModel=true"); + build(p); + checkWasFullBuild(); + printModel(p); + + AspectJElementHierarchy model = (AspectJElementHierarchy) getModelFor(p).getHierarchy(); + // Node for "Code.java" should not be there: + IProgramElement ipe = model.findElementForHandleOrCreate("=PR278496_9<a.b.c{Code.java", false); + assertNull(ipe); + } + + // deleting unaffected model entries + public void testDeletion_278496_2() throws Exception { + String p = "PR278496_2"; + initialiseProject(p); + configureNonStandardCompileOptions(p, "-Xset:minimalModel=true"); + build(p); + checkWasFullBuild(); + // printModel(p); + // Here is the model without deletion. + // PR278496_2 [build configuration file] hid:=PR278496_2 + // [package] hid:=PR278496_2< + // Azpect.java [java source file] 1 hid:=PR278496_2<{Azpect.java + // [import reference] hid:=PR278496_2<{Azpect.java# + // Azpect [aspect] 1 hid:=PR278496_2<{Azpect.java}Azpect + // Code.m() [inter-type method] 2 hid:=PR278496_2<{Azpect.java}Azpect)Code.m + // Code.java [java source file] 1 hid:=PR278496_2<{Code.java + // [import reference] hid:=PR278496_2<{Code.java# + // Code [class] 1 hid:=PR278496_2<{Code.java[Code + // Hid:1:(targets=1) =PR278496_2<{Azpect.java}Azpect)Code.m (declared on) =PR278496_2<{Code.java[Code + // Hid:2:(targets=1) =PR278496_2<{Code.java[Code (aspect declarations) =PR278496_2<{Azpect.java}Azpect)Code.m + + AspectJElementHierarchy model = (AspectJElementHierarchy) getModelFor(p).getHierarchy(); + // Node for "Code.java" should be there since it is the target of a relationship + IProgramElement ipe = model.findElementForHandleOrCreate("=PR278496_2<{Code.java", false); + assertNotNull(ipe); + } + + public void testWorldDemotion_278496_5() throws Exception { + String p = "PR278496_5"; + initialiseProject(p); + configureNonStandardCompileOptions(p, "-Xset:typeDemotion=true"); + build(p); + checkWasFullBuild(); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + AjdeCoreBuildManager buildManager = getCompilerForProjectWithName(p).getBuildManager(); + AjBuildManager ajBuildManager = buildManager.getAjBuildManager(); + World w = ajBuildManager.getWorld(); + ReferenceTypeDelegate delegate = null; + delegate = w.resolveToReferenceType("com.Foo").getDelegate(); + ResolvedMember[] fields = delegate.getDeclaredFields(); + assertEquals("int com.Foo.i", fields[0].toString()); + assertEquals("java.lang.String com.Foo.s", fields[1].toString()); + assertEquals("java.util.List com.Foo.ls", fields[2].toString()); + + assertEquals("[Anno[Lcom/Anno; rVis]]", stringify(fields[2].getAnnotations())); + assertNotNull(fields[2].getAnnotationOfType(UnresolvedType.forSignature("Lcom/Anno;"))); + assertNull(fields[2].getAnnotationOfType(UnresolvedType.forSignature("Lcom/Anno2;"))); + assertTrue(fields[2].hasAnnotation(UnresolvedType.forSignature("Lcom/Anno;"))); + assertFalse(fields[2].hasAnnotation(UnresolvedType.forSignature("Ljava/lang/String;"))); + assertEquals(0, fields[1].getAnnotations().length); + assertEquals("[com.Anno2 com.Anno]", stringify(fields[3].getAnnotationTypes())); + assertEquals("[]", stringify(fields[1].getAnnotationTypes())); + assertEquals("[Anno[Lcom/Anno2; rVis a=(int)42] Anno[Lcom/Anno; rVis]]", stringify(fields[3].getAnnotations())); + assertEquals("[]", stringify(fields[1].getAnnotations())); + + assertEquals("I", fields[0].getSignature()); + assertEquals("Ljava/lang/String;", fields[1].getSignature()); + assertEquals("Ljava/util/List;", fields[2].getSignature()); + assertEquals("Pjava/util/List<Ljava/lang/String;>;", fields[2].getGenericReturnType().getSignature()); + assertEquals("Ljava/util/List;", fields[3].getSignature()); + assertEquals("Pjava/util/List<Ljava/lang/Integer;>;", fields[3].getGenericReturnType().getSignature()); + } + + /** + * This test is verifying the treatment of array types (here, String[]). These should be expendable but because the + * ArrayReferenceType wasnt overriding isExposedToWeaver() an array had an apparent null delegate - this caused the isExpendable + * check to fail when choosing whether to put something in the permanent or expendable map. Leaving something in the permanent + * map that would never be cleared out. + */ + public void testWorldDemotion_278496_10() throws Exception { + String p = "PR278496_10"; + TypeMap.useExpendableMap = false; + initialiseProject(p); + configureNonStandardCompileOptions(p, "-Xset:typeDemotion=true,typeDemotionDebug=true"); + build(p); + checkWasFullBuild(); + AjdeCoreBuildManager buildManager = getCompilerForProjectWithName(p).getBuildManager(); + AjBuildManager ajBuildManager = buildManager.getAjBuildManager(); + World w = ajBuildManager.getWorld(); + + assertNotInTypeMap(w, "Lcom/Foo;"); + assertNotInTypeMap(w, "[Ljava/lang/String;"); + assertInTypeMap(w, "Lcom/Asp;"); + assertInTypeMap(w, "[I"); + assertInTypeMap(w, "[[F"); + } + + public void testWorldDemotion_278496_11() throws Exception { + String asp = "PR278496_11_a"; + initialiseProject(asp); + build(asp); + + String p = "PR278496_11"; + TypeMap.useExpendableMap = false; + initialiseProject(p); + configureNonStandardCompileOptions(p, "-Xset:typeDemotion=true,typeDemotionDebug=true"); + configureAspectPath(p, getProjectRelativePath(asp, "bin")); + build(p); + checkWasFullBuild(); + AjdeCoreBuildManager buildManager = getCompilerForProjectWithName(p).getBuildManager(); + AjBuildManager ajBuildManager = buildManager.getAjBuildManager(); + World w = ajBuildManager.getWorld(); + + assertNotInTypeMap(w, "Lcom/Foo;"); + assertInTypeMap(w, "Lcom/Asp;"); + assertNotInTypeMap(w, "Lcom/Dibble;"); + } + + public void testWorldDemotion_278496_6() throws Exception { + String p = "PR278496_6"; + initialiseProject(p); + configureNonStandardCompileOptions(p, "-Xset:typeDemotion=true"); + build(p); + checkWasFullBuild(); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + AjdeCoreBuildManager buildManager = getCompilerForProjectWithName(p).getBuildManager(); + AjBuildManager ajBuildManager = buildManager.getAjBuildManager(); + World w = ajBuildManager.getWorld(); + ReferenceTypeDelegate delegate = null; + delegate = w.resolveToReferenceType("com.Meths").getDelegate(); + // assertTrue(delegate instanceof CompactTypeStructureDelegate); + ResolvedMember[] methods = delegate.getDeclaredMethods(); + assertEquals("void com.Meths.<init>()", methods[0].toString()); + assertEquals("void com.Meths.m()", methods[1].toString()); + assertEquals("java.util.List com.Meths.n(int, long, java.util.List)", methods[2].toString()); + + System.out.println(stringify(methods[0].getAnnotations())); + System.out.println(stringify(methods[1].getAnnotations())); + System.out.println(stringify(methods[2].getAnnotations())); + assertEquals("[Anno[Lcom/Anno; rVis]]", stringify(methods[1].getAnnotations())); + // assertNotNull(fields[2].getAnnotationOfType(UnresolvedType.forSignature("Lcom/Anno;"))); + // assertNull(fields[2].getAnnotationOfType(UnresolvedType.forSignature("Lcom/Anno2;"))); + // assertTrue(fields[2].hasAnnotation(UnresolvedType.forSignature("Lcom/Anno;"))); + // assertFalse(fields[2].hasAnnotation(UnresolvedType.forSignature("Ljava/lang/String;"))); + // assertEquals(0,fields[1].getAnnotations().length); + // assertEquals("[com.Anno2 com.Anno]",stringify(fields[3].getAnnotationTypes())); + // assertEquals("[]",stringify(fields[1].getAnnotationTypes())); + // assertEquals("[Anno[Lcom/Anno2; rVis a=(int)42] Anno[Lcom/Anno; rVis]]",stringify(fields[3].getAnnotations())); + // assertEquals("[]",stringify(fields[1].getAnnotations())); + // + // assertEquals("I",fields[0].getSignature()); + // assertEquals("Ljava/lang/String;",fields[1].getSignature()); + // assertEquals("Ljava/util/List;",fields[2].getSignature()); + // assertEquals("Pjava/util/List<Ljava/lang/String;>;",fields[2].getGenericReturnType().getSignature()); + // assertEquals("Ljava/util/List;",fields[3].getSignature()); + // assertEquals("Pjava/util/List<Ljava/lang/Integer;>;",fields[3].getGenericReturnType().getSignature()); + } + + // public void testWorldDemotion_278496_7() throws Exception { + // boolean demotion = true; + // AjdeInteractionTestbed.VERBOSE=true; + // String p = "PR278496_7"; + // TypeMap.useExpendableMap=false; + // initialiseProject(p); + // if (demotion) { + // configureNonStandardCompileOptions(p, "-Xset:typeDemotion=true,typeDemotionDebug=true"); + // } + // build(p); + // checkWasFullBuild(); + // assertNoErrors(p); + // alter(p,"inc1"); + // build(p); + // checkWasntFullBuild(); + // assertNoErrors(p); + // + // AjdeCoreBuildManager buildManager = getCompilerForProjectWithName(p).getBuildManager(); + // AjBuildManager ajBuildManager = buildManager.getAjBuildManager(); + // World w = ajBuildManager.getWorld(); + // } + + public void testWorldDemotion_278496_4() throws Exception { + String p = "PR278496_4"; + // Setting this ensures types are forced out when demoted - we are not at the mercy of weak reference GC + TypeMap.useExpendableMap = false; + initialiseProject(p); + configureNonStandardCompileOptions(p, "-Xset:typeDemotion=true,typeDemotionDebug=true"); + build(p); + checkWasFullBuild(); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + + AjdeCoreBuildManager buildManager = getCompilerForProjectWithName(p).getBuildManager(); + AjBuildManager ajBuildManager = buildManager.getAjBuildManager(); + World w = ajBuildManager.getWorld(); + + // Confirm demoted: + assertNotInTypeMap(w, "Lcom/foo/Bar;"); + + ReferenceType rt = null; + ReferenceTypeDelegate delegate = null; + rt = w.resolveToReferenceType("com.foo.Bar"); + delegate = rt.getDelegate(); + // Should have been demoted to a CTSD + assertEquals(0, delegate.getAnnotations().length); + assertEquals(0, delegate.getAnnotationTypes().length); + assertEquals(0, delegate.getDeclaredInterfaces().length); + assertEquals("java.lang.Object", delegate.getSuperclass().toString()); + assertNull(delegate.getRetentionPolicy()); + assertFalse(delegate.isInterface()); + assertTrue(delegate.isClass()); + assertFalse(delegate.isEnum()); + // assertFalse(rtd.isWeavable()); + // try { + // assertTrue(delegate.hasBeenWoven()); + // fail("expected exception"); + // } catch (IllegalStateException ise) { + // // success + // } + + // Confirm demoted: + assertNull(w.getTypeMap().get("Lcom/foo/Color;")); + rt = w.resolveToReferenceType("com.foo.Color"); + delegate = rt.getDelegate(); + assertFalse(delegate.isInterface()); + assertTrue(delegate.isEnum()); + + // Aspects are never demoted and so never have a per clause, declares or type mungers + assertNull(delegate.getPerClause()); + assertEquals(0, delegate.getDeclares().size()); + assertEquals(0, delegate.getTypeMungers().size()); + assertFalse(delegate.isAspect()); + assertEquals(0, delegate.getPrivilegedAccesses().size()); + assertEquals(0, delegate.getDeclaredPointcuts().length); + assertFalse(delegate.isAnnotationStyleAspect()); + assertFalse(delegate.isAnnotationWithRuntimeRetention()); + + // Confirm demoted: + assertNull(w.getTypeMap().get("Lcom/foo/Extender;")); + rt = w.resolveToReferenceType("com.foo.Extender"); + delegate = rt.getDelegate(); + assertEquals("[com.foo.Marker]", stringify(delegate.getDeclaredInterfaces())); + assertEquals("com.foo.Super", delegate.getSuperclass().toString()); + + // this has one fixed annotation that is a well known one + // Confirm demoted: + ResolvedType annoType = w.getTypeMap().get("Lcom/foo/Anno;"); + assertNull(annoType); + rt = w.resolveToReferenceType("com.foo.Anno"); + delegate = rt.getDelegate(); + assertEquals("[Anno[Ljava/lang/annotation/Retention; rVis value=E(Ljava/lang/annotation/RetentionPolicy; RUNTIME)]]", + stringify(delegate.getAnnotations())); + assertEquals("[java.lang.annotation.Retention]", stringify(delegate.getAnnotationTypes())); + assertTrue(delegate.isAnnotationWithRuntimeRetention()); + assertEquals("RUNTIME", delegate.getRetentionPolicy()); + + // this has a bunch of well known ones + rt = w.resolveToReferenceType("com.foo.Anno2"); + delegate = rt.getDelegate(); + assertEquals( + "[Anno[Ljava/lang/Deprecated; rVis] Anno[Ljava/lang/annotation/Inherited; rVis] Anno[Ljava/lang/annotation/Retention; rVis value=E(Ljava/lang/annotation/RetentionPolicy; CLASS)]]", + stringify(delegate.getAnnotations())); + assertEquals("[java.lang.Deprecated java.lang.annotation.Inherited java.lang.annotation.Retention]", + stringify(delegate.getAnnotationTypes())); + assertFalse(delegate.isAnnotationWithRuntimeRetention()); + assertEquals("CLASS", delegate.getRetentionPolicy()); + assertTrue(delegate.hasAnnotation(UnresolvedType.forSignature("Ljava/lang/annotation/Inherited;"))); + assertTrue(delegate.hasAnnotation(UnresolvedType.forSignature("Ljava/lang/annotation/Retention;"))); + assertFalse(delegate.hasAnnotation(UnresolvedType.forSignature("Lcom/foo/Anno;"))); + + // this has a well known one and a non-well known one + rt = w.resolveToReferenceType("com.foo.Anno3"); + delegate = rt.getDelegate(); + System.out.println(stringify(delegate.getAnnotations())); + assertEquals( + "[Anno[Lcom/foo/Anno; rVis] Anno[Ljava/lang/annotation/Retention; rVis value=E(Ljava/lang/annotation/RetentionPolicy; SOURCE)]]", + stringify(delegate.getAnnotations())); + assertEquals("[com.foo.Anno java.lang.annotation.Retention]", stringify(delegate.getAnnotationTypes())); + assertFalse(delegate.isAnnotationWithRuntimeRetention()); + assertEquals("SOURCE", delegate.getRetentionPolicy()); + + // this has two non-well known ones + rt = w.resolveToReferenceType("com.foo.Anno4"); + delegate = rt.getDelegate(); + assertEquals("[Anno[Lcom/foo/Anno2; rInvis] Anno[Lcom/foo/Anno; rVis]]", stringify(delegate.getAnnotations())); + assertEquals("[com.foo.Anno2 com.foo.Anno]", stringify(delegate.getAnnotationTypes())); + assertFalse(delegate.isAnnotationWithRuntimeRetention()); + assertNull(delegate.getRetentionPolicy()); + assertTrue(delegate.hasAnnotation(UnresolvedType.forSignature("Lcom/foo/Anno;"))); + + rt = w.resolveToReferenceType("com.foo.Colored"); + delegate = rt.getDelegate(); + AnnotationAJ annotation = delegate.getAnnotations()[0]; // should be ColorAnno(c=Color.G) + assertTrue(annotation.hasNamedValue("c")); + assertFalse(annotation.hasNamedValue("value")); + assertTrue(annotation.hasNameValuePair("c", "Lcom/foo/Color;G")); + assertFalse(annotation.hasNameValuePair("c", "Lcom/foo/Color;B")); + assertFalse(annotation.hasNameValuePair("d", "xxx")); + assertNull(annotation.getStringFormOfValue("d")); + assertEquals("Lcom/foo/Color;G", annotation.getStringFormOfValue("c")); + assertEquals(0, annotation.getTargets().size()); + assertTrue(delegate.isCacheable()); + + assertFalse(delegate.isExposedToWeaver()); + + // assertEquals(w.resolve(UnresolvedType.forSignature("Lcom/foo/Colored;")),delegate.getResolvedTypeX()); + + assertEquals("com/foo/Colored.java", delegate.getSourcefilename()); + + // Anno5 has an @Target annotation + rt = w.resolveToReferenceType("com.foo.Anno5"); + delegate = rt.getDelegate(); + annotation = delegate.getAnnotations()[0]; // should be @Target(TYPE,FIELD) + Set<String> ss = annotation.getTargets(); + assertEquals(2, ss.size()); + assertTrue(ss.contains("FIELD")); + assertTrue(ss.contains("TYPE")); + // AnnotationTargetKind[] kinds = delegate.getAnnotationTargetKinds(); + // assertEquals("FIELD",kinds[0].getName()); + // assertEquals("TYPE",kinds[1].getName()); + + rt = w.resolveToReferenceType("com.foo.Inners$Inner"); + delegate = rt.getDelegate(); + assertTrue(delegate.isNested()); + assertEquals("com.foo.Inners", delegate.getOuterClass().getName()); + + rt = w.resolveToReferenceType("com.foo.Inners$1"); + delegate = rt.getDelegate(); + assertTrue(delegate.isAnonymous()); + assertTrue(delegate.isNested()); + + // delegate = w.resolveToReferenceType("com.foo.Anno6").getDelegate(); + // kinds = delegate.getAnnotationTargetKinds(); + // assertEquals(6,kinds.length); + // String s = stringify(kinds); + // assertTrue(s.contains("ANNOTATION_TYPE")); + // assertTrue(s.contains("LOCAL_VARIABLE")); + // assertTrue(s.contains("METHOD")); + // assertTrue(s.contains("PARAMETER")); + // assertTrue(s.contains("PACKAGE")); + // assertTrue(s.contains("CONSTRUCTOR")); + + delegate = w.resolveToReferenceType("com.foo.Marker").getDelegate(); + assertTrue(delegate.isInterface()); + + } + + private void assertNotInTypeMap(World w, String string) { + assertNull(w.getTypeMap().get(string)); + } + + private void assertInTypeMap(World w, String string) { + assertNotNull(w.getTypeMap().get(string)); + } + + private String stringify(Object[] arr) { + StringBuilder s = new StringBuilder(); + for (int i = 0; i < arr.length; i++) { + s.append(arr[i]); + s.append(" "); + } + return "[" + s.toString().trim() + "]"; + } + + public void testDeletionInnerAspects_278496_4() throws Exception { + String p = "PR278496_4"; + initialiseProject(p); + configureNonStandardCompileOptions(p, "-Xset:minimalModel=true"); + build(p); + checkWasFullBuild(); + // printModel(p); + // Here is the model without deletion. + // PR278496_4 [build configuration file] hid:=PR278496_4 + // foo [package] hid:=PR278496_4<foo + // MyOtherClass.java [java source file] 1 hid:=PR278496_4<foo{MyOtherClass.java + // foo [package declaration] 1 hid:=PR278496_4<foo{MyOtherClass.java%foo + // [import reference] hid:=PR278496_4<foo{MyOtherClass.java# + // MyOtherClass [class] 2 hid:=PR278496_4<foo{MyOtherClass.java[MyOtherClass + // MyInnerClass [class] 4 hid:=PR278496_4<foo{MyOtherClass.java[MyOtherClass[MyInnerClass + // MyInnerInnerAspect [aspect] 6 hid:=PR278496_4<foo{MyOtherClass.java[MyOtherClass[MyInnerClass}MyInnerInnerAspect + // before(): <anonymous pointcut> [advice] 8 + // hid:=PR278496_4<foo{MyOtherClass.java[MyOtherClass[MyInnerClass}MyInnerInnerAspect&before + // MyClass.java [java source file] 1 hid:=PR278496_4<foo{MyClass.java + // foo [package declaration] 1 hid:=PR278496_4<foo{MyClass.java%foo + // [import reference] hid:=PR278496_4<foo{MyClass.java# + // MyClass [class] 9 hid:=PR278496_4<foo{MyClass.java[MyClass + // main(java.lang.String[]) [method] 12 hid:=PR278496_4<foo{MyClass.java[MyClass~main~\[QString; + // method1() [method] 16 hid:=PR278496_4<foo{MyClass.java[MyClass~method1 + // method2() [method] 18 hid:=PR278496_4<foo{MyClass.java[MyClass~method2 + // Hid:1:(targets=1) =PR278496_4<foo{MyClass.java[MyClass~method1 (advised by) + // =PR278496_4<foo{MyOtherClass.java[MyOtherClass[MyInnerClass}MyInnerInnerAspect&before + // Hid:2:(targets=1) =PR278496_4<foo{MyOtherClass.java[MyOtherClass[MyInnerClass}MyInnerInnerAspect&before (advises) + // =PR278496_4<foo{MyClass.java[MyClass~method1 + + AspectJElementHierarchy model = (AspectJElementHierarchy) getModelFor(p).getHierarchy(); + IProgramElement ipe = model.findElementForHandleOrCreate( + "=PR278496_4<foo{MyOtherClass.java[MyOtherClass[MyInnerClass'MyInnerInnerAspect", false); + assertNotNull(ipe); + } + + public void testDeletionAnonInnerType_278496_8() throws Exception { + AjdeInteractionTestbed.VERBOSE = true; + String p = "pr278496_8"; + initialiseProject(p); + configureNonStandardCompileOptions(p, "-Xset:minimalModel=true"); + build(p); + checkWasFullBuild(); + // printModel(p); + // Here is the model without deletion. + // PR278496_8 [build configuration file] hid:=PR278496_8 + // generics [package] hid:=PR278496_8<generics + // DeleteActionAspect.aj [java source file] 1 hid:=PR278496_8<generics*DeleteActionAspect.aj + // generics [package declaration] 1 hid:=PR278496_8<generics*DeleteActionAspect.aj%generics + // [import reference] hid:=PR278496_8<generics*DeleteActionAspect.aj# + // java.util.List [import reference] 3 hid:=PR278496_8<generics*DeleteActionAspect.aj#java.util.List + // DeleteActionAspect [aspect] 6 hid:=PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect + // DeleteAction.delete() [inter-type method] 8 + // hid:=PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect)DeleteAction.delete + // DeleteAction.delete2 [inter-type field] 14 + // hid:=PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect,DeleteAction.delete2 + // DeleteAction.delete3 [inter-type field] 16 + // hid:=PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect,DeleteAction.delete3 + // main(java.lang.String[]) [method] 19 hid:=PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect~main~\[QString; + // new DeleteAction<String>() {..} [class] 20 + // hid:=PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect~main~\[QString;[ + // getSelected() [method] 21 hid:=PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect~main~\[QString;[~getSelected + // ActionExecutor.java [java source file] 1 hid:=PR278496_8<generics{ActionExecutor.java + // generics [package declaration] 1 hid:=PR278496_8<generics{ActionExecutor.java%generics + // [import reference] hid:=PR278496_8<generics{ActionExecutor.java# + // ActionExecutor [class] 3 hid:=PR278496_8<generics{ActionExecutor.java[ActionExecutor + // main(java.lang.String[]) [method] 4 hid:=PR278496_8<generics{ActionExecutor.java[ActionExecutor~main~\[QString; + // new DeleteAction<String>() {..} [class] 5 hid:=PR278496_8<generics{ActionExecutor.java[ActionExecutor~main~\[QString;[ + // getSelected() [method] 6 hid:=PR278496_8<generics{ActionExecutor.java[ActionExecutor~main~\[QString;[~getSelected + // nothing2(generics.DeleteAction<java.lang.String>) [method] 15 + // hid:=PR278496_8<generics{ActionExecutor.java[ActionExecutor~nothing2~QDeleteAction\<QString;>; + // DeleteAction.java [java source file] 1 hid:=PR278496_8<generics{DeleteAction.java + // generics [package declaration] 1 hid:=PR278496_8<generics{DeleteAction.java%generics + // [import reference] hid:=PR278496_8<generics{DeleteAction.java# + // java.util.List [import reference] 2 hid:=PR278496_8<generics{DeleteAction.java#java.util.List + // DeleteAction [interface] 5 hid:=PR278496_8<generics{DeleteAction.java[DeleteAction + // delete() [method] 7 hid:=PR278496_8<generics{DeleteAction.java[DeleteAction~delete + // getSelected() [method] 9 hid:=PR278496_8<generics{DeleteAction.java[DeleteAction~getSelected + // test [package] hid:=PR278496_8<test + // MyAspect.aj [java source file] 1 hid:=PR278496_8<test*MyAspect.aj + // test [package declaration] 1 hid:=PR278496_8<test*MyAspect.aj%test + // [import reference] hid:=PR278496_8<test*MyAspect.aj# + // java.util.List [import reference] 2 hid:=PR278496_8<test*MyAspect.aj#java.util.List + // MyAspect [aspect] 4 hid:=PR278496_8<test*MyAspect.aj'MyAspect + // MyAnnotation [annotation] 47 hid:=PR278496_8<test*MyAspect.aj'MyAspect[MyAnnotation + // Abstract [class] 60 hid:=PR278496_8<test*MyAspect.aj'MyAspect[Abstract + // Demo.version [inter-type field] 7 hid:=PR278496_8<test*MyAspect.aj'MyAspect,Demo.version + // Demo.list [inter-type field] 10 hid:=PR278496_8<test*MyAspect.aj'MyAspect,Demo.list + // Demo.x [inter-type field] 11 hid:=PR278496_8<test*MyAspect.aj'MyAspect,Demo.x + // Demo.foo(java.util.List<java.lang.String>) [inter-type method] 13 + // hid:=PR278496_8<test*MyAspect.aj'MyAspect)Demo.foo)QList\<QString;>; + // Demo.Demo(int) [inter-type constructor] 17 hid:=PR278496_8<test*MyAspect.aj'MyAspect)Demo.Demo_new)I + // declare warning: "blah" [declare warning] 21 hid:=PR278496_8<test*MyAspect.aj'MyAspect`declare warning + // declare error: "blah" [declare error] 23 hid:=PR278496_8<test*MyAspect.aj'MyAspect`declare error!2 + // declare soft: java.lang.Exception [declare soft] 25 hid:=PR278496_8<test*MyAspect.aj'MyAspect`declare soft!3 + // s() [pointcut] 28 hid:=PR278496_8<test*MyAspect.aj'MyAspect"s + // before(): s.. [advice] 31 hid:=PR278496_8<test*MyAspect.aj'MyAspect&before + // after(): s.. [advice] 33 hid:=PR278496_8<test*MyAspect.aj'MyAspect&after + // around(): s.. [advice] 35 hid:=PR278496_8<test*MyAspect.aj'MyAspect&around + // afterReturning(): s.. [advice] 39 hid:=PR278496_8<test*MyAspect.aj'MyAspect&afterReturning + // afterThrowing(): s.. [advice] 41 hid:=PR278496_8<test*MyAspect.aj'MyAspect&afterThrowing + // declare @type: test.Demo : @MyAnnotation [declare @type] 52 hid:=PR278496_8<test*MyAspect.aj'MyAspect`declare \@type + // declare @field: int test.Demo.x : @MyAnnotation [declare @field] 53 hid:=PR278496_8<test*MyAspect.aj'MyAspect`declare + // \@field + // declare @method: void test.Demo.foo(..) : @MyAnnotation [declare @method] 54 + // hid:=PR278496_8<test*MyAspect.aj'MyAspect`declare \@method + // declare @constructor: public test.Demo.new(int) : @MyAnnotation [declare @constructor] 55 + // hid:=PR278496_8<test*MyAspect.aj'MyAspect`declare \@constructor + // Abstract.nothing() [inter-type method] 58 hid:=PR278496_8<test*MyAspect.aj'MyAspect)Abstract.nothing + // Demo.aj [java source file] 1 hid:=PR278496_8<test*Demo.aj + // test [package declaration] 1 hid:=PR278496_8<test*Demo.aj%test + // [import reference] hid:=PR278496_8<test*Demo.aj# + // test.MyAspect$MyAnnotation [import reference] 1 hid:=PR278496_8<test*Demo.aj#test.MyAspect$MyAnnotation + // java.util.List [import reference] 3 hid:=PR278496_8<test*Demo.aj#java.util.List + // Demo [class] 5 hid:=PR278496_8<test*Demo.aj[Demo + // g() [method] 7 hid:=PR278496_8<test*Demo.aj[Demo~g + // OtherClass.aj [java source file] 1 hid:=PR278496_8<test*OtherClass.aj + // test [package declaration] 1 hid:=PR278496_8<test*OtherClass.aj%test + // [import reference] hid:=PR278496_8<test*OtherClass.aj# + // OtherClass [class] 4 hid:=PR278496_8<test*OtherClass.aj[OtherClass + // x() [method] 5 hid:=PR278496_8<test*OtherClass.aj[OtherClass~x + // test2 [package] hid:=PR278496_8<test2 + // MyAspect2.aj [java source file] 1 hid:=PR278496_8<test2*MyAspect2.aj + // test2 [package declaration] 4 hid:=PR278496_8<test2*MyAspect2.aj%test2 + // [import reference] hid:=PR278496_8<test2*MyAspect2.aj# + // test.Demo [import reference] 3 hid:=PR278496_8<test2*MyAspect2.aj#test.Demo + // MyAspect2 [aspect] 6 hid:=PR278496_8<test2*MyAspect2.aj'MyAspect2 + // Bar [interface] 8 hid:=PR278496_8<test2*MyAspect2.aj'MyAspect2[Bar + // Foo [class] 18 hid:=PR278496_8<test2*MyAspect2.aj'MyAspect2[Foo + // Foo() [constructor] 19 hid:=PR278496_8<test2*MyAspect2.aj'MyAspect2[Foo~Foo + // declare parents: implements MyAspect2$Bar,Cloneable [declare parents] 11 + // hid:=PR278496_8<test2*MyAspect2.aj'MyAspect2`declare parents + // Bar.bar() [inter-type method] 13 hid:=PR278496_8<test2*MyAspect2.aj'MyAspect2)Bar.bar + // declare parents: extends MyAspect2$Foo [declare parents] 23 hid:=PR278496_8<test2*MyAspect2.aj'MyAspect2`declare + // parents!2 + // Foo.baz() [inter-type method] 25 hid:=PR278496_8<test2*MyAspect2.aj'MyAspect2)Foo.baz + // OtherClass2.aj [java source file] 1 hid:=PR278496_8<test2*OtherClass2.aj + // test2 [package declaration] 1 hid:=PR278496_8<test2*OtherClass2.aj%test2 + // [import reference] hid:=PR278496_8<test2*OtherClass2.aj# + // test.Demo [import reference] 3 hid:=PR278496_8<test2*OtherClass2.aj#test.Demo + // OtherClass2 [class] 5 hid:=PR278496_8<test2*OtherClass2.aj[OtherClass2 + // x() [method] 6 hid:=PR278496_8<test2*OtherClass2.aj[OtherClass2~x + // Hid:1:(targets=1) =PR278496_8<test*MyAspect.aj'MyAspect,Demo.version (declared on) =PR278496_8<test*Demo.aj[Demo + // Hid:2:(targets=1) =PR278496_8<test*MyAspect.aj'MyAspect)Abstract.nothing (declared on) + // =PR278496_8<test*MyAspect.aj'MyAspect[Abstract + // Hid:3:(targets=1) =PR278496_8<test*Demo.aj[Demo (annotated by) =PR278496_8<test*MyAspect.aj'MyAspect`declare \@type + // Hid:4:(targets=8) =PR278496_8<test*Demo.aj[Demo (aspect declarations) =PR278496_8<test2*MyAspect2.aj'MyAspect2`declare + // parents!2 + // Hid:5:(targets=8) =PR278496_8<test*Demo.aj[Demo (aspect declarations) =PR278496_8<test2*MyAspect2.aj'MyAspect2`declare + // parents + // Hid:6:(targets=8) =PR278496_8<test*Demo.aj[Demo (aspect declarations) =PR278496_8<test2*MyAspect2.aj'MyAspect2)Bar.bar + // Hid:7:(targets=8) =PR278496_8<test*Demo.aj[Demo (aspect declarations) =PR278496_8<test*MyAspect.aj'MyAspect,Demo.version + // Hid:8:(targets=8) =PR278496_8<test*Demo.aj[Demo (aspect declarations) =PR278496_8<test*MyAspect.aj'MyAspect,Demo.list + // Hid:9:(targets=8) =PR278496_8<test*Demo.aj[Demo (aspect declarations) =PR278496_8<test*MyAspect.aj'MyAspect,Demo.x + // Hid:10:(targets=8) =PR278496_8<test*Demo.aj[Demo (aspect declarations) + // =PR278496_8<test*MyAspect.aj'MyAspect)Demo.foo)QList\<QString;>; + // Hid:11:(targets=8) =PR278496_8<test*Demo.aj[Demo (aspect declarations) + // =PR278496_8<test*MyAspect.aj'MyAspect)Demo.Demo_new)I + // Hid:12:(targets=1) =PR278496_8<test*MyAspect.aj'MyAspect`declare \@type (annotates) =PR278496_8<test*Demo.aj[Demo + // Hid:13:(targets=1) =PR278496_8<test*MyAspect.aj'MyAspect,Demo.list (declared on) =PR278496_8<test*Demo.aj[Demo + // Hid:14:(targets=1) =PR278496_8<test*MyAspect.aj'MyAspect)Demo.foo)QList\<QString;>; (declared on) + // =PR278496_8<test*Demo.aj[Demo + // Hid:15:(targets=1) =PR278496_8<test2*MyAspect2.aj'MyAspect2`declare parents!2 (declared on) =PR278496_8<test*Demo.aj[Demo + // Hid:16:(targets=3) =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect,DeleteAction.delete2 (declared on) + // =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect~main~\[QString;[ + // Hid:17:(targets=3) =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect,DeleteAction.delete2 (declared on) + // =PR278496_8<generics{ActionExecutor.java[ActionExecutor~main~\[QString;[ + // Hid:18:(targets=3) =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect,DeleteAction.delete2 (declared on) + // =PR278496_8<generics{DeleteAction.java[DeleteAction + // Hid:19:(targets=1) =PR278496_8<test*MyAspect.aj'MyAspect`declare \@constructor (annotates) + // =PR278496_8<test*MyAspect.aj'MyAspect)Demo.Demo_new)I + // Hid:20:(targets=3) =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect,DeleteAction.delete3 (declared on) + // =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect~main~\[QString;[ + // Hid:21:(targets=3) =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect,DeleteAction.delete3 (declared on) + // =PR278496_8<generics{ActionExecutor.java[ActionExecutor~main~\[QString;[ + // Hid:22:(targets=3) =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect,DeleteAction.delete3 (declared on) + // =PR278496_8<generics{DeleteAction.java[DeleteAction + // Hid:23:(targets=1) =PR278496_8<test*MyAspect.aj'MyAspect[Abstract (aspect declarations) + // =PR278496_8<test*MyAspect.aj'MyAspect)Abstract.nothing + // Hid:24:(targets=1) =PR278496_8<test2*MyAspect2.aj'MyAspect2`declare parents (declared on) =PR278496_8<test*Demo.aj[Demo + // Hid:25:(targets=3) =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect)DeleteAction.delete (declared on) + // =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect~main~\[QString;[ + // Hid:26:(targets=3) =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect)DeleteAction.delete (declared on) + // =PR278496_8<generics{ActionExecutor.java[ActionExecutor~main~\[QString;[ + // Hid:27:(targets=3) =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect)DeleteAction.delete (declared on) + // =PR278496_8<generics{DeleteAction.java[DeleteAction + // Hid:28:(targets=1) =PR278496_8<test*MyAspect.aj'MyAspect`declare \@field (annotates) + // =PR278496_8<test*MyAspect.aj'MyAspect,Demo.x + // Hid:29:(targets=3) =PR278496_8<generics{ActionExecutor.java[ActionExecutor~main~\[QString;[ (aspect declarations) + // =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect)DeleteAction.delete + // Hid:30:(targets=3) =PR278496_8<generics{ActionExecutor.java[ActionExecutor~main~\[QString;[ (aspect declarations) + // =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect,DeleteAction.delete2 + // Hid:31:(targets=3) =PR278496_8<generics{ActionExecutor.java[ActionExecutor~main~\[QString;[ (aspect declarations) + // =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect,DeleteAction.delete3 + // Hid:32:(targets=3) =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect~main~\[QString;[ (aspect declarations) + // =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect)DeleteAction.delete + // Hid:33:(targets=3) =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect~main~\[QString;[ (aspect declarations) + // =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect,DeleteAction.delete2 + // Hid:34:(targets=3) =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect~main~\[QString;[ (aspect declarations) + // =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect,DeleteAction.delete3 + // Hid:35:(targets=3) =PR278496_8<generics{DeleteAction.java[DeleteAction (aspect declarations) + // =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect)DeleteAction.delete + // Hid:36:(targets=3) =PR278496_8<generics{DeleteAction.java[DeleteAction (aspect declarations) + // =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect,DeleteAction.delete2 + // Hid:37:(targets=3) =PR278496_8<generics{DeleteAction.java[DeleteAction (aspect declarations) + // =PR278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect,DeleteAction.delete3 + // Hid:38:(targets=1) =PR278496_8<test2*MyAspect2.aj'MyAspect2[Foo (aspect declarations) + // =PR278496_8<test2*MyAspect2.aj'MyAspect2)Foo.baz + // Hid:39:(targets=1) =PR278496_8<test*MyAspect.aj'MyAspect)Demo.Demo_new)I (annotated by) + // =PR278496_8<test*MyAspect.aj'MyAspect`declare \@constructor + // Hid:40:(targets=1) =PR278496_8<test*MyAspect.aj'MyAspect)Demo.Demo_new)I (declared on) =PR278496_8<test*Demo.aj[Demo + // Hid:41:(targets=1) =PR278496_8<test*MyAspect.aj'MyAspect,Demo.x (annotated by) + // =PR278496_8<test*MyAspect.aj'MyAspect`declare \@field + // Hid:42:(targets=1) =PR278496_8<test*MyAspect.aj'MyAspect,Demo.x (declared on) =PR278496_8<test*Demo.aj[Demo + // Hid:43:(targets=2) =PR278496_8<test2*MyAspect2.aj'MyAspect2)Bar.bar (declared on) + // =PR278496_8<test2*MyAspect2.aj'MyAspect2[Bar + // Hid:44:(targets=2) =PR278496_8<test2*MyAspect2.aj'MyAspect2)Bar.bar (declared on) =PR278496_8<test*Demo.aj[Demo + // Hid:45:(targets=1) =PR278496_8<test2*MyAspect2.aj'MyAspect2[Bar (aspect declarations) + // =PR278496_8<test2*MyAspect2.aj'MyAspect2)Bar.bar + // Hid:46:(targets=1) =PR278496_8<test2*MyAspect2.aj'MyAspect2)Foo.baz (declared on) + // =PR278496_8<test2*MyAspect2.aj'MyAspect2[Foo + AspectJElementHierarchy model = (AspectJElementHierarchy) getModelFor(p).getHierarchy(); + // check handle to anonymous inner: + IProgramElement ipe = model.findElementForHandleOrCreate( + "=pr278496_8<generics*DeleteActionAspect.aj'DeleteActionAspect~main~\\[QString;[", false); + assertNotNull(ipe); + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/IncrementalOutputLocationManagerTests.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/IncrementalOutputLocationManagerTests.java new file mode 100644 index 000000000..3f2afc409 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/IncrementalOutputLocationManagerTests.java @@ -0,0 +1,106 @@ +/******************************************************************** + * Copyright (c) 2006 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://eclipse.org/legal/epl-v10.html + * + * Contributors: IBM Corporation - initial API and implementation + * Helen Hawkins - initial version + *******************************************************************/ +package org.aspectj.systemtest.incremental.tools; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.aspectj.ajde.core.IOutputLocationManager; + +/** + * OutputLocationManger tests which check whether the correct type of build has happened. + */ +public class IncrementalOutputLocationManagerTests extends AbstractMultiProjectIncrementalAjdeInteractionTestbed { + + public void testPr166580() { + initialiseProject("PR166580"); + configureOutputLocationManager("PR166580", new MyOutputLocationManager("PR166580", 2)); + build("PR166580"); + checkWasFullBuild(); + alter("PR166580", "inc1"); + build("PR166580"); + checkWasntFullBuild(); + } + + /** + * Will send output from src dir 'srcX' to directory 'binX' + */ + private class MyOutputLocationManager implements IOutputLocationManager { + + private String projectDir; + private int numberOfSrcDirs; + private List<File> allOutputDirs; + + public MyOutputLocationManager(String projectName, int numberOfSrcDirs) { + projectDir = getWorkingDir() + File.separator + projectName; + this.numberOfSrcDirs = numberOfSrcDirs; + } + + public void reportFileWrite(String outputfile, int filetype) { + } + + public void reportFileRemove(String outputfile, int filetype) { + } + + public Map<File,String> getInpathMap() { + return Collections.emptyMap(); + } + + public File getOutputLocationForClass(File compilationUnit) { + String path = compilationUnit.getAbsolutePath(); + int index = path.indexOf("src"); + String number = path.substring(index + 3, index + 4); + File ret = new File(projectDir + File.separator + "bin" + number); + if (!ret.exists()) { + ret.mkdirs(); + } + return ret; + } + + public File getOutputLocationForResource(File resource) { + return getOutputLocationForClass(resource); + } + + public List<File> getAllOutputLocations() { + if (allOutputDirs == null) { + allOutputDirs = new ArrayList<>(); + for (int i = 0; i < numberOfSrcDirs + 1; i++) { + File f = null; + if (i == 0) { + f = new File(projectDir + File.separator + "bin"); + } else { + f = new File(projectDir + File.separator + "bin" + i); + } + allOutputDirs.add(f); + } + } + return allOutputDirs; + } + + public File getDefaultOutputLocation() { + return new File(projectDir + File.separator + "bin"); + } + + public String getSourceFolderForFile(File sourceFile) { + return null; + } + + public int discoverChangesSince(File dir, long buildtime) { + // TODO Auto-generated method stub + return 0; + } + + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/IncrementalPerformanceTests.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/IncrementalPerformanceTests.java new file mode 100644 index 000000000..428c037d8 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/IncrementalPerformanceTests.java @@ -0,0 +1,174 @@ +/******************************************************************** + * Copyright (c) 2008 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement initial implementation + *******************************************************************/ +package org.aspectj.systemtest.incremental.tools; + +import java.io.IOException; + +import org.aspectj.ajde.core.ICompilerConfiguration; + +/** + * Testing the performance of incremental compilation as it would be in AJDT. + * + * @author AndyClement + */ +public class IncrementalPerformanceTests extends AbstractMultiProjectIncrementalAjdeInteractionTestbed { + + /** + * Build a project of 64 source files and no aspects.<br> + * <ul> + * <li>First build is a full build. + * <li>Second build is an incremental build with no changes at all. + * <li>Third build is an incremental build with just a source file touched (not changed). + * </ul> + * + * <p> + * 162-dev, 28Aug08 times: Thinkpad T61p: 3203/3140/3234/3156 173/172/172/172 313/297/297/312 + */ + public void testBuildingProject64Files() { + String proj = "Proj64"; + + // A full build: + initialiseProject(proj); + build(proj); + checkWasFullBuild(); + long fullbuildtime = getTimeTakenForBuild(proj); + System.out.println("Full build time: " + fullbuildtime + "ms"); + + // An incremental build with no source file changes at all. What should happen? + // We need to determine that nothing has to be done as fast as possible, this is all about + // determining from the configuration that nothing has changed and returning as fast as possible. Any + // delays here are unnecessary burden that will hurt every other kind of compilation. + build(proj); + checkWasntFullBuild(); + checkCompileWeaveCount(proj, 0, 0); + long nochangebuild = getTimeTakenForBuild(proj); + System.out.println("Incr build time for no changes at all: " + nochangebuild + "ms"); + + // An incremental build with no source file changes at all *and* we tell the compiler there are + // no source changes (so it doesn't need to check timestamps). super fast + addProjectSourceFileChanged(proj, null); + build(proj); + checkWasntFullBuild(); + checkCompileWeaveCount(proj, 0, 0); + long nochangebuildandDoTellCompiler = getTimeTakenForBuild(proj); + System.out.println("Incr build time for no changes at all and telling the compiler that: " + nochangebuildandDoTellCompiler + + "ms"); + + // Now we touch a file (C0.java) and call build. What should happen? + // We need to determine what has changed, we'll do that by walking over the set of input files and + // checking their last modified stamps. So although we won't rebuild a buildConfig object, we will + // call lastModifiedTime() a lot to determine which file has changed. + alter(proj, "inc1"); + build(proj); + checkWasntFullBuild(); + checkCompileWeaveCount(proj, 1, 1); + long whitespacechangeDontTellCompiler = getTimeTakenForBuild(proj); + System.out.println("Incr build time for whitespace change: " + whitespacechangeDontTellCompiler + "ms"); + + // Similar to previous test, touch that file, but this time tell the compiler which file has changed. What should happen? + // As we are telling the compiler what has changed, it will not jump through hoops checking the last mod time of + // every source file in the project configuration. + alter(proj, "inc1"); + addProjectSourceFileChanged(proj, getProjectRelativePath(proj, "src/out/C0.java")); + build(proj); + checkWasntFullBuild(); + checkCompileWeaveCount(proj, 1, 1); + long whitespacechangeDoTellCompiler = getTimeTakenForBuild(proj); + System.out.println("Incr build time for whitespace change (where we tell the compiler what changed): " + + whitespacechangeDoTellCompiler + "ms"); + + // Lets assert what really ought to be true + assertTrue(nochangebuild < fullbuildtime); + assertTrue(whitespacechangeDontTellCompiler < fullbuildtime); + assertTrue(whitespacechangeDoTellCompiler < fullbuildtime); + + assertTrue(nochangebuild < whitespacechangeDontTellCompiler); + // assertTrue(nochangebuild < whitespacechangeDoTellCompiler); + + // assertTrue(whitespacechangeDoTellCompiler < whitespacechangeDontTellCompiler); + } + + /** + * Project dependencies are captured by using classpath. The dependee project has the bin folder for the project upon which it + * depends on its classpath. This can make it expensive when determining whether to build the dependee project as we may need to + * analyse all the classpath entries, we don't know which are project related. However, a new API in ICompilerConfiguration + * called getClasspathElementsWithModifiedContents() can be returned by an implementor to tell us which parts of the classpath + * to check. + */ + public void testBuildingTwoProjects() { + AjdeInteractionTestbed.VERBOSE = true; + + String projA = "Proj64"; + String projB = "Dependee"; + + // A full build: + initialiseProject(projA); + initialiseProject(projB); + configureNewProjectDependency(projB, projA); + build(projA); + checkWasFullBuild(); + build(projB); + checkWasFullBuild(); + + alter(projA, "C43changeOne"); // C43 made package private + build(projA); + setNextChangeResponse(projB, ICompilerConfiguration.EVERYTHING); + build(projB); + long timeTakenWhenFullyAnalysingClasspath = getTimeTakenForBuild(projB); + checkWasntFullBuild(); + + alter(projA, "C43changeOne"); // C43 made package private + build(projA); + addClasspathEntryChanged(projB, getProjectRelativePath(projA, "bin").getPath()); + // waitForReturn(); + build(projB); + long timeTakenWhenFullyToldSpecifically = getTimeTakenForBuild(projB); + // waitFor10(); + checkWasntFullBuild(); + + System.out.println("Without: " + timeTakenWhenFullyAnalysingClasspath + "ms With: " + timeTakenWhenFullyToldSpecifically + + "ms"); + + } + + // --- helper code --- + + @SuppressWarnings("unused") + private void waitFor10() { + try { + Thread.sleep(10000); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @SuppressWarnings("unused") + private void waitForReturn() { + try { + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + testdataSrcDir = "../tests/incrementalPerformance"; + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + testdataSrcDir = "../tests/multiIncremental"; + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MoreOutputLocationManagerTests.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MoreOutputLocationManagerTests.java new file mode 100644 index 000000000..c35b88610 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MoreOutputLocationManagerTests.java @@ -0,0 +1,382 @@ +/******************************************************************** + * Copyright (c) 2006 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://eclipse.org/legal/epl-v10.html + * + * Contributors: IBM Corporation - initial API and implementation + * Helen Hawkins - initial version + *******************************************************************/ +package org.aspectj.systemtest.incremental.tools; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.aspectj.ajde.core.IOutputLocationManager; +import org.aspectj.ajdt.internal.core.builder.AjBuildConfig; +import org.aspectj.ajdt.internal.core.builder.AjState; +import org.aspectj.ajdt.internal.core.builder.IncrementalStateManager; +import org.aspectj.util.FileUtil; +import org.aspectj.weaver.bcel.UnwovenClassFile; + +/** + * Similar to OutputLocationManagerTests, however, tests the different scenarios when no outputDir is set but instead there is an + * OutputLocationManager which returns the same output location for all files and resources. + * + * There are eight places where AjBuildConfig.getOutputDir() is called that are tested here: + * + * AjBuildManager.getOutputClassFileName(..) - testCorrectInfoWhenNoOutputPath AjBuildManager.initBcelWorld(..) - + * testPathResolutionWithInpathDirAndNoOutputPath testPathResolutionWithInpathJarAndNoOutputPath AjBuildManager.writeManifest(..) - + * testCopyManifest AjBuildManager.writeOutxml(..) - testOutxml - testOutXmlForAspectsWithDifferentOutputDirs + * AjState.createUnwovenClassFile(..) - testPathResolutionAfterChangeInClassOnInpath AjState.deleteResources(..) - + * testAjStateDeleteResources AjState.maybeDeleteResources(..) - testAjStateDeleteResourcesInInputDir + * AjState.removeAllResultsOfLastBuild(..) - testAllResourcesAreDeletedCorrectlyOnPathChange + * IncrementalStateManager.findStateManagingOutputLocation(..) - testFindStateManagingOutputLocation + * + * The other three places are not tested here because they were implemented when OutputLocationManager was introduced. + * + */ +public class MoreOutputLocationManagerTests extends AbstractMultiProjectIncrementalAjdeInteractionTestbed { + + private String inpathTestingDir; + private String expectedOutputDir; + + @Override + protected void setUp() throws Exception { + super.setUp(); + initialiseProject("inpathTesting"); + inpathTestingDir = getWorkingDir() + File.separator + "inpathTesting"; + expectedOutputDir = inpathTestingDir + File.separator + "bin"; + configureOutputLocationManager("inpathTesting", new SingleDirOutputLocMgr(inpathTestingDir)); + } + + /** + * Tests that the UnwovenClassFiles have the correct path when there is no outputDir but there is an OutputLocationManager. Is a + * simple project that has no inpath setting + */ + public void testCorrectInfoWhenNoOutputPath() { + build("inpathTesting"); + AjState state = getState(); + + Map<String,File> classNameToFileMap = state.getClassNameToFileMap(); + assertFalse("expected there to be classes ", classNameToFileMap.isEmpty()); + Set<Map.Entry<String,File>> entrySet = classNameToFileMap.entrySet(); + for (Iterator<Map.Entry<String,File>> iterator = entrySet.iterator(); iterator.hasNext();) { + Map.Entry<String,File> entry = iterator.next(); + String className = entry.getKey(); + String fullClassName = expectedOutputDir + File.separator + className.replace('.', File.separatorChar) + ".class"; + File file = entry.getValue(); + assertEquals("expected file to have path \n" + fullClassName + ", but" + " found path \n" + file.getAbsolutePath(), + fullClassName, file.getAbsolutePath()); + } + } + + /** + * Tests that can retieve the state that manages a given output location when there is no outputDir set + */ + public void testFindStateManagingOutputLocation() { + build("inpathTesting"); + AjState state = IncrementalStateManager.findStateManagingOutputLocation(new File(expectedOutputDir)); + assertNotNull("Expected to find a state that managed output location " + expectedOutputDir + ", but did not", state); + + } + + /** + * Tests that the UnwovenClassFiles corresponding to classes on the inpath have the correct class name when there is no output + * directory (ultimately tests AjBuildManager.initBcelWorld() when there is a jar on the inpath). Only does one build. + */ + public void testPathResolutionWithInpathDirAndNoOutputPath() { + String inpathDir = inpathTestingDir + File.separator + "injarBin" + File.separator + "pkg"; + addInpathEntry(inpathDir); + build("inpathTesting"); + + // expect to compile the aspect in 'inpathTesting' project and weave + // both the aspect and the class on the inpath. + checkCompileWeaveCount("inpathTesting", 1, 2); + + // get hold of the state for this project - expect to find one + AjState state = getState(); + + // the classes onthe inpath are recorded against the AjBuildManager + // (they are deleted from the ajstate whilst cleaning up after a build) + Map<String,List<UnwovenClassFile>> binarySources = state.getAjBuildManager().getBinarySourcesForThisWeave(); + assertFalse("expected there to be binary sources from the inpath setting but didn't find any", binarySources.isEmpty()); + + List<UnwovenClassFile> unwovenClassFiles = binarySources.get(inpathDir + File.separator + "InpathClass.class"); + List<String> fileNames = new ArrayList<>(); + // the unwovenClassFiles should have filenames that point to the output dir + // (which in this case is the sandbox dir) and not where they came from. + for (UnwovenClassFile ucf: unwovenClassFiles) { + if (ucf.getFilename().indexOf(expectedOutputDir) == -1) { + fileNames.add(ucf.getFilename()); + } + } + assertTrue("expected to find UnwovenClassFile from directory\n" + expectedOutputDir + ", \n but found files " + fileNames, + fileNames.isEmpty()); + } + + /** + * Tests that the UnwovenClassFiles corresponding to classes on the inpath have the correct class name when there is no output + * directory (ultimately tests AjState.createUnwovenClassFile(BinarySourceFile) and ensures the unwovenClassFile has the correct + * name. Makes a change to a class file on the inpath to ensure we enter this method (there is a check that says are we the + * first build)) + */ + public void testPathResolutionAfterChangeInClassOnInpath() throws Exception { + String inpathDir = inpathTestingDir + File.separator + "injarBin" + File.separator + "pkg"; + addInpathEntry(inpathDir); + build("inpathTesting"); + + // build again so that we enter + // AjState.createUnwovenClassFile(BinarySourceFile) + File from = new File(testdataSrcDir + File.separatorChar + "inpathTesting" + File.separatorChar + "newInpathClass" + + File.separatorChar + "InpathClass.class"); + File destination = new File(inpathDir + File.separatorChar + "InpathClass.class"); + FileUtil.copyFile(from, destination); + + // get hold of the state for this project - expect to find one + AjState state = getState(); + AjBuildConfig buildConfig = state.getBuildConfig(); + state.prepareForNextBuild(buildConfig); + + Map<String, List<UnwovenClassFile>> binarySources = state.getBinaryFilesToCompile(true); + assertFalse("expected there to be binary sources from the inpath setting but didn't find any", binarySources.isEmpty()); + + List<UnwovenClassFile> unwovenClassFiles = binarySources.get(inpathDir + File.separator + "InpathClass.class"); + List<String> fileNames = new ArrayList<>(); + // the unwovenClassFiles should have filenames that point to the output dir + // (which in this case is the sandbox dir) and not where they came from. + for (UnwovenClassFile ucf: unwovenClassFiles) { + if (ucf.getFilename().indexOf(expectedOutputDir) == -1) { + fileNames.add(ucf.getFilename()); + } + } + assertTrue("expected to find UnwovenClassFile from directory\n" + expectedOutputDir + ", \n but found files " + fileNames, + fileNames.isEmpty()); + } + + /** + * Tests that the UnwovenClassFiles corresponding to jars on the inpath have the correct class name when there is no output path + * (ultimately tests AjBuildManager.initBcelWorld() when there is a jar on the inpath). Only does one build. + */ + public void testPathResolutionWithInpathJarAndNoOutputPath() { + String inpathDir = inpathTestingDir + File.separator + "inpathJar.jar"; + addInpathEntry(inpathDir); + build("inpathTesting"); + // expect to compile the aspect in 'inpathTesting' project and weave + // both the aspect and the class in the jar on the inpath. + checkCompileWeaveCount("inpathTesting", 1, 2); + + AjState state = getState(); + + // tests AjState.createUnwovenClassFile(BinarySourceFile) + Map<String,List<UnwovenClassFile>> binarySources = state.getAjBuildManager().getBinarySourcesForThisWeave(); + assertFalse("expected there to be binary sources from the inpath setting but didn't find any", binarySources.isEmpty()); + + List<UnwovenClassFile> unwovenClassFiles = binarySources.get(inpathDir); + List<String> fileNames = new ArrayList<>(); + + for (UnwovenClassFile ucf: unwovenClassFiles) { + if (ucf.getFilename().indexOf(expectedOutputDir) == -1) { + fileNames.add(ucf.getFilename()); + } + } + assertTrue("expected to find UnwovenClassFile from directory\n" + expectedOutputDir + ", \n but found files " + fileNames, + fileNames.isEmpty()); + + } + + /** + * A manifest file is in the jar on the inpath - check that it's copied to the correct place + */ + public void testCopyManifest() { + String inpathDir = inpathTestingDir + File.separator + "inpathJar.jar"; + addInpathEntry(inpathDir); + + build("inpathTesting"); + String resource = expectedOutputDir + File.separator + "META-INF" + File.separator + "MANIFEST.MF"; + File f = new File(resource); + assertTrue("expected file " + resource + " to exist but it did not", f.exists()); + } + + /** + * "resources" are contained within inpath jars - check that a text file contained within a jar is copied and then deleted + * correctly. Essentially tests AjState.deleteResources(). + */ + // see 243376: for now don't do this, waste of cpu - ajdt better for handling resources - but is that true for inpath resources? + // public void testAjStateDeleteResources() { + // String inpathDir = inpathTestingDir + File.separator + "inpathJar.jar"; + // addInpathEntry(inpathDir); + // + // build("inpathTesting"); + // + // AjState state = getState(); + // + // String resource = expectedOutputDir + File.separator + "inpathResource.txt"; + // File f = new File(resource); + // assertTrue("expected file " + resource + " to exist but it did not",f.exists()); + // // this call should delete the resources + // state.getFilesToCompile(true); + // assertFalse("did not expect the file " + resource + " to exist but it does",f.exists()); + // } + /** + * Can set to copy resources that are in inpath dirs - check that a text file contained within such a dir is copied and then + * deleted correctly. Essentially tests AjState.maybeDeleteResources(). + */ + // see 243376: for now don't do this, waste of cpu - ajdt better for handling resources - but is that true for inpath resources? + // public void testAjStateDeleteResourcesInInputDir() { + // // temporary problem with this on linux, think it is a filesystem lastmodtime issue + // if (System.getProperty("os.name","").toLowerCase().equals("linux")) return; + // if (System.getProperty("os.name","").toLowerCase().indexOf("mac")!=-1) return; + // + // AjBuildManager.COPY_INPATH_DIR_RESOURCES = true; + // try { + // String inpathDir = inpathTestingDir + File.separator + "injarBin" + // + File.separator + "pkg"; + // addInpathEntry(inpathDir); + // build("inpathTesting"); + // AjState state = getState(); + // String resource = "inDirResource.txt"; + // assertTrue("expected state to have resource " + resource + "but it did not", + // state.hasResource(resource)); + // // this call should delete the resources - tests AjState.deleteResources() + // state.getFilesToCompile(true); + // assertFalse("did not expect state to have resource " + resource + + // " but found that it did", state.hasResource(resource)); + // } finally { + // AjBuildManager.COPY_INPATH_DIR_RESOURCES = false; + // } + // + // } + /** + * Changing inpath entry from a jar to a directory between builds means that AjState should realise somethings changed. This + * causes all resources (Manifest and txt files) to be deleted. Also should be a full build. Essentially tests + * AjState.removeAllResultsFromLastBuild(). + */ + public void testAllResourcesAreDeletedCorrectlyOnPathChange() { + String inpathJar = inpathTestingDir + File.separator + "inpathJar.jar"; + + addInpathEntry(inpathJar); + build("inpathTesting"); + + String resource = expectedOutputDir + File.separator + "inpathResource.txt"; + File f = new File(resource); + assertTrue("expected file " + resource + " to exist but it did not", f.exists()); + + // this should force a change and the file is deleted + // tests AjState.removeAllResultsFromLastBuild() + addInpathEntry(null); + build("inpathTesting"); + assertFalse("did not expect the file " + resource + " to exist but it does", f.exists()); + + checkWasFullBuild(); + } + + public void testOutxml() { + configureNonStandardCompileOptions("inpathTesting", "-outxml"); + build("inpathTesting"); + String resource = expectedOutputDir + File.separator + "META-INF" + File.separator + "aop-ajc.xml"; + File f = new File(resource); + assertTrue("expected file " + resource + " to exist but it did not", f.exists()); + } + + public void testAspectsRecordedOnlyOnceInState() { + configureNonStandardCompileOptions("inpathTesting", "-outxml"); + build("inpathTesting"); + AjState state = getState(); + Map<String,char[]> m = state.getAspectNamesToFileNameMap(); + assertEquals("Expected only one aspect recored in the state but found " + m.size(), 1, m.size()); + build("inpathTesting"); + m = state.getAspectNamesToFileNameMap(); + assertEquals("Expected only one aspect recored in the state but found " + m.size(), 1, m.size()); + } + + private AjState getState() { + // get hold of the state for this project - expect to find one + AjState state = IncrementalStateManager.retrieveStateFor(inpathTestingDir); + assertNotNull("expected to find AjState for build config " + inpathTestingDir + " but didn't", state); + return state; + } + + private void addInpathEntry(String entry) { + if (entry == null) { + configureInPath("inpathTesting", (Set)null); + return; + } + File f = new File(entry); + Set<File> s = new HashSet<>(); + s.add(f); + configureInPath("inpathTesting", s); + } + + /** + * Sends all output to the same directory + */ + private static class SingleDirOutputLocMgr implements IOutputLocationManager { + + private File classOutputLoc; + private File resourceOutputLoc; + private String testProjectOutputPath; + private List<File> allOutputLocations; + private File outputLoc; + + public SingleDirOutputLocMgr(String testProjectPath) { + this.testProjectOutputPath = testProjectPath + File.separator + "bin"; + outputLoc = new File(testProjectOutputPath); + + allOutputLocations = new ArrayList<>(); + allOutputLocations.add(outputLoc); + } + + @Override + public File getOutputLocationForClass(File compilationUnit) { + return outputLoc; + } + + @Override + public Map<File,String> getInpathMap() { + return Collections.emptyMap(); + } + + + @Override + public File getOutputLocationForResource(File resource) { + return outputLoc; + } + + @Override + public List<File> getAllOutputLocations() { + return allOutputLocations; + } + + @Override + public File getDefaultOutputLocation() { + return outputLoc; + } + + @Override + public void reportFileWrite(String outputfile, int filetype) { + } + + @Override + public void reportFileRemove(String outputfile, int filetype) { + } + + @Override + public String getSourceFolderForFile(File sourceFile) { + return null; // no impl + } + + @Override + public int discoverChangesSince(File dir, long buildtime) { + return 0; // no impl + } + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestBuildProgressMonitor.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestBuildProgressMonitor.java new file mode 100644 index 000000000..6218ce3e4 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestBuildProgressMonitor.java @@ -0,0 +1,91 @@ +/******************************************************************** + * Copyright (c) 2007 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://eclipse.org/legal/epl-v10.html + * + * Contributors: IBM Corporation - initial API and implementation + * Helen Hawkins - initial version (bug 148190) + *******************************************************************/ +package org.aspectj.systemtest.incremental.tools; + +import java.util.ArrayList; +import java.util.List; + +import org.aspectj.ajde.core.IBuildProgressMonitor; + +/** + * IBuildProgressMonitor that records how many files were compiled and woven as well as whether or not the build was a full build. + * Will print progress information to the screen if VERBOSE is true. + */ +public class MultiProjTestBuildProgressMonitor implements IBuildProgressMonitor { + + public boolean VERBOSE = false; + + private List<String> compiledFiles = new ArrayList<String>(); + private List<String> wovenClasses = new ArrayList<String>(); + + private long starttime = 0; + private long totaltimetaken = 0; + private boolean wasFullBuild = true; + + public void finish(boolean wasFullBuild) { + log("IBuildProgressMonitor.finish(" + wasFullBuild + ")"); + this.wasFullBuild = wasFullBuild; + totaltimetaken = (System.currentTimeMillis() - starttime); + } + + public boolean isCancelRequested() { + log("IBuildProgressMonitor.isCancelRequested()"); + return false; + } + + public void setProgress(double percentDone) { + log("IBuildProgressMonitor.setProgress(" + percentDone + ")"); + } + + public void setProgressText(String text) { + log("BuildProgressMonitor.setProgressText(" + text + ")"); + if (text.startsWith("compiled: ")) { + compiledFiles.add(text.substring(10)); + } else if (text.startsWith("woven class ")) { + wovenClasses.add(text.substring(12)); + } else if (text.startsWith("woven aspect ")) { + wovenClasses.add(text.substring(13)); + } + } + + public void begin() { + starttime = System.currentTimeMillis(); + log("IBuildProgressMonitor.start()"); + } + + public List<String> getCompiledFiles() { + return compiledFiles; + } + + public List<String> getWovenClasses() { + return wovenClasses; + } + + public void log(String s) { + if (VERBOSE) { + System.out.println(s); + } + } + + public long getTimeTaken() { + return totaltimetaken; + } + + public boolean wasFullBuild() { + return wasFullBuild; + } + + public void reset() { + wasFullBuild = true; + compiledFiles.clear(); + wovenClasses.clear(); + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java new file mode 100644 index 000000000..cd80218b2 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java @@ -0,0 +1,275 @@ +/******************************************************************** + * Copyright (c) 2007 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://eclipse.org/legal/epl-v10.html + * + * Contributors: IBM Corporation - initial API and implementation + * Helen Hawkins - initial version (bug 148190) + *******************************************************************/ +package org.aspectj.systemtest.incremental.tools; + +import java.io.File; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.aspectj.ajde.core.ICompilerConfiguration; +import org.aspectj.ajde.core.IOutputLocationManager; +import org.aspectj.util.LangUtil; + +/** + * ICompilerConfiguration which mirrors the way AJDT behaves. Always returns that its 1.5 compliant and enables the setting of all + * options except output jar. + */ +public class MultiProjTestCompilerConfiguration implements ICompilerConfiguration { + + private boolean verbose = false; + + private String classPath = ""; + private Set<File> aspectPath = null; + private Map<String,File> sourcePathResources = null; + private IOutputLocationManager outputLocationManager = null; + private List<String> dependants; + private Map<String,String> javaOptionsMap; + private Set<File> inpath; + private String encoding = null; + private String outjar; + private String processor; + private String processorPath; + private String nonstandardoptions; + private List<File> modifiedFiles; + private List<String> modifiedDirs; + private List<String> projectSourceFiles = new ArrayList<>(); + private List<String> xmlConfigFiles = new ArrayList<>(); + private String projectPath; + + int changed; + + public MultiProjTestCompilerConfiguration(String projectPath) { + this.projectPath = projectPath; + } + + public Set<File> getAspectPath() { + log("ICompilerConfiguration.getAspectPath(" + aspectPath + ")"); + return aspectPath; + } + + public String getClasspath() { + log("ICompilerConfiguration.getClasspath()"); + // AJDT has all the output directories on it's classpath + StringBuffer sb = new StringBuffer(); + List<File> allOutputPaths = getOutputLocationManager().getAllOutputLocations(); + for (File dir: allOutputPaths) { + sb.append(File.pathSeparator + dir.getAbsolutePath()); + } + String cp = sb.toString() + File.pathSeparator + new File(AjdeInteractionTestbed.testdataSrcDir) + File.pathSeparator + + System.getProperty("sun.boot.class.path") + File.pathSeparator + "../runtime/bin" + File.pathSeparator + + this.classPath + File.pathSeparator + System.getProperty("aspectjrt.path") + File.pathSeparator + + "../lib/junit/junit.jar" + "c:/batik/batik-1.6/lib/batik-util.jar;" + + "c:/batik/batik-1.6/lib/batik-awt-util.jar;" + "c:/batik/batik-1.6/lib/batik-dom.jar;" + + "c:/batik/batik-1.6/lib/batik-svggen.jar;" + File.pathSeparator + ".." + File.separator + "lib" + File.separator + + "test" + File.separator + "aspectjrt.jar"; + if (LangUtil.is19VMOrGreater()) { + cp = LangUtil.getJrtFsFilePath() + File.pathSeparator + cp; + } + + // look at dependant projects + if (dependants != null) { + for (String dependant: dependants) { + cp = AjdeInteractionTestbed.getFile(dependant, "bin") + File.pathSeparator + cp; + } + } + // System.err.println("For project "+projectPath+" getClasspath() returning "+cp); + return cp; + } + + public Set<File> getInpath() { + log("ICompilerConfiguration.getInPath()"); + return inpath; + } + + public Map<String, String> getJavaOptionsMap() { + log("ICompilerConfiguration.getJavaOptionsMap()"); + if (javaOptionsMap != null && !javaOptionsMap.isEmpty()) + return javaOptionsMap; + + Hashtable<String, String> ht = new Hashtable<String, String>(); + ht.put("org.eclipse.jdt.core.compiler.compliance", "1.5"); + ht.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.5"); + ht.put("org.eclipse.jdt.core.compiler.source", "1.5"); + return ht; + } + + public String getNonStandardOptions() { + log("ICompilerConfiguration.getNonStandardOptions( " + nonstandardoptions + ")"); + return nonstandardoptions; + } + + public String getOutJar() { + log("ICompilerConfiguration.getOutJar()"); + return null; + } + + public IOutputLocationManager getOutputLocationManager() { + log("ICompilerConfiguration.getOutputLocationManager()"); + if (outputLocationManager == null) { + outputLocationManager = new MultiProjTestOutputLocationManager(projectPath); + } + return outputLocationManager; + } + + public List<String> getProjectSourceFiles() { + log("ICompilerConfiguration.getProjectSourceFiles()"); + return projectSourceFiles; + } + + public List<String> getProjectXmlConfigFiles() { + return xmlConfigFiles; + } + + public List<File> getProjectSourceFilesChanged() { + log("ICompilerConfiguration.getProjectSourceFilesChanged()"); + return modifiedFiles; + } + + public Map<String,File> getSourcePathResources() { + log("ICompilerConfiguration.getSourcePathResources()"); + return sourcePathResources; + } + + public void log(String s) { + if (verbose) + System.out.println(s); + } + + public void addDependancy(String projectItDependsOn) { + if (dependants == null) { + dependants = new ArrayList<String>(); + } + dependants.add(projectItDependsOn); + } + + // -------------------- setter methods useful for testing --------------- + public void setAspectPath(Set<File> aspectPath) { + this.aspectPath = aspectPath; + this.changed |= ICompilerConfiguration.ASPECTPATH_CHANGED; + } + + public void setInpath(Set<File> inpath) { + this.inpath = inpath; + this.changed |= ICompilerConfiguration.INPATH_CHANGED; + } + + public void setOutjar(String outjar) { + this.outjar = outjar; + this.changed |= ICompilerConfiguration.OUTJAR_CHANGED; + } + + public void setProcessor(String processor) { + this.processor = processor; + this.changed |= ICompilerConfiguration.PROCESSOR_CHANGED; + } + + public void setProcessorPath(String processorPath) { + this.processorPath = processorPath; + this.changed |= ICompilerConfiguration.PROCESSOR_CHANGED; + } + + public void setJavaOptions(Map<String,String> javaOptions) { + this.javaOptionsMap = javaOptions; + this.changed |= ICompilerConfiguration.JAVAOPTIONS_CHANGED; + } + + public void setNonStandardOptions(String options) { + this.nonstandardoptions = options; + this.changed |= ICompilerConfiguration.NONSTANDARDOPTIONS_CHANGED; + } + + public void setProjectSourceFiles(List<String> projectSourceFiles) { + this.projectSourceFiles = projectSourceFiles; + this.changed |= ICompilerConfiguration.PROJECTSOURCEFILES_CHANGED; + } + + public void setProjectXmlConfigFiles(List<String> xmlConfigFiles) { + this.xmlConfigFiles = xmlConfigFiles; + this.changed |= ICompilerConfiguration.XMLCONFIG_CHANGED; + } + + public void addProjectSourceFileChanged(File f) { + if (this.modifiedFiles == null) { + this.modifiedFiles = new ArrayList<File>(); + } + if (f != null) { + modifiedFiles.add(f); + } + } + + public void addClasspathEntryChanged(String f) { + if (this.modifiedDirs == null) { + this.modifiedDirs = new ArrayList<String>(); + } + if (f != null) { + modifiedDirs.add(f); + } + } + + public void setSourcePathResources(Map<String,File> sourcePathResources) { + this.sourcePathResources = sourcePathResources; + this.changed |= ICompilerConfiguration.PROJECTSOURCERESOURCES_CHANGED; + } + + public void setOutputLocationManager(IOutputLocationManager manager) { + this.outputLocationManager = manager; + } + + public void setClasspath(String path) { + this.classPath = path; + this.changed |= ICompilerConfiguration.CLASSPATH_CHANGED; + } + + public int getConfigurationChanges() { + return changed; + // return EVERYTHING; + } + + public void configurationRead() { + changed = NO_CHANGES; + modifiedFiles = null; + modifiedDirs = null; + } + + public List<String> getClasspathElementsWithModifiedContents() { + return modifiedDirs; + } + + public void setProjectEncoding(String encoding) { + this.encoding = encoding; + } + + public String getProjectEncoding() { + return this.encoding; + } + + public String getProcessor() { + return this.processor; + } + + public String getProcessorPath() { + return this.processorPath; + } + + @Override + public String getModulepath() { + return null; + } + + @Override + public String getModuleSourcepath() { + return null; + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestMessageHandler.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestMessageHandler.java new file mode 100644 index 000000000..fa66bede7 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestMessageHandler.java @@ -0,0 +1,133 @@ +/******************************************************************** + * Copyright (c) 2007 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://eclipse.org/legal/epl-v10.html + * + * Contributors: IBM Corporation - initial API and implementation + * Helen Hawkins - initial version (bug 148190) + *******************************************************************/ +package org.aspectj.systemtest.incremental.tools; + +import java.util.ArrayList; +import java.util.List; + +import org.aspectj.ajde.core.IBuildMessageHandler; +import org.aspectj.bridge.AbortException; +import org.aspectj.bridge.IMessage; +import org.aspectj.bridge.IMessage.Kind; + +/** + * IMessageHandler which by default ignores INFO and WEAVEINFO messages. Records the warning, weaving, compiler errors and error + * messages and provides methods to get them. + */ +public class MultiProjTestMessageHandler implements IBuildMessageHandler { + + private final boolean VERBOSE = false; + + private boolean receivedNonIncrementalBuildMessage = false; + private boolean receivedBatchBuildMessage = false; + + private List<IMessage> errorMessages; + private List<IMessage> warningMessages; + private List<IMessage> weavingMessages; + private List<String> compilerErrors; + private List<Kind> ignoring; + + public MultiProjTestMessageHandler() { + ignoring = new ArrayList<>(); + errorMessages = new ArrayList<IMessage>(); + warningMessages = new ArrayList<IMessage>(); + weavingMessages = new ArrayList<IMessage>(); + compilerErrors = new ArrayList<>(); + ignore(IMessage.INFO); + ignore(IMessage.WEAVEINFO); + } + + public boolean handleMessage(IMessage message) throws AbortException { + IMessage.Kind kind = message.getKind(); + if (isIgnoring(kind)) { + return true; + } + if (kind.equals(IMessage.ABORT) || message.getThrown() != null) { + log("> AjCompiler error: " + message.getMessage() + ", " + message.getThrown() + ")"); //$NON-NLS-1$ + message.getThrown().printStackTrace(); + compilerErrors.add(message + ", (" + message.getThrown() + ")"); + if (VERBOSE && (message.getThrown() != null)) { + message.getThrown().printStackTrace(); + } + return true; + } + if (message.getKind() == IMessage.ERROR) { + errorMessages.add(message); + } + if (message.getKind() == IMessage.WARNING) { + warningMessages.add(message); + } + if (message.getKind() == IMessage.WEAVEINFO) { + weavingMessages.add(message); + } + log("IMessageHandler.handleMessage(" + message + ")"); + return true; + } + + public void dontIgnore(Kind kind) { + if (null != kind) { + ignoring.remove(kind); + } + } + + public boolean isIgnoring(Kind kind) { + return ((null != kind) && (ignoring.contains(kind))); + } + + public void ignore(Kind kind) { + if ((null != kind) && (!ignoring.contains(kind))) { + ignoring.add(kind); + } + } + + public boolean hasWarning() { + return !warningMessages.isEmpty(); + } + + public boolean hasErrorMessages() { + return !errorMessages.isEmpty(); + } + + public boolean hasCompilerErrorMessages() { + return !compilerErrors.isEmpty(); + } + + public List<IMessage> getErrorMessages() { + return errorMessages; + } + + public List<IMessage> getWarningMessages() { + return warningMessages; + } + + public List<IMessage> getWeavingMessages() { + return weavingMessages; + } + + public List<String> getCompilerErrors() { + return compilerErrors; + } + + public void log(String s) { + if (VERBOSE) { + System.out.println(s); + } + } + + public void reset() { + receivedNonIncrementalBuildMessage = false; + receivedBatchBuildMessage = false; + errorMessages.clear(); + warningMessages.clear(); + weavingMessages.clear(); + compilerErrors.clear(); + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestOutputLocationManager.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestOutputLocationManager.java new file mode 100644 index 000000000..bb04e515b --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjTestOutputLocationManager.java @@ -0,0 +1,120 @@ +/******************************************************************** + * Copyright (c) 2007 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://eclipse.org/legal/epl-v10.html + * + * Contributors: IBM Corporation - initial API and implementation + * Helen Hawkins - initial version (bug 148190) + *******************************************************************/ +package org.aspectj.systemtest.incremental.tools; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.aspectj.ajde.core.IOutputLocationManager; + +/** + * An IOutputLocationManager which by default sends all output to the testProjectPath\bin directory. However, there are getter + * methods which enable sending resources and classes to different output dirs. Doesn't enable sending different classes to + * different output locations. + */ +public class MultiProjTestOutputLocationManager implements IOutputLocationManager { + + private final String testProjectOutputPath; + private File classOutputLoc; + private File resourceOutputLoc; + private final Map sourceFolders = new HashMap(); + private List<File> allOutputLocations; + + public MultiProjTestOutputLocationManager(String testProjectPath) { + this.testProjectOutputPath = testProjectPath + File.separator + "bin"; + } + + public File getOutputLocationForClass(File compilationUnit) { + initLocations(); + return classOutputLoc; + } + + public Map getInpathMap() { + return Collections.EMPTY_MAP; + } + + + public File getOutputLocationForResource(File resource) { + initLocations(); + return resourceOutputLoc; + } + + public List<File> getAllOutputLocations() { + if (allOutputLocations == null) { + allOutputLocations = new ArrayList<>(); + initLocations(); + allOutputLocations.add(classOutputLoc); + if (!classOutputLoc.equals(resourceOutputLoc)) { + allOutputLocations.add(resourceOutputLoc); + } + } + return allOutputLocations; + } + + public File getDefaultOutputLocation() { + return classOutputLoc; + } + + private void initLocations() { + if (classOutputLoc == null) { + classOutputLoc = new File(testProjectOutputPath); + } + if (resourceOutputLoc == null) { + resourceOutputLoc = new File(testProjectOutputPath); + } + } + + // -------------- setter methods useful for testing ------------- + public void setOutputLocForClass(File f) { + classOutputLoc = f; + } + + public void setSourceFolderFor(File sourceFile, String sourceFolder) { + try { + sourceFolders.put(sourceFile.getCanonicalPath(), sourceFolder); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + public void setOutputLocForResource(File f) { + resourceOutputLoc = f; + } + + public String getSourceFolderForFile(File sourceFile) { + try { + String f = (String) sourceFolders.get(sourceFile.getCanonicalPath()); + return f; + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + public void reportFileWrite(String outputfile, int filetype) { + // System.err.println(">>>" + outputfile); + } + + public void reportFileRemove(String outputfile, int filetype) { + } + + public int discoverChangesSince(File dir, long buildtime) { + // TODO Auto-generated method stub + return 0; + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java new file mode 100644 index 000000000..779143bd1 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -0,0 +1,4038 @@ +/******************************************************************** + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement initial implementation + * Helen Hawkins Converted to new interface (bug 148190) + *******************************************************************/ +package org.aspectj.systemtest.incremental.tools; + +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +import org.aspectj.ajde.core.ICompilerConfiguration; +import org.aspectj.ajde.core.TestOutputLocationManager; +import org.aspectj.ajde.core.internal.AjdeCoreBuildManager; +import org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory; +import org.aspectj.ajdt.internal.core.builder.AjBuildManager; +import org.aspectj.ajdt.internal.core.builder.AjState; +import org.aspectj.ajdt.internal.core.builder.IncrementalStateManager; +import org.aspectj.asm.AsmManager; +import org.aspectj.asm.IHierarchy; +import org.aspectj.asm.IProgramElement; +import org.aspectj.asm.IProgramElement.Kind; +import org.aspectj.asm.IRelationship; +import org.aspectj.asm.IRelationshipMap; +import org.aspectj.asm.internal.ProgramElement; +import org.aspectj.asm.internal.Relationship; +import org.aspectj.bridge.IMessage; +import org.aspectj.bridge.ISourceLocation; +import org.aspectj.bridge.Message; +import org.aspectj.tools.ajc.Ajc; +import org.aspectj.util.FileUtil; +import org.aspectj.weaver.ResolvedMember; +import org.aspectj.weaver.ResolvedType; +import org.aspectj.weaver.World; + +/** + * The superclass knows all about talking through Ajde to the compiler. The superclass isn't in charge of knowing how to simulate + * overlays for incremental builds, that is in here. As is the ability to generate valid build configs based on a directory + * structure. To support this we just need access to a sandbox directory - this sandbox is managed by the superclass (it only + * assumes all builds occur in <sandboxDir>/<projectName>/ ) + * + * The idea is you can initialize multiple projects in the sandbox and they can all be built independently, hopefully exploiting + * incremental compilation. Between builds you can alter the contents of a project using the alter() method that overlays some set + * of new files onto the current set (adding new files/changing existing ones) - you can then drive a new build and check it behaves + * as expected. + */ +public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementalAjdeInteractionTestbed { + + public void testIncremental_344326() throws Exception { + AjdeInteractionTestbed.VERBOSE = true; + String p = "pr344326"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + checkCompileWeaveCount(p, 3, 4); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + checkCompileWeaveCount(p, 1, 1); + } + + public void testMissingRel_328121() throws Exception { + String p = "pr328121"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + assertNoErrors(p); + // Check the annotations: + runMethod(p, "TestRequirements.TestRequirements", "foo"); + assertEquals(4, getRelationshipCount(p)); + } + + public void testEncoding_pr290741() throws Exception { + String p = "pr290741"; + initialiseProject(p); + setProjectEncoding(p, "UTF-8"); + build(p); + checkWasFullBuild(); + assertNoErrors(p); + runMethod(p, "demo.ConverterTest", "run"); + } + + public void testRogueConstantReference() throws Exception { + String p = "pr404345"; + initialiseProject(p); + setProjectEncoding(p, "UTF-8"); + build(p); + checkWasFullBuild(); + // Should both indicate that Location cannot be resolved + assertEquals(2,getErrorMessages(p).size()); + } + + public void testIncrementalITDInners4() throws Exception { + String p = "prInner4"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + assertNoErrors(p); + // touch the aspect making the ITD member type + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + assertNoErrors(p); + } + + public void testIncrementalITDInners3() throws Exception { + AjdeInteractionTestbed.VERBOSE = true; + String p = "prInner3"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + // touch the aspect making the ITD member type + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + // touch the aspect making the ITD that depends on the member type + alter(p, "inc2"); + build(p); + checkWasntFullBuild(); + // touch the type affected by the ITDs + alter(p, "inc3"); + build(p); + checkWasntFullBuild(); + } + + // mixing ITDs with inner type intertypes + public void testIncrementalITDInners2() throws Exception { + String p = "prInner2"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + // touch the aspect making the ITD member type + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + // touch the aspect making the ITD that depends on the member type + alter(p, "inc2"); + build(p); + checkWasntFullBuild(); + // touch the type affected by the ITDs + alter(p, "inc3"); + build(p); + checkWasntFullBuild(); + } + + public void testIncrementalITDInners() throws Exception { + String p = "prInner"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + } + + /* + * public void testIncrementalAspectWhitespace() throws Exception { AjdeInteractionTestbed.VERBOSE = true; String p = "xxx"; + * initialiseProject(p); configureNonStandardCompileOptions(p, "-showWeaveInfo"); configureShowWeaveInfoMessages(p, true); + * build(p); + * + * List weaveMessages = getWeavingMessages(p); if (weaveMessages.size() != 0) { for (Iterator iterator = + * weaveMessages.iterator(); iterator.hasNext();) { Object object = iterator.next(); System.out.println(object); } } + * checkWasFullBuild(); assertNoErrors(p); alter(p, "inc1"); build(p); checkWasntFullBuild(); assertNoErrors(p); } + */ + + public void testIncrementalGenericItds_pr280676() throws Exception { + String p = "pr280676"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + assertNoErrors(p); + alter(p, "inc1"); // remove type variables from ITD field + build(p); + checkWasFullBuild(); + assertNoErrors(p); + alter(p, "inc2"); // remove type variables from ITD method + build(p); + checkWasFullBuild(); + assertNoErrors(p); + alter(p, "inc3"); // readded type variables on ITD method + build(p); + checkWasFullBuild(); + assertNoErrors(p); + } + + public void testIncrementalGenericItds_pr280676_2() throws Exception { + String p = "pr280676_2"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + assertNoErrors(p); + alter(p, "inc1"); // remove type variables from target type + build(p); + List<IMessage> errors = getErrorMessages(p); + // Build errors: + // error at N:\temp\ajcSandbox\aspectj16_3\ajcTest60379.tmp\pr280676_2\src\p\A.java:8:0::0 a.ls cannot be resolved or is not + // a field + // error at N:\temp\ajcSandbox\aspectj16_3\ajcTest60379.tmp\pr280676_2\src\p\Foo.aj:8:0::0 Type parameters can not be + // specified in the ITD target type - the target type p.A is not generic. + // error at N:\temp\ajcSandbox\aspectj16_3\ajcTest60379.tmp\pr280676_2\src\p\Foo.aj:12:0::0 Type parameters can not be + // specified in the ITD target type - the target type p.A is not generic. + // error at N:\temp\ajcSandbox\aspectj16_3\ajcTest60379.tmp\pr280676_2\src\p\Foo.aj:8:0::0 Type parameters can not be + // specified in the ITD target type - the target type p.A is not generic. + // error at N:\temp\ajcSandbox\aspectj16_3\ajcTest60379.tmp\pr280676_2\src\p\Foo.aj:12:0::0 Type parameters can not be + // specified in the ITD target type - the target type p.A is not generic. + assertEquals(5, errors.size()); + } + + public void testAdviceHandles_pr284771() throws Exception { + String p = "pr284771"; + initialiseProject(p); + build(p); + IRelationshipMap irm = getModelFor(p).getRelationshipMap(); + List<IRelationship> rels = irm.get("=pr284771<test*AspectTrace.aj'AspectTrace&before"); + assertNotNull(rels); + assertEquals(2, ((Relationship) rels.get(0)).getTargets().size()); + rels = irm.get("=pr284771<test*AspectTrace.aj'AspectTrace&before!2"); + assertNotNull(rels); + assertEquals(2, ((Relationship) rels.get(0)).getTargets().size()); + } + + public void testDeclareSoftHandles_329111() throws Exception { + String p = "pr329111"; + initialiseProject(p); + build(p); + printModel(p); + IRelationshipMap irm = getModelFor(p).getRelationshipMap(); + List<IRelationship> rels = irm.get("=pr329111<{AJ.java'AJ`declare soft"); + assertNotNull(rels); + rels = irm.get("=pr329111<{AJ2.java'AJ2`declare soft"); + assertNotNull(rels); + rels = irm.get("=pr329111<{AJ2.java'AJ2`declare soft!2"); + assertNotNull(rels); + rels = irm.get("=pr329111<{AJ2.java'AJ2`declare soft!3"); + assertNotNull(rels); + rels = irm.get("=pr329111<{AJ3.java'AJ3`declare warning"); + assertNotNull(rels); + rels = irm.get("=pr329111<{AJ3.java'AJ3`declare warning!2"); + assertNotNull(rels); + rels = irm.get("=pr329111<{AJ3.java'AJ3`declare error"); + assertNotNull(rels); + rels = irm.get("=pr329111<{AJ3.java'AJ3`declare error!2"); + assertNotNull(rels); + } + + /** + * Test that the declare parents in the super aspect gets a relationship from the type declaring it. + */ + public void testAspectInheritance_322446() throws Exception { + String p = "pr322446"; + initialiseProject(p); + build(p); + IRelationshipMap irm = getModelFor(p).getRelationshipMap(); + // Hid:1:(targets=1) =pr322446<{Class.java[Class (aspect declarations) =pr322446<{AbstractAspect.java'AbstractAspect`declare + // parents + // Hid:2:(targets=1) =pr322446<{AbstractAspect.java'AbstractAspect`declare parents (declared on) =pr322446<{Class.java[Class + List<IRelationship> rels = irm.get("=pr322446<{AbstractAspect.java'AbstractAspect`declare parents"); + assertNotNull(rels); + } + + public void testAspectInheritance_322446_2() throws Exception { + String p = "pr322446_2"; + initialiseProject(p); + build(p); + IProgramElement thisAspectNode = getModelFor(p).getHierarchy().findElementForType("", "Sub"); + assertEquals("{Code=[I]}", thisAspectNode.getDeclareParentsMap().toString()); + } + + public void testBinaryAspectsAndTheModel_343001() throws Exception { + String lib = "pr343001_lib"; + initialiseProject(lib); + build(lib); + + // Check the 'standard build' - the library also has a type affected by the decp so we can check what happens on an 'all + // source' build + IProgramElement theAspect = getModelFor(lib).getHierarchy().findElementForHandleOrCreate("=pr343001_lib<{Super.java'Super", + false); + assertNotNull(theAspect); + IProgramElement sourcelevelDecp = getModelFor(lib).getHierarchy().findElementForHandleOrCreate( + "=pr343001_lib<{Super.java'Super`declare parents", false); + assertNotNull(sourcelevelDecp); + assertEquals("[java.io.Serializable]", sourcelevelDecp.getParentTypes().toString()); + + String p = "pr343001"; + initialiseProject(p); + configureAspectPath(p, getProjectRelativePath(lib, "bin")); + build(p); + + IProgramElement theBinaryAspect = getModelFor(p).getHierarchy().findElementForHandleOrCreate( + "=pr343001/binaries<(Super.class'Super", false); + assertNotNull(theBinaryAspect); + IProgramElement binaryDecp = getModelFor(p).getHierarchy().findElementForHandleOrCreate( + "=pr343001/binaries<(Super.class'Super`declare parents", false); + assertNotNull(binaryDecp); + assertEquals("[java.io.Serializable]", (binaryDecp.getParentTypes() == null ? "" : binaryDecp.getParentTypes().toString())); + } + + // found whilst looking at 322446 hence that is the testdata name + public void testAspectInheritance_322664() throws Exception { + AjdeInteractionTestbed.VERBOSE = true; + String p = "pr322446_3"; + initialiseProject(p); + build(p); + assertNoErrors(p); + alter(p, "inc1"); + build(p); + // should be some errors: + // error at N:\temp\ajcSandbox\aspectj16_1\ajcTest3209787521625191676.tmp\pr322446_3\src\AbstractAspect.java:5:0::0 can't + // bind type name 'T' + // error at N:\temp\ajcSandbox\aspectj16_1\ajcTest3209787521625191676.tmp\pr322446_3\src\AbstractAspect.java:8:0::0 + // Incorrect number of arguments for type AbstractAspect<S>; it cannot be parameterized with arguments <X, Y> + List<IMessage> errors = getErrorMessages(p); + assertTrue(errors != null && errors.size() > 0); + alter(p, "inc2"); + build(p); + // that build would contain an exception if the bug were around + assertNoErrors(p); + } + + // TODO (asc) these tests don't actually verify anything! + // public void testAtDeclareParents_280658() throws Exception { + // AjdeInteractionTestbed.VERBOSE = true; + // String lib = "pr280658_decp"; + // initialiseProject(lib); + // build(lib); + // checkWasFullBuild(); + // + // String cli = "pr280658_target"; + // initialiseProject(cli); + // + // configureAspectPath(cli, getProjectRelativePath(lib, "bin")); + // build(cli); + // checkWasFullBuild(); + // printModel(cli); + // } + // + // public void testAtDeclareMixin_280651() throws Exception { + // AjdeInteractionTestbed.VERBOSE = true; + // String lib = "pr280651_decmix"; + // initialiseProject(lib); + // build(lib); + // checkWasFullBuild(); + // + // String cli = "pr280658_target"; + // initialiseProject(cli); + // + // configureAspectPath(cli, getProjectRelativePath(lib, "bin")); + // build(cli); + // checkWasFullBuild(); + // printModel(cli); + // } + + // Testing that declare annotation model entries preserve the fully qualified type of the annotation + public void testDecAnnoState_pr286539() throws Exception { + String p = "pr286539"; + initialiseProject(p); + build(p); + printModel(p); + IProgramElement decpPE = getModelFor(p).getHierarchy().findElementForHandle( + "=pr286539<p.q.r{Aspect.java'Asp`declare parents"); + assertNotNull(decpPE); + String s = ((decpPE.getParentTypes()).get(0)); + assertEquals("p.q.r.Int", s); + + decpPE = getModelFor(p).getHierarchy().findElementForHandle("=pr286539<p.q.r{Aspect.java'Asp`declare parents!2"); + assertNotNull(decpPE); + s = ((decpPE.getParentTypes()).get(0)); + assertEquals("p.q.r.Int", s); + + IProgramElement decaPE = getModelFor(p).getHierarchy().findElementForHandle( + "=pr286539<p.q.r{Aspect.java'Asp`declare \\@type"); + assertNotNull(decaPE); + assertEquals("p.q.r.Foo", decaPE.getAnnotationType()); + + decaPE = getModelFor(p).getHierarchy().findElementForHandle("=pr286539<p.q.r{Aspect.java'Asp`declare \\@type!2"); + assertNotNull(decaPE); + assertEquals("p.q.r.Goo", decaPE.getAnnotationType()); + + decaPE = getModelFor(p).getHierarchy().findElementForHandle("=pr286539<p.q.r{Aspect.java'Asp`declare \\@field"); + assertNotNull(decaPE); + assertEquals("p.q.r.Foo", decaPE.getAnnotationType()); + + decaPE = getModelFor(p).getHierarchy().findElementForHandle("=pr286539<p.q.r{Aspect.java'Asp`declare \\@method"); + assertNotNull(decaPE); + assertEquals("p.q.r.Foo", decaPE.getAnnotationType()); + + decaPE = getModelFor(p).getHierarchy().findElementForHandle("=pr286539<p.q.r{Aspect.java'Asp`declare \\@constructor"); + assertNotNull(decaPE); + assertEquals("p.q.r.Foo", decaPE.getAnnotationType()); + } + + public void testQualifiedInnerTypeRefs_269082() throws Exception { + String p = "pr269082"; + initialiseProject(p); + configureNonStandardCompileOptions(p, "-Xset:minimalModel=false"); + + build(p); + printModel(p); + + IProgramElement root = getModelFor(p).getHierarchy().getRoot(); + + IProgramElement ipe = findElementAtLine(root, 7); + assertEquals("=pr269082<a{ClassUsingInner.java[ClassUsingInner~foo~QMyInner;~QObject;~QString;", ipe.getHandleIdentifier()); + + ipe = findElementAtLine(root, 9); + assertEquals("=pr269082<a{ClassUsingInner.java[ClassUsingInner~goo~QClassUsingInner.MyInner;~QObject;~QString;", + ipe.getHandleIdentifier()); + + ipe = findElementAtLine(root, 11); + assertEquals("=pr269082<a{ClassUsingInner.java[ClassUsingInner~hoo~Qa.ClassUsingInner.MyInner;~QObject;~QString;", + ipe.getHandleIdentifier()); + } + + // just simple incremental build - no code change, just the aspect touched + public void testIncrementalFqItds_280380() throws Exception { + + String p = "pr280380"; + initialiseProject(p); + build(p); + // printModel(p); + alter(p, "inc1"); + build(p); + // should not be an error about f.AClass not being found + assertNoErrors(p); + // printModel(p); + } + + public void testIncrementalAdvisingItdJoinpointsAccessingPrivFields_307120() throws Exception { + String p = "pr307120"; + initialiseProject(p); + build(p); + // Hid:1:(targets=1) =pr307120<{Test.java}Test)A.getFoo?field-get(int A.foo) (advised by) =pr307120<{Test.java}Test&before + // Hid:2:(targets=1) =pr307120<{A.java[A (aspect declarations) =pr307120<{Test.java}Test)A.getFoo + // Hid:3:(targets=1) =pr307120<{Test.java}Test&before (advises) =pr307120<{Test.java}Test)A.getFoo?field-get(int A.foo) + // Hid:4:(targets=1) =pr307120<{Test.java}Test)A.getFoo (declared on) =pr307120<{A.java[A + alter(p, "inc1"); + assertEquals(4, getRelationshipCount(p)); + build(p); + // Hid:1:(targets=1) =pr307120<{A.java[A (aspect declarations) =pr307120<{Test.java}Test)A.getFoo + // Hid:2:(targets=1) =pr307120<{Test.java}Test)A.getFoo (declared on) =pr307120<{A.java[A + // These two are missing without the fix: + // Hid:1:(targets=1) =pr307120<{Test.java}Test)A.getFoo?field-get(int A.foo) (advised by) =pr307120<{Test.java}Test&before + // Hid:7:(targets=1) =pr307120<{Test.java}Test&before (advises) =pr307120<{Test.java}Test)A.getFoo?field-get(int A.foo) + assertNoErrors(p); + assertEquals(4, getRelationshipCount(p)); + } + + public void testIncrementalAdvisingItdJoinpointsAccessingPrivFields_307120_pipelineOff() throws Exception { + String p = "pr307120"; + initialiseProject(p); + configureNonStandardCompileOptions(p, "-Xset:pipelineCompilation=false"); + build(p); + // Hid:1:(targets=1) =pr307120<{Test.java}Test)A.getFoo?field-get(int A.foo) (advised by) =pr307120<{Test.java}Test&before + // Hid:2:(targets=1) =pr307120<{A.java[A (aspect declarations) =pr307120<{Test.java}Test)A.getFoo + // Hid:3:(targets=1) =pr307120<{Test.java}Test&before (advises) =pr307120<{Test.java}Test)A.getFoo?field-get(int A.foo) + // Hid:4:(targets=1) =pr307120<{Test.java}Test)A.getFoo (declared on) =pr307120<{A.java[A + alter(p, "inc1"); + assertEquals(4, getRelationshipCount(p)); + build(p); + // Hid:1:(targets=1) =pr307120<{A.java[A (aspect declarations) =pr307120<{Test.java}Test)A.getFoo + // Hid:2:(targets=1) =pr307120<{Test.java}Test)A.getFoo (declared on) =pr307120<{A.java[A + // These two are missing without the fix: + // Hid:1:(targets=1) =pr307120<{Test.java}Test)A.getFoo?field-get(int A.foo) (advised by) =pr307120<{Test.java}Test&before + // Hid:7:(targets=1) =pr307120<{Test.java}Test&before (advises) =pr307120<{Test.java}Test)A.getFoo?field-get(int A.foo) + assertNoErrors(p); + assertEquals(4, getRelationshipCount(p)); + } + + // More sophisticated variant of above. + public void testIncrementalAdvisingItdJoinpointsAccessingPrivFields_307120_2_pipelineOff() throws Exception { + String p = "pr307120_3"; + initialiseProject(p); + configureNonStandardCompileOptions(p, "-Xset:pipelineCompilation=false"); + build(p); + assertNoErrors(p); + // Hid:1:(targets=1) =pr307120_3<{TargetAugmenter.java}TargetAugmenter)Target.setIt)QString; (declared on) + // =pr307120_3<{Target.java[Target + + // Hid:2:(targets=1) =pr307120_3<{Target.java[Target (aspect declarations) + // =pr307120_3<{TargetAugmenter.java}TargetAugmenter)Target.setIt)QString; + + // these are missing under this bug: + + // Hid:3:(targets=1) =pr307120_3<{Advisor.java}Advisor&around&QObject;&QObject; (advises) + // =pr307120_3<{TargetAugmenter.java}TargetAugmenter)Target.setIt)QString;?field-set(java.lang.String Target.it) + + // Hid:4:(targets=1) =pr307120_3<{TargetAugmenter.java}TargetAugmenter)Target.setIt)QString;?field-set(java.lang.String + // Target.it) (advised by) =pr307120_3<{Advisor.java}Advisor&around&QObject;&QObject; + + assertEquals(4, getRelationshipCount(p)); + alter(p, "inc1"); + build(p); + + assertEquals(4, getRelationshipCount(p)); + assertNoErrors(p); + } + + // More sophisticated variant of above. + public void testIncrementalAdvisingItdJoinpointsAccessingPrivFields_307120_2() throws Exception { + String p = "pr307120_2"; + initialiseProject(p); + build(p); + assertNoErrors(p); + // Hid:2:(targets=1) =pr307120_2<{TargetAugmenter.java}TargetAugmenter)Target.setIt)QString; (declared on) + // =pr307120_2<{Target.java[Target + // Hid:8:(targets=1) =pr307120_2<{TargetAugmenter.java}TargetAugmenter)Target.getIt (declared on) + // =pr307120_2<{Target.java[Target + // Hid:5:(targets=2) =pr307120_2<{Target.java[Target (aspect declarations) + // =pr307120_2<{TargetAugmenter.java}TargetAugmenter)Target.getIt + // Hid:6:(targets=2) =pr307120_2<{Target.java[Target (aspect declarations) + // =pr307120_2<{TargetAugmenter.java}TargetAugmenter)Target.setIt)QString; + // Hid:1:(targets=1) =pr307120_2<{TargetAugmenter.java}TargetAugmenter)Target.setIt)QString;?field-set(java.lang.String + // Target.it) (advised by) =pr307120_2<{Advisor.java}Advisor&around&QObject;&QObject; + // Hid:3:(targets=1) =pr307120_2<{TargetAugmenter.java}TargetAugmenter)Target.getIt?field-get(java.lang.String Target.it) + // (advised by) =pr307120_2<{Advisor.java}Advisor&around&QObject; + // Hid:4:(targets=1) =pr307120_2<{Advisor.java}Advisor&around&QObject; (advises) + // =pr307120_2<{TargetAugmenter.java}TargetAugmenter)Target.getIt?field-get(java.lang.String Target.it) + // Hid:7:(targets=1) =pr307120_2<{Advisor.java}Advisor&around&QObject;&QObject; (advises) + // =pr307120_2<{TargetAugmenter.java}TargetAugmenter)Target.setIt)QString;?field-set(java.lang.String Target.it) + assertEquals(8, getRelationshipCount(p)); + alter(p, "inc1"); + build(p); + assertEquals(8, getRelationshipCount(p)); + assertNoErrors(p); + } + + // // More sophisticated variant of above. + // public void testIncrementalAdvisingItdJoinpointsAccessingPrivFields_307120_4_pipelineOff() throws Exception { + // String p = "pr307120_4"; + // initialiseProject(p); + // configureNonStandardCompileOptions(p, "-Xset:pipelineCompilation=false"); + // build(p); + // assertNoErrors(p); + // + // printModel(p); + // assertEquals(4, getRelationshipCount(p)); + // alter(p, "inc1"); + // build(p); + // + // assertEquals(4, getRelationshipCount(p)); + // assertNoErrors(p); + // } + + // modified aspect so target is fully qualified on the incremental change + public void testIncrementalFqItds_280380_2() throws Exception { + String p = "pr280380"; + initialiseProject(p); + build(p); + // printModel(p); + assertEquals(4, getModelFor(p).getRelationshipMap().getEntries().size()); + // Hid:1:(targets=3) =pr280380<f{AClass.java[AClass (aspect declarations) =pr280380<g*AnAspect.aj}AnAspect)AClass.xxxx + // Hid:2:(targets=3) =pr280380<f{AClass.java[AClass (aspect declarations) =pr280380<g*AnAspect.aj}AnAspect)AClass.y + // Hid:3:(targets=3) =pr280380<f{AClass.java[AClass (aspect declarations) =pr280380<g*AnAspect.aj}AnAspect)AClass.AClass_new + // Hid:4:(targets=1) =pr280380<g*AnAspect.aj}AnAspect)AClass.y (declared on) =pr280380<f{AClass.java[AClass + // Hid:5:(targets=1) =pr280380<g*AnAspect.aj}AnAspect)AClass.AClass_new (declared on) =pr280380<f{AClass.java[AClass + // Hid:6:(targets=1) =pr280380<g*AnAspect.aj}AnAspect)AClass.xxxx (declared on) =pr280380<f{AClass.java[AClass + + alter(p, "inc2"); + build(p); + // should not be an error about f.AClass not being found + assertNoErrors(p); + // printModel(p); + assertEquals(4, getModelFor(p).getRelationshipMap().getEntries().size()); + // Hid:1:(targets=3) =pr280380<f{AClass.java[AClass (aspect declarations) =pr280380<g*AnAspect.aj}AnAspect)AClass.xxxx + // Hid:2:(targets=3) =pr280380<f{AClass.java[AClass (aspect declarations) =pr280380<g*AnAspect.aj}AnAspect)AClass.y + // Hid:3:(targets=3) =pr280380<f{AClass.java[AClass (aspect declarations) =pr280380<g*AnAspect.aj}AnAspect)AClass.AClass_new + // Hid:4:(targets=1) =pr280380<g*AnAspect.aj}AnAspect)AClass.y (declared on) =pr280380<f{AClass.java[AClass + // Hid:5:(targets=1) =pr280380<g*AnAspect.aj}AnAspect)AClass.AClass_new (declared on) =pr280380<f{AClass.java[AClass + // Hid:6:(targets=1) =pr280380<g*AnAspect.aj}AnAspect)AClass.xxxx (declared on) =pr280380<f{AClass.java[AClass + } + + public void testIncrementalFqItds_280380_3() throws Exception { + String p = "pr280380"; + initialiseProject(p); + build(p); + // printModel(p); + assertEquals(4, getModelFor(p).getRelationshipMap().getEntries().size()); + // Hid:1:(targets=3) =pr280380<f{AClass.java[AClass (aspect declarations) =pr280380<g*AnAspect.aj}AnAspect)AClass.xxxx + // Hid:2:(targets=3) =pr280380<f{AClass.java[AClass (aspect declarations) =pr280380<g*AnAspect.aj}AnAspect)AClass.y + // Hid:3:(targets=3) =pr280380<f{AClass.java[AClass (aspect declarations) =pr280380<g*AnAspect.aj}AnAspect)AClass.AClass_new + // Hid:4:(targets=1) =pr280380<g*AnAspect.aj}AnAspect)AClass.y (declared on) =pr280380<f{AClass.java[AClass + // Hid:5:(targets=1) =pr280380<g*AnAspect.aj}AnAspect)AClass.AClass_new (declared on) =pr280380<f{AClass.java[AClass + // Hid:6:(targets=1) =pr280380<g*AnAspect.aj}AnAspect)AClass.xxxx (declared on) =pr280380<f{AClass.java[AClass + printModel(p); + assertNotNull(getModelFor(p).getRelationshipMap().get("=pr280380<g*AnAspect.aj'AnAspect,AClass.xxxx")); + alter(p, "inc2"); + build(p); + assertNoErrors(p); + printModel(p); + // On this build the relationship should have changed to include the fully qualified target + assertEquals(4, getModelFor(p).getRelationshipMap().getEntries().size()); + assertNotNull(getModelFor(p).getRelationshipMap().get("=pr280380<g*AnAspect.aj'AnAspect,AClass.xxxx")); + // Hid:1:(targets=3) =pr280380<f{AClass.java[AClass (aspect declarations) =pr280380<g*AnAspect.aj}AnAspect)AClass.xxxx + // Hid:2:(targets=3) =pr280380<f{AClass.java[AClass (aspect declarations) =pr280380<g*AnAspect.aj}AnAspect)AClass.y + // Hid:3:(targets=3) =pr280380<f{AClass.java[AClass (aspect declarations) =pr280380<g*AnAspect.aj}AnAspect)AClass.AClass_new + // Hid:4:(targets=1) =pr280380<g*AnAspect.aj}AnAspect)AClass.y (declared on) =pr280380<f{AClass.java[AClass + // Hid:5:(targets=1) =pr280380<g*AnAspect.aj}AnAspect)AClass.AClass_new (declared on) =pr280380<f{AClass.java[AClass + // Hid:6:(targets=1) =pr280380<g*AnAspect.aj}AnAspect)AClass.xxxx (declared on) =pr280380<f{AClass.java[AClass + } + + public void testFQItds_322039() throws Exception { + String p = "pr322039"; + initialiseProject(p); + build(p); + printModel(p); + IRelationshipMap irm = getModelFor(p).getRelationshipMap(); + List<IRelationship> rels = irm.get("=pr322039<p{Azpect.java'Azpect)q2.Code.something2"); + assertNotNull(rels); + } + + public void testIncrementalCtorItdHandle_280383() throws Exception { + String p = "pr280383"; + initialiseProject(p); + build(p); + printModel(p); + IRelationshipMap irm = getModelFor(p).getRelationshipMap(); + List<IRelationship> rels = irm.get("=pr280383<f{AnAspect.java'AnAspect)f.AClass.f_AClass_new"); + assertNotNull(rels); + } + + // public void testArraysGenerics() throws Exception { + // String p = "pr283864"; + // initialiseProject(p); + // build(p); + // printModel(p); + // // IRelationshipMap irm = getModelFor(p).getRelationshipMap(); + // // List rels = irm.get("=pr280383<f{AnAspect.java}AnAspect)f.AClass.f_AClass_new"); + // // assertNotNull(rels); + // } + + public void testSimilarITDS() throws Exception { + String p = "pr283657"; + initialiseProject(p); + build(p); + printModel(p); + // Hid:1:(targets=1) =pr283657<{Aspect.java}Aspect)Target.foo (declared on) =pr283657<{Aspect.java[Target + // Hid:2:(targets=1) =pr283657<{Aspect.java}Aspect)Target.foo!2 (declared on) =pr283657<{Aspect.java[Target + // Hid:3:(targets=2) =pr283657<{Aspect.java[Target (aspect declarations) =pr283657<{Aspect.java}Aspect)Target.foo + // Hid:4:(targets=2) =pr283657<{Aspect.java[Target (aspect declarations) =pr283657<{Aspect.java}Aspect)Target.foo!2 + IRelationshipMap irm = getModelFor(p).getRelationshipMap(); + List<IRelationship> rels = irm.get("=pr283657<{Aspect.java'Aspect,Target.foo"); + assertNotNull(rels); + rels = irm.get("=pr283657<{Aspect.java'Aspect)Target.foo!2"); + assertNotNull(rels); + } + + public void testIncrementalAnnotationMatched_276399() throws Exception { + String p = "pr276399"; + initialiseProject(p); + addSourceFolderForSourceFile(p, getProjectRelativePath(p, "src/X.aj"), "src"); + addSourceFolderForSourceFile(p, getProjectRelativePath(p, "src/C.java"), "src"); + build(p); + IRelationshipMap irm = getModelFor(p).getRelationshipMap(); + IRelationship ir = irm.get("=pr276399/src<*X.aj'X&after").get(0); + assertNotNull(ir); + alter(p, "inc1"); + build(p); + printModel(p); + irm = getModelFor(p).getRelationshipMap(); + List<IRelationship> rels = irm.get("=pr276399/src<*X.aj'X&after"); // should be gone after the inc build + assertNull(rels); + } + + public void testHandleCountDecA_pr278255() throws Exception { + String p = "pr278255"; + initialiseProject(p); + build(p); + printModelAndRelationships(p); + IRelationshipMap irm = getModelFor(p).getRelationshipMap(); + List<IRelationship> l = irm.get("=pr278255<{A.java'X`declare \\@type"); + assertNotNull(l); + IRelationship ir = l.get(0); + assertNotNull(ir); + } + + public void testIncrementalItdDefaultCtor() { + String p = "pr275032"; + initialiseProject(p); + build(p); + assertEquals(0, getErrorMessages(p).size()); + alter(p, "inc1"); + build(p); + // error is: inter-type declaration from X conflicts with existing member: void A.<init>() + // List ms = + getErrorMessages(p); + assertEquals(4, getErrorMessages(p).size()); + // Why 4 errors? I believe the problem is: + // 2 errors are reported when there is a clash - one against the aspect, one against the affected target type. + // each of the two errors are recorded against the compilation result for the aspect and the target + // So it comes out as 4 - but for now I am tempted to leave it because at least it shows there is a problem... + assertTrue("Was:" + getErrorMessages(p).get(0), getErrorMessages(p).get(0).toString().indexOf("conflicts") != -1); + } + + public void testOutputLocationCallbacks2() { + String p = "pr268827_ol_res"; + initialiseProject(p); + Map<String,File> m = new HashMap<String,File>(); + m.put("a.txt", new File(getFile(p, "src/a.txt"))); + configureResourceMap(p, m); + CustomOLM olm = new CustomOLM(getProjectRelativePath(p, ".").toString()); + configureOutputLocationManager(p, olm); + build(p); + checkCompileWeaveCount(p, 2, 2); + assertEquals(3, olm.writeCount); + alter(p, "inc1"); // this contains a new B.java that doesn't have the aspect inside it + build(p); + checkCompileWeaveCount(p, 3, 1); + assertEquals(1, olm.removeCount); // B.class removed + } + + public void testOutputLocationCallbacks() { + String p = "pr268827_ol"; + initialiseProject(p); + CustomOLM olm = new CustomOLM(getProjectRelativePath(p, ".").toString()); + configureOutputLocationManager(p, olm); + build(p); + checkCompileWeaveCount(p, 2, 3); + alter(p, "inc1"); // this contains a new Foo.java that no longer has Extra class in it + build(p); + checkCompileWeaveCount(p, 1, 1); + assertEquals(1, olm.removeCount); + } + + public void testOutputLocationCallbacksFileAdd() { + String p = "pr268827_ol2"; + initialiseProject(p); + CustomOLM olm = new CustomOLM(getProjectRelativePath(p, ".").toString()); + configureOutputLocationManager(p, olm); + build(p); + assertEquals(3, olm.writeCount); + olm.writeCount = 0; + checkCompileWeaveCount(p, 2, 3); + alter(p, "inc1"); // this contains a new file Boo.java + build(p); + assertEquals(1, olm.writeCount); + checkCompileWeaveCount(p, 1, 1); + // assertEquals(1, olm.removeCount); + } + + static class CustomOLM extends TestOutputLocationManager { + + public int writeCount = 0; + public int removeCount = 0; + + public CustomOLM(String testProjectPath) { + super(testProjectPath); + } + + @Override + public void reportFileWrite(String outputfile, int filetype) { + super.reportFileWrite(outputfile, filetype); + writeCount++; + System.out.println("Written " + outputfile); + // System.out.println("Written " + outputfile + " " + filetype); + } + + @Override + public void reportFileRemove(String outputfile, int filetype) { + super.reportFileRemove(outputfile, filetype); + removeCount++; + System.out.println("Removed " + outputfile); + // System.out.println("Removed " + outputfile + " " + filetype); + } + + } + + public void testBrokenCodeDeca_268611() { + String p = "pr268611"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + assertEquals(1, getErrorMessages(p).size()); + assertTrue(((Message) getErrorMessages(p).get(0)).getMessage().indexOf( + "Syntax error on token \")\", \"name pattern\" expected") != -1); + } + + public void testIncrementalMixin() { + String p = "mixin"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + assertEquals(0, getErrorMessages(p).size()); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + assertEquals(0, getErrorMessages(p).size()); + } + + public void testUnusedPrivates_pr266420() { + String p = "pr266420"; + initialiseProject(p); + + Hashtable<String,String> javaOptions = new Hashtable<String,String>(); + javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6"); + javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6"); + javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.6"); + javaOptions.put("org.eclipse.jdt.core.compiler.problem.unusedPrivateMember", "warning"); + configureJavaOptionsMap(p, javaOptions); + + build(p); + checkWasFullBuild(); + List<IMessage> warnings = getWarningMessages(p); + assertEquals(0, warnings.size()); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + warnings = getWarningMessages(p); + assertEquals(0, warnings.size()); + } + + public void testExtendingITDAspectOnClasspath_PR298704() throws Exception { + String base = "pr298704_baseaspects"; + String test = "pr298704_testaspects"; + initialiseProject(base); + initialiseProject(test); + configureNewProjectDependency(test, base); + + build(base); + build(test); + checkWasFullBuild(); + assertNoErrors(test); + IRelationshipMap irm = getModelFor(test).getRelationshipMap(); + assertEquals(7, irm.getEntries().size()); + } + + public void testPR265729() { + AjdeInteractionTestbed.VERBOSE = true; + String lib = "pr265729_lib"; + initialiseProject(lib); + // addClasspathEntryChanged(lib, getProjectRelativePath(p1, + // "bin").toString()); + build(lib); + checkWasFullBuild(); + + String cli = "pr265729_client"; + initialiseProject(cli); + + // addClasspathEntry(cli, new File("../lib/junit/junit.jar")); + configureAspectPath(cli, getProjectRelativePath(lib, "bin")); + build(cli); + checkWasFullBuild(); + + IProgramElement root = getModelFor(cli).getHierarchy().getRoot(); + + // dumptree(root, 0); + // PrintWriter pw = new PrintWriter(System.out); + // try { + // getModelFor(cli).dumprels(pw); + // pw.flush(); + // } catch (Exception e) { + // } + IRelationshipMap irm = getModelFor(cli).getRelationshipMap(); + IRelationship ir = irm.get("=pr265729_client<be.cronos.aop{App.java[App").get(0); + // This type should be affected by an ITD and a declare parents + // could be either way round + String h1 = ir.getTargets().get(0); + String h2 = ir.getTargets().get(1); + + // For some ITD: public void I.g(String s) {} + // Node in tree: I.g(java.lang.String) [inter-type method] + // Handle: =pr265729_client<be.cronos.aop{App.java}X)I.g)QString; + + if (!h1.endsWith("parents")) { + String h3 = h1; + h1 = h2; + h2 = h3; + } + // ITD from the test program: + // public String InterTypeAspectInterface.foo(int i,List list,App a) { + assertEquals("=pr265729_client/binaries<be.cronos.aop.aspects(InterTypeAspect.class'InterTypeAspect`declare parents", h1); + assertEquals( + "=pr265729_client/binaries<be.cronos.aop.aspects(InterTypeAspect.class'InterTypeAspect)InterTypeAspectInterface.foo)I)QList;)QSerializable;", + h2); + IProgramElement binaryDecp = getModelFor(cli).getHierarchy().getElement(h1); + assertNotNull(binaryDecp); + IProgramElement binaryITDM = getModelFor(cli).getHierarchy().getElement(h2); + assertNotNull(binaryITDM); + + // @see AsmRelationshipProvider.createIntertypeDeclaredChild() + List<char[]> ptypes = binaryITDM.getParameterTypes(); + assertEquals("int", new String((char[]) ptypes.get(0))); + assertEquals("java.util.List", new String((char[]) ptypes.get(1))); + assertEquals("java.io.Serializable", new String((char[]) ptypes.get(2))); + + // param names not set + // List pnames = binaryITDM.getParameterNames(); + // assertEquals("i", new String((char[]) pnames.get(0))); + // assertEquals("list", new String((char[]) pnames.get(1))); + // assertEquals("b", new String((char[]) pnames.get(2))); + + assertEquals("java.lang.String", binaryITDM.getCorrespondingType(true)); + } + + public void testXmlConfiguredProject() { + AjdeInteractionTestbed.VERBOSE = true; + String p = "xmlone"; + initialiseProject(p); + configureNonStandardCompileOptions(p, "-showWeaveInfo");// -xmlConfigured"); + configureShowWeaveInfoMessages(p, true); + addXmlConfigFile(p, getProjectRelativePath(p, "p/aop.xml").toString()); + build(p); + checkWasFullBuild(); + List<IMessage> weaveMessages = getWeavingMessages(p); + if (weaveMessages.size() != 1) { + for (Iterator<IMessage> iterator = weaveMessages.iterator(); iterator.hasNext();) { + Object object = iterator.next(); + System.out.println(object); + } + fail("Expected just one weave message. The aop.xml should have limited the weaving"); + } + + } + + public void testDeclareParentsInModel() { + String p = "decps"; + initialiseProject(p); + build(p); + IProgramElement decp = getModelFor(p).getHierarchy().findElementForHandle("=decps<a{A.java'A`declare parents"); + List<String> ps = decp.getParentTypes(); + assertNotNull(ps); + assertEquals(2, ps.size()); + int count = 0; + for (Iterator<String> iterator = ps.iterator(); iterator.hasNext();) { + String type = iterator.next(); + if (type.equals("java.io.Serializable")) { + count++; + } + if (type.equals("a.Goo")) { + count++; + } + } + assertEquals("Should have found the two types in: " + ps, 2, count); + } + + public void testConstructorAdvice_pr261380() throws Exception { + String p = "261380"; + initialiseProject(p); + build(p); + IRelationshipMap irm = getModelFor(p).getRelationshipMap(); + IRelationship ir = irm.get("=261380<test{C.java'X&before").get(0); + List<String> targets = ir.getTargets(); + assertEquals(1, targets.size()); + System.out.println(targets.get(0)); + String handle = (String) targets.get(0); + assertEquals("Expected the handle for the code node inside the constructor decl", + "=261380<test{C.java[C~C?constructor-call(void test.C.<init>())", handle); + } + + /* + * A.aj package pack; public aspect A { pointcut p() : call( C.method before() : p() { // line 7 } } + * + * C.java package pack; public class C { public void method1() { method2(); // line 6 } public void method2() { } public void + * method3() { method2(); // line 13 } + * + * } + */ + public void testDontLoseAdviceMarkers_pr134471() { + try { + // see pr148027 AsmHierarchyBuilder.shouldAddUsesPointcut=false; + initialiseProject("P4"); + build("P4"); + Ajc.dumpAJDEStructureModel(getModelFor("P4"), "after full build where advice is applying"); + // should be 4 relationship entries + + // In inc1 the first advised line is 'commented out' + alter("P4", "inc1"); + build("P4"); + checkWasntFullBuild(); + Ajc.dumpAJDEStructureModel(getModelFor("P4"), "after inc build where first advised line is gone"); + // should now be 2 relationship entries + + // This will be the line 6 entry in C.java + IProgramElement codeElement = findCode(checkForNode(getModelFor("P4"), "pack", "C", true)); + + // This will be the line 7 entry in A.java + IProgramElement advice = findAdvice(checkForNode(getModelFor("P4"), "pack", "A", true)); + + IRelationshipMap asmRelMap = getModelFor("P4").getRelationshipMap(); + assertEquals("There should be two relationships in the relationship map", 2, asmRelMap.getEntries().size()); + + for (Iterator<String> iter = asmRelMap.getEntries().iterator(); iter.hasNext();) { + String sourceOfRelationship = (String) iter.next(); + IProgramElement ipe = getModelFor("P4").getHierarchy().findElementForHandle(sourceOfRelationship); + assertNotNull("expected to find IProgramElement with handle " + sourceOfRelationship + " but didn't", ipe); + if (ipe.getKind().equals(IProgramElement.Kind.ADVICE)) { + assertEquals("expected source of relationship to be " + advice.toString() + " but found " + ipe.toString(), + advice, ipe); + } else if (ipe.getKind().equals(IProgramElement.Kind.CODE)) { + assertEquals( + "expected source of relationship to be " + codeElement.toString() + " but found " + ipe.toString(), + codeElement, ipe); + } else { + fail("found unexpected relationship source " + ipe + " with kind " + ipe.getKind() + + " when looking up handle: " + sourceOfRelationship); + } + List<IRelationship> relationships = asmRelMap.get(ipe); + assertNotNull("expected " + ipe.getName() + " to have some " + "relationships", relationships); + for (Iterator<IRelationship> iterator = relationships.iterator(); iterator.hasNext();) { + Relationship rel = (Relationship) iterator.next(); + List<String> targets = rel.getTargets(); + for (Iterator<String> iterator2 = targets.iterator(); iterator2.hasNext();) { + String t = (String) iterator2.next(); + IProgramElement link = getModelFor("P4").getHierarchy().findElementForHandle(t); + if (ipe.getKind().equals(IProgramElement.Kind.ADVICE)) { + assertEquals( + "expected target of relationship to be " + codeElement.toString() + " but found " + + link.toString(), codeElement, link); + } else if (ipe.getKind().equals(IProgramElement.Kind.CODE)) { + assertEquals( + "expected target of relationship to be " + advice.toString() + " but found " + link.toString(), + advice, link); + } else { + fail("found unexpected relationship source " + ipe.getName() + " with kind " + ipe.getKind()); + } + } + } + } + + } finally { + // see pr148027 AsmHierarchyBuilder.shouldAddUsesPointcut=true; + // configureBuildStructureModel(false); + } + } + + public void testPr148285() { + String p = "PR148285_2"; + initialiseProject(p); // Single source file A.aj defines A and C + build(p); + checkWasFullBuild(); + alter(p, "inc1"); // Second source introduced C.java, defines C + build(p); + checkWasntFullBuild(); + List<IMessage> msgs = getErrorMessages(p); + assertEquals("error message should be 'The type C is already defined' ", "The type C is already defined", + ((IMessage) msgs.get(0)).getMessage()); + alter("PR148285_2", "inc2"); // type C in A.aj is commented out + build("PR148285_2"); + checkWasntFullBuild(); + msgs = getErrorMessages(p); + assertTrue("There should be no errors reported:\n" + getErrorMessages(p), msgs.isEmpty()); + } + + public void testIncrementalAndAnnotations() { + initialiseProject("Annos"); + build("Annos"); + checkWasFullBuild(); + checkCompileWeaveCount("Annos", 4, 4); + AsmManager model = getModelFor("Annos"); + assertEquals("Should be 3 relationships ", 3, model.getRelationshipMap().getEntries().size()); + + alter("Annos", "inc1"); // Comment out the annotation on Parent + build("Annos"); + checkWasntFullBuild(); + assertEquals("Should be no relationships ", 0, model.getRelationshipMap().getEntries().size()); + checkCompileWeaveCount("Annos", 3, 3); + + alter("Annos", "inc2"); // Add the annotation back onto Parent + build("Annos"); + checkWasntFullBuild(); + assertEquals("Should be 3 relationships ", 3, model.getRelationshipMap().getEntries().size()); + checkCompileWeaveCount("Annos", 3, 3); + } + + // package a.b.c; + // + // public class A { + // } + // + // aspect X { + // B A.foo(C c) { return null; } + // declare parents: A implements java.io.Serializable; + // } + // + // class B {} + // class C {} + public void testITDFQNames_pr252702() { + String p = "itdfq"; + AjdeInteractionTestbed.VERBOSE = true; + initialiseProject(p); + build(p); + AsmManager model = getModelFor(p); + dumptree(model.getHierarchy().getRoot(), 0); + IProgramElement root = model.getHierarchy().getRoot(); + ProgramElement theITD = (ProgramElement) findElementAtLine(root, 7); + Map<String, Object> m = theITD.kvpairs; + for (Iterator<String> iterator = m.keySet().iterator(); iterator.hasNext();) { + String type = iterator.next(); + System.out.println(type + " = " + m.get(type)); + } + // return type of the ITD + assertEquals("a.b.c.B", theITD.getCorrespondingType(true)); + List<char[]> ptypes = theITD.getParameterTypes(); + for (Iterator<char[]> iterator = ptypes.iterator(); iterator.hasNext();) { + char[] object = iterator.next(); + System.out.println("p = " + new String(object)); + } + ProgramElement decp = (ProgramElement) findElementAtLine(root, 8); + m = decp.kvpairs; + for (Iterator<String> iterator = m.keySet().iterator(); iterator.hasNext();) { + String type = iterator.next(); + System.out.println(type + " = " + m.get(type)); + } + List<String> l = decp.getParentTypes(); + assertEquals("java.io.Serializable", l.get(0)); + ProgramElement ctorDecp = (ProgramElement) findElementAtLine(root, 16); + String ctordecphandle = ctorDecp.getHandleIdentifier(); + assertEquals("=itdfq<a.b.c{A.java'XX)B.B_new)QString;", ctordecphandle); // 252702 + // , + // comment + // 7 + } + + public void testBrokenHandles_pr247742() { + String p = "BrokenHandles"; + initialiseProject(p); + // alter(p, "inc1"); + build(p); + // alter(p, "inc2"); + // build(p); + AsmManager model = getModelFor(p); + dumptree(model.getHierarchy().getRoot(), 0); + + IProgramElement root = model.getHierarchy().getRoot(); + IProgramElement ipe = findElementAtLine(root, 4); + assertEquals("=BrokenHandles<p{GetInfo.java'GetInfo`declare warning", ipe.getHandleIdentifier()); + ipe = findElementAtLine(root, 5); + assertEquals("=BrokenHandles<p{GetInfo.java'GetInfo`declare warning!2", ipe.getHandleIdentifier()); + ipe = findElementAtLine(root, 6); + assertEquals("=BrokenHandles<p{GetInfo.java'GetInfo`declare parents", ipe.getHandleIdentifier()); + } + + public void testNPEIncremental_pr262218() { + AjdeInteractionTestbed.VERBOSE = true; + String p = "pr262218"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + List<String> l = getCompilerErrorMessages(p); + assertEquals("Unexpected compiler error", 0, l.size()); + } + + public void testDeclareAnnotationNPE_298504() { + AjdeInteractionTestbed.VERBOSE = true; + String p = "pr298504"; + initialiseProject(p); + build(p); + List<IMessage> l = getErrorMessages(p); + assertTrue(l.toString().indexOf("ManagedResource cannot be resolved to a type") != -1); + // checkWasFullBuild(); + alter(p, "inc1"); + build(p); + // checkWasntFullBuild(); + List<String> compilerErrors = getCompilerErrorMessages(p); + assertTrue(compilerErrors.toString().indexOf("NullPointerException") == -1); + l = getErrorMessages(p); + assertTrue(l.toString().indexOf("ManagedResource cannot be resolved to a type") != -1); + } + + public void testIncrementalAnnoStyle_pr286341() { + AjdeInteractionTestbed.VERBOSE = true; + String base = "pr286341_base"; + initialiseProject(base); + build(base); + checkWasFullBuild(); + String p = "pr286341"; + initialiseProject(p); + configureAspectPath(p, getProjectRelativePath(base, "bin")); + addClasspathEntry(p, getProjectRelativePath(base, "bin")); + build(p); + checkWasFullBuild(); + assertNoErrors(p); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + assertNoErrors(p); + } + + public void testImports_pr263487() { + String p2 = "importProb2"; + initialiseProject(p2); + build(p2); + checkWasFullBuild(); + + String p = "importProb"; + initialiseProject(p); + build(p); + configureAspectPath(p, getProjectRelativePath(p2, "bin")); + checkWasFullBuild(); + build(p); + build(p); + build(p); + alter(p, "inc1"); + addProjectSourceFileChanged(p, getProjectRelativePath(p, "src/p/Code.java")); + // addProjectSourceFileChanged(p, getProjectRelativePath(p, + // "src/q/Asp.java")); + build(p); + checkWasntFullBuild(); + List<String> l = getCompilerErrorMessages(p); + assertEquals("Unexpected compiler error", 0, l.size()); + } + + public void testBuildingBrokenCode_pr263323() { + AjdeInteractionTestbed.VERBOSE = true; + String p = "brokenCode"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + alter(p, "inc1"); // break the aspect + build(p); + checkWasntFullBuild(); + alter(p, "inc2"); // whitespace change on affected file + build(p); + checkWasntFullBuild(); + List<String> l = getCompilerErrorMessages(p); + assertEquals("Unexpected compiler error", 0, l.size()); + } + + /* + * public void testNPEGenericCtor_pr260944() { AjdeInteractionTestbed.VERBOSE = true; String p = "pr260944"; + * initialiseProject(p); build(p); checkWasFullBuild(); alter(p, "inc1"); build(p); checkWasntFullBuild(); List l = + * getCompilerErrorMessages(p); assertEquals("Unexpected compiler error", 0, l.size()); } + */ + + public void testItdProb() { + AjdeInteractionTestbed.VERBOSE = true; + String p = "itdprob"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + List<String> l = getCompilerErrorMessages(p); + assertEquals("Unexpected compiler error", 0, l.size()); + } + + /* + * public void testGenericITD_pr262257() throws IOException { String p = "pr262257"; initialiseProject(p); build(p); + * checkWasFullBuild(); + * + * dumptree(getModelFor(p).getHierarchy().getRoot(), 0); PrintWriter pw = new PrintWriter(System.out); + * getModelFor(p).dumprels(pw); pw.flush(); } + */ + public void testAnnotations_pr262154() { + String p = "pr262154"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + alter(p, "inc1"); + build(p); + List<String> l = getCompilerErrorMessages(p); + assertEquals("Unexpected compiler error", 0, l.size()); + } + + public void testAnnotations_pr255555() { + String p = "pr255555"; + initialiseProject(p); + build(p); + checkCompileWeaveCount(p, 2, 1); + } + + public void testSpacewarHandles() { + // String p = "SpaceWar"; + String p = "Simpler"; + initialiseProject(p); + build(p); + dumptree(getModelFor(p).getHierarchy().getRoot(), 0); + // incomplete + } + + /** + * Test what is in the model for package declarations and import statements. Package Declaration nodes are new in AspectJ 1.6.4. + * Import statements are contained with an 'import references' node. + */ + public void testImportHandles() { + String p = "Imports"; + initialiseProject(p); + configureNonStandardCompileOptions(p, "-Xset:minimalModel=false"); + build(p); + + IProgramElement root = getModelFor(p).getHierarchy().getRoot(); + + // Looking for 'package p.q' + IProgramElement ipe = findFile(root, "Example.aj");// findElementAtLine(root, 1); + ipe = ipe.getChildren().get(0); // package decl is first entry in the type + assertEquals(IProgramElement.Kind.PACKAGE_DECLARATION, ipe.getKind()); + assertEquals("package p.q;", ipe.getSourceSignature()); + assertEquals("=Imports<p.q*Example.aj%p.q", ipe.getHandleIdentifier()); + assertEquals(ipe.getSourceLocation().getOffset(), 8); // "package p.q" - location of p.q + + // Looking for import containing containing string and integer + ipe = findElementAtLine(root, 3); // first import + ipe = ipe.getParent(); // imports container + assertEquals("=Imports<p.q*Example.aj#", ipe.getHandleIdentifier()); + } + + public void testAdvisingCallJoinpointsInITDS_pr253067() { + String p = "pr253067"; + initialiseProject(p); + build(p); + // Check for a code node at line 5 - if there is one then we created it + // correctly when building + // the advice relationship + IProgramElement root = getModelFor(p).getHierarchy().getRoot(); + IProgramElement code = findElementAtLine(root, 5); + assertEquals("=pr253067<aa*AdvisesC.aj'AdvisesC)C.nothing?method-call(int aa.C.nothing())", code.getHandleIdentifier()); + // dumptree(getModelFor(p).getHierarchy().getRoot(), 0); + // Ajc.dumpAJDEStructureModel(getModelFor("pr253067"), + // "after inc build where first advised line is gone"); + } + + public void testHandles_DeclareAnno_pr249216_c9() { + String p = "pr249216"; + initialiseProject(p); + build(p); + IProgramElement root = getModelFor(p).getHierarchy().getRoot(); + IProgramElement code = findElementAtLine(root, 4); + // the @ should be escapified + assertEquals("=pr249216<{Deca.java'X`declare \\@type", code.getHandleIdentifier()); + // dumptree(getModelFor(p).getHierarchy().getRoot(), 0); + // Ajc.dumpAJDEStructureModel(getModelFor(p), + // "after inc build where first advised line is gone"); + } + + public void testNullDelegateBrokenCode_pr251940() { + String p = "pr251940"; + initialiseProject(p); + build(p); + checkForError(p, "The type F must implement the inherited"); + } + + public void testBeanExample() throws Exception { + String p = "BeanExample"; + initialiseProject(p); + build(p); + dumptree(getModelFor(p).getHierarchy().getRoot(), 0); + PrintWriter pw = new PrintWriter(System.out); + getModelFor(p).dumprels(pw); + pw.flush(); + // incomplete + } + + // private void checkIfContainsFile(Set s, String filename, boolean shouldBeFound) { + // StringBuffer sb = new StringBuffer("Set of files\n"); + // for (Iterator iterator = s.iterator(); iterator.hasNext();) { + // Object object = iterator.next(); + // sb.append(object).append("\n"); + // } + // for (Iterator iterator = s.iterator(); iterator.hasNext();) { + // File fname = (File) iterator.next(); + // if (fname.getName().endsWith(filename)) { + // if (!shouldBeFound) { + // System.out.println(sb.toString()); + // fail("Unexpectedly found file " + filename); + // } else { + // return; + // } + // } + // } + // if (shouldBeFound) { + // System.out.println(sb.toString()); + // fail("Did not find filename " + filename); + // } + // } + + // /** + // * Checking return values of the AsmManager API calls that can be invoked + // post incremental build that tell the caller which + // * files had their relationships altered. As well as the affected (woven) + // files, it is possible to query the aspects that wove + // * those files. + // */ + // public void testChangesOnBuild() throws Exception { + // String p = "ChangesOnBuild"; + // initialiseProject(p); + // build(p); + // // Not incremental + // checkIfContainsFile(AsmManager.getDefault().getModelChangesOnLastBuild(), + // "A.java", false); + // alter(p, "inc1"); + // build(p); + // // Incremental + // checkIfContainsFile(AsmManager.getDefault().getModelChangesOnLastBuild(), + // "A.java", true); + // checkIfContainsFile(AsmManager.getDefault(). + // getAspectsWeavingFilesOnLastBuild(), "X.java", true); + // checkIfContainsFile(AsmManager.getDefault(). + // getAspectsWeavingFilesOnLastBuild(), "Y.java", false); + // } + + public void testITDIncremental_pr192877() { + String p = "PR192877"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + } + + public void testIncrementalBuildsWithItds_pr259528() { + String p = "pr259528"; + AjdeInteractionTestbed.VERBOSE = true; + initialiseProject(p); + build(p); + checkWasFullBuild(); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + } + + public void testAdviceHandlesAreJDTCompatible() { + String p = "AdviceHandles"; + initialiseProject(p); + addSourceFolderForSourceFile(p, getProjectRelativePath(p, "src/Handles.aj"), "src"); + build(p); + IProgramElement root = getModelFor(p).getHierarchy().getRoot(); + IProgramElement typeDecl = findElementAtLine(root, 4); + assertEquals("=AdviceHandles/src<spacewar*Handles.aj'Handles", typeDecl.getHandleIdentifier()); + + IProgramElement advice1 = findElementAtLine(root, 7); + assertEquals("=AdviceHandles/src<spacewar*Handles.aj'Handles&before", advice1.getHandleIdentifier()); + + IProgramElement advice2 = findElementAtLine(root, 11); + assertEquals("=AdviceHandles/src<spacewar*Handles.aj'Handles&before!2", advice2.getHandleIdentifier()); + + IProgramElement advice3 = findElementAtLine(root, 15); + assertEquals("=AdviceHandles/src<spacewar*Handles.aj'Handles&before&I", advice3.getHandleIdentifier()); + + IProgramElement advice4 = findElementAtLine(root, 20); + assertEquals("=AdviceHandles/src<spacewar*Handles.aj'Handles&before&I!2", advice4.getHandleIdentifier()); + + IProgramElement advice5 = findElementAtLine(root, 25); + assertEquals("=AdviceHandles/src<spacewar*Handles.aj'Handles&after", advice5.getHandleIdentifier()); + + IProgramElement advice6 = findElementAtLine(root, 30); + assertEquals("=AdviceHandles/src<spacewar*Handles.aj'Handles&afterReturning", advice6.getHandleIdentifier()); + + IProgramElement advice7 = findElementAtLine(root, 35); + assertEquals("=AdviceHandles/src<spacewar*Handles.aj'Handles&afterThrowing", advice7.getHandleIdentifier()); + + IProgramElement advice8 = findElementAtLine(root, 40); + assertEquals("=AdviceHandles/src<spacewar*Handles.aj'Handles&afterThrowing&I", advice8.getHandleIdentifier()); + + IProgramElement namedInnerClass = findElementAtLine(root, 46); + assertEquals("=AdviceHandles/src<spacewar*Handles.aj'Handles~x[NamedClass", namedInnerClass.getHandleIdentifier()); + + assertEquals("=AdviceHandles/src<spacewar*Handles.aj'Handles~foo[", findElementAtLine(root, 55).getHandleIdentifier()); + assertEquals("=AdviceHandles/src<spacewar*Handles.aj'Handles~foo[!2", findElementAtLine(root, 56).getHandleIdentifier()); + + // From 247742: comment 3: two anon class declarations + assertEquals("=AdviceHandles/src<spacewar*Handles.aj'Handles~b~QString;[", findElementAtLine(root, 62) + .getHandleIdentifier()); + assertEquals("=AdviceHandles/src<spacewar*Handles.aj'Handles~b~QString;[!2", findElementAtLine(root, 63) + .getHandleIdentifier()); + + // From 247742: comment 6: two diff anon class declarations + assertEquals("=AdviceHandles/src<spacewar*Handles.aj'Handles~c~QString;[", findElementAtLine(root, 66) + .getHandleIdentifier()); + assertEquals("=AdviceHandles/src<spacewar*Handles.aj'Handles~c~QString;[!2", findElementAtLine(root, 67) + .getHandleIdentifier()); + + // // From 247742: comment 4 + // assertEquals( + // "=AdviceHandles/src<spacewar*Handles.aj}Foo&afterReturning&QString;", + // findElementAtLine(root, + // 72).getHandleIdentifier()); + // assertEquals( + // "=AdviceHandles/src<spacewar*Handles.aj}Foo&afterReturning&QString;!2" + // , findElementAtLine(root, + // 73).getHandleIdentifier()); + + } + + // Testing code handles - should they included positional information? seems + // to be what AJDT wants but we + // only have the declaration start position in the programelement + // public void testHandlesForCodeElements() { + // String p = "CodeHandles"; + // initialiseProject(p); + // addSourceFolderForSourceFile(p, getProjectRelativePath(p, + // "src/Handles.aj"), "src"); + // build(p); + // IProgramElement root = AsmManager.getDefault().getHierarchy().getRoot(); + // IProgramElement typeDecl = findElementAtLine(root, 3); + // assertEquals("=CodeHandles/src<spacewar*Handles.aj[C", + // typeDecl.getHandleIdentifier()); + // + // IProgramElement code = findElementAtLine(root, 6); + // assertEquals( + // "=CodeHandles/src<spacewar*Handles.aj[C~m?method-call(void spacewar.C.foo(int))" + // , code.getHandleIdentifier()); + // code = findElementAtLine(root, 7); + // assertEquals( + // "=CodeHandles/src<spacewar*Handles.aj[C~m?method-call(void spacewar.C.foo(int))!2" + // , code.getHandleIdentifier()); + // + // } + + private IProgramElement findFile(IProgramElement whereToLook, String filesubstring) { + if (whereToLook.getSourceLocation() != null && whereToLook.getKind().isSourceFile() + && whereToLook.getSourceLocation().getSourceFile().toString().indexOf(filesubstring) != -1) { + return whereToLook; + } + for (IProgramElement element : whereToLook.getChildren()) { + Kind k = element.getKind(); + ISourceLocation sloc = element.getSourceLocation(); + if (sloc != null && k.isSourceFile() && sloc.getSourceFile().toString().indexOf(filesubstring) != -1) { + return element; + } + if (k.isSourceFile()) { + continue; // no need to look further down + } + IProgramElement gotSomething = findFile(element, filesubstring); + if (gotSomething != null) { + return gotSomething; + } + } + return null; + } + + private IProgramElement findElementAtLine(IProgramElement whereToLook, int line) { + if (whereToLook == null) { + return null; + } + if (whereToLook.getSourceLocation() != null && whereToLook.getSourceLocation().getLine() == line) { + return whereToLook; + } + for (IProgramElement object : whereToLook.getChildren()) { + if (object.getSourceLocation() != null && object.getSourceLocation().getLine() == line) { + return object; + } + IProgramElement gotSomething = findElementAtLine(object, line); + if (gotSomething != null) { + return gotSomething; + } + } + return null; + } + + public void testModelWithMultipleSourceFolders() { + initialiseProject("MultiSource"); + // File sourceFolderOne = getProjectRelativePath("MultiSource", "src1"); + // File sourceFolderTwo = getProjectRelativePath("MultiSource", "src2"); + // File sourceFolderThree = getProjectRelativePath("MultiSource", + // "src3"); + // src1 source folder slashed as per 264563 + addSourceFolderForSourceFile("MultiSource", getProjectRelativePath("MultiSource", "src1/CodeOne.java"), "src1/"); + addSourceFolderForSourceFile("MultiSource", getProjectRelativePath("MultiSource", "src2/CodeTwo.java"), "src2"); + addSourceFolderForSourceFile("MultiSource", getProjectRelativePath("MultiSource", "src3/pkg/CodeThree.java"), "src3"); + build("MultiSource"); + IProgramElement srcOne = getModelFor("MultiSource").getHierarchy().findElementForHandle("=MultiSource/src1"); + IProgramElement CodeOneClass = getModelFor("MultiSource").getHierarchy().findElementForHandle( + "=MultiSource/src1{CodeOne.java[CodeOne"); + IProgramElement srcTwoPackage = getModelFor("MultiSource").getHierarchy().findElementForHandle("=MultiSource/src2<pkg"); + IProgramElement srcThreePackage = getModelFor("MultiSource").getHierarchy().findElementForHandle("=MultiSource/src3<pkg"); + assertNotNull(srcOne); + assertNotNull(CodeOneClass); + assertNotNull(srcTwoPackage); + assertNotNull(srcThreePackage); + if (srcTwoPackage.equals(srcThreePackage)) { + throw new RuntimeException( + "Should not have found these package nodes to be the same, they are in different source folders"); + } + // dumptree(AsmManager.getDefault().getHierarchy().getRoot(), 0); + } + + // Now the source folders are more complex 'src/java/main' and + // 'src/java/tests' + public void testModelWithMultipleSourceFolders2() { + initialiseProject("MultiSource"); + // File sourceFolderOne = getProjectRelativePath("MultiSource", + // "src/java/main"); + // File sourceFolderTwo = getProjectRelativePath("MultiSource", "src2"); + // File sourceFolderThree = getProjectRelativePath("MultiSource", + // "src3"); + addSourceFolderForSourceFile("MultiSource", getProjectRelativePath("MultiSource", "src1/CodeOne.java"), "src/java/main"); + addSourceFolderForSourceFile("MultiSource", getProjectRelativePath("MultiSource", "src2/CodeTwo.java"), "src/java/main"); + addSourceFolderForSourceFile("MultiSource", getProjectRelativePath("MultiSource", "src3/pkg/CodeThree.java"), + "src/java/tests"); + build("MultiSource"); + + IProgramElement srcOne = getModelFor("MultiSource").getHierarchy().findElementForHandleOrCreate( + "=MultiSource/src\\/java\\/main", false); + IProgramElement CodeOneClass = getModelFor("MultiSource").getHierarchy().findElementForHandle( + "=MultiSource/src\\/java\\/main{CodeOne.java[CodeOne"); + IProgramElement srcTwoPackage = getModelFor("MultiSource").getHierarchy().findElementForHandle( + "=MultiSource/src\\/java\\/tests<pkg"); + IProgramElement srcThreePackage = getModelFor("MultiSource").getHierarchy().findElementForHandle( + "=MultiSource/src\\/java\\/testssrc3<pkg"); + assertNotNull(srcOne); + assertNotNull(CodeOneClass); + assertNotNull(srcTwoPackage); + assertNotNull(srcThreePackage); + if (srcTwoPackage.equals(srcThreePackage)) { + throw new RuntimeException( + "Should not have found these package nodes to be the same, they are in different source folders"); + } + // dumptree(AsmManager.getDefault().getHierarchy().getRoot(), 0); + } + + public void testIncrementalItdsWithMultipleAspects_pr173729() { + initialiseProject("PR173729"); + build("PR173729"); + checkWasFullBuild(); + alter("PR173729", "inc1"); + build("PR173729"); + checkWasntFullBuild(); + } + + // Compile a single simple project + public void testTheBasics() { + initialiseProject("P1"); + build("P1"); // This first build will be batch + build("P1"); + checkWasntFullBuild(); + checkCompileWeaveCount("P1", 0, 0); + } + + // source code doesnt matter, we are checking invalid path handling + public void testInvalidAspectpath_pr121395() { + initialiseProject("P1"); + File f = new File("foo.jar"); + Set<File> s = new HashSet<File>(); + s.add(f); + configureAspectPath("P1", s); + build("P1"); // This first build will be batch + checkForError("P1", "invalid aspectpath entry"); + } + + // incorrect use of '?' when it should be '*' + public void testAspectPath_pr242797_c46() { + String bug = "pr242797_1"; + String bug2 = "pr242797_2"; + initialiseProject(bug); + initialiseProject(bug2); + configureAspectPath(bug2, getProjectRelativePath(bug, "bin")); + build(bug); + build(bug2); + } + + public void testAspectPath_pr247742_c16() throws IOException { + String bug = "AspectPathOne"; + String bug2 = "AspectPathTwo"; + addSourceFolderForSourceFile(bug2, getProjectRelativePath(bug2, "src/C.java"), "src"); + initialiseProject(bug); + initialiseProject(bug2); + configureAspectPath(bug2, getProjectRelativePath(bug, "bin")); + build(bug); + build(bug2); + dumptree(getModelFor(bug2).getHierarchy().getRoot(), 0); + PrintWriter pw = new PrintWriter(System.out); + getModelFor(bug2).dumprels(pw); + pw.flush(); + IProgramElement root = getModelFor(bug2).getHierarchy().getRoot(); + assertEquals("=AspectPathTwo/binaries<pkg(Asp.class'Asp&before", findElementAtLine(root, 5).getHandleIdentifier()); + assertEquals("=AspectPathTwo/binaries<(Asp2.class'Asp2&before", findElementAtLine(root, 16).getHandleIdentifier()); + } + + public void testAspectPath_pr274558() throws Exception { + String base = "bug274558depending"; + String depending = "bug274558base"; + // addSourceFolderForSourceFile(bug2, getProjectRelativePath(bug2, "src/C.java"), "src"); + initialiseProject(base); + initialiseProject(depending); + configureAspectPath(depending, getProjectRelativePath(base, "bin")); + build(base); + build(depending); + printModel(depending); + IProgramElement root = getModelFor(depending).getHierarchy().getRoot(); + assertEquals("=bug274558base/binaries<r(DeclaresITD.class'DeclaresITD,InterfaceForITD.x", findElementAtLine(root, 5) + .getHandleIdentifier()); + // assertEquals("=AspectPathTwo/binaries<(Asp2.class}Asp2&before", findElementAtLine(root, 16).getHandleIdentifier()); + } + + public void testAspectPath_pr265693() throws IOException { + String bug = "AspectPath3"; + String bug2 = "AspectPath4"; + addSourceFolderForSourceFile(bug2, getProjectRelativePath(bug2, "src/C.java"), "src"); + initialiseProject(bug); + initialiseProject(bug2); + configureAspectPath(bug2, getProjectRelativePath(bug, "bin")); + build(bug); + build(bug2); + // dumptree(getModelFor(bug2).getHierarchy().getRoot(), 0); + // PrintWriter pw = new PrintWriter(System.out); + // getModelFor(bug2).dumprels(pw); + // pw.flush(); + IProgramElement root = getModelFor(bug2).getHierarchy().getRoot(); + IProgramElement binariesNode = getChild(root, "binaries"); + assertNotNull(binariesNode); + IProgramElement packageNode = binariesNode.getChildren().get(0); + assertEquals("a.b.c", packageNode.getName()); + IProgramElement fileNode = packageNode.getChildren().get(0); + assertEquals(IProgramElement.Kind.FILE, fileNode.getKind()); + } + + private IProgramElement getChild(IProgramElement start, String name) { + if (start.getName().equals(name)) { + return start; + } + List<IProgramElement> kids = start.getChildren(); + if (kids != null) { + for (int i = 0; i < kids.size(); i++) { + IProgramElement found = getChild((IProgramElement) kids.get(i), name); + if (found != null) { + return found; + } + } + } + return null; + } + + public void testHandleQualification_pr265993() throws IOException { + String p = "pr265993"; + initialiseProject(p); + configureNonStandardCompileOptions(p, "-Xset:minimalModel=false"); + build(p); + IProgramElement root = getModelFor(p).getHierarchy().getRoot(); + // dumptree(getModelFor(p).getHierarchy().getRoot(), 0); + // PrintWriter pw = new PrintWriter(System.out); + // getModelFor(p).dumprels(pw); + // pw.flush(); + assertEquals("=pr265993<{A.java[A~m~QString;~Qjava.lang.String;", findElementAtLine(root, 3).getHandleIdentifier()); + assertEquals("=pr265993<{A.java[A~m2~QList;", findElementAtLine(root, 5).getHandleIdentifier()); + assertEquals("=pr265993<{A.java[A~m3~Qjava.util.ArrayList;", findElementAtLine(root, 6).getHandleIdentifier()); + assertEquals("=pr265993<{A.java[A~m4~QMap\\<Qjava.lang.String;QList;>;", findElementAtLine(root, 8).getHandleIdentifier()); + assertEquals("=pr265993<{A.java[A~m5~Qjava.util.Map\\<Qjava.lang.String;QList;>;", findElementAtLine(root, 9) + .getHandleIdentifier()); + assertEquals("=pr265993<{A.java[A~m6~QMap\\<\\[IQList;>;", findElementAtLine(root, 10).getHandleIdentifier()); + assertEquals("=pr265993<{A.java[A~m7~\\[I", findElementAtLine(root, 11).getHandleIdentifier()); + assertEquals("=pr265993<{A.java[A~m8~\\[Qjava.lang.String;", findElementAtLine(root, 12).getHandleIdentifier()); + assertEquals("=pr265993<{A.java[A~m9~\\[QString;", findElementAtLine(root, 13).getHandleIdentifier()); + assertEquals("=pr265993<{A.java[A~m10~\\[\\[QList\\<QString;>;", findElementAtLine(root, 14).getHandleIdentifier()); + assertEquals("=pr265993<{A.java[A~m11~Qjava.util.List\\<QT;>;", findElementAtLine(root, 15).getHandleIdentifier()); + assertEquals("=pr265993<{A.java[A~m12~\\[QT;", findElementAtLine(root, 16).getHandleIdentifier()); + assertEquals("=pr265993<{A.java[A~m13~QClass\\<QT;>;~QObject;~QString;", findElementAtLine(root, 17).getHandleIdentifier()); + } + + public void testHandlesForAnnotationStyle_pr269286() throws IOException { + String p = "pr269286"; + initialiseProject(p); + build(p); + IProgramElement root = getModelFor(p).getHierarchy().getRoot(); + dumptree(getModelFor(p).getHierarchy().getRoot(), 0); + PrintWriter pw = new PrintWriter(System.out); + getModelFor(p).dumprels(pw); + pw.flush(); + assertEquals("=pr269286<{Logger.java[Logger", findElementAtLine(root, 4).getHandleIdentifier()); // type + assertEquals("=pr269286<{Logger.java[Logger~boo", findElementAtLine(root, 7).getHandleIdentifier()); // before + assertEquals("=pr269286<{Logger.java[Logger~aoo", findElementAtLine(root, 11).getHandleIdentifier()); // after + assertEquals("=pr269286<{Logger.java[Logger~aroo", findElementAtLine(root, 15).getHandleIdentifier()); // around + + // pointcuts are not fixed - seems to buggy handling of them internally + assertEquals("=pr269286<{Logger.java[Logger\"ooo", findElementAtLine(root, 20).getHandleIdentifier()); + + // DeclareWarning + assertEquals("=pr269286<{Logger.java[Logger^message", findElementAtLine(root, 24).getHandleIdentifier()); + + // DeclareError + assertEquals("=pr269286<{Logger.java[Logger^message2", findElementAtLine(root, 27).getHandleIdentifier()); + } + + public void testHandleCountersForAdvice() throws IOException { + String p = "prx"; + initialiseProject(p); + build(p); + // System.out.println("Handle Counters For Advice Output"); + IProgramElement root = getModelFor(p).getHierarchy().getRoot(); + // dumptree(getModelFor(p).getHierarchy().getRoot(), 0); + // PrintWriter pw = new PrintWriter(System.out); + // getModelFor(p).dumprels(pw); + // pw.flush(); + IProgramElement ff = findFile(root, "ProcessAspect.aj"); + assertEquals("=prx<com.kronos.aspects*ProcessAspect.aj'ProcessAspect&after&QMyProcessor;", findElementAtLine(root, 22) + .getHandleIdentifier()); + assertEquals("=prx<com.kronos.aspects*ProcessAspect.aj'ProcessAspect&after&QMyProcessor;!2", findElementAtLine(root, 68) + .getHandleIdentifier()); + } + + /** + * A change is made to an aspect on the aspectpath (staticinitialization() advice is added) for another project. + * <p> + * Managing the aspectpath is hard. We want to do a minimal build of this project which means recognizing what kind of changes + * have occurred on the aspectpath. Was it a regular class or an aspect? Was it a structural change to that aspect? + * <p> + * The filenames for .class files created that contain aspects is stored in the AjState.aspectClassFiles field. When a change is + * detected we can see who was managing the location where the change occurred and ask them if the .class file contained an + * aspect. Right now a change detected like this will cause a full build. We might improve the detection logic here but it isn't + * trivial: + * <ul> + * <li>Around advice is inlined. Changing the body of an around advice would not normally be thought of as a structural change + * (as it does not change the signature of the class) but due to inlining it is a change we would need to pay attention to as it + * will affect types previously woven with that advice. + * <li>Annotation style aspects include pointcuts in strings. Changes to these are considered non-structural but clearly they do + * affect what might be woven. + * </ul> + */ + public void testAspectPath_pr249212_c1() throws IOException { + String p1 = "AspectPathOne"; + String p2 = "AspectPathTwo"; + addSourceFolderForSourceFile(p2, getProjectRelativePath(p2, "src/C.java"), "src"); + initialiseProject(p1); + initialiseProject(p2); + configureAspectPath(p2, getProjectRelativePath(p1, "bin")); + build(p1); + build(p2); + + alter(p1, "inc1"); + build(p1); // Modify the aspect Asp2 to include staticinitialization() + // advice + checkWasFullBuild(); + Set<File> s = getModelFor(p1).getModelChangesOnLastBuild(); + assertTrue("Should be empty as was full build:" + s, s.isEmpty()); + + // prod the build of the second project with some extra info to tell it + // more precisely about the change: + addClasspathEntryChanged(p2, getProjectRelativePath(p1, "bin").toString()); + configureAspectPath(p2, getProjectRelativePath(p1, "bin")); + build(p2); + checkWasFullBuild(); + + // dumptree(AsmManager.getDefault().getHierarchy().getRoot(), 0); + // PrintWriter pw = new PrintWriter(System.out); + // AsmManager.getDefault().dumprels(pw); + // pw.flush(); + + // Not incremental + assertTrue("Should be empty as was full build:" + s, s.isEmpty()); + // Set s = AsmManager.getDefault().getModelChangesOnLastBuild(); + // checkIfContainsFile(AsmManager.getDefault().getModelChangesOnLastBuild + // (), "C.java", true); + } + + // public void testAspectPath_pr242797_c41() { + // String bug = "pr242797_3"; + // String bug2 = "pr242797_4"; + // initialiseProject(bug); + // initialiseProject(bug2); + // configureAspectPath(bug2, getProjectRelativePath(bug, "bin")); + // build(bug); + // build(bug2); + // } + + /** + * Build a project containing a resource - then mark the resource readOnly(), then do an inc-compile, it will report an error + * about write access to the resource in the output folder being denied + */ + /* + * public void testProblemCopyingResources_pr138171() { initialiseProject("PR138171"); + * + * File f=getProjectRelativePath("PR138171","res.txt"); Map m = new HashMap(); m.put("res.txt",f); + * AjdeInteractionTestbed.MyProjectPropertiesAdapter .getInstance().setSourcePathResources(m); build("PR138171"); File f2 = + * getProjectOutputRelativePath("PR138171","res.txt"); boolean successful = f2.setReadOnly(); + * + * alter("PR138171","inc1"); AjdeInteractionTestbed.MyProjectPropertiesAdapter .getInstance().setSourcePathResources(m); + * build("PR138171"); List msgs = MyTaskListManager.getErrorMessages(); assertTrue("there should be one message but there are " + * +(msgs==null?0:msgs.size())+":\n"+msgs,msgs!=null && msgs.size()==1); IMessage msg = (IMessage)msgs.get(0); String exp = + * "unable to copy resource to output folder: 'res.txt'"; assertTrue("Expected message to include this text [" + * +exp+"] but it does not: "+msg,msg.toString().indexOf(exp)!=-1); } + */ + + // Make simple changes to a project, adding a class + public void testSimpleChanges() { + initialiseProject("P1"); + build("P1"); // This first build will be batch + alter("P1", "inc1"); // adds a single class + build("P1"); + checkCompileWeaveCount("P1", 1, -1); + build("P1"); + checkCompileWeaveCount("P1", 0, -1); + } + + // Make simple changes to a project, adding a class and an aspect + public void testAddingAnAspect() { + initialiseProject("P1"); + build("P1"); // build 1, weave 1 + alter("P1", "inc1"); // adds a class + alter("P1", "inc2"); // adds an aspect + build("P1"); // build 1, + long timeTakenForFullBuildAndWeave = getTimeTakenForBuild("P1"); + checkWasFullBuild(); // it *will* be a full build under the new + // "back-to-the-source strategy + checkCompileWeaveCount("P1", 5, 3); // we compile X and A (the delta) + // find out that + // an aspect has changed, go back to the source + // and compile X,A,C, then weave the all. + build("P1"); + long timeTakenForSimpleIncBuild = getTimeTakenForBuild("P1"); + // I don't think this test will have timing issues as the times should + // be *RADICALLY* different + // On my config, first build time is 2093ms and the second is 30ms + assertTrue("Should not take longer for the trivial incremental build! first=" + timeTakenForFullBuildAndWeave + + "ms second=" + timeTakenForSimpleIncBuild + "ms", timeTakenForSimpleIncBuild < timeTakenForFullBuildAndWeave); + } + + public void testBuildingTwoProjectsInTurns() { + initialiseProject("P1"); + initialiseProject("P2"); + build("P1"); + build("P2"); + build("P1"); + checkWasntFullBuild(); + build("P2"); + checkWasntFullBuild(); + } + + public void testBuildingBrokenCode_pr240360() { + initialiseProject("pr240360"); + // configureNonStandardCompileOptions("pr240360","-proceedOnError"); + build("pr240360"); + checkWasFullBuild(); + checkCompileWeaveCount("pr240360", 5, 4); + assertTrue("There should be an error:\n" + getErrorMessages("pr240360"), !getErrorMessages("pr240360").isEmpty()); + + Set s = getModelFor("pr240360").getRelationshipMap().getEntries(); + int relmapLength = s.size(); + + // Delete the erroneous type + String f = getWorkingDir().getAbsolutePath() + File.separatorChar + "pr240360" + File.separatorChar + "src" + + File.separatorChar + "test" + File.separatorChar + "Error.java"; + (new File(f)).delete(); + build("pr240360"); + checkWasntFullBuild(); + checkCompileWeaveCount("pr240360", 0, 0); + assertEquals(relmapLength, getModelFor("pr240360").getRelationshipMap().getEntries().size()); + + // Readd the erroneous type + alter("pr240360", "inc1"); + build("pr240360"); + checkWasntFullBuild(); + checkCompileWeaveCount("pr240360", 1, 0); + assertEquals(relmapLength, getModelFor("pr240360").getRelationshipMap().getEntries().size()); + + // Change the advice + alter("pr240360", "inc2"); + build("pr240360"); + checkWasFullBuild(); + checkCompileWeaveCount("pr240360", 6, 4); + assertEquals(relmapLength, getModelFor("pr240360").getRelationshipMap().getEntries().size()); + + } + + public void testBrokenCodeCompilation() { + initialiseProject("pr102733_1"); + // configureNonStandardCompileOptions("pr102733_1","-proceedOnError"); + build("pr102733_1"); + checkWasFullBuild(); + checkCompileWeaveCount("pr102733_1", 1, 0); + assertTrue("There should be an error:\n" + getErrorMessages("pr102733_1"), !getErrorMessages("pr102733_1").isEmpty()); + build("pr102733_1"); // incremental + checkCompileWeaveCount("pr102733_1", 0, 0); + checkWasntFullBuild(); + alter("pr102733_1", "inc1"); // fix the error + build("pr102733_1"); + checkWasntFullBuild(); + checkCompileWeaveCount("pr102733_1", 1, 1); + assertTrue("There should be no errors:\n" + getErrorMessages("pr102733_1"), getErrorMessages("pr102733_1").isEmpty()); + alter("pr102733_1", "inc2"); // break it again + build("pr102733_1"); + checkWasntFullBuild(); + checkCompileWeaveCount("pr102733_1", 1, 0); + assertTrue("There should be an error:\n" + getErrorMessages("pr102733_1"), !getErrorMessages("pr102733_1").isEmpty()); + } + + // public void testDeclareAtType_pr149293() { + // configureBuildStructureModel(true); + // initialiseProject("PR149293_1"); + // build("PR149293_1"); + // checkCompileWeaveCount(4,5); + // assertNoErrors(); + // alter("PR149293_1","inc1"); + // build("PR149293_1"); + // assertNoErrors(); + // } + + public void testRefactoring_pr148285() { + // configureBuildStructureModel(true); + + initialiseProject("PR148285"); + build("PR148285"); + alter("PR148285", "inc1"); + build("PR148285"); + } + + /** + * In order for this next test to run, I had to move the weaver/world pair we keep in the AjBuildManager instance down into the + * state object - this makes perfect sense - otherwise when reusing the state for another project we'd not be switching to the + * right weaver/world for that project. + */ + public void testBuildingTwoProjectsMakingSmallChanges() { + + initialiseProject("P1"); + initialiseProject("P2"); + + build("P1"); + build("P2"); + build("P1"); + checkWasntFullBuild(); + + build("P2"); + checkWasntFullBuild(); + + alter("P1", "inc1"); // adds a class + alter("P1", "inc2"); // adds an aspect + build("P1"); + checkWasFullBuild(); // adding an aspect makes us go back to the source + } + + public void testPr134371() { + initialiseProject("PR134371"); + build("PR134371"); + alter("PR134371", "inc1"); + build("PR134371"); + assertTrue("There should be no exceptions handled:\n" + getErrorMessages("PR134371"), getErrorMessages("PR134371") + .isEmpty()); + + } + + /** + * This test is verifying the behaviour of the code that iterates through the type hierarchy for some type. There are two ways + * to do it - an approach that grabs all the information up front or an approach that works through iterators and only processes + * as much data as necessary to satisfy the caller. The latter approach could be much faster - especially if the matching + * process typically looks for a method in the declaring type. + */ + public void xtestOptimizedMemberLookup() { + String p = "oml"; + initialiseProject(p); + build(p); + + AjdeCoreBuildManager buildManager = getCompilerForProjectWithName(p).getBuildManager(); + AjBuildManager ajBuildManager = buildManager.getAjBuildManager(); + World w = ajBuildManager.getWorld(); + // Type A has no hierarchy (well, Object) and defines 3 methods + checkType(w, "com.foo.A"); + // Type B extends B2. Two methods in B2, three in B + checkType(w, "com.foo.B"); + // Type C implements an interface + checkType(w, "com.foo.C"); + // Type CC extends a class that implements an interface + checkType(w, "com.foo.CC"); + // Type CCC implements an interface that extends another interface + checkType(w, "com.foo.CCC"); + // Type CCC implements an interface that extends another interface + checkType(w, "com.foo.CCC"); + checkType(w, "GenericMethodInterface"); + checkType(w, "GenericInterfaceChain"); + + // Some random classes from rt.jar that did reveal some problems: + checkType(w, "java.lang.StringBuffer"); + checkType(w, "com.sun.corba.se.impl.encoding.CDRInputObject"); + checkTypeHierarchy(w, "com.sun.corba.se.impl.interceptors.PIHandlerImpl$RequestInfoStack", true); + checkType(w, "com.sun.corba.se.impl.interceptors.PIHandlerImpl$RequestInfoStack"); + checkType(w, "DeclareWarningAndInterfaceMethodCW"); + checkType(w, "ICanGetSomething"); + checkType(w, "B"); + checkType(w, "C"); + + // checkRtJar(w); // only works if the JDK path is setup ok in checkRtJar + + // speedCheck(w); + } + + // private void checkRtJar(World w) { + // System.out.println("Processing everything in rt.jar: ~16000 classes"); + // try { + // ZipFile zf = new ZipFile("c:/jvms/jdk1.6.0_06/jre/lib/rt.jar"); + // Enumeration e = zf.entries(); + // int count = 1; + // while (e.hasMoreElements()) { + // ZipEntry ze = (ZipEntry) e.nextElement(); + // String n = ze.getName(); + // if (n.endsWith(".class")) { + // n = n.replace('/', '.'); + // n = n.substring(0, n.length() - 6); + // if ((count % 100) == 0) { + // System.out.print(count + " "); + // } + // if ((count % 1000) == 0) { + // System.out.println(); + // } + // checkType(w, n); + // count++; + // } + // } + // zf.close(); + // } catch (IOException t) { + // t.printStackTrace(); + // fail(t.toString()); + // } + // System.out.println(); + // } + + /** + * Compare time taken to grab them all and look at them and iterator through them all. + */ + private void speedCheck(World w) { + long stime = System.currentTimeMillis(); + try { + ZipFile zf = new ZipFile("c:/jvms/jdk1.6.0_06/jre/lib/rt.jar"); + Enumeration<? extends ZipEntry> e = zf.entries(); + while (e.hasMoreElements()) { + ZipEntry ze = (ZipEntry) e.nextElement(); + String n = ze.getName(); + if (n.endsWith(".class")) { + n = n.replace('/', '.'); + n = n.substring(0, n.length() - 6); + ResolvedType typeA = w.resolve(n); + assertFalse(typeA.isMissing()); + List<ResolvedMember> viaIteratorList = getThemAll(typeA.getMethods(true, true)); + viaIteratorList = getThemAll(typeA.getMethods(false, true)); + } + } + zf.close(); + } catch (IOException t) { + t.printStackTrace(); + fail(t.toString()); + } + long etime = System.currentTimeMillis(); + System.out.println("Time taken for 'iterator' approach: " + (etime - stime) + "ms"); + stime = System.currentTimeMillis(); + try { + ZipFile zf = new ZipFile("c:/jvms/jdk1.6.0_06/jre/lib/rt.jar"); + Enumeration e = zf.entries(); + while (e.hasMoreElements()) { + ZipEntry ze = (ZipEntry) e.nextElement(); + String n = ze.getName(); + if (n.endsWith(".class")) { + n = n.replace('/', '.'); + n = n.substring(0, n.length() - 6); + ResolvedType typeA = w.resolve(n); + assertFalse(typeA.isMissing()); + List<ResolvedMember> viaIteratorList = typeA.getMethodsWithoutIterator(false, true, true); + viaIteratorList = typeA.getMethodsWithoutIterator(false, true, false); + } + } + zf.close(); + } catch (IOException t) { + t.printStackTrace(); + fail(t.toString()); + } + etime = System.currentTimeMillis(); + System.out.println("Time taken for 'grab all up front' approach: " + (etime - stime) + "ms"); + + } + + private void checkType(World w, String name) { + checkTypeHierarchy(w, name, true); + checkTypeHierarchy(w, name, false); + checkMethods(w, name, true); + checkMethods(w, name, false); + } + + private void checkMethods(World w, String name, boolean wantGenerics) { + ResolvedType typeA = w.resolve(name); + assertFalse(typeA.isMissing()); + List<ResolvedMember> viaIteratorList = getThemAll(typeA.getMethods(wantGenerics, true)); + List<ResolvedMember> directlyList = typeA.getMethodsWithoutIterator(true, true, wantGenerics); + Collections.sort(viaIteratorList, new ResolvedMemberComparator()); + Collections.sort(directlyList, new ResolvedMemberComparator()); + compare(viaIteratorList, directlyList, name); + // System.out.println(toString(viaIteratorList, directlyList, genericsAware)); + } + + private static class ResolvedMemberComparator implements Comparator<ResolvedMember> { + public int compare(ResolvedMember o1, ResolvedMember o2) { + return o1.toString().compareTo(o2.toString()); + } + } + + private void checkTypeHierarchy(World w, String name, boolean wantGenerics) { + ResolvedType typeA = w.resolve(name); + assertFalse(typeA.isMissing()); + List<String> viaIteratorList = exhaustTypeIterator(typeA.getHierarchy(wantGenerics, false)); + List<ResolvedType> typeDirectlyList = typeA.getHierarchyWithoutIterator(true, true, wantGenerics); + assertFalse(viaIteratorList.isEmpty()); + List<String> directlyList = new ArrayList<String>(); + for (ResolvedType type : typeDirectlyList) { + String n = type.getName(); + if (!directlyList.contains(n)) { + directlyList.add(n); + } + } + Collections.sort(viaIteratorList); + Collections.sort(directlyList); + compareTypeLists(viaIteratorList, directlyList); + // System.out.println("ShouldBeGenerics?" + wantGenerics + "\n" + typeListsToString(viaIteratorList, directlyList)); + } + + private void compare(List<ResolvedMember> viaIteratorList, List<ResolvedMember> directlyList, String typename) { + assertEquals(typename + "\n" + toString(directlyList), typename + "\n" + toString(viaIteratorList)); + } + + private void compareTypeLists(List<String> viaIteratorList, List<String> directlyList) { + assertEquals(typeListToString(directlyList), typeListToString(viaIteratorList)); + } + + private String toString(List<ResolvedMember> list) { + StringBuffer sb = new StringBuffer(); + for (ResolvedMember m : list) { + sb.append(m).append("\n"); + } + return sb.toString(); + } + + private String typeListToString(List<String> list) { + StringBuffer sb = new StringBuffer(); + for (String m : list) { + sb.append(m).append("\n"); + } + return sb.toString(); + } + + private String toString(List<ResolvedMember> one, List<ResolvedMember> two, boolean shouldIncludeGenerics) { + StringBuffer sb = new StringBuffer(); + sb.append("Through iterator\n"); + for (ResolvedMember m : one) { + sb.append(m).append("\n"); + } + sb.append("Directly retrieved\n"); + for (ResolvedMember m : one) { + sb.append(m).append("\n"); + } + return sb.toString(); + } + + private String typeListsToString(List<String> one, List<String> two) { + StringBuffer sb = new StringBuffer(); + sb.append("Through iterator\n"); + for (String m : one) { + sb.append(">" + m).append("\n"); + } + sb.append("Directly retrieved\n"); + for (String m : one) { + sb.append(">" + m).append("\n"); + } + return sb.toString(); + } + + private List<ResolvedMember> getThemAll(Iterator<ResolvedMember> methods) { + List<ResolvedMember> allOfThem = new ArrayList<ResolvedMember>(); + while (methods.hasNext()) { + allOfThem.add(methods.next()); + } + return allOfThem; + } + + private List<String> exhaustTypeIterator(Iterator<ResolvedType> types) { + List<String> allOfThem = new ArrayList<String>(); + while (types.hasNext()) { + allOfThem.add(types.next().getName()); + } + return allOfThem; + } + + /** + * Setup up two simple projects and build them in turn - check the structure model is right after each build + */ + public void testBuildingTwoProjectsAndVerifyingModel() { + initialiseProject("P1"); + initialiseProject("P2"); + configureNonStandardCompileOptions("P1", "-Xset:minimalModel=false"); + configureNonStandardCompileOptions("P2", "-Xset:minimalModel=false"); + + build("P1"); + checkForNode(getModelFor("P1"), "pkg", "C", true); + + build("P2"); + checkForNode(getModelFor("P2"), "pkg", "C", false); + + build("P1"); + checkForNode(getModelFor("P1"), "pkg", "C", true); + + build("P2"); + checkForNode(getModelFor("P2"), "pkg", "C", false); + } + + // Setup up two simple projects and build them in turn - check the + // structure model is right after each build + public void testBuildingTwoProjectsAndVerifyingStuff() { + initialiseProject("P1"); + initialiseProject("P2"); + configureNonStandardCompileOptions("P1", "-Xset:minimalModel=false"); + configureNonStandardCompileOptions("P2", "-Xset:minimalModel=false"); + + build("P1"); + checkForNode(getModelFor("P1"), "pkg", "C", true); + + build("P2"); + checkForNode(getModelFor("P2"), "pkg", "C", false); + + build("P1"); + checkForNode(getModelFor("P1"), "pkg", "C", true); + + build("P2"); + checkForNode(getModelFor("P2"), "pkg", "C", false); + } + + /** + * Complex. Here we are testing that a state object records structural changes since the last full build correctly. We build a + * simple project from scratch - this will be a full build and so the structural changes since last build count should be 0. We + * then alter a class, adding a new method and check structural changes is 1. + */ + public void testStateManagement1() { + + File binDirectoryForP1 = new File(getFile("P1", "bin")); + + initialiseProject("P1"); + build("P1"); // full build + AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(binDirectoryForP1); + assertTrue("There should be a state object for project P1", ajs != null); + assertTrue( + "Should be no structural changes as it was a full build but found: " + + ajs.getNumberOfStructuralChangesSinceLastFullBuild(), + ajs.getNumberOfStructuralChangesSinceLastFullBuild() == 0); + + alter("P1", "inc3"); // adds a method to the class C.java + build("P1"); + checkWasntFullBuild(); + ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("P1", "bin"))); + assertTrue("There should be state for project P1", ajs != null); + checkWasntFullBuild(); + assertTrue( + "Should be one structural changes as it was a full build but found: " + + ajs.getNumberOfStructuralChangesSinceLastFullBuild(), + ajs.getNumberOfStructuralChangesSinceLastFullBuild() == 1); + + } + + /** + * Complex. Here we are testing that a state object records structural changes since the last full build correctly. We build a + * simple project from scratch - this will be a full build and so the structural changes since last build count should be 0. We + * then alter a class, changing body of a method, not the structure and check struc changes is still 0. + */ + public void testStateManagement2() { + File binDirectoryForP1 = new File(getFile("P1", "bin")); + + initialiseProject("P1"); + alter("P1", "inc3"); // need this change in here so 'inc4' can be + // applied without making + // it a structural change + build("P1"); // full build + AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(binDirectoryForP1); + assertTrue("There should be state for project P1", ajs != null); + assertTrue("Should be no struc changes as its a full build: " + ajs.getNumberOfStructuralChangesSinceLastFullBuild(), + ajs.getNumberOfStructuralChangesSinceLastFullBuild() == 0); + + alter("P1", "inc4"); // changes body of main() method but does *not* + // change the structure of C.java + build("P1"); + checkWasntFullBuild(); + ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("P1", "bin"))); + assertTrue("There should be state for project P1", ajs != null); + checkWasntFullBuild(); + assertTrue("Shouldn't be any structural changes but there were " + ajs.getNumberOfStructuralChangesSinceLastFullBuild(), + ajs.getNumberOfStructuralChangesSinceLastFullBuild() == 0); + } + + /** + * The C.java file modified in this test has an inner class - this means the inner class has a this$0 field and <init>(C) ctor + * to watch out for when checking for structural changes + * + */ + public void testStateManagement3() { + File binDirForInterproject1 = new File(getFile("interprojectdeps1", "bin")); + + initialiseProject("interprojectdeps1"); + build("interprojectdeps1"); // full build + AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(binDirForInterproject1); + assertTrue("There should be state for project P1", ajs != null); + assertTrue("Should be no struc changes as its a full build: " + ajs.getNumberOfStructuralChangesSinceLastFullBuild(), + ajs.getNumberOfStructuralChangesSinceLastFullBuild() == 0); + + alter("interprojectdeps1", "inc1"); // adds a space to C.java + build("interprojectdeps1"); + checkWasntFullBuild(); + ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("interprojectdeps1", "bin"))); + assertTrue("There should be state for project interprojectdeps1", ajs != null); + checkWasntFullBuild(); + assertTrue("Shouldn't be any structural changes but there were " + ajs.getNumberOfStructuralChangesSinceLastFullBuild(), + ajs.getNumberOfStructuralChangesSinceLastFullBuild() == 0); + } + + /** + * The C.java file modified in this test has an inner class - which has two ctors - this checks how they are mangled with an + * instance of C. + * + */ + public void testStateManagement4() { + File binDirForInterproject2 = new File(getFile("interprojectdeps2", "bin")); + + initialiseProject("interprojectdeps2"); + build("interprojectdeps2"); // full build + AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(binDirForInterproject2); + assertTrue("There should be state for project interprojectdeps2", ajs != null); + assertTrue("Should be no struc changes as its a full build: " + ajs.getNumberOfStructuralChangesSinceLastFullBuild(), + ajs.getNumberOfStructuralChangesSinceLastFullBuild() == 0); + + alter("interprojectdeps2", "inc1"); // minor change to C.java + build("interprojectdeps2"); + checkWasntFullBuild(); + ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("interprojectdeps2", "bin"))); + assertTrue("There should be state for project interprojectdeps1", ajs != null); + checkWasntFullBuild(); + assertTrue("Shouldn't be any structural changes but there were " + ajs.getNumberOfStructuralChangesSinceLastFullBuild(), + ajs.getNumberOfStructuralChangesSinceLastFullBuild() == 0); + } + + /** + * The C.java file modified in this test has an inner class - it has two ctors but also a reference to C.this in it - which will + * give rise to an accessor being created in C + * + */ + public void testStateManagement5() { + File binDirForInterproject3 = new File(getFile("interprojectdeps3", "bin")); + + initialiseProject("interprojectdeps3"); + build("interprojectdeps3"); // full build + AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(binDirForInterproject3); + assertTrue("There should be state for project interprojectdeps3", ajs != null); + assertTrue("Should be no struc changes as its a full build: " + ajs.getNumberOfStructuralChangesSinceLastFullBuild(), + ajs.getNumberOfStructuralChangesSinceLastFullBuild() == 0); + + alter("interprojectdeps3", "inc1"); // minor change to C.java + build("interprojectdeps3"); + checkWasntFullBuild(); + ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("interprojectdeps3", "bin"))); + assertTrue("There should be state for project interprojectdeps1", ajs != null); + checkWasntFullBuild(); + assertTrue("Shouldn't be any structural changes but there were " + ajs.getNumberOfStructuralChangesSinceLastFullBuild(), + ajs.getNumberOfStructuralChangesSinceLastFullBuild() == 0); + } + + /** + * Now the most complex test. Create a dependancy between two projects. Building one may affect whether the other does an + * incremental or full build. The structural information recorded in the state object should be getting used to control whether + * a full build is necessary... + */ + public void testBuildingDependantProjects() { + initialiseProject("P1"); + initialiseProject("P2"); + configureNewProjectDependency("P2", "P1"); + + build("P1"); + build("P2"); // now everything is consistent and compiled + alter("P1", "inc1"); // adds a second class + build("P1"); + build("P2"); // although a second class was added - P2 can't be using + // it, so we don't full build here :) + checkWasntFullBuild(); + alter("P1", "inc3"); // structurally changes one of the classes + build("P1"); + build("P2"); // build notices the structural change, but is incremental + // of I and J as they depend on C + checkWasntFullBuild(); + alter("P1", "inc4"); + build("P1"); + build("P2"); // build sees a change but works out its not structural + checkWasntFullBuild(); + } + + public void testPr85132() { + initialiseProject("PR85132"); + build("PR85132"); + alter("PR85132", "inc1"); + build("PR85132"); + } + + // parameterization of generic aspects + public void testPr125405() { + initialiseProject("PR125405"); + build("PR125405"); + checkCompileWeaveCount("PR125405", 1, 1); + alter("PR125405", "inc1"); + build("PR125405"); + // "only abstract aspects can have type parameters" + checkForError("PR125405", "only abstract aspects can have type parameters"); + alter("PR125405", "inc2"); + build("PR125405"); + checkCompileWeaveCount("PR125405", 1, 1); + assertTrue("Should be no errors, but got " + getErrorMessages("PR125405"), getErrorMessages("PR125405").size() == 0); + } + + public void testPr128618() { + initialiseProject("PR128618_1"); + initialiseProject("PR128618_2"); + configureNewProjectDependency("PR128618_2", "PR128618_1"); + assertTrue("there should be no warning messages before we start", getWarningMessages("PR128618_1").isEmpty()); + assertTrue("there should be no warning messages before we start", getWarningMessages("PR128618_2").isEmpty()); + + build("PR128618_1"); + build("PR128618_2"); + List<IMessage> l = getWarningMessages("PR128618_2"); + + // there should be one warning against "PR128618_2" + List<IMessage> warnings = getWarningMessages("PR128618_2"); + assertTrue("Should be one warning, but there are #" + warnings.size(), warnings.size() == 1); + IMessage msg = (getWarningMessages("PR128618_2").get(0)); + assertEquals("warning should be against the FFDC.aj resource", "FFDC.aj", msg.getSourceLocation().getSourceFile().getName()); + + alter("PR128618_2", "inc1"); + build("PR128618_2"); + + checkWasntFullBuild(); + IMessage msg2 = (getWarningMessages("PR128618_2").get(0)); + assertEquals("warning should be against the FFDC.aj resource", "FFDC.aj", msg2.getSourceLocation().getSourceFile() + .getName()); + assertFalse("a new warning message should have been generated", msg.equals(msg2)); + } + + public void testPr92837() { + initialiseProject("PR92837"); + build("PR92837"); + alter("PR92837", "inc1"); + build("PR92837"); + } + + // See open generic itd bug mentioning 119570 + // public void testPr119570() { + // initialiseProject("PR119570"); + // build("PR119570"); + // assertNoErrors("PR119570"); + // } + + // public void testPr119570_212783_2() { + // initialiseProject("PR119570_2"); + // build("PR119570_2"); + // List l = getWarningMessages("PR119570_2"); + // assertTrue("Should be no warnings, but got "+l,l.size()==0); + // assertNoErrors("PR119570_2"); + // } + // + // public void testPr119570_212783_3() { + // initialiseProject("pr119570_3"); + // build("pr119570_3"); + // List l = getWarningMessages("pr119570_3"); + // assertTrue("Should be no warnings, but got "+l,l.size()==0); + // assertNoErrors("pr119570_3"); + // } + + // If you fiddle with the compiler options - you must manually reset the + // options at the end of the test + public void testPr117209() { + try { + initialiseProject("pr117209"); + configureNonStandardCompileOptions("pr117209", "-proceedOnError"); + build("pr117209"); + checkCompileWeaveCount("pr117209", 6, 5); + } finally { + // MyBuildOptionsAdapter.reset(); + } + } + + public void testPr114875() { + // temporary problem with this on linux, think it is a filesystem + // lastmodtime issue + if (System.getProperty("os.name", "").toLowerCase().equals("linux")) { + return; + } + initialiseProject("pr114875"); + build("pr114875"); + alter("pr114875", "inc1"); + build("pr114875"); + checkWasFullBuild(); + alter("pr114875", "inc2"); + build("pr114875"); + checkWasFullBuild(); // back to the source for an aspect change + } + + public void testPr117882() { + // AjdeInteractionTestbed.VERBOSE=true; + // AjdeInteractionTestbed.configureBuildStructureModel(true); + initialiseProject("PR117882"); + build("PR117882"); + checkWasFullBuild(); + alter("PR117882", "inc1"); + build("PR117882"); + // This should be an incremental build now - because of the changes + // under 259649 + checkWasntFullBuild(); // back to the source for an aspect + // AjdeInteractionTestbed.VERBOSE=false; + // AjdeInteractionTestbed.configureBuildStructureModel(false); + } + + public void testPr117882_2() { + // AjdeInteractionTestbed.VERBOSE=true; + // AjdeInteractionTestbed.configureBuildStructureModel(true); + initialiseProject("PR117882_2"); + build("PR117882_2"); + checkWasFullBuild(); + alter("PR117882_2", "inc1"); + build("PR117882_2"); + checkWasFullBuild(); // back to the source... + // checkCompileWeaveCount(1,4); + // fullBuild("PR117882_2"); + // checkWasFullBuild(); + // AjdeInteractionTestbed.VERBOSE=false; + // AjdeInteractionTestbed.configureBuildStructureModel(false); + } + + public void testPr115251() { + // AjdeInteractionTestbed.VERBOSE=true; + initialiseProject("PR115251"); + build("PR115251"); + checkWasFullBuild(); + alter("PR115251", "inc1"); + build("PR115251"); + checkWasFullBuild(); // back to the source + } + + public void testPr220255_InfiniteBuildHasMember() { + initialiseProject("pr220255"); + configureNonStandardCompileOptions("pr220255", "-XhasMember"); + build("pr220255"); + checkWasFullBuild(); + alter("pr220255", "inc1"); + build("pr220255"); + checkWasntFullBuild(); + } + + public void testPr157054() { + initialiseProject("PR157054"); + configureNonStandardCompileOptions("PR157054", "-showWeaveInfo"); + configureShowWeaveInfoMessages("PR157054", true); + build("PR157054"); + checkWasFullBuild(); + List<IMessage> weaveMessages = getWeavingMessages("PR157054"); + assertTrue("Should be two weaving messages but there are " + weaveMessages.size(), weaveMessages.size() == 2); + alter("PR157054", "inc1"); + build("PR157054"); + weaveMessages = getWeavingMessages("PR157054"); + assertTrue("Should be three weaving messages but there are " + weaveMessages.size(), weaveMessages.size() == 3); + checkWasntFullBuild(); + fullBuild("PR157054"); + weaveMessages = getWeavingMessages("PR157054"); + assertTrue("Should be three weaving messages but there are " + weaveMessages.size(), weaveMessages.size() == 3); + } + + /** + * Checks we aren't leaking mungers across compiles (accumulating multiple instances of the same one that all do the same + * thing). On the first compile the munger is added late on - so at the time we set the count it is still zero. On the + * subsequent compiles we know about this extra one. + */ + public void testPr141956_IncrementallyCompilingAtAj() { + initialiseProject("PR141956"); + build("PR141956"); + assertTrue("Should be zero but reports " + EclipseFactory.debug_mungerCount, EclipseFactory.debug_mungerCount == 0); + alter("PR141956", "inc1"); + build("PR141956"); + assertTrue("Should be two but reports " + EclipseFactory.debug_mungerCount, EclipseFactory.debug_mungerCount == 2); + alter("PR141956", "inc1"); + build("PR141956"); + assertTrue("Should be two but reports " + EclipseFactory.debug_mungerCount, EclipseFactory.debug_mungerCount == 2); + alter("PR141956", "inc1"); + build("PR141956"); + assertTrue("Should be two but reports " + EclipseFactory.debug_mungerCount, EclipseFactory.debug_mungerCount == 2); + alter("PR141956", "inc1"); + build("PR141956"); + assertTrue("Should be two but reports " + EclipseFactory.debug_mungerCount, EclipseFactory.debug_mungerCount == 2); + } + + // public void testPr124399() { + // AjdeInteractionTestbed.VERBOSE=true; + // configureBuildStructureModel(true); + // initialiseProject("PR124399"); + // build("PR124399"); + // checkWasFullBuild(); + // alter("PR124399","inc1"); + // build("PR124399"); + // checkWasntFullBuild(); + // } + + public void testPr121384() { + // AjdeInteractionTestbed.VERBOSE=true; + // AsmManager.setReporting("c:/foo.txt",true,true,true,false); + initialiseProject("pr121384"); + configureNonStandardCompileOptions("pr121384", "-showWeaveInfo"); + build("pr121384"); + checkWasFullBuild(); + alter("pr121384", "inc1"); + build("pr121384"); + checkWasntFullBuild(); + } + + /* + * public void testPr111779() { super.VERBOSE=true; initialiseProject("PR111779"); build("PR111779"); alter("PR111779","inc1"); + * build("PR111779"); } + */ + + public void testPr93310_1() { + initialiseProject("PR93310_1"); + build("PR93310_1"); + checkWasFullBuild(); + String fileC2 = getWorkingDir().getAbsolutePath() + File.separatorChar + "PR93310_1" + File.separatorChar + "src" + + File.separatorChar + "pack" + File.separatorChar + "C2.java"; + (new File(fileC2)).delete(); + alter("PR93310_1", "inc1"); + build("PR93310_1"); + checkWasFullBuild(); + int l = AjdeInteractionTestbed.MyStateListener.detectedDeletions.size(); + assertTrue("Expected one deleted file to be noticed, but detected: " + l, l == 1); + String name = (String) AjdeInteractionTestbed.MyStateListener.detectedDeletions.get(0); + assertTrue("Should end with C2.java but is " + name, name.endsWith("C2.java")); + } + + public void testPr93310_2() { + initialiseProject("PR93310_2"); + build("PR93310_2"); + checkWasFullBuild(); + String fileC2 = getWorkingDir().getAbsolutePath() + File.separatorChar + "PR93310_2" + File.separatorChar + "src" + + File.separatorChar + "pack" + File.separatorChar + "C2.java"; + (new File(fileC2)).delete(); + alter("PR93310_2", "inc1"); + build("PR93310_2"); + checkWasFullBuild(); + int l = AjdeInteractionTestbed.MyStateListener.detectedDeletions.size(); + assertTrue("Expected one deleted file to be noticed, but detected: " + l, l == 1); + String name = (String) AjdeInteractionTestbed.MyStateListener.detectedDeletions.get(0); + assertTrue("Should end with C2.java but is " + name, name.endsWith("C2.java")); + } + + // Stage1: Compile two files, pack.A and pack.A1 - A1 sets a protected field + // in A. + // Stage2: make the field private in class A > gives compile error + // Stage3: Add a new aspect whilst there is a compile error ! + public void testPr113531() { + initialiseProject("PR113531"); + build("PR113531"); + assertTrue("build should have compiled ok", getErrorMessages("PR113531").isEmpty()); + alter("PR113531", "inc1"); + build("PR113531"); + assertEquals("error message should be 'foo cannot be resolved to a variable' ", "foo cannot be resolved to a variable", + (getErrorMessages("PR113531").get(0)).getMessage()); + alter("PR113531", "inc2"); + build("PR113531"); + assertTrue("There should be no exceptions handled:\n" + getCompilerErrorMessages("PR113531"), + getCompilerErrorMessages("PR113531").isEmpty()); + assertEquals("error message should be 'foo cannot be resolved to a variable' ", "foo cannot be resolved to a variable", + (getErrorMessages("PR113531").get(0)).getMessage()); + } + + // Stage 1: Compile the 4 files, pack.A2 extends pack.A1 (aspects) where + // A2 uses a protected field in A1 and pack.C2 extends pack.C1 (classes) + // where C2 uses a protected field in C1 + // Stage 2: make the field private in class C1 ==> compile errors in C2 + // Stage 3: make the field private in aspect A1 whilst there's the compile + // error. + // There shouldn't be a BCException saying can't find delegate for pack.C2 + public void testPr119882() { + initialiseProject("PR119882"); + build("PR119882"); + assertTrue("build should have compiled ok", getErrorMessages("PR119882").isEmpty()); + alter("PR119882", "inc1"); + build("PR119882"); + // fullBuild("PR119882"); + List<IMessage> errors = getErrorMessages("PR119882"); + assertTrue("Should be at least one error, but got none", errors.size() == 1); + assertEquals("error message should be 'i cannot be resolved to a variable' ", "i cannot be resolved to a variable", + ((IMessage) errors.get(0)).getMessage()); + alter("PR119882", "inc2"); + build("PR119882"); + assertTrue("There should be no exceptions handled:\n" + getCompilerErrorMessages("PR119882"), + getCompilerErrorMessages("PR119882").isEmpty()); + assertEquals("error message should be 'i cannot be resolved to a variable' ", "i cannot be resolved to a variable", + ((IMessage) errors.get(0)).getMessage()); + + } + + public void testPr112736() { + initialiseProject("PR112736"); + build("PR112736"); + checkWasFullBuild(); + String fileC2 = getWorkingDir().getAbsolutePath() + File.separatorChar + "PR112736" + File.separatorChar + "src" + + File.separatorChar + "pack" + File.separatorChar + "A.java"; + (new File(fileC2)).delete(); + alter("PR112736", "inc1"); + build("PR112736"); + checkWasFullBuild(); + } + + /** + * We have problems with multiple rewrites of a pointcut across incremental builds. + */ + public void testPr113257() { + initialiseProject("PR113257"); + build("PR113257"); + alter("PR113257", "inc1"); + build("PR113257"); + checkWasFullBuild(); // back to the source + alter("PR113257", "inc1"); + build("PR113257"); + } + + public void testPr123612() { + initialiseProject("PR123612"); + build("PR123612"); + alter("PR123612", "inc1"); + build("PR123612"); + checkWasFullBuild(); // back to the source + } + + // Bugzilla Bug 152257 - Incremental compiler doesn't handle exception + // declaration correctly + public void testPr152257() { + initialiseProject("PR152257"); + configureNonStandardCompileOptions("PR152257", "-XnoInline"); + build("PR152257"); + List<IMessage> errors = getErrorMessages("PR152257"); + assertTrue("Should be no warnings, but there are #" + errors.size(), errors.size() == 0); + checkWasFullBuild(); + alter("PR152257", "inc1"); + build("PR152257"); + errors = getErrorMessages("PR152257"); + assertTrue("Should be no warnings, but there are #" + errors.size(), errors.size() == 0); + checkWasntFullBuild(); + } + + public void testPr128655() { + initialiseProject("pr128655"); + configureNonStandardCompileOptions("pr128655", "-showWeaveInfo"); + configureShowWeaveInfoMessages("pr128655", true); + build("pr128655"); + List<IMessage> firstBuildMessages = getWeavingMessages("pr128655"); + assertTrue("Should be at least one message about the dec @type, but there were none", firstBuildMessages.size() > 0); + alter("pr128655", "inc1"); + build("pr128655"); + checkWasntFullBuild(); // back to the source + List<IMessage> secondBuildMessages = getWeavingMessages("pr128655"); + // check they are the same + for (int i = 0; i < firstBuildMessages.size(); i++) { + IMessage m1 = (IMessage) firstBuildMessages.get(i); + IMessage m2 = (IMessage) secondBuildMessages.get(i); + if (!m1.toString().equals(m2.toString())) { + System.err.println("Message during first build was: " + m1); + System.err.println("Message during second build was: " + m1); + fail("The two messages should be the same, but are not: \n" + m1 + "!=" + m2); + } + } + } + + // Similar to above, but now the annotation is in the default package + public void testPr128655_2() { + initialiseProject("pr128655_2"); + configureNonStandardCompileOptions("pr128655_2", "-showWeaveInfo"); + configureShowWeaveInfoMessages("pr128655_2", true); + build("pr128655_2"); + List<IMessage> firstBuildMessages = getWeavingMessages("pr128655_2"); + assertTrue("Should be at least one message about the dec @type, but there were none", firstBuildMessages.size() > 0); + alter("pr128655_2", "inc1"); + build("pr128655_2"); + checkWasntFullBuild(); // back to the source + List<IMessage> secondBuildMessages = getWeavingMessages("pr128655_2"); + // check they are the same + for (int i = 0; i < firstBuildMessages.size(); i++) { + IMessage m1 = (IMessage) firstBuildMessages.get(i); + IMessage m2 = (IMessage) secondBuildMessages.get(i); + if (!m1.toString().equals(m2.toString())) { + System.err.println("Message during first build was: " + m1); + System.err.println("Message during second build was: " + m1); + fail("The two messages should be the same, but are not: \n" + m1 + "!=" + m2); + } + } + } + + // test for comment #31 - NPE + public void testPr129163() { + initialiseProject("PR129613"); + build("PR129613"); + alter("PR129613", "inc1"); + build("PR129613"); + assertTrue("There should be no exceptions handled:\n" + getCompilerErrorMessages("PR129613"), + getCompilerErrorMessages("PR129613").isEmpty()); + assertEquals("warning message should be 'no match for this type name: File [Xlint:invalidAbsoluteTypeName]' ", + "no match for this type name: File [Xlint:invalidAbsoluteTypeName]", + (getWarningMessages("PR129613").get(0)).getMessage()); + } + + // test for comment #0 - adding a comment to a class file shouldn't + // cause us to go back to source and recompile everything. To force this + // to behave like AJDT we need to include the aspect in 'inc1' so that + // when AjState looks at its timestamp it thinks the aspect has been + // modified. + // The logic within CrosscuttingMembers should then work out correctly + // that there haven't really been any changes within the aspect and so + // we shouldn't go back to source. + public void testPr129163_2() { + // want to behave like AJDT + initialiseProject("pr129163_2"); + build("pr129163_2"); + checkWasFullBuild(); + alter("pr129163_2", "inc1"); + build("pr129163_2"); + checkWasntFullBuild(); // shouldn't be a full build because the + // aspect hasn't changed + } + + public void testIncrementalIntelligence_Scenario01() { + AjdeInteractionTestbed.VERBOSE = true; + initialiseProject("Project1"); + initialiseProject("Project2"); + configureNewProjectDependency("Project2", "Project1"); + build("Project1"); + build("Project2"); + + alter("Project1", "inc1"); // white space change to ClassA - no impact + build("Project1"); + build("Project2"); + checkWasntFullBuild(); // not a structural change so ignored + + alter("Project1", "inc2"); // structural change to ClassB - new method! + build("Project1"); + build("Project2"); + checkWasntFullBuild(); // not a type that Project2 depends on so ignored + + alter("Project1", "inc3"); // structural change to ClassA + build("Project1"); + setNextChangeResponse("Project2", ICompilerConfiguration.EVERYTHING); // See + // pr245566 + // comment + // 3 + build("Project2"); + checkWasntFullBuild(); // Just need to recompile ClassAExtender + checkCompileWeaveCount("Project2", 1, 1); + checkCompiled("Project2", "ClassAExtender"); + + alter("Project2", "inc1"); // New type that depends on ClassAExtender + build("Project1"); + build("Project2"); + checkWasntFullBuild(); // Just build ClassAExtenderExtender + + alter("Project1", "inc4"); // another structural change to ClassA + build("Project1"); + setNextChangeResponse("Project2", ICompilerConfiguration.EVERYTHING); // See + // pr245566 + // comment + // 3 + build("Project2"); + checkWasntFullBuild(); // Should rebuild ClassAExtender and + // ClassAExtenderExtender + checkCompileWeaveCount("Project2", 2, 2); + checkCompiled("Project2", "ClassAExtenderExtender"); + + } + + private void checkCompiled(String projectName, String typeNameSubstring) { + List<String> files = getCompiledFiles(projectName); + boolean found = false; + for (String object: files) { + if (object.indexOf(typeNameSubstring) != -1) { + found = true; + } + } + assertTrue("Did not find '" + typeNameSubstring + "' in list of compiled files", found); + } + + // Case001: renaming a private field in a type + /* + * public void testPrReducingDependentBuilds_001_221427() { AjdeInteractionTestbed.VERBOSE=true; + * IncrementalStateManager.debugIncrementalStates=true; initialiseProject("P221427_1"); initialiseProject("P221427_2"); + * configureNewProjectDependency("P221427_2","P221427_1"); + * + * build("P221427_1"); build("P221427_2"); alter("P221427_1","inc1"); // rename private class in super project + * MyStateListener.reset(); build("P221427_1"); build("P221427_2"); + * + * AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("P221427_1","bin"))); + * assertTrue("There should be state for project P221427_1",ajs!=null); + * //System.out.println(MyStateListener.getInstance().getDecisions()); checkWasntFullBuild(); + * assertTrue("Should be one structural change but there were "+ ajs.getNumberOfStructuralChangesSinceLastFullBuild(), + * ajs.getNumberOfStructuralChangesSinceLastFullBuild()==1); + * + * } + * + * // Case002: changing a class to final that is extended in a dependent project public void + * testPrReducingDependentBuilds_002_221427() { AjdeInteractionTestbed.VERBOSE=true; + * IncrementalStateManager.debugIncrementalStates=true; initialiseProject("P221427_3"); initialiseProject("P221427_4"); + * configureNewProjectDependency("P221427_4","P221427_3"); + * + * build("P221427_3"); build("P221427_4"); // build OK, type in super project is non-final alter("P221427_3","inc1"); // change + * class declaration in super-project to final MyStateListener.reset(); build("P221427_3"); build("P221427_4"); // build FAIL, + * type in super project is now final + * + * AjState ajs = IncrementalStateManager.findStateManagingOutputLocation(new File(getFile("P221427_3","bin"))); + * assertTrue("There should be state for project P221427_3",ajs!=null); + * System.out.println(MyStateListener.getInstance().getDecisions()); + * + * List errors = getErrorMessages("P221427_4"); if (errors.size()!=1) { if (errors.size()==0) + * fail("Expected error about not being able to extend final class"); for (Iterator iterator = errors.iterator(); + * iterator.hasNext();) { Object object = (Object) iterator.next(); System.out.println(object); } + * fail("Expected 1 error but got "+errors.size()); } // assertTrue("Shouldn't be one structural change but there were "+ // + * ajs.getNumberOfStructuralChangesSinceLastFullBuild(), // ajs.getNumberOfStructuralChangesSinceLastFullBuild()==1); + * + * } + */ + // test for comment #6 - simulates AJDT core builder test testBug99133a - + // changing the contents of a method within a class shouldn't force a + // full build of a dependant project. To force this to behave like AJDT + // 'inc1' of the dependant project should just be a copy of 'base' so that + // AjState thinks somethings changed within the dependant project and + // we do a build. Similarly, 'inc1' of the project depended on should + // include the aspect even though nothing's changed within it. This causes + // AjState to think that the aspect has changed. Together its then up to + // logic within CrosscuttingMembers and various equals methods to decide + // correctly that we don't have to go back to source. + public void testPr129163_3() { + initialiseProject("PR129163_4"); + build("PR129163_4"); + checkWasFullBuild(); // should be a full build because initializing + // project + initialiseProject("PR129163_3"); + configureNewProjectDependency("PR129163_3", "PR129163_4"); + build("PR129163_3"); + checkWasFullBuild(); // should be a full build because initializing + // project + alter("PR129163_4", "inc1"); + build("PR129163_4"); + checkWasntFullBuild(); // should be an incremental build because + // although + // "inc1" includes the aspect A1.aj, it actually hasn't + // changed so we shouldn't go back to source + alter("PR129163_3", "inc1"); + build("PR129163_3"); + checkWasntFullBuild(); // should be an incremental build because nothing + // has + // changed within the class and no aspects have changed + // within the running of the test + } + + public void testPr133117() { + // System.gc(); + // System.exit(); + initialiseProject("PR133117"); + configureNonStandardCompileOptions("PR133117", "-Xlint:warning"); + build("PR133117"); + assertTrue("There should only be one xlint warning message reported:\n" + getWarningMessages("PR133117"), + getWarningMessages("PR133117").size() == 1); + alter("PR133117", "inc1"); + build("PR133117"); + List<IMessage> warnings = getWarningMessages("PR133117"); + List<IMessage> noGuardWarnings = new ArrayList<>(); + for (IMessage warning: warnings) { + if (warning.getMessage().indexOf("Xlint:noGuardForLazyTjp") != -1) { + noGuardWarnings.add(warning); + } + } + assertTrue("There should only be two Xlint:noGuardForLazyTjp warning message reported:\n" + noGuardWarnings, + noGuardWarnings.size() == 2); + } + + public void testPr131505() { + initialiseProject("PR131505"); + configureNonStandardCompileOptions("PR131505", "-outxml"); + build("PR131505"); + checkWasFullBuild(); + String outputDir = getWorkingDir().getAbsolutePath() + File.separatorChar + "PR131505" + File.separatorChar + "bin"; + // aop.xml file shouldn't contain any aspects + checkXMLAspectCount("PR131505", "", 0, outputDir); + // add a new aspect A which should be included in the aop.xml file + alter("PR131505", "inc1"); + build("PR131505"); + checkWasFullBuild(); + checkXMLAspectCount("PR131505", "", 1, outputDir); + checkXMLAspectCount("PR131505", "A", 1, outputDir); + // make changes to the class file which shouldn't affect the contents + // of the aop.xml file + alter("PR131505", "inc2"); + build("PR131505"); + checkWasntFullBuild(); + checkXMLAspectCount("PR131505", "", 1, outputDir); + checkXMLAspectCount("PR131505", "A", 1, outputDir); + // add another new aspect A1 which should also be included in the + // aop.xml file + // ...there should be no duplicate entries in the file + alter("PR131505", "inc3"); + build("PR131505"); + checkWasFullBuild(); + checkXMLAspectCount("PR131505", "", 2, outputDir); + checkXMLAspectCount("PR131505", "A1", 1, outputDir); + checkXMLAspectCount("PR131505", "A", 1, outputDir); + // delete aspect A1 which meanss that aop.xml file should only contain A + File a1 = new File(getWorkingDir().getAbsolutePath() + File.separatorChar + "PR131505" + File.separatorChar + "A1.aj"); + a1.delete(); + build("PR131505"); + checkWasFullBuild(); + checkXMLAspectCount("PR131505", "", 1, outputDir); + checkXMLAspectCount("PR131505", "A1", 0, outputDir); + checkXMLAspectCount("PR131505", "A", 1, outputDir); + // add another aspect called A which is in a different package, both A + // and pkg.A should be included in the aop.xml file + alter("PR131505", "inc4"); + build("PR131505"); + checkWasFullBuild(); + checkXMLAspectCount("PR131505", "", 2, outputDir); + checkXMLAspectCount("PR131505", "A", 1, outputDir); + checkXMLAspectCount("PR131505", "pkg.A", 1, outputDir); + } + + public void testPr136585() { + initialiseProject("PR136585"); + build("PR136585"); + alter("PR136585", "inc1"); + build("PR136585"); + assertTrue("There should be no errors reported:\n" + getErrorMessages("PR136585"), getErrorMessages("PR136585").isEmpty()); + } + + public void testPr133532() { + initialiseProject("PR133532"); + build("PR133532"); + alter("PR133532", "inc1"); + build("PR133532"); + alter("PR133532", "inc2"); + build("PR133532"); + assertTrue("There should be no errors reported:\n" + getErrorMessages("PR133532"), getErrorMessages("PR133532").isEmpty()); + } + + public void testPr133532_2() { + initialiseProject("pr133532_2"); + build("pr133532_2"); + alter("pr133532_2", "inc2"); + build("pr133532_2"); + assertTrue("There should be no errors reported:\n" + getErrorMessages("pr133532_2"), getErrorMessages("pr133532_2") + .isEmpty()); + String decisions = AjdeInteractionTestbed.MyStateListener.getDecisions(); + String expect = "Need to recompile 'A.aj'"; + assertTrue("Couldn't find build decision: '" + expect + "' in the list of decisions made:\n" + decisions, + decisions.indexOf(expect) != -1); + } + + public void testPr133532_3() { + initialiseProject("PR133532_3"); + build("PR133532_3"); + alter("PR133532_3", "inc1"); + build("PR133532_3"); + assertTrue("There should be no errors reported:\n" + getErrorMessages("PR133532_3"), getErrorMessages("PR133532_3") + .isEmpty()); + } + + public void testPr134541() { + initialiseProject("PR134541"); + build("PR134541"); + assertEquals("[Xlint:adviceDidNotMatch] should be associated with line 5", 5, (getWarningMessages("PR134541").get(0)) + .getSourceLocation().getLine()); + alter("PR134541", "inc1"); + build("PR134541"); + // if (getModelFor("PR134541").getHandleProvider().dependsOnLocation()) + // checkWasFullBuild(); // the line number has changed... but nothing + // // structural about the code + // else + checkWasntFullBuild(); // the line number has changed... but nothing + // structural about the code + assertEquals("[Xlint:adviceDidNotMatch] should now be associated with line 7", 7, (getWarningMessages("PR134541").get(0)) + .getSourceLocation().getLine()); + } + + public void testJDTLikeHandleProviderWithLstFile_pr141730() { + // IElementHandleProvider handleProvider = + // AsmManager.getDefault().getHandleProvider(); + // AsmManager.getDefault().setHandleProvider(new + // JDTLikeHandleProvider()); + // try { + // The JDTLike-handles should start with the name + // of the buildconfig file + initialiseProject("JDTLikeHandleProvider"); + build("JDTLikeHandleProvider"); + IHierarchy top = getModelFor("JDTLikeHandleProvider").getHierarchy(); + IProgramElement pe = top.findElementForType("pkg", "A"); + String expectedHandle = "=JDTLikeHandleProvider<pkg*A.aj'A"; + assertEquals("expected handle to be " + expectedHandle + ", but found " + pe.getHandleIdentifier(), expectedHandle, + pe.getHandleIdentifier()); + // } finally { + // AsmManager.getDefault().setHandleProvider(handleProvider); + // } + } + + public void testMovingAdviceDoesntChangeHandles_pr141730() { + // IElementHandleProvider handleProvider = + // AsmManager.getDefault().getHandleProvider(); + // AsmManager.getDefault().setHandleProvider(new + // JDTLikeHandleProvider()); + // try { + initialiseProject("JDTLikeHandleProvider"); + build("JDTLikeHandleProvider"); + checkWasFullBuild(); + IHierarchy top = getModelFor("JDTLikeHandleProvider").getHierarchy(); + IProgramElement pe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.ADVICE, "before(): <anonymous pointcut>"); + // add a line which shouldn't change the handle + alter("JDTLikeHandleProvider", "inc1"); + build("JDTLikeHandleProvider"); + checkWasntFullBuild(); + IHierarchy top2 = getModelFor("JDTLikeHandleProvider").getHierarchy(); + IProgramElement pe2 = top + .findElementForLabel(top2.getRoot(), IProgramElement.Kind.ADVICE, "before(): <anonymous pointcut>"); + assertEquals("expected advice to be on line " + pe.getSourceLocation().getLine() + 1 + " but was on " + + pe2.getSourceLocation().getLine(), pe.getSourceLocation().getLine() + 1, pe2.getSourceLocation().getLine()); + assertEquals( + "expected advice to have handle " + pe.getHandleIdentifier() + " but found handle " + pe2.getHandleIdentifier(), + pe.getHandleIdentifier(), pe2.getHandleIdentifier()); + // } finally { + // AsmManager.getDefault().setHandleProvider(handleProvider); + // } + } + + public void testSwappingAdviceAndHandles_pr141730() { + // IElementHandleProvider handleProvider = + // AsmManager.getDefault().getHandleProvider(); + // AsmManager.getDefault().setHandleProvider(new + // JDTLikeHandleProvider()); + // try { + initialiseProject("JDTLikeHandleProvider"); + build("JDTLikeHandleProvider"); + IHierarchy top = getModelFor("JDTLikeHandleProvider").getHierarchy(); + + IProgramElement call = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.ADVICE, "after(): callPCD.."); + IProgramElement exec = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.ADVICE, "after(): execPCD.."); + // swap the two after advice statements over. This forces + // a full build which means 'after(): callPCD..' will now + // be the second after advice in the file and have the same + // handle as 'after(): execPCD..' originally did. + alter("JDTLikeHandleProvider", "inc2"); + build("JDTLikeHandleProvider"); + checkWasFullBuild(); + + IHierarchy top2 = getModelFor("JDTLikeHandleProvider").getHierarchy(); + IProgramElement newCall = top2.findElementForLabel(top2.getRoot(), IProgramElement.Kind.ADVICE, "after(): callPCD.."); + IProgramElement newExec = top2.findElementForLabel(top2.getRoot(), IProgramElement.Kind.ADVICE, "after(): execPCD.."); + + assertEquals("after swapping places, expected 'after(): callPCD..' " + "to be on line " + + newExec.getSourceLocation().getLine() + " but was on line " + call.getSourceLocation().getLine(), newExec + .getSourceLocation().getLine(), call.getSourceLocation().getLine()); + assertEquals("after swapping places, expected 'after(): callPCD..' " + "to have handle " + exec.getHandleIdentifier() + + " (because was full build) but had " + newCall.getHandleIdentifier(), exec.getHandleIdentifier(), + newCall.getHandleIdentifier()); + // } finally { + // AsmManager.getDefault().setHandleProvider(handleProvider); + // } + } + + public void testInitializerCountForJDTLikeHandleProvider_pr141730() { + // IElementHandleProvider handleProvider = + // AsmManager.getDefault().getHandleProvider(); + // AsmManager.getDefault().setHandleProvider(new + // JDTLikeHandleProvider()); + // try { + initialiseProject("JDTLikeHandleProvider"); + build("JDTLikeHandleProvider"); + String expected = "=JDTLikeHandleProvider<pkg*A.aj[C|1"; + + IHierarchy top = getModelFor("JDTLikeHandleProvider").getHierarchy(); + IProgramElement init = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.INITIALIZER, "..."); + assertEquals("expected initializers handle to be " + expected + "," + " but found " + init.getHandleIdentifier(true), + expected, init.getHandleIdentifier(true)); + + alter("JDTLikeHandleProvider", "inc2"); + build("JDTLikeHandleProvider"); + checkWasFullBuild(); + + IHierarchy top2 = getModelFor("JDTLikeHandleProvider").getHierarchy(); + IProgramElement init2 = top2.findElementForLabel(top2.getRoot(), IProgramElement.Kind.INITIALIZER, "..."); + assertEquals( + "expected initializers handle to still be " + expected + "," + " but found " + init2.getHandleIdentifier(true), + expected, init2.getHandleIdentifier(true)); + + // } finally { + // AsmManager.getDefault().setHandleProvider(handleProvider); + // } + } + + // 134471 related tests perform incremental compilation and verify features + // of the structure model post compile + public void testPr134471_IncrementalCompilationAndModelUpdates() { + try { + // see pr148027 AsmHierarchyBuilder.shouldAddUsesPointcut=false; + + // Step1. Build the code, simple advice from aspect A onto class C + initialiseProject("PR134471"); + configureNonStandardCompileOptions("PR134471", "-showWeaveInfo -emacssym"); + configureShowWeaveInfoMessages("PR134471", true); + build("PR134471"); + AsmManager model = getModelFor("PR134471"); + // Step2. Quick check that the advice points to something... + IProgramElement nodeForTypeA = checkForNode(model, "pkg", "A", true); + IProgramElement nodeForAdvice = findAdvice(nodeForTypeA); + List<String> relatedElements = getRelatedElements(model, nodeForAdvice, 1); + + // Step3. Check the advice applying at the first 'code' join point + // in pkg.C is from aspect pkg.A, line 7 + IProgramElement programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true))); + int line = programElement.getSourceLocation().getLine(); + assertTrue("advice should be at line 7 - but is at line " + line, line == 7); + + // Step4. Simulate the aspect being saved but with no change at all + // in it + alter("PR134471", "inc1"); + build("PR134471"); + model = getModelFor("PR134471"); + + // Step5. Quick check that the advice points to something... + nodeForTypeA = checkForNode(model, "pkg", "A", true); + nodeForAdvice = findAdvice(nodeForTypeA); + relatedElements = getRelatedElements(model, nodeForAdvice, 1); + + // Step6. Check the advice applying at the first 'code' join point + // in pkg.C is from aspect pkg.A, line 7 + programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true))); + line = programElement.getSourceLocation().getLine(); + assertTrue("advice should be at line 7 - but is at line " + line, line == 7); + } finally { + // see pr148027 AsmHierarchyBuilder.shouldAddUsesPointcut=true; + } + } + + // now the advice moves down a few lines - hopefully the model will + // notice... see discussion in 134471 + public void testPr134471_MovingAdvice() { + + // Step1. build the project + initialiseProject("PR134471_2"); + configureNonStandardCompileOptions("PR134471_2", "-showWeaveInfo -emacssym"); + configureShowWeaveInfoMessages("PR134471_2", true); + build("PR134471_2"); + AsmManager model = getModelFor("PR134471_2"); + // Step2. confirm advice is from correct location + IProgramElement programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true))); + int line = programElement.getSourceLocation().getLine(); + assertTrue("advice should be at line 7 - but is at line " + line, line == 7); + + // Step3. No structural change to the aspect but the advice has moved + // down a few lines... (change in source location) + alter("PR134471_2", "inc1"); + build("PR134471_2"); + model = getModelFor("PR134471_2"); + checkWasntFullBuild(); // the line number has changed... but nothing + // structural about the code + + // checkWasFullBuild(); // this is true whilst we consider + // sourcelocation in the type/shadow munger equals() method - have + // to until the handles are independent of location + + // Step4. Check we have correctly realised the advice moved to line 11 + programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true))); + line = programElement.getSourceLocation().getLine(); + assertTrue("advice should be at line 11 - but is at line " + line, line == 11); + } + + public void testAddingAndRemovingDecwWithStructureModel() { + initialiseProject("P3"); + build("P3"); + alter("P3", "inc1"); + build("P3"); + assertTrue("There should be no exceptions handled:\n" + getCompilerErrorMessages("P3"), getCompilerErrorMessages("P3") + .isEmpty()); + alter("P3", "inc2"); + build("P3"); + assertTrue("There should be no exceptions handled:\n" + getCompilerErrorMessages("P3"), getCompilerErrorMessages("P3") + .isEmpty()); + } + + // same as first test with an extra stage that asks for C to be recompiled, + // it should still be advised... + public void testPr134471_IncrementallyRecompilingTheAffectedClass() { + try { + // see pr148027 AsmHierarchyBuilder.shouldAddUsesPointcut=false; + // Step1. build the project + initialiseProject("PR134471"); + configureNonStandardCompileOptions("PR134471", "-showWeaveInfo -emacssym"); + configureShowWeaveInfoMessages("PR134471", true); + build("PR134471"); + AsmManager model = getModelFor("PR134471"); + // Step2. confirm advice is from correct location + IProgramElement programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true))); + int line = programElement.getSourceLocation().getLine(); + assertTrue("advice should be at line 7 - but is at line " + line, line == 7); + + // Step3. No change to the aspect at all + alter("PR134471", "inc1"); + build("PR134471"); + model = getModelFor("PR134471"); + // Step4. Quick check that the advice points to something... + IProgramElement nodeForTypeA = checkForNode(model, "pkg", "A", true); + IProgramElement nodeForAdvice = findAdvice(nodeForTypeA); + List<String> relatedElements = getRelatedElements(model, nodeForAdvice, 1); + + // Step5. No change to the file C but it should still be advised + // afterwards + alter("PR134471", "inc2"); + build("PR134471"); + checkWasntFullBuild(); + model = getModelFor("PR134471"); + + // Step6. confirm advice is from correct location + programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true))); + line = programElement.getSourceLocation().getLine(); + assertTrue("advice should be at line 7 - but is at line " + line, line == 7); + } finally { + // see pr148027 AsmHierarchyBuilder.shouldAddUsesPointcut=true; + } + + } + + // similar to previous test but with 'declare warning' as well as advice + public void testPr134471_IncrementallyRecompilingAspectContainingDeclare() { + + // Step1. build the project + initialiseProject("PR134471_3"); + configureNonStandardCompileOptions("PR134471_3", "-showWeaveInfo -emacssym"); + configureShowWeaveInfoMessages("PR134471_3", true); + build("PR134471_3"); + checkWasFullBuild(); + + AsmManager model = getModelFor("PR134471_3"); + // Step2. confirm declare warning is from correct location, decw matches + // line 7 in pkg.C + IProgramElement programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true), 7)); + int line = programElement.getSourceLocation().getLine(); + assertTrue("declare warning should be at line 10 - but is at line " + line, line == 10); + + // Step3. confirm advice is from correct location, advice matches line 6 + // in pkg.C + programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true), 6)); + line = programElement.getSourceLocation().getLine(); + assertTrue("advice should be at line 7 - but is at line " + line, line == 7); + + // Step4. Move declare warning in the aspect + alter("PR134471_3", "inc1"); + build("PR134471_3"); + model = getModelFor("PR134471_3"); + checkWasntFullBuild(); // the line number has changed... but nothing + // structural about the code + + // checkWasFullBuild(); + + // Step5. confirm declare warning is from correct location, decw (now at + // line 12) in pkg.A matches line 7 in pkg.C + programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true), 7)); + line = programElement.getSourceLocation().getLine(); + assertTrue("declare warning should be at line 12 - but is at line " + line, line == 12); + + // Step6. Now just simulate 'resave' of the aspect, nothing has changed + alter("PR134471_3", "inc2"); + build("PR134471_3"); + checkWasntFullBuild(); + model = getModelFor("PR134471_3"); + // Step7. confirm declare warning is from correct location, decw (now at + // line 12) in pkg.A matches line 7 in pkg.C + programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true), 7)); + line = programElement.getSourceLocation().getLine(); + assertTrue("declare warning should be at line 12 - but is at line " + line, line == 12); + } + + // similar to previous test but with 'declare warning' as well as advice + public void testPr134471_IncrementallyRecompilingTheClassAffectedByDeclare() { + + // Step1. build the project + initialiseProject("PR134471_3"); + configureNonStandardCompileOptions("PR134471_3", "-showWeaveInfo -emacssym"); + configureShowWeaveInfoMessages("PR134471_3", true); + build("PR134471_3"); + checkWasFullBuild(); + AsmManager model = getModelFor("PR134471_3"); + // Step2. confirm declare warning is from correct location, decw matches + // line 7 in pkg.C + IProgramElement programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true), 7)); + int line = programElement.getSourceLocation().getLine(); + assertTrue("declare warning should be at line 10 - but is at line " + line, line == 10); + + // Step3. confirm advice is from correct location, advice matches line 6 + // in pkg.C + programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true), 6)); + line = programElement.getSourceLocation().getLine(); + assertTrue("advice should be at line 7 - but is at line " + line, line == 7); + + // Step4. Move declare warning in the aspect + alter("PR134471_3", "inc1"); + build("PR134471_3"); + model = getModelFor("PR134471_3"); + checkWasntFullBuild(); // the line number has changed... but nothing + // structural about the code + + // checkWasFullBuild(); + + // Step5. confirm declare warning is from correct location, decw (now at + // line 12) in pkg.A matches line 7 in pkg.C + programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true), 7)); + line = programElement.getSourceLocation().getLine(); + assertTrue("declare warning should be at line 12 - but is at line " + line, line == 12); + + // Step6. Now just simulate 'resave' of the aspect, nothing has changed + alter("PR134471_3", "inc2"); + build("PR134471_3"); + checkWasntFullBuild(); + model = getModelFor("PR134471_3"); + // Step7. confirm declare warning is from correct location, decw (now at + // line 12) in pkg.A matches line 7 in pkg.C + programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true), 7)); + line = programElement.getSourceLocation().getLine(); + assertTrue("declare warning should be at line 12 - but is at line " + line, line == 12); + + // Step8. Now just simulate resave of the pkg.C type - no change at + // all... are relationships gonna be repaired OK? + alter("PR134471_3", "inc3"); + build("PR134471_3"); + checkWasntFullBuild(); + + // Step9. confirm declare warning is from correct location, decw (now at + // line 12) in pkg.A matches line 7 in pkg.C + programElement = getFirstRelatedElement(model, findCode(checkForNode(model, "pkg", "C", true), 7)); + line = programElement.getSourceLocation().getLine(); + assertTrue("declare warning should be at line 12 - but is at line " + line, line == 12); + } + + public void testDontLoseXlintWarnings_pr141556() { + initialiseProject("PR141556"); + configureNonStandardCompileOptions("PR141556", "-Xlint:warning"); + build("PR141556"); + checkWasFullBuild(); + String warningMessage = "can not build thisJoinPoint " + "lazily for this advice since it has no suitable guard " + + "[Xlint:noGuardForLazyTjp]"; + assertEquals("warning message should be '" + warningMessage + "'", warningMessage, + (getWarningMessages("PR141556").get(0)).getMessage()); + + // add a space to the Aspect but dont do a build + alter("PR141556", "inc1"); + // remove the space so that the Aspect is exactly as it was + alter("PR141556", "inc2"); + // build the project and we should not have lost the xlint warning + build("PR141556"); + checkWasntFullBuild(); + assertTrue("there should still be a warning message ", !getWarningMessages("PR141556").isEmpty()); + assertEquals("warning message should be '" + warningMessage + "'", warningMessage, + (getWarningMessages("PR141556").get(0)).getMessage()); + } + + public void testAdviceDidNotMatch_pr152589() { + initialiseProject("PR152589"); + build("PR152589"); + List<IMessage> warnings = getWarningMessages("PR152589"); + assertTrue("There should be no warnings:\n" + warnings, warnings.isEmpty()); + alter("PR152589", "inc1"); + build("PR152589"); + checkWasntFullBuild(); // the line number has changed... but nothing + // structural about the code + + // checkWasFullBuild(); + warnings = getWarningMessages("PR152589"); + assertTrue("There should be no warnings after adding a whitespace:\n" + warnings, warnings.isEmpty()); + } + + // see comment #11 of bug 154054 + public void testNoFullBuildOnChangeInSysOutInAdviceBody_pr154054() { + initialiseProject("PR154054"); + build("PR154054"); + alter("PR154054", "inc1"); + build("PR154054"); + checkWasntFullBuild(); + } + + public void testIncrementalBuildAdviceChange_456801() throws Exception { + initialiseProject("456801"); + build("456801"); + String output = runMethod("456801", "Code", "run"); + assertEquals("advice runnning\nrun() running\n",output); + alter("456801", "inc1"); + build("456801"); + output = runMethod("456801", "Code", "run"); + assertEquals("advice running\nrun() running\n",output); + checkCompileWeaveCount("456801", 1, 1); + checkWasntFullBuild(); + } + + // change exception type in around advice, does it notice? + public void testShouldFullBuildOnExceptionChange_pr154054() { + initialiseProject("PR154054_2"); + build("PR154054_2"); + alter("PR154054_2", "inc1"); + build("PR154054_2"); + checkWasFullBuild(); + } + + public void testPR158573() { + // IElementHandleProvider handleProvider = + // AsmManager.getDefault().getHandleProvider(); + // AsmManager.getDefault().setHandleProvider(new + // JDTLikeHandleProvider()); + initialiseProject("PR158573"); + build("PR158573"); + List warnings = getWarningMessages("PR158573"); + assertTrue("There should be no warnings:\n" + warnings, warnings.isEmpty()); + alter("PR158573", "inc1"); + build("PR158573"); + + checkWasntFullBuild(); + warnings = getWarningMessages("PR158573"); + assertTrue("There should be no warnings after changing the value of a " + "variable:\n" + warnings, warnings.isEmpty()); + // AsmManager.getDefault().setHandleProvider(handleProvider); + } + + /** + * If the user has specified that they want Java 6 compliance and kept the default classfile and source file level settings + * (also 6.0) then expect an error saying that we don't support java 6. + */ + public void testPR164384_1() { + initialiseProject("PR164384"); + + Hashtable<String, String> javaOptions = new Hashtable<String, String>(); + javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6"); + javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6"); + javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.6"); + configureJavaOptionsMap("PR164384", javaOptions); + + build("PR164384"); + List<IMessage> errors = getErrorMessages("PR164384"); + + if (getCompilerForProjectWithName("PR164384").isJava6Compatible()) { + assertTrue("There should be no errors:\n" + errors, errors.isEmpty()); + } else { + String expectedError = "Java 6.0 compliance level is unsupported"; + String found = ((IMessage) errors.get(0)).getMessage(); + assertEquals("Expected 'Java 6.0 compliance level is unsupported'" + " error message but found " + found, + expectedError, found); + // This is because the 'Java 6.0 compliance' error is an 'error' + // rather than an 'abort'. Aborts are really for compiler + // exceptions. + assertTrue("expected there to be more than the one compliance level" + " error but only found that one", + errors.size() > 1); + } + + } + + /** + * If the user has specified that they want Java 6 compliance and selected classfile and source file level settings to be 5.0 + * then expect an error saying that we don't support java 6. + */ + public void testPR164384_2() { + initialiseProject("PR164384"); + + Hashtable<String, String> javaOptions = new Hashtable<String, String>(); + javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6"); + javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.5"); + javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.5"); + configureJavaOptionsMap("PR164384", javaOptions); + + build("PR164384"); + List<IMessage> errors = getErrorMessages("PR164384"); + if (getCompilerForProjectWithName("PR164384").isJava6Compatible()) { + assertTrue("There should be no errors:\n" + errors, errors.isEmpty()); + } else { + String expectedError = "Java 6.0 compliance level is unsupported"; + String found = ((IMessage) errors.get(0)).getMessage(); + assertEquals("Expected 'Java 6.0 compliance level is unsupported'" + " error message but found " + found, + expectedError, found); + // This is because the 'Java 6.0 compliance' error is an 'error' + // rather than an 'abort'. Aborts are really for compiler + // exceptions. + assertTrue("expected there to be more than the one compliance level" + " error but only found that one", + errors.size() > 1); + } + } + + /** + * If the user has specified that they want Java 6 compliance and set the classfile level to be 6.0 and source file level to be + * 5.0 then expect an error saying that we don't support java 6. + */ + public void testPR164384_3() { + initialiseProject("PR164384"); + + Hashtable<String, String> javaOptions = new Hashtable<String, String>(); + javaOptions.put("org.eclipse.jdt.core.compiler.compliance", "1.6"); + javaOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", "1.6"); + javaOptions.put("org.eclipse.jdt.core.compiler.source", "1.5"); + configureJavaOptionsMap("PR164384", javaOptions); + + build("PR164384"); + List<IMessage> errors = getErrorMessages("PR164384"); + + if (getCompilerForProjectWithName("PR164384").isJava6Compatible()) { + assertTrue("There should be no errros:\n" + errors, errors.isEmpty()); + } else { + String expectedError = "Java 6.0 compliance level is unsupported"; + String found = ((IMessage) errors.get(0)).getMessage(); + assertEquals("Expected 'Java 6.0 compliance level is unsupported'" + " error message but found " + found, + expectedError, found); + // This is because the 'Java 6.0 compliance' error is an 'error' + // rather than an 'abort'. Aborts are really for compiler + // exceptions. + assertTrue("expected there to be more than the one compliance level" + " error but only found that one", + errors.size() > 1); + } + } + + public void testPr168840() throws Exception { + initialiseProject("inpathTesting"); + + String inpathTestingDir = getWorkingDir() + File.separator + "inpathTesting"; + String inpathDir = inpathTestingDir + File.separator + "injarBin" + File.separator + "pkg"; + String expectedOutputDir = inpathTestingDir + File.separator + "bin"; + + // set up the inpath to have the directory on it's path + File f = new File(inpathDir); + Set<File> s = new HashSet<File>(); + s.add(f); + configureInPath("inpathTesting", s); + build("inpathTesting"); + // the declare warning matches one place so expect one warning message + List<IMessage> warnings = getWarningMessages("inpathTesting"); + assertTrue("Expected there to be one warning message but found " + warnings.size() + ": " + warnings, warnings.size() == 1); + + // copy over the updated version of the inpath class file + File from = new File(testdataSrcDir + File.separatorChar + "inpathTesting" + File.separatorChar + "newInpathClass" + + File.separatorChar + "InpathClass.class"); + File destination = new File(inpathDir + File.separatorChar + "InpathClass.class"); + FileUtil.copyFile(from, destination); + + build("inpathTesting"); + checkWasntFullBuild(); + // the newly copied inpath class means the declare warning now matches + // two + // places, therefore expect two warning messages + warnings = getWarningMessages("inpathTesting"); + assertTrue("Expected there to be two warning message but found " + warnings.size() + ": " + warnings, warnings.size() == 2); + } + + // warning about cant change parents of Object is fine + public void testInpathHandles_271201() throws Exception { + AjdeInteractionTestbed.VERBOSE = true; + String p = "inpathHandles"; + initialiseProject(p); + + String inpathTestingDir = getWorkingDir() + File.separator + "inpathHandles"; + String inpathDir = inpathTestingDir + File.separator + "binpath"; + + // set up the inpath to have the directory on it's path + System.out.println(inpathDir); + File f = new File(inpathDir); + Set<File> s = new HashSet<File>(); + s.add(f); + configureInPath(p, s); + build(p); + + IProgramElement root = getModelFor(p).getHierarchy().getRoot(); + + // alter(p,"inc1"); + // build(p); + dumptree(root, 0); + PrintWriter pw = new PrintWriter(System.out); + try { + getModelFor(p).dumprels(pw); + pw.flush(); + } catch (Exception e) { + } + List<IRelationship> l = getModelFor(p).getRelationshipMap().get("=inpathHandles/;<codep(Code.class[Code"); + assertNotNull(l); + } + + // warning about cant change parents of Object is fine + public void testInpathHandles_IncrementalCompilation_271201() throws Exception { + AjdeInteractionTestbed.VERBOSE = true; + String p = "inpathHandles"; + initialiseProject(p); + + String inpathTestingDir = getWorkingDir() + File.separator + "inpathHandles"; + String inpathDir = inpathTestingDir + File.separator + "binpath"; + + // set up the inpath to have the directory on it's path + File f = new File(inpathDir); + Set<File> s = new HashSet<File>(); + s.add(f); + configureInPath(p, s); + + // This build will weave a declare parents into the inpath class codep.Code + build(p); + assertNotNull(getModelFor(p).getRelationshipMap().get("=inpathHandles/;<codep(Code.class[Code")); + + IProgramElement root = getModelFor(p).getHierarchy().getRoot(); + + // This alteration introduces a new source file B.java, the build should not + // damage phantom handle based relationships + alter(p, "inc1"); + build(p); + assertNotNull(getModelFor(p).getRelationshipMap().get("=inpathHandles/;<codep(Code.class[Code")); + assertNotNull(getModelFor(p).getRelationshipMap().get("=inpathHandles<p{B.java[B")); + + // This alteration removes B.java, the build should not damage phantom handle based relationships + String fileB = getWorkingDir().getAbsolutePath() + File.separatorChar + "inpathHandles" + File.separatorChar + "src" + + File.separatorChar + "p" + File.separatorChar + "B.java"; + (new File(fileB)).delete(); + build(p); + assertNotNull(getModelFor(p).getRelationshipMap().get("=inpathHandles/;<codep(Code.class[Code")); + assertNull(getModelFor(p).getRelationshipMap().get("=inpathHandles<p{B.java[B")); + } + + public void testInpathHandles_WithInpathMap_271201() throws Exception { + AjdeInteractionTestbed.VERBOSE = true; + String p = "inpathHandles"; + initialiseProject(p); + + String inpathTestingDir = getWorkingDir() + File.separator + "inpathHandles"; + String inpathDir = inpathTestingDir + File.separator + "binpath";// + File.separator+ "codep"; + // String expectedOutputDir = inpathTestingDir + File.separator + "bin"; + + // set up the inpath to have the directory on it's path + System.out.println(inpathDir); + File f = new File(inpathDir); + Set<File> s = new HashSet<File>(); + s.add(f); + Map<File, String> m = new HashMap<File, String>(); + m.put(f, "wibble"); + configureOutputLocationManager(p, new TestOutputLocationManager(getProjectRelativePath(p, ".").toString(), m)); + + configureInPath(p, s); + build(p); + + IProgramElement root = getModelFor(p).getHierarchy().getRoot(); + + // alter(p,"inc1"); + // build(p); + dumptree(root, 0); + PrintWriter pw = new PrintWriter(System.out); + try { + getModelFor(p).dumprels(pw); + pw.flush(); + } catch (Exception e) { + } + List<IRelationship> l = getModelFor(p).getRelationshipMap().get("=inpathHandles/;wibble<codep(Code.class[Code"); + assertNotNull(l); + } + + private void printModelAndRelationships(String p) { + IProgramElement root = getModelFor(p).getHierarchy().getRoot(); + + dumptree(root, 0); + PrintWriter pw = new PrintWriter(System.out); + try { + getModelFor(p).dumprels(pw); + pw.flush(); + } catch (Exception e) { + } + } + + public void testInpathHandles_IncrementalCompilation_RemovingInpathEntries_271201() throws Exception { + AjdeInteractionTestbed.VERBOSE = true; + String p = "inpathHandles2"; + initialiseProject(p); + + String inpathDir = getWorkingDir() + File.separator + "inpathHandles2" + File.separator + "binpath"; + + // set up the inpath to have the directory on it's path + File f = new File(inpathDir); + configureInPath(p, f); + + // This build will weave a declare parents into the inpath class codep.A and codep.B + build(p); + assertNotNull(getModelFor(p).getRelationshipMap().get("=inpathHandles2/;<codep(A.class[A")); + + // Not let us delete one of the inpath .class files + assertTrue(new File(inpathDir, "codep" + File.separator + "A.class").delete()); + setNextChangeResponse(p, ICompilerConfiguration.EVERYTHING); + build(p); + // printModelAndRelationships(p); + } + + // warning about cant change parents of Object is fine + // public void testInpathJars_271201() throws Exception { + // AjdeInteractionTestbed.VERBOSE = true; + // String p = "inpathJars"; + // initialiseProject(p); + // + // String inpathTestingDir = getWorkingDir() + File.separator + "inpathJars"; + // String inpathDir = inpathTestingDir + File.separator + "code.jar"; + // // String expectedOutputDir = inpathTestingDir + File.separator + "bin"; + // + // // set up the inpath to have the directory on it's path + // File f = new File(inpathDir); + // Set s = new HashSet(); + // s.add(f); + // Map m = new HashMap(); + // m.put(f, "Gibble"); + // configureOutputLocationManager(p, new TestOutputLocationManager(getProjectRelativePath(p, ".").toString(), m)); + // configureInPath(p, s); + // build(p); + // + // // alter(p,"inc1"); + // // build(p); + // List l = getModelFor(p).getRelationshipMap().get("=inpathJars/,Gibble<codep(Code.class[Code"); + // assertNotNull(l); + // } + + // --- helper code --- + + /** + * Retrieve program elements related to this one regardless of the relationship. A JUnit assertion is made that the number that + * the 'expected' number are found. + * + * @param programElement Program element whose related elements are to be found + * @param expected the number of expected related elements + */ + private List<String> getRelatedElements(AsmManager model, IProgramElement programElement, int expected) { + List<String> relatedElements = getRelatedElements(model, programElement); + StringBuffer debugString = new StringBuffer(); + if (relatedElements != null) { + for (String element : relatedElements) { + debugString.append(model.getHierarchy().findElementForHandle(element).toLabelString()).append("\n"); + } + } + assertTrue("Should be " + expected + " element" + (expected > 1 ? "s" : "") + " related to this one '" + programElement + + "' but found :\n " + debugString, relatedElements != null && relatedElements.size() == 1); + return relatedElements; + } + + private IProgramElement getFirstRelatedElement(AsmManager model, IProgramElement programElement) { + List<String> rels = getRelatedElements(model, programElement, 1); + return model.getHierarchy().findElementForHandle((String) rels.get(0)); + } + + private List<String> getRelatedElements(AsmManager model, IProgramElement advice) { + List<String> output = null; + IRelationshipMap map = model.getRelationshipMap(); + List<IRelationship> rels = map.get(advice); + if (rels == null) { + fail("Did not find any related elements!"); + } + for (Iterator<IRelationship> iter = rels.iterator(); iter.hasNext();) { + IRelationship element = iter.next(); + List<String> targets = element.getTargets(); + if (output == null) { + output = new ArrayList<String>(); + } + output.addAll(targets); + } + return output; + } + + private IProgramElement findAdvice(IProgramElement ipe) { + return findAdvice(ipe, 1); + } + + private IProgramElement findAdvice(IProgramElement ipe, int whichOne) { + if (ipe.getKind() == IProgramElement.Kind.ADVICE) { + whichOne = whichOne - 1; + if (whichOne == 0) { + return ipe; + } + } + List<IProgramElement> kids = ipe.getChildren(); + for (IProgramElement kid: kids) { + IProgramElement found = findAdvice(kid, whichOne); + if (found != null) { + return found; + } + } + return null; + } + + /** + * Finds the first 'code' program element below the element supplied - will return null if there aren't any + */ + private IProgramElement findCode(IProgramElement ipe) { + return findCode(ipe, -1); + } + + /** + * Searches a hierarchy of program elements for a 'code' element at the specified line number, a line number of -1 means just + * return the first one you find + */ + private IProgramElement findCode(IProgramElement ipe, int linenumber) { + if (ipe.getKind() == IProgramElement.Kind.CODE) { + if (linenumber == -1 || ipe.getSourceLocation().getLine() == linenumber) { + return ipe; + } + } + List<IProgramElement> kids = ipe.getChildren(); + for (IProgramElement kid: kids) { + IProgramElement found = findCode(kid, linenumber); + if (found != null) { + return found; + } + } + return null; + } + + // other possible tests: + // - memory usage (freemem calls?) + // - relationship map + + // -------------------------------------------------------------------------- + // ------------------------- + + private IProgramElement checkForNode(AsmManager model, String packageName, String typeName, boolean shouldBeFound) { + IProgramElement ipe = model.getHierarchy().findElementForType(packageName, typeName); + if (shouldBeFound) { + if (ipe == null) { + printModel(model); + } + assertTrue("Should have been able to find '" + packageName + "." + typeName + "' in the asm", ipe != null); + } else { + if (ipe != null) { + printModel(model); + } + assertTrue("Should have NOT been able to find '" + packageName + "." + typeName + "' in the asm", ipe == null); + } + return ipe; + } + + private void printModel(AsmManager model) { + try { + AsmManager.dumptree(model.getHierarchy().getRoot(), 0); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private static void log(String msg) { + if (VERBOSE) { + System.out.println(msg); + } + } + +}
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/incremental/tools/OutputLocationManagerTests.java b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/OutputLocationManagerTests.java new file mode 100644 index 000000000..333495399 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/incremental/tools/OutputLocationManagerTests.java @@ -0,0 +1,165 @@ +/******************************************************************** + * Copyright (c) 2006 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Adrian Colyer initial implementation + * Helen Hawkins Converted to new interface (bug 148190) + *******************************************************************/ +package org.aspectj.systemtest.incremental.tools; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.aspectj.ajde.core.IOutputLocationManager; + +/** + * Test the OutputLocationManager support used to enable multiple output folders. These aren't true "multi-project incremental" + * tests, but that superclass has some handy methods over and above AjdeInteractionTestCase that I want to use. + */ +public class OutputLocationManagerTests extends AbstractMultiProjectIncrementalAjdeInteractionTestbed { + + private static final String PROJECT_NAME = "MultipleOutputFolders"; + private MyOutputLocationManager outputLocationManager; + + protected void setUp() throws Exception { + super.setUp(); + initialiseProject(PROJECT_NAME); + this.outputLocationManager = new MyOutputLocationManager(new File(getFile(PROJECT_NAME, ""))); + configureOutputLocationManager(PROJECT_NAME, this.outputLocationManager); + } + + public void testDefaultOutputLocationUsedWhenNoOutputLocationManager() { + configureOutputLocationManager(PROJECT_NAME, null); + build(PROJECT_NAME); + assertFileExists(PROJECT_NAME, "bin/a/A.class"); + assertFileExists(PROJECT_NAME, "bin/b/B.class"); + } + + public void testTwoSourceRootsWithSeparateOutputLocations() { + build(PROJECT_NAME); + assertFileExists(PROJECT_NAME, "target/main/classes/a/A.class"); + assertFileExists(PROJECT_NAME, "target/test/classes/b/B.class"); + } + + public void testResourceCopying() { + Map<String,File> resourceMap = new HashMap<>(); + resourceMap.put("resourceOne.txt", new File(getFile(PROJECT_NAME, "srcRootOne/resourceOne.txt"))); + resourceMap.put("resourceTwo.txt", new File(getFile(PROJECT_NAME, "srcRootTwo/resourceTwo.txt"))); + configureResourceMap(PROJECT_NAME, resourceMap); + build(PROJECT_NAME); + assertFileExists(PROJECT_NAME, "target/main/classes/resourceOne.txt"); + assertFileExists(PROJECT_NAME, "target/test/classes/resourceTwo.txt"); + } + + public void testGeneratedClassesPlacedInAppropriateOutputFolder() { + configureNonStandardCompileOptions(PROJECT_NAME, "-XnoInline"); + build(PROJECT_NAME); + assertFileExists(PROJECT_NAME, "target/main/classes/a/A.class"); + assertFileExists(PROJECT_NAME, "target/main/classes/a/A$AjcClosure1.class"); + } + + /** + * Tests the case when we have two aspects, each of which are sent to a different output location. There should be an aop.xml + * file in each of the two output directories. + */ + public void testOutXmlForAspectsWithDifferentOutputDirs() { + configureNonStandardCompileOptions(PROJECT_NAME, "-outxml"); + build(PROJECT_NAME); + assertFileExists(PROJECT_NAME, "target/main/classes/META-INF/aop-ajc.xml"); + assertFileExists(PROJECT_NAME, "target/test/classes/META-INF/aop-ajc.xml"); + // aop.xml file should exist even if there aren't any aspects (mirrors + // what happens when there's one output dir) + checkXMLAspectCount(PROJECT_NAME, "", 0, getFile(PROJECT_NAME, "target/anotherTest/classes")); + // add aspects to the srcRootThree src dir and they should appear in the + // corresponding aop.xml file + alter(PROJECT_NAME, "inc1"); + build(PROJECT_NAME); + checkXMLAspectCount(PROJECT_NAME, "c.C$AnAspect", 1, getFile(PROJECT_NAME, "target/anotherTest/classes")); + } + + protected void assertFileExists(String project, String relativePath) { + assertTrue("file " + relativePath + " should have been created as a result of building " + project, new File(getFile( + project, relativePath)).exists()); + } + + private static class MyOutputLocationManager implements IOutputLocationManager { + + private File projectHome; + private List<File> allOutputDirs; + + public MyOutputLocationManager(File projectHome) { + this.projectHome = projectHome; + + } + + public void reportFileWrite(String outputfile, int filetype) { + } + + public void reportFileRemove(String outputfile, int filetype) { + } + + public Map<File,String> getInpathMap() { + return Collections.emptyMap(); + } + + + public File getOutputLocationForClass(File compilationUnit) { + String relativePath = ""; + String compilationUnitName = compilationUnit.getAbsolutePath(); + if (compilationUnitName.indexOf("srcRootOne") != -1) { + relativePath = "target/main/classes"; + } else if (compilationUnitName.indexOf("srcRootTwo") != -1) { + relativePath = "target/test/classes"; + } else if (compilationUnitName.indexOf("srcRootThree") != -1) { + relativePath = "target/anotherTest/classes"; + } + File ret = new File(projectHome, relativePath); + if (!ret.exists()) { + ret.mkdirs(); + } + return ret; + } + + public File getOutputLocationForResource(File resource) { + return getOutputLocationForClass(resource); + } + + public List<File> getAllOutputLocations() { + if (allOutputDirs == null) { + allOutputDirs = new ArrayList<>(); + allOutputDirs.add(new File(projectHome, "target/main/classes")); + allOutputDirs.add(new File(projectHome, "target/test/classes")); + allOutputDirs.add(new File(projectHome, "target/anotherTest/classes")); + } + return allOutputDirs; + } + + public File getDefaultOutputLocation() { + return new File(projectHome, "target/main/classes"); + } + + public String getSourceFolderForFile(File sourceFile) { + return null; + } + + public int discoverChangesSince(File dir, long buildtime) { + // TODO Auto-generated method stub + return 0; + } + } + + public void reportFileWrite(String outputfile, int filetype) { + } + + public void reportFileRemove(String outputfile, int filetype) { + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/inpath/InPathTests.java b/tests/src/test/java/org/aspectj/systemtest/inpath/InPathTests.java new file mode 100644 index 000000000..ec2fd8d7b --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/inpath/InPathTests.java @@ -0,0 +1,97 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM Corporation + * 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 + * + * ******************************************************************/ +package org.aspectj.systemtest.inpath; + +import java.io.File; +import junit.framework.Test; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class InPathTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(InPathTests.class); + } + + protected File getSpecFile() { + return getClassResource("inpath.xml"); + } + + + public void test001(){ + runTest("source for options -injars"); + } + + public void test002(){ + runTest("options -injars"); + } + + public void test003(){ + runTest("options -injars checking declare parents interactions"); + } + +// test removed from suite since aspects are *always* generated reweavable +// public void test004(){ +// runTest("The compiler crashes when using aspect libraries created without using -terminateAfterCompilation"); +// } + + public void test005(){ + runTest("declare warnings on main"); + } + + public void test006(){ + runTest("declare warnings on binary javac 1.4 classes"); + } + + public void test007(){ + runTest("declare warnings on binary ajc 1.1 classes"); + } + + public void test008(){ + runTest("Weaving rt.jar results in stack overflow"); + } + + public void test009(){ + runTest("Weaving failure when using injars (no jars)"); + } + + public void test010(){ + runTest("Weaving failure when using injars (on aspectpath)"); + } + + public void test011(){ + runTest("Weaving failure when using injars (on classpath)"); + } + + public void test012(){ + runTest("Weaving failure when using injars (actual injars)"); + } + + public void test013(){ + runTest("Introduced abstract method on interface not implemented by subtype (injars)"); + } + + public void test014(){ + runTest("error Type mismatch: cannot convert from java.lang.String to java.lang.String"); + } + + public void test015(){ + runTest("declare error binary-weaving NPE"); + } + + public void test016(){ + runTest("declare error binary-weaving NPE"); + } + + public void test017(){ + runTest("Regression from 1.1: NPE in CompilationResult"); + } + +} + diff --git a/tests/src/test/java/org/aspectj/systemtest/inpath/inpath-tests.xml b/tests/src/test/java/org/aspectj/systemtest/inpath/inpath-tests.xml new file mode 100644 index 000000000..46fe869c1 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/inpath/inpath-tests.xml @@ -0,0 +1,297 @@ +<!-- InPath Tests --> + + <!-- .................................... -injars tests --> + + <ajc-test dir="options/injars/simple" + title="source for options -injars"> + <compile files="Simple.java,Main.java"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="options/injars/simple" + title="options -injars"> + <compile files="Simple.java,main.jar" + options="!eclipse"/> + <run class="Main"/> + </ajc-test> + + + <ajc-test dir="options/injars/simple" pr="35865" + title="options -injars checking declare parents interactions"> + <compile files="DecParents.java,main.jar" + options="!eclipse"/> + <run class="DecParents"/> + </ajc-test> + + <ajc-test dir="new/options11" pr="36329" + comment="the line number might change, we're really interested only in the files here" + title="The compiler crashes when using aspect libraries created without using -terminateAfterCompile"> + <compile files="Main.java,injar.jar,Aspect.java,aspectlib1.jar,aspectlib2.jar"> + <message kind="error" line="0"/> + </compile> + </ajc-test> + + <ajc-test dir="new/binaryWarnings/src" pr="37020" + title="declare warnings on main"> + <compile files="aspects/MainWarnings.java,app/Main.java"> + <message line="4" text="staticinitialization(Main)" kind="warning" file="app/Main.java" /> + <message line="6" text="set(String Main.staticString)" kind="warning" file="app/Main.java" /> + <message line="8" text="set(String Main.s)" kind="warning" file="app/Main.java" /> + <message line="12" text="get(String Main.staticString)" kind="warning" file="app/Main.java" /> + <message line="14" text="set(String Main.staticString)" kind="warning" file="app/Main.java" /> + <message line="16" text="call(Main.new())" kind="warning" file="app/Main.java" /> + <message line="19" text="call(void Main.go(String))" kind="warning" file="app/Main.java" /> + <message line="23" text="initialization(Main.new())" kind="warning" file="app/Main.java" /> + <message line="23" text="get(String Main.s)" kind="warning" file="app/Main.java" /> + <message line="23" text="set(String Main.s)" kind="warning" file="app/Main.java" /> + <message line="26" text="execution(void Main.go(String))" kind="warning" file="app/Main.java" /> + <message line="29" text="get(String Main.s)" kind="warning" file="app/Main.java" /> + <message line="31" text="set(String Main.s)" kind="warning" file="app/Main.java" /> + <message line="32" text="D.go withincode(void Main.go(String))" kind="warning" file="app/Main.java" /> + <message line="33" text="handler(RuntimeException)" kind="warning" file="app/Main.java" /> + <message line="35" text="withincode(void Main.go(String))" kind="warning" file="app/Main.java" /> + <message line="42" text="withincode(void Main.stop())" kind="warning" file="app/Main.java" /> + <message line="50" text="preinitialization(app.C.new())" kind="warning" file="app/Main.java" /> + </compile> + <run class="app.Main"/> + </ajc-test> + + <ajc-test dir="new/binaryWarnings/src" pr="37020" + title="declare warnings on binary javac 1.4 classes"> + <compile files="aspects/MainWarnings.java,../injars/app-javac-1.4.jar"> + <message line="6" text="staticinitialization(Main)" kind="warning" file="app/Main.java" /> + <message line="6" text="set(String Main.staticString)" kind="warning" file="app/Main.java" /> + <message line="8" text="set(String Main.s)" kind="warning" file="app/Main.java" /> + <message line="12" text="get(String Main.staticString)" kind="warning" file="app/Main.java" /> + <message line="14" text="set(String Main.staticString)" kind="warning" file="app/Main.java" /> + <message line="16" text="call(Main.new())" kind="warning" file="app/Main.java" /> + <message line="19" text="call(void Main.go(String))" kind="warning" file="app/Main.java" /> + <message line="23" text="initialization(Main.new())" kind="warning" file="app/Main.java" /> + <message line="23" text="get(String Main.s)" kind="warning" file="app/Main.java" /> + <message line="23" text="set(String Main.s)" kind="warning" file="app/Main.java" /> + <message line="26" text="execution(void Main.go(String))" kind="warning" file="app/Main.java" /> + <message line="29" text="get(String Main.s)" kind="warning" file="app/Main.java" /> + <message line="31" text="set(String Main.s)" kind="warning" file="app/Main.java" /> + <message line="32" text="D.go withincode(void Main.go(String))" kind="warning" file="app/Main.java" /> + <message line="33" text="handler(RuntimeException)" kind="warning" file="app/Main.java" /> + <message line="35" text="withincode(void Main.go(String))" kind="warning" file="app/Main.java" /> + <message line="42" text="withincode(void Main.stop())" kind="warning" file="app/Main.java" /> + <message line="50" text="preinitialization(app.C.new())" kind="warning" file="app/Main.java" /> + </compile> + <run class="app.Main"/> + </ajc-test> + + <ajc-test dir="new/binaryWarnings/src" pr="37023" + title="declare warnings on binary ajc 1.1 classes"> + <compile files="aspects/MainWarnings.java,../injars/app-ajc-1.1.jar"> + <message line="6" text="staticinitialization(Main)" kind="warning" file="app/Main.java" /> + <message line="6" text="set(String Main.staticString)" kind="warning" file="app/Main.java" /> + <message line="8" text="set(String Main.s)" kind="warning" file="app/Main.java" /> + <message line="12" text="get(String Main.staticString)" kind="warning" file="app/Main.java" /> + <message line="14" text="set(String Main.staticString)" kind="warning" file="app/Main.java" /> + <message line="16" text="call(Main.new())" kind="warning" file="app/Main.java" /> + <message line="19" text="call(void Main.go(String))" kind="warning" file="app/Main.java" /> + <message line="23" text="initialization(Main.new())" kind="warning" file="app/Main.java" /> + <message line="23" text="get(String Main.s)" kind="warning" file="app/Main.java" /> + <message line="23" text="set(String Main.s)" kind="warning" file="app/Main.java" /> + <message line="26" text="execution(void Main.go(String))" kind="warning" file="app/Main.java" /> + <message line="29" text="get(String Main.s)" kind="warning" file="app/Main.java" /> + <message line="31" text="set(String Main.s)" kind="warning" file="app/Main.java" /> + <message line="32" text="D.go withincode(void Main.go(String))" kind="warning" file="app/Main.java" /> + <message line="33" text="handler(RuntimeException)" kind="warning" file="app/Main.java" /> + <message line="35" text="withincode(void Main.go(String))" kind="warning" file="app/Main.java" /> + <message line="42" text="withincode(void Main.stop())" kind="warning" file="app/Main.java" /> + <message line="50" text="preinitialization(app.C.new())" kind="warning" file="app/Main.java" /> + </compile> + <run class="app.Main"/> + </ajc-test> + + <ajc-test dir="bugs/lines" pr="37758" + title="Weaving rt.jar results in stack overflow"> + <compile files="A.java,big.jar"> + <!-- message no longer produced as a result of bug fix 44190 + <message kind="warning" text="manifest not copied"/> + --> + </compile> + <run class="Big"/> + </ajc-test> + + <ajc-test dir="bugs/moreInterfaceLibrary" + pr="41123" + title="Weaving failure when using injars (no jars)"> + <compile + files="lib/ExecutionMonitor.aj,model/BusObj.java,model/MonitorBusObj.java"> + </compile> + </ajc-test> + + <ajc-test dir="bugs/moreInterfaceLibrary" + pr="41123" + title="Weaving failure when using injars (on aspectpath)"> + <compile + files="model/BusObj.java,model/MonitorBusObj.java" + aspectpath="lib.jar"> + </compile> + </ajc-test> + + <ajc-test dir="bugs/moreInterfaceLibrary" + pr="41123" + title="Weaving failure when using injars (on classpath)"> + <compile + files="model/BusObj.java,model/MonitorBusObj.java" + classpath="lib.jar"> + <message kind="error" line="3"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/moreInterfaceLibrary" + pr="41123" + title="Weaving failure when using injars (actual injars)"> + <compile + files="model/BusObj.java,model/MonitorBusObj.java,lib.jar"> + <message kind="error" line="3"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/abstractMethods" pr="49784" + title="Introduced abstract method on interface not implemented by subtype (injars)"> + <compile files="interface/C.java,interface/jars/AandB.jar"> + <message kind="error" line="1"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/StringToString" pr="55341" + title="error Type mismatch: cannot convert from java.lang.String to java.lang.String" + comment="make helloworld.jar with 'ajc -outjar helloworld.jar HW.java' or run BcweaverJarMaker" + keywords=""> + <compile files="X.java" classpath="helloworld.jar"> + <message kind="warning" line="3"/> + <message kind="warning" line="7"/> + <message kind="warning" text="needed for privileged"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/systemouts" + pr="57432" + title="declare error binary-weaving NPE"> + <compile files="injar-debug.jar,A.java"> + <message kind="error" line="12" file="X.java"/> + <message kind="error" line="13" file="X.java"/> + <message kind="error" line="20" file="X.java"/> + <message kind="error" line="22" file="X.java"/> + <message kind="error" line="23" file="X.java"/> + <message kind="error" line="27" file="X.java"/> + <message kind="error" line="28" file="X.java"/> + <message kind="error" line="29" file="X.java"/> + <message kind="error" line="30" file="X.java"/> + <message kind="error" line="31" file="X.java"/> + <message kind="error" line="32" file="X.java"/> + <message kind="error" line="33" file="X.java"/> + <message kind="error" line="34" file="X.java"/> + <message kind="error" line="35" file="X.java"/> + <message kind="error" line="36" file="X.java"/> + <message kind="error" line="37" file="X.java"/> + <message kind="error" line="38" file="X.java"/> + <message kind="error" line="39" file="X.java"/> + <message kind="error" line="40" file="X.java"/> + <message kind="error" line="41" file="X.java"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/systemouts" + pr="57432" + title="declare error binary-weaving NPE"> + <compile files="injar-nodebug.jar,A.java"> + <message kind="error" line="0"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/tooManyErrors" + pr="58679" + title="Regression from 1.1: NPE in CompilationResult"> + <compile files="Joinpoints101.jar,DecErrors.aj"> + + <message kind="error" line="10"/><message kind="error" line="11"/> + <message kind="error" line="12"/><message kind="error" line="13"/> + <message kind="error" line="14"/> + + <message kind="error" line="16"/><message kind="error" line="17"/> + <message kind="error" line="18"/><message kind="error" line="19"/> + <message kind="error" line="20"/> + + <message kind="error" line="22"/><message kind="error" line="23"/> + <message kind="error" line="24"/><message kind="error" line="25"/> + <message kind="error" line="26"/> + + <message kind="error" line="28"/><message kind="error" line="29"/> + <message kind="error" line="30"/><message kind="error" line="31"/> + <message kind="error" line="32"/> + + <message kind="error" line="34"/><message kind="error" line="35"/> + <message kind="error" line="36"/><message kind="error" line="37"/> + <message kind="error" line="38"/> + + <message kind="error" line="40"/><message kind="error" line="41"/> + <message kind="error" line="42"/><message kind="error" line="43"/> + <message kind="error" line="44"/> + + <message kind="error" line="46"/><message kind="error" line="47"/> + <message kind="error" line="48"/><message kind="error" line="49"/> + <message kind="error" line="50"/> + + <message kind="error" line="52"/><message kind="error" line="53"/> + <message kind="error" line="54"/><message kind="error" line="55"/> + <message kind="error" line="56"/> + + <message kind="error" line="58"/><message kind="error" line="59"/> + <message kind="error" line="60"/><message kind="error" line="61"/> + <message kind="error" line="62"/> + + <message kind="error" line="64"/><message kind="error" line="65"/> + <message kind="error" line="66"/><message kind="error" line="67"/> + <message kind="error" line="68"/> + + <message kind="error" line="70"/><message kind="error" line="71"/> + <message kind="error" line="72"/><message kind="error" line="73"/> + <message kind="error" line="74"/> + + <message kind="error" line="76"/><message kind="error" line="77"/> + <message kind="error" line="78"/><message kind="error" line="79"/> + <message kind="error" line="80"/> + + <message kind="error" line="82"/><message kind="error" line="83"/> + <message kind="error" line="84"/><message kind="error" line="85"/> + <message kind="error" line="86"/> + + <message kind="error" line="88"/><message kind="error" line="89"/> + <message kind="error" line="90"/><message kind="error" line="91"/> + <message kind="error" line="92"/> + + <message kind="error" line="94"/><message kind="error" line="95"/> + <message kind="error" line="96"/><message kind="error" line="97"/> + <message kind="error" line="98"/> + + <message kind="error" line="100"/><message kind="error" line="101"/> + <message kind="error" line="102"/><message kind="error" line="103"/> + <message kind="error" line="104"/> + + <message kind="error" line="106"/><message kind="error" line="107"/> + <message kind="error" line="108"/><message kind="error" line="109"/> + <message kind="error" line="110"/> + + <message kind="error" line="112"/><message kind="error" line="113"/> + <message kind="error" line="114"/><message kind="error" line="115"/> + <message kind="error" line="116"/> + + <message kind="error" line="118"/><message kind="error" line="119"/> + <message kind="error" line="120"/><message kind="error" line="121"/> + <message kind="error" line="122"/> + + <message kind="error" line="124"/><message kind="error" line="125"/> + <message kind="error" line="126"/><message kind="error" line="127"/> + <message kind="error" line="128"/> + + <message kind="error" line="130"/> + + </compile> + </ajc-test> +
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/inpath/inpath.xml b/tests/src/test/java/org/aspectj/systemtest/inpath/inpath.xml new file mode 100644 index 000000000..2c0eac4c7 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/inpath/inpath.xml @@ -0,0 +1,11 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[ +<!ENTITY tests SYSTEM "../tests/src/org/aspectj/systemtest/inpath/inpath-tests.xml"> +]> + +<!-- InPath Tests --> + +<suite> + +&tests; + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/java14/Java14Tests.java b/tests/src/test/java/org/aspectj/systemtest/java14/Java14Tests.java new file mode 100644 index 000000000..d71b2ba4f --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/java14/Java14Tests.java @@ -0,0 +1,127 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM Corporation + * 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 + * + * ******************************************************************/ +package org.aspectj.systemtest.java14; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.util.LangUtil; + +public class Java14Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Java14Tests.class); + } + + protected File getSpecFile() { + return getClassResource("java14.xml"); + } + + + public void test001(){ + runTest("assert flow"); + } + + public void test002(){ + runTest("assert flow - 2"); + } + + public void test003(){ + runTest("assert typing"); + } + +// bug in eclipse compiler, moved to ajcTestsFailing.xml +// public void test004(){ +// runTest("assert coverage tests [requires 1.4]"); +// } + +// bug in eclipse compiler, moved to ajcTestsFailing.xml +// public void test005(){ +// runTest("assert coverage tests in one package [requires 1.4]"); +// } + + public void test006(){ + if (!LangUtil.is14VMOrGreater()) { System.err.println("Skipping test 006 not >=1.4");return;} + runTest("compiling asserts in methods"); + } + + public void test007(){ + if (!LangUtil.is14VMOrGreater()) { System.err.println("Skipping test 007 not >=1.4");return;} + runTest("asserts"); + } + + public void test008(){ + if (!LangUtil.is14VMOrGreater()) { System.err.println("Skipping test 008 not >=1.4");return;} + runTest("asserts in aspect and declared methods [requires 1.4]"); + } + + public void test009(){ + runTest("Does the matrix coverage thing for the new method signatures"); + } + + public void test010(){ + runTest("correct types of parameters at call-sites"); + } + + public void test011(){ + runTest("target type matching with messy interface hierarchies"); + } + + public void test012(){ + if (!LangUtil.is14VMOrGreater()) { System.err.println("Skipping test 012 not >=1.4");return;} + runTest("assert tests in introduction [requires 1.4]"); + } + + public void test013(){ + runTest("various forms of package name pattern matching work"); + } + + public void test014(){ + if (!LangUtil.is14VMOrGreater()) { System.err.println("Skipping test 014 not >=1.4");return;} + runTest("assert statement in advice coverage [requires 1.4]"); + } + + public void test015(){ + if (!LangUtil.is14VMOrGreater()) { System.err.println("Skipping test 015 not >=1.4");return;} + runTest("assert statement in advice [requires 1.4]"); + } + + public void test016(){ + if (!LangUtil.is14VMOrGreater()) { System.err.println("Skipping test 016 not >=1.4");return;} + runTest("assert and pertarget crashes compiler"); + } + + public void test017(){ + if (!LangUtil.is14VMOrGreater()) { System.err.println("Skipping test 017 not >=1.4");return;} + runTest("testing that assert works like .class"); + } + + public void test018(){ + runTest("JoinPoint Optimization when targetting 1.4"); + } + + public void test019(){ + runTest("XLint warning for call PCD's using subtype of defining type (-1.4 -Xlint:ignore)"); + } + + // public void test020(){ + // runTest("XLint warning for call PCD's using subtype of defining type (-1.4)"); + // } + + public void test021(){ + if (!LangUtil.is14VMOrGreater()) { System.err.println("Skipping test 021 not >=1.4");return;} + runTest("Class Literals as non final fields (also assert, and this$0)"); + } + + +} + diff --git a/tests/src/test/java/org/aspectj/systemtest/java14/java14-tests.xml b/tests/src/test/java/org/aspectj/systemtest/java14/java14-tests.xml new file mode 100644 index 000000000..364c28e4f --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/java14/java14-tests.xml @@ -0,0 +1,153 @@ +<!-- Java 1.4 Specific Tests --> + + <ajc-test dir="pureJava" title="assert flow" + keywords="from-14tests,purejava"> + <compile options="-source,1.4" files="AssertsCF.java"> + <message kind="error" line="8"/> + <message kind="error" line="11"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" title="assert flow - 2" + keywords="from-14tests,purejava"> + <compile options="-source,1.4" files="AssertsCF2.java"> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" title="assert typing" + keywords="from-14tests,purejava,fail-publicType"> + <compile options="-source,1.4" files="AssertsCF1.java"> + <message kind="error" line="5"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" title="compiling asserts in methods" + keywords="from-14tests,purejava"> + <compile options="-source,1.4" files="AssertInMethod.java"/> + <run class="AssertInMethod" vm="1.4"/> + </ajc-test> + + <ajc-test dir="pureJava" title="asserts" keywords="from-14tests"> + <compile options="-source,1.4" files="Asserts.java"/> + <run class="Asserts" vm="1.4"/> + </ajc-test> + + <ajc-test dir="pureJava" pr="725" + title="asserts in aspect and declared methods [requires 1.4]" + keywords="from-14tests" comment="not pure java!"> + <compile options="-source,1.4" + files="IntroducedAssertion.java"/> + <run class="IntroducedAssertion" vm="1.4"/> + </ajc-test> + + <!-- This test case requires bytecode generated according to the declaring type + rules in JLS 2nd edition. -1.4 must be passed to the eclipse compiler for + this behavior. --> + <ajc-test dir="new" + title="Does the matrix coverage thing for the new method signatures" + keywords="from-resolved_10x"> + <compile files="MethodSignatures.java" options="-1.4,-Xlint:ignore"/> + <run class="MethodSignatures" vm="1.4"/> + </ajc-test> + + <!-- This test case requires bytecode generated according to the declaring type + rules in JLS 2nd edition. -1.4 must be passed to the eclipse compiler for + this behavior. --> + <ajc-test dir="new" title="correct types of parameters at call-sites" + keywords="from-resolved_10x"> + <compile files="CallTypes.java" options="-1.4,-Xlint:ignore"/> + <run class="CallTypes" vm="1.4"/> + </ajc-test> + + <!-- This test case requires bytecode generated according to the declaring type + rules in JLS 2nd edition. -1.4 must be passed to the eclipse compiler for + this behavior. That means that this case will only work under 1.4. --> + <ajc-test dir="new" + title="target type matching with messy interface hierarchies" + keywords="from-resolved_10x"> + <compile files="CallTypesI.java" options="-1.4,-Xlint:ignore"/> + <run class="CallTypesI" vm="1.4"/> + </ajc-test> + + <ajc-test dir="new" title="assert tests in introduction [requires 1.4]" + keywords="from-14tests,fail-unimplemented"> + <compile options="-source,1.4" files="AssertInIntro.java"/> + <run class="AssertInIntro" vm="1.4"/> + </ajc-test> + + + <ajc-test dir="base/test131" + title="various forms of package name pattern matching work" + keywords="from-broken14usejavac"> + <compile files="Driver.java,p1/C1.java,p1/p2/C2.java" /> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="new" pr="657" + title="assert statement in advice coverage [requires 1.4]" + keywords="from-14tests,fail-in-eclipse"> + <compile options="-source,1.4" files="AssertInAdvice.java"/> + <run class="AssertInAdvice" vm="1.4"/> + </ajc-test> + + <ajc-test dir="new" pr="657" + title="assert statement in advice [requires 1.4]" + keywords="from-14tests,fail-in-eclipse"> + <compile options="-source,1.4" files="AssertInAdviceBug.java"/> + <run class="AssertInAdviceBug" vm="1.4"/> + </ajc-test> + + <ajc-test dir="bugs" pr="28703" title="assert and pertarget crashes compiler"> + <compile files="EnsureOverriding.java" options="-source,1.4"/> + <run class="EnsureOverriding" vm="1.4"/> + </ajc-test> + + <ajc-test dir="bugs/interSpecials" title="testing that assert works like .class" + pr="36110"> + <compile files="p1/C.java,p2/A2.java" options="-source,1.4"/> + <run class="p2.A2" vm="1.4"/> + </ajc-test> + + <ajc-test dir="bugs/jpOptimization" + pr="45441" + title="JoinPoint Optimization when targetting 1.4"> + <compile + files="de/test/MyMain.java, + de/test/MyAspect.java" + options="-1.4"/> + <run class="de.test.MyMain"/> + </ajc-test> + + <ajc-test dir="bugs" + title="XLint warning for call PCD's using subtype of defining type (-1.4 -Xlint:ignore)" + pr="41952" + > + <compile + options="-Xlint:ignore,-1.4" + files="DeclaringTypeWarning.java" > + <message kind="warning" line="12"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" + title="XLint warning for call PCD's using subtype of defining type (-1.4)" + pr="41952" + > + <compile + options="-1.4" + files="DeclaringTypeWarning.java" > + <message kind="warning" line="6" text="declaring type"> + <source line="14" file="DeclaringTypeWarning.java"/> + </message> + <message kind="warning" line="12" text="declare warning"> + <source line="19" file="DeclaringTypeWarning.java"/> + </message> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="39711" + title="Class Literals as non final fields (also assert, and this$0)"> + <compile files="ClassLiteralField.java" options="-source,1.4"/> + <run vm="1.4" class="ClassLiteralField"/> + </ajc-test> +
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/java14/java14.xml b/tests/src/test/java/org/aspectj/systemtest/java14/java14.xml new file mode 100644 index 000000000..c25b999cf --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/java14/java14.xml @@ -0,0 +1,11 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[ +<!ENTITY tests SYSTEM "../tests/src/org/aspectj/systemtest/java14/java14-tests.xml"> +]> + +<!-- Tests requiring JDK 1.4 or above --> + +<suite> + +&tests; + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/knownfailures/KnownfailuresTests.java b/tests/src/test/java/org/aspectj/systemtest/knownfailures/KnownfailuresTests.java new file mode 100644 index 000000000..52a626545 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/knownfailures/KnownfailuresTests.java @@ -0,0 +1,37 @@ +/* ******************************************************************* +* Copyright (c) 2005 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: +* Andrew Huff initial implementation +* ******************************************************************/ +package org.aspectj.systemtest.knownfailures; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class KnownfailuresTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(KnownfailuresTests.class); + } + + protected File getSpecFile() { + return new File("../tests/src/org/aspectj/systemtest/knownfailures/knownfailures.xml"); + } + + + public void test001(){ + runTest("NullPointerException in jdt when using generics and inpath"); + // the NPE goes away if you don't use generics + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/knownfailures/knownfailures.xml b/tests/src/test/java/org/aspectj/systemtest/knownfailures/knownfailures.xml new file mode 100644 index 000000000..e2e2343dc --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/knownfailures/knownfailures.xml @@ -0,0 +1,13 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[ +]> + +<!-- AspectJ v1.5.0 Tests --> + +<suite> + + <ajc-test dir="bugs150/pr90588" + pr="90588" title="NullPointerException in jdt when using generics and inpath"> + <compile files="AbstractClass.java,ConcreteClass.java"> + </compile> + </ajc-test> +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/knownlimitations/KnownLimitationsTests.java b/tests/src/test/java/org/aspectj/systemtest/knownlimitations/KnownLimitationsTests.java new file mode 100644 index 000000000..556c66f1e --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/knownlimitations/KnownLimitationsTests.java @@ -0,0 +1,144 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM Corporation + * 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 + * + * ******************************************************************/ +package org.aspectj.systemtest.knownlimitations; + +import java.io.File; +import junit.framework.Test; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class KnownLimitationsTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(KnownLimitationsTests.class); + } + + protected File getSpecFile() { + return new File("../tests/src/org/aspectj/systemtest/knownlimitations/knownlimitations.xml"); + } + + + public void test001(){ + runTest("DEPRECATED: introduce of variables"); + } + + public void test002(){ + runTest("checking the contra-variant errors for typing of proceed"); + } + + public void test003(){ + runTest("introduction of static methods and fields on classes and interfaces"); + } + + public void test004(){ + runTest("advice on catch clauses"); + } + + public void test005(){ + runTest("holding onto proceed calls in a closure-like way"); + } + + public void test006(){ + runTest("PR#458 Compiler was incorrectly flagging error in advice on initialization and static initialization"); + } + + public void test007(){ + runTest("Introduced type unavailable to instanceof expressions in introduced methods"); + } + + public void test008(){ + runTest("enclosing join point not exported properly in pre-initialization join point"); + } + + public void test009(){ + runTest("cyclic pointcut definitions"); + } + + public void test010(){ + runTest("package typepattern with no packages (in default package)"); + } + + public void test011(){ + runTest("flag errors when binding args with indeterminate prefix and suffix"); + } + + public void test012(){ + runTest("around and return types + inlining optimizations"); + } + + public void test013(){ + runTest("source locations within expressions (hard case of constructor start)"); + } + + public void test014(){ + runTest("declaring method on superclass and subclass"); + } + + public void test015(){ + runTest("illegal name binding in around cflow"); + } + + public void test016(){ + runTest("incrementally change string size and wire in injar classes"); + } + + public void test017(){ + runTest("before():execution(new(..)) does not throw NoAspectBoundException"); + } + + public void test018(){ + runTest("declare error on handler/method execution with no code on binary ajc 1.1 classes"); + } + + public void test019(){ + runTest("declare error on handler/method execution with no code on binary javac 1.4 classes"); + } + + public void test020(){ + runTest("CLE: -help usage"); + } + + public void test021(){ + runTest("declare warnings on main - constructor execution"); + } + + public void test022(){ + runTest("declare warnings on binary javac 1.4 main - constructor execution"); + } + + public void test023(){ + runTest("declare warnings on binary ajc 1.1 main - constructor execution"); + } + + public void test024(){ + runTest("advice on handler join points should not throw unpermitted checked exceptions"); + } + + public void test025(){ + runTest("-nowarn suppresses XLint warnings"); + } + + public void test026(){ + runTest("warn:none suppresses XLint warnings"); + } + + public void test027(){ + runTest("-nowarn suppresses declare warnings"); + } + + public void test028(){ + runTest("-warn:none suppresses declare warnings"); + } + + public void test029(){ + runTest("insertion of lots of advice code can make branch offset for if too large"); + } + +} + diff --git a/tests/src/test/java/org/aspectj/systemtest/knownlimitations/knownLimitations-tests.xml b/tests/src/test/java/org/aspectj/systemtest/knownlimitations/knownLimitations-tests.xml new file mode 100644 index 000000000..d420885de --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/knownlimitations/knownLimitations-tests.xml @@ -0,0 +1,297 @@ +<!-- Known Limitations --> + + <!-- we're not implementing static inter-type fields on interfaces in 1.1 --> + <ajc-test dir="knownLimitations/test117" title="DEPRECATED: introduce of variables" + keywords="from-base,knownLimitation"> + <compile files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <!-- we're not implementing this error check in 1.1 --> + <ajc-test dir="errors" + title="checking the contra-variant errors for typing of proceed" + keywords="from-errors,knownLimitation"> + <compile files="BadAround.java"> + <message kind="error" line="12"/> + <message kind="error" line="15"/> + <message kind="error" line="18"/> + <message kind="error" line="19"/> + <message kind="error" line="22"/> + </compile> + </ajc-test> + + <!-- we're not implementing static inter-type fields on interfaces in 1.1 --> + <ajc-test dir="design/intro" + title="introduction of static methods and fields on classes and interfaces" + keywords="from-design,knownLimitation"> + <compile files="Statics.java"/> + <run class="Statics"/> + </ajc-test> + + <!-- only before advice implemented for handler join points in 1.1 --> + <ajc-test dir="new" title="advice on catch clauses" + keywords="from-resolved_10x,knownLimitation"> + <compile files="CatchAdvice.java"/> + <run class="CatchAdvice"/> + </ajc-test> + + <!-- we will handle this by signalling a weave-time error for any around + advice that is applied to a join point which throws checked exceptions + that it can't handle. proceeds in closures change the exceptions that + around advice can handle to include the greatest lower bound of the + checked exceptions that are legally throwable by the proceed. + Ideally their should be an -Xlint compile-time warning for ALL + cases that could produce weave-time errors. + --> + <ajc-test dir="new" title="holding onto proceed calls in a closure-like way" + keywords="from-resolved_10x,knownLimitation"> + <compile files="HoldProceed.java"/> + <run class="HoldProceed"/> + </ajc-test> + + <!-- around advice not implemented on initializer join points --> + <ajc-test dir="new" pr="490" + title="PR#458 Compiler was incorrectly flagging error in advice on initialization and static initialization" + keywords="from-resolved_10x,knownLimitation"> + <compile files="StaticInitCE.java"/> + <run class="StaticInitCE"/> + </ajc-test> + + <!-- This behavior is different from 1.0, but we might want to consider allowing it + Using the eclipse compiler it would be much easier to permit than forbid. --> + <ajc-test dir="new/introTypeMissing" + title="Introduced type unavailable to instanceof expressions in introduced methods" + keywords="from-resolved_10x,knownLimitation"> + <compile files="InstanceOf.java,TargetClass.java,Util.java"> + <message kind="error" line="19"/> + <message kind="error" line="20"/> + <message kind="error" line="21"/> + <message kind="error" line="22"/> + <message kind="error" line="23"/> + <message kind="error" line="24"/> + <message kind="error" line="25"/> + <message kind="error" line="26"/> + </compile> + </ajc-test> + + <ajc-test dir="new" + title="enclosing join point not exported properly in pre-initialization join point" + keywords="from-resolved_10x,knownLimitation"> + <compile files="PreInitialization.java"/> + <run class="PreInitialization"/> + </ajc-test> + + <!-- pointcuts aren't checked for circularities unless they're used --> + <ajc-test dir="new" pr="568" title="cyclic pointcut definitions" + keywords="from-resolved_10rc3,knownLimitation"> + <compile files="CyclicPointcuts.java"> + <message kind="error" line="11"/> + <message kind="error" line="14"/> + <message kind="error" line="18"/> + <message kind="error" line="32"/> + <message kind="error" line="43"/> + </compile> + </ajc-test> + + <ajc-test dir="new" + title="package typepattern with no packages (in default package)" + keywords="from-resolved_105,knownLimitation"> + <compile options="-Xlint" files="TypeNames.java"> + <message kind="warning" line="34"/> + <message kind="warning" line="39"/> + <message kind="warning" line="43"/> + <message kind="warning" line="47"/> + </compile> + <run class="TypeNames"/> + </ajc-test> + + <ajc-test dir="new" pr="764" + title="flag errors when binding args with indeterminate prefix and suffix" + keywords="from-resolved_105,knownLimitation"> + <compile files="IndeterminateArgsCE.java"> + <message kind="error" line="67"/> + <message kind="error" line="68"/> + <message kind="error" line="70"/> + <message kind="error" line="72"/> + </compile> + </ajc-test> + + <ajc-test dir="design/around" + title="around and return types + inlining optimizations" + comment="-XOcodeSize not in 1.1, source uses 1.4 APIs" + keywords="from-14tests,knownLimitation"> + <compile options="-XOcodeSize,-source,1.4" + files="ReturnCastProceed.java,StackChecker.java"> + <message kind="warning" line="68"/> + </compile> + <run class="ReturnCastProceed" vm="1.4"/> + </ajc-test> + + <ajc-test dir="new" pr="885" keywords="knownLimitation" + comment="this behaves differently in 1.3 from 1.4 for unknown reasons, merge with above when resolved" + title="source locations within expressions (hard case of constructor start)"> + <compile files="SourceLocationWithinExprHard.java"/> + <run class="SourceLocationWithinExprHard"/> + </ajc-test> + + <!-- Can't handle packages named 'aspect' in parser + --> + <ajc-test dir="new/PR852" pr="852" + title="declaring method on superclass and subclass" + keywords="knownLimitation"> + <compile files="aspect/Aspect.java,target/SubClass.java,target/SuperClass.java"> + <dir-changes added="target.SubClass,target.SuperClass"/> + </compile> + <run class="aspect.Aspect"/> + </ajc-test> + + <ajc-test dir="new" pr="660" title="illegal name binding in around cflow" + keywords="from-resolved_104,knownLimitation"> + <compile files="ArgsInCflowCf.java"> + <message kind="error" line="19"/> + <message kind="error" line="29"/> + <message kind="error" line="35"/> + </compile> + </ajc-test> + + <ajc-test dir="incremental/stringliteral" + keywords="knownLimitation" + title="incrementally change string size and wire in injar classes"> + <compile staging="true" options="-incremental" + files="oneInjar.jar,twoInjar.jar" + sourceroots="src"/> + <run class="packageOne.Main" + options="in packageOne.Main.main(..), + before main packageOne.Main"/> + <inc-compile tag="20"> + <dir-changes updated="packageOne.Main"/> + </inc-compile> + <!-- now failing here. This step passes in non-injar variant. --> + <run class="packageOne.Main" + options="in longer packageOne.Main.main(..), + before main packageOne.Main"/> + <inc-compile tag="30"> + <dir-changes added="RunInjarMains"/> + </inc-compile> + <run class="packageOne.Main" + options="in longer packageOne.Main.main(..), + before main InjarOneMain, + before main InjarTwoMain, + before main packageOne.Main"/> + </ajc-test> + + <ajc-test dir="bugs" pr="34206" + keywords="knownLimitation" + title="before():execution(new(..)) does not throw NoAspectBoundException" + comment="correct behavior of this case needs to be thought through"> + <compile files="AspectInitError.java"/> + <run class="AspectInitError"/> + </ajc-test> + + <ajc-test dir="new/binaryWarnings/src" pr="37020" + keywords="knownLimitation" + comment="source loc of binary jp depends on first code, not block start" + title="declare error on handler/method execution with no code on binary ajc 1.1 classes"> + <compile files="aspects/MainExecStartLinesErrors.java,../injars/appStartLines-ajc-1.1.jar"> + <message kind="error" file="app/MainExecStartLines.java" + line="6" text="execution(void MainExecStartLines.main(String[]))"/> + <message kind="error" file="app/MainExecStartLines.java" + line="17" text="handler(RuntimeException)"/> + </compile> + </ajc-test> + + <ajc-test dir="new/binaryWarnings/src" pr="37020" + keywords="knownLimitation" + comment="source loc of binary jp depends on first code, not block start; XXX need javac inlining example" + title="declare error on handler/method execution with no code on binary javac 1.4 classes"> + <compile files="aspects/MainExecStartLinesErrors.java,../injars/appStartLines-javac-1.4.jar"> + <message kind="error" file="app/MainExecStartLines.java" + line="6" text="execution(void MainExecStartLines.main(String[]))"/> + <message kind="error" file="app/MainExecStartLines.java" + line="17" text="handler(RuntimeException)"/> + </compile> + </ajc-test> + + <ajc-test dir="harness" + keywords="command-line-error,knownLimitation" + comment="can't test -help: has to abort, but returns 0, normal status" + title="CLE: -help usage"> + <compile badInput="true" options="-help"> + <message kind="abort" text="Usage"/> + </compile> + </ajc-test> + + <!-- The next three tests are all about the same issue. The source + line for a constructor execution is returned as the first executable + line within the constructor-execution join point rather than the declaration + line of the constructor. Any other definition will require collusion between + the source->bytecode compiler and the weaver and will only work in + those case where such collusion is possible. + --> + + <ajc-test dir="new/binaryWarnings/src" pr="37020" keywords="knownLimitation" + title="declare warnings on main - constructor execution"> + <compile files="aspects/ConstructorExecutionWarning.java,app/Main.java"> + <message kind="warning" file="app/Main.java" + line="23" text="execution(Main.new())"/> + </compile> + <run class="app.Main"/> + </ajc-test> + + <ajc-test dir="new/binaryWarnings/src" pr="37020" keywords="knownLimitation" + title="declare warnings on binary javac 1.4 main - constructor execution"> + <compile files="aspects/ConstructorExecutionWarning.java,../injars/app-javac-1.4.jar"> + <message kind="warning" file="app/Main.java" + line="23" text="execution(Main.new())"/> + </compile> + <run class="app.Main"/> + </ajc-test> + + <ajc-test dir="new/binaryWarnings/src" pr="37020" keywords="knownLimitation" + title="declare warnings on binary ajc 1.1 main - constructor execution"> + <compile files="aspects/ConstructorExecutionWarning.java,../injars/app-ajc-1.1.jar"> + <message kind="warning" file="app/Main.java" + line="23" text="execution(Main.new())"/> + </compile> + <run class="app.Main"/> + </ajc-test> + + <ajc-test dir="bugs/handlers" pr="37898" keywords="knownLimitation" + title="advice on handler join points should not throw unpermitted checked exceptions"> + <compile files="ExceptionCheckCE.java"> + <message kind="warning" line="8" text="expected"/> + <message kind="error" line="25" text="throw checked exception" /> + <message kind="error" line="8" text="throw checked exception" /> + </compile> + </ajc-test> + + <ajc-test dir="harness" pr="38134" keywords="knownLimitation" + comment="behavior is correct for 1.1 - revisit for 1.2" + title="-nowarn suppresses XLint warnings"> + <compile files="XLintWarningTest.java" options="-nowarn"/> + </ajc-test> + + <ajc-test dir="harness" pr="38134" keywords="knownLimitation" + comment="behavior is correct for 1.1 - revisit for 1.2" + title="warn:none suppresses XLint warnings"> + <compile files="XLintWarningTest.java" options="-warn:none"/> + </ajc-test> + + <ajc-test dir="harness" pr="38134" keywords="knownLimitation" + comment="behavior is correct for 1.1 - revisit for 1.2" + title="-nowarn suppresses declare warnings"> + <compile files="WarningTest.java" options="-nowarn"/> + </ajc-test> + + <ajc-test dir="harness" pr="38134" keywords="knownLimitation" + comment="behavior is correct for 1.1 - revisit for 1.2" + title="-warn:none suppresses declare warnings"> + <compile files="WarningTest.java" options="-warn:none"/> + </ajc-test> + + <ajc-test dir="bugs" pr="38168" keywords="knownLimitation" + title="insertion of lots of advice code can make branch offset for if too large"> + <compile files="WideJumps.java"/> + <run class="WideJumps"/> + </ajc-test> + diff --git a/tests/src/test/java/org/aspectj/systemtest/knownlimitations/knownLimitations.xml b/tests/src/test/java/org/aspectj/systemtest/knownlimitations/knownLimitations.xml new file mode 100644 index 000000000..25d99f6e4 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/knownlimitations/knownLimitations.xml @@ -0,0 +1,11 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[ +<!ENTITY tests SYSTEM "../tests/src/org/aspectj/systemtest/knownlimitations/knownLimitations-tests.xml"> +]> + +<!-- Known Limitations -these tests will fail --> + +<suite> + +&tests; + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/model/Model5Tests.java b/tests/src/test/java/org/aspectj/systemtest/model/Model5Tests.java new file mode 100644 index 000000000..3176803e4 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/model/Model5Tests.java @@ -0,0 +1,93 @@ +/******************************************************************** + * Copyright (c) 2006 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://eclipse.org/legal/epl-v10.html + * + * Contributors: IBM Corporation - initial API and implementation + * Helen Hawkins - initial version + *******************************************************************/ +package org.aspectj.systemtest.model; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.weaver.World; + +/** + * Tests the model when there is a requirement on Java5 features. + * + * @see org.aspectj.systemtest.model.ModelTestCase + */ +public class Model5Tests extends ModelTestCase { + + static { + // Switch this to true for a single iteration if you want to reconstruct the + // 'expected model' files. + regenerate = false; + // Switch this to true if you want to debug the comparison + debugTest = false; + } + + public void testDeclareAtTypeInStructureModel_pr115607() { + runModelTest("declare at type appears correctly in structure model", "pr115607"); + } + + public void testStructureModelForGenericITD_pr131932() { + runModelTest("structure model for generic itd", "pr131932"); + } + + public void testDeclareAnnotationAppearsInStructureModel_pr132130() { + runModelTest("declare annotation appears in structure model when in same file", "pr132130"); + } + + public void testAtAspectDEOWInStructureModel_pr120356() { + runModelTest("@AJ deow appear correctly when structure model is generated", "pr120356"); + } + + public void testDeclareAtMethodRelationship_pr143924() { + runModelTest("declare @method relationship", "pr143924"); + } + + public void testNewIProgramElementMethodsForGenerics_pr141730() { + runModelTest("new iprogramelement methods for generics", "pr141730_2"); + } + + // if not filling in the model for classes contained in jar files then + // want to ensure that the relationship map is correct and has nodes + // which can be used in AJDT - ensure no NPE occurs for the end of + // the relationship with inpath + public void testAspectPathRelWhenNotFillingInModel_pr141730() { + World.createInjarHierarchy = false; + try { + // the aspect used for this test has advice, declare parents, deow, + // and declare @type, @constructor, @field and @method. We only expect + // there to be relationships in the map for declare parents and declare @type + // (provided the model isn't being filled in) because the logic in the other + // addXXXRelationship methods use AspectJElementHierarchy.findElementForType(). + // This method which returns null because there is no such ipe. The relationship is + // therefore not added to the model. Adding declare @type and declare parents + // uses AspectJElementHierarchy.findElementForHandle() which returns the file + // node ipe if it can't find one for the given handle. Therefore the relationships + // are added against the file node. Before change to using ipe's to create handles + // we also had the deow relationship, however, now we don't because this also + // uses findElementForType to find the targetNode which in the inpath case is null. + runModelTest("ensure inpath injar relationships are correct when not filling in model", "pr141730_4"); + } finally { + World.createInjarHierarchy = true; + } + } + + // /////////////////////////////////////// + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Model5Tests.class); + } + + protected File getSpecFile() { + return getClassResource("model.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/model/ModelTestCase.java b/tests/src/test/java/org/aspectj/systemtest/model/ModelTestCase.java new file mode 100644 index 000000000..0e443c3d3 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/model/ModelTestCase.java @@ -0,0 +1,218 @@ +/******************************************************************** + * Copyright (c) 2006 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://eclipse.org/legal/epl-v10.html + * + * Contributors: IBM Corporation - initial API and implementation + * Helen Hawkins - initial version + *******************************************************************/ +package org.aspectj.systemtest.model; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.aspectj.asm.AsmManager; +import org.aspectj.asm.IElementHandleProvider; +import org.aspectj.asm.IModelFilter; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.util.FileUtil; + +/** + * This class provides an extension to the XMLBasedAjcTestCase to manage testing the model. It assumes the testdata is in + * ../tests/model/<testid> and that the expected model against which to do the comparison is in the file + * ../tests/model/expected/<testid>.txt. One test ensures that both the model and the relationship map are as expected for the given + * testdata. + * + * To write a testcase, create a testdata directory containing the data for the test run and a file containing the expected model + * (this can be generated by setting the regenerate flag to true). Add the required configuration to model.xml. Finally, create a + * testcase in either ModelTests or Model5Tests (depending on whether the testcase has a requirement on Java5) and call + * runModelTest(<title of test>,<testid>). + */ +public abstract class ModelTestCase extends XMLBasedAjcTestCase { + + protected static boolean regenerate = false; + protected static boolean debugTest = false; + + private final String expectedOutDir = "../tests/model/expected" + File.separator; + private String testid; + + private String modelFilename; + + private IElementHandleProvider handleProvider; + + /* + * (non-Javadoc) + * + * @see junit.framework.TestCase#setUp() + */ + protected void setUp() throws Exception { + super.setUp(); + // using the JDTLikeHandleProvider because this produces consistent handles + // over different compiles + // We are about to create a sandbox for the model output file, don't let the + // following compile wipe it. + ajc.setShouldEmptySandbox(false); + // report all information - model, relationships delta processing + modelFilename = ajc.getSandboxDirectory().getAbsolutePath() + File.separator + "model.txt"; + AsmManager.setReporting(modelFilename, true, true, true, false, + new TestFilter(ajc.getSandboxDirectory().getCanonicalPath())); + } + + static class TestFilter implements IModelFilter { + String sandboxDirectory; + + public TestFilter(String sandboxDirectory) { + this.sandboxDirectory = sandboxDirectory; + } + + public String processFilelocation(String loc) { + if (loc.toLowerCase().startsWith(sandboxDirectory.toLowerCase())) { + String sub = loc.substring(sandboxDirectory.length()); + int forwardSlash = sub.indexOf("/"); + // replace all "/" with "\" - to ensure platform independence + if (forwardSlash != -1) { + sub = sub.replace('/', '\\'); + } + // don't report the column number since this is sometimes + // different on windows and linux + int column = sub.lastIndexOf(':'); + if (column != -1) { + return "TEST_SANDBOX" + sub.substring(0, column); + } + return "TEST_SANDBOX" + sub; + } + return loc; + } + + public boolean wantsHandleIds() { + return false; + } + } + + /* + * (non-Javadoc) + * + * @see junit.framework.TestCase#tearDown() + */ + protected void tearDown() throws Exception { + super.tearDown(); + AsmManager.setDontReport(); + ajc.setShouldEmptySandbox(true); + } + + /** + * Firstly sets the testid which is both the name of the expected output file and the name of the testdata directory. It then + * invokes XMLBasedAjcTestCase.runTest(String) with the given title and finally verifies that the model file created from this + * test run is the same as the expected output (includes model information, the relationship map and various properties about + * the model) contained in ../tests/model/expected/<testid>.txt + */ + protected void runModelTest(String title, String testid) { + this.testid = testid; + runTest(title); + verifyModel(); + } + + private void verifyModel() { + File expectedOutput = new File(expectedOutDir + testid + ".txt"); + if (regenerate) { + // Create the file + saveModel(expectedOutput); + } else { + // Verify the file matches what we have + compareModel(expectedOutput); + } + } + + private void compareModel(File expectedF) { + if (debugTest) + System.out.println("comparing with model in file " + expectedF.getAbsolutePath()); + List<String> fileContents = new ArrayList<String>(); + try { + // String sandboxDir = ajc.getSandboxDirectory().getAbsolutePath(); + String modelOutput = modelFilename; + // Load the file with the expected output + BufferedReader expect = new BufferedReader(new FileReader(expectedF)); + // String tempDir = expect.readLine(); + String expectedLine = null; + while ((expectedLine = expect.readLine()) != null) { + fileContents.add(expectedLine); + } + List<String> expectedFileContents = new ArrayList<String>(); + expectedFileContents.addAll(fileContents); + + // Load the file with the output from this test run + BufferedReader found = new BufferedReader(new FileReader(new File(modelOutput))); + String foundLine = null; + List<String> foundFileContents = new ArrayList<String>(); + while ((foundLine = found.readLine()) != null) { + // int i = foundLine.indexOf(sandboxDir); + // if (i == -1) { + // int j = foundLine.indexOf("(targets="); + // if (j == -1) { + foundFileContents.add(foundLine); + // } else { + // foundFileContents.add(foundLine.substring(j)); + // } + // } else { + // String newLine = foundLine.substring(0,i) + tempDir + // + foundLine.substring(i + sandboxDir.length()); + // foundFileContents.add(newLine); + // } + } + + // iterate over what we found + for (Iterator<String> iter = foundFileContents.iterator(); iter.hasNext();) { + String line = (String) iter.next(); + if (debugTest) + System.err.println("looking at model entry: " + line); + if (!fileContents.contains(line)) { + // if (!((String)fileContents.get(lineNumber)).equals(line)) { + + if (debugTest) { + System.err.println("couldn't find: " + line); + for (Iterator<String> iterator = fileContents.iterator(); iterator.hasNext();) { + String element = (String) iterator.next(); + System.err.println("compared with: " + element); + } + } + + // StringBuffer errorData = new StringBuffer(); + // errorData.append("Problem with comparison at line number: "+) + fail("couldn't find model entry '" + line + "' in expected output"); + } else { + fileContents.remove(line); + } + } + + if (debugTest && !fileContents.isEmpty()) { + for (Iterator<String> iter = fileContents.iterator(); iter.hasNext();) { + String element = (String) iter.next(); + System.err.println("remaining: " + element); + } + } + assertTrue("should have found all expected model output: " + fileContents, fileContents.isEmpty()); + } catch (Exception e) { + fail("Unexpected exception comparing model files:" + e); + } + } + + private void saveModel(File f) { + if (debugTest) + System.out.println("Saving model into " + f.getAbsolutePath()); + File modelFile = new File(modelFilename); + try { + FileUtil.copyFile(modelFile, f); + } catch (IOException ioe) { + ioe.printStackTrace(); + fail("Couldn't copy file to " + f.toString()); + } + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/model/ModelTests.java b/tests/src/test/java/org/aspectj/systemtest/model/ModelTests.java new file mode 100644 index 000000000..26b3887f7 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/model/ModelTests.java @@ -0,0 +1,114 @@ +/******************************************************************** + * Copyright (c) 2006 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://eclipse.org/legal/epl-v10.html + * + * Contributors: IBM Corporation - initial API and implementation + * Helen Hawkins - initial version + *******************************************************************/ +package org.aspectj.systemtest.model; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.weaver.World; + +/** + * Tests the model when there is no requirement on Java5 features. + * + * @see org.aspectj.systemtest.model.ModelTestCase + */ +public class ModelTests extends ModelTestCase { + + static { + // Switch this to true for a single iteration if you want to reconstruct the + // 'expected model' files. + regenerate = false; + // Switch this to true if you want to debug the comparison + debugTest = false; + } + + public void testAdviceInStructureModelWithAnonymousInnerClass_pr77269() { + runModelTest("advice in structure model with anonymous inner class", "pr77269_1"); + } + + public void testAdviceInStructureModelWithNamedInnerClass_pr77269() { + runModelTest("advice in structure model with named inner class", "pr77269_2"); + } + + public void testDWInStructureModelWithAnonymousInnerClass_pr77269() { + runModelTest("declare warning in structure model with anonymous inner class", "pr77269_3"); + } + + public void testNewIProgramElementMethods_pr141730() { + runModelTest("new iprogramelement methods", "pr141730_1"); + } + + // if not filling in the model for aspects contained in jar files then + // want to ensure that the relationship map is correct and has nodes + // which can be used in AJDT - ensure no NPE occurs for the end of + // the relationship with aspectpath + public void testAspectPathRelWhenNotFillingInModel_pr141730() { + World.createInjarHierarchy = false; + try { + runModelTest("ensure aspectpath injar relationships are correct when not filling in model", "pr141730_3"); + } finally { + World.createInjarHierarchy = true; + } + } + + // + // public void testPCDInClassAppearsInModel_pr148027() { + // boolean b = AsmHierarchyBuilder.shouldAddUsesPointcut; + // AsmHierarchyBuilder.shouldAddUsesPointcut = true; + // World.createInjarHierarchy = false; + // try { + // runModelTest("ensure pcd declare in class appears in model", "pr148027"); + // } finally { + // World.createInjarHierarchy = true; + // AsmHierarchyBuilder.shouldAddUsesPointcut = b; + // } + // } + + // public void testInpathAdvisedCode_prX() { runModelTest("inpath advised elements","prX"); } + + public void testSourceLocationAndJarFile_pr145963() { + runModelTest("sourcelocation and jar file", "pr145963_1"); + } + + public void testSourceLocationAndClassFile_pr145963() { + runModelTest("sourcelocation and class file", "pr145963_2"); + } + + public void testAspectInDefaultPackage_pr145963() { + runModelTest("aspect in default package", "pr145963_3"); + } + + public void testAspectInJavaFile_pr145963() { + runModelTest("aspect in java file", "pr145963_4"); + } + + public void testAbstractAspectsAndAdvice_pr160469() { + runModelTest("ensure advice from abstract aspects appear correctly in the model", "pr160469_1"); + } + + public void testAbstractAspectsAndDeow_pr160469() { + runModelTest("ensure deow from abstract aspects appear correctly in the model", "pr160469_2"); + } + + // public void testMultipleIdenticalJpsOnOneLine_pr238054() { runModelTest("multiple identical jps on one line","pr238054");} + + // /////////////////////////////////////// + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(ModelTests.class); + } + + protected File getSpecFile() { + return getClassResource("model.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/model/model.xml b/tests/src/test/java/org/aspectj/systemtest/model/model.xml new file mode 100644 index 000000000..811b78254 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/model/model.xml @@ -0,0 +1,115 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- Model and Hierarchy Tests --> +<suite> +<!-- non-AspectJ 5 specific tests --> + + <ajc-test dir="model/pr238054" title="multiple identical jps on one line"> + <compile files="pr238054.aj" options="-emacssym"/> + </ajc-test> + + + + <ajc-test dir="model/pr77269_1" title="advice in structure model with anonymous inner class"> + <compile files="pack/pr77269.aj" options="-emacssym -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="model/pr77269_2" title="advice in structure model with named inner class"> + <compile files="pr77269b.aj" options="-emacssym -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="model/pr77269_3" title="declare warning in structure model with anonymous inner class"> + <compile files="pack/pr77269c.aj" options="-emacssym -Xset:minimalModel=false"> + <message kind="warning" line="8" text="blah blah blah"/> + </compile> + </ajc-test> + + <ajc-test dir="model/pr145963_1" title="sourcelocation and jar file"> + <compile files="C.java, SourceAspect.aj" aspectpath="simple.jar" options="-emacssym"> + <message kind="warning" line="6" text="There should be no printlns"/> + </compile> + </ajc-test> + + <ajc-test dir="model/pr145963_2" title="sourcelocation and class file"> + <compile files="C.java, SourceAspect.aj" aspectpath="pkg" options="-emacssym"> + <message kind="warning" line="6" text="There should be no printlns"/> + </compile> + </ajc-test> + + <ajc-test dir="model/pr145963_3" title="aspect in default package"> + <compile files="C.java" aspectpath="simple.jar" options="-emacssym -Xset:minimalModel=false"> + <message kind="warning" line="6" text="There should be no printlns"/> + </compile> + </ajc-test> + + <ajc-test dir="model/pr145963_4" title="aspect in java file"> + <compile files="C.java" aspectpath="simple.jar" options="-emacssym -Xset:minimalModel=false"> + <message kind="warning" line="6" text="There should be no printlns"/> + </compile> + </ajc-test> + + <ajc-test dir="model/pr141730_1" title="new iprogramelement methods"> + <compile files="pr141730.aj" options="-emacssym"/> + </ajc-test> + + <ajc-test dir="model/pr141730_3" title="ensure aspectpath injar relationships are correct when not filling in model"> + <compile files="MyFoo.java" aspectpath="aspectpath.jar" options="-emacssym"/> + </ajc-test> + + <ajc-test dir="model/pr148027" title="ensure pcd declare in class appears in model"> + <compile files="A.aj, C.aj" options="-emacssym"/> + </ajc-test> + + <ajc-test dir="model/pr160469_1" title="ensure advice from abstract aspects appear correctly in the model"> + <compile files="Simple.java" options="-emacssym" aspectpath="aspects.jar"/> + </ajc-test> + + <ajc-test dir="model/pr160469_2" title="ensure deow from abstract aspects appear correctly in the model"> + <compile files="Simple.java" options="-emacssym -Xset:minimalModel=false" aspectpath="aspects.jar"> + <message kind="warning" line="5" text="warning"/> + </compile> + </ajc-test> + +<!-- AspectJ 5 specific tests --> + + <ajc-test dir="model/pr115607" title="declare at type appears correctly in structure model"> + <compile files="pr115607.java" options="-1.5,-emacssym,-Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="model/pr131932" title="structure model for generic itd"> + <compile files="pr131932.aj" options="-1.5 -emacssym"/> + </ajc-test> + + <ajc-test dir="model/pr132130" title="declare annotation appears in structure model when in same file"> + <compile files="pr132130.aj" options="-1.5 -emacssym -Xset:minimalModel=false"/> + </ajc-test> + + <ajc-test dir="model/pr120356" title="@AJ deow appear correctly when structure model is generated"> + <compile files="C.java, A.java" options="-1.5, -emacssym -Xset:minimalModel=false"> + <message kind="error" line="8" text="error"/> + <message kind="warning" line="5" text="warning"/> + </compile> + </ajc-test> + + <ajc-test dir="model/pr143924" title="declare @method relationship"> + <compile files="pr143924.aj" options="-1.5 -showWeaveInfo -emacssym -Xset:minimalModel=false"> + <message kind="weave" text="'public void BankAccount.debit(String,long)' (pr143924.aj:7) is annotated with @Secured"/> + </compile> + </ajc-test> + + <ajc-test dir="model/pr141730_2" title="new iprogramelement methods for generics"> + <compile files="pr141730.aj" options="-1.5 -emacssym"/> + </ajc-test> + + <ajc-test dir="model/pr141730_4" title="ensure inpath injar relationships are correct when not filling in model"> + <compile files="MyBar.aj, MyAnnotation.java, NewClass.java" inpath="inpath.jar" options="-1.5 -emacssym -Xset:minimalModel=false"> + <message kind="warning" line="20" text="System.out should not be called"/> + </compile> + </ajc-test> + + <ajc-test dir="model/prX" title="inpath advised elements"> + <compile files="X.java" inpath="inpath.jar" options="-1.5 -emacssym"/> + </ajc-test> + + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/options/OptionsTests.java b/tests/src/test/java/org/aspectj/systemtest/options/OptionsTests.java new file mode 100644 index 000000000..80710a6ed --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/options/OptionsTests.java @@ -0,0 +1,44 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM Corporation + * 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 + * + * ******************************************************************/ +package org.aspectj.systemtest.options; + +import java.io.File; +import junit.framework.Test; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class OptionsTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(OptionsTests.class); + } + + protected File getSpecFile() { + return getClassResource("options.xml"); + } + + + public void test001(){ + runTest("options -warn:deprecation"); + } + + public void test002(){ + runTest("options -warn:deprecation not enabled"); + } + + public void test003(){ + runTest("setting -warn:constructorName works"); + } + + public void test004(){ + runTest("-deprecation not working?"); + } + +} + diff --git a/tests/src/test/java/org/aspectj/systemtest/options/options-tests.xml b/tests/src/test/java/org/aspectj/systemtest/options/options-tests.xml new file mode 100644 index 000000000..d109cd2d0 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/options/options-tests.xml @@ -0,0 +1,37 @@ +<!-- Options Tests --> + + <!-- .................................... option tests --> + <!-- .................................... -warn tests --> + <ajc-test dir="options/deprecated" + title="options -warn:deprecation"> + <compile files="WarnDeprecated.java,OldStuff.java" + options="!eclipse,-warn:deprecation"> + <message kind="warning" line="10"/> + </compile> + </ajc-test> + + <ajc-test dir="options/deprecated" + title="options -warn:deprecation not enabled"> + <compile files="WarnDeprecated.java,OldStuff.java" + options="!eclipse"> + </compile> + </ajc-test> + + + <ajc-test dir="harness" + title="setting -warn:constructorName works"> + <compile files="ConstructorNameWarning.java" + options="-warn:constructorName"> + <message kind="warning" line="5" text="constructor name"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/deprecated" pr="54098" + title="-deprecation not working?" > + <compile files="Deprecation.java, Deprecated.java" options="-deprecation"> + <message kind="warning" line="5"/> + <message kind="warning" line="6"/> + </compile> + </ajc-test> + +
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/options/options.xml b/tests/src/test/java/org/aspectj/systemtest/options/options.xml new file mode 100644 index 000000000..d877da040 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/options/options.xml @@ -0,0 +1,10 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[ +<!ENTITY tests SYSTEM "../tests/src/org/aspectj/systemtest/options/options-tests.xml"> +]> +<!-- Options Tests --> + +<suite> + +&tests; + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/pre10x/AjcPre10xTests.java b/tests/src/test/java/org/aspectj/systemtest/pre10x/AjcPre10xTests.java new file mode 100644 index 000000000..be240a9be --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/pre10x/AjcPre10xTests.java @@ -0,0 +1,316 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM Corporation + * 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 + * + * ******************************************************************/ +package org.aspectj.systemtest.pre10x; + +import java.io.File; +import junit.framework.Test; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class AjcPre10xTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(AjcPre10xTests.class); + } + + protected File getSpecFile() { + return getClassResource("pre10x.xml"); + } + + + public void test001(){ + runTest("Using 'aspect' as identifier is legal TODO"); + } + + public void test002(){ + runTest("Using 'pointcut' as identifier is legal TODO"); + } + + public void test003(){ + runTest("CF expected when enclosing class superclass used as this qualifier in inner class"); + } + + public void test004(){ + runTest("enclosing class may be used as this qualifier in inner class"); + } + + public void test005(){ + runTest("reasonable error for crosscut reference with no formals specified"); + } + + public void test006(){ + runTest("reasonable error for introduction on type whose source isn't found"); + } + + public void test007(){ + runTest("handle errors in crosscut designators, insist that they end with a semicolon"); + } + + public void test008(){ + runTest("try to return from a before, after, after throwing and after returning"); + } + + public void test009(){ + runTest("the designator has a wildcard for method name but no return type specified"); + } + + public void test010(){ + runTest("the designator for the introduction has no type after the | charcter"); + } + + public void test011(){ + runTest("crosscut signature does not match"); + } + + public void test012(){ + runTest("proper exit conditions when errors fall through to javac"); + } + + public void test013(){ + runTest("mismatched parens on advice (wasn't binding Tester)"); + } + + public void test014(){ + runTest("Non-static advice silently ignored"); + } + + public void test015(){ + runTest("extra closing brace"); + } + + public void test016(){ + runTest("decent errors for around return type not matching target point"); + } + + public void test017(){ + runTest("eachobject: can't call new on an aspect of"); + } + + public void test018(){ + runTest("eachobject: only zero-argument constructors allowed in an aspect"); + } + + public void test019(){ + runTest("eachobject: can't extend a concrete aspect"); + } + + public void test020(){ + runTest("instanceof used without a class"); + } + + public void test021(){ + runTest("wildcard used for returns clause"); + } + + public void test022(){ + runTest("no return statement in around advice"); + } + + public void test023(){ + runTest("inner aspects must be static (no longer matches PR#286)"); + } + + public void test024(){ + runTest("Casting class declarations as interfaces"); + } + + public void test025(){ + runTest("omits a variable name and crashes with a null pointer"); + } + + public void test026(){ + runTest("Not generating an error for using new as a method name"); + } + + public void test027(){ + runTest("ClassCastException on the int literal"); + } + + public void test028(){ + runTest("Wrong strictfp keyword usage in interface function prototype [TODO: move to errors]"); + } + + public void test029(){ + runTest("Wrong strictfp keyword usage in field declaration [TODO: move to errors]"); + } + + public void test030(){ + runTest("Wrong strictfp keyword usage in constructor declaration [TODO: move to errors]"); + } + + public void test031(){ + runTest("Incorrect static casts to primitively foldable arguments should not crash the compiler."); + } + + public void test032(){ + runTest("Dominates with commas should signal an error."); + } + + public void test033(){ + runTest("stack overflow with recursive crosscut specifier"); + } + + public void test034(){ + runTest("Throwing a NullPointerException when formals can't be bound in named pointcut"); + } + + public void test035(){ + runTest("disallow defining more than one pointcut with the same name"); + } + + public void test036(){ + runTest("pre 0.7 introduction form outside aspect body causes an EmptyStackException"); + } + + public void test037(){ + runTest("a class can't extend an aspect"); + } + + public void test038(){ + runTest("a before() clause at the class-level causes an EmptyStackException"); + } + + public void test039(){ + runTest("an after() clause at the class-level causes an EmptyStackException"); + } + + public void test040(){ + runTest("an around() clause at the class-level causes an EmptyStackException"); + } + + public void test041(){ + runTest("Doesn't detect cyclic inheritance of aspects."); + } + + public void test042(){ + runTest("Binds the pointcut formals to member variables instead of pointcut formals."); + } + + public void test043(){ + runTest("ambiguous formal in formals pattern"); + } + + public void test044(){ + runTest("good error for field name instead of type name"); + } + + public void test045(){ + runTest("errors in aspect inheritance - 1"); + } + + public void test046(){ + runTest("errors in aspect inheritance - 2"); + } + + public void test047(){ + runTest("errors in aspect inheritance - 3"); + } + + public void test048(){ + runTest("errors in aspect inheritance - 4"); + } + + public void test049(){ + runTest("circular dominates leading to irresolvable advice precedence"); + } + + public void test050(){ + runTest("Should issue an error for using 'class' instead of 'aspect'"); + } + + public void test051(){ + runTest("Should signal an error when we need an exposed value but don't provide it"); + } + + public void test052(){ + runTest("StackOverFlowException with circular +implements's."); + } + + public void test053(){ + runTest("Introducing protected methods is causing a crash"); + } + + public void test054(){ + runTest("Introducing protected fields is causing a crash"); + } + + public void test055(){ + runTest("two classes with the same fully-qualified names [eachjvm]"); + } + + public void test056(){ + runTest("Undefined pointcuts were throwing exceptions in 07b11 [callsto]"); + } + + public void test057(){ + runTest("advice on abstract pointcuts"); + } + + public void test058(){ + runTest("Whoops, I forgot to put a class in the field access PCD."); + } + + public void test059(){ + runTest("the arounds return something but there is no returns statement"); + } + + public void test060(){ + runTest("multiple conflicting introductions"); + } + + public void test061(){ + runTest("referencing non-static pointcuts in outer aspects"); + } + + public void test062(){ + runTest("javac correct compiler error if there is no return in around returning result"); + } + + public void test063(){ + runTest("should give an error for introducing two members with the same name"); + } + + public void test064(){ + runTest("wimpy test for undeclared and uncaught exceptions"); + } + + public void test065(){ + runTest("Given non-matching TypePattern, CE flags use of non-introduced method rather than failure to introduce"); + } + + public void test066(){ + runTest("Compiler should suggest using aspect when advice, pointcuts, or introduction is in a class"); + } + + public void test067(){ + runTest("declare error working with pointcut and-not (amp,amp,bang)"); + } + + public void test068(){ + runTest("aspect as member of interface (private and protected)"); + } + + public void test069(){ + runTest("introduced inner interfaces - compile should fail to bind interface name outside of Aspect or if implementing method is not public"); + } + + public void test070(){ + runTest("aspects may not implement Serializable or Cloneable"); + } + + public void test071(){ + runTest("explicit constructor calls can throw exceptions"); + } + + public void test072(){ + runTest("bad proceed args good error messages"); + } + +} + diff --git a/tests/src/test/java/org/aspectj/systemtest/pre10x/pre10x-tests.xml b/tests/src/test/java/org/aspectj/systemtest/pre10x/pre10x-tests.xml new file mode 100644 index 000000000..9b0837dbe --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/pre10x/pre10x-tests.xml @@ -0,0 +1,638 @@ +<!-- AspectJ v0.8 - 0.99 Tests --> + + + <ajc-test dir="pureJava" title="Using 'aspect' as identifier is legal TODO" + keywords="from-java" comment="keep this test in main suite"> + <compile files="KeywordAspect.java"/> + <run class="KeywordAspect"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Using 'pointcut' as identifier is legal TODO" + keywords="from-java" comment="keep this test in main suite"> + <compile files="KeywordPointcut.java"/> + <run class="KeywordPointcut"/> + </ajc-test> + + <ajc-test dir="new/introTypeMissing" + title="CF expected when enclosing class superclass used as this qualifier in inner class" + keywords="from-java"> + <compile files="TargetClassCF.java,Util.java"> + <message kind="error" line="22"/> + <message kind="error" line="23"/> + <message kind="error" line="27"/> + <message kind="error" line="28"/> + </compile> + </ajc-test> + + <ajc-test dir="new/introTypeMissing" + title="enclosing class may be used as this qualifier in inner class" + keywords="from-java"> + <compile files="TargetClassCP.java,Util.java"/> + <run class="TargetClassCP"/> + </ajc-test> + + <ajc-test dir="errors" + title="reasonable error for crosscut reference with no formals specified" + keywords="from-errors"> + <compile files="NoFormalsCrosscut.java"> + <message kind="error" line="6"/> + <message kind="error" line="7"/> + <message kind="error" line="8"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="reasonable error for introduction on type whose source isn't found" + keywords="from-errors"> + <compile files="NoSource.java"> + <message kind="error" line="4"/> + </compile> + </ajc-test> + + + <ajc-test dir="errors" + title="handle errors in crosscut designators, insist that they end with a semicolon" + keywords="from-errors"> + <compile files="BadDesignator.java"> + <message kind="error" line="4"/> + </compile> + </ajc-test> + + + <ajc-test dir="errors" + title="try to return from a before, after, after throwing and after returning" + keywords="from-errors"> + <compile files="InvalidReturn.java"> + <message kind="error" line="12"/> + <message kind="error" line="16"/> + <message kind="error" line="19"/> + <message kind="error" line="22"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" pr="130" + title="the designator has a wildcard for method name but no return type specified" + keywords="from-errors"> + <compile files="NoReturnTypeInDesignator.java"> + <message kind="error" line="6"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="the designator for the introduction has no type after the | charcter" + keywords="from-errors"> + <compile files="BadIntroductionDesignator.java"> + <message kind="error" line="6"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" pr="140" title="crosscut signature does not match" + keywords="from-errors"> + <compile files="BadCCutSig.java"> + <message kind="error" line="8"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="proper exit conditions when errors fall through to javac" + keywords="from-errors"> + <compile files="FromJavac.java"> + <message kind="error" line="11"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" pr="213" + title="mismatched parens on advice (wasn't binding Tester)" + keywords="from-errors"> + <compile files="MismatchedParens.java"> + <message kind="error" line="16"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" pr="209" title="Non-static advice silently ignored" + keywords="from-errors"> + <compile files="BadPointcutName.java"> + <message kind="error" line="15"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" pr="219" title="extra closing brace" + keywords="from-errors"> + <compile files="ExtraClosingBrace.java"> + <message kind="error" line="8"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" pr="244" + title="decent errors for around return type not matching target point" + keywords="from-errors"> + <compile files="AroundReturnType.java" options="-1.4"> + <message kind="error" line="2"/> + <message kind="error" line="6"/> + <message kind="error" line="7"/> + <message kind="error" line="16"/> + <message kind="error" line="21"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="eachobject: can't call new on an aspect of" + keywords="from-errors"> + <compile files="CantCallConstructorOnAspects.java"> + <message kind="error" line="4"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="eachobject: only zero-argument constructors allowed in an aspect" + keywords="from-errors,fail-unimplemented"> + <compile files="AspectsCantHaveYesArgumentConstructors.java"> + <message kind="error" line="8"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="eachobject: can't extend a concrete aspect" + keywords="from-errors,fail-unimplemented"> + <compile files="SubAspectsCantExtendNonAbstractAspects.java"> + <message kind="error" line="14"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" pr="271" title="instanceof used without a class" + keywords="from-errors"> + <compile files="InstanceofWithoutClass.java"> + <message kind="error" line="14"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" pr="280" title="wildcard used for returns clause" + keywords="from-errors"> + <compile files="WildcardForReturns.java"> + <message kind="error" line="17"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" pr="280" title="no return statement in around advice" + keywords="from-errors,new-messages-vary"> + <compile files="NoReturnStatement.java"> + <message kind="error" line="14"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" pr="286" + title="inner aspects must be static (no longer matches PR#286)" + keywords="from-errors,fail-unimplemented"> + <compile files="AbstractAspectOf.java"> + <message kind="error" line="12"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="Casting class declarations as interfaces" + keywords="from-errors"> + <compile files="InterfaceCast.java"> + <message kind="error" line="14"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="omits a variable name and crashes with a null pointer" + keywords="from-errors"> + <compile files="BindingNullPointer.java"> + <message kind="error" line="7"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="Not generating an error for using new as a method name" + keywords="from-errors"> + <compile files="New.java"> + <message kind="error" line="12"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="ClassCastException on the int literal" + keywords="from-errors"> + <compile files="IntLiteral.java"> + <message kind="error" line="17"/> + </compile> + </ajc-test> + + <ajc-test dir="new" + title="Wrong strictfp keyword usage in interface function prototype [TODO: move to errors]" + keywords="from-errors"> + <compile files="StrictFpCErr1.java"> + <message kind="error" line="3"/> + </compile> + </ajc-test> + + <ajc-test dir="new" + title="Wrong strictfp keyword usage in field declaration [TODO: move to errors]" + keywords="from-errors"> + <compile files="StrictFpCErr2.java"> + <message kind="error" line="3"/> + </compile> + </ajc-test> + + <ajc-test dir="new" + title="Wrong strictfp keyword usage in constructor declaration [TODO: move to errors]" + keywords="from-errors"> + <compile files="StrictFpCErr3.java"> + <message kind="error" line="3"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="Incorrect static casts to primitively foldable arguments should not crash the compiler." + keywords="from-errors"> + <compile files="BadStaticCast.java"> + <message kind="error" line="5"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="Dominates with commas should signal an error." + keywords="from-errors"> + <compile files="DominatesWithCommas.java"> + <message kind="error" line="9"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" pr="95" + title="stack overflow with recursive crosscut specifier" + keywords="from-errors"> + <compile files="RecursiveCCutSpecifier.java"> + <message kind="error" line="10"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="Throwing a NullPointerException when formals can't be bound in named pointcut" + keywords="from-errors"> + <compile files="BadFormalsToCalls.java"> + <message kind="error" line="22"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" pr="385" + title="disallow defining more than one pointcut with the same name" + keywords="from-errors,fail-unimplemented"> + <compile files="OverloadedPointcuts.java"> + <message kind="error" line="4"/> + <message kind="error" line="5"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="pre 0.7 introduction form outside aspect body causes an EmptyStackException" + keywords="from-errors"> + <compile files="BadIntroduction.java"> + <message kind="error" line="1" /> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="a class can't extend an aspect" + keywords="from-errors,fail-unimplemented"> + <compile files="ClassExtendingAspect.java"> + <message kind="error" line="19"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="a before() clause at the class-level causes an EmptyStackException" + keywords="from-errors"> + <compile files="TopLevelBefore.java"> + <message kind="error" line="1"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="an after() clause at the class-level causes an EmptyStackException" + keywords="from-errors"> + <compile files="TopLevelAfter.java"> + <message kind="error" line="1"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="an around() clause at the class-level causes an EmptyStackException" + keywords="from-errors"> + <compile files="TopLevelAround.java"> + <message kind="error" line="1"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="Doesn't detect cyclic inheritance of aspects." + keywords="from-errors"> + <compile files="CircularExtendsAspect.java"> + <message kind="error" line="18"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="Binds the pointcut formals to member variables instead of pointcut formals." + keywords="from-errors"> + <compile files="PointcutFormals.java" options="-Xlint:warning"> + <message kind="error" line="14"/> + <message kind="error" line="15"/> + <message kind="warning" line="16"/> + <message kind="warning" line="17"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="ambiguous formal in formals pattern" + keywords="from-errors"> + <compile files="AmbiguousFormal.java"> + <message kind="error" line="6"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="good error for field name instead of type name" + keywords="from-errors"> + <compile files="BadTypeName.java"> + <message kind="error" line="2"/> + <message kind="error" line="4"/> + <message kind="error" line="6"/> + <message kind="error" line="8"/> + <message kind="error" line="10"/> + <message kind="error" line="12"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="errors in aspect inheritance - 1" + keywords="from-errors"> + <compile files="AspectInheritance1.java"> + <message kind="error" line="17"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="errors in aspect inheritance - 2" + keywords="from-errors"> + <compile files="AspectInheritance2.java"> + <message kind="error" line="8"/> + <message kind="error" line="16"/> + <message kind="error" line="20"/> + <message kind="error" line="26"/> + <message kind="error" line="30"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="errors in aspect inheritance - 3" + keywords="from-errors"> + <compile files="AspectInheritance3.java"> + <message kind="error" line="19"/> + <message kind="error" line="24"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="errors in aspect inheritance - 4" + keywords="from-errors"> + <compile files="AspectInheritance4.java"> + <message kind="error" line="17"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="circular dominates leading to irresolvable advice precedence" + keywords="from-errors"> + <compile files="CircularDominates.java" options="-1.4"> + <message kind="error" line="12"/> + <message kind="error" line="16"/> + <message kind="error" line="20"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="Should issue an error for using 'class' instead of 'aspect'" + keywords="from-errors"> + <compile files="NoAspect.java"> + <message kind="error" line="1" text="Syntax error on token "{", ; expected"/> + <message kind="error" line="12" text="Syntax error on token "{", pointcut expected after this token"/> + <message kind="error" line="12" text="Syntax error, insert ";" to complete ClassBodyDeclarations"/> + <message kind="error" line="12" text="Syntax error on token "{", delete this token"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="Should signal an error when we need an exposed value but don't provide it" + keywords="from-errors"> + <compile files="MissingExposure.java"> + <message kind="error" line="13"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="StackOverFlowException with circular +implements's." + keywords="from-errors"> + <compile files="CircularPlusImplementsIntros.java"> + <message kind="error" line="19"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="Introducing protected methods is causing a crash" + keywords="from-errors"> + <compile files="ProtectedIntro.java"> + <message kind="error" line="14"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="Introducing protected fields is causing a crash" + keywords="from-errors"> + <compile files="ProtectedFieldIntro.java"> + <message kind="error" line="14"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" pr="388" + title="two classes with the same fully-qualified names [eachjvm]" + keywords="from-errors" + comment="XXX error not flagging initial type"> + <compile files="DuplicatedNames.java"> + <message kind="error" line="3"/> + <message kind="error" line="5"/> + <message kind="error" line="7"/> + <message kind="error" line="9"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" pr="396" + title="Undefined pointcuts were throwing exceptions in 07b11 [callsto]" + keywords="from-errors"> + <compile files="UndefinedPointCut_PR396.java"> + <message kind="error" line="8"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" pr="240" title="advice on abstract pointcuts" + keywords="from-errors"> + <compile files="StaticAdviceOnAbstract.java"> + <message kind="error" line="17"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="Whoops, I forgot to put a class in the field access PCD." + keywords="from-errors"> + <compile files="BadGetPCD.java"> + <message kind="error" line="5"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" pr="138" + title="the arounds return something but there is no returns statement" + keywords="from-errors"> + <compile files="MissingReturns.java"> + <message kind="error" line="14"/> + <message kind="error" line="20"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="multiple conflicting introductions" + keywords="from-errors"> + <compile files="MultipleIntros.java"> + <message kind="error" line="5"/> + <message kind="error" line="16"/> + <message kind="error" line="18"/> + <message kind="error" line="19"/> + <message kind="error" line="22"/> + <message kind="error" line="27"/> + <message kind="error" line="30"/> + <!-- new error due to 275032 - other end of itd clash has error recorded against it --> + <message kind="error" line="7"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="referencing non-static pointcuts in outer aspects" + keywords="from-errors"> + <compile files="StaticPointcutRefs.java"> + <message kind="error" line="8"/> + </compile> + </ajc-test> + + <ajc-test dir="new" + title="javac correct compiler error if there is no return in around returning result" + keywords="from-errors"> + <compile files="NoReturnInProceed.java"> + <message kind="error" line="16"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="should give an error for introducing two members with the same name" + keywords="from-errors"> + <compile files="TwoIntros.java"> + <message kind="error" line="10"/> + <message kind="error" line="14"/> + <message kind="error" line="16"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="wimpy test for undeclared and uncaught exceptions" + keywords="from-errors"> + <compile files="UndeclaredThrows.java"> + <message kind="error" line="12"/> + <message kind="error" line="18"/> + </compile> + </ajc-test> + + <ajc-test dir="new" + title="Given non-matching TypePattern, CE flags use of non-introduced method rather than failure to introduce" + keywords="from-errors"> + <compile + files="typepatternmatch/pack1/IntroErrorLocation.java,typepatternmatch/pack2/TargetClass.java"> + <message kind="error" line="28" + file="pack1/IntroErrorLocation.java" + text="TargetClass cannot be resolved"/> + <message kind="warning" line="33" + file="pack1/IntroErrorLocation.java" + text="no match for this type name: TargetClass"/> + <message kind="error" line="39" + file="pack1/IntroErrorLocation.java" + text="undefined for the type TargetClass"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="457" + title="Compiler should suggest using aspect when advice, pointcuts, or introduction is in a class" + keywords="from-errors,poorErrorMessages"> + <compile files="RecognizeAspectCE.java"> + <message kind="error" line="3" + file="RecognizeAspectCE.java" + text="Syntax error on token "}", pointcut expected after this token"/> + <message kind="error" line="2" + file="RecognizeAspectCE.java" + text="Syntax error"/> + <message kind="error" line="6" + file="RecognizeAspectCE.java" + text="Syntax error"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="declare error working with pointcut and-not (amp,amp,bang)" + keywords="from-errors"> + <compile files="DeclareError.java"> + <message kind="error" line="5"/> + <message kind="error" line="19"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="534" + title="aspect as member of interface (private and protected)" + keywords="from-errors"> + <compile files="AspectInInterfaceCF.java"> + <message kind="error" line="11"/> + <message kind="error" line="14"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="494" + title="introduced inner interfaces - compile should fail to bind interface name outside of Aspect or if implementing method is not public" + keywords="from-errors"> + <compile files="IntroduceInnerInterfaceCF.java" options="-Xlint:ignore"> + <message kind="error" line="18"/> + <message kind="error" line="19"/> + <message kind="error" line="20"/> + <message kind="error" line="24"/> + <message kind="error" line="42"/> + <message kind="error" line="45"/> + <message kind="error" line="48"/> + <message kind="error" line="50"/> + <message kind="error" line="58"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="aspects may not implement Serializable or Cloneable" + keywords="from-errors"> + <compile files="AspectInterfaces.java"> + <message kind="error" line="4"/> + <message kind="error" line="5"/> + <message kind="error" line="9"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="explicit constructor calls can throw exceptions" + keywords="from-errors"> + <compile files="ExplicitConstructorThrows.java"> + <message kind="error" line="3"/> + <message kind="error" line="12"/> + <message kind="error" line="18"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" pr="664" title="bad proceed args good error messages" + keywords="from-errors"> + <compile files="ProceedArgsCE.java"> + <message kind="error" line="13"/> + <message kind="error" line="16"/> + <message kind="error" line="19"/> + </compile> + </ajc-test> + + diff --git a/tests/src/test/java/org/aspectj/systemtest/pre10x/pre10x.xml b/tests/src/test/java/org/aspectj/systemtest/pre10x/pre10x.xml new file mode 100644 index 000000000..cfaa7480d --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/pre10x/pre10x.xml @@ -0,0 +1,10 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[ +<!ENTITY tests SYSTEM "../tests/src/org/aspectj/systemtest/pre10x/pre10x-tests.xml"> +]> +<!-- AspectJ v0.8 - 0.99 Tests --> + +<suite> + +&tests; + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/purejava/PureJavaTests.java b/tests/src/test/java/org/aspectj/systemtest/purejava/PureJavaTests.java new file mode 100644 index 000000000..05f2774a5 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/purejava/PureJavaTests.java @@ -0,0 +1,992 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM Corporation + * 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 + * + * ******************************************************************/ +package org.aspectj.systemtest.purejava; + +import java.io.File; +import junit.framework.Test; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class PureJavaTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(PureJavaTests.class); + } + + protected File getSpecFile() { + return new File("../tests/src/org/aspectj/systemtest/pureJava/pureJava.xml"); + } + + + public void test001(){ + runTest("unicodes and literals"); + } + + public void test002(){ + runTest("For Statement"); + } + + public void test003(){ + runTest("correct super call lookup for method().name()"); + } + + public void test004(){ + runTest("combined logic expression (handling coericions vs. parens)"); + } + + public void test005(){ + runTest("comment after class closes (with no new line at end)"); + } + + public void test006(){ + runTest("multi-dimensional array initializers"); + } + + public void test007(){ + runTest("probelm with the generated names of exceptions"); + } + + public void test008(){ + runTest("checks if the class field can be used on all of the primitive types"); + } + + public void test009(){ + runTest("Doesn't parse an array-returning method that throws an exception"); + } + + public void test010(){ + runTest("check that nested constructions of local classes work"); + } + + public void test011(){ + runTest("Make sure anonymous classes can have non-nullary constructors"); + } + + public void test012(){ + runTest("Full names are dropped from inner interfaces"); + } + + public void test013(){ + runTest("Making sure full names stay on static inner classes"); + } + + public void test014(){ + runTest("Not binding constructor when using more than one compilation"); + } + + public void test015(){ + runTest("return;;; is not really legal"); + } + + public void test016(){ + runTest("ajc treating Throwable as checked, issuing error if not found"); + } + + public void test017(){ + runTest("package protected classes becoming public"); + } + + public void test018(){ + runTest("IOException on windows if nul used as identifier"); + } + + public void test019(){ + runTest("NullPointerException (not compiler error) when extending non-static inner class"); + } + + public void test020(){ + runTest("compiler flags final static variable as indefinite in member assignment."); + } + + public void test021(){ + runTest("confirm no IOException on windows if nul used as identifier"); + } + + public void test022(){ + runTest("final constructor parameter causes incorrect compiler error"); + } + + public void test023(){ + runTest("Error expected for field of type void"); + } + + public void test024(){ + runTest("Error expected for constructor in interfaces"); + } + + public void test025(){ + runTest("class name for identifier as String should provoke error"); + } + + public void test026(){ + runTest("cyclic interface inheritance not detected if no classes implement the interfaces"); + } + + public void test027(){ + runTest("cyclic class inheritance"); + } + + public void test028(){ + runTest("type and package name conflicts are resolved happily (1a)"); + } + + public void test029(){ + runTest("(fails in USEJAVAC) type and package name conflicts are resolved happily (1b)"); + } + + public void test030(){ + runTest("type and package name conflicts caught as errors (1)"); + } + + public void test031(){ + runTest("flow analysis where final variable set in another constructor"); + } + + public void test032(){ + runTest("Can construct inner classes using qualified expressions"); + } + + public void test033(){ + runTest("subclass unable to access protected static methods using type-qualified references"); + } + + public void test034(){ + runTest("Undefined inner class constructor"); + } + + public void test035(){ + runTest("classes that are package prefixes are illegal"); + } + + public void test036(){ + runTest("valid type expressions for introduced type testing"); + } + + public void test037(){ + runTest("PR591 compiler error expected when directly calling unimplemented abstract method using super"); + } + + public void test038(){ + runTest("suggested by Jacks 15.28-qualified-namestr tests"); + } + + public void test039(){ + runTest("suggested by jacks 3.7-15 all comments must be closed"); + } + + public void test040(){ + runTest("package class access not enforced outside of package"); + } + + public void test041(){ + runTest("expecting CE for ambiguous reference"); + } + + public void test042(){ + runTest("try without catch or finally"); + } + + public void test043(){ + runTest("invalid floating-point constant"); + } + + public void test044(){ + runTest("concrete aspect unable to access abstract package-private method in parent for overriding"); + } + + public void test045(){ + runTest("super reference used to disambiguate names of different but compatible types"); + } + + public void test046(){ + runTest("anonymous explicit inner constructors"); + } + + public void test047(){ + runTest("Overruning the lineStarts buffer, DO NOT EDIT THIS FILE!!!!"); + } + + public void test048(){ + runTest("no CE for unambiguous type reference"); + } + + public void test049(){ + runTest("CE for ambiguous type reference (imports)"); + } + + public void test050(){ + runTest("CE for ambiguous type reference (two type declarations)"); + } + + public void test051(){ + runTest("CE for ambiguous type reference (two inner types)"); + } + + public void test052(){ + runTest("final assignment in loop"); + } + + public void test053(){ + runTest("private super access in inners"); + } + + public void test054(){ + runTest("nested interface does not require new qualifier (8)"); + } + + public void test055(){ + runTest("nested interface does not require new qualifier (9)"); + } + + public void test056(){ + runTest("nested interface does not require new qualifier (10)"); + } + + public void test057(){ + runTest("nested interface does not require new qualifier (14)"); + } + + public void test058(){ + runTest("nested interface does not require new qualifier (15)"); + } + + public void test059(){ + runTest("nested interface does not require new qualifier (16)"); + } + + public void test060(){ + runTest("check that constructor name's match the enclosing type"); + } + + public void test061(){ + runTest("errors for not applicable or accessible methods"); + } + + public void test062(){ + runTest("import statement within class body crashes compiler"); + } + + public void test063(){ + runTest("Accessing instance fields and instance methods statically."); + } + + public void test064(){ + runTest("Crashes when a cast is within another cast"); + } + + public void test065(){ + runTest("Crashes when a cast of the form )int) appears"); + } + + public void test066(){ + runTest("Crashes when the closing brace is reversed"); + } + + public void test067(){ + runTest("Crashes when a method name is missing in a call -- e.g. 'System.out.();'"); + } + + public void test068(){ + runTest("Crashes when a bad r-value appears."); + } + + public void test069(){ + runTest("Two underscores as a variables causes a crash"); + } + + public void test070(){ + runTest("Crashes when assigning to a final static in an intializer and declaration"); + } + + public void test071(){ + runTest("Crashes when two dots appear instead of one"); + } + + public void test072(){ + runTest("Crashes when there're stray dots"); + } + + public void test073(){ + runTest("Stray characters cause a crash"); + } + + public void test074(){ + runTest("Colon instead of a semi-colon causes a crash"); + } + + public void test075(){ + runTest("type error in initializer caught by ajc, not javac"); + } + + public void test076(){ + runTest("Circular inheritance with classes causes a stack overflow."); + } + + public void test077(){ + runTest("Missing ;"); + } + + public void test078(){ + runTest("cast expressions should not allow casts between ifaces and array types"); + } + + public void test079(){ + runTest("parsing errors for various bad forms of NewArrayExprs."); + } + + public void test080(){ + runTest("good error for bad field and inner class references"); + } + + public void test081(){ + runTest("Implementing a non-interface used to crash the compiler."); + } + + public void test082(){ + runTest("error of no return statement detected not by ajc but by javac (line 4)"); + } + + public void test083(){ + runTest("class and interface extension"); + } + + public void test084(){ + runTest("types in throws clauses"); + } + + public void test085(){ + runTest("bad switch syntax"); + } + + public void test086(){ + runTest("Referencing various things from static contexts"); + } + + public void test087(){ + runTest("Some expressions are illegal expression statements"); + } + + public void test088(){ + runTest("illegal forward reference"); + } + + public void test089(){ + runTest("protected accessibility"); + } + + public void test090(){ + runTest("parse-time illegal modifiers"); + } + + public void test091(){ + runTest("check-time illegal modifiers"); + } + + public void test092(){ + runTest("illegal synchronized stmts"); + } + + public void test093(){ + runTest("modifiers on interface members"); + } + + public void test094(){ + runTest("good errors (and not too many) for missing members"); + } + + public void test095(){ + runTest("expecting compile failures with subclass narrowing scope of superclass methods or accessing private superclass variables"); + } + + public void test096(){ + runTest("inner classes may not have static non-constant members"); + } + + public void test097(){ + runTest("flow analysis with local types"); + } + + public void test098(){ + runTest("PR584 Can construct inner classes using qualified expressions"); + } + + public void test099(){ + runTest("incrementing objects, arrays - 2"); + } + + public void test100(){ + runTest("incrementing objects, arrays CE"); + } + + public void test101(){ + runTest("incrementing objects, arrays - 3"); + } + + public void test102(){ + runTest("incrementing objects, arrays"); + } + + public void test103(){ + runTest("no circularity errors simply because of inners (1)"); + } + + public void test104(){ + runTest("no circularity errors simply because of inners (2)"); + } + + public void test105(){ + runTest("should have circular inheritance errors (1)"); + } + + public void test106(){ + runTest("should have circular inheritance errors (2)"); + } + + public void test107(){ + runTest("interface using preceding subinterface in its definition"); + } + + public void test108(){ + runTest("Parent interface using public inner interface of child in same file"); + } + + public void test109(){ + runTest("a type is not allowed to extend or implement its own innner type"); + } + + public void test110(){ + runTest("try requires block JLS 14.19"); + } + + public void test111(){ + runTest("loop expressions not declarations"); + } + + public void test112(){ + runTest("no error when public class is in file of a different name"); + } + + public void test113(){ + runTest("local variables must be final to be accessed from inner class"); + } + + public void test114(){ + runTest("final local variables may be accessed from inner class"); + } + + public void test115(){ + runTest("missing package identifier"); + } + + public void test116(){ + runTest("CE for ambiguous type reference (two files in package)"); + } + + public void test117(){ + runTest("initializer can throw so long as all constructors declare so"); + } + + public void test118(){ + runTest("interfaces may not contain initializers (bug found by jacks)"); + } + + public void test119(){ + runTest("initializers must be able to complete normally (found by jacks)"); + } + + public void test120(){ + runTest("more tests of super alone"); + } + + public void test121(){ + runTest("subclass access to enclosing super class private members"); + } + + public void test122(){ + runTest("various tests of switch bounds"); + } + + public void test123(){ + runTest("VerifyError if nested sync returning result"); + } + + public void test124(){ + runTest("assert flow"); + } + + public void test125(){ + runTest("assert flow - 2"); + } + + public void test126(){ + runTest("assert typing"); + } + + public void test127(){ + runTest("assert coverage tests [requires 1.4]"); + } + + public void test128(){ + runTest("assert coverage tests in one package [requires 1.4]"); + } + + public void test129(){ + runTest("compiling asserts in methods"); + } + + public void test130(){ + runTest("import of a class in the default package"); + } + + public void test131(){ + runTest("Referencing static interfaces with import statements"); + } + + public void test132(){ + runTest("Referencing static interfaces with import statements stars"); + } + + public void test133(){ + runTest("Referencing static interfaces with import statements stars 2"); + } + + public void test134(){ + runTest("Referencing static interfaces with import statements stars 3"); + } + + public void test135(){ + runTest("Referencing interfaces with import statements"); + } + + public void test136(){ + runTest("Referencing interfaces with import statements stars"); + } + + public void test137(){ + runTest("Referencing interfaces with import statements stars 2"); + } + + public void test138(){ + runTest("Referencing interfaces with import statements stars 3"); + } + + public void test139(){ + runTest("import any inner from interface implementor"); + } + + public void test140(){ + runTest("equals method on quoted strings"); + } + + public void test141(){ + runTest("anonymous inner class"); + } + + public void test142(){ + runTest("parsing of parenthesized 'this' (in returns)"); + } + + public void test143(){ + runTest("Strings are folded and interned correctly"); + } + + public void test144(){ + runTest("Cast binds tighter than equality tests"); + } + + public void test145(){ + runTest("Boundary base values can be parsed"); + } + + public void test146(){ + runTest("State is passed correctly across nested annonymous inners"); + } + + public void test147(){ + runTest("?: expressions should typecheck in interesting ways"); + } + + public void test148(){ + runTest("cast expressions should allow casts to/from interfaces at compile-time."); + } + + public void test149(){ + runTest("various anonymous inner classes plus super types tests"); + } + + public void test150(){ + runTest("Various comment syntaxes should be handled."); + } + + public void test151(){ + runTest("Abstract inner classes across package boundaries"); + } + + public void test152(){ + runTest("inner classes accessing outers and some more inner class names"); + } + + public void test153(){ + runTest("remember to cast folded values down to the proper types."); + } + + public void test154(){ + runTest("inner classes can be built using protected constructors in super"); + } + + public void test155(){ + runTest("The current AspectJ compiler cannot parse qualified superclass constructor invocations"); + } + + public void test156(){ + runTest("More thourough test of static members using full names"); + } + + public void test157(){ + runTest("More thourough test of static members using imports"); + } + + public void test158(){ + runTest("Looking in class Java for java.lang.String WITH separate compilation"); + } + + public void test159(){ + runTest("Looking in class Java for java.lang.String WITHOUT separate compilation"); + } + + public void test160(){ + runTest("Looking in class Java for java.lang.String WITH separate compilation with packages"); + } + + public void test161(){ + runTest("Looking in class Java for java.lang.String WITHOUT separate compilation with packages"); + } + + public void test162(){ + runTest("Testing ternary operations."); + } + + public void test163(){ + runTest("Lifting locals in switch statements."); + } + + public void test164(){ + runTest("Getting confused when looking up method signatures"); + } + + public void test165(){ + runTest("Not recognizing the chars '\0', '\1', '\2', '\3', '\4', '\5', '\6', '\7'"); + } + + public void test166(){ + runTest("Test chars '\0', '\1', '\2', '\3', '\4', '\5', '\6', '\7' with a case statement"); + } + + public void test167(){ + runTest("Checking character values with all the unicode chars."); + } + + public void test168(){ + runTest("Trouble finding methods with the same name and different parameter types"); + } + + public void test169(){ + runTest("Binding non-public static inner classes of interfaces in other packages"); + } + + public void test170(){ + runTest("Not recognizing the octal chars '\0', '\1', '\2', '\3', '\4', '\5', '\6', '\7'"); + } + + public void test171(){ + runTest("Members with the same name as their package cause confusion with fully-qualified names."); + } + + public void test172(){ + runTest("Fully-qual'ed names with same start as variable names"); + } + + public void test173(){ + runTest("Fully qualifying inner classes within annonymous classes causes problems."); + } + + public void test174(){ + runTest("Calls to methods in outer annonymous classes are being qual's incorrectly with 'this'"); + } + + public void test175(){ + runTest("Reading inner classes from source and bytecode (1) -- was failing"); + } + + public void test176(){ + runTest("Reading inner classes from source and bytecode (2)"); + } + + public void test177(){ + runTest("Reading inner classes from source and bytecode (3)"); + } + + public void test178(){ + runTest("Not lifting types correctly with bytes and shorts with ternary ops"); + } + + public void test179(){ + runTest("Not looking up methods inside of anonymous declarations correctly."); + } + + public void test180(){ + runTest("Resolving extended classes with array parameters"); + } + + public void test181(){ + runTest("Assignments as second arguments in ternary operators."); + } + + public void test182(){ + runTest("Conflicting inner classes with interfaces."); + } + + public void test183(){ + runTest("confusions of casts and parens"); + } + + public void test184(){ + runTest("default constructors seen by inner classes subtyping outers"); + } + + public void test185(){ + runTest("folding fields set to anonymous instances containing self-references"); + } + + public void test186(){ + runTest("finally at the end of a method that needs to return"); + } + + public void test187(){ + runTest("overriding methods from object in interfaces and multiple-inheritance"); + } + + public void test188(){ + runTest("private fields in an outer class accessed by an inner which also extends the outer"); + } + + public void test189(){ + runTest("breaking out of a labeled block inside of an if"); + } + + public void test190(){ + runTest("abstractifying a method and getting it back through super"); + } + + public void test191(){ + runTest("Packages and static classes with the same name produce compile errors."); + } + + public void test192(){ + runTest("Inner types must generate classfiles with only Public/Default access flags."); + } + + public void test193(){ + runTest("Default constructors have same access as their enclosing type"); + } + + public void test194(){ + runTest("Returning primitive values matching method return type (minimal)"); + } + + public void test195(){ + runTest("Flow analysis and if(true)"); + } + + public void test196(){ + runTest("packages and generated inner types (for I.class)"); + } + + public void test197(){ + runTest("A.this exprs match by exact type matching"); + } + + public void test198(){ + runTest("Implicit this for new inner instance must be avaliable"); + } + + public void test199(){ + runTest("Inners can reference protected fields of their outer's super."); + } + + public void test200(){ + runTest("Primitives that special case for a constant arm should work"); + } + + public void test201(){ + runTest("Parenthesized true and false don't parse"); + } + + public void test202(){ + runTest("Field sets to public fields of private fields of enclosing types"); + } + + public void test203(){ + runTest("Constant values should be stored with the correct type of their fields"); + } + + public void test204(){ + runTest("Local variables in initializers should not be treated as blank final fields"); + } + + public void test205(){ + runTest("Binops aren't allowed as update stmts in for loops"); + } + + public void test206(){ + runTest("Can't avoid doing division in case of div by zero"); + } + + public void test207(){ + runTest("Testing frames w/greater than FF locals and 7F incs (i.e., WIDE instruction)"); + } + + public void test208(){ + runTest("correct numeric literals"); + } + + public void test209(){ + runTest("invalid numeric literals"); + } + + public void test210(){ + runTest("inner types can't have the same simple name as an enclosing type"); + } + + public void test211(){ + runTest("test the unops and binops with various values"); + } + + public void test212(){ + runTest("test + and += for strings and variously typed values"); + } + + public void test213(){ + runTest("test try/catch/finally statements"); + } + + public void test214(){ + runTest("local types can be bound in the signatures of other local types"); + } + + public void test215(){ + runTest("type and package name conflicts are resolved happily (2)"); + } + + public void test216(){ + runTest("try statements work sorta like scoped items for exception flow control"); + } + + public void test217(){ + runTest("qualified this must work exactly, not based on subtypes"); + } + + public void test218(){ + runTest("nested finally blocks have interesting frame location problems"); + } + + public void test219(){ + runTest("nested synchronized blocks have interesting frame location problems"); + } + + public void test220(){ + runTest("anonymous inner classes with inner types"); + } + + public void test221(){ + runTest("qualified super call expr"); + } + + public void test222(){ + runTest("interfaces with non-explicitly static inner classes"); + } + + public void test223(){ + runTest("Operands work correctly"); + } + + public void test224(){ + runTest("simple tests of throws and for stmt typing"); + } + + public void test225(){ + runTest("test for not folding circular constants"); + } + + public void test226(){ + runTest("continue targets must be continuable"); + } + + public void test227(){ + runTest("qualified this to non-inner should be caught"); + } + + public void test228(){ + runTest("Cannot bind a name."); + } + + public void test229(){ + runTest("interface declaration not permitted in local method scope"); + } + + public void test230(){ + runTest("Locals inside other locals, ordering of processing [eh]"); + } + + public void test231(){ + runTest("asserts"); + } + + public void test232(){ + runTest("non-constant static final fields marked as final in .class"); + } + + public void test233(){ + runTest("handle multiple nested inner classes"); + } + + public void test234(){ + runTest("advice on a static method"); + } + + public void test235(){ + runTest("inner constructor syntax causes compile error"); + } + + public void test236(){ + runTest("widening of method parameters to match javac"); + } + + public void test237(){ + runTest("parenthesized string literals matching primitive type names"); + } + + public void test238(){ + runTest("simple type coercions tests"); + } + + public void test239(){ + runTest("order of type declarations shouldn't matter"); + } + + public void test240(){ + runTest("Scanner non recognizing strictfp."); + } + + public void test241(){ + runTest("Crashes when a lot of zeros are in front of a double variable [!!! purejava]"); + } + +} + diff --git a/tests/src/test/java/org/aspectj/systemtest/purejava/pureJava-tests.xml b/tests/src/test/java/org/aspectj/systemtest/purejava/pureJava-tests.xml new file mode 100644 index 000000000..9864ffe79 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/purejava/pureJava-tests.xml @@ -0,0 +1,1894 @@ +<!-- Pure Java Tests --> + + <ajc-test dir="pureJava/test120" title="unicodes and literals" + keywords="from-base,purejava"> + <compile files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="pureJava/test126" title="For Statement" + keywords="from-base,purejava"> + <compile files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="pureJava/test133" + title="correct super call lookup for method().name()" + keywords="from-base,purejava"> + <compile files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="new" pr="99" + title="combined logic expression (handling coericions vs. parens)" + keywords="from-java,purejava"> + <compile files="CombinedLogic.java"/> + <run class="CombinedLogic"/> + </ajc-test> + + <ajc-test dir="new" pr="99" + title="comment after class closes (with no new line at end)" + keywords="from-java,purejava"> + <compile files="CommentAfterClass.java"/> + <run class="CommentAfterClass"/> + </ajc-test> + + <ajc-test dir="new" pr="108" title="multi-dimensional array initializers" + keywords="from-java,purejava"> + <compile files="MultiArrays.java"/> + <run class="MultiArrays"/> + </ajc-test> + + <ajc-test dir="new" pr="125" + title="probelm with the generated names of exceptions" + keywords="from-java,purejava"> + <compile files="ExceptionNames.java"/> + <run class="ExceptionNames"/> + </ajc-test> + + <ajc-test dir="new" pr="109" + title="checks if the class field can be used on all of the primitive types" + keywords="from-java,purejava"> + <compile files="ClassFieldOnPrimitiveType.java"/> + <run class="ClassFieldOnPrimitiveType"/> + </ajc-test> + + <ajc-test dir="new" + title="Doesn't parse an array-returning method that throws an exception" + keywords="from-java,purejava"> + <compile files="ArrayMethod.java"/> + <run class="ArrayMethod"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="check that nested constructions of local classes work" + keywords="from-java,purejava"> + <compile files="NestedConstructionsOfLocalClasses.java"/> + <run class="NestedConstructionsOfLocalClasses"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Make sure anonymous classes can have non-nullary constructors" + keywords="from-java,purejava"> + <compile files="NonNullaryAnonymous.java"/> + <run class="NonNullaryAnonymous"/> + </ajc-test> + + <ajc-test dir="new" pr="417" + title="Full names are dropped from inner interfaces" + keywords="from-java,purejava"> + <compile files="PR417a.java"/> + <run class="PR417a"/> + </ajc-test> + + <ajc-test dir="new" pr="417" + title="Making sure full names stay on static inner classes" + keywords="from-java,purejava"> + <compile files="PR417b.java"/> + <run class="PR417b"/> + </ajc-test> + + <ajc-test dir="new" pr="408" + title="Not binding constructor when using more than one compilation" + keywords="from-java,purejava"> + <compile files="OuterAbstract_PR408.java"/> + <compile files="ExtendsOuterAbstract_PR408.java"/> + <compile files="ConstructorNotFound_PR408.java"/> + <run class="ConstructorNotFound_PR408"/> + </ajc-test> + + <ajc-test dir="pureJava" title="return;;; is not really legal" + keywords="from-java,purejava"> + <compile files="ReachableEmpty.java"> + <message kind="error" line="5"/> + <message kind="error" line="9"/> + <message kind="error" line="13"/> + <message kind="error" line="17"/> + </compile> + </ajc-test> + + <ajc-test dir="new" + title="ajc treating Throwable as checked, issuing error if not found" + keywords="from-java,purejava"> + <compile files="FalseThrowsCE.java"/> + <run class="FalseThrowsCE"/> + </ajc-test> + + <ajc-test dir="new" pr="328" + title="package protected classes becoming public" + keywords="from-java,purejava"> + <compile files="PR328.java"/> + <run class="PR328"/> + </ajc-test> + + <ajc-test dir="new" title="IOException on windows if nul used as identifier" + keywords="from-java,purejava"> + <compile files="NulIOException.java"> + <message kind="error" line="12"/> + <message kind="error" line="14"/> + <message kind="error" line="17"/> + </compile> + </ajc-test> + + <ajc-test dir="new" + title="NullPointerException (not compiler error) when extending non-static inner class" + keywords="from-java,purejava"> + <compile files="ExtendInnerCE.java"> + <message kind="error" line="3"/> + </compile> + </ajc-test> + + <ajc-test dir="new" + title="compiler flags final static variable as indefinite in member assignment." + keywords="from-java,purejava"> + <compile files="DefiniteStatic.java"/> + <run class="DefiniteStatic"/> + </ajc-test> + + <ajc-test dir="new" + title="confirm no IOException on windows if nul used as identifier" + keywords="from-java,purejava"> + <compile files="NulIOException2.java"/> + <run class="NulIOException2"/> + </ajc-test> + + <ajc-test dir="new" + title="final constructor parameter causes incorrect compiler error" + keywords="from-java,purejava"> + <compile files="FinalConstructorParm.java"/> + <run class="FinalConstructorParm"/> + </ajc-test> + + <ajc-test dir="new" title="Error expected for field of type void" + keywords="from-java,purejava"> + <compile files="VoidField.java"> + <message kind="error" line="2"/> + <message kind="error" line="4"/> + <message kind="error" line="6"/> + </compile> + </ajc-test> + + <ajc-test dir="new" title="Error expected for constructor in interfaces" + keywords="from-java,purejava"> + <compile files="InterfaceConstructor.java"> + <message kind="error" line="2"/> + <message kind="error" line="6"/> + <message kind="error" line="8"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="558" + title="class name for identifier as String should provoke error" + keywords="from-java,purejava"> + <compile files="PR558.java"> + <message kind="error" line="4"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="567" + title="cyclic interface inheritance not detected if no classes implement the interfaces" + keywords="from-java,purejava,messages-vary"> + <compile files="CyclicInterfaceInheritance.java" + options="!eclipse"> + <message kind="error" line="14"/> + <message kind="error" line="15"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="567" title="cyclic class inheritance" + keywords="from-java,purejava"> + <compile files="CyclicClassInheritance.java"> + <message kind="error" line="11"/> + <message kind="error" line="12"/> + </compile> + </ajc-test> + + <!-- broken test - both javac and eclipse give error on line 35 --> + <!-- + <ajc-test dir="pureJava" title="Type names are not expressions on their own" + keywords="from-java,purejava"> + <compile files="TypeExprErrors.java"> + <message kind="error" line="10"/> + <message kind="error" line="17"/> + <message kind="error" line="18"/> + <message kind="error" line="19"/> + <message kind="error" line="20"/> + <message kind="error" line="21"/> + <message kind="error" line="22"/> + <message kind="error" line="23"/> + <message kind="error" line="24"/> + <message kind="error" line="25"/> + <message kind="error" line="26"/> + <message kind="error" line="27"/> + <message kind="error" line="28"/> + <message kind="error" line="29"/> + <message kind="error" line="30"/> + <message kind="error" line="31"/> + <message kind="error" line="32"/> + <message kind="error" line="33"/> + <message kind="error" line="34"/> + <message kind="error" line="36"/> + <message kind="error" line="37"/> + </compile> + </ajc-test> + --> + + <ajc-test dir="pureJava/nameConflicts" + title="type and package name conflicts are resolved happily (1a)" + keywords="from-java,purejava"> + <compile files="p1/Main1.java,p1/Foo.java,p1/p2.java"/> + <run class="p1.Main1"/> + </ajc-test> + + <ajc-test dir="pureJava/nameConflicts" + title="(fails in USEJAVAC) type and package name conflicts are resolved happily (1b)" + keywords="from-java,purejava"> + <compile files="p1.java,p1/p2/Foo.java"/> + <compile files="p1/Main1.java,p1/Foo.java,p1/p2.java"/> + <run class="p1.Main1"/> + </ajc-test> + + <ajc-test dir="pureJava/nameConflicts" + title="type and package name conflicts caught as errors (1)" + keywords="from-java,purejava"> + <compile files="p1/p2.java,p1/Main1.java,p1/Foo.java,p1/p2/Foo.java"> + <message kind="error" line="3"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" + title="flow analysis where final variable set in another constructor" + keywords="from-java,purejava"> + <compile files="ConstructorFlow.java"/> + <run class="ConstructorFlow"/> + </ajc-test> + + <ajc-test dir="new" pr="584" + title="Can construct inner classes using qualified expressions" + keywords="from-java,purejava"> + <compile files="PR584.java"/> + <run class="PR584"/> + </ajc-test> + + <ajc-test dir="new/protectedStatic" pr="585" + title="subclass unable to access protected static methods using type-qualified references" + keywords="from-java,purejava"> + <compile files="SubClass.java,pack/SuperClass.java"/> + <run class="SubClass"/> + </ajc-test> + + <ajc-test dir="new" pr="588" title="Undefined inner class constructor" + keywords="from-java,purejava"> + <compile files="UndefinedInner.java"> + <message kind="error" line="6"/> + </compile> + </ajc-test> + + <ajc-test dir="new/packagePrefix" pr="574" + title="classes that are package prefixes are illegal" + keywords="from-java,purejava,messages-vary"> + <compile files="p/prefix.java,p/prefix/SomeClass.java" + options="!eclipse"> + <message kind="error" line="2"/> + </compile> + </ajc-test> + + <ajc-test dir="new/introTypeMissing" + title="valid type expressions for introduced type testing" + keywords="from-java,purejava"> + <compile files="TargetClass.java,Util.java"/> + <run class="TargetClass"/> + </ajc-test> + + <ajc-test dir="new" + title="PR591 compiler error expected when directly calling unimplemented abstract method using super" + keywords="from-java,purejava"> + <compile files="AbstractMethodCall.java"> + <message kind="error" line="10"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" + title="suggested by Jacks 15.28-qualified-namestr tests" + keywords="from-java,purejava,messages-vary"> + <compile files="NonConstants.java" + options="!eclipse"> + <message kind="error" line="13"/> + <message kind="error" line="14"/> + <message kind="error" line="15"/> + <message kind="error" line="16"/> + <message kind="error" line="17"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" + title="suggested by jacks 3.7-15 all comments must be closed" + keywords="from-java,purejava"> + <compile files="OpenComment.java"> + <message kind="error" line="7"/> + </compile> + </ajc-test> + + <ajc-test dir="new/classaccess" + title="package class access not enforced outside of package" + keywords="from-java,purejava"> + <compile files="main/Main.java,pack1/Target.java"> + <message kind="error" line="7"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="631" title="expecting CE for ambiguous reference" + keywords="from-java,purejava"> + <compile files="AmbiguousClassReference.java"> + <message kind="error" line="11"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="643" title="try without catch or finally" + keywords="from-java,purejava,message-vary"> + <compile files="TryNoCatchCE.java" + options="!eclipse"> + <message kind="error" line="6"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="642" title="invalid floating-point constant" + keywords="from-java,purejava,messages-vary"> + <compile files="ParsingFloatCE.java" + options="!eclipse"> + <message kind="error" line="5"/> + </compile> + </ajc-test> + + <ajc-test dir="new/subaspects" pr="647" + title="concrete aspect unable to access abstract package-private method in parent for overriding" + keywords="from-java,purejava,messages-vary" + comment="XXX fix source - package-private"> + <compile files="parent/ParentMethodCE.java,child/ChildMethodCE.java" + options="!eclipse"> + <message kind="warning" line="28"/> + <message kind="error" line="27"/> + </compile> + </ajc-test> + + <ajc-test dir="new" + title="super reference used to disambiguate names of different but compatible types" + keywords="from-java,purejava"> + <compile files="SuperDisambiguatingType.java"/> + <run class="SuperDisambiguatingType"/> + </ajc-test> + + <ajc-test dir="pureJava" title="anonymous explicit inner constructors" + keywords="from-java,purejava"> + <compile files="QualifiedNewCP.java"/> + <run class="QualifiedNewCP"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Overruning the lineStarts buffer, DO NOT EDIT THIS FILE!!!!" + keywords="from-java,purejava"> + <compile files="AJError.java"/> + <run class="AJError"/> + </ajc-test> + + <ajc-test dir="new" pr="701" title="no CE for unambiguous type reference" + keywords="from-java,purejava"> + <compile files="UnambiguousClassReference3CP.java"/> + <run class="UnambiguousClassReference3CP"/> + </ajc-test> + + <ajc-test dir="new" pr="701" + title="CE for ambiguous type reference (imports)" + keywords="from-java,purejava"> + <compile files="AmbiguousClassReference2CE.java"> + <message kind="error" line="2"/> + <message kind="error" line="10"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="701" + title="CE for ambiguous type reference (two type declarations)" + keywords="from-java,purejava,messages-vary"> + <compile files="AmbiguousClassReference3CE.java" + options="!eclipse"> + <message kind="error" line="10"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="701" + title="CE for ambiguous type reference (two inner types)" + keywords="from-java,purejava,messages-vary"> + <compile files="AmbiguousClassReference4CE.java" + options="!eclipse"> + <message kind="error" line="10"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="709" title="final assignment in loop" + keywords="from-java,purejava"> + <compile files="FinalInLoop.java"/> + <run class="FinalInLoop"/> + </ajc-test> + + <ajc-test dir="pureJava" title="private super access in inners" + keywords="from-java,purejava"> + <compile files="PrivateSuperInnerAccess.java"/> + <run class="PrivateSuperInnerAccess"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="nested interface does not require new qualifier (8)" + keywords="from-java,purejava"> + <compile files="InvalidNewQualifier8CE.java"> + <message kind="error" line="8"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" + title="nested interface does not require new qualifier (9)" + keywords="from-java,purejava"> + <compile files="InvalidNewQualifier9CE.java"> + <message kind="error" line="9"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" + title="nested interface does not require new qualifier (10)" + keywords="from-java,purejava"> + <compile files="InvalidNewQualifier10CE.java"> + <message kind="error" line="10"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" + title="nested interface does not require new qualifier (14)" + keywords="from-java,purejava"> + <compile files="InvalidNewQualifier14CE.java"> + <message kind="error" line="14"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" + title="nested interface does not require new qualifier (15)" + keywords="from-java,purejava"> + <compile files="InvalidNewQualifier15CE.java"> + <message kind="error" line="15"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" + title="nested interface does not require new qualifier (16)" + keywords="from-java,purejava"> + <compile files="InvalidNewQualifier16CE.java"> + <message kind="error" line="16"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="check that constructor name's match the enclosing type" + keywords="from-errors,purejava"> + <compile files="BadConstructorName.java"> + <message kind="error" line="4"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="errors for not applicable or accessible methods" + keywords="from-errors,purejava"> + <compile files="MethodsNotFound.java"> + <message kind="error" line="4"/> + <message kind="error" line="8"/> + <message kind="error" line="12"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" pr="218" + title="import statement within class body crashes compiler" + keywords="from-errors,purejava"> + <compile files="ImportWithinClassBody.java"> + <message kind="error" line="8"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="Accessing instance fields and instance methods statically." + keywords="from-errors,purejava"> + <compile files="AccessingInstanceFieldsStatically.java"> + <message kind="error" line="15"/> + <message kind="error" line="16"/> + <message kind="error" line="17"/> + <message kind="error" line="18"/> + <message kind="error" line="26"/> + <message kind="error" line="27"/> + <message kind="error" line="30"/> + <message kind="error" line="38"/> + <message kind="error" line="39"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="Crashes when a cast is within another cast" + keywords="from-errors,purejava"> + <compile files="CastInCast.java"> + <message kind="error" line="9"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="Crashes when a cast of the form )int) appears" + keywords="from-errors,purejava,messages-vary"> + <compile files="BadCast.java" + options="!eclipse"> + <message kind="error" line="9"/> + <message kind="error" line="10"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="Crashes when the closing brace is reversed" + keywords="from-errors,purejava,messages-vary"> + <compile files="ClosingBrace.java" + options="!eclipse"> + <message kind="error" line="11"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="Crashes when a method name is missing in a call -- e.g. 'System.out.();'" + keywords="from-errors,purejava"> + <compile files="NoMethodName.java"> + <message kind="error" line="9"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="Crashes when a bad r-value appears." + keywords="from-errors,purejava"> + <compile files="BadValue.java"> + <message kind="error" line="9"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="Two underscores as a variables causes a crash" + keywords="from-errors,purejava"> + <compile files="BadVar.java"> + <message kind="error" line="9"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="Crashes when assigning to a final static in an intializer and declaration" + keywords="from-errors,purejava"> + <compile files="FinalStatic.java"> + <message kind="error" line="13"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="Crashes when two dots appear instead of one" + keywords="from-errors,purejava"> + <compile files="TwoDots.java"> + <message kind="error" line="9"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="Crashes when there're stray dots" + keywords="from-errors,purejava"> + <compile files="StrayDot.java"> + <message kind="error" line="9"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="Stray characters cause a crash" + comment="XXX public class in wrong file" + keywords="from-errors,purejava"> + <compile files="StraySlash.java"> + <message kind="error" line="9"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="Colon instead of a semi-colon causes a crash" + comment="XXX public class in wrong file" + keywords="from-errors,purejava"> + <compile files="Colon.java"> + <message kind="error" line="9"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="type error in initializer caught by ajc, not javac" + keywords="from-errors,purejava"> + <compile files="ArrayInitializerType.java"> + <message kind="error" line="2"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="Circular inheritance with classes causes a stack overflow." + keywords="from-errors,purejava"> + <compile files="CircularExtends.java"> + <message kind="error" line="7"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="Missing ;" keywords="from-errors,purejava"> + <compile files="PR405.java"> + <message kind="error" line="15"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="cast expressions should not allow casts between ifaces and array types" + keywords="from-errors,purejava"> + <compile files="InterfaceArrayCast.java"> + <message kind="error" line="9"/> + <message kind="error" line="10"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="parsing errors for various bad forms of NewArrayExprs." + keywords="from-errors,purejava"> + <compile files="BadNewArrayExprs.java"> + <message kind="error" line="4"/> + <message kind="error" line="5"/> + <message kind="error" line="6"/> + <message kind="error" line="7"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="good error for bad field and inner class references" + keywords="from-errors,purejava"> + <compile files="BadReferences.java"> + <message kind="error" line="3"/> + <message kind="error" line="5"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="Implementing a non-interface used to crash the compiler." + keywords="from-errors,purejava"> + <compile files="PR333.java"> + <message kind="error" line="6"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="error of no return statement detected not by ajc but by javac (line 4)" + keywords="from-errors,purejava"> + <compile files="NoReturnStatementSimple.java"> + <message kind="error" line="4"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="class and interface extension" + keywords="from-errors,purejava,messages-vary"> + <compile files="BadExtension.java" + options="!eclipse"> + <message kind="error" line="7"/> + <message kind="error" line="9"/> + <message kind="error" line="16"/> + <message kind="error" line="17"/> + <message kind="error" line="18"/> + <message kind="error" line="19"/> + <message kind="error" line="21"/> + <message kind="error" line="35"/> + <message kind="error" line="38"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="types in throws clauses" + keywords="from-errors,purejava"> + <compile files="ThrowsClause.java"> + <message kind="error" line="2"/> + <message kind="error" line="4"/> + <message kind="error" line="13"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="bad switch syntax" + keywords="from-errors,purejava"> + <compile files="Switch.java"> + <message kind="error" line="4"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" + title="Referencing various things from static contexts" + keywords="from-errors,purejava"> + <compile files="StaticContexts.java"> + <message kind="error" line="11"/> + <message kind="error" line="18"/> + <message kind="error" line="19"/> + <message kind="error" line="20"/> + <message kind="error" line="21"/> + <message kind="error" line="27"/> + <message kind="error" line="28"/> + <message kind="error" line="31"/> + <message kind="error" line="35"/> + <message kind="error" line="36"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="Some expressions are illegal expression statements" + keywords="from-errors,purejava"> + <compile files="BadExpressionStatement.java"> + <message kind="error" line="3"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" title="illegal forward reference" + keywords="from-errors,purejava"> + <compile files="IllegalForwardReference.java"> + <message kind="error" line="9"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="protected accessibility" + keywords="from-errors,purejava"> + <compile files="protectedAccess/Main.java,protectedAccess/p1/C1.java"> + <message kind="error" line="26"/> + <message kind="error" line="28"/> + <message kind="error" line="29"/> + <message kind="error" line="31"/> + <message kind="error" line="37"/> + <message kind="error" line="45"/> + <message kind="error" line="46"/> + <message kind="error" line="54"/> + <message kind="error" line="55"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="parse-time illegal modifiers" + keywords="from-errors,purejava"> + <compile files="Modifiers1.java"> + <message kind="error" line="2"/> + <message kind="error" line="3"/> + <message kind="error" line="6"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="check-time illegal modifiers" + keywords="from-errors,purejava"> + <compile files="Modifiers.java"> + <message kind="error" line="2"/> + <message kind="error" line="3"/> + <message kind="error" line="4"/> + <message kind="error" line="6"/> + <message kind="error" line="7"/> + <message kind="error" line="8"/> + <message kind="error" line="9"/> + <message kind="error" line="11"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" title="illegal synchronized stmts" + keywords="from-errors,purejava,messages-vary"> + <compile files="BadSynchronized.java" + options="!eclipse"> + <message kind="error" line="6"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" title="modifiers on interface members" + keywords="from-errors,purejava"> + <compile files="InterfaceMembers.java"> + <message kind="error" line="2"/> + <message kind="error" line="3"/> + <message kind="error" line="4"/> + <message kind="error" line="5"/> + <message kind="error" line="7"/> + <message kind="error" line="8"/> + <message kind="error" line="9"/> + <message kind="error" line="10"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="good errors (and not too many) for missing members" + comment="XXX import of class in default package" + + keywords="from-errors,purejava"> + <compile files="NotFound.java"> + <message kind="error" line="1"/> + <message kind="error" line="2"/> + <message kind="error" line="6"/> + <message kind="error" line="9"/> + <message kind="error" line="10"/> + <message kind="error" line="14"/> + <message kind="error" line="16"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="536" + title="expecting compile failures with subclass narrowing scope of superclass methods or accessing private superclass variables" + keywords="from-errors,purejava"> + <compile files="RestrictingVisibilityCF.java"> + <message kind="error" line="27"/> + <message kind="error" line="29"/> + <message kind="error" line="31"/> + <message kind="error" line="39"/> + <message kind="error" line="41"/> + <message kind="error" line="46"/> + <message kind="error" line="48"/> + <message kind="error" line="53"/> + </compile> + </ajc-test> + + <ajc-test dir="errors" + title="inner classes may not have static non-constant members" + keywords="from-errors,purejava"> + <compile files="InnerMembers.java"> + <message kind="error" line="8"/> + <message kind="error" line="9"/> + <message kind="error" line="10"/> + <message kind="error" line="11"/> + <message kind="error" line="16"/> + <message kind="error" line="17"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" title="flow analysis with local types" + keywords="from-errors,purejava"> + <compile files="InnerFlow.java"> + <message kind="error" line="5"/> + </compile> + </ajc-test> + + <ajc-test dir="new" + title="PR584 Can construct inner classes using qualified expressions" + keywords="from-resolved_10rc3,purejava"> + <compile files="PR584.java"/> + <run class="PR584"/> + </ajc-test> + + <ajc-test dir="new" pr="715" title="incrementing objects, arrays - 2" + keywords="from-resolved_104,purejava"> + <compile files="ArrayInc2CE.java"> + <message kind="error" line="12"/> + <message kind="error" line="13"/> + <message kind="error" line="14"/> + <message kind="error" line="15"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="715" title="incrementing objects, arrays CE" + keywords="from-resolved_104,purejava,messages-vary"> + <compile files="ArrayIncCE.java" + options="!eclipse"> + <message kind="error" line="15"/> + <message kind="error" line="16"/> + <message kind="error" line="17"/> + <message kind="error" line="18"/> + <message kind="error" line="19"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="715" title="incrementing objects, arrays - 3" + keywords="from-resolved_104,purejava"> + <compile files="ArrayInc3CE.java"> + <message kind="error" line="15"/> + <message kind="error" line="16"/> + <message kind="error" line="17"/> + <message kind="error" line="18"/> + <message kind="error" line="19"/> + </compile> + </ajc-test> + + <ajc-test dir="new" pr="715" title="incrementing objects, arrays" + keywords="from-resolved_104,purejava"> + <compile files="ArrayInc.java"/> + <run class="ArrayInc"/> + </ajc-test> + + <ajc-test dir="pureJava" pr="737" + title="no circularity errors simply because of inners (1)" + keywords="from-resolved_105,purejava"> + <compile files="circle/Test1CP.java"/> + <run class="circle.Test1CP"/> + </ajc-test> + + <ajc-test dir="pureJava" pr="737" + title="no circularity errors simply because of inners (2)" + keywords="from-resolved_105,purejava"> + <compile files="circle/Test2CP.java"/> + <run class="circle.Test2CP"/> + </ajc-test> + + <ajc-test dir="pureJava" pr="737" + title="should have circular inheritance errors (1)" + keywords="from-resolved_105,purejava,messages-vary"> + <compile files="circle/Test1CF.java" + options="!eclipse"> + <message kind="error" line="7"/> + <message kind="error" line="15"/> + <message kind="error" line="17"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" pr="737" + title="should have circular inheritance errors (2)" + keywords="from-resolved_105,purejava,messages-vary"> + <compile files="circle/Test2CF.java" + options="!eclipse"> + <message kind="error" line="6"/> + <message kind="error" line="10"/> + <message kind="error" line="15"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" pr="728" + title="interface using preceding subinterface in its definition" + keywords="from-resolved_105,purejava"> + <compile files="ParentUsingChild.java"/> + <run class="ParentUsingChild"/> + </ajc-test> + + <ajc-test dir="new" pr="645" + title="Parent interface using public inner interface of child in same file" + keywords="from-resolved_105,purejava"> + <compile files="ParentInterfaceUsingChildInnerInterface.java"/> + <run class="ParentInterfaceUsingChildInnerInterface"/> + </ajc-test> + + <ajc-test dir="errors" + title="a type is not allowed to extend or implement its own innner type" + keywords="from-resolved_105,purejava"> + <compile files="NestedInterfaceTest.java"> + <message kind="error" line="1"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" title="try requires block JLS 14.19" + keywords="from-resolved_105,purejava,messages-vary"> + <compile files="TryBlockRequiredCE.java" + options="!eclipse"> + <message kind="error" line="6"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" pr="722" title="loop expressions not declarations" + keywords="from-resolved_105,purejava,messages-vary"> + <compile files="DeclarationsInLoopsCE.java" + options="!eclipse"> + <message kind="error" line="7"/> + </compile> + </ajc-test> + + + + + + + + + <ajc-test dir="new" pr="663" + title="no error when public class is in file of a different name" + keywords="from-resolved_105,purejava"> + <compile options="-strict" files="PublicClassWrongFilename.java"> + <message kind="error" line="3"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" pr="739" + title="local variables must be final to be accessed from inner class" + keywords="from-resolved_105,purejava"> + <compile files="LocalsFromInnerCE.java"> + <message kind="error" line="6"/> + <message kind="error" line="13"/> + <message kind="error" line="19"/> + <message kind="error" line="25"/> + <message kind="error" line="32"/> + <message kind="error" line="40"/> + <message kind="error" line="51"/> + <message kind="error" line="61"/> + <message kind="error" line="67"/> + <message kind="error" line="75"/> + <message kind="error" line="81"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" pr="739" + title="final local variables may be accessed from inner class" + keywords="from-resolved_105,purejava"> + <compile files="LocalsFromInnerCP.java"/> + <run class="LocalsFromInnerCP"/> + </ajc-test> + + + <ajc-test dir="pureJava" pr="723" title="missing package identifier" + keywords="from-resolved_105,purejava"> + <compile files="MissingPackageCE.java"> + <message kind="error" line="2"/> + </compile> + </ajc-test> + <ajc-test dir="new" pr="701" + title="CE for ambiguous type reference (two files in package)" + keywords="from-resolved_105,purejava"> + <compile + files="ambiguousClass/AmbiguousReferent.java,ambiguousClass/AmbiguousClassReference.java"> + <message kind="error" line="5"/> + </compile> + </ajc-test> + + + <ajc-test dir="new" + title="initializer can throw so long as all constructors declare so" + keywords="from-resolved_105,purejava"> + <compile files="InitializerWithThrow.java"/> + <run class="InitializerWithThrow"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="interfaces may not contain initializers (bug found by jacks)" + keywords="from-resolved_105,purejava"> + <compile files="InterfaceMembersCf.java"> + <message kind="error" line="2"/> + <message kind="error" line="3"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" + title="initializers must be able to complete normally (found by jacks)" + keywords="from-resolved_105,purejava,messages-vary"> + <compile files="InitializerFlowCf.java" + options="!eclipse"> + <message kind="error" line="2"/> + <message kind="error" line="4"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" title="more tests of super alone" + keywords="from-resolved_105,purejava"> + <compile files="SuperIsWeird.java"> + <message kind="error" line="9"/> + <message kind="error" line="13"/> + <message kind="error" line="20"/> + <message kind="error" line="21"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" pr="752" + title="subclass access to enclosing super class private members" + keywords="from-resolved_105,purejava,fail-unimplemented"> + <compile files="SubclassAccessToEnclosingSuperClassPrivate.java"/> + <run class="SubclassAccessToEnclosingSuperClassPrivate"/> + </ajc-test> + + <ajc-test dir="pureJava" title="various tests of switch bounds" + keywords="from-resolved_106,purejava"> + <compile files="SwitchBounds.java"/> + <run class="SwitchBounds"/> + </ajc-test> + + <ajc-test dir="new" pr="601" + title="VerifyError if nested sync returning result" + comment="XXX inconsistent behavior?" + keywords="from-resolved_10final,purejava"> + <compile files="NestedSyncWithResult.java"/> + <run class="NestedSyncWithResult"/> + </ajc-test> + + + <ajc-test dir="new" pr="134" + title="import of a class in the default package" + keywords="from-broken14usejavac,purejava"> + <compile files="ImportFromUnnamed.java,DeclaredExcs.java"/> + <run class="ImportFromUnnamed"/> + </ajc-test> + + <ajc-test dir="pureJava" pr="386" + title="Referencing static interfaces with import statements" + keywords="from-broken14usejavac,purejava"> + <compile files="ClassWithStaticInnerInterfaces.java"/> + <compile files="ImportingStaticInnerInterfaces_PR386.java"/> + <run class="ImportingStaticInnerInterfaces_PR386"/> + </ajc-test> + + <ajc-test dir="pureJava" pr="386" + title="Referencing static interfaces with import statements stars" + keywords="purejava,from-broken14usejavac"> + <compile files="ClassWithStaticInnerInterfaces.java"/> + <compile files="ImportingStaticInnerInterfacesStars_PR386.java"/> + <run class="ImportingStaticInnerInterfacesStars_PR386"/> + </ajc-test> + + <ajc-test dir="pureJava" pr="386" + title="Referencing static interfaces with import statements stars 2" + keywords="purejava,from-broken14usejavac"> + <compile files="ClassWithStaticInnerInterfaces.java"/> + <compile files="ImportingStaticInnerInterfacesStars2_PR386.java"/> + <run class="ImportingStaticInnerInterfacesStars2_PR386"/> + </ajc-test> + + <ajc-test dir="pureJava" pr="386" + title="Referencing static interfaces with import statements stars 3" + keywords="purejava,from-broken14usejavac"> + <compile files="ClassWithStaticInnerInterfaces.java"/> + <compile files="ImportingStaticInnerInterfacesStars3_PR386.java"/> + <run class="ImportingStaticInnerInterfacesStars3_PR386"/> + </ajc-test> + + <ajc-test dir="pureJava" pr="386" + title="Referencing interfaces with import statements" + keywords="purejava,from-broken14usejavac"> + <compile + files="ClassWithInnerInterfaces.java,ImportingInnerInterfaces_PR386.java"/> + <run class="ImportingInnerInterfaces_PR386"/> + </ajc-test> + + <ajc-test dir="pureJava" pr="386" + title="Referencing interfaces with import statements stars" + keywords="purejava,from-broken14usejavac"> + <compile + files="ClassWithInnerInterfaces.java,ImportingInnerInterfacesStars_PR386.java"/> + <run class="ImportingInnerInterfacesStars_PR386"/> + </ajc-test> + + <ajc-test dir="pureJava" pr="386" + title="Referencing interfaces with import statements stars 2" + keywords="purejava,from-broken14usejavac"> + <compile + files="ClassWithInnerInterfaces.java,ImportingInnerInterfacesStars2_PR386.java"/> + <run class="ImportingInnerInterfacesStars2_PR386"/> + </ajc-test> + + <ajc-test dir="pureJava" pr="386" + title="Referencing interfaces with import statements stars 3" + keywords="purejava,from-broken14usejavac"> + <compile + files="ClassWithInnerInterfaces.java,ImportingInnerInterfacesStars3_PR386.java"/> + <run class="ImportingInnerInterfacesStars3_PR386"/> + </ajc-test> + + <ajc-test dir="new/PR862" pr="862" + title="import any inner from interface implementor" + keywords="purejava"> + <compile files="pack/ImportInnerFromInterfaceImplementor.java"> + <dir-changes added="pack.ImportInnerFromInterfaceImplementor"/> + </compile> + <run class="pack.ImportInnerFromInterfaceImplementor"/> + </ajc-test> + + <ajc-test dir="pureJava/equalsMethOnStr" pr="214" + title="equals method on quoted strings" keywords="from-java"> + <compile files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="pureJava/anonInnerClass" pr="294" + title="anonymous inner class" keywords="from-java"> + <compile files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="parsing of parenthesized 'this' (in returns)" keywords="from-java"> + <compile files="ReturnThis.java"/> + <run class="ReturnThis"/> + </ajc-test> + + <ajc-test dir="pureJava" title="Strings are folded and interned correctly" + keywords="from-java"> + <compile files="StringFold.java"/> + <run class="StringFold"/> + </ajc-test> + + <ajc-test dir="pureJava" title="Cast binds tighter than equality tests" + keywords="from-java"> + <compile files="CastAndBinary.java"/> + <run class="CastAndBinary"/> + </ajc-test> + + <ajc-test dir="pureJava" title="Boundary base values can be parsed" + keywords="from-java"> + <compile files="BoundaryNums.java"/> + <run class="BoundaryNums"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="State is passed correctly across nested annonymous inners" + keywords="from-java"> + <compile files="NestedInners.java"/> + <run class="NestedInners"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="?: expressions should typecheck in interesting ways" + keywords="from-java"> + <compile files="TriTestTypecheck.java"/> + <run class="TriTestTypecheck"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="cast expressions should allow casts to/from interfaces at compile-time." + keywords="from-java"> + <compile files="InterfaceCast.java"/> + <run class="InterfaceCast"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="various anonymous inner classes plus super types tests" + keywords="from-java"> + <compile files="InnerSuper.java"/> + <run class="InnerSuper"/> + </ajc-test> + + <ajc-test dir="pureJava" title="Various comment syntaxes should be handled." + keywords="from-java"> + <compile files="CommentSyntax.java"/> + <run class="CommentSyntax"/> + </ajc-test> + + <ajc-test dir="pureJava/abstractInner" + title="Abstract inner classes across package boundaries" + keywords="from-java"> + <compile files="C.java,pkg/A.java"/> + <run class="C"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="inner classes accessing outers and some more inner class names" + keywords="from-java"> + <compile files="InnerAccess.java"/> + <run class="InnerAccess"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="remember to cast folded values down to the proper types." + keywords="from-java"> + <compile files="CastingFoldedValues.java"/> + <run class="CastingFoldedValues"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="inner classes can be built using protected constructors in super" + keywords="from-java"> + <compile files="VariousConstructors.java"/> + <run class="VariousConstructors"/> + </ajc-test> + + <ajc-test dir="pureJava" pr="401" + title="The current AspectJ compiler cannot parse qualified superclass constructor invocations" + keywords="from-java"> + <compile files="QualifiedSuperClassConstructorInvocations_PR401.java"/> + <run class="QualifiedSuperClassConstructorInvocations_PR401"/> + </ajc-test> + + <ajc-test dir="pureJava" pr="421" + title="More thourough test of static members using full names" + keywords="from-java"> + <compile + files="Statics.java,StaticMembers_PR421.java,p1/C1.java,p1/P1Statics.java,p1/subp1/SubC1.java,p1/p2/P1P2Statics.java"/> + <run class="StaticMembers_PR421"/> + </ajc-test> + + <ajc-test dir="pureJava" pr="421" + title="More thourough test of static members using imports" + keywords="from-java"> + <compile + files="Statics.java,StaticMembersImports_PR421.java,p1/C1.java,p1/P1Statics.java,p1/subp1/SubC1.java,p1/p2/P1P2Statics.java"/> + <run class="StaticMembersImports_PR421"/> + </ajc-test> + + <ajc-test dir="pureJava/conflictingPackageNames" pr="437" + title="Looking in class Java for java.lang.String WITH separate compilation" + keywords="from-java"> + <compile files="Java.java"/> + <compile files="Main.java"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="pureJava/conflictingPackageNames" pr="437" + title="Looking in class Java for java.lang.String WITHOUT separate compilation" + keywords="from-java"> + <compile files="Main.java,Java.java"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="pureJava/conflictingPackageNamesWithPackages" pr="437" + title="Looking in class Java for java.lang.String WITH separate compilation with packages" + keywords="from-java"> + <compile files="Java.java"/> + <compile files="Main.java"/> + <run class="conflictingPackageNamesWithPackages.Main"/> + </ajc-test> + + <ajc-test dir="pureJava/conflictingPackageNamesWithPackages" pr="437" + title="Looking in class Java for java.lang.String WITHOUT separate compilation with packages" + keywords="from-java"> + <compile files="Main.java,Java.java"/> + <run class="conflictingPackageNamesWithPackages.Main"/> + </ajc-test> + + <ajc-test dir="pureJava" title="Testing ternary operations." + keywords="from-java"> + <compile files="MultiTernaryOps.java"/> + <run class="MultiTernaryOps"/> + </ajc-test> + + <ajc-test dir="pureJava" title="Lifting locals in switch statements." + keywords="from-java"> + <compile files="SwitchStmtLocals.java"/> + <run class="SwitchStmtLocals"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Getting confused when looking up method signatures" + keywords="from-java"> + <compile files="MethodSigs.java"/> + <run class="MethodSigs"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Not recognizing the chars '\0', '\1', '\2', '\3', '\4', '\5', '\6', '\7'" + keywords="from-java"> + <compile files="Chars.java"/> + <run class="Chars"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Test chars '\0', '\1', '\2', '\3', '\4', '\5', '\6', '\7' with a case statement" + keywords="from-java"> + <compile files="CaseClauses.java"/> + <run class="CaseClauses"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Checking character values with all the unicode chars." + keywords="from-java"> + <compile files="CharsUnicode.java"/> + <run class="CharsUnicode"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Trouble finding methods with the same name and different parameter types" + keywords="from-java"> + <compile files="MethodsWithTheSameName.java"/> + <run class="MethodsWithTheSameName"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Binding non-public static inner classes of interfaces in other packages" + keywords="from-java"> + <compile + files="StaticClassesInInterfaces.java,anotherPackage/AnotherPackageInterface.java"/> + <run class="StaticClassesInInterfaces"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Not recognizing the octal chars '\0', '\1', '\2', '\3', '\4', '\5', '\6', '\7'" + keywords="from-java"> + <compile files="OctalChars.java"/> + <run class="OctalChars"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Members with the same name as their package cause confusion with fully-qualified names." + keywords="from-java"> + <compile files="samenames/Main.java,samenames/Other.java"/> + <run class="samenames.Main"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Fully-qual'ed names with same start as variable names" + keywords="from-java"> + <compile files="FullNames.java"/> + <run class="FullNames"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Fully qualifying inner classes within annonymous classes causes problems." + keywords="from-java"> + <compile files="InnerClassesInAnnonymousClasses.java"/> + <run class="InnerClassesInAnnonymousClasses"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Calls to methods in outer annonymous classes are being qual's incorrectly with 'this'" + keywords="from-java"> + <compile files="MisplacedThisInAnnonymousInnerClasses.java"/> + <run class="MisplacedThisInAnnonymousInnerClasses"/> + </ajc-test> + + <ajc-test dir="pureJava/innersFromSourceAndBytecode" + title="Reading inner classes from source and bytecode (1) -- was failing" + keywords="from-java"> + <compile files="C.java,D.java"/> + <compile files="Main.java,C.java" + includeClassesDir="true"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="pureJava/innersFromSourceAndBytecode" + title="Reading inner classes from source and bytecode (2)" + keywords="from-java"> + <compile files="Main.java,C.java,D.java"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="pureJava/innersFromSourceAndBytecode" + title="Reading inner classes from source and bytecode (3)" + keywords="from-java"> + <compile files="C.java,D.java"/> + <compile files="Main.java,C.java,D.java" + includeClassesDir="true"/> + <run class="Main"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Not lifting types correctly with bytes and shorts with ternary ops" + keywords="from-java"> + <compile files="TernaryPrimitiveOps.java"/> + <run class="TernaryPrimitiveOps"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Not looking up methods inside of anonymous declarations correctly." + keywords="from-java"> + <compile files="AnonymousMethodLookup.java"/> + <run class="AnonymousMethodLookup"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Resolving extended classes with array parameters" + keywords="from-java"> + <compile files="ResolvingArrayParameters.java"/> + <run class="ResolvingArrayParameters"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Assignments as second arguments in ternary operators." + keywords="from-java"> + <compile files="TernaryAssignments.java"/> + <run class="TernaryAssignments"/> + </ajc-test> + + + <ajc-test dir="pureJava" title="Conflicting inner classes with interfaces." + keywords="from-java"> + <compile files="PR413.java"/> + <run class="PR413"/> + </ajc-test> + + <ajc-test dir="pureJava" title="confusions of casts and parens" + keywords="from-java"> + <compile files="CastVsParen.java"/> + <run class="CastVsParen"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="default constructors seen by inner classes subtyping outers" + keywords="from-java"> + <compile files="DefaultConsAndInner.java"/> + <run class="DefaultConsAndInner"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="folding fields set to anonymous instances containing self-references" + keywords="from-java"> + <compile files="AnonFolding.java"/> + <run class="AnonFolding"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="finally at the end of a method that needs to return" + keywords="from-java"> + <compile files="FinallyAndReturns.java"/> + <run class="FinallyAndReturns"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="overriding methods from object in interfaces and multiple-inheritance" + keywords="from-java"> + <compile files="InterfaceAndObject.java"/> + <run class="InterfaceAndObject"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="private fields in an outer class accessed by an inner which also extends the outer" + keywords="from-java"> + <compile files="PrivateFields.java"/> + <run class="PrivateFields"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="breaking out of a labeled block inside of an if" + keywords="from-java"> + <compile files="Breaks.java"/> + <run class="Breaks"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="abstractifying a method and getting it back through super" + keywords="from-java"> + <compile files="Abstracts.java"/> + <run class="Abstracts"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Packages and static classes with the same name produce compile errors." + keywords="from-java"> + <compile files="PackagesAndStaticClassesWithTheSameName.java"/> + <run class="PackagesAndStaticClassesWithTheSameName"/> + </ajc-test> + + <ajc-test dir="pureJava/innerTypeModifiers" + title="Inner types must generate classfiles with only Public/Default access flags." + keywords="from-java"> + <compile files="pkg1/Main.java,pkg2/Foo.java"/> + <run class="pkg1.Main"/> + </ajc-test> + + <ajc-test dir="pureJava/innerDefaultConstructors" + title="Default constructors have same access as their enclosing type" + keywords="from-java"> + <compile files="pkg1/Main.java,pkg2/Foo.java"> + <message kind="error" line="6"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" + title="Returning primitive values matching method return type (minimal)" + keywords="from-java"> + <compile files="ReturnTypes.java"/> + <run class="ReturnTypes"/> + </ajc-test> + + <ajc-test dir="pureJava" title="Flow analysis and if(true)" + keywords="from-java"> + <compile files="Flow.java"/> + <run class="Flow"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="packages and generated inner types (for I.class)" + keywords="from-java"> + <compile files="InterfaceAndClass.java"/> + <run class="p.InterfaceAndClass"/> + </ajc-test> + + <ajc-test dir="pureJava" title="A.this exprs match by exact type matching" + keywords="from-java"> + <compile files="QualifiedThisMatchesExactly.java"> + <message kind="error" line="14"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" + title="Implicit this for new inner instance must be avaliable" + keywords="from-java"> + <compile files="ImplicitThisMissing.java"> + <message kind="error" line="4"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" + title="Inners can reference protected fields of their outer's super." + keywords="from-java"> + <compile + files="protectedFieldRefInInner/Main.java,protectedFieldRefInInner/p1/C.java"/> + <run class="protectedFieldRefInInner.Main"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Primitives that special case for a constant arm should work" + keywords="from-java"> + <compile files="OneArmedPrimitiveTests.java"/> + <run class="OneArmedPrimitiveTests"/> + </ajc-test> + + <ajc-test dir="pureJava" title="Parenthesized true and false don't parse" + keywords="from-java"> + <compile files="ParenKeywords.java"/> + <run class="ParenKeywords"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Field sets to public fields of private fields of enclosing types" + keywords="from-java"> + <compile files="InnerFieldRef.java"/> + <run class="InnerFieldRef"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Constant values should be stored with the correct type of their fields" + keywords="from-java"> + <compile files="ConstantValueConversion.java"/> + <run class="ConstantValueConversion"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Local variables in initializers should not be treated as blank final fields" + keywords="from-java"> + <compile files="LocalInitializerVariableNotBlank.java"/> + <run class="LocalInitializerVariableNotBlank"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Binops aren't allowed as update stmts in for loops" + keywords="from-java"> + <compile files="NonStmtInFor.java"> + <message kind="error" line="3"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" + title="Can't avoid doing division in case of div by zero" + keywords="from-java"> + <compile files="DivOpMustHappen.java"/> + <run class="DivOpMustHappen"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="Testing frames w/greater than FF locals and 7F incs (i.e., WIDE instruction)" + keywords="from-java"> + <compile files="BigFrameTest.java"/> + <run class="BigFrameTest"/> + </ajc-test> + + <ajc-test dir="pureJava" title="correct numeric literals" + keywords="from-java"> + <compile files="LiteralsCp.java"/> + <run class="LiteralsCp"/> + </ajc-test> + + <ajc-test dir="pureJava" title="invalid numeric literals" + keywords="from-java"> + <compile files="LiteralsCf.java"> + <message kind="error" line="8"/> + <message kind="error" line="9"/> + <message kind="error" line="10"/> + <message kind="error" line="11"/> + <message kind="error" line="12"/> + <message kind="error" line="17"/> + <message kind="error" line="18"/> + <message kind="error" line="19"/> + <message kind="error" line="20"/> + <message kind="error" line="21"/> + <message kind="error" line="22"/> + <message kind="error" line="23"/> + <message kind="error" line="25"/> + <message kind="error" line="27"/> + <message kind="error" line="28"/> + <message kind="error" line="29"/> + <message kind="error" line="30"/> + <message kind="error" line="32"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" pr="538" + title="inner types can't have the same simple name as an enclosing type" + keywords="from-java"> + <compile files="InnerNameConflictsCf.java"> + <message kind="error" line="9"/> + <message kind="error" line="14"/> + <message kind="error" line="20"/> + <message kind="error" line="21"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" + title="test the unops and binops with various values" keywords="from-java"> + <compile files="BigOps.java"/> + <run class="BigOps"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="test + and += for strings and variously typed values" + keywords="from-java"> + <compile files="BigString.java"/> + <run class="BigString"/> + </ajc-test> + + <ajc-test dir="pureJava" title="test try/catch/finally statements" + keywords="from-java"> + <compile files="TryCatchFinally.java"/> + <run class="TryCatchFinally"/> + </ajc-test> + + + <ajc-test dir="pureJava" pr="547" + title="local types can be bound in the signatures of other local types" + keywords="from-resolved_10rc3,from-java"> + <compile files="LocalInners.java"/> + <run class="LocalInners"/> + </ajc-test> + + <ajc-test dir="pureJava/nameConflicts" + title="type and package name conflicts are resolved happily (2)" + keywords="from-java"> + <compile files="p1/Main2.java,p1/p2/Foo.java"/> + <run class="p1.Main2"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="try statements work sorta like scoped items for exception flow control" + keywords="from-java"> + <compile files="TryWorksLikeEnvironment.java"/> + <run class="TryWorksLikeEnvironment"/> + </ajc-test> + + <ajc-test dir="pureJava" + title="qualified this must work exactly, not based on subtypes" + keywords="from-java"> + <compile files="QualifiedThisExactness.java"> + <message kind="error" line="6"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" + title="nested finally blocks have interesting frame location problems" + keywords="from-java"> + <compile files="NestedFinally.java"/> + <run class="NestedFinally"/> + </ajc-test> + + <ajc-test dir="pureJava" pr="601" + title="nested synchronized blocks have interesting frame location problems" + keywords="from-java"> + <compile files="NestedSynchronized.java"/> + <run class="NestedSynchronized"/> + </ajc-test> + + <ajc-test dir="pureJava" title="anonymous inner classes with inner types" + keywords="from-java"> + <compile files="AnonymousWithInner.java"/> + <run class="AnonymousWithInner"/> + </ajc-test> + + <ajc-test dir="pureJava" pr="651" title="qualified super call expr" + keywords="from-java"> + <compile files="QualifiedSuperCall.java"/> + <run class="QualifiedSuperCall"/> + </ajc-test> + + <ajc-test dir="pureJava" pr="680" + title="interfaces with non-explicitly static inner classes" + keywords="from-java"> + <compile files="InterfaceAndInnerHelper.java"/> + <compile files="InterfaceAndInner.java" + includeClassesDir="true"/> + <run class="InterfaceAndInner"/> + </ajc-test> + + <ajc-test dir="pureJava" title="Operands work correctly" + keywords="from-bigjava"> + <compile files="Ops.java"/> + <run class="Ops"/> + </ajc-test> + + <ajc-test dir="pureJava" title="simple tests of throws and for stmt typing" + keywords="from-errors"> + <compile files="SimpleSpec.java"> + <message kind="error" line="4"/> + <message kind="error" line="7"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" title="test for not folding circular constants" + keywords="from-errors"> + <compile files="CircularFolding.java"> + <message kind="error" line="6"/> + <message kind="error" line="7"/> + <message kind="error" line="8"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" title="continue targets must be continuable" + keywords="from-errors"> + <compile files="BadContinueTarget.java"> + <message kind="error" line="6"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" + title="qualified this to non-inner should be caught" + keywords="from-errors"> + <compile files="BadQualifiedNew.java"> + <message kind="error" line="4"/> + </compile> + </ajc-test> + + <ajc-test dir="new" + title="Cannot bind a name." keywords="from-resolved_10x,purejava"> + <compile files="CannotReferenceSuper.java"/> + <run class="CannotReferenceSuper"/> + </ajc-test> + + <ajc-test dir="pureJava" pr="721" + title="interface declaration not permitted in local method scope" + keywords="from-resolved_105"> + <compile files="LocalInterfaceCE.java"> + <message kind="error" line="5"/> + <message kind="error" line="8"/> + <message kind="error" line="11"/> + <message kind="error" line="15"/> + </compile> + </ajc-test> + + <ajc-test dir="pureJava" + title="Locals inside other locals, ordering of processing [eh]" + keywords="from-resolved_105"> + <compile files="LocalInners2.java"/> + <run class="LocalInners2"/> + </ajc-test> + + <ajc-test dir="pureJava" pr="866" + title="non-constant static final fields marked as final in .class"> + <compile files="FinalStaticField.java"/> + <run class="FinalStaticField"/> + </ajc-test> + + <ajc-test dir="new" title="handle multiple nested inner classes" + keywords="from-java"> + <compile files="InnerHell.java"/> + <run class="InnerHell"/> + </ajc-test> + + <ajc-test dir="new/volatileKeyword" pr="151" + title="advice on a static method" keywords="from-java"> + <compile files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="new/innerConsSyntax" pr="192" + title="inner constructor syntax causes compile error" keywords="from-java"> + <compile files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="new/paramWidening" pr="195" + title="widening of method parameters to match javac" keywords="from-java"> + <compile files="Driver.java"/> + <run class="Driver"/> + </ajc-test> + + <ajc-test dir="new" pr="313" + title="parenthesized string literals matching primitive type names" + keywords="from-java"> + <compile files="ParenPrimitive.java"/> + <run class="ParenPrimitive"/> + </ajc-test> + + <ajc-test dir="new" title="simple type coercions tests" keywords="from-java"> + <compile files="TypeCoercions.java"/> + <run class="TypeCoercions"/> + </ajc-test> + + <ajc-test dir="new" title="order of type declarations shouldn't matter" + keywords="from-java"> + <compile files="OrderOfTypes.java"/> + <run class="OrderOfTypes"/> + </ajc-test> + + <ajc-test dir="new" title="Scanner non recognizing strictfp." + keywords="from-java"> + <compile files="StrictFp.java"/> + <run class="StrictFp"/> + </ajc-test> + + <ajc-test dir="new" + title="Crashes when a lot of zeros are in front of a double variable [!!! purejava]" + keywords="from-java"> + <compile files="Zeros.java"/> + <run class="Zeros"/> + </ajc-test> + diff --git a/tests/src/test/java/org/aspectj/systemtest/purejava/pureJava.xml b/tests/src/test/java/org/aspectj/systemtest/purejava/pureJava.xml new file mode 100644 index 000000000..1eb4b9f60 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/purejava/pureJava.xml @@ -0,0 +1,10 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[ +<!ENTITY tests SYSTEM "../tests/src/org/aspectj/systemtest/purejava/pureJava-tests.xml"> +]> +<!-- Pure Java Tests --> + +<suite> + +&tests; + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/serialVerUID/SUIDTests.java b/tests/src/test/java/org/aspectj/systemtest/serialVerUID/SUIDTests.java new file mode 100644 index 000000000..50c5dc216 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/serialVerUID/SUIDTests.java @@ -0,0 +1,96 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM Corporation + * 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 + * + * ******************************************************************/ +package org.aspectj.systemtest.serialVerUID; + +import java.io.File; +import junit.framework.Test; +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class SUIDTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(SUIDTests.class); + } + + protected File getSpecFile() { + return getClassResource("serialVerUID.xml"); + } + + + public void test001(){ + runTest("SUID: Before execution advice"); + } + + public void test002(){ + runTest("SUID: Around execution advice"); + } + + public void test003(){ + runTest("SUID: Around closure execution advice (-Xlint:ignore)"); + } + + public void test004(){ + runTest("SUID: Around closure execution advice"); + } + + public void test005(){ + runTest("SUID: thisJoinPoint"); + } + + public void test006(){ + runTest("SUID: thisJoinPoint with clinit method"); + } + + public void test007(){ + runTest("SUID: After returning staticinitialization advice"); + } + + public void test008(){ + runTest("SUID: After returning staticinitialization advice with serialVersionUID field"); + } + + public void test009(){ + runTest("SUID: ITD field"); + } + + public void test010(){ + runTest("SUID: ITD method"); + } + + public void test011(){ + runTest("SUID: Declare extends"); + } + + public void test012(){ + runTest("SUID: Declare implements (compile)"); + } + + public void test013(){ + runTest("SUID: Declare implements non-Serializable (compile)"); + } + + public void test014(){ + runTest("SUID: Declare implements Serializable (compile)"); + } + + public void test015(){ + runTest("SUID: Declare implements (weave)"); + } + + public void test016(){ + runTest("SUID: Priviliged aspect"); + } + + public void test017(){ + runTest("SUID: Perthis aspect"); + } + +} + diff --git a/tests/src/test/java/org/aspectj/systemtest/serialVerUID/serialVerUID-tests.xml b/tests/src/test/java/org/aspectj/systemtest/serialVerUID/serialVerUID-tests.xml new file mode 100644 index 000000000..d6346ceac --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/serialVerUID/serialVerUID-tests.xml @@ -0,0 +1,169 @@ +<!-- SUID Tests --> + + <ajc-test dir="bugs/serialVersionUID" + title="SUID: Before execution advice" pr="41181"> + <compile files="Test.java, Util.java"/> + <run class="Test"/> + <compile files="Test.java, Util.java, BeforeExecutionAdvice.aj" options="-Xlint:warning"/> + <run class="Util"/> + </ajc-test> + + <ajc-test dir="bugs/serialVersionUID" + title="SUID: Around execution advice" comment="OK because around_body private" pr="41181"> + <compile files="Test.java, Util.java"/> + <run class="Test"/> + <compile files="Test.java, Util.java, AroundExecutionAdvice.aj" options="-Xlint:warning"/> + <run class="Util"/> + </ajc-test> + + <ajc-test dir="bugs/serialVersionUID" + title="SUID: Around closure execution advice (-Xlint:ignore)" comment="OK because ignoring warnings" + pr="41181"> + <compile files="Test.java, Util.java"/> + <run class="Test"/> + <compile files="Test.java, Util.java, AroundClosureExecutionAdvice.aj" options="-Xlint:ignore"/> + <run class="Util" options="-fail"/> + </ajc-test> + + <ajc-test dir="bugs/serialVersionUID" + title="SUID: Around closure execution advice" comment="Warning because around_body non-private" + pr="41181"> + <compile files="Test.java, Util.java"/> + <run class="Test"/> + <compile files="Test.java, Util.java, AroundClosureExecutionAdvice.aj" + xlintfile="Xlint.properties"> + <message kind="warning" line="9"/> + </compile> + <run class="Util" options="-fail"/> + </ajc-test> + + <ajc-test dir="bugs/serialVersionUID" + title="SUID: thisJoinPoint" comment="Warning because of introduced clinit" pr="41181"> + <compile files="Test.java, Util.java"/> + <run class="Test"/> + <compile + files="Test.java, Util.java, TJP.aj" options="-Xlint:warning"> + <message kind="warning" line="6"/> + <message kind="warning" line="13"/> + <message kind="warning" line="17"/> + <message kind="warning" line="24"/> + <message kind="warning" line="31"/> + </compile> + <run class="Util" options="-fail"/> + </ajc-test> + + <ajc-test dir="bugs/serialVersionUID" + title="SUID: thisJoinPoint with clinit method" comment="OK if tjp private and existing clinit" + pr="41181"> + <compile files="ClinitTest.java, Util.java"/> + <run class="ClinitTest"/> + <compile files="ClinitTest.java, Util.java, TJP.aj" options="-Xlint:warning -1.4"> + <message kind="warning" line="24" text="can not build"/> + <message kind="warning" line="31" text="can not build"/> + </compile> + <run class="Util" options="-read"/> + </ajc-test> + + <ajc-test dir="bugs/serialVersionUID" + title="SUID: After returning staticinitialization advice" comment="Warning because of added clinit" + pr="41181"> + <compile files="Test.java, Util.java"/> + <run class="Test"/> + <compile + files="Test.java, Util.java, AfterReturningStaticinitializationAdvice.aj" options="-Xlint:warning"> + <message kind="warning" line="6"/> + </compile> + <run class="Util" options="-fail"/> + </ajc-test> + + <ajc-test dir="bugs/serialVersionUID" + title="SUID: After returning staticinitialization advice with serialVersionUID field" + comment="OK because of serialVersionUID field" pr="41181"> + <compile files="SuidTest.java, Util.java" /> + <run class="SuidTest"/> + <compile files="SuidTest.java, Util.java, AfterReturningStaticinitializationAdvice.aj" options="-Xlint:warning"/> + <run class="Util"/> + </ajc-test> + + <ajc-test dir="bugs/serialVersionUID" + title="SUID: ITD field" comment="Error because added field may not be initialized" pr="41181"> + <compile files="Test.java, Util.java"/> + <run class="Test"/> + <compile files="Test.java, Util.java, ITDField.aj" options="-Xlint:error"> + <message kind="error" line="1"/> <!-- two messages about new getter/setter affecting suid for private itd field --> + <message kind="error" line="3"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/serialVersionUID" + title="SUID: ITD method" comment="Warning because of added method" pr="41181"> + <compile files="Test.java, Util.java" /> + <run class="Test"/> + <compile files="Test.java, Util.java, ITDMethod.aj" options="-Xlint:warning"> + <message kind="warning" line="3"/> + </compile> + <run class="Util" options="-fail"/> + </ajc-test> + + <ajc-test dir="bugs/serialVersionUID" + title="SUID: Declare extends" comment="OK" pr="41181"> + <compile files="Test.java, Util.java" /> + <run class="Test"/> + <compile files="Test.java, Util.java, DeclareExtends.aj" options="-Xlint:warning"/> + <run class="Util"/> + </ajc-test> + + <ajc-test dir="bugs/serialVersionUID" + title="SUID: Declare implements (compile)" comment="Warning because of added interface" pr="41181"> + <compile files="Test.java, Util.java" /> + <run class="Test"/> + <compile files="Test.java, Util.java, DeclareImplements.aj" options="-Xlint:warning"> + <message kind="warning" line="3"/> + </compile> + <run class="Util" options="-fail"/> + </ajc-test> + + <ajc-test dir="bugs/serialVersionUID" + title="SUID: Declare implements non-Serializable (compile)" comment="OK because not Serializable" + pr="41181"> + <compile files="NonSerializableTest.java, DeclareImplements.aj" options="-Xlint:warning"/> + </ajc-test> + + <ajc-test dir="bugs/serialVersionUID" + title="SUID: Declare implements Serializable (compile)" comment="OK because adding Serializable" + pr="41181"> + <compile files="NonSerializableTest.java, DeclareImplementsSerializable.aj" options="-Xlint:warning"/> + </ajc-test> + + <ajc-test dir="bugs/serialVersionUID" + title="SUID: Declare implements (weave)" comment="Warning because of added interface" pr="41181"> + <compile files="Test.java, Util.java" /> + <run class="Test"/> + <compile files="injar.jar, DeclareImplements.aj" options="-Xlint:warning"> + <message kind="warning" line="3"/> + </compile> + <run class="Util" options="-fail"/> + </ajc-test> + + <ajc-test dir="bugs/serialVersionUID" title="SUID: Priviliged aspect" pr="41181"> + <compile files="Test.java, Util.java"/> + <run class="Test"/> + <compile files="Test.java, Util.java, PrivilegedAspect.aj" options="-Xlint:warning"> + <message kind="warning" line="0"/> + </compile> + <run class="Util" options="-fail"/> + </ajc-test> + + <ajc-test dir="bugs/serialVersionUID" + title="SUID: Perthis aspect" + comment="Warning because added of added interface MightHaveAspect. Added field is private transient" + pr="41181"> + <compile files="Test.java, Util.java" /> + <run class="Test"/> + <compile files="Test.java, Util.java, PerThisAspect.aj" options="-Xlint:warning"> + <message kind="warning" line="0"/> + </compile> + <run class="Util" options="-fail"/> + </ajc-test> + + diff --git a/tests/src/test/java/org/aspectj/systemtest/serialVerUID/serialVerUID.xml b/tests/src/test/java/org/aspectj/systemtest/serialVerUID/serialVerUID.xml new file mode 100644 index 000000000..20bfa889d --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/serialVerUID/serialVerUID.xml @@ -0,0 +1,10 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[ +<!ENTITY tests SYSTEM "../tests/src/org/aspectj/systemtest/serialVerUID/serialVerUID-tests.xml"> +]> +<!-- SUID Tests --> + +<suite> + +&tests; + +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/tests/.cvsignore b/tests/src/test/java/org/aspectj/systemtest/tests/.cvsignore new file mode 100644 index 000000000..9d3c17f8d --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/tests/.cvsignore @@ -0,0 +1 @@ +ajcTestSuite.dtd diff --git a/tests/src/test/java/org/aspectj/systemtest/tracing/TracingTests.java b/tests/src/test/java/org/aspectj/systemtest/tracing/TracingTests.java new file mode 100644 index 000000000..3e8b6d8db --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/tracing/TracingTests.java @@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * 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: + * Matthew Webster - initial implementation + *******************************************************************************/ +package org.aspectj.systemtest.tracing; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class TracingTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(TracingTests.class); + } + + protected File getSpecFile() { + return getClassResource("tracing.xml"); + } + + public void testTracing () { + runTest("Tracing"); + } + + public void testDefaultTracing () { + runTest("Default tracing"); + } + + public void testTraceMessages () { + runTest("Trace messages"); + } + + public void testTraceEverything () { + runTest("Trace everything"); + } + + public void testJDK14Tracing_pr159854 () { + runTest("JDK 1.4 tracing"); + } + + public void testTracingFileSystemProperty () { + runTest("Tracing file System Property"); + + File dir = getSandboxDirectory(); + File file = new File(dir,"tracing.txt"); + assertTrue("Missing tracing file: " + file,file.exists()); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/tracing/tracing.xml b/tests/src/test/java/org/aspectj/systemtest/tracing/tracing.xml new file mode 100644 index 000000000..8a6409183 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/tracing/tracing.xml @@ -0,0 +1,99 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<!-- Tracing Tests --> +<suite> + + <ajc-test dir="tracing" title="Tracing" keywords="tracing"> + <compile + files="TracingTest.java" + /> + <ant file="ant.xml" target="Tracing" verbose="true"> + <stdout> + <line text="? TracingTest.main() trace="/> + </stdout> + </ant> + </ajc-test> + + <ajc-test dir="tracing" title="Default tracing" keywords="tracing"> + <compile + files="DefaultTracingTest.java" + /> + <ant file="ant.xml" target="Default tracing" verbose="true"> + <stdout> + <line text="? DefaultTracingTest.main() trace=org.aspectj.weaver.tools.DefaultTrace"/> + </stdout> + </ant> + </ajc-test> + + <ajc-test dir="tracing" title="Trace messages" keywords="tracing"> + <compile + files="HelloWorld.java" + /> + <compile + files="IncludedAspect.aj, ExcludedAspect.aj" + /> + <ant file="ant.xml" target="Trace messages" verbose="true"> + <stdout> + <line text="Hello World!"/> + </stdout> + <!-- + Always get info messages even without -verbose because output determined + by tracing infrastructure. + + Duplicate warning and error messages: first through trace then message + writer + --> + <stderr> + <line text="info AspectJ Weaver Version"/> + <line text="info register classloader"/> + <line text="info using configuration"/> + <line text="info register aspect IncludedAspect"/> + <line text="warning aspect ExcludedAspect exluded"/> + <line text="warning aspect ExcludedAspect exluded"/> + <line text="info define aspect IncludedMissingAspect"/> + <line text="error Cannot find parent aspect"/> + <line text="error Cannot find parent aspect"/> + <line text="error Concrete-aspect 'IncludedMissingAspect' could not be registered"/> + <line text="error Concrete-aspect 'IncludedMissingAspect' could not be registered"/> + <line text="warning failure(s) registering aspects. Disabling weaver for class loader"/> + <line text="warning failure(s) registering aspects. Disabling weaver for class loader"/> + </stderr> + </ant> + </ajc-test> + + <ajc-test dir="tracing" title="Trace everything" keywords="tracing"> + <compile + files="HelloWorld.java" + /> + <compile files="Aspect.aj" options="-outxml -1.4"/> + <ant file="ant.xml" target="Trace everything" verbose="true"> + <stdout> + <line text="Hello World!"/> + </stdout> + </ant> + </ajc-test> + + <ajc-test dir="tracing" title="JDK 1.4 tracing" keywords="tracing"> + <compile + files="HelloWorld.java" + /> + <compile files="Aspect.aj" options="-outxml -1.4"/> + <ant file="ant.xml" target="JDK 1.4 tracing" verbose="true"> + <stdout> + <line text="Hello World!"/> + </stdout> + </ant> + </ajc-test> + + <ajc-test dir="tracing" title="Tracing file System Property" keywords="tracing"> + <compile + files="HelloWorld.java" + /> + <compile files="Aspect.aj" options="-outxml -1.4"/> + <ant file="ant.xml" target="Tracing file System Property" verbose="true"> + <stdout> + <line text="Hello World!"/> + </stdout> + </ant> + </ajc-test> +</suite> diff --git a/tests/src/test/java/org/aspectj/systemtest/xlint/XLint5Tests.java b/tests/src/test/java/org/aspectj/systemtest/xlint/XLint5Tests.java new file mode 100644 index 000000000..35e5b05ca --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/xlint/XLint5Tests.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM + * 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: + * Matthew Webster Move Java 5 dependent tests + *******************************************************************************/ +package org.aspectj.systemtest.xlint; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class XLint5Tests extends XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(XLint5Tests.class); + } + + protected File getSpecFile() { + return getClassResource("xlint.xml"); + } + + public void testBug99136(){ + runTest("Two Xlint warnings wth cflow?"); + if(ajc.getLastCompilationResult().getWarningMessages().size() != 1){ + fail(); + } + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/xlint/XLintTests.java b/tests/src/test/java/org/aspectj/systemtest/xlint/XLintTests.java new file mode 100644 index 000000000..c5a2b7fdf --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/xlint/XLintTests.java @@ -0,0 +1,169 @@ +/* ******************************************************************* + * Copyright (c) 2004 IBM Corporation + * 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 + * + * ******************************************************************/ +package org.aspectj.systemtest.xlint; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.weaver.bcel.BcelShadow; + +public class XLintTests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(XLintTests.class); + } + + protected File getSpecFile() { + return getClassResource("xlint.xml"); + } + + + public void test001(){ + runTest("options -Xlint args()"); + } + + public void test002(){ + runTest("options declare field on bad type"); + } + + public void test003(){ + runTest("options declare method on bad type"); + } + + public void test004(){ + runTest("options -Xlint declare parent"); + } + + public void test005(){ + runTest("options -Xlint target()"); + } + + public void test006(){ + runTest("options -Xlint this()"); + } + + public void test007(){ + runTest("options negative -Xlint args()"); + } + + public void test008(){ + runTest("options negative -Xlint declare parent"); + } + + public void test009(){ + runTest("options negative -Xlint target()"); + } + + public void test010(){ + runTest("options negative -Xlint this()"); + } + + public void test011(){ + runTest("unmatched type name in a declare parents should result in a warning in -Xlint mode"); + } + + public void test012(){ + runTest("privileged access to code outside the control of the compiler"); + } + + public void test013(){ + runTest("Unexpected Xlint:unresolvableMember warning with withincode"); + } + + public void test014(){ + runTest("valid XLintWarningTest file, default level of warning"); + } + + public void test015(){ + runTest("XLint:ignore suppresses XLint warnings"); + } + + public void test016(){ + runTest("XLint:error promotes XLint warnings to error"); + } + + public void test017(){ + runTest("alias getCause for getWrappedThrowable in SoftException"); + } + +// public void test018(){ +// runTest("XLint warning for call PCD's using subtype of defining type"); +// } + + public void test019(){ + runTest("XLint warning for call PCD's using subtype of defining type (-1.3 -Xlint:ignore)"); + } + + + // the following five tests check various scenarios around the lazyTjp XLint message + public void test020(){ + runTest("no XLint warning: thisJoinPoint potentially lazy and nothing stopping it"); + assertTrue("Something prevented the lazytjp optimization from working??",BcelShadow.appliedLazyTjpOptimization); + } + + public void test021(){ + runTest("XLint warning: thisJoinPoint potentially lazy but stopped by around advice which doesn't use tjp"); + assertFalse("lazytjp optimization should have failed to be applied because of around advice at the jp", + BcelShadow.appliedLazyTjpOptimization); + } + + public void test022(){ + runTest("no XLint warning: thisJoinPoint not lazy (no if PCD) but would have been stopped anyway by around advice"); + assertFalse("lazytjp optimization should have failed to be applied because of around advice *and* before advice has no if() at the jp", + BcelShadow.appliedLazyTjpOptimization); + } + + public void test023(){ + runTest("no XLint warning: thisJoinPoint cannot be built lazily"); + assertFalse("lazytjp optimization should have failed to be applied because before advice has no if() at the jp", + BcelShadow.appliedLazyTjpOptimization); + } + + public void test024(){ + runTest("XLint warning: thisJoinPoint potentially lazy but stopped by around advice which uses tjp"); + assertFalse("lazytjp optimization should have failed to be applied because around advice uses tjp", + BcelShadow.appliedLazyTjpOptimization); + } + + public void test025(){ + runTest("check for xlazytjp warning if actually supplied"); + assertTrue("Something prevented the lazytjp optimization from working??",BcelShadow.appliedLazyTjpOptimization); + } + + public void test026(){ + runTest("lazytjp: warning when around advice uses tjp"); + } + + public void test027() { + runTest("lazytjp: warning when if missing on before advice"); + } + + public void test028() { + runTest("lazytjp: warning when if missing on after advice"); + } + + public void test029() { + runTest("lazytjp: multiple clashing advice preventing lazytjp"); + } + + public void test030() { + runTest("lazytjp: interfering before and around"); + } + + // FIXME asc put this back in ! +// public void test031() { +// if (is15VMOrGreater) +// runTest("7 lint warnings"); +// } + +} + diff --git a/tests/src/test/java/org/aspectj/systemtest/xlint/xlint-tests.xml b/tests/src/test/java/org/aspectj/systemtest/xlint/xlint-tests.xml new file mode 100644 index 000000000..4bbf23841 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/xlint/xlint-tests.xml @@ -0,0 +1,267 @@ +<!-- XLint Tests --> + + <!-- .................................... -Xlint tests --> + <!-- ............... positive -Xlint tests --> + + <ajc-test dir="bugs/lazyTjpXLintWarning" + title="no XLint warning: thisJoinPoint potentially lazy and nothing stopping it"> + <compile options="-Xlint:warning" files="Scenario1.aj"/> + </ajc-test> + + <ajc-test dir="bugs/lazyTjpXLintWarning" + title="XLint warning: thisJoinPoint potentially lazy but stopped by around advice which doesn't use tjp"> + <compile options="-Xlint:warning" files="Scenario2.aj"> + <message kind="warning" line="21" text="can not implement lazyTjp on this joinpoint method-execution(void Test.main(java.lang.String[])) because around advice is used [Xlint:canNotImplementLazyTjp]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/lazyTjpXLintWarning" + title="no XLint warning: thisJoinPoint not lazy (no if PCD) but would have been stopped anyway by around advice"> + <compile options="-Xlint:warning" files="Scenario3.aj"> + <message kind="warning" line="14" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard [Xlint:noGuardForLazyTjp]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/lazyTjpXLintWarning" title="no XLint warning: thisJoinPoint cannot be built lazily"> + <compile options="-Xlint:warning" files="Scenario4.aj"> + <message kind="warning" line="9" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/lazyTjpXLintWarning" + title="XLint warning: thisJoinPoint potentially lazy but stopped by around advice which uses tjp"> + <compile options="-Xlint:warning" files="Scenario5.aj"> + <message kind="warning" line="22" text="can not implement lazyTjp on this joinpoint method-execution(void Test.main(java.lang.String[])) because around advice is used [Xlint:canNotImplementLazyTjp]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/lazyTjpXLintWarning" + title="check for xlazytjp warning if actually supplied"> + <compile options="-XlazyTjp -Xlint:warning" files="Scenario1.aj"> + <message kind="warning" text="-XlazyTjp should no longer be used, build tjps lazily is now the default"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/lazyTjpXLintWarning" + title="lazytjp: warning when around advice uses tjp"> + <compile options="-Xlint:warning" files="LazyTjpTest1.java"> + <message kind="warning" line="4" text="can not implement lazyTjp on this joinpoint method-execution(void LazyTjpTest1.test2()) because around advice is used [Xlint:canNotImplementLazyTjp]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/lazyTjpXLintWarning" + title="lazytjp: warning when if missing on before advice"> + <compile options="-Xlint:warning" files="LazyTjpTest2.java"> + <message kind="warning" line="16" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/lazyTjpXLintWarning" + title="lazytjp: warning when if missing on after advice"> + <compile options="-Xlint:warning" files="LazyTjpTest3.java"> + <message kind="warning" line="17" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/lazyTjpXLintWarning" + title="lazytjp: multiple clashing advice preventing lazytjp"> + <compile options="-Xlint:warning" files="LazyTjpTest4.java"> + <message kind="warning" line="13" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard"/> + <message kind="warning" line="3" text="can not implement lazyTjp at joinpoint method-execution(void LazyTjpTest4.test1()) because of advice conflicts, see secondary locations to find conflicting advice"/> + <message kind="warning" line="17" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/lazyTjpXLintWarning" + title="lazytjp: interfering before and around"> + <compile options="-Xlint:warning" files="LazyTjpTest5.java"> + <message kind="warning" line="3" text="can not implement lazyTjp at joinpoint method-execution(void LazyTjpTest5.test1()) because of advice conflicts, see secondary locations to find conflicting advice"/> + <message kind="warning" line="13" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard"/> + </compile> + </ajc-test> + + <ajc-test dir="options" + title="options -Xlint args()" + keywords="lint"> + <compile files="XLintTypeArgsPCD.java"> + <message kind="warning" line="10"/> + </compile> + </ajc-test> + + <ajc-test dir="options" + title="options declare field on bad type"> + <compile files="XLintTypeDeclareField.java" options="!eclipse"> + <message kind="error" line="10"/> + </compile> + </ajc-test> + + <ajc-test dir="options" + title="options declare method on bad type"> + <compile files="XLintTypeDeclareMethod.java" options="!eclipse"> + <message kind="error" line="10"/> + </compile> + </ajc-test> + + <ajc-test dir="options" + title="options -Xlint declare parent" + keywords="lint"> + <compile files="XLintTypeDeclareParent.java"> + <message kind="warning" line="10"/> + </compile> + </ajc-test> + + <ajc-test dir="options" + title="options -Xlint target()" + keywords="lint"> + <compile files="XLintTypeTargetPCD.java"> + <message kind="warning" line="10"/> + </compile> + </ajc-test> + + <ajc-test dir="options" + title="options -Xlint this()" + keywords="lint"> + <compile files="XLintTypeThisPCD.java"> + <message kind="warning" line="10"/> + </compile> + </ajc-test> + + <!-- ............... negative -Xlint tests --> + <ajc-test dir="options" + title="options negative -Xlint args()" + keywords="lint"> + <compile files="XLintTypeArgsPCD.java" options="-Xlint:ignore"/> + </ajc-test> + + <ajc-test dir="options" + title="options negative -Xlint declare parent" + keywords="lint"> + <compile files="XLintTypeDeclareParent.java" options="-Xlint:ignore"/> + </ajc-test> + + <ajc-test dir="options" + title="options negative -Xlint target()" + keywords="lint"> + <compile files="XLintTypeTargetPCD.java" options="-Xlint:ignore"/> + </ajc-test> + + <ajc-test dir="options" + title="options negative -Xlint this()" + keywords="lint"> + <compile files="XLintTypeThisPCD.java" options="-Xlint:ignore"/> + </ajc-test> + + + <ajc-test dir="new" + title="unmatched type name in a declare parents should result in a warning in -Xlint mode" + keywords="tofix"> + <compile options="-Xlint" files="MissingTypeInDeclareParents.java"> + <message kind="warning" line="20"/> + </compile> + <run class="MissingTypeInDeclareParents"/> + </ajc-test> + + + <!-- The correct behavior of this program is to produce an Xlint + warning for the lack of access to the needed type, and then + to generate code with link errors that will throw a NoSuchMethodError + when run. + --> + <ajc-test dir="bugs" pr="906" + title="privileged access to code outside the control of the compiler"> + <compile files="PrivilegeBeyondScope.java" options="-Xlint:warning"> + <message kind="warning" line="23"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="37739" + title="Unexpected Xlint:unresolvableMember warning with withincode"> + <compile files="CatchSig.java"> + </compile> + <run class="CatchSig"/> + </ajc-test> + + + <ajc-test dir="harness" + title="valid XLintWarningTest file, default level of warning"> + <compile files="XLintWarningTest.java" options="-1.4"> + <message kind="warning" line="5" + text="Xlint:invalidAbsoluteTypeName"/> + </compile> + </ajc-test> + + <ajc-test dir="harness" + title="XLint:ignore suppresses XLint warnings"> + <compile files="XLintWarningTest.java" options="-Xlint:ignore"/> + </ajc-test> + + <ajc-test dir="harness" + title="XLint:error promotes XLint warnings to error"> + <compile files="XLintWarningTest.java" options="-Xlint:error"> + <message kind="error" line="5" + text="Xlint:invalidAbsoluteTypeName"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs" pr="49250" + title="alias getCause for getWrappedThrowable in SoftException"> + <compile files="GetCauseOnSoftException.java" options="-Xlint:warning"> + </compile> + <run vm="1.3" class="GetCauseOnSoftException"/> + </ajc-test> + + <ajc-test dir="bugs" + title="XLint warning for call PCD's using subtype of defining type" + pr="41952" + > + <compile + files="DeclaringTypeWarning.java" + options="-1.3" > + <message kind="warning" line="6" text="declaring type"> + <source line="12" file="DeclaringTypeWarning.java" /> + </message> + <message kind="warning" line="6" text="declaring type"> + <source line="14" file="DeclaringTypeWarning.java" /> + </message> + </compile> + </ajc-test> + + <ajc-test dir="bugs" + title="XLint warning for call PCD's using subtype of defining type (-1.3 -Xlint:ignore)" + pr="41952" + > + <compile + options="-Xlint:ignore,-1.3" + files="DeclaringTypeWarning.java" > + </compile> + </ajc-test> + +<!-- + <ajc-test dir="bugs/seven/lint" title="7 lint warnings" pr="91719"> + <compile options="-1.5" files="Main.java"> + <message kind="warning" line="31" text="no match for this type name: java.xxx.Object [Xlint:invalidAbsoluteTypeName]"> + </message> + <message kind="warning" line="34" text="no match for this type name: java.lang.Xxx [Xlint:invalidAbsoluteTypeName]"> + </message> + <message kind="warning" line="41" text="no match for this type name: java.lang.Xxx [Xlint:invalidAbsoluteTypeName]"> + </message> + <message kind="warning" line="69" text="this affected type is not exposed to the weaver: java.lang.Object [Xlint:typeNotExposedToWeaver]"> + </message> + <message kind="warning" line="87" text="does not match because declaring type is java.lang.Object, if match desired use target(Car) [Xlint:unmatchedSuperTypeInCall]"> + </message> + <message kind="warning" line="92" text="advice defined in XlintTest has not been applied [Xlint:adviceDidNotMatch]"> + </message> + <message kind="warning" line="157" text="no interface constructor-execution join point - use java.util.List+ for implementing classes [Xlint:noInterfaceCtorJoinpoint]"> + </message> + </compile> + </ajc-test> +--> + + <ajc-test dir="harness" + title="Two Xlint warnings wth cflow?"> + <compile files="XLintcflow.java" options="-1.5"> + <message kind="warning" line="4" text="advice defined in A has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + </ajc-test> + +
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/systemtest/xlint/xlint.xml b/tests/src/test/java/org/aspectj/systemtest/xlint/xlint.xml new file mode 100644 index 000000000..efe2a0014 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/xlint/xlint.xml @@ -0,0 +1,10 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[ +<!ENTITY tests SYSTEM "../tests/src/org/aspectj/systemtest/xlint/xlint-tests.xml"> +]> +<!-- XLint Tests --> + +<suite> + +&tests; + +</suite>
\ No newline at end of file diff --git a/tests/src/test/java/org/aspectj/testing/Harness.java b/tests/src/test/java/org/aspectj/testing/Harness.java new file mode 100644 index 000000000..e21f924f1 --- /dev/null +++ b/tests/src/test/java/org/aspectj/testing/Harness.java @@ -0,0 +1,39 @@ +/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * This file is part of the compiler and core tools for the AspectJ(tm) + * programming language; see http://aspectj.org + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is AspectJ. + * + * The Initial Developer of the Original Code is Xerox Corporation. Portions + * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation. + * All Rights Reserved. + * + * Contributor(s): + */ +package org.aspectj.testing; + +/** + * @see org.aspectj.testing.drivers.Harness + */ +public class Harness { + + private Harness() {} + + /** + * @see org.aspectj.testing.drivers.Harness#main(String[]) + */ + public static void main(String[] args) throws Exception { + org.aspectj.testing.drivers.Harness.main(args); + } +} diff --git a/tests/src/test/java/org/aspectj/testing/Utils.java b/tests/src/test/java/org/aspectj/testing/Utils.java new file mode 100644 index 000000000..92e0ed833 --- /dev/null +++ b/tests/src/test/java/org/aspectj/testing/Utils.java @@ -0,0 +1,83 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM + * 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.testing; + +import java.io.File; + +import org.aspectj.apache.bcel.Repository; +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Method; +import org.aspectj.apache.bcel.util.ClassPath; +import org.aspectj.apache.bcel.util.SyntheticRepository; +import org.aspectj.apache.bcel.verifier.VerificationResult; +import org.aspectj.apache.bcel.verifier.Verifier; +import org.aspectj.apache.bcel.verifier.VerifierFactory; +import org.aspectj.tools.ajc.Ajc; + +/** + * Not quite the right place for this class.. + */ +public class Utils { + + private final static boolean debugVerification=false; + + /** + * Performs verification of a class - the supplied class is expected to exist in the sandbox + * directory so typically this is called after a small compile step has been invoked to build it. + * @param ajc + */ + public static String verifyClass(Ajc ajc, String clazzname) { + JavaClass jc = null; + try { + jc = getClassFrom(ajc.getSandboxDirectory().getAbsolutePath(),clazzname); + } catch (ClassNotFoundException cnfe) { + return "Could not find "+clazzname+" in the sandbox: "+ajc.getSandboxDirectory(); + } + if (jc==null) return "Could not find class "+clazzname; + Repository.setRepository(jc.getRepository()); + Verifier v = VerifierFactory.getVerifier("mypackage.MyAspect"); + VerificationResult vr = v.doPass1(); + if (debugVerification) System.err.println(vr); + + if (vr.getStatus()!=VerificationResult.VERIFIED_OK) + return "Verification not ok: "+vr; + vr = v.doPass2(); + if (debugVerification) System.err.println(vr); + if (vr.getStatus()!=VerificationResult.VERIFIED_OK) + return "Verification not ok: "+vr; + Method[] ms = jc.getMethods(); + for (int i = 0; i < ms.length; i++) { + if (debugVerification) System.err.println("Pass3a for "+ms[i]); + vr = v.doPass3a(i); + if (debugVerification) System.err.println(vr); + if (vr.getStatus()!=VerificationResult.VERIFIED_OK) + return "Verification not ok: "+vr; + if (debugVerification) System.err.println("Pass3b for "+ms[i]); + vr = v.doPass3b(i); + if (debugVerification) System.err.println(vr); + if (vr.getStatus()!=VerificationResult.VERIFIED_OK) + return "Verification not ok: "+vr; + } + return null; + } + + public static JavaClass getClassFrom(String frompath,String clazzname) throws ClassNotFoundException { + SyntheticRepository repos = createRepos(frompath); + return repos.loadClass(clazzname); + } + + public static SyntheticRepository createRepos(String cpentry) { + ClassPath cp = new ClassPath( + cpentry+File.pathSeparator+ + System.getProperty("java.class.path")); + return SyntheticRepository.getInstance(cp); + } +} diff --git a/tests/src/test/java/org/aspectj/tests/TestsModuleTests.java b/tests/src/test/java/org/aspectj/tests/TestsModuleTests.java new file mode 100644 index 000000000..672a95299 --- /dev/null +++ b/tests/src/test/java/org/aspectj/tests/TestsModuleTests.java @@ -0,0 +1,51 @@ +package org.aspectj.tests; + +/* ******************************************************************* + * Copyright (c) 2005 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wes Isberg initial implementation + * ******************************************************************/ + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.aspectj.systemtest.AllTests; +import org.aspectj.systemtest.AllTests14; +import org.aspectj.systemtest.AllTests17; +import org.aspectj.systemtest.AllTests18; +import org.aspectj.systemtest.AllTests19; +import org.aspectj.util.LangUtil; + +public class TestsModuleTests extends TestCase { + + public static Test suite() { + String name = TestsModuleTests.class.getName(); + TestSuite suite = new TestSuite(name); + // compiler tests, wrapped for JUnit + if (LangUtil.is19VMOrGreater()) { + suite.addTest(AllTests19.suite()); + } else if (LangUtil.is18VMOrGreater()) { + suite.addTest(AllTests18.suite()); + } else if (LangUtil.is15VMOrGreater()) { + // suite.addTest(AllTests15.suite()); + suite.addTest(AllTests17.suite()); // there are currently (28/11/06) no tests specific to a 1.6/1.7 vm - so we can do + // this + } else if (LangUtil.is14VMOrGreater()) { + System.err.println("Skipping tests for 1.5"); + // suite.addTest(TestUtil.skipTest("for 1.5")); + suite.addTest(AllTests14.suite()); + } else { + System.err.println("Skipping tests for 1.4 and 1.5"); + // suite.addTest(TestUtil.skipTest("for 1.4 and 1.5")); + suite.addTest(AllTests.suite()); + } + return suite; + } +} |