diff options
author | Jonathan Nieder <jrn@google.com> | 2018-10-09 15:56:55 -0700 |
---|---|---|
committer | Jonathan Nieder <jrn@google.com> | 2018-10-09 15:56:55 -0700 |
commit | b0991ca80530bc6f73fd92ad5e183f434d26da1a (patch) | |
tree | 24461699e0b33d4447325a71c994e74cb91a4062 /org.eclipse.jgit/src/org | |
parent | 608b6b03b1182329ae6f76a4c3938874dcc9c210 (diff) | |
download | jgit-b0991ca80530bc6f73fd92ad5e183f434d26da1a.tar.gz jgit-b0991ca80530bc6f73fd92ad5e183f434d26da1a.zip |
Format @NonNull on return value as method annotation
For example, instead of using
public @NonNull String getMyFavoriteString() { ... }
use
@NonNull
public String getMyFavoriteString() { ... }
This makes the style more consistent (the existing JGit code base
tends to lean toward the second style) and makes the source code
better reflect how the annotation is parsed, as a METHOD annotation.
Longer term, we should switch to a TYPE_USE annotation and switch to
the first style.
Noticed using a style checker that follows
https://google.github.io/styleguide/javaguide.html#s4.8.5-annotations
Change-Id: I9b9fa08035d805ca660520f812a84d2f47eff507
Reported-by: Ivan Frade <ifrade@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
Diffstat (limited to 'org.eclipse.jgit/src/org')
3 files changed, 8 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/events/WorkingTreeModifiedEvent.java b/org.eclipse.jgit/src/org/eclipse/jgit/events/WorkingTreeModifiedEvent.java index 9fbcc4dd50..afd7889f8a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/events/WorkingTreeModifiedEvent.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/events/WorkingTreeModifiedEvent.java @@ -94,7 +94,8 @@ public class WorkingTreeModifiedEvent * * @return the set */ - public @NonNull Collection<String> getModified() { + @NonNull + public Collection<String> getModified() { Collection<String> result = modified; if (result == null) { result = Collections.emptyList(); @@ -109,7 +110,8 @@ public class WorkingTreeModifiedEvent * * @return the set */ - public @NonNull Collection<String> getDeleted() { + @NonNull + public Collection<String> getDeleted() { Collection<String> result = deleted; if (result == null) { result = Collections.emptyList(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java index 26e783ddd7..8e463415b8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java @@ -358,7 +358,8 @@ public class ManifestParser extends DefaultHandler { * * @return filtered projects list reference, never null */ - public @NonNull List<RepoProject> getFilteredProjects() { + @NonNull + public List<RepoProject> getFilteredProjects() { return filteredProjects; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java index 891c7f23b4..6a66cf682f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java @@ -293,7 +293,8 @@ public class DefaultTypedConfigGetter implements TypedConfigGetter { /** {@inheritDoc} */ @Override - public @NonNull List<RefSpec> getRefSpecs(Config config, String section, + @NonNull + public List<RefSpec> getRefSpecs(Config config, String section, String subsection, String name) { String[] values = config.getStringList(section, subsection, name); List<RefSpec> result = new ArrayList<>(values.length); |