Browse Source

Nullable: Switch to TYPE_USE

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>
stable-4.11
David Pursehouse 7 years ago
parent
commit
8e217517e2
  1. 2
      org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LargeFileRepository.java
  2. 8
      org.eclipse.jgit/src/org/eclipse/jgit/annotations/Nullable.java
  3. 3
      org.eclipse.jgit/src/org/eclipse/jgit/errors/CorruptObjectException.java
  4. 3
      org.eclipse.jgit/src/org/eclipse/jgit/internal/fsck/FsckError.java
  5. 3
      org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java

2
org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LargeFileRepository.java

@ -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

8
org.eclipse.jgit/src/org/eclipse/jgit/annotations/Nullable.java

@ -43,12 +43,8 @@
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
}

3
org.eclipse.jgit/src/org/eclipse/jgit/errors/CorruptObjectException.java

@ -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;
}
}

3
org.eclipse.jgit/src/org/eclipse/jgit/internal/fsck/FsckError.java

@ -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;
}
}

3
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java

@ -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));
}

Loading…
Cancel
Save