diff options
author | ehilsdal <ehilsdal> | 2003-11-18 02:43:31 +0000 |
---|---|---|
committer | ehilsdal <ehilsdal> | 2003-11-18 02:43:31 +0000 |
commit | 393f65bdec7a0822eddd55af22a8f7fce9bc58cd (patch) | |
tree | 673ea8f88d6f7554a80df486bee560b2b3a95948 /docs/progGuideDB | |
parent | 07cdee49d842cfc761a24c92e611042812719699 (diff) | |
download | aspectj-393f65bdec7a0822eddd55af22a8f7fce9bc58cd.tar.gz aspectj-393f65bdec7a0822eddd55af22a8f7fce9bc58cd.zip |
Work on Bugzilla 42668: effect of an after returning type incompatible with a join point return type
* fix to semantics document to describe correct semantics
* checkin of failing coverage test case for correct semantics
Diffstat (limited to 'docs/progGuideDB')
-rw-r--r-- | docs/progGuideDB/semantics.xml | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/docs/progGuideDB/semantics.xml b/docs/progGuideDB/semantics.xml index 6e8f8f649..639ddeb9b 100644 --- a/docs/progGuideDB/semantics.xml +++ b/docs/progGuideDB/semantics.xml @@ -1456,25 +1456,39 @@ </programlisting> <para> - It is an error to try to put after returning advice on a join point that - does not return the correct type. For example, + If after returning does expose its returned object, then the + type of the parameter is considered to be an + <literal>instanceof</literal>-like constraint on the advice: it + will run only when the return value is of the appropriate type. </para> -<programlisting> - after() returning (byte b): call(int String.length()) { - // this is an error - } -</programlisting> + <para> + A value is of the appropriate type if it would be assignable to + a variable of that type, in the Java sense. + <literal>byte</literal>, <literal>short</literal>, + <literal>char</literal> and <literal>int</literal> are + assignable to each other, an <literal>int</literal> is + assignable to a <literal>float</literal> parameter, + <literal>boolean</literal> values are only assignable to + <literal>boolean</literal> parameters, and reference types work + by instanceof. + </para> + + <para> + There are two special cases: If the exposed value is typed to + <literal>Object</literal>, then the advice is not constrained by + that type: the actual return value is converted to an object + type for the body of the advice: <literal>int</literal> values + are represented as <literal>java.lang.Integer</literal> objects, + etc, and no value (from void methods, for example) is + represented as <literal>null</literal>. + </para> <para> - is not allowed. But if no return value is exposed, or the exposed return - value is typed to <literal>Object</literal>, then it may be applied to - any join point. If the exposed value is typed to - <literal>Object</literal>, then the actual return value is converted to - an object type for the body of the advice: <literal>int</literal> values - are represented as <literal>java.lang.Integer</literal> objects, etc, and - no value (from void methods, for example) is represented as - <literal>null</literal>. + Secondly, the <literal>null</literal> value is assignable to a + parameter <literal>T</literal> if the join point + <emphasis>could</emphasis> return something of type + <literal>T</literal>. </para> <para> |