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):
55
55
a.hasOneOfMetaAnnotation(defn.BeanSetterMetaAnnot ) || ! a.hasOneOfMetaAnnotation(defn.BeanGetterMetaAnnot )
56
56
}
57
57
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)
59
60
}
60
61
61
62
def prefixedName (prefix : String , valName : Name ) =
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ package transform
4
4
import core ._
5
5
import DenotTransformers ._
6
6
import Contexts ._
7
- import Phases .phaseOf
7
+ import Phases .*
8
8
import SymDenotations .SymDenotation
9
9
import Denotations ._
10
10
import Symbols ._
@@ -130,7 +130,7 @@ class Memoize extends MiniPhase with IdentityDenotTransformer { thisPhase =>
130
130
def removeUnwantedAnnotations (denot : SymDenotation , metaAnnotSym : ClassSymbol ): Unit =
131
131
if (sym.annotations.nonEmpty) {
132
132
val cpy = sym.copySymDenotation()
133
- cpy.filterAnnotations(_.symbol.hasAnnotation (metaAnnotSym))
133
+ cpy.filterAnnotations(annot => atPhase(typerPhase)(annot.hasOneOfMetaAnnotation (metaAnnotSym) ))
134
134
cpy.installAfter(thisPhase)
135
135
}
136
136
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
7
9
inspecting 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 .*
2
2
3
- type MyColumn = MyColumnBase @ field
3
+ type FieldColumn = MyColumnBase @ field
4
+ type GetterColumn = MyColumnBase @ getter
4
5
5
6
class 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 ,
10
16
)
Original file line number Diff line number Diff line change @@ -5,22 +5,25 @@ object Test:
5
5
6
6
for (m <- cls.getDeclaredFields.sortBy(_.getName)) {
7
7
m.setAccessible(true )
8
- println (s " inspecting field ${m.getName}" )
8
+ print (s " inspecting field ${m.getName}" )
9
9
for a <- m.getAnnotations().sortBy(_.annotationType.toString) do
10
- println(a.annotationType)
10
+ print(s " @ ${a.annotationType.getName}" )
11
+ println()
11
12
}
12
13
13
14
for (m <- cls.getDeclaredMethods.sortBy(_.getName)) {
14
15
m.setAccessible(true )
15
- println (s " inspecting method ${m.getName}" )
16
+ print (s " inspecting method ${m.getName}" )
16
17
for a <- m.getAnnotations().sortBy(_.annotationType.toString) do
17
- println(a.annotationType)
18
+ print(s " @ ${a.annotationType.getName}" )
19
+ println()
18
20
}
19
21
20
22
for c <- cls.getDeclaredConstructors.sortBy(_.getName) do
21
23
c.setAccessible(true )
22
24
println(s " inspecting constructor ${c.getName}" )
23
25
for p <- c.getParameters.sortBy(_.getName) do
24
- println (s " inspecting param ${p.getName}" )
26
+ print (s " inspecting param ${p.getName}" )
25
27
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
5
3
inspecting method setValue
6
4
inspecting method value
7
5
inspecting method value_$eq
Original file line number Diff line number Diff line change @@ -5,22 +5,25 @@ object Test:
5
5
6
6
for (m <- cls.getDeclaredFields.sortBy(_.getName)) {
7
7
m.setAccessible(true )
8
- println (s " inspecting field ${m.getName}" )
8
+ print (s " inspecting field ${m.getName}" )
9
9
for a <- m.getAnnotations().sortBy(_.annotationType.toString) do
10
- println(a.annotationType)
10
+ print(s " @ ${a.annotationType.getName}" )
11
+ println()
11
12
}
12
13
13
14
for (m <- cls.getDeclaredMethods.sortBy(_.getName)) {
14
15
m.setAccessible(true )
15
- println (s " inspecting method ${m.getName}" )
16
+ print (s " inspecting method ${m.getName}" )
16
17
for a <- m.getAnnotations().sortBy(_.annotationType.toString) do
17
- println(a.annotationType)
18
+ print(s " @ ${a.annotationType.getName}" )
19
+ println()
18
20
}
19
21
20
22
for c <- cls.getDeclaredConstructors.sortBy(_.getName) do
21
23
c.setAccessible(true )
22
24
println(s " inspecting constructor ${c.getName}" )
23
25
for p <- c.getParameters.sortBy(_.getName) do
24
- println (s " inspecting param ${p.getName}" )
26
+ print (s " inspecting param ${p.getName}" )
25
27
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