File tree Expand file tree Collapse file tree 7 files changed +48
-33
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 7 files changed +48
-33
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,8 @@ class BeanProperties(thisPhase: DenotTransformer):
5555 a.hasOneOfMetaAnnotation(defn.BeanSetterMetaAnnot ) || ! a.hasOneOfMetaAnnotation(defn.BeanGetterMetaAnnot )
5656 }
5757 meth.addAnnotations(annots)
58- DefDef (meth, (params : List [List [Tree ]]) => Assign (ref(valDef.symbol), params.head.head)).withSpan(meth.span)
58+ def body (params : List [List [Tree ]]): Tree = Assign (ref(valDef.symbol), params.head.head)
59+ DefDef (meth, body).withSpan(meth.span)
5960 }
6061
6162 def prefixedName (prefix : String , valName : Name ) =
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ package transform
44import core ._
55import DenotTransformers ._
66import Contexts ._
7- import Phases .phaseOf
7+ import Phases .*
88import SymDenotations .SymDenotation
99import Denotations ._
1010import Symbols ._
@@ -130,7 +130,7 @@ class Memoize extends MiniPhase with IdentityDenotTransformer { thisPhase =>
130130 def removeUnwantedAnnotations (denot : SymDenotation , metaAnnotSym : ClassSymbol ): Unit =
131131 if (sym.annotations.nonEmpty) {
132132 val cpy = sym.copySymDenotation()
133- cpy.filterAnnotations(_.symbol.hasAnnotation (metaAnnotSym))
133+ cpy.filterAnnotations(annot => atPhase(typerPhase)(annot.hasOneOfMetaAnnotation (metaAnnotSym) ))
134134 cpy.installAfter(thisPhase)
135135 }
136136
Original file line number Diff line number Diff line change 1- inspecting field brandName
2- interface MyColumnBase
3- inspecting field companyName
4- interface MyColumnBase
5- inspecting method brandName
6- inspecting method companyName
1+ inspecting field fieldName1 @MyColumnBase
2+ inspecting field fieldName2 @MyColumnBase
3+ inspecting field getterName1 @MyColumnBase
4+ inspecting field getterName2 @MyColumnBase
5+ inspecting method fieldName1
6+ inspecting method fieldName2
7+ inspecting method getterName1 @MyColumnBase
8+ inspecting method getterName2 @MyColumnBase
79inspecting constructor MyTable
8- inspecting param brandName
9- inspecting param companyName
10+ inspecting param fieldName1
11+ inspecting param fieldName2
12+ inspecting param getterName1
13+ inspecting param getterName2
Original file line number Diff line number Diff line change 1- import scala .annotation .meta .field
1+ import scala .annotation .meta .*
22
3- type MyColumn = MyColumnBase @ field
3+ type FieldColumn = MyColumnBase @ field
4+ type GetterColumn = MyColumnBase @ getter
45
56class MyTable (
6- @ (MyColumnBase @ field)(name= " BRAND_NAME" )
7- val brandName : String ,
8- @ MyColumn (name= " COMPANY_NAME" )
9- val companyName : String ,
7+ @ (MyColumnBase @ field)(name= " FIELD_NAME1" )
8+ val fieldName1 : String ,
9+ @ FieldColumn (name= " FIELD_NAME2" )
10+ val fieldName2 : String ,
11+
12+ @ (MyColumnBase @ getter)(name= " GETTER_NAME1" )
13+ val getterName1 : String ,
14+ @ GetterColumn (name= " GETTER_NAME2" )
15+ val getterName2 : String ,
1016)
Original file line number Diff line number Diff line change @@ -5,22 +5,25 @@ object Test:
55
66 for (m <- cls.getDeclaredFields.sortBy(_.getName)) {
77 m.setAccessible(true )
8- println (s " inspecting field ${m.getName}" )
8+ print (s " inspecting field ${m.getName}" )
99 for a <- m.getAnnotations().sortBy(_.annotationType.toString) do
10- println(a.annotationType)
10+ print(s " @ ${a.annotationType.getName}" )
11+ println()
1112 }
1213
1314 for (m <- cls.getDeclaredMethods.sortBy(_.getName)) {
1415 m.setAccessible(true )
15- println (s " inspecting method ${m.getName}" )
16+ print (s " inspecting method ${m.getName}" )
1617 for a <- m.getAnnotations().sortBy(_.annotationType.toString) do
17- println(a.annotationType)
18+ print(s " @ ${a.annotationType.getName}" )
19+ println()
1820 }
1921
2022 for c <- cls.getDeclaredConstructors.sortBy(_.getName) do
2123 c.setAccessible(true )
2224 println(s " inspecting constructor ${c.getName}" )
2325 for p <- c.getParameters.sortBy(_.getName) do
24- println (s " inspecting param ${p.getName}" )
26+ print (s " inspecting param ${p.getName}" )
2527 for a <- p.getAnnotations.sortBy(_.annotationType.toString) do
26- println(a.annotationType)
28+ print(s " @ ${a.annotationType.getName}" )
29+ println()
Original file line number Diff line number Diff line change 1- inspecting field value
2- interface JsonProperty
3- inspecting method getValue
4- interface JsonProperty
1+ inspecting field value @JsonProperty
2+ inspecting method getValue @JsonProperty
53inspecting method setValue
64inspecting method value
75inspecting method value_$eq
Original file line number Diff line number Diff line change @@ -5,22 +5,25 @@ object Test:
55
66 for (m <- cls.getDeclaredFields.sortBy(_.getName)) {
77 m.setAccessible(true )
8- println (s " inspecting field ${m.getName}" )
8+ print (s " inspecting field ${m.getName}" )
99 for a <- m.getAnnotations().sortBy(_.annotationType.toString) do
10- println(a.annotationType)
10+ print(s " @ ${a.annotationType.getName}" )
11+ println()
1112 }
1213
1314 for (m <- cls.getDeclaredMethods.sortBy(_.getName)) {
1415 m.setAccessible(true )
15- println (s " inspecting method ${m.getName}" )
16+ print (s " inspecting method ${m.getName}" )
1617 for a <- m.getAnnotations().sortBy(_.annotationType.toString) do
17- println(a.annotationType)
18+ print(s " @ ${a.annotationType.getName}" )
19+ println()
1820 }
1921
2022 for c <- cls.getDeclaredConstructors.sortBy(_.getName) do
2123 c.setAccessible(true )
2224 println(s " inspecting constructor ${c.getName}" )
2325 for p <- c.getParameters.sortBy(_.getName) do
24- println (s " inspecting param ${p.getName}" )
26+ print (s " inspecting param ${p.getName}" )
2527 for a <- p.getAnnotations.sortBy(_.annotationType.toString) do
26- println(a.annotationType)
28+ print(s " @ ${a.annotationType.getName}" )
29+ println()
You can’t perform that action at this time.
0 commit comments