- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
inconsistent behaviour for annotated constructor params
Tue, 2011-04-05, 22:47
Using -Xprint
class BippyTest(@proxy dg : Bippy) extends Bippy
will create the tree:
class BippyTest extends java.lang.Object with autoproxy.test.Bippy with ScalaObject { @autoproxy.annotation.proxy <paramaccessor> private[this] val dg: autoproxy.test.Bippy = _; def this(@autoproxy.annotation.proxy dg: autoproxy.test.Bippy): autoproxy.test.BippyTest = { BippyTest.super.this(); () } }
whereas
class BippyTest(@proxy val dg : Bippy) extends Bippy
will generate
class BippyTest extends java.lang.Object with autoproxy.test.Bippy with ScalaObject { <paramaccessor> private[this] val dg: autoproxy.test.Bippy = _; <stable> <accessor> <paramaccessor> def dg: autoproxy.test.Bippy = BippyTest.this.dg; def this(@autoproxy.annotation.proxy dg: autoproxy.test.Bippy): autoproxy.test.BippyTest = { BippyTest.super.this(); () } }
This understandably causes issues for annotation-driven plugins. I had a look through trac and couldn't see this reported. Before I create a ticket, can I confirm that nobody is already aware of the issue.
--
Kevin Wright
gtalk / msn : kev.lee.wright@gmail.com kev.lee.wright@gmail.commail: kevin.wright@scalatechnology.com
vibe / skype: kev.lee.wrightquora: http://www.quora.com/Kevin-Wright
twitter: @thecoda
"My point today is that, if we wish to count lines of code, we should not regard them as "lines produced" but as "lines spent": the current conventional wisdom is so foolish as to book that count on the wrong side of the ledger" ~ Dijkstra
class BippyTest(@proxy dg : Bippy) extends Bippy
will create the tree:
class BippyTest extends java.lang.Object with autoproxy.test.Bippy with ScalaObject { @autoproxy.annotation.proxy <paramaccessor> private[this] val dg: autoproxy.test.Bippy = _; def this(@autoproxy.annotation.proxy dg: autoproxy.test.Bippy): autoproxy.test.BippyTest = { BippyTest.super.this(); () } }
whereas
class BippyTest(@proxy val dg : Bippy) extends Bippy
will generate
class BippyTest extends java.lang.Object with autoproxy.test.Bippy with ScalaObject { <paramaccessor> private[this] val dg: autoproxy.test.Bippy = _; <stable> <accessor> <paramaccessor> def dg: autoproxy.test.Bippy = BippyTest.this.dg; def this(@autoproxy.annotation.proxy dg: autoproxy.test.Bippy): autoproxy.test.BippyTest = { BippyTest.super.this(); () } }
This understandably causes issues for annotation-driven plugins. I had a look through trac and couldn't see this reported. Before I create a ticket, can I confirm that nobody is already aware of the issue.
--
Kevin Wright
gtalk / msn : kev.lee.wright@gmail.com kev.lee.wright@gmail.commail: kevin.wright@scalatechnology.com
vibe / skype: kev.lee.wrightquora: http://www.quora.com/Kevin-Wright
twitter: @thecoda
"My point today is that, if we wish to count lines of code, we should not regard them as "lines produced" but as "lines spent": the current conventional wisdom is so foolish as to book that count on the wrong side of the ledger" ~ Dijkstra
On Tue, Apr 5, 2011 at 23:47, Kevin Wright <kev.lee.wright@gmail.com> wrote:
assuming that the annotation class (proxy) is itself not annotated with a target-meta-annotation,this is a bug. the annotation should end up only on the parameter by default.
this is the correct behavior.
please report a bug.