[documentation] Custom StaticAnnotation not represented on field Symbol
See original GitHub issueCompiler version
3.1.2-RC1-bin-20211022-f7abd32-NIGHTLY
Minimized code
import scala.quoted.*
final class Ann extends scala.annotation.StaticAnnotation
case class Foo(
@Ann @transient bar: String,
lorem: Int)
inline def foo[T]: Unit = ${ fooImpl[T] }
private def fooImpl[T: Type](using q: Quotes): Expr[Unit] = {
import q.reflect.*
val tpe = TypeRepr.of[T]
val annots =
tpe.typeSymbol.declaredFields.flatMap(_.annotations).mkString(", ")
'{ println("annotations = " + ${ Expr(annots) }) }
}
Output
annotations = Apply(Select(New(Ident(transient)),<init>),List())
Expectation
Custom StaticAnnotation
Ann
should be resolved (and so printed there)
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Field symbol as a work area - SAP Community
Statically, field symbols or interface parameters can be used in all oper-and positions that are not excluded by their type with one exception:...
Read more >Scala returns no annotations for a field - Stack Overflow
For any reason that I do not know, if I write a space at the end of the TermName, then it returns the...
Read more >Annotations, Names, Scopes, and More - Scala Documentation
A custom annotation type can be made persistent by inheriting from scala.annotation.StaticAnnotation or scala.annotation.ClassfileAnnotation .
Read more >SAP Annotations for OData Version 2.0 - GitHub Pages
If updatability can change per entity or based on the entities' state, do not use this static annotation and use sap:field-control instead.
Read more >Annotations - SuperSTAR Documentation
You can enable annotations for a field (for example: Gender), a field value (for ... in a relational database called the static annotation...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I mean at least adding a
@see
inStaticAnnotation
and/orAnnotation
tometa
indicating that it could be helpful to define the required retention. Otherwise you need to already know of@meta
.The annotation is on the primary constructor parameter. It can be accessed like this: