Fix for bugzilla bug 71087:

underspecification of primitive conversion
This commit is contained in:
ehilsdal 2004-08-23 23:42:09 +00:00
parent 6a1dcf2e9e
commit 27d7cdb731

View File

@ -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>