From 393f65bdec7a0822eddd55af22a8f7fce9bc58cd Mon Sep 17 00:00:00 2001 From: ehilsdal Date: Tue, 18 Nov 2003 02:43:31 +0000 Subject: 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 --- docs/progGuideDB/semantics.xml | 44 ++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 15 deletions(-) (limited to 'docs/progGuideDB') 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 @@ - 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 + instanceof-like constraint on the advice: it + will run only when the return value is of the appropriate type. - - after() returning (byte b): call(int String.length()) { - // this is an error - } - + + A value is of the appropriate type if it would be assignable to + a variable of that type, in the Java sense. + byte, short, + char and int are + assignable to each other, an int is + assignable to a float parameter, + boolean values are only assignable to + boolean parameters, and reference types work + by instanceof. + + + + There are two special cases: If the exposed value is typed to + Object, 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: int values + are represented as java.lang.Integer objects, + etc, and no value (from void methods, for example) is + represented as null. + - is not allowed. But if no return value is exposed, or the exposed return - value is typed to Object, then it may be applied to - any join point. If the exposed value is typed to - Object, then the actual return value is converted to - an object type for the body of the advice: int values - are represented as java.lang.Integer objects, etc, and - no value (from void methods, for example) is represented as - null. + Secondly, the null value is assignable to a + parameter T if the join point + could return something of type + T. -- cgit v1.2.3