aboutsummaryrefslogtreecommitdiffstats
path: root/docs/adk15ProgGuideDB/autoboxing.xml
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2021-04-10 19:19:39 +0700
committerAlexander Kriegisch <Alexander@Kriegisch.name>2021-04-10 19:19:39 +0700
commit92edca3ea7a482d59a9086b1cb61413ed8604b67 (patch)
treed709ab2fd24a563cf626fb5ff354a0972a1dc6a9 /docs/adk15ProgGuideDB/autoboxing.xml
parent79c272eb9c158a976b7b3313c50759dd87b1b5fd (diff)
downloadaspectj-92edca3ea7a482d59a9086b1cb61413ed8604b67.tar.gz
aspectj-92edca3ea7a482d59a9086b1cb61413ed8604b67.zip
Remove indentation from <programlisting> blocks in docs
Many dozens (hundreds?) of documentation code blocks were indented to match the surrounding XML or just arbitrarily. The thing is: Inside <programlisting> tags, similar to <pre> tags, line feeds and leading whitespace are being preserved, which looked very awkward in the HTML documentation. While a few files were mostly correct in this respect, which shows that it was meant to be like that, many others were not. This was tedious, stupid work to fix, but it had to be done. Please note that the documentation was in no way updated content-wise. This is also overdue, but not my focus here. Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'docs/adk15ProgGuideDB/autoboxing.xml')
-rw-r--r--docs/adk15ProgGuideDB/autoboxing.xml66
1 files changed, 33 insertions, 33 deletions
diff --git a/docs/adk15ProgGuideDB/autoboxing.xml b/docs/adk15ProgGuideDB/autoboxing.xml
index ec19fb7fe..7a3cdaca1 100644
--- a/docs/adk15ProgGuideDB/autoboxing.xml
+++ b/docs/adk15ProgGuideDB/autoboxing.xml
@@ -1,54 +1,54 @@
<chapter id="autoboxing" xreflabel="Autoboxing and Unboxing">
<title>Autoboxing and Unboxing</title>
-
+
<sect1 id="boxing-inJava5">
<title>Autoboxing and Unboxing in Java 5</title>
-
+
<para>
- Java 5 (and hence AspectJ 1.5) supports automatic conversion of
+ Java 5 (and hence AspectJ 1.5) supports automatic conversion of
primitive types (int, float, double etc.) to their object equivalents
(Integer, Float, Double,...) in assignments and method and constructor
invocations. This conversion is know as autoboxing.
</para>
-
+
<para>Java 5 also supports automatic unboxing, where wrapper types
are automatically converted into their primitive equivalents if
needed for assignments or method or constructor invocations.</para>
-
+
<para>For example:</para>
<programlisting><![CDATA[
- int i = 0;
- i = new Integer(5); // auto-unboxing
-
- Integer i2 = 5; // autoboxing
- ]]></programlisting>
-
+int i = 0;
+i = new Integer(5); // auto-unboxing
+
+Integer i2 = 5; // autoboxing
+]]></programlisting>
+
</sect1>
-
+
<sect1 id="autoboxing-in-aspectj5">
<title>Autoboxing and Join Point matching in AspectJ 5</title>
-
+
<para>Most of the pointcut designators match based on signatures, and
hence are unaffected by autoboxing. For example, a call to a method</para>
<programlisting><![CDATA[
- public void foo(Integer i);
- ]]></programlisting>
-
+public void foo(Integer i);
+]]></programlisting>
+
<para>is <emphasis>not</emphasis> matched by a pointcut
<literal>call(void foo(int))</literal> since the signature declares
a single <literal>Integer</literal> parameter, not an <literal>int</literal>.
</para>
-
+
<para>The <literal>args</literal> pointcut designator is affected by
autoboxing since it matches based on the runtime type of the arguments.
AspectJ 5 applies autoboxing and unboxing in determining argument matching.
In other words, <literal>args(Integer)</literal> will match any join
point at which there is a single argument of type <literal>Integer</literal>
or of type <literal>int</literal>.</para>
-
+
<itemizedlist>
<listitem>args(Integer) and args(int) are equivalent</listitem>
<listitem>args(Float) and args(float) are equivalent</listitem>
@@ -58,29 +58,29 @@
<listitem>args(Long) and args(long) are equivalent</listitem>
<listitem>args(Boolean) and args(boolean) are equivalent</listitem>
</itemizedlist>
-
+
<para>
- Autoboxing and unboxing are also applied when binding pointcut or
- advice parameters, for example:
+ Autoboxing and unboxing are also applied when binding pointcut or
+ advice parameters, for example:
</para>
<programlisting><![CDATA[
- pointcut foo(int i) : args(i);
-
- before(Integer i) : foo(i) {
- ...
- }
- ]]></programlisting>
+pointcut foo(int i) : args(i);
+
+before(Integer i) : foo(i) {
+ ...
+}
+]]></programlisting>
</sect1>
-
+
<sect1 id="autoboxing-and-method-dispatch">
<title>Inter-type method declarations and method dispatch</title>
-
+
<para>Autoboxing, unboxing, and also varargs all affect the method
dispatch algorithm used in Java 5. In AspectJ 5, the target method
of a call is selected according to the following algorithm:</para>
-
+
<orderedlist>
<listitem>Attempt to locate a matching method or inter-type declared
method without considering
@@ -90,11 +90,11 @@
<listitem>Finally try again considering both autoboxing, unboxing,
and varargs.</listitem>
</orderedlist>
-
+
<para>One consequence is that a directly matching inter-type declared
- method will take precedence over a method declared locally in the
+ method will take precedence over a method declared locally in the
target class but that only matches via autoboxing.</para>
</sect1>
-
+
</chapter>