Add our own Nullable implementation

When deploying Gerrit in an osgi container we see an issue where the
javax.annotation.Nullable annotation is not available at runtime.
As a consequence Guice injection throws an error if a (Nullable)
parameter is null.

A research on that topic reveals that this is caused by the Split
Package issue in osgi [1]. The javax.annotation.* package is split
as one part of it comes from JRE and another one from the jsr305
packaged in gerrit.war.

Since guice supports usage of any Nullable annotation type whose simple
name is "Nullable" [2], we can use own Nullable annotation type.

[1] http://wiki.osgi.org/wiki/Split_Packages
[2] https://code.google.com/p/google-guice/source/browse/core/src/com/google/inject/internal/Nullability.java

Change-Id: I63b27be6d695e73fd92940e42169d09f751d7274
This commit is contained in:
Sasa Zivkov
2013-09-26 16:44:32 +02:00
committed by Saša Živkov
parent 4edbf74578
commit d6ccccf96a
64 changed files with 90 additions and 107 deletions

View File

@@ -24,6 +24,7 @@ import com.google.common.collect.Sets;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningScheduledExecutorService;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.PatchSetApproval;
import com.google.gerrit.server.config.GerritServerConfig;
@@ -87,8 +88,6 @@ import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import javax.annotation.Nullable;
/**
* Secondary index implementation using Apache Lucene.
* <p>