-
Notifications
You must be signed in to change notification settings - Fork 736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove a few long deprecated methods and fully annotate others #719
Changes from all commits
1b63a58
fe4f45c
0155d5a
944d92b
5e5708d
56a51f1
ba8d2a2
5b57513
75d95d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,23 +63,14 @@ public class GHIssue extends GHObject implements Reactable { | |
protected int comments; | ||
@SkipFromToString | ||
protected String body; | ||
// for backward compatibility with < 1.63, this collection needs to hold instances of Label, not GHLabel | ||
protected List<Label> labels; | ||
protected List<GHLabel> labels; | ||
protected GHUser user; | ||
protected String title, html_url; | ||
protected GHIssue.PullRequest pull_request; | ||
protected GHMilestone milestone; | ||
protected GHUser closed_by; | ||
protected boolean locked; | ||
|
||
/** | ||
* The type Label. | ||
* | ||
* @deprecated use {@link GHLabel} | ||
*/ | ||
public static class Label extends GHLabel { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is publicly visible, but not returned from any properties. It exists in one spot (above). |
||
} | ||
|
||
GHIssue wrap(GHRepository owner) { | ||
this.owner = owner; | ||
if (milestone != null) | ||
|
@@ -172,7 +163,7 @@ public Collection<GHLabel> getLabels() throws IOException { | |
if (labels == null) { | ||
return Collections.emptyList(); | ||
} | ||
return Collections.<GHLabel>unmodifiableList(labels); | ||
return Collections.unmodifiableList(labels); | ||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
import java.io.IOException; | ||
import java.net.MalformedURLException; | ||
import java.net.URL; | ||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.Date; | ||
import java.util.Iterator; | ||
|
@@ -20,7 +19,7 @@ public abstract class GHPerson extends GHObject { | |
/* package almost final */ GitHub root; | ||
|
||
// core data fields that exist even for "small" user data (such as the user info in pull request) | ||
protected String login, avatar_url, gravatar_id; | ||
protected String login, avatar_url; | ||
|
||
// other fields (that only show up in full data) | ||
protected String location, blog, email, name, company, type; | ||
|
@@ -115,31 +114,27 @@ public PagedIterable<GHRepository> listRepositories(final int pageSize) { | |
*/ | ||
@Deprecated | ||
public synchronized Iterable<List<GHRepository>> iterateRepositories(final int pageSize) { | ||
return new Iterable<List<GHRepository>>() { | ||
public Iterator<List<GHRepository>> iterator() { | ||
final Iterator<GHRepository[]> pager; | ||
try { | ||
pager = GitHubPageIterator.create(root.getClient(), | ||
GHRepository[].class, | ||
root.createRequest().withUrlPath("users", login, "repos").build(), | ||
pageSize); | ||
} catch (MalformedURLException e) { | ||
throw new GHException("Unable to build GitHub API URL", e); | ||
return () -> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clean up to use even more of the existing code base. Still behaves the same. |
||
final PagedIterator<GHRepository> pager; | ||
try { | ||
GitHubPageIterator<GHRepository[]> iterator = GitHubPageIterator.create(root.getClient(), | ||
GHRepository[].class, | ||
root.createRequest().withUrlPath("users", login, "repos").build(), | ||
pageSize); | ||
pager = new PagedIterator<>(iterator, item -> item.wrap(root)); | ||
} catch (MalformedURLException e) { | ||
throw new GHException("Unable to build GitHub API URL", e); | ||
} | ||
|
||
return new Iterator<List<GHRepository>>() { | ||
public boolean hasNext() { | ||
return pager.hasNext(); | ||
} | ||
|
||
return new Iterator<List<GHRepository>>() { | ||
public boolean hasNext() { | ||
return pager.hasNext(); | ||
} | ||
|
||
public List<GHRepository> next() { | ||
GHRepository[] batch = pager.next(); | ||
for (GHRepository r : batch) | ||
r.root = root; | ||
return Arrays.asList(batch); | ||
} | ||
}; | ||
} | ||
public List<GHRepository> next() { | ||
return pager.nextPage(); | ||
} | ||
}; | ||
}; | ||
} | ||
|
||
|
@@ -178,22 +173,18 @@ public GHRepository getRepository(String name) throws IOException { | |
* @return the gravatar id | ||
* @deprecated No longer available in the v3 API. | ||
*/ | ||
@Deprecated | ||
public String getGravatarId() { | ||
return gravatar_id; | ||
return ""; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This always returns |
||
} | ||
|
||
/** | ||
* Returns a string like 'https://secure.gravatar.com/avatar/0cb9832a01c22c083390f3c5dcb64105' that indicates the | ||
* avatar image URL. | ||
* Returns a string of the avatar image URL. | ||
* | ||
* @return the avatar url | ||
*/ | ||
public String getAvatarUrl() { | ||
if (avatar_url != null) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is null, it is still more meaningful that the |
||
return avatar_url; | ||
if (gravatar_id != null) | ||
return "https://secure.gravatar.com/avatar/" + gravatar_id; | ||
return null; | ||
return avatar_url; | ||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v1.63 is 5 years ago.