aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.junit.http
diff options
context:
space:
mode:
authorJonathan Nieder <jrn@google.com>2015-12-07 12:56:32 -0800
committerJonathan Nieder <jrn@google.com>2015-12-07 19:26:23 -0500
commite12482deed7b6120b4f65da042dc73912c4c4075 (patch)
tree771d044ca81e293eeddec5a5d802a97f475054b1 /org.eclipse.jgit.junit.http
parent3d8e6b1e16092701c31463092e945b8f00886bb7 (diff)
downloadjgit-e12482deed7b6120b4f65da042dc73912c4c4075.tar.gz
jgit-e12482deed7b6120b4f65da042dc73912c4c4075.zip
Use runtime retention for Nullable annotation
JGit's Nullable type was added[1] in the hope of being able to add nullness annotations that (a) do not preclude building and running with Java 7 and (b) could be shared by Gerrit, which uses a custom Nullable type for other reasons[2]. Sharing a type is useful because Eclipse's null analysis is only able to use one Nullable type at a time in a given workspace (so for this analysis to function in a workspace used to develop Gerrit, JGit and Gerrit would need to use the same Nullable type). The new Nullable type has CLASS instead of RUNTIME retention because there wasn't any obvious use for the annotation at run time. Gerrit uses the Nullable annotation to communicate with Guice. Guice injection happens at runtime, so it needs to be able to read the @Nullable annotations at run time[3]. Otherwise Guice produces provisioning errors, such as 3) null returned by binding at com.google.gerrit.lucene.LuceneChangeIndex$Factory.create() but parameter 7 of com.google.gerrit.lucene.LuceneChangeIndex.<init>() is not @Nullable Switch to RUNTIME retention to avoid this. While at it, update the javadoc to explain more clearly how this annotation relates to other Nullable types[4]. This should make it clearer why JGit needed another Nullable type: A. Avoiding dependency on Java 8 B. RUNTIME retention to allow Guice to read the annotation at run time C. Named Nullable so Guice can recognize the annotation D. Not an addition to Java EE's javax.annotation package, to avoid the split-package problem[2] that prevents the annotation from being readable at run time when loaded from an OSGi container E. Avoiding heavyweight dependencies, deprecated dependencies, and dependencies on package internals org.checkerframework.checker.nullness.qual.Nullable: A com.sun.istack.internal.Nullable: B, E *.CheckForNull, *.NullAllowed, etc: C edu.umd.cs.findbugs.annotations.Nullable: B, E javax.annotation.Nullable: D org.eclipse.jdt.annotation.Nullable: B org.jetbrains.annotations.Nullable: B org.jmlspecs.annotation.Nullable: E android.annotation.Nullable, android.support.annotation.Nullable: E [1] https://git.eclipse.org/r/59993 [2] https://gerrit-review.googlesource.com/50112 [3] https://github.com/google/guice/blob/master/core/src/com/google/inject/internal/Nullability.java [4] https://github.com/typetools/checker-framework/blob/5832a01f1/checker/src/org/checkerframework/checker/nullness/NullnessAnnotatedTypeFactory.java#L118 http://types.cs.washington.edu/checker-framework/current/checker-framework-manual.html#nullness-related-work Change-Id: I6c482653d2b53e3509abb11211b67fc29cf2949c Signed-off-by: Jonathan Nieder <jrn@google.com>
Diffstat (limited to 'org.eclipse.jgit.junit.http')
0 files changed, 0 insertions, 0 deletions