]> source.dussan.org Git - jgit.git/commitdiff
Nullable: Switch to TYPE_USE 81/115581/1
authorDavid Pursehouse <david.pursehouse@gmail.com>
Thu, 18 Jan 2018 04:35:44 +0000 (13:35 +0900)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Thu, 18 Jan 2018 04:35:44 +0000 (13:35 +0900)
Since JGit now requires Java 8, we can switch to TYPE_USE instead
of explicitly specifying the target type.

Some of the existing uses of Nullable need to be reworked slightly
as described in [1] to prevent the compilation error:

  scoping construct cannot be annotated with type-use annotation

[1] https://stackoverflow.com/a/21385939/381622

Change-Id: Idba48f67a09353b5237685996ce828c8ca398168
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LargeFileRepository.java
org.eclipse.jgit/src/org/eclipse/jgit/annotations/Nullable.java
org.eclipse.jgit/src/org/eclipse/jgit/errors/CorruptObjectException.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/fsck/FsckError.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java

index cfa53af9cdc7591972a58fa9d5f989534b47937f..75bd549dda3f4a7a34bad7fc17bf4a731bfc7d02 100644 (file)
@@ -82,7 +82,7 @@ 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);
+       public Response.@Nullable Action getVerifyAction(AnyLongObjectId id);
 
        /**
         * Get size of an object
index f8a7a366d4fdefbdfa7db091b0e6b7b636319032..e914140ce4746f6cefba1b4074f41bf89f88d4ed 100644 (file)
 
 package org.eclipse.jgit.annotations;
 
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-
 import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
@@ -93,7 +89,7 @@ import java.lang.annotation.Target;
  */
 @Documented
 @Retention(RetentionPolicy.RUNTIME)
-@Target({ FIELD, METHOD, PARAMETER, LOCAL_VARIABLE })
+@Target(ElementType.TYPE_USE)
 public @interface Nullable {
        // marker annotation with no members
 }
index 4b503a302d0bb2363ef231571fa9b0374d0fbcf7..314c4e6dae8c260dbb28b0741915804b1bbedf3f 100644 (file)
@@ -140,8 +140,7 @@ public class CorruptObjectException extends IOException {
         * @return error condition or null.
         * @since 4.2
         */
-       @Nullable
-       public ObjectChecker.ErrorType getErrorType() {
+       public ObjectChecker.@Nullable ErrorType getErrorType() {
                return errorType;
        }
 }
index 131b0048ae664bfe61be04aa8cc2d2936136b506..3c6f38efb06fe989a50c702501acb0dcefc66b40 100644 (file)
@@ -89,8 +89,7 @@ public class FsckError {
                }
 
                /** @return error type of the corruption. */
-               @Nullable
-               public ObjectChecker.ErrorType getErrorType() {
+               public ObjectChecker.@Nullable ErrorType getErrorType() {
                        return errorType;
                }
        }
index 4c70725e4200c893da18a5fb4b9e56f67608b2f1..cd03a3d924534ec062ebda88593370c5b597db8a 100644 (file)
@@ -265,8 +265,7 @@ public class TransferConfig {
                        }
                }
 
-               @Nullable
-               static ObjectChecker.ErrorType parse(String key) {
+               static ObjectChecker.@Nullable ErrorType parse(String key) {
                        return errors.get(toLowerCase(key));
                }