How to annotate type parameter in scala

Java 8 supports annotations of type parameters such as

class SomeBean {
     Optional<@Base64 String> bs;
}

How can this be written in Scala (if possible)? I tried the following (which compiles), but the resulting bytecode does not mention the annotation Base64:

case class SomeScalaBean(bs: Optional[String @Base64]) 

Note . If you're interested, the hibernate validator is used, see http://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/#type-arguments-constraints

Edit : I created a ticket for this - https://issues.scala-lang.org/browse/SI-9883

+4
source share

Source: https://habr.com/ru/post/1650576/


All Articles