summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2018-01-18 13:35:44 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2018-01-18 13:35:44 +0900
commit8e217517e2c515032dd0d661535d2133cd80123a (patch)
tree869968a82d3c8f86613c06937c838f92327db870 /org.eclipse.jgit
parent55eba8d0f55464ca84d676828f67a6fe14b2454d (diff)
downloadjgit-8e217517e2c515032dd0d661535d2133cd80123a.tar.gz
jgit-8e217517e2c515032dd0d661535d2133cd80123a.zip
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>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/annotations/Nullable.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/errors/CorruptObjectException.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/fsck/FsckError.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java3
4 files changed, 5 insertions, 12 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/annotations/Nullable.java b/org.eclipse.jgit/src/org/eclipse/jgit/annotations/Nullable.java
index f8a7a366d4..e914140ce4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/annotations/Nullable.java
+++ b/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
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/CorruptObjectException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/CorruptObjectException.java
index 4b503a302d..314c4e6dae 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/CorruptObjectException.java
+++ b/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;
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/fsck/FsckError.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/fsck/FsckError.java
index 131b0048ae..3c6f38efb0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/fsck/FsckError.java
+++ b/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;
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java
index 4c70725e42..cd03a3d924 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java
+++ b/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));
}