summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/progGuideDB/semantics.xml41
1 files changed, 38 insertions, 3 deletions
diff --git a/docs/progGuideDB/semantics.xml b/docs/progGuideDB/semantics.xml
index 3c1c8fe32..cef27728b 100644
--- a/docs/progGuideDB/semantics.xml
+++ b/docs/progGuideDB/semantics.xml
@@ -652,9 +652,12 @@
</programlisting>
<para>
- picks out join points where an <literal>int</literal> is being
- passed as an argument. Second, though, it makes the value of that
- argument available to the enclosing advice or pointcut.
+ picks out join points where an <literal>int</literal> (or
+ a <literal>byte</literal>, <literal>short</literal>, or
+ <literal>char</literal>; anything assignable to an
+ <literal>int</literal>) is being passed as an argument.
+ Second, though, it makes the value of that argument
+ available to the enclosing advice or pointcut.
</para>
<para>
@@ -697,6 +700,38 @@
advice will be of type <literal>java.lang.Integer</literal>.
</para>
+ <para>
+ The "boxing" of the primitive value is based on the
+ <emphasis>original</emphasis> primitive type. So in the
+ following program
+ </para>
+
+<programlisting>
+ public class InstanceOf {
+
+ public static void main(String[] args) {
+ doInt(5);
+ }
+
+ static void doInt(int i) { }
+ }
+
+ aspect IntToLong {
+ pointcut el(long l) :
+ execution(* doInt(..)) <![CDATA[&&]]> args(l);
+
+ before(Object o) : el(o) {
+ System.out.println(o.getClass());
+ }
+ }
+</programlisting>
+
+ <para>
+ The pointcut will match and expose the integer argument,
+ but it will expose it as an <literal>Integer</literal>,
+ not a <literal>Long</literal>.
+ </para>
+
</sect2>
<sect2>