File: Main.smali

package info (click to toggle)
libsmali-java 2.5.2.git2771eae-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 9,136 kB
  • sloc: java: 47,715; sh: 232; xml: 60; ansic: 46; makefile: 6
file content (138 lines) | stat: -rw-r--r-- 3,525 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
.class public LMain;
.super Ljava/lang/Object;


#expected output:
#@ClassAnnotation()
#@MethodAnnotation()
#@FieldAnnotation()
#@ParameterAnnotation()


.method public static main([Ljava/lang/String;)V
    .registers 1

    invoke-static {}, LMain;->testClassAnnotation()V

    invoke-static {}, LMain;->testMethodAnnotation()V

    invoke-static {}, LMain;->testFieldAnnotation()V

    const-string v0, ""

    invoke-static {v0}, LMain;->testParameterAnnotation(Ljava/lang/String;)V 

	return-void
.end method

.annotation runtime LClassAnnotation;
.end annotation

.method public static testClassAnnotation()V
    .registers 3

    sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream;

    const-class v1, LMain;
    const-class v2, LClassAnnotation;

    invoke-virtual {v1, v2}, Ljava/lang/Class;->getAnnotation(Ljava/lang/Class;)Ljava/lang/annotation/Annotation;
    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V

    return-void
.end method



.method public static testMethodAnnotation()V
    .registers 4

    .annotation runtime LMethodAnnotation;
    .end annotation

    sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream;

    const-class v1, LMain;
    const-string v2, "testMethodAnnotation"

    const/4 v3, 0
    new-array v3, v3, [Ljava/lang/Class;

    invoke-virtual {v1, v2, v3}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
    move-result-object v1

    const-class v2, LMethodAnnotation;

    invoke-virtual {v1, v2}, Ljava/lang/reflect/Method;->getAnnotation(Ljava/lang/Class;)Ljava/lang/annotation/Annotation;
    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V

    return-void
.end method


.field public static fieldAnnotationTest:Ljava/lang/Object;
    .annotation runtime LFieldAnnotation;
    .end annotation
.end field

.method public static testFieldAnnotation()V
    .registers 3

    sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream;

    const-class v1, LMain;
    const-string v2, "fieldAnnotationTest"

    invoke-virtual {v1, v2}, Ljava/lang/Class;->getField(Ljava/lang/String;)Ljava/lang/reflect/Field;
    move-result-object v1

    const-class v2, LFieldAnnotation;

    invoke-virtual {v1, v2}, Ljava/lang/reflect/Field;->getAnnotation(Ljava/lang/Class;)Ljava/lang/annotation/Annotation;
    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V

    return-void
.end method


.method public static testParameterAnnotation(Ljava/lang/String;)V
    .registers 6

    .param p0    # Ljava/lang/String;
        .annotation runtime LParameterAnnotation;
        .end annotation
    .end param


    sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream;

    const-class v1, LMain;
    const-string v2, "testParameterAnnotation"

    const/4 v3, 1
    new-array v3, v3, [Ljava/lang/Class;

    const-class v4, Ljava/lang/String;
    const/4 v5, 0
    aput-object v4, v3, v5

    invoke-virtual {v1, v2, v3}, Ljava/lang/Class;->getMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
    move-result-object v1


    invoke-virtual {v1}, Ljava/lang/reflect/Method;->getParameterAnnotations()[[Ljava/lang/annotation/Annotation;
    move-result-object v1

    aget-object v1, v1, v5
    aget-object v1, v1, v5

    invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V

    return-void
.end method