From affe83d095982094f8b889683dbfa4a838b0af42 Mon Sep 17 00:00:00 2001 From: Oleg Nenashev Date: Mon, 20 Jul 2015 02:40:15 +0300 Subject: [PATCH] FindBugs: Cleanup UUF_UNUSED_FIELD warnings --- src/main/java/org/kohsuke/github/GHBranch.java | 7 +++++-- src/main/java/org/kohsuke/github/GHCommit.java | 10 ++++++++-- src/main/java/org/kohsuke/github/GHCommitComment.java | 6 +++++- src/main/java/org/kohsuke/github/GHEventInfo.java | 2 ++ .../org/kohsuke/github/GHPullRequestCommitDetail.java | 4 ++++ src/main/java/org/kohsuke/github/GHThread.java | 4 ++++ 6 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHBranch.java b/src/main/java/org/kohsuke/github/GHBranch.java index efc854518e..272c643f47 100644 --- a/src/main/java/org/kohsuke/github/GHBranch.java +++ b/src/main/java/org/kohsuke/github/GHBranch.java @@ -17,7 +17,10 @@ public class GHBranch { private Commit commit; public static class Commit { - String sha,url; + String sha; + + @SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "We don't provide it in API now") + String url; } public GitHub getRoot() { @@ -41,7 +44,7 @@ public String getName() { public String getSHA1() { return commit.sha; } - + @Override public String toString() { final String url = owner != null ? owner.getUrl().toString() : "unknown"; diff --git a/src/main/java/org/kohsuke/github/GHCommit.java b/src/main/java/org/kohsuke/github/GHCommit.java index 15b13781e6..b45683f2d2 100644 --- a/src/main/java/org/kohsuke/github/GHCommit.java +++ b/src/main/java/org/kohsuke/github/GHCommit.java @@ -156,13 +156,19 @@ public String getSha() { } public static class Parent { - String url,sha; + @SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "We don't provide it in API now") + String url; + String sha; } static class User { // TODO: what if someone who doesn't have an account on GitHub makes a commit? - String url,avatar_url,login,gravatar_id; + @SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "We don't provide it in API now") + String url,avatar_url,gravatar_id; + @SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "We don't provide it in API now") int id; + + String login; } String url,sha; diff --git a/src/main/java/org/kohsuke/github/GHCommitComment.java b/src/main/java/org/kohsuke/github/GHCommitComment.java index 1630153285..7020f9b98f 100644 --- a/src/main/java/org/kohsuke/github/GHCommitComment.java +++ b/src/main/java/org/kohsuke/github/GHCommitComment.java @@ -25,8 +25,12 @@ public class GHCommitComment extends GHObject { static class User { // TODO: what if someone who doesn't have an account on GitHub makes a commit? - String url,avatar_url,login,gravatar_id; + @SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "We don't provide it in API now") + String url,avatar_url,gravatar_id; + @SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "We don't provide it in API now") int id; + + String login; } public GHRepository getOwner() { diff --git a/src/main/java/org/kohsuke/github/GHEventInfo.java b/src/main/java/org/kohsuke/github/GHEventInfo.java index 89b79efb29..9772cba16e 100644 --- a/src/main/java/org/kohsuke/github/GHEventInfo.java +++ b/src/main/java/org/kohsuke/github/GHEventInfo.java @@ -32,7 +32,9 @@ public class GHEventInfo { @SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" }, justification = "JSON API") public static class GHEventRepository { + @SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "We don't provide it in API now") private int id; + @SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "We don't provide it in API now") private String url; // repository API URL private String name; // owner/repo } diff --git a/src/main/java/org/kohsuke/github/GHPullRequestCommitDetail.java b/src/main/java/org/kohsuke/github/GHPullRequestCommitDetail.java index 1abd024a29..d4b48da538 100644 --- a/src/main/java/org/kohsuke/github/GHPullRequestCommitDetail.java +++ b/src/main/java/org/kohsuke/github/GHPullRequestCommitDetail.java @@ -92,6 +92,10 @@ public URL getUrl() { public int getComment_count() { return comment_count; } + + public Tree getTree() { + return tree; + } } public static class CommitPointer { diff --git a/src/main/java/org/kohsuke/github/GHThread.java b/src/main/java/org/kohsuke/github/GHThread.java index c2d4aa12c0..a1964b10de 100644 --- a/src/main/java/org/kohsuke/github/GHThread.java +++ b/src/main/java/org/kohsuke/github/GHThread.java @@ -70,6 +70,10 @@ public String getTitle() { public String getType() { return subject.type; } + + public String getLastCommentUrl() { + return subject.latest_comment_url; + } /** * If this thread is about an issue, return that issue.