Skip to content

Commit f6444ce

Browse files
authored
Merge pull request #257 from modelix/feature/MODELIX-556_add_metadata_to_deprecations
chore: add an annotation to record deprecation meta data
2 parents d11e068 + c84c45e commit f6444ce

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright (c) 2023.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.modelix.kotlin.utils
18+
19+
/**
20+
* Stores information on [Deprecated] code. This information is intended to facilitate performing the deprecation cycle.
21+
*
22+
* @property since an information since when the construct is deprecated. Preferably, use an ISO 8601 data such as
23+
* 2022-01-09
24+
* @property removalHint an optional hint on when it is ok to remove the deprecated code. For instance, this property
25+
* can include known uses of the deprecated construct that have to be checked before removing the
26+
* deprecated code.
27+
*/
28+
// The target list is copied from @Deprecated to ensure this annotation is usable in the same places.
29+
@Target(
30+
AnnotationTarget.CLASS,
31+
AnnotationTarget.FUNCTION,
32+
AnnotationTarget.PROPERTY,
33+
AnnotationTarget.ANNOTATION_CLASS,
34+
AnnotationTarget.CONSTRUCTOR,
35+
AnnotationTarget.PROPERTY_SETTER,
36+
AnnotationTarget.PROPERTY_GETTER,
37+
AnnotationTarget.TYPEALIAS,
38+
)
39+
// This is just metadata to be read by developers. No need for bloating the binary code with this information.
40+
@Retention(AnnotationRetention.SOURCE)
41+
annotation class DeprecationInfo(
42+
val since: String,
43+
val removalHint: String = "",
44+
)

0 commit comments

Comments
 (0)