11package org .kohsuke .github ;
22
33import com .fasterxml .jackson .annotation .JsonProperty ;
4+ import edu .umd .cs .findbugs .annotations .SuppressFBWarnings ;
45import org .kohsuke .github .internal .EnumUtils ;
56
67import java .io .IOException ;
78import java .net .MalformedURLException ;
89import java .net .URL ;
10+ import java .util .Collections ;
911import java .util .List ;
1012import java .util .Map ;
1113import 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 ) {
0 commit comments