summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authormihaylov <mihaylov@epfl.ch>2006-06-12 14:29:24 +0000
committermihaylov <mihaylov@epfl.ch>2006-06-12 14:29:24 +0000
commitae11503b40b26bc6835e0506ebc57f941c717aa3 (patch)
treee23b7632010f3793dd49899f35e2fb560960078c /src/compiler
parent333b75ec320375e4f8abf84b3d37608b3024295e (diff)
downloadscala-ae11503b40b26bc6835e0506ebc57f941c717aa3.tar.gz
scala-ae11503b40b26bc6835e0506ebc57f941c717aa3.tar.bz2
scala-ae11503b40b26bc6835e0506ebc57f941c717aa3.zip
Extended Java annotations support
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index 29dd3df042..28b620cbc7 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -278,23 +278,26 @@ abstract class ClassfileParser {
for (val i <- 0 until fieldCount) parseField()
val methodCount = in.nextChar
for (val i <- 0 until methodCount) parseMethod()
- if ((instanceDefs.lookup(nme.CONSTRUCTOR) == NoSymbol
- && (sflags & INTERFACE) == 0) ||
- isAttribute)
+ if ((instanceDefs.lookup(nme.CONSTRUCTOR) == NoSymbol &&
+ (sflags & INTERFACE) == 0))
{
//System.out.println("adding constructor to " + clazz);//DEBUG
- val constrParamTypes =
- if (isAttribute) {
- val value = instanceDefs.lookup(nme.value)
- if (value == NoSymbol) List ()
- else List(value.tpe.resultType)
- //System.out.println("" + value + " : " + value.tpe)
- }
- else List()
instanceDefs.enter(
clazz.newConstructor(Position.NOPOS)
.setFlag(clazz.flags & ConstrFlags)
- .setInfo(MethodType(constrParamTypes, clazz.tpe)))
+ .setInfo(MethodType(List(), clazz.tpe)))
+
+ // If the annotation has an attribute with name 'value'
+ // add a constructor for it
+ if (isAttribute) {
+ val value = instanceDefs.lookup(nme.value)
+ if (value != NoSymbol) {
+ instanceDefs.enter(
+ clazz.newConstructor(Position.NOPOS)
+ .setFlag(clazz.flags & ConstrFlags)
+ .setInfo(MethodType(List(value.tpe.resultType), clazz.tpe)))
+ }
+ }
}
}
}