File tree 4 files changed +32
-1
lines changed
test/clojure/test_clojure/annotations
4 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 92
92
<!-- <sysproperty key="clojure.compiler.disable-locals-clearing" value="true"/>-->
93
93
<arg value =" clojure.test-clojure.protocols.examples" />
94
94
<arg value =" clojure.test-clojure.genclass.examples" />
95
+ <arg value =" clojure.test-clojure.annotations" />
95
96
</java >
96
97
</target >
97
98
Original file line number Diff line number Diff line change 301
301
302
302
; ctors
303
303
(doseq [[pclasses super-pclasses] ctor-sig-map]
304
- (let [pclasses (map the-class pclasses)
304
+ (let [constructor-annotations (meta pclasses)
305
+ pclasses (map the-class pclasses)
305
306
super-pclasses (map the-class super-pclasses)
306
307
ptypes (to-types pclasses)
307
308
super-ptypes (to-types super-pclasses)
308
309
m (new Method " <init>" (. Type VOID_TYPE) ptypes)
309
310
super-m (new Method " <init>" (. Type VOID_TYPE) super-ptypes)
310
311
gen (new GeneratorAdapter (. Opcodes ACC_PUBLIC) m nil nil cv)
312
+ _ (add-annotations gen constructor-annotations)
311
313
no-init-label (. gen newLabel)
312
314
end-label (. gen newLabel)
313
315
no-post-init-label (. gen newLabel)
Original file line number Diff line number Diff line change 52
52
expected-annotations
53
53
(into #{} (map annotation->map (.getAnnotations (.getMethod Bar " foo" nil )))))))
54
54
55
+ (gen-class :name foo.Bar
56
+ :extends clojure.lang.Box
57
+ :constructors {^{Deprecated true } [Object] [Object]}
58
+ :init init
59
+ :prefix " foo" )
60
+
61
+ (defn foo-init [obj]
62
+ [[obj] nil ])
63
+
64
+ (deftest test-annotations-on-constructor
65
+ (is (some #(instance? Deprecated %)
66
+ (for [ctor (.getConstructors (Class/forName " foo.Bar" ))
67
+ annotation (.getAnnotations ctor)]
68
+ annotation))))
Original file line number Diff line number Diff line change 71
71
expected-annotations
72
72
(into #{} (map annotation->map (.getAnnotations (.getMethod Bar " foo" nil )))))))
73
73
74
+ (gen-class :name foo.Bar
75
+ :extends clojure.lang.Box
76
+ :constructors {^{Deprecated true } [Object] [Object]}
77
+ :init init
78
+ :prefix " foo" )
79
+
80
+ (defn foo-init [obj]
81
+ [[obj] nil ])
82
+
83
+ (deftest test-annotations-on-constructor
84
+ (is (some #(instance? Deprecated %)
85
+ (for [ctor (.getConstructors (Class/forName " foo.Bar" ))
86
+ annotation (.getAnnotations ctor)]
87
+ annotation))))
You can’t perform that action at this time.
0 commit comments