Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cfcf81a

Browse filesBrowse files
committed
Followup cleanup based on root streamlining
1 parent 29b01f6 commit cfcf81a
Copy full SHA for cfcf81a

File tree

Expand file treeCollapse file tree

70 files changed

+290
-631
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

70 files changed

+290
-631
lines changed

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

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHApp.java
+5-13Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,6 @@ public void setPermissions(Map<String, String> permissions) {
183183
throw new RuntimeException("Do not use this method.");
184184
}
185185

186-
GHApp wrapUp(GitHub root) {
187-
return this;
188-
}
189-
190186
/**
191187
* Obtains all the installations associated with this app.
192188
* <p>
@@ -200,7 +196,7 @@ public PagedIterable<GHAppInstallation> listInstallations() {
200196
return root().createRequest()
201197
.withPreview(MACHINE_MAN)
202198
.withUrlPath("/app/installations")
203-
.toIterable(GHAppInstallation[].class, item -> item.wrapUp(root()));
199+
.toIterable(GHAppInstallation[].class, null);
204200
}
205201

206202
/**
@@ -220,8 +216,7 @@ public GHAppInstallation getInstallationById(long id) throws IOException {
220216
return root().createRequest()
221217
.withPreview(MACHINE_MAN)
222218
.withUrlPath(String.format("/app/installations/%d", id))
223-
.fetch(GHAppInstallation.class)
224-
.wrapUp(root());
219+
.fetch(GHAppInstallation.class);
225220
}
226221

227222
/**
@@ -242,8 +237,7 @@ public GHAppInstallation getInstallationByOrganization(String name) throws IOExc
242237
return root().createRequest()
243238
.withPreview(MACHINE_MAN)
244239
.withUrlPath(String.format("/orgs/%s/installation", name))
245-
.fetch(GHAppInstallation.class)
246-
.wrapUp(root());
240+
.fetch(GHAppInstallation.class);
247241
}
248242

249243
/**
@@ -266,8 +260,7 @@ public GHAppInstallation getInstallationByRepository(String ownerName, String re
266260
return root().createRequest()
267261
.withPreview(MACHINE_MAN)
268262
.withUrlPath(String.format("/repos/%s/%s/installation", ownerName, repositoryName))
269-
.fetch(GHAppInstallation.class)
270-
.wrapUp(root());
263+
.fetch(GHAppInstallation.class);
271264
}
272265

273266
/**
@@ -287,8 +280,7 @@ public GHAppInstallation getInstallationByUser(String name) throws IOException {
287280
return root().createRequest()
288281
.withPreview(MACHINE_MAN)
289282
.withUrlPath(String.format("/users/%s/installation", name))
290-
.fetch(GHAppInstallation.class)
291-
.wrapUp(root());
283+
.fetch(GHAppInstallation.class);
292284
}
293285

294286
}

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

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHAppCreateTokenBuilder.java
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ public GHAppInstallationToken create() throws IOException {
7878
return builder.method("POST")
7979
.withPreview(MACHINE_MAN)
8080
.withUrlPath(apiUrlTail)
81-
.fetch(GHAppInstallationToken.class)
82-
.wrapUp(root());
81+
.fetch(GHAppInstallationToken.class);
8382
}
8483

8584
}

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

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHAppInstallation.java
+2-6Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ private static class GHAppInstallationRepositoryResult extends SearchResult<GHRe
137137

138138
@Override
139139
GHRepository[] getItems(GitHub root) {
140-
for (GHRepository item : repositories)
141-
item.wrap(root);
140+
for (GHRepository item : repositories) {
141+
}
142142
return repositories;
143143
}
144144
}
@@ -304,10 +304,6 @@ public void setRepositorySelection(GHRepositorySelection repositorySelection) {
304304
throw new RuntimeException("Do not use this method.");
305305
}
306306

307-
GHAppInstallation wrapUp(GitHub root) {
308-
return this;
309-
}
310-
311307
/**
312308
* Delete a Github App installation
313309
* <p>

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

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHAppInstallationToken.java
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,4 @@ public Date getExpiresAt() throws IOException {
131131
private Object expiresAtStr(Date id, Class type) {
132132
return expires_at;
133133
}
134-
135-
GHAppInstallationToken wrapUp(GitHub root) {
136-
return this;
137-
}
138134
}

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

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHArtifact.java
+2-6Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,8 @@ private String getApiRoute() {
130130

131131
GHArtifact wrapUp(GHRepository owner) {
132132
this.owner = owner;
133-
return wrapUp(owner.root());
134-
}
135-
136-
GHArtifact wrapUp(GitHub root) {
137-
if (owner != null)
138-
owner.wrap(root);
133+
this.owner = owner;
139134
return this;
140135
}
136+
141137
}

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

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHAsset.java
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ private String getApiRoute() {
147147

148148
GHAsset wrap(GHRelease release) {
149149
this.owner = release.getOwner();
150-
owner.root();
151150
return this;
152151
}
153152

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

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHAuthorization.java
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,6 @@ public String getFingerprint() {
146146
return fingerprint;
147147
}
148148

149-
GHAuthorization wrap(GitHub root) {
150-
return this;
151-
}
152-
153149
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD" },
154150
justification = "JSON API")
155151
private static class App {

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

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHBranch.java
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ public GHBranchProtection getProtection() throws IOException {
9797
return root().createRequest()
9898
.withPreview(Previews.LUKE_CAGE)
9999
.setRawUrlPath(protection_url)
100-
.fetch(GHBranchProtection.class)
101-
.wrap(this);
100+
.fetch(GHBranchProtection.class);
102101
}
103102

104103
/**
@@ -222,7 +221,6 @@ public String toString() {
222221

223222
GHBranch wrap(GHRepository repo) {
224223
this.owner = repo;
225-
repo.root();
226224
return this;
227225
}
228226
}

‎src/main/java/org/kohsuke/github/GHBranchProtection.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHBranchProtection.java
-5Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,6 @@ public String getUrl() {
115115
return url;
116116
}
117117

118-
GHBranchProtection wrap(GHBranch branch) {
119-
branch.root();
120-
return this;
121-
}
122-
123118
private Requester requester() {
124119
return root().createRequest().withPreview(ZZZAX);
125120
}

‎src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ public GHBranchProtection enable() throws IOException {
9494
.withNullable("restrictions", restrictions)
9595
.withNullable("enforce_admins", enforceAdmins)
9696
.withUrlPath(branch.getProtectionUrl().toString())
97-
.fetch(GHBranchProtection.class)
98-
.wrap(branch);
97+
.fetch(GHBranchProtection.class);
9998
}
10099

101100
/**

‎src/main/java/org/kohsuke/github/GHCheckRun.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHCheckRun.java
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ GHCheckRun wrap(GHRepository owner) {
5050

5151
GHCheckRun wrap(GitHub root) {
5252
if (owner != null) {
53-
owner.wrap(root);
5453
for (GHPullRequest singlePull : pullRequests) {
5554
singlePull.wrap(owner);
5655
}
@@ -62,9 +61,6 @@ GHCheckRun wrap(GitHub root) {
6261
checkSuite.wrap(root);
6362
}
6463
}
65-
if (app != null) {
66-
app.wrapUp(root);
67-
}
6864

6965
return this;
7066
}

‎src/main/java/org/kohsuke/github/GHCheckSuite.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHCheckSuite.java
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,12 @@ GHCheckSuite wrap(GHRepository owner) {
4343

4444
GHCheckSuite wrap(GitHub root) {
4545
if (owner != null) {
46-
owner.wrap(root);
4746
if (pullRequests != null && pullRequests.length != 0) {
4847
for (GHPullRequest singlePull : pullRequests) {
4948
singlePull.wrap(owner);
5049
}
5150
}
5251
}
53-
if (app != null) {
54-
app.wrapUp(root);
55-
}
5652
return this;
5753
}
5854

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

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHCommitComment.java
+3-7Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public int getLine() {
9191
* the io exception
9292
*/
9393
public GHUser getUser() throws IOException {
94-
return owner == null || owner.root().isOffline() ? user : owner.root().getUser(user.login);
94+
return owner == null || owner.isOffline() ? user : owner.root().getUser(user.login);
9595
}
9696

9797
/**
@@ -131,8 +131,7 @@ public GHReaction createReaction(ReactionContent content) throws IOException {
131131
.withPreview(SQUIRREL_GIRL)
132132
.with("content", content.getContent())
133133
.withUrlPath(getApiTail() + "/reactions")
134-
.fetch(GHReaction.class)
135-
.wrap(owner.root());
134+
.fetch(GHReaction.class);
136135
}
137136

138137
@Preview(SQUIRREL_GIRL)
@@ -141,7 +140,7 @@ public PagedIterable<GHReaction> listReactions() {
141140
.createRequest()
142141
.withPreview(SQUIRREL_GIRL)
143142
.withUrlPath(getApiTail() + "/reactions")
144-
.toIterable(GHReaction[].class, item -> item.wrap(owner.root()));
143+
.toIterable(GHReaction[].class, item -> owner.root());
145144
}
146145

147146
/**
@@ -160,9 +159,6 @@ private String getApiTail() {
160159

161160
GHCommitComment wrap(GHRepository owner) {
162161
this.owner = owner;
163-
if (owner.root().isOffline()) {
164-
user.wrapUp(owner.root());
165-
}
166162
return this;
167163
}
168164
}

‎src/main/java/org/kohsuke/github/GHCommitPointer.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHCommitPointer.java
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,4 @@ public GHCommit getCommit() throws IOException {
9999
return getRepository().getCommit(getSha());
100100
}
101101

102-
void wrapUp(GitHub root) {
103-
if (user != null) {
104-
}
105-
if (repo != null)
106-
repo.wrap(root);
107-
}
108102
}

‎src/main/java/org/kohsuke/github/GHCommitStatus.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHCommitStatus.java
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ public class GHCommitStatus extends GHObject {
1818
String context;
1919
GHUser creator;
2020

21-
GHCommitStatus wrapUp(GitHub root) {
22-
if (creator != null)
23-
creator.wrapUp(root);
24-
return this;
25-
}
26-
2721
/**
2822
* Gets state.
2923
*

‎src/main/java/org/kohsuke/github/GHContent.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHContent.java
-7Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -386,13 +386,6 @@ static String getApiRoute(GHRepository repository, String path) {
386386

387387
GHContent wrap(GHRepository owner) {
388388
this.repository = owner;
389-
owner.root();
390-
return this;
391-
}
392-
393-
GHContent wrap(GitHub root) {
394-
if (repository != null)
395-
repository.wrap(root);
396389
return this;
397390
}
398391

‎src/main/java/org/kohsuke/github/GHContentSearchBuilder.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHContentSearchBuilder.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ private static class ContentSearchResult extends SearchResult<GHContent> {
158158

159159
@Override
160160
GHContent[] getItems(GitHub root) {
161-
for (GHContent item : items)
162-
item.wrap(root);
161+
for (GHContent item : items) {
162+
}
163163
return items;
164164
}
165165
}

‎src/main/java/org/kohsuke/github/GHContentWithLicense.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHContentWithLicense.java
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ class GHContentWithLicense extends GHContent {
1313
@Override
1414
GHContentWithLicense wrap(GHRepository owner) {
1515
super.wrap(owner);
16-
if (license != null)
17-
license.wrap(owner.root());
1816
return this;
1917
}
2018
}

‎src/main/java/org/kohsuke/github/GHDeployment.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHDeployment.java
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ public class GHDeployment extends GHObject {
3232

3333
GHDeployment wrap(GHRepository owner) {
3434
this.owner = owner;
35-
owner.root();
36-
if (creator != null)
37-
creator.wrapUp(root());
3835
return this;
3936
}
4037

@@ -201,4 +198,8 @@ public PagedIterable<GHDeploymentStatus> listStatuses() {
201198
.toIterable(GHDeploymentStatus[].class, item -> item.lateBind(owner));
202199
}
203200

201+
// test only
202+
GHRepository getOwner() {
203+
return owner;
204+
}
204205
}

‎src/main/java/org/kohsuke/github/GHDeploymentStatus.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHDeploymentStatus.java
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ public GHDeploymentStatus wrap(GHRepository owner) {
4242
*/
4343
GHDeploymentStatus lateBind(GHRepository owner) {
4444
this.owner = owner;
45-
owner.root();
46-
if (creator != null)
47-
creator.wrapUp(root());
4845
return this;
4946
}
5047

@@ -120,4 +117,9 @@ public GHDeploymentState getState() {
120117
public URL getHtmlUrl() {
121118
return null;
122119
}
120+
121+
// test only
122+
GHRepository getOwner() {
123+
return owner;
124+
}
123125
}

‎src/main/java/org/kohsuke/github/GHEventInfo.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHEventInfo.java
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ public GHEvent getType() {
9191
return transformTypeToGHEvent(type);
9292
}
9393

94-
GHEventInfo wrapUp(GitHub root) {
95-
return this;
96-
}
97-
9894
/**
9995
* Gets id.
10096
*
@@ -177,7 +173,7 @@ public GHOrganization getOrganization() throws IOException {
177173
*/
178174
public <T extends GHEventPayload> T getPayload(Class<T> type) throws IOException {
179175
T v = GitHubClient.getMappingObjectReader(root()).readValue(payload.traverse(), type);
180-
v.wrapUp(root());
176+
v.lateBind();
181177
return v;
182178
}
183179
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.