Skip to content

Commit 6ddcdbe

Browse files
authored
Merge pull request #1216 from hub4j/dependabot/maven/spotbugs.version-4.4.0
Chore(deps): Bump spotbugs.version from 4.2.3 to 4.4.0
2 parents 213eff4 + 707b2dc commit 6ddcdbe

68 files changed

Lines changed: 524 additions & 161 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<properties>
3535
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3636
<spotbugs-maven-plugin.version>4.3.0</spotbugs-maven-plugin.version>
37-
<spotbugs.version>4.2.3</spotbugs.version>
37+
<spotbugs.version>4.4.0</spotbugs.version>
3838
<spotbugs-maven-plugin.failOnError>true</spotbugs-maven-plugin.failOnError>
3939
<hamcrest.version>2.2</hamcrest.version>
4040
<okhttp3.version>4.4.1</okhttp3.version>

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

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package org.kohsuke.github;
22

3+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
34
import org.kohsuke.github.internal.EnumUtils;
45

56
import java.io.IOException;
67
import java.net.URL;
8+
import java.util.Collections;
79
import java.util.List;
810
import java.util.Map;
911
import java.util.stream.Collectors;
@@ -32,6 +34,7 @@ public class GHApp extends GHObject {
3234
*
3335
* @return the owner
3436
*/
37+
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior")
3538
public GHUser getOwner() {
3639
return owner;
3740
}
@@ -45,7 +48,7 @@ public GHUser getOwner() {
4548
*/
4649
@Deprecated
4750
public void setOwner(GHUser owner) {
48-
this.owner = owner;
51+
throw new RuntimeException("Do not use this method.");
4952
}
5053

5154
/**
@@ -66,7 +69,7 @@ public String getName() {
6669
*/
6770
@Deprecated
6871
public void setName(String name) {
69-
this.name = name;
72+
throw new RuntimeException("Do not use this method.");
7073
}
7174

7275
/**
@@ -87,7 +90,7 @@ public String getDescription() {
8790
*/
8891
@Deprecated
8992
public void setDescription(String description) {
90-
this.description = description;
93+
throw new RuntimeException("Do not use this method.");
9194
}
9295

9396
/**
@@ -108,7 +111,7 @@ public String getExternalUrl() {
108111
*/
109112
@Deprecated
110113
public void setExternalUrl(String externalUrl) {
111-
this.externalUrl = externalUrl;
114+
throw new RuntimeException("Do not use this method.");
112115
}
113116

114117
/**
@@ -131,7 +134,7 @@ public List<GHEvent> getEvents() {
131134
*/
132135
@Deprecated
133136
public void setEvents(List<GHEvent> events) {
134-
this.events = events.stream().map(GHEvent::symbol).collect(Collectors.toList());
137+
throw new RuntimeException("Do not use this method.");
135138
}
136139

137140
/**
@@ -152,7 +155,7 @@ public long getInstallationsCount() {
152155
*/
153156
@Deprecated
154157
public void setInstallationsCount(long installationsCount) {
155-
this.installationsCount = installationsCount;
158+
throw new RuntimeException("Do not use this method.");
156159
}
157160

158161
public URL getHtmlUrl() {
@@ -165,7 +168,7 @@ public URL getHtmlUrl() {
165168
* @return the permissions
166169
*/
167170
public Map<String, String> getPermissions() {
168-
return permissions;
171+
return Collections.unmodifiableMap(permissions);
169172
}
170173

171174
/**
@@ -177,7 +180,7 @@ public Map<String, String> getPermissions() {
177180
*/
178181
@Deprecated
179182
public void setPermissions(Map<String, String> permissions) {
180-
this.permissions = permissions;
183+
throw new RuntimeException("Do not use this method.");
181184
}
182185

183186
GHApp wrapUp(GitHub root) {

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

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package org.kohsuke.github;
22

33
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
45
import org.kohsuke.github.internal.EnumUtils;
56

67
import java.io.IOException;
78
import java.net.MalformedURLException;
89
import java.net.URL;
10+
import java.util.Collections;
911
import java.util.List;
1012
import java.util.Map;
1113
import java.util.stream.Collectors;
@@ -52,7 +54,10 @@ public URL getHtmlUrl() {
5254
* Gets root.
5355
*
5456
* @return the root
57+
* @deprecated This method should be used internally only.
5558
*/
59+
@Deprecated
60+
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior")
5661
public GitHub getRoot() {
5762
return root;
5863
}
@@ -66,14 +71,15 @@ public GitHub getRoot() {
6671
*/
6772
@Deprecated
6873
public void setRoot(GitHub root) {
69-
this.root = root;
74+
throw new RuntimeException("Do not use this method.");
7075
}
7176

7277
/**
7378
* Gets account.
7479
*
7580
* @return the account
7681
*/
82+
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior")
7783
public GHUser getAccount() {
7884
return account;
7985
}
@@ -87,7 +93,7 @@ public GHUser getAccount() {
8793
*/
8894
@Deprecated
8995
public void setAccount(GHUser account) {
90-
this.account = account;
96+
throw new RuntimeException("Do not use this method.");
9197
}
9298

9399
/**
@@ -108,7 +114,7 @@ public String getAccessTokenUrl() {
108114
*/
109115
@Deprecated
110116
public void setAccessTokenUrl(String accessTokenUrl) {
111-
this.accessTokenUrl = accessTokenUrl;
117+
throw new RuntimeException("Do not use this method.");
112118
}
113119

114120
/**
@@ -158,7 +164,7 @@ GHRepository[] getItems(GitHub root) {
158164
*/
159165
@Deprecated
160166
public void setRepositoriesUrl(String repositoriesUrl) {
161-
this.repositoriesUrl = repositoriesUrl;
167+
throw new RuntimeException("Do not use this method.");
162168
}
163169

164170
/**
@@ -179,7 +185,7 @@ public long getAppId() {
179185
*/
180186
@Deprecated
181187
public void setAppId(long appId) {
182-
this.appId = appId;
188+
throw new RuntimeException("Do not use this method.");
183189
}
184190

185191
/**
@@ -200,7 +206,7 @@ public long getTargetId() {
200206
*/
201207
@Deprecated
202208
public void setTargetId(long targetId) {
203-
this.targetId = targetId;
209+
throw new RuntimeException("Do not use this method.");
204210
}
205211

206212
/**
@@ -221,7 +227,7 @@ public GHTargetType getTargetType() {
221227
*/
222228
@Deprecated
223229
public void setTargetType(GHTargetType targetType) {
224-
this.targetType = targetType;
230+
throw new RuntimeException("Do not use this method.");
225231
}
226232

227233
/**
@@ -230,7 +236,7 @@ public void setTargetType(GHTargetType targetType) {
230236
* @return the permissions
231237
*/
232238
public Map<String, GHPermissionType> getPermissions() {
233-
return permissions;
239+
return Collections.unmodifiableMap(permissions);
234240
}
235241

236242
/**
@@ -242,7 +248,7 @@ public Map<String, GHPermissionType> getPermissions() {
242248
*/
243249
@Deprecated
244250
public void setPermissions(Map<String, GHPermissionType> permissions) {
245-
this.permissions = permissions;
251+
throw new RuntimeException("Do not use this method.");
246252
}
247253

248254
/**
@@ -265,7 +271,7 @@ public List<GHEvent> getEvents() {
265271
*/
266272
@Deprecated
267273
public void setEvents(List<GHEvent> events) {
268-
this.events = events.stream().map(GHEvent::symbol).collect(Collectors.toList());
274+
throw new RuntimeException("Do not use this method.");
269275
}
270276

271277
/**
@@ -286,7 +292,7 @@ public String getSingleFileName() {
286292
*/
287293
@Deprecated
288294
public void setSingleFileName(String singleFileName) {
289-
this.singleFileName = singleFileName;
295+
throw new RuntimeException("Do not use this method.");
290296
}
291297

292298
/**
@@ -307,7 +313,7 @@ public GHRepositorySelection getRepositorySelection() {
307313
*/
308314
@Deprecated
309315
public void setRepositorySelection(GHRepositorySelection repositorySelection) {
310-
this.repositorySelection = repositorySelection;
316+
throw new RuntimeException("Do not use this method.");
311317
}
312318

313319
GHAppInstallation wrapUp(GitHub root) {

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
55

66
import java.io.IOException;
7-
import java.util.Date;
8-
import java.util.List;
9-
import java.util.Map;
7+
import java.util.*;
108

119
/**
1210
* A Github App Installation Token.
@@ -25,7 +23,10 @@ public class GHAppInstallationToken extends GitHubInteractiveObject {
2523
* Gets root.
2624
*
2725
* @return the root
26+
* @deprecated This method should be used internally only.
2827
*/
28+
@Deprecated
29+
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior")
2930
public GitHub getRoot() {
3031
return root;
3132
}
@@ -39,7 +40,7 @@ public GitHub getRoot() {
3940
*/
4041
@Deprecated
4142
public void setRoot(GitHub root) {
42-
this.root = root;
43+
throw new RuntimeException("Do not use this method.");
4344
}
4445

4546
/**
@@ -48,7 +49,7 @@ public void setRoot(GitHub root) {
4849
* @return the permissions
4950
*/
5051
public Map<String, String> getPermissions() {
51-
return permissions;
52+
return Collections.unmodifiableMap(permissions);
5253
}
5354

5455
/**
@@ -60,7 +61,7 @@ public Map<String, String> getPermissions() {
6061
*/
6162
@Deprecated
6263
public void setPermissions(Map<String, String> permissions) {
63-
this.permissions = permissions;
64+
throw new RuntimeException("Do not use this method.");
6465
}
6566

6667
/**
@@ -81,7 +82,7 @@ public String getToken() {
8182
*/
8283
@Deprecated
8384
public void setToken(String token) {
84-
this.token = token;
85+
throw new RuntimeException("Do not use this method.");
8586
}
8687

8788
/**
@@ -90,7 +91,7 @@ public void setToken(String token) {
9091
* @return the repositories
9192
*/
9293
public List<GHRepository> getRepositories() {
93-
return repositories;
94+
return GitHubClient.unmodifiableListOrNull(repositories);
9495
}
9596

9697
/**
@@ -102,7 +103,7 @@ public List<GHRepository> getRepositories() {
102103
*/
103104
@Deprecated
104105
public void setRepositories(List<GHRepository> repositories) {
105-
this.repositories = repositories;
106+
throw new RuntimeException("Do not use this method.");
106107
}
107108

108109
/**
@@ -123,7 +124,7 @@ public GHRepositorySelection getRepositorySelection() {
123124
*/
124125
@Deprecated
125126
public void setRepositorySelection(GHRepositorySelection repositorySelection) {
126-
this.repositorySelection = repositorySelection;
127+
throw new RuntimeException("Do not use this method.");
127128
}
128129

129130
/**

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.kohsuke.github;
22

33
import com.fasterxml.jackson.annotation.JsonIgnore;
4+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
45
import org.apache.commons.lang3.StringUtils;
56
import org.kohsuke.github.function.InputStreamFunction;
67

@@ -78,6 +79,7 @@ public Date getExpiresAt() {
7879
*
7980
* @return the repository
8081
*/
82+
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior")
8183
public GHRepository getRepository() {
8284
return owner;
8385
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.kohsuke.github;
22

3+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
4+
35
import java.io.IOException;
46
import java.net.URL;
57

@@ -85,6 +87,7 @@ public String getName() {
8587
*
8688
* @return the owner
8789
*/
90+
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior")
8891
public GHRepository getOwner() {
8992
return owner;
9093
}
@@ -93,7 +96,10 @@ public GHRepository getOwner() {
9396
* Gets root.
9497
*
9598
* @return the root
99+
* @deprecated This method should be used internally only.
96100
*/
101+
@Deprecated
102+
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior")
97103
public GitHub getRoot() {
98104
return root;
99105
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import java.net.URL;
66
import java.util.Collection;
7+
import java.util.Collections;
78
import java.util.List;
89

910
/**
@@ -48,7 +49,10 @@ public class GHAuthorization extends GHObject {
4849
* Gets root.
4950
*
5051
* @return the root
52+
* @deprecated This method should be used internally only.
5153
*/
54+
@Deprecated
55+
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior")
5256
public GitHub getRoot() {
5357
return root;
5458
}
@@ -59,7 +63,7 @@ public GitHub getRoot() {
5963
* @return the scopes
6064
*/
6165
public List<String> getScopes() {
62-
return scopes;
66+
return Collections.unmodifiableList(scopes);
6367
}
6468

6569
/**

0 commit comments

Comments
 (0)