Now, the location more closely resembles where it is on the website. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>tags/V1_9_21_1
For users of JDK 1.4 the bin directory of your AspectJ distribution | |||||
contains a script "aj" to perform load-time weaving. Java classes on | |||||
the CLASSPATH are loaded and woven with aspects also on the CLASSPATH | |||||
which are declared in an aop.xml file. This file is either created by | |||||
the user or generated by the compiler. Alternatively aspects can be | |||||
loaded from an explicitly defined ASPECTPATH. | |||||
For users of JDK 1.5 the bin directory of your AspectJ distribution | |||||
contains a script "aj5" to perform load-time weaving using an agent. | |||||
This uses an aop.xml as described above. | |||||
--To compile the HelloWorld program-- | |||||
ajc -outjar hello.jar HelloWorld.java | |||||
--To compile the Tracing aspect-- | |||||
ajc -outjar tracing.jar -outxml Tracing.aj | |||||
--To run the example-- | |||||
set CLASSPATH to include hello.jar | |||||
aj HelloWorld | |||||
--To run the example with tracing-- | |||||
set CLASSPATH to include "tracing.jar" | |||||
aj HelloWorld | |||||
--To run the example with tracing using ASPECTPATH-- | |||||
set ASPECTPATH=tracing.jar | |||||
aj HelloWorld | |||||
--To run the example with tracing using an agent-- | |||||
aj5 HelloWorld | |||||
For users of JDK 1.4 the bin directory of your AspectJ distribution | |||||
contains a script "aj" to perform load-time weaving. Java classes on | |||||
the CLASSPATH are loaded and woven with aspects also on the CLASSPATH | |||||
which are declared in an aop.xml file. This file is either created by | |||||
the user or generated by the compiler. Alternatively aspects can be | |||||
loaded from an explicitly defined ASPECTPATH. | |||||
For users of JDK 1.5 the bin directory of your AspectJ distribution | |||||
contains a script "aj5" to perform load-time weaving using an agent. | |||||
This uses an aop.xml as described above. | |||||
--To compile the HelloWorld program-- | |||||
ajc -outjar hello.jar HelloWorld.java | |||||
--To compile the Tracing aspect-- | |||||
ajc -outjar tracing.jar -outxml Tracing.aj | |||||
--To run the example-- | |||||
set CLASSPATH to include hello.jar | |||||
aj HelloWorld | |||||
--To run the example with tracing-- | |||||
set CLASSPATH to include "tracing.jar" | |||||
aj HelloWorld | |||||
--To run the example with tracing using ASPECTPATH-- | |||||
set ASPECTPATH=tracing.jar | |||||
aj HelloWorld | |||||
--To run the example with tracing using an agent-- | |||||
aj5 HelloWorld | |||||
SHELL=bash | |||||
ACJOPTS=-verbose -nosymbols | |||||
AJC=ajc | |||||
.PHONY: demo debug | |||||
demo: | |||||
$(AJC) $(ACJOPTS) @demo.lst | |||||
debug: | |||||
$(AJC) $(ACJOPTS) @debug.lst | |||||
SHELL=bash | |||||
ACJOPTS=-verbose -nosymbols | |||||
AJC=ajc | |||||
.PHONY: demo debug | |||||
demo: | |||||
$(AJC) $(ACJOPTS) @demo.lst | |||||
debug: | |||||
$(AJC) $(ACJOPTS) @debug.lst | |||||
This directory contains several examples of tracing aspects, | |||||
including a reusable tracing library and examples of | |||||
using that library. | |||||
A lesson in the AspectJ Primer explains all of this code. | |||||
To work with these (or any other examples), first be sure .../examples | |||||
is on your classpath, where ... is where you have installed AspectJ. | |||||
--To compile and run the example without tracing-- | |||||
ajc @.../examples/tracing/notrace.lst | |||||
java tracing.ExampleMain | |||||
--To compile and run the example with tracing version<N>-- | |||||
ajc @.../examples/tracing/tracev<N>.lst | |||||
java tracing.version<N>.TraceMyClasses | |||||
where <N> is 1, 2, 3 or 4 | |||||
--To use the tracing.lib.AbstractTrace aspect-- | |||||
Make sure .../examples is in your classpath. | |||||
In order to use this aspect, please read the documentation under | |||||
tracing/doc | |||||
This directory contains several examples of tracing aspects, | |||||
including a reusable tracing library and examples of | |||||
using that library. | |||||
A lesson in the AspectJ Primer explains all of this code. | |||||
To work with these (or any other examples), first be sure .../examples | |||||
is on your classpath, where ... is where you have installed AspectJ. | |||||
--To compile and run the example without tracing-- | |||||
ajc @.../examples/tracing/notrace.lst | |||||
java tracing.ExampleMain | |||||
--To compile and run the example with tracing version<N>-- | |||||
ajc @.../examples/tracing/tracev<N>.lst | |||||
java tracing.version<N>.TraceMyClasses | |||||
where <N> is 1, 2, 3 or 4 | |||||
--To use the tracing.lib.AbstractTrace aspect-- | |||||
Make sure .../examples is in your classpath. | |||||
In order to use this aspect, please read the documentation under | |||||
tracing/doc |
xref:progguide/index.adoc[programming], | xref:progguide/index.adoc[programming], | ||||
xref:devguide/index.adoc[development] and | xref:devguide/index.adoc[development] and | ||||
xref:pdguide/index.adoc[problem diagnosis] guides, | xref:pdguide/index.adoc[problem diagnosis] guides, | ||||
link:runtime-api/index.html[API] and link:https://github.com/eclipse-aspectj/aspectj/tree/master/docs/dist/doc/examples[example code]. | |||||
link:runtime-api/index.html[API] and link:https://github.com/eclipse-aspectj/aspectj/tree/master/docs/examples[example code]. | |||||
|xref:#distributions[Distributions] | |xref:#distributions[Distributions] | ||||
|https://eclipse.org/aspectj[AspectJ]; development environment support | |https://eclipse.org/aspectj[AspectJ]; development environment support | ||||
|xref:dist/doc/changes.adoc[Changes] |Changes between historical releases up to 1.6.0. | |xref:dist/doc/changes.adoc[Changes] |Changes between historical releases up to 1.6.0. | ||||
|link:https://github.com/eclipse-aspectj/aspectj/tree/master/docs/dist/doc/examples[Examples] |AspectJ code to demonstrate some language | |||||
|link:https://github.com/eclipse-aspectj/aspectj/tree/master/docs/examples[Examples] |AspectJ code to demonstrate some language | |||||
features and implement JavaBean properties, the Observer pattern, a | features and implement JavaBean properties, the Observer pattern, a | ||||
tracing library, and a game application where aspects handle display | tracing library, and a game application where aspects handle display | ||||
updating. | updating. | ||||
xref:progguide/semantics.adoc[Semantics appendix] nearby as the best | xref:progguide/semantics.adoc[Semantics appendix] nearby as the best | ||||
reference for AspectJ usage. Focus initially on the join point model and | reference for AspectJ usage. Focus initially on the join point model and | ||||
pointcuts, concepts AOP adds to OOP. To read about how the | pointcuts, concepts AOP adds to OOP. To read about how the | ||||
link:https://github.com/eclipse-aspectj/aspectj/tree/master/docs/dist/doc/examples[examples] work, see the | |||||
link:https://github.com/eclipse-aspectj/aspectj/tree/master/docs/examples[examples] work, see the | |||||
xref:progguide/examples.adoc[Examples] section in the | xref:progguide/examples.adoc[Examples] section in the | ||||
xref:progguide/index.adoc[Programming Guide]. View and navigate the | xref:progguide/index.adoc[Programming Guide]. View and navigate the | ||||
crosscutting structure using https://eclipse.org/ajdt[AJDT]. | crosscutting structure using https://eclipse.org/ajdt[AJDT]. |
TestUtil.runMain("out;../lib/test/testing-client.jar", "org.schmidmeier.unittests.cache.AllTimeCacheTests"); | TestUtil.runMain("out;../lib/test/testing-client.jar", "org.schmidmeier.unittests.cache.AllTimeCacheTests"); | ||||
} | } | ||||
private static String examplesDir = "../docs/dist/doc/examples/"; | |||||
private static String examplesDir = "../docs/examples/"; | |||||
private static void example(String[] argfiles, String[] classes) { | private static void example(String[] argfiles, String[] classes) { | ||||
List args = new ArrayList(); | List args = new ArrayList(); | ||||
args.add("-verbose"); | args.add("-verbose"); |
} | } | ||||
void setupTracingJava(Javac javac) { // XXX assumes module dir, doc loc | void setupTracingJava(Javac javac) { // XXX assumes module dir, doc loc | ||||
String exDir = "../docs/dist/doc/examples"; | |||||
String exDir = "../docs/examples"; | |||||
javac.setSrcdir(new Path(javac.getProject(), exDir)); | javac.setSrcdir(new Path(javac.getProject(), exDir)); | ||||
javac.setIncludes("tracing/*.java"); // XXX assumes tracing example | javac.setIncludes("tracing/*.java"); // XXX assumes tracing example | ||||
} | } |
<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"> | <!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"> | ||||
<!-- | |||||
<!-- | |||||
Test documentation examples. | Test documentation examples. | ||||
Results unverified except for compiler messages, | |||||
Results unverified except for compiler messages, | |||||
runtime exceptions, System.exit codes, and System.err | runtime exceptions, System.exit codes, and System.err | ||||
messages (the latter not for all tests). | messages (the latter not for all tests). | ||||
To run the example classes using a forked 1.1 vm: | To run the example classes using a forked 1.1 vm: | ||||
java -Djavarun.fork=true \ | java -Djavarun.fork=true \ | ||||
-Djavarun.java.home=d:\\jdk11 \ | -Djavarun.java.home=d:\\jdk11 \ | ||||
-Djavarun.java=d:\\jdk11\\bin\\javaw \ | -Djavarun.java=d:\\jdk11\\bin\\javaw \ | ||||
-jar ../aj-build/jars/testing-drivers-all.jar \ | -jar ../aj-build/jars/testing-drivers-all.jar \ | ||||
ajcTestsExamples.xml \ | ajcTestsExamples.xml \ | ||||
-ajctestSkipKeywords=knownLimitation-run11 \ | -ajctestSkipKeywords=knownLimitation-run11 \ | ||||
-logFail | |||||
-logFail | |||||
--> | --> | ||||
<suite> | <suite> | ||||
<ajc-test dir="../docs/dist/doc/examples" | |||||
<ajc-test dir="../docs/examples" | |||||
keywords="doc-examples" | keywords="doc-examples" | ||||
title="bean example"> | title="bean example"> | ||||
<compile argfiles="bean/files.lst"/> | <compile argfiles="bean/files.lst"/> | ||||
<run class="bean.Demo" | <run class="bean.Demo" | ||||
errStreamIsError="false"/> | errStreamIsError="false"/> | ||||
<!-- ??: error security properties not found. using defaults. --> | <!-- ??: error security properties not found. using defaults. --> | ||||
</ajc-test> | |||||
</ajc-test> | |||||
<ajc-test dir="../docs/dist/doc/examples" | |||||
<ajc-test dir="../docs/examples" | |||||
keywords="doc-examples,knownLimitation-run11" | keywords="doc-examples,knownLimitation-run11" | ||||
title="introduction"> | title="introduction"> | ||||
<compile argfiles="introduction/files.lst"/> | <compile argfiles="introduction/files.lst"/> | ||||
<run vm="1.2" class="introduction.CloneablePoint"/> | <run vm="1.2" class="introduction.CloneablePoint"/> | ||||
<run vm="1.2" class="introduction.ComparablePoint"/> | <run vm="1.2" class="introduction.ComparablePoint"/> | ||||
<run vm="1.2" class="introduction.HashablePoint"/> | <run vm="1.2" class="introduction.HashablePoint"/> | ||||
</ajc-test> | |||||
</ajc-test> | |||||
<ajc-test dir="../docs/dist/doc/examples" | |||||
<ajc-test dir="../docs/examples" | |||||
keywords="doc-examples" | keywords="doc-examples" | ||||
title="observer example"> | title="observer example"> | ||||
<compile argfiles="observer/files.lst"/> | <compile argfiles="observer/files.lst"/> | ||||
<!-- GUI run class="observer.Demo"/ --> | <!-- GUI run class="observer.Demo"/ --> | ||||
</ajc-test> | |||||
</ajc-test> | |||||
<ajc-test dir="../docs/dist/doc/examples" | |||||
<ajc-test dir="../docs/examples" | |||||
keywords="doc-examples" | keywords="doc-examples" | ||||
title="spacewar example"> | title="spacewar example"> | ||||
<compile argfiles="spacewar/debug.lst"/> | <compile argfiles="spacewar/debug.lst"/> | ||||
<compile argfiles="spacewar/demo.lst"/> | <compile argfiles="spacewar/demo.lst"/> | ||||
<!-- GUI run class="spacewar.Game"/ --> | <!-- GUI run class="spacewar.Game"/ --> | ||||
</ajc-test> | |||||
</ajc-test> | |||||
<!-- | <!-- | ||||
TODO: change 1.2 API's in telecom to 1.1: | TODO: change 1.2 API's in telecom to 1.1: | ||||
(Vector.[add|remove](..) to [add|remove]Element(..)) | (Vector.[add|remove](..) to [add|remove]Element(..)) | ||||
then remove the knownLimitation-run11 keywords | then remove the knownLimitation-run11 keywords | ||||
--> | |||||
<ajc-test dir="../docs/dist/doc/examples" | |||||
--> | |||||
<ajc-test dir="../docs/examples" | |||||
keywords="doc-examples,knownLimitation-run11" | keywords="doc-examples,knownLimitation-run11" | ||||
title="telecom basic example"> | title="telecom basic example"> | ||||
<compile argfiles="telecom/basic.lst"/> | <compile argfiles="telecom/basic.lst"/> | ||||
<run class="telecom.BasicSimulation"/> | <run class="telecom.BasicSimulation"/> | ||||
</ajc-test> | |||||
</ajc-test> | |||||
<ajc-test dir="../docs/dist/doc/examples" | |||||
<ajc-test dir="../docs/examples" | |||||
keywords="doc-examples,knownLimitation-run11" | keywords="doc-examples,knownLimitation-run11" | ||||
title="telecom billing example"> | title="telecom billing example"> | ||||
<compile argfiles="telecom/billing.lst"/> | <compile argfiles="telecom/billing.lst"/> | ||||
<run class="telecom.BillingSimulation"/> | <run class="telecom.BillingSimulation"/> | ||||
</ajc-test> | |||||
</ajc-test> | |||||
<ajc-test dir="../docs/dist/doc/examples" | |||||
<ajc-test dir="../docs/examples" | |||||
keywords="doc-examples,knownLimitation-run11" | keywords="doc-examples,knownLimitation-run11" | ||||
title="telecom timing example"> | title="telecom timing example"> | ||||
<compile argfiles="telecom/timing.lst"/> | <compile argfiles="telecom/timing.lst"/> | ||||
<run class="telecom.TimingSimulation"/> | <run class="telecom.TimingSimulation"/> | ||||
</ajc-test> | |||||
</ajc-test> | |||||
<ajc-test dir="../docs/dist/doc/examples" | |||||
<ajc-test dir="../docs/examples" | |||||
keywords="doc-examples" | keywords="doc-examples" | ||||
title="thisJoinPoint example"> | title="thisJoinPoint example"> | ||||
<compile argfiles="tjp/files.lst"/> | <compile argfiles="tjp/files.lst"/> | ||||
<run class="tjp.Demo"/> | <run class="tjp.Demo"/> | ||||
</ajc-test> | |||||
</ajc-test> | |||||
<ajc-test dir="../docs/dist/doc/examples" | |||||
<ajc-test dir="../docs/examples" | |||||
keywords="doc-examples" | keywords="doc-examples" | ||||
title="tracing example - none"> | title="tracing example - none"> | ||||
<compile argfiles="tracing/notrace.lst"/> | <compile argfiles="tracing/notrace.lst"/> | ||||
<run class="tracing.ExampleMain"/> | <run class="tracing.ExampleMain"/> | ||||
</ajc-test> | |||||
</ajc-test> | |||||
<ajc-test dir="../docs/dist/doc/examples" | |||||
<ajc-test dir="../docs/examples" | |||||
keywords="doc-examples" | keywords="doc-examples" | ||||
title="tracing example - version 1"> | title="tracing example - version 1"> | ||||
<compile argfiles="tracing/tracev1.lst"/> | <compile argfiles="tracing/tracev1.lst"/> | ||||
<run class="tracing.version1.TraceMyClasses" | <run class="tracing.version1.TraceMyClasses" | ||||
errStreamIsError="false"/> | errStreamIsError="false"/> | ||||
</ajc-test> | |||||
</ajc-test> | |||||
<ajc-test dir="../docs/dist/doc/examples" | |||||
<ajc-test dir="../docs/examples" | |||||
keywords="doc-examples" | keywords="doc-examples" | ||||
title="tracing example - version 2"> | title="tracing example - version 2"> | ||||
<compile argfiles="tracing/tracev2.lst"/> | <compile argfiles="tracing/tracev2.lst"/> | ||||
<run class="tracing.version2.TraceMyClasses" | <run class="tracing.version2.TraceMyClasses" | ||||
errStreamIsError="false"/> | errStreamIsError="false"/> | ||||
</ajc-test> | |||||
</ajc-test> | |||||
<ajc-test dir="../docs/dist/doc/examples" | |||||
<ajc-test dir="../docs/examples" | |||||
keywords="doc-examples" | keywords="doc-examples" | ||||
title="tracing example - version 3"> | title="tracing example - version 3"> | ||||
<compile argfiles="tracing/tracev3.lst"/> | <compile argfiles="tracing/tracev3.lst"/> | ||||
<run class="tracing.version3.TraceMyClasses" | <run class="tracing.version3.TraceMyClasses" | ||||
errStreamIsError="false"/> | errStreamIsError="false"/> | ||||
</ajc-test> | |||||
</ajc-test> | |||||
</suite> | </suite> |
<!-- end of atOverride tests with ITDs --> | <!-- end of atOverride tests with ITDs --> | ||||
<ajc-test dir="../docs/dist/doc/examples/introduction" title="introduction sample" vm="1.5"> | |||||
<ajc-test dir="../docs/examples/introduction" title="introduction sample" vm="1.5"> | |||||
<compile files="CloneablePoint.java,ComparablePoint.java,HashablePoint.java,Point.java" options="-1.5 -Xlint:ignore"/> | <compile files="CloneablePoint.java,ComparablePoint.java,HashablePoint.java,Point.java" options="-1.5 -Xlint:ignore"/> | ||||
</ajc-test> | </ajc-test> | ||||
<!-- end of atOverride tests with ITDs --> | <!-- end of atOverride tests with ITDs --> | ||||
<ajc-test dir="../docs/dist/doc/examples/introduction" title="introduction sample" vm="1.5"> | |||||
<ajc-test dir="../docs/examples/introduction" title="introduction sample" vm="1.5"> | |||||
<compile files="CloneablePoint.java,ComparablePoint.java,HashablePoint.java,Point.java" options="-1.9 -Xlint:ignore"/> | <compile files="CloneablePoint.java,ComparablePoint.java,HashablePoint.java,Point.java" options="-1.9 -Xlint:ignore"/> | ||||
</ajc-test> | </ajc-test> | ||||
location="${aj.otherSystems.dir}/examples"/> | location="${aj.otherSystems.dir}/examples"/> | ||||
<mkdir dir="${aj.tempExamples.dir}"/> | <mkdir dir="${aj.tempExamples.dir}"/> | ||||
<copy todir="${aj.tempExamples.dir}"> | <copy todir="${aj.tempExamples.dir}"> | ||||
<fileset dir="../docs/dist/doc/examples"/> | |||||
<fileset dir="../docs/examples"/> | |||||
</copy> | </copy> | ||||
<!-- copy to temp.examples.dir --> | <!-- copy to temp.examples.dir --> | ||||
<ajctest testId="examples" | <ajctest testId="examples" |