Skip to content

Commit fafb23c

Browse files
authored
Merge pull request hub4j#1002 from marcoferrer/add-sdk-beta-annotation
Implement BetaApi annotation for hub4j sdk
2 parents e3e495b + 4e7ac70 commit fafb23c

13 files changed

Lines changed: 90 additions & 25 deletions

src/main/java/org/kohsuke/github/AbstractBuilder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ protected AbstractBuilder(@Nonnull Class<R> finalReturnType,
9797
* if there is an I/O Exception
9898
*/
9999
@Nonnull
100-
@Preview
100+
@BetaApi
101101
@Deprecated
102102
public R done() throws IOException {
103103
R result;
@@ -127,7 +127,7 @@ public R done() throws IOException {
127127
* if an I/O error occurs
128128
*/
129129
@Nonnull
130-
@Preview
130+
@BetaApi
131131
@Deprecated
132132
protected S with(@Nonnull String name, Object value) throws IOException {
133133
requester.with(name, value);
@@ -148,7 +148,7 @@ protected S with(@Nonnull String name, Object value) throws IOException {
148148
* if an I/O error occurs
149149
*/
150150
@Nonnull
151-
@Preview
151+
@BetaApi
152152
@Deprecated
153153
protected S continueOrDone() throws IOException {
154154
// This little bit of roughness in this base class means all inheriting builders get to create Updater and
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package org.kohsuke.github;
2+
3+
import java.lang.annotation.Documented;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
7+
/**
8+
* Indicates that the method/class/etc marked is a beta implementation of an sdk feature.
9+
* <p>
10+
* These APIs are subject to change and not a part of the backward compatibility commitment. Always used in conjunction
11+
* with 'deprecated' to raise awareness to clients.
12+
* </p>
13+
*
14+
*/
15+
@Retention(RetentionPolicy.RUNTIME)
16+
@Documented
17+
public @interface BetaApi {
18+
}

src/main/java/org/kohsuke/github/GHAppCreateTokenBuilder.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ public class GHAppCreateTokenBuilder {
1919
protected final Requester builder;
2020
private final String apiUrlTail;
2121

22-
@Preview
22+
@BetaApi
2323
@Deprecated
2424
GHAppCreateTokenBuilder(GitHub root, String apiUrlTail) {
2525
this.root = root;
2626
this.apiUrlTail = apiUrlTail;
2727
this.builder = root.createRequest();
2828
}
2929

30-
@Preview
30+
@BetaApi
3131
@Deprecated
3232
GHAppCreateTokenBuilder(GitHub root, String apiUrlTail, Map<String, GHPermissionType> permissions) {
3333
this(root, apiUrlTail);
@@ -43,7 +43,7 @@ public class GHAppCreateTokenBuilder {
4343
* Array containing the repositories Ids
4444
* @return a GHAppCreateTokenBuilder
4545
*/
46-
@Preview
46+
@BetaApi
4747
@Deprecated
4848
public GHAppCreateTokenBuilder repositoryIds(List<Long> repositoryIds) {
4949
this.builder.with("repository_ids", repositoryIds);
@@ -58,7 +58,7 @@ public GHAppCreateTokenBuilder repositoryIds(List<Long> repositoryIds) {
5858
* Map containing the permission names and types.
5959
* @return a GHAppCreateTokenBuilder
6060
*/
61-
@Preview
61+
@BetaApi
6262
@Deprecated
6363
public GHAppCreateTokenBuilder permissions(Map<String, GHPermissionType> permissions) {
6464
Map<String, String> retMap = new HashMap<>();

src/main/java/org/kohsuke/github/GHAppInstallation.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ public void deleteInstallation() throws IOException {
344344
* @return a GHAppCreateTokenBuilder instance
345345
* @deprecated Use {@link GHAppInstallation#createToken()} instead.
346346
*/
347-
@Preview
347+
@BetaApi
348348
@Deprecated
349349
public GHAppCreateTokenBuilder createToken(Map<String, GHPermissionType> permissions) {
350350
return new GHAppCreateTokenBuilder(root,
@@ -361,7 +361,7 @@ public GHAppCreateTokenBuilder createToken(Map<String, GHPermissionType> permiss
361361
*
362362
* @return a GHAppCreateTokenBuilder instance
363363
*/
364-
@Preview
364+
@BetaApi
365365
@Deprecated
366366
public GHAppCreateTokenBuilder createToken() {
367367
return new GHAppCreateTokenBuilder(root, String.format("/app/installations/%d/access_tokens", getId()));

src/main/java/org/kohsuke/github/GHBranch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public String getName() {
7878
*
7979
* @return true if the push to this branch is restricted via branch protection.
8080
*/
81-
@Preview
81+
@Preview(Previews.LUKE_CAGE)
8282
@Deprecated
8383
public boolean isProtected() {
8484
return protection;

src/main/java/org/kohsuke/github/GHCommitComment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public void update(String body) throws IOException {
121121
this.body = body;
122122
}
123123

124-
@Preview
124+
@Preview(SQUIRREL_GIRL)
125125
@Deprecated
126126
public GHReaction createReaction(ReactionContent content) throws IOException {
127127
return owner.root.createRequest()

src/main/java/org/kohsuke/github/GHLabel.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static Collection<String> toNames(Collection<GHLabel> labels) {
132132
* @throws IOException
133133
* the io exception
134134
*/
135-
@Preview
135+
@BetaApi
136136
@Deprecated
137137
static Creator create(GHRepository repository) throws IOException {
138138
return new Creator(repository);
@@ -179,7 +179,7 @@ static PagedIterable<GHLabel> readAll(@Nonnull final GHRepository repository) th
179179
*
180180
* @return a {@link Updater}
181181
*/
182-
@Preview
182+
@BetaApi
183183
@Deprecated
184184
public Updater update() {
185185
return new Updater(this);
@@ -190,7 +190,7 @@ public Updater update() {
190190
*
191191
* @return a {@link Setter}
192192
*/
193-
@Preview
193+
@BetaApi
194194
@Deprecated
195195
public Setter set() {
196196
return new Setter(this);
@@ -227,7 +227,7 @@ public int hashCode() {
227227
*
228228
* {@link #done()} is called automatically after the property is set.
229229
*/
230-
@Preview
230+
@BetaApi
231231
@Deprecated
232232
public static class Setter extends GHLabelBuilder<GHLabel> {
233233
private Setter(@Nonnull GHLabel base) {
@@ -241,7 +241,7 @@ private Setter(@Nonnull GHLabel base) {
241241
*
242242
* Consumer must call {@link #done()} to commit changes.
243243
*/
244-
@Preview
244+
@BetaApi
245245
@Deprecated
246246
public static class Updater extends GHLabelBuilder<Updater> {
247247
private Updater(@Nonnull GHLabel base) {
@@ -255,7 +255,7 @@ private Updater(@Nonnull GHLabel base) {
255255
*
256256
* Consumer must call {@link #done()} to create the new instance.
257257
*/
258-
@Preview
258+
@BetaApi
259259
@Deprecated
260260
public static class Creator extends GHLabelBuilder<Creator> {
261261
private Creator(@Nonnull GHRepository repository) {

src/main/java/org/kohsuke/github/GHLabelBuilder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,21 @@ protected GHLabelBuilder(@Nonnull Class<S> intermediateReturnType,
3838
}
3939

4040
@Nonnull
41-
@Preview
41+
@BetaApi
4242
@Deprecated
4343
public S name(String value) throws IOException {
4444
return with("name", value);
4545
}
4646

4747
@Nonnull
48-
@Preview
48+
@BetaApi
4949
@Deprecated
5050
public S color(String value) throws IOException {
5151
return with("color", value);
5252
}
5353

5454
@Nonnull
55-
@Preview
55+
@BetaApi
5656
@Deprecated
5757
public S description(String value) throws IOException {
5858
return with("description", value);

src/main/java/org/kohsuke/github/GHRelease.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ public GHAsset uploadAsset(String filename, InputStream stream, String contentTy
260260
* existing logic in place for backwards compatibility.
261261
*/
262262
@Deprecated
263-
@Preview
264263
public List<GHAsset> assets() {
265264
return assets;
266265
}

src/main/java/org/kohsuke/github/GHRepositoryStatistics.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public PagedIterable<ContributorStats> getContributorStats() throws IOException,
6060
* @throws InterruptedException
6161
* the interrupted exception
6262
*/
63-
@Preview
63+
@BetaApi
6464
@Deprecated
6565
@SuppressWarnings("SleepWhileInLoop")
6666
@SuppressFBWarnings(value = { "RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE" }, justification = "JSON API")

0 commit comments

Comments
 (0)