Skip to content

Commit 5b61e51

Browse files
authored
make annotations SOURCE retention (#252)
1 parent 0a05ecb commit 5b61e51

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

jsonb/src/main/java/io/avaje/jsonb/CustomAdapter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package io.avaje.jsonb;
22

33
import static java.lang.annotation.ElementType.TYPE;
4+
import static java.lang.annotation.RetentionPolicy.SOURCE;
45

6+
import java.lang.annotation.Retention;
57
import java.lang.annotation.Target;
68

79

@@ -57,6 +59,7 @@
5759
* }</pre>
5860
*/
5961
@Target(TYPE)
62+
@Retention(SOURCE)
6063
public @interface CustomAdapter {
6164

6265
/**

jsonb/src/main/java/io/avaje/jsonb/Json.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import static java.lang.annotation.ElementType.TYPE;
1111
import static java.lang.annotation.RetentionPolicy.CLASS;
1212
import static java.lang.annotation.RetentionPolicy.RUNTIME;
13+
import static java.lang.annotation.RetentionPolicy.SOURCE;
1314

1415
import java.lang.annotation.Repeatable;
1516
import java.lang.annotation.Retention;
@@ -36,8 +37,8 @@
3637
*
3738
* }</pre>
3839
*/
39-
@Retention(CLASS)
4040
@Target(TYPE)
41+
@Retention(SOURCE)
4142
public @interface Json {
4243

4344
/**
@@ -74,7 +75,7 @@
7475
*
7576
* }</pre>
7677
*/
77-
@Retention(CLASS)
78+
@Retention(SOURCE)
7879
@Repeatable(List.class)
7980
@Target({TYPE, PACKAGE, MODULE})
8081
@interface Import {
@@ -96,7 +97,7 @@
9697
/**
9798
* The list of types to Import for Jsonb.
9899
*/
99-
@Retention(CLASS)
100+
@Retention(SOURCE)
100101
@Target({TYPE, PACKAGE, MODULE})
101102
@interface List {
102103

@@ -114,7 +115,7 @@
114115
*
115116
* }</pre>
116117
*/
117-
@Retention(CLASS)
118+
@Retention(SOURCE)
118119
@Target({FIELD, METHOD})
119120
@interface Property {
120121

@@ -134,7 +135,7 @@
134135
*
135136
* }</pre>
136137
*/
137-
@Retention(CLASS)
138+
@Retention(SOURCE)
138139
@Target({FIELD, PARAMETER})
139140
@interface Alias {
140141

@@ -152,8 +153,8 @@
152153
* We can explicitly use {@code serialize=true} to include the property in
153154
* serialization but not deserialization.
154155
*/
155-
@Retention(CLASS)
156156
@Target(FIELD)
157+
@Retention(SOURCE)
157158
@interface Ignore {
158159

159160
/**
@@ -180,7 +181,7 @@
180181
*
181182
* }</pre>
182183
*/
183-
@Retention(CLASS)
184+
@Retention(SOURCE)
184185
@Target({FIELD, METHOD, PARAMETER})
185186
@interface Unmapped {
186187

@@ -213,8 +214,8 @@
213214
*
214215
* }</pre>
215216
*/
216-
@Retention(RUNTIME)
217217
@Target(METHOD)
218+
@Retention(SOURCE)
218219
@interface Value {}
219220

220221
/**
@@ -236,8 +237,8 @@
236237
*
237238
* }</pre>
238239
*/
239-
@Retention(CLASS)
240240
@Target(TYPE)
241+
@Retention(SOURCE)
241242
@Repeatable(SubTypes.class)
242243
@interface SubType {
243244

@@ -258,8 +259,8 @@
258259
* Container of all the concrete SubType's that an interface type or abstract
259260
* type can be represented as.
260261
*/
261-
@Retention(CLASS)
262262
@Target(TYPE)
263+
@Retention(SOURCE)
263264
@interface SubTypes {
264265

265266
SubType[] value();
@@ -268,7 +269,7 @@
268269
/**
269270
* Marks a String field as containing raw JSON content.
270271
*/
271-
@Retention(CLASS)
272+
@Retention(SOURCE)
272273
@Target({FIELD, METHOD})
273274
@interface Raw {
274275

@@ -294,8 +295,8 @@
294295
*
295296
* }</pre>
296297
*/
297-
@Retention(CLASS)
298298
@Target(TYPE)
299+
@Retention(SOURCE)
299300
@interface MixIn {
300301
/** The concrete type to mix. */
301302
Class<?> value();
@@ -335,7 +336,7 @@
335336
*
336337
* }</pre>
337338
*/
338-
@Retention(CLASS)
339+
@Retention(SOURCE)
339340
@Target({CONSTRUCTOR, METHOD})
340341
@interface Creator {}
341342

0 commit comments

Comments
 (0)