]> source.dussan.org Git - jgit.git/commitdiff
Format @Nullable on return value as method annotation 15/130715/1
authorJonathan Nieder <jrn@google.com>
Tue, 9 Oct 2018 22:48:16 +0000 (15:48 -0700)
committerJonathan Nieder <jrn@google.com>
Tue, 9 Oct 2018 22:52:54 +0000 (15:52 -0700)
For example, instead of using

public @Nullable String getMyFavoriteString() { ... }

use

@Nullable
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: I07f4e67cc149fb8007f696a4663e10d4bfc57e3a
Reported-by: Ivan Frade <ifrade@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LargeFileRepository.java
org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsRepository.java
org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/BuiltinLFS.java
org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/AtomicObjectOutputStream.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java
org.eclipse.jgit/src/org/eclipse/jgit/util/LfsFactory.java
org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java

index cfa53af9cdc7591972a58fa9d5f989534b47937f..4cb0277b64c80d379c62026856be04fdd431a28e 100644 (file)
@@ -82,7 +82,8 @@ public interface LargeFileRepository {
         * @return Action for verifying the object, or {@code null} if the server
         *         doesn't support or require verification
         */
-       public @Nullable Response.Action getVerifyAction(AnyLongObjectId id);
+       @Nullable
+       public Response.Action getVerifyAction(AnyLongObjectId id);
 
        /**
         * Get size of an object
index 55d9093241efc3cebec1675819032efb527e881d..0a7c37ca55086e3a0c2dc8c6691ad3d435bae65e 100644 (file)
@@ -99,7 +99,8 @@ public class FileLfsRepository implements LargeFileRepository {
 
        /** {@inheritDoc} */
        @Override
-       public @Nullable Action getVerifyAction(AnyLongObjectId id) {
+       @Nullable
+       public Action getVerifyAction(AnyLongObjectId id) {
                return null;
        }
 
index 415caa98598b32712ea6003932e87a14d5e5ebbc..56e3a12ddc9c3949b5ec4a57d1906c5188858459 100644 (file)
@@ -99,7 +99,8 @@ public class BuiltinLFS extends LfsFactory {
        }
 
        @Override
-       public @Nullable PrePushHook getPrePushHook(Repository repo,
+       @Nullable
+       public PrePushHook getPrePushHook(Repository repo,
                        PrintStream outputStream) {
                if (isEnabled(repo)) {
                        return new LfsPrePushHook(repo, outputStream);
index 0762ac5f1446ac22546c9e15882a678c1a3e02c4..317d68a980814d2b2440caf96ffa37049cfec9f2 100644 (file)
@@ -106,7 +106,8 @@ public class AtomicObjectOutputStream extends OutputStream {
         *         stream. May return {@code null} if called before closing this
         *         stream.
         */
-       public @Nullable AnyLongObjectId getId() {
+       @Nullable
+       public AnyLongObjectId getId() {
                return id;
        }
 
index 6b8d5c598e9810b8047649c79ee54fdce6fe3e8a..4f2ea64e16f361ba5f78c6eedd8f77725c927992 100644 (file)
@@ -106,7 +106,8 @@ public class TransferConfig {
                        this.name = name;
                }
 
-               static @Nullable ProtocolVersion parse(@Nullable String name) {
+               @Nullable
+               static ProtocolVersion parse(@Nullable String name) {
                        if (name == null) {
                                return null;
                        }
index 8c6cc52801b2fad7b7fce645b5dff59a99896c2c..96636b7994b0131bfeca8d24b1e2449a8680238b 100644 (file)
@@ -152,7 +152,8 @@ public class LfsFactory {
         * @param outputStream
         * @return a {@link PrePushHook} implementation or <code>null</code>
         */
-       public @Nullable PrePushHook getPrePushHook(Repository repo,
+       @Nullable
+       public PrePushHook getPrePushHook(Repository repo,
                        PrintStream outputStream) {
                return null;
        }
@@ -163,7 +164,8 @@ public class LfsFactory {
         *
         * @return a command to install LFS support.
         */
-       public @Nullable LfsInstallCommand getInstallCommand() {
+       @Nullable
+       public LfsInstallCommand getInstallCommand() {
                return null;
        }
 
index 28f406a49e692f875e643e82ee7d7169ef5fbc57..bbb1645c5925170b989c96fceab251fdb2e9f4ed 100644 (file)
@@ -729,7 +729,8 @@ public final class RawParseUtils {
                return map;
        }
 
-       private static @Nullable IntList lineMapOrNull(byte[] buf, int ptr, int end) {
+       @Nullable
+       private static IntList lineMapOrNull(byte[] buf, int ptr, int end) {
                // Experimentally derived from multiple source repositories
                // the average number of bytes/line is 36. Its a rough guess
                // to initially size our map close to the target.