]> source.dussan.org Git - jgit.git/commitdiff
Format @NonNull on return value as method annotation 16/130716/1
authorJonathan Nieder <jrn@google.com>
Tue, 9 Oct 2018 22:56:55 +0000 (15:56 -0700)
committerJonathan Nieder <jrn@google.com>
Tue, 9 Oct 2018 22:56:55 +0000 (15:56 -0700)
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>
org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java
org.eclipse.jgit/src/org/eclipse/jgit/events/WorkingTreeModifiedEvent.java
org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java

index 955eca0c3f2650db8f532244edbe1af2eb90f570..feb8b4ae5af9bbb152bd2f2c1bfa5dac2636efc0 100644 (file)
@@ -227,7 +227,8 @@ public class LfsConnectionFactory {
         * @throws IOException
         *             in case of any error.
         */
-       public static @NonNull HttpConnection getLfsContentConnection(
+       @NonNull
+       public static HttpConnection getLfsContentConnection(
                        Repository repo, Protocol.Action action, String method)
                        throws IOException {
                URL contentUrl = new URL(action.href);
index 9fbcc4dd5069400ceed3063c36d3be3820d20075..afd7889f8ae5f726d62eca5f79097d67dd26bb44 100644 (file)
@@ -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();
index 26e783ddd7f1d8026338c77472a65d82092cb409..8e463415b8332b24b86e4fb4f4109ac42e941272 100644 (file)
@@ -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;
        }
 
index 891c7f23b41c57861fba3d1675c91e6fd320fb9e..6a66cf682f22e70bd73ca92043a4b8cb0ad7e104 100644 (file)
@@ -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);