Browse files

Annotated @proxy to target fields and annotated @proxy to target fiel…

…ds (small change in GenerateSynthetics to support this)
  • Loading branch information...
1 parent 13d51da commit 2a1fe77fd50a0c8f047377344e36569d42d4ebe4 @kevinwright committed Apr 6, 2011
View
3 annotation/src/main/scala/autoproxy/annotation/proxyAnnotation.scala
@@ -1,5 +1,7 @@
package autoproxy.annotation
+import annotation.target.field
+
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2002-2009, LAMP/EPFL **
@@ -39,5 +41,6 @@ package autoproxy.annotation
* (i.e. same name and signature) in the containing object.
* </p>
*/
+@field
class proxy extends scala.annotation.StaticAnnotation
View
10 examples/simple/src/main/scala/autoproxy/test/Bippy.scala
@@ -0,0 +1,10 @@
+package autoproxy.test
+
+import autoproxy.annotation.proxy
+import annotation.target.field
+
+trait Bippy {
+ def bippy(i : Int) : String
+}
+
+class BippyTest(@proxy var dg : Bippy) extends Bippy
View
5 plugin/src/main/scala/autoproxy/plugin/GenerateSynthetics.scala
@@ -136,14 +136,15 @@ class GenerateSynthetics(plugin: AutoProxyPlugin, val global: Global) extends Pl
if (sym != null) {
val testSym = if (sym.isModule) sym.moduleClass else sym
testSym.annotations foreach { ann => log("annotation:" + ann) }
- val gotOne = testSym.annotations exists {_.toString == plugin.AutoproxyAnnotationClass}
+ val gotOne = testSym.annotations exists {_.toString startsWith plugin.AutoproxyAnnotationClass}
if(gotOne) log("got a live one here!")
gotOne
} else false
}
def shouldAutoProxy(tree: Tree) = {
- isAccessor(tree) && shouldAutoProxySym(tree.symbol)
+ //isAccessor(tree) &&
+ shouldAutoProxySym(tree.symbol)
}
val newTree = tree match {

0 comments on commit 2a1fe77

Please sign in to comment.