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

Commit 3be172c

Browse files
Denys Smirnovdennwc
authored andcommitted
add missing "Default" modifier for interfaces; fixes #93
Signed-off-by: Denys Smirnov <[email protected]>
1 parent 5596879 commit 3be172c

File tree

5 files changed

+226
-9
lines changed

5 files changed

+226
-9
lines changed

driver/normalizer/annotation.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ var (
5555
// method
5656
"synchronized": {role.Incomplete},
5757
"native": {role.Incomplete},
58+
// interface method
59+
"default": {role.Incomplete},
5860
})
5961
infixRoles = StringToRolesMap(map[string][]role.Role{
6062
"+": {role.Arithmetic, role.Add},
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
interface Testiface1 {
22
void testfnc1();
3+
default void testfunc2();
34
}

fixtures/u2_type_interface_method.java.native

Lines changed: 78 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
col: 1,
99
},
1010
end: { '@type': "uast:Position",
11-
offset: 46,
11+
offset: 76,
1212
col: 0,
1313
},
1414
},
@@ -24,8 +24,8 @@
2424
col: 1,
2525
},
2626
end: { '@type': "uast:Position",
27-
offset: 45,
28-
line: 3,
27+
offset: 75,
28+
line: 4,
2929
col: 2,
3030
},
3131
},
@@ -88,6 +88,81 @@
8888
thrownExceptionTypes: ~,
8989
typeParameters: ~,
9090
},
91+
{ '@type': "MethodDeclaration",
92+
'@role': [Unannotated],
93+
'@pos': { '@type': "uast:Positions",
94+
start: { '@type': "uast:Position",
95+
offset: 48,
96+
line: 3,
97+
col: 5,
98+
},
99+
end: { '@type': "uast:Position",
100+
offset: 73,
101+
line: 3,
102+
col: 30,
103+
},
104+
},
105+
body: ~,
106+
constructor: "false",
107+
'extraDimensions2': ~,
108+
javadoc: ~,
109+
modifiers: [
110+
{ '@type': "Modifier",
111+
'@role': [Unannotated],
112+
'@pos': { '@type': "uast:Positions",
113+
start: { '@type': "uast:Position",
114+
offset: 48,
115+
line: 3,
116+
col: 5,
117+
},
118+
end: { '@type': "uast:Position",
119+
offset: 55,
120+
line: 3,
121+
col: 12,
122+
},
123+
},
124+
keyword: "default",
125+
},
126+
],
127+
name: { '@type': "SimpleName",
128+
'@role': [Unannotated],
129+
'@pos': { '@type': "uast:Positions",
130+
start: { '@type': "uast:Position",
131+
offset: 61,
132+
line: 3,
133+
col: 18,
134+
},
135+
end: { '@type': "uast:Position",
136+
offset: 70,
137+
line: 3,
138+
col: 27,
139+
},
140+
},
141+
identifier: "testfunc2",
142+
},
143+
parameters: ~,
144+
receiverQualifier: ~,
145+
receiverType: ~,
146+
'returnType2': { '@type': "PrimitiveType",
147+
'@role': [Unannotated],
148+
'@pos': { '@type': "uast:Positions",
149+
start: { '@type': "uast:Position",
150+
offset: 56,
151+
line: 3,
152+
col: 13,
153+
},
154+
end: { '@type': "uast:Position",
155+
offset: 60,
156+
line: 3,
157+
col: 17,
158+
},
159+
},
160+
annotations: ~,
161+
primitiveTypeCode: "void",
162+
},
163+
thrownExceptionTypes: ~,
164+
typeParameters: ~,
165+
},
91166
],
92167
interface: "true",
93168
javadoc: ~,

fixtures/u2_type_interface_method.java.sem.uast

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
col: 1,
88
},
99
end: { '@type': "uast:Position",
10-
offset: 46,
10+
offset: 76,
1111
col: 0,
1212
},
1313
},
@@ -23,8 +23,8 @@
2323
col: 1,
2424
},
2525
end: { '@type': "uast:Position",
26-
offset: 45,
27-
line: 3,
26+
offset: 75,
27+
line: 4,
2828
col: 2,
2929
},
3030
},
@@ -76,6 +76,70 @@
7676
},
7777
],
7878
},
79+
{ '@type': "uast:FunctionGroup",
80+
'@pos': { '@type': "uast:Positions",
81+
start: { '@type': "uast:Position",
82+
offset: 48,
83+
line: 3,
84+
col: 5,
85+
},
86+
end: { '@type': "uast:Position",
87+
offset: 73,
88+
line: 3,
89+
col: 30,
90+
},
91+
},
92+
Nodes: [
93+
~,
94+
[
95+
{ '@type': "java:Modifier",
96+
'@token': "default",
97+
'@role': [Incomplete],
98+
'@pos': { '@type': "uast:Positions",
99+
start: { '@type': "uast:Position",
100+
offset: 48,
101+
line: 3,
102+
col: 5,
103+
},
104+
end: { '@type': "uast:Position",
105+
offset: 55,
106+
line: 3,
107+
col: 12,
108+
},
109+
},
110+
},
111+
],
112+
{ '@type': "uast:Alias",
113+
Name: { '@type': "uast:Identifier",
114+
'@pos': { '@type': "uast:Positions",
115+
start: { '@type': "uast:Position",
116+
offset: 61,
117+
line: 3,
118+
col: 18,
119+
},
120+
end: { '@type': "uast:Position",
121+
offset: 70,
122+
line: 3,
123+
col: 27,
124+
},
125+
},
126+
Name: "testfunc2",
127+
},
128+
Node: { '@type': "uast:Function",
129+
Body: ~,
130+
Type: { '@type': "uast:FunctionType",
131+
Arguments: ~,
132+
Returns: ~,
133+
},
134+
},
135+
},
136+
{
137+
constructor: "false",
138+
thrownExceptionTypes: ~,
139+
typeParameters: ~,
140+
},
141+
],
142+
},
79143
],
80144
interface: "true",
81145
javadoc: ~,

fixtures/u2_type_interface_method.java.uast

Lines changed: 78 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
col: 1,
88
},
99
end: { '@type': "uast:Position",
10-
offset: 46,
10+
offset: 76,
1111
col: 0,
1212
},
1313
},
@@ -23,8 +23,8 @@
2323
col: 1,
2424
},
2525
end: { '@type': "uast:Position",
26-
offset: 45,
27-
line: 3,
26+
offset: 75,
27+
line: 4,
2828
col: 2,
2929
},
3030
},
@@ -87,6 +87,81 @@
8787
thrownExceptionTypes: ~,
8888
typeParameters: ~,
8989
},
90+
{ '@type': "MethodDeclaration",
91+
'@role': [Declaration, Function, Package, Visibility],
92+
'@pos': { '@type': "uast:Positions",
93+
start: { '@type': "uast:Position",
94+
offset: 48,
95+
line: 3,
96+
col: 5,
97+
},
98+
end: { '@type': "uast:Position",
99+
offset: 73,
100+
line: 3,
101+
col: 30,
102+
},
103+
},
104+
body: ~,
105+
constructor: "false",
106+
'extraDimensions2': ~,
107+
javadoc: ~,
108+
modifiers: [
109+
{ '@type': "Modifier",
110+
'@token': "default",
111+
'@role': [Incomplete],
112+
'@pos': { '@type': "uast:Positions",
113+
start: { '@type': "uast:Position",
114+
offset: 48,
115+
line: 3,
116+
col: 5,
117+
},
118+
end: { '@type': "uast:Position",
119+
offset: 55,
120+
line: 3,
121+
col: 12,
122+
},
123+
},
124+
},
125+
],
126+
name: { '@type': "SimpleName",
127+
'@token': "testfunc2",
128+
'@role': [Expression, Function, Identifier, Name],
129+
'@pos': { '@type': "uast:Positions",
130+
start: { '@type': "uast:Position",
131+
offset: 61,
132+
line: 3,
133+
col: 18,
134+
},
135+
end: { '@type': "uast:Position",
136+
offset: 70,
137+
line: 3,
138+
col: 27,
139+
},
140+
},
141+
},
142+
parameters: ~,
143+
receiverQualifier: ~,
144+
receiverType: ~,
145+
'returnType2': { '@type': "PrimitiveType",
146+
'@token': "void",
147+
'@role': [Primitive, Type],
148+
'@pos': { '@type': "uast:Positions",
149+
start: { '@type': "uast:Position",
150+
offset: 56,
151+
line: 3,
152+
col: 13,
153+
},
154+
end: { '@type': "uast:Position",
155+
offset: 60,
156+
line: 3,
157+
col: 17,
158+
},
159+
},
160+
annotations: ~,
161+
},
162+
thrownExceptionTypes: ~,
163+
typeParameters: ~,
164+
},
90165
],
91166
interface: "true",
92167
javadoc: ~,

0 commit comments

Comments
 (0)