Skip to content

Commit eaa9595

Browse files
committed
Restore type-accesses to annotation methods; accept test changes.
1 parent 9e0eb56 commit eaa9595

File tree

3 files changed

+9
-96
lines changed

3 files changed

+9
-96
lines changed

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ open class KotlinFileExtractor(
901901
.filterIsInstance<IrProperty>()
902902
.map {
903903
val getter = it.getter!!
904-
val label = extractFunction(getter, id, extractBody = false, extractMethodAndParameterTypeAccesses = false, extractAnnotations = true, null, listOf())
904+
val label = extractFunction(getter, id, extractBody = false, extractMethodAndParameterTypeAccesses = true, extractAnnotations = true, null, listOf())
905905
tw.writeIsAnnotElem(label!!.cast<DbMethod>())
906906
}
907907
} else {
Lines changed: 8 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,21 @@
11
test.kt:
22
# 0| [CompilationUnit] test
33
# 3| 1: [Interface] A
4-
# 3| 1: [Constructor] A
5-
#-----| 4: (Parameters)
6-
# 3| 0: [Parameter] c1
7-
# 3| 0: [TypeAccess] Class<?>
8-
# 3| 0: [WildcardTypeAccess] ? ...
9-
# 3| 1: [Parameter] c2
10-
# 3| 0: [TypeAccess] Class<? extends CharSequence>
11-
# 3| 0: [WildcardTypeAccess] ? ...
12-
# 3| 0: [TypeAccess] CharSequence
13-
# 3| 2: [Parameter] c3
14-
# 3| 0: [TypeAccess] Class<String>
15-
# 3| 0: [TypeAccess] String
16-
# 3| 3: [Parameter] c4
17-
# 3| 0: [TypeAccess] Class<?>[]
18-
# 3| 0: [TypeAccess] Class<?>
19-
# 3| 0: [WildcardTypeAccess] ? ...
20-
# 3| 5: [BlockStmt] { ... }
21-
# 3| 0: [SuperConstructorInvocationStmt] super(...)
22-
# 3| 1: [BlockStmt] { ... }
23-
# 3| 0: [ExprStmt] <Expr>;
24-
# 3| 0: [KtInitializerAssignExpr] ...=...
25-
# 3| 0: [VarAccess] c1
26-
# 3| 1: [ExprStmt] <Expr>;
27-
# 3| 0: [KtInitializerAssignExpr] ...=...
28-
# 3| 0: [VarAccess] c2
29-
# 3| 2: [ExprStmt] <Expr>;
30-
# 3| 0: [KtInitializerAssignExpr] ...=...
31-
# 3| 0: [VarAccess] c3
32-
# 3| 3: [ExprStmt] <Expr>;
33-
# 3| 0: [KtInitializerAssignExpr] ...=...
34-
# 3| 0: [VarAccess] c4
35-
# 3| 2: [FieldDeclaration] Class<?> c1;
36-
# 3| -1: [TypeAccess] Class<?>
37-
# 3| 0: [WildcardTypeAccess] ? ...
38-
# 3| 0: [VarAccess] c1
39-
# 3| 3: [Method] c1
4+
#-----| -3: (Annotations)
5+
# 0| 1: [Annotation] Retention
6+
# 0| 1: [VarAccess] RetentionPolicy.RUNTIME
7+
# 0| -1: [TypeAccess] RetentionPolicy
8+
# 3| 1: [Method] c1
409
# 3| 3: [TypeAccess] Class<?>
4110
# 3| 0: [WildcardTypeAccess] ? ...
42-
# 3| 5: [BlockStmt] { ... }
43-
# 3| 0: [ReturnStmt] return ...
44-
# 3| 0: [VarAccess] this.c1
45-
# 3| -1: [ThisAccess] this
46-
# 3| 4: [FieldDeclaration] Class<? extends CharSequence> c2;
47-
# 3| -1: [TypeAccess] Class<? extends CharSequence>
48-
# 3| 0: [WildcardTypeAccess] ? ...
49-
# 3| 0: [TypeAccess] CharSequence
50-
# 3| 0: [VarAccess] c2
51-
# 3| 5: [Method] c2
11+
# 3| 2: [Method] c2
5212
# 3| 3: [TypeAccess] Class<? extends CharSequence>
5313
# 3| 0: [WildcardTypeAccess] ? ...
5414
# 3| 0: [TypeAccess] CharSequence
55-
# 3| 5: [BlockStmt] { ... }
56-
# 3| 0: [ReturnStmt] return ...
57-
# 3| 0: [VarAccess] this.c2
58-
# 3| -1: [ThisAccess] this
59-
# 3| 6: [FieldDeclaration] Class<String> c3;
60-
# 3| -1: [TypeAccess] Class<String>
61-
# 3| 0: [TypeAccess] String
62-
# 3| 0: [VarAccess] c3
63-
# 3| 7: [Method] c3
15+
# 3| 3: [Method] c3
6416
# 3| 3: [TypeAccess] Class<String>
6517
# 3| 0: [TypeAccess] String
66-
# 3| 5: [BlockStmt] { ... }
67-
# 3| 0: [ReturnStmt] return ...
68-
# 3| 0: [VarAccess] this.c3
69-
# 3| -1: [ThisAccess] this
70-
# 3| 8: [FieldDeclaration] Class<?>[] c4;
71-
# 3| -1: [TypeAccess] Class<?>[]
72-
# 3| 0: [TypeAccess] Class<?>
73-
# 3| 0: [WildcardTypeAccess] ? ...
74-
# 3| 0: [VarAccess] c4
75-
# 3| 9: [Method] c4
18+
# 3| 4: [Method] c4
7619
# 3| 3: [TypeAccess] Class<?>[]
7720
# 3| 0: [TypeAccess] Class<?>
7821
# 3| 0: [WildcardTypeAccess] ? ...
79-
# 3| 5: [BlockStmt] { ... }
80-
# 3| 0: [ReturnStmt] return ...
81-
# 3| 0: [VarAccess] this.c4
82-
# 3| -1: [ThisAccess] this

java/ql/test/kotlin/library-tests/annotation-accessor-result-type/test.expected

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,9 @@
11
classExprs
2-
| test.kt:3:20:3:36 | ...=... | Class<?> |
32
| test.kt:3:20:3:36 | Class<?> | Class<?> |
4-
| test.kt:3:20:3:36 | Class<?> | Class<?> |
5-
| test.kt:3:20:3:36 | Class<?> | Class<?> |
6-
| test.kt:3:20:3:36 | c1 | Class<?> |
7-
| test.kt:3:20:3:36 | c1 | Class<?> |
8-
| test.kt:3:20:3:36 | this.c1 | Class<?> |
9-
| test.kt:3:39:3:70 | ...=... | Class<? extends CharSequence> |
10-
| test.kt:3:39:3:70 | Class<? extends CharSequence> | Class<? extends CharSequence> |
113
| test.kt:3:39:3:70 | Class<? extends CharSequence> | Class<? extends CharSequence> |
12-
| test.kt:3:39:3:70 | Class<? extends CharSequence> | Class<? extends CharSequence> |
13-
| test.kt:3:39:3:70 | c2 | Class<? extends CharSequence> |
14-
| test.kt:3:39:3:70 | c2 | Class<? extends CharSequence> |
15-
| test.kt:3:39:3:70 | this.c2 | Class<? extends CharSequence> |
16-
| test.kt:3:73:3:94 | ...=... | Class<String> |
17-
| test.kt:3:73:3:94 | Class<String> | Class<String> |
184
| test.kt:3:73:3:94 | Class<String> | Class<String> |
19-
| test.kt:3:73:3:94 | Class<String> | Class<String> |
20-
| test.kt:3:73:3:94 | c3 | Class<String> |
21-
| test.kt:3:73:3:94 | c3 | Class<String> |
22-
| test.kt:3:73:3:94 | this.c3 | Class<String> |
23-
| test.kt:3:97:3:120 | ...=... | Class<?>[] |
24-
| test.kt:3:97:3:120 | Class<?> | Class<?> |
25-
| test.kt:3:97:3:120 | Class<?> | Class<?> |
265
| test.kt:3:97:3:120 | Class<?> | Class<?> |
276
| test.kt:3:97:3:120 | Class<?>[] | Class<?>[] |
28-
| test.kt:3:97:3:120 | Class<?>[] | Class<?>[] |
29-
| test.kt:3:97:3:120 | Class<?>[] | Class<?>[] |
30-
| test.kt:3:97:3:120 | c4 | Class<?>[] |
31-
| test.kt:3:97:3:120 | c4 | Class<?>[] |
32-
| test.kt:3:97:3:120 | this.c4 | Class<?>[] |
337
#select
348
| test.kt:3:20:3:36 | c1 | Class<?> |
359
| test.kt:3:39:3:70 | c2 | Class<? extends CharSequence> |

0 commit comments

Comments
 (0)