Aladdin - Scala Bugtracking
[#957] project: compiler priority: low category: bug
submitter assigned to status date submitted
Nikolay Martin fixed 2007-02-18 15:31:19.0
subject [contrib #337] Java annotations no longer emitted
code
JAVA CODE:

import java.lang.annotation.*;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface indexed { }

SCALA CODE:

object X { [indexed] val x = 5; }
val m = X.getClass().getMethod("x", Array())
Console.println(m.getAnnotations().map(.annotationType().getName()))
what happened
Array()
what expected
Array(indexed)

This worked in 2.3.1

[back to overview]
Changes of this bug report
Nikolay  edited on  2007-02-18 15:37:39.0
The problem is that the annotations are not copied to the val accessor. The example would work if x is a def. Martin, can you comment on where the split happens. I found sth in Namers but it doesn't create tree, only symbols, and it only triggers if the val still has no symbol (method Namer.enterSym).
Martin  edited on  2007-02-19 17:17:39.0
Probably fixed by coping attributes in addGetterSetter in Typers. I assign to Nick to verify.
Martin  edited on  2007-02-19 17:18:12.0
Nikolay  edited on  2007-02-20 17:48:49.0
This still doesn't work. The annotation sticks to the field but not to the accessor.
Martin  edited on  2007-02-20 19:33:50.0
I fixed it now, and verified that it is fixed.