Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit cba4871

Browse files
committed
annotations: Add annotations for modifiers
1 parent 6d90ec0 commit cba4871

11 files changed

Lines changed: 49 additions & 16 deletions

ANNOTATION.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,17 @@
115115
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='SimpleType'\] | Incomplete |
116116
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='UnionType'\] | Incomplete |
117117
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='WildcardType'\] | Incomplete |
118+
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='Modifier'\]/self::\*\[@Token='public'\] | VisibleFromWorld |
119+
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='Modifier'\]/self::\*\[@Token='protected'\] | VisibleFromSubtype |
120+
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='Modifier'\]/self::\*\[@Token='private'\] | VisibleFromInstance |
121+
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='Modifier'\]/self::\*\[@Token='abstract'\] | Incomplete |
122+
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='Modifier'\]/self::\*\[@Token='static'\] | Incomplete |
123+
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='Modifier'\]/self::\*\[@Token='final'\] | Incomplete |
124+
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='Modifier'\]/self::\*\[@Token='strictfp'\] | Incomplete |
125+
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='Modifier'\]/self::\*\[@Token='transient'\] | Incomplete |
126+
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='Modifier'\]/self::\*\[@Token='volatile'\] | Incomplete |
127+
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='Modifier'\]/self::\*\[@Token='synchronized'\] | Incomplete |
128+
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='Modifier'\]/self::\*\[@Token='native'\] | Incomplete |
118129
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='TryStatement'\] | Try, Statement |
119130
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='TryStatement'\]/\*\[@internalRole\]\[@internalRole='body'\] | TryBody |
120131
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='TryStatement'\]/\*\[@internalRole\]\[@internalRole='catchClauses'\] | TryCatch |

driver/normalizer/annotation.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,28 @@ var AnnotationRules = On(jdt.CompilationUnit).Roles(File).Descendants(
189189
On(jdt.UnionType).Roles(Incomplete),
190190
On(jdt.WildcardType).Roles(Incomplete),
191191

192+
// Modifiers
193+
On(jdt.Modifier).Self(
194+
On(jdt.KeywordPublic).Roles(VisibleFromWorld),
195+
On(jdt.KeywordProtected).Roles(VisibleFromSubtype),
196+
On(jdt.KeywordPrivate).Roles(VisibleFromInstance),
197+
198+
// class | method | interface
199+
On(jdt.KeywordAbstract).Roles(Incomplete),
200+
// class | field | method | interface
201+
On(jdt.KeywordStatic).Roles(Incomplete),
202+
// class | field | method
203+
On(jdt.KeywordFinal).Roles(Incomplete),
204+
// class | method | interface
205+
On(jdt.KeywordStrictfp).Roles(Incomplete),
206+
// field
207+
On(jdt.KeywordTransient).Roles(Incomplete),
208+
On(jdt.KeywordVolatile).Roles(Incomplete),
209+
// method
210+
On(jdt.KeywordSynchronized).Roles(Incomplete),
211+
On(jdt.KeywordNative).Roles(Incomplete),
212+
),
213+
192214
// Exceptions
193215
On(jdt.TryStatement).Roles(Try, Statement).Children(
194216
// TODO: TryWithResourcesStatement

tests/anonymous_class_declaration.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ CompilationUnit {
147147
. . . . . . . . . . . . . . . }
148148
. . . . . . . . . . . . . . . Children: {
149149
. . . . . . . . . . . . . . . . 0: Modifier {
150-
. . . . . . . . . . . . . . . . . Roles: Unannotated
150+
. . . . . . . . . . . . . . . . . Roles: VisibleFromWorld
151151
. . . . . . . . . . . . . . . . . TOKEN "public"
152152
. . . . . . . . . . . . . . . . . StartPosition: {
153153
. . . . . . . . . . . . . . . . . . Offset: 57

tests/field_access.uast

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ CompilationUnit {
3535
. . . . . }
3636
. . . . . Children: {
3737
. . . . . . 0: Modifier {
38-
. . . . . . . Roles: Unannotated
38+
. . . . . . . Roles: VisibleFromInstance
3939
. . . . . . . TOKEN "private"
4040
. . . . . . . StartPosition: {
4141
. . . . . . . . Offset: 15
@@ -47,7 +47,7 @@ CompilationUnit {
4747
. . . . . . . }
4848
. . . . . . }
4949
. . . . . . 1: Modifier {
50-
. . . . . . . Roles: Unannotated
50+
. . . . . . . Roles: Incomplete
5151
. . . . . . . TOKEN "final"
5252
. . . . . . . StartPosition: {
5353
. . . . . . . . Offset: 23

tests/hello_world.uast

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ CompilationUnit {
4141
. . . . . }
4242
. . . . . Children: {
4343
. . . . . . 0: Modifier {
44-
. . . . . . . Roles: Unannotated
44+
. . . . . . . Roles: VisibleFromWorld
4545
. . . . . . . TOKEN "public"
4646
. . . . . . . StartPosition: {
4747
. . . . . . . . Offset: 15
@@ -53,7 +53,7 @@ CompilationUnit {
5353
. . . . . . . }
5454
. . . . . . }
5555
. . . . . . 1: Modifier {
56-
. . . . . . . Roles: Unannotated
56+
. . . . . . . Roles: Incomplete
5757
. . . . . . . TOKEN "static"
5858
. . . . . . . StartPosition: {
5959
. . . . . . . . Offset: 22

tests/initializer.uast

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ CompilationUnit {
3535
. . . . . }
3636
. . . . . Children: {
3737
. . . . . . 0: Modifier {
38-
. . . . . . . Roles: Unannotated
38+
. . . . . . . Roles: VisibleFromInstance
3939
. . . . . . . TOKEN "private"
4040
. . . . . . . StartPosition: {
4141
. . . . . . . . Offset: 15
@@ -47,7 +47,7 @@ CompilationUnit {
4747
. . . . . . . }
4848
. . . . . . }
4949
. . . . . . 1: Modifier {
50-
. . . . . . . Roles: Unannotated
50+
. . . . . . . Roles: Incomplete
5151
. . . . . . . TOKEN "final"
5252
. . . . . . . StartPosition: {
5353
. . . . . . . . Offset: 23
@@ -59,7 +59,7 @@ CompilationUnit {
5959
. . . . . . . }
6060
. . . . . . }
6161
. . . . . . 2: Modifier {
62-
. . . . . . . Roles: Unannotated
62+
. . . . . . . Roles: Incomplete
6363
. . . . . . . TOKEN "static"
6464
. . . . . . . StartPosition: {
6565
. . . . . . . . Offset: 29
@@ -111,7 +111,7 @@ CompilationUnit {
111111
. . . . . }
112112
. . . . . Children: {
113113
. . . . . . 0: Modifier {
114-
. . . . . . . Roles: Unannotated
114+
. . . . . . . Roles: Incomplete
115115
. . . . . . . TOKEN "static"
116116
. . . . . . . StartPosition: {
117117
. . . . . . . . Offset: 45

tests/method_declarations.uast

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ CompilationUnit {
8585
. . . . . }
8686
. . . . . Children: {
8787
. . . . . . 0: Modifier {
88-
. . . . . . . Roles: Unannotated
88+
. . . . . . . Roles: VisibleFromWorld
8989
. . . . . . . TOKEN "public"
9090
. . . . . . . StartPosition: {
9191
. . . . . . . . Offset: 43
@@ -97,7 +97,7 @@ CompilationUnit {
9797
. . . . . . . }
9898
. . . . . . }
9999
. . . . . . 1: Modifier {
100-
. . . . . . . Roles: Unannotated
100+
. . . . . . . Roles: Incomplete
101101
. . . . . . . TOKEN "static"
102102
. . . . . . . StartPosition: {
103103
. . . . . . . . Offset: 50

tests/super_field_access.uast

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ CompilationUnit {
3535
. . . . . }
3636
. . . . . Children: {
3737
. . . . . . 0: Modifier {
38-
. . . . . . . Roles: Unannotated
38+
. . . . . . . Roles: VisibleFromWorld
3939
. . . . . . . TOKEN "public"
4040
. . . . . . . StartPosition: {
4141
. . . . . . . . Offset: 12
@@ -133,7 +133,7 @@ CompilationUnit {
133133
. . . . . }
134134
. . . . . Children: {
135135
. . . . . . 0: Modifier {
136-
. . . . . . . Roles: Unannotated
136+
. . . . . . . Roles: VisibleFromWorld
137137
. . . . . . . TOKEN "public"
138138
. . . . . . . StartPosition: {
139139
. . . . . . . . Offset: 51

tests/super_method_invocation.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ CompilationUnit {
4141
. . . . . }
4242
. . . . . Children: {
4343
. . . . . . 0: Modifier {
44-
. . . . . . . Roles: Unannotated
44+
. . . . . . . Roles: VisibleFromWorld
4545
. . . . . . . TOKEN "public"
4646
. . . . . . . StartPosition: {
4747
. . . . . . . . Offset: 12

tests/super_method_reference.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ CompilationUnit {
128128
. . . . . }
129129
. . . . . Children: {
130130
. . . . . . 0: Modifier {
131-
. . . . . . . Roles: Unannotated
131+
. . . . . . . Roles: VisibleFromWorld
132132
. . . . . . . TOKEN "public"
133133
. . . . . . . StartPosition: {
134134
. . . . . . . . Offset: 49

0 commit comments

Comments
 (0)