<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.opentaps.org/docs/index.php?action=history&amp;feed=atom&amp;title=Understanding_AspectJ</id>
	<title>Understanding AspectJ - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://docs.opentaps.org/docs/index.php?action=history&amp;feed=atom&amp;title=Understanding_AspectJ"/>
	<link rel="alternate" type="text/html" href="https://docs.opentaps.org/docs/index.php?title=Understanding_AspectJ&amp;action=history"/>
	<updated>2026-05-15T17:07:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.32.1</generator>
	<entry>
		<id>https://docs.opentaps.org/docs/index.php?title=Understanding_AspectJ&amp;diff=4080&amp;oldid=prev</id>
		<title>Sichen at 00:52, 21 July 2009</title>
		<link rel="alternate" type="text/html" href="https://docs.opentaps.org/docs/index.php?title=Understanding_AspectJ&amp;diff=4080&amp;oldid=prev"/>
		<updated>2009-07-21T00:52:59Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 00:52, 21 July 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;'''IMPORTANT&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;''' &lt;/del&gt; In newer versions of opentaps, aspectWerkz  has replaced aspectJ.  See [[Aspect Oriented programming and opentaps]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;'''IMPORTANT  In newer versions of opentaps, aspectWerkz  has replaced aspectJ.  See [[Aspect Oriented programming and opentaps]]&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Some theory:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Some theory:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sichen</name></author>
		
	</entry>
	<entry>
		<id>https://docs.opentaps.org/docs/index.php?title=Understanding_AspectJ&amp;diff=4079&amp;oldid=prev</id>
		<title>Sichen at 00:52, 21 July 2009</title>
		<link rel="alternate" type="text/html" href="https://docs.opentaps.org/docs/index.php?title=Understanding_AspectJ&amp;diff=4079&amp;oldid=prev"/>
		<updated>2009-07-21T00:52:33Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 00:52, 21 July 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''IMPORTANT'''  In newer versions of opentaps, aspectWerkz  has replaced aspectJ.  See [[Aspect Oriented programming and opentaps]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Some theory:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Some theory:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sichen</name></author>
		
	</entry>
	<entry>
		<id>https://docs.opentaps.org/docs/index.php?title=Understanding_AspectJ&amp;diff=4077&amp;oldid=prev</id>
		<title>Sichen: Protected &quot;Understanding AspectJ&quot;: Sysop page [edit=sysop:move=sysop]</title>
		<link rel="alternate" type="text/html" href="https://docs.opentaps.org/docs/index.php?title=Understanding_AspectJ&amp;diff=4077&amp;oldid=prev"/>
		<updated>2009-07-21T00:50:34Z</updated>

		<summary type="html">&lt;p&gt;Protected &amp;quot;&lt;a href=&quot;/docs/index.php?title=Understanding_AspectJ&quot; title=&quot;Understanding AspectJ&quot;&gt;Understanding AspectJ&lt;/a&gt;&amp;quot;: Sysop page [edit=sysop:move=sysop]&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 00:50, 21 July 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Sichen</name></author>
		
	</entry>
	<entry>
		<id>https://docs.opentaps.org/docs/index.php?title=Understanding_AspectJ&amp;diff=4076&amp;oldid=prev</id>
		<title>Sichen: New page: * Some theory:  First you have to create a file with your aspect. We are not talking anymore about class, but aspect. Actually, it use a specific compiler. (Compiler errors message are not...</title>
		<link rel="alternate" type="text/html" href="https://docs.opentaps.org/docs/index.php?title=Understanding_AspectJ&amp;diff=4076&amp;oldid=prev"/>
		<updated>2009-07-21T00:50:31Z</updated>

		<summary type="html">&lt;p&gt;New page: * Some theory:  First you have to create a file with your aspect. We are not talking anymore about class, but aspect. Actually, it use a specific compiler. (Compiler errors message are not...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;* Some theory:&lt;br /&gt;
&lt;br /&gt;
First you have to create a file with your aspect. We are not talking anymore about class, but aspect. Actually, it use a specific compiler. (Compiler errors message are not really understandable in my mind... You can activate the options verbose and showWaveInfo to have some more info.)&lt;br /&gt;
&lt;br /&gt;
AOP is a way to add code to several points of the project, based on&lt;br /&gt;
method selections or pointcut.&lt;br /&gt;
&lt;br /&gt;
Creation of a poincut:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pointcut testRunContainerStart() : execution(public boolean org.ofbiz.testtools.TestRunContainer.start());&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can use wildcard:&lt;br /&gt;
'''*, +, ..'''&lt;br /&gt;
&lt;br /&gt;
'''*''' replace a name or part of the name&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public  * fr.umlv.*.test.*.start*(int, String, *)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''+''' used to not tell the name of the parameter of the method or the name&lt;br /&gt;
of the package&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public void fr..Test.SetParams(..)&lt;br /&gt;
all the public method of SetParam whatever are their parameters,&lt;br /&gt;
returning void and available in the classes Test which are wherever in&lt;br /&gt;
the package fr&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''..''' used to define whatever sub-type of a class or interface.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void fr.umlv.test.IMouseListener+.set*(..)&lt;br /&gt;
all the methods which begins with set in the classes implementing the&lt;br /&gt;
interface IMouseListener.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Some Practical comments:&lt;br /&gt;
&lt;br /&gt;
In my case I almost always give the full method name with the argument. Because ofbiz and opentaps project are big projects, side effects could happen in case of not specifing the full method name I want to work on.&lt;br /&gt;
&lt;br /&gt;
* Let's go back to theory:&lt;br /&gt;
&lt;br /&gt;
You can define the poincut on various events:&lt;br /&gt;
'''call, execution, get, set, handler, initialization, preinitialization,&lt;br /&gt;
staticinitialization, adviceexecution'''&lt;br /&gt;
&lt;br /&gt;
'''call''' call of the method&lt;br /&gt;
&lt;br /&gt;
'''execution''' execution of the method.&lt;br /&gt;
&lt;br /&gt;
* What is the difference between call and execution?&lt;br /&gt;
&lt;br /&gt;
Mainly it is about heritance. In the case of call we are working with the reference which is used in the program (it can be the interface). In the case of execution we are working on the object which is instanciated.&lt;br /&gt;
&lt;br /&gt;
There is more differences.&lt;br /&gt;
&lt;br /&gt;
In case of a call, the compiler modifies the invoking code.&lt;br /&gt;
In case of an execution, the compiler modifies the target code.&lt;br /&gt;
&lt;br /&gt;
It's made problematic crosslibrary using of &amp;quot;call&amp;quot;, if the execution used around pointcut is inlined in target method.&lt;br /&gt;
&lt;br /&gt;
I.e.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
someMethod() {&lt;br /&gt;
  Debug.logInfo(&amp;quot;Enter method&amp;quot;);&lt;br /&gt;
  Debug.logInfo(&amp;quot;Leave method&amp;quot;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
execution(someMethod)&lt;br /&gt;
around(someAdvice) {&lt;br /&gt;
  Debug.logInfo(&amp;quot;Enter advice&amp;quot;);&lt;br /&gt;
  proceed()&lt;br /&gt;
  Debug.logInfo(&amp;quot;Leave advice&amp;quot;)&lt;br /&gt;
}&lt;br /&gt;
compiler will produce&lt;br /&gt;
someMethod {&lt;br /&gt;
  Debug.logInfo(&amp;quot;Enter advice&amp;quot;);&lt;br /&gt;
  Debug.logInfo(&amp;quot;Enter method&amp;quot;);&lt;br /&gt;
  Debug.logInfo(&amp;quot;Leave method&amp;quot;)&lt;br /&gt;
  Debug.logInfo(&amp;quot;Leave advice&amp;quot;)&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A bit crazy:)&lt;br /&gt;
&lt;br /&gt;
This can bring a problem with debugging and breakpoints in advises. Eclipse has special options for this case.&lt;br /&gt;
&lt;br /&gt;
* During the creation of a pointcut, you can use logic and associate various call, execution with &amp;amp;&amp;amp; or ||&lt;br /&gt;
&lt;br /&gt;
The interesant method is args which let you access to the parameter of the method.&lt;br /&gt;
&lt;br /&gt;
* When you pointcut is defined, you can realize a treatment.&lt;br /&gt;
&lt;br /&gt;
'''before'''  to realize the treatment before to reach the pointcut.&lt;br /&gt;
&lt;br /&gt;
'''after''' to realize the treatment after to reach the pointcut.&lt;br /&gt;
&lt;br /&gt;
* If the program is multithread (case of opentaps) and you have to do two treatment before and after the pointcut, you can use '''around''' and '''proceed'''.  proceed will execute the code corresponding to the poincut in a around&lt;br /&gt;
instruction.&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
* http://www.eclipse.org/aspectj/doc/released/progguide/implementation.html&lt;br /&gt;
* http://www-igm.univ-mlv.fr/~dr/XPOSE2005/sophie/#&lt;/div&gt;</summary>
		<author><name>Sichen</name></author>
		
	</entry>
</feed>