-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Compiler version
3.0.0
Minimized code
This is an issue I've encountered while trying to port squeryl to scala 3.
In a MyColumnBase.java
file:
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface MyColumnBase {
String value() default "";
String name() default "";
}
and in a scala file:
import annotation.meta.field
type MyColumn = MyColumnBase @field
class MyTable(
@MyColumn(name="BRAND_NAME")
val brandName: String
) {
@MyColumn(name="WEIGHT")
val weightInGrams: Option[String] = None
}
val clasz = classOf[MyTable]
for(m <- clasz.getDeclaredFields) {
m.setAccessible(true)
if(m.getName == "weightInGrams" || m.getName == "brandName"){
println(s"inspecting field ${m.getName}")
assert(m.getAnnotations().size == 1, s"no annotation found for ${m.getName}")
}
}
Output
Array() had size 0 instead of expected size 1 no annotation found for brandName
Expectation
I would expect to see the annotation on the field brandName
. In scala 2.13, I can at least.