[JSR308] Receiver on field initializers
Mahmood Ali
mahmood at MIT.EDU
Sun May 11 20:02:14 EDT 2008
Greetings,
> No subtype rules are specified for constructors invocation (unlike
> other method invocations).
>
> Is there any reason that constructors are treated differently than
> method invocations? In my particular case the constructors need to
> be treated just like method calls.
>
The previous sentence has a typo, my fault. The sentence (along with
the sentence preceding it) should have been:
The framework currently checks arguments passed to the constructor for
valid subtyping. No subtype rules are specified for constructor
invocation *receiver* (unlike other method invocations).
We simply could not find a common rule to restrict constructor
invocation based on the constructor receiver, unlike method
invocation. Within method invocation, the receiver is a formal
parameter.
As I said earlier though, arguments to constructor parameters are type-
checked using the regular subtype rules.
Also, it might help the conversation a lot if you provide an code
example along with what you expect and what the framework does.
> My first goal is to implement a checker for a @NoEscape annotation.
> A reference annotated as such cannot escape the current scope. The
> reference cannot be copied to fields, inside arrays, or returned.
Great. I would like hear see your results. We have been considering
implementing a Unique type system that is similar to your proposal.
- Mahmood
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.csail.mit.edu/pipermail/jsr308/attachments/20080511/ae0baccc/attachment.htm
More information about the JSR308
mailing list