aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/annotations/Nullable.java
Commit message (Collapse)AuthorAgeFilesLines
* Update EDL 1.0 license headers to new short SPDX compliant formatMatthias Sohn2020-01-041-38/+5
| | | | | | | | | | This is the format given by the Eclipse legal doc generator [1]. [1] https://www.eclipse.org/projects/tools/documentation.php?id=technology.jgit Bug: 548298 Change-Id: I8d8cabc998ba1b083e3f0906a8d558d391ffb6c4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Revert usage of TYPE_USE in Nullable and NonNull annotationsDavid Pursehouse2018-01-191-2/+6
| | | | | | | | | | | | Using TYPE_USE causes compilation errors in Eclipse Neon.3 (JDT 3.12.3) and Eclipse Oxygen.2 (JDT 3.13.2). This reverts commit 8e217517e2c515032dd0d661535d2133cd80123a. This reverts commit 55eba8d0f55464ca84d676828f67a6fe14b2454d. Reported-by: Thomas Wolf <thomas.wolf@paranor.ch> Change-Id: I96869f80dd11ee238911706581b224bca4fb12cd Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Nullable: Switch to TYPE_USEDavid Pursehouse2018-01-181-6/+2
| | | | | | | | | | | | | | | 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>
* Fix javadoc in org.eclipse.jgit annotations and api packagesMatthias Sohn2017-12-181-1/+0
| | | | Change-Id: I2761ea91f8dfed16ea54e7a6646af03a30c15ec9 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Use runtime retention for Nullable annotationJonathan Nieder2015-12-071-4/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Make jgit annotations accessible to other pluginsAndrey Loskutov2015-11-171-0/+2
| | | | | | | | | | | | | | | Other plugins which want to use JGit nullness annotations in their code cannot do this if the annotations aren't part of the published API. Unfortunately it looks like although Eclipse JDT allows to use custom nullness annotation types per project, it does not understand if those annotations are used mixed with other nullness annotations in other projects. E.g. EGit can either configure JGit annotations for NPE analysis and so "understand" nullness from JGit API but so it loses the ability to use any other nullness annotations to annotate its own code. Change-Id: Ieeeb578c2fe35223a7561d668dce8e767dc89ef0 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* Add a JGit-internal Nullable typeTerry Parker2015-11-091-0/+67
Commit 847b3d1 enabled annotation-based NPE analysis to JGit. In so doing, it introduced a new dependency on the org.eclipse.jdt that is undesirable. Follow Gerrit's lead by adding an internal Nullable type (see https://gerrit.googlesource.com/gerrit/+/stable-2.11/gerrit-common/src/main/java/com/google/gerrit/common/Nullable.java). The javax.annotations.Nullable class uses a retention policy of RUNTIME, whereas the org.eclipse.jdt.annotation.Nullable class used a policy of CLASS. Since I'm not aware of tools that make use of the annotation at runtime I chose the CLASS policy. If in the future there is a benefit to retaining the annotations in the running binary we can update this class. Change-Id: I63dc8f9a6dc46b517cbde211bb5e2f8521a54d04 Signed-off-by: Terry Parker <tparker@google.com>