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.gerrit.acceptance.AccountCreator;
import com.google.gerrit.acceptance.RestResponse;
import com.google.gerrit.acceptance.RestSession;
import com.google.gerrit.acceptance.TestAccount;
import com.google.gerrit.common.Nullable;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.google.inject.Inject;
@ -36,8 +37,6 @@ import java.io.IOException;
import java.util.Collection;
import java.util.List;
import javax.annotation.Nullable;
public class ListGroupIncludesIT extends AbstractDaemonTest {
@Inject

View File

@ -25,6 +25,7 @@ import com.google.gerrit.acceptance.RestResponse;
import com.google.gerrit.acceptance.RestSession;
import com.google.gerrit.acceptance.TestAccount;
import com.google.gerrit.acceptance.rest.account.AccountInfo;
import com.google.gerrit.common.Nullable;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.google.inject.Inject;
@ -37,8 +38,6 @@ import java.io.IOException;
import java.util.Collection;
import java.util.List;
import javax.annotation.Nullable;
public class ListGroupMembersIT extends AbstractDaemonTest {
@Inject

View File

@ -25,6 +25,7 @@ import com.google.gerrit.acceptance.AccountCreator;
import com.google.gerrit.acceptance.RestResponse;
import com.google.gerrit.acceptance.RestSession;
import com.google.gerrit.acceptance.TestAccount;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.server.account.GroupCache;
import com.google.gson.Gson;
@ -41,8 +42,6 @@ import java.io.IOException;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
public class ListGroupsIT extends AbstractDaemonTest {
@Inject

View File

@ -0,0 +1,26 @@
// Copyright (C) 2013 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.common;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
/**
* Gerrit's own replacement for the javax.annotations.Nullable
*/
@Retention(RUNTIME)
public @interface Nullable {
}

View File

@ -14,10 +14,9 @@
package com.google.gerrit.common.data;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.reviewdb.client.AccountGroup;
import javax.annotation.Nullable;
/**
* Group methods exposed by the GroupBackend.
*/

View File

@ -14,11 +14,10 @@
package com.google.gerrit.common.data;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.PageLinks;
import com.google.gerrit.reviewdb.client.AccountGroup;
import javax.annotation.Nullable;
/**
* Utility class for building GroupDescription objects.
*/

View File

@ -28,6 +28,7 @@ import com.google.gerrit.client.ui.AddMemberBox;
import com.google.gerrit.client.ui.FancyFlexTable;
import com.google.gerrit.client.ui.Hyperlink;
import com.google.gerrit.client.ui.SmallHeading;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
@ -42,8 +43,6 @@ import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import javax.annotation.Nullable;
public class AccountGroupMembersScreen extends AccountGroupScreen {
private MemberTable members;

View File

@ -14,9 +14,9 @@
package com.google.gerrit.httpd;
import javax.annotation.Nullable;
import javax.servlet.http.HttpServletRequest;
import com.google.gerrit.common.Nullable;
import com.google.inject.Inject;
import com.google.inject.Provider;

View File

@ -17,6 +17,7 @@ package com.google.gerrit.httpd;
import com.google.gerrit.audit.AuditEvent;
import com.google.gerrit.audit.AuditService;
import com.google.common.base.Strings;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.server.CurrentUser;
import com.google.gerrit.server.account.AccountManager;
import com.google.gerrit.server.config.AuthConfig;
@ -27,7 +28,6 @@ import com.google.inject.Singleton;
import java.io.IOException;
import javax.annotation.Nullable;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

View File

@ -20,6 +20,7 @@ import static javax.servlet.http.HttpServletResponse.SC_FORBIDDEN;
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.server.AccessPath;
import com.google.gerrit.server.account.AccountCache;
import com.google.gerrit.server.account.AccountState;
@ -42,7 +43,6 @@ import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import javax.annotation.Nullable;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;

View File

@ -14,6 +14,7 @@
package com.google.gerrit.httpd;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.server.config.CanonicalWebUrl;
import com.google.inject.Inject;
import com.google.inject.Provider;
@ -22,7 +23,6 @@ import com.google.inject.servlet.ServletModule;
import java.io.IOException;
import javax.annotation.Nullable;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;

View File

@ -17,6 +17,7 @@ package com.google.gerrit.httpd;
import static com.google.gerrit.extensions.registration.PrivateInternals_DynamicTypes.registerInParentInjectors;
import static com.google.inject.Scopes.SINGLETON;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.GerritConfig;
import com.google.gerrit.extensions.registration.DynamicSet;
import com.google.gerrit.extensions.webui.WebUiPlugin;
@ -45,8 +46,6 @@ import com.google.inject.servlet.RequestScoped;
import java.net.SocketAddress;
import javax.annotation.Nullable;
public class WebModule extends FactoryModule {
private final AuthConfig authConfig;
private final UrlModule.UrlConfig urlConfig;

View File

@ -14,6 +14,7 @@
package com.google.gerrit.httpd.auth.container;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.PageLinks;
import com.google.gerrit.server.config.CanonicalWebUrl;
import com.google.gwtexpui.server.CacheHeaders;
@ -23,7 +24,6 @@ import com.google.inject.Singleton;
import java.io.IOException;
import javax.annotation.Nullable;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

View File

@ -16,6 +16,7 @@ package com.google.gerrit.httpd.auth.ldap;
import com.google.common.base.Objects;
import com.google.common.base.Strings;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.PageLinks;
import com.google.gerrit.httpd.CanonicalWebUrl;
import com.google.gerrit.httpd.HtmlDomUtil;
@ -39,7 +40,6 @@ import org.w3c.dom.Element;
import java.io.IOException;
import javax.annotation.Nullable;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;

View File

@ -14,9 +14,10 @@
package com.google.gerrit.httpd.plugins;
import com.google.gerrit.common.Nullable;
import java.io.IOException;
import javax.annotation.Nullable;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

View File

@ -31,6 +31,7 @@ import com.google.common.cache.Weigher;
import com.google.common.collect.Maps;
import com.google.common.hash.Hashing;
import com.google.common.io.ByteStreams;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.httpd.HtmlDomUtil;
import com.google.gerrit.server.config.GerritServerConfig;
import com.google.gerrit.server.config.SitePaths;
@ -51,7 +52,6 @@ import java.io.OutputStream;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import javax.annotation.Nullable;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

View File

@ -46,6 +46,7 @@ import com.google.common.math.IntMath;
import com.google.common.net.HttpHeaders;
import com.google.gerrit.audit.AuditService;
import com.google.gerrit.audit.HttpAuditEvent;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.extensions.registration.DynamicMap;
import com.google.gerrit.extensions.restapi.AcceptsCreate;
import com.google.gerrit.extensions.restapi.AcceptsPost;
@ -117,7 +118,6 @@ import java.util.Set;
import java.util.regex.Pattern;
import java.util.zip.GZIPOutputStream;
import javax.annotation.Nullable;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;

View File

@ -16,6 +16,7 @@ package com.google.gerrit.httpd.rpc;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.AccountInfo;
import com.google.gerrit.common.data.GroupReference;
import com.google.gerrit.common.data.ReviewerInfo;
@ -54,8 +55,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
class SuggestServiceImpl extends BaseServiceImplementation implements
SuggestService {
private static final String MAX_SUFFIX = "\u9fa5";

View File

@ -14,6 +14,7 @@
package com.google.gerrit.httpd.rpc.changedetail;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.ChangeDetail;
import com.google.gerrit.common.errors.EmailException;
import com.google.gerrit.common.errors.NoSuchEntityException;
@ -44,8 +45,6 @@ import org.eclipse.jgit.lib.Repository;
import java.io.IOException;
import javax.annotation.Nullable;
class EditCommitMessageHandler extends Handler<ChangeDetail> {
interface Factory {
EditCommitMessageHandler create(PatchSet.Id patchSetId, String message);

View File

@ -17,6 +17,7 @@ package com.google.gerrit.httpd.rpc.changedetail;
import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.PatchSetDetail;
import com.google.gerrit.common.data.UiCommandDetail;
import com.google.gerrit.common.errors.NoSuchEntityException;
@ -58,8 +59,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
/** Creates a {@link PatchSetDetail} from a {@link PatchSet}. */
class PatchSetDetailFactory extends Handler<PatchSetDetail> {

View File

@ -14,6 +14,7 @@
package com.google.gerrit.httpd.rpc.project;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.AccessSection;
import com.google.gerrit.common.data.ProjectAccess;
import com.google.gerrit.reviewdb.client.Project;
@ -32,8 +33,6 @@ import org.eclipse.jgit.lib.ObjectId;
import java.io.IOException;
import java.util.List;
import javax.annotation.Nullable;
class ChangeProjectAccess extends ProjectAccessHandler<ProjectAccess> {
interface Factory {
ChangeProjectAccess create(@Assisted Project.NameKey projectName,

View File

@ -14,6 +14,7 @@
package com.google.gerrit.httpd.rpc.project;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.AccessSection;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.reviewdb.client.Branch;
@ -49,8 +50,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
public class ReviewProjectAccess extends ProjectAccessHandler<Change.Id> {
interface Factory {
ReviewProjectAccess create(@Assisted Project.NameKey projectName,

View File

@ -22,6 +22,7 @@ java_library(
deps = [
':query_builder',
'//gerrit-antlr:query_exception',
'//gerrit-common:server',
'//gerrit-extension-api:api',
'//gerrit-reviewdb:server',
'//gerrit-server:server',

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>

View File

@ -19,6 +19,7 @@ import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.PageLinks;
import com.google.gerrit.common.auth.openid.OpenIdUrls;
import com.google.gerrit.extensions.restapi.Url;
@ -42,7 +43,6 @@ import java.io.IOException;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;

View File

@ -14,6 +14,7 @@ java_library(
name = 'init-api',
srcs = INIT_API_SRCS,
deps = [
'//gerrit-common:server',
'//gerrit-server:server',
'//lib:jsr305',
'//lib/guice:guice',

View File

@ -14,6 +14,7 @@
package com.google.gerrit.pgm.init;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.pgm.util.ConsoleUI;
import com.google.gerrit.server.config.ConfigUtil;
import com.google.gerrit.server.config.SitePaths;
@ -25,8 +26,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Set;
import javax.annotation.Nullable;
/** Helper to edit a section of the configuration files. */
public class Section {
public interface Factory {

View File

@ -16,6 +16,7 @@ package com.google.gerrit.server;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.AccountInfo;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.AccountDiffPreference;
@ -59,8 +60,6 @@ import java.util.List;
import java.util.Set;
import java.util.TimeZone;
import javax.annotation.Nullable;
/** An authenticated user. */
public class IdentifiedUser extends CurrentUser {
/** Create an IdentifiedUser, ignoring any per-request state. */

View File

@ -16,6 +16,7 @@ package com.google.gerrit.server.account;
import static com.google.gerrit.reviewdb.client.AccountExternalId.SCHEME_USERNAME;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.errors.InvalidUserNameException;
import com.google.gerrit.common.errors.NameAlreadyUsedException;
import com.google.gerrit.reviewdb.client.Account;
@ -36,8 +37,6 @@ import java.util.Collections;
import java.util.concurrent.Callable;
import java.util.regex.Pattern;
import javax.annotation.Nullable;
/** Operation to change the username of an account. */
public class ChangeUserName implements Callable<VoidResult> {
private static final Pattern USER_NAME_PATTERN =

View File

@ -14,6 +14,7 @@
package com.google.gerrit.server.account;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.GroupDescription;
import com.google.gerrit.common.data.GroupReference;
import com.google.gerrit.extensions.annotations.ExtensionPoint;
@ -23,8 +24,6 @@ import com.google.gerrit.server.project.ProjectControl;
import java.util.Collection;
import javax.annotation.Nullable;
/**
* Implementations of GroupBackend provide lookup and membership accessors
* to a group system.

View File

@ -15,6 +15,7 @@
package com.google.gerrit.server.account;
import com.google.common.collect.Iterables;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.GroupReference;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.server.project.ProjectControl;
@ -22,8 +23,6 @@ import com.google.gerrit.server.project.ProjectControl;
import java.util.Collection;
import java.util.Comparator;
import javax.annotation.Nullable;
/**
* Utility class for dealing with a GroupBackend.
*/

View File

@ -14,10 +14,9 @@
package com.google.gerrit.server.account;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.reviewdb.client.AccountGroup;
import javax.annotation.Nullable;
/** Tracks group objects in memory for efficient access. */
public interface GroupCache {
public AccountGroup get(AccountGroup.Id groupId);

View File

@ -21,6 +21,7 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.GroupDescription;
import com.google.gerrit.common.data.GroupReference;
import com.google.gerrit.extensions.registration.DynamicSet;
@ -37,8 +38,6 @@ import java.util.Collection;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
/**
* Universal implementation of the GroupBackend that works with the injected
* set of GroupBackends.

View File

@ -15,8 +15,7 @@
package com.google.gerrit.server.auth;
import com.google.common.base.Objects;
import javax.annotation.Nullable;
import com.google.gerrit.common.Nullable;
/**
* Defines an abstract request for user authentication to Gerrit.

View File

@ -16,7 +16,7 @@ package com.google.gerrit.server.auth;
import static com.google.common.base.Preconditions.checkNotNull;
import javax.annotation.Nullable;
import com.google.gerrit.common.Nullable;
/**
* An authenticated user as specified by the AuthBackend.

View File

@ -21,6 +21,7 @@ import static com.google.gerrit.server.auth.ldap.LdapModule.GROUP_EXIST_CACHE;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.Sets;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.GroupDescription;
import com.google.gerrit.common.data.GroupReference;
import com.google.gerrit.common.data.ParameterizedString;
@ -48,7 +49,6 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import javax.annotation.Nullable;
import javax.naming.InvalidNameException;
import javax.naming.NamingException;
import javax.naming.directory.DirContext;

View File

@ -16,12 +16,11 @@ package com.google.gerrit.server.cache;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.Weigher;
import com.google.gerrit.common.Nullable;
import com.google.inject.TypeLiteral;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
/** Configure a cache declared within a {@link CacheModule} instance. */
public interface CacheBinding<K, V> {
/** Set the total size of the cache. */

View File

@ -21,6 +21,7 @@ import com.google.common.base.Strings;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.Weigher;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.extensions.annotations.PluginName;
import com.google.inject.Inject;
import com.google.inject.Provider;
@ -28,8 +29,6 @@ import com.google.inject.TypeLiteral;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
class CacheProvider<K, V>
implements Provider<Cache<K, V>>,
CacheBinding<K, V> {

View File

@ -15,6 +15,7 @@
package com.google.gerrit.server.change;
import com.google.common.collect.Maps;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Patch;
import com.google.gerrit.reviewdb.client.PatchSet;
@ -30,8 +31,6 @@ import org.eclipse.jgit.lib.ObjectId;
import java.util.Map;
import javax.annotation.Nullable;
public class FileInfoJson {
private final PatchListCache patchListCache;

View File

@ -19,6 +19,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.extensions.restapi.RestReadView;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.PatchSet;
@ -56,8 +57,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
public class GetRelated implements RestReadView<RevisionResource> {
private static final Logger log = LoggerFactory.getLogger(GetRelated.class);

View File

@ -14,6 +14,7 @@
package com.google.gerrit.server.events;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.LabelType;
import com.google.gerrit.common.data.LabelTypes;
import com.google.gerrit.common.data.SubmitRecord;
@ -69,8 +70,6 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
@Singleton
public class EventFactory {
private static final Logger log = LoggerFactory.getLogger(EventFactory.class);

View File

@ -19,6 +19,7 @@ import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.extensions.registration.DynamicMap;
import com.google.gerrit.extensions.restapi.AuthException;
import com.google.gerrit.extensions.restapi.RestCollection;
@ -37,8 +38,6 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import javax.annotation.Nullable;
public class UiActions {
private static final Logger log = LoggerFactory.getLogger(UiActions.class);

View File

@ -26,6 +26,7 @@ import com.google.common.collect.Iterables;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Sets;
import com.google.gerrit.common.ChangeHooks;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.Capable;
import com.google.gerrit.common.data.SubmitTypeRecord;
import com.google.gerrit.reviewdb.client.Account;
@ -89,8 +90,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
/**
* Merges changes in submission order into a single branch.
* <p>

View File

@ -14,6 +14,7 @@
package com.google.gerrit.server.git;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.LabelType;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Branch;
@ -69,8 +70,6 @@ import java.util.List;
import java.util.Set;
import java.util.TimeZone;
import javax.annotation.Nullable;
public class MergeUtil {
private static final Logger log = LoggerFactory.getLogger(MergeUtil.class);

View File

@ -44,6 +44,7 @@ import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.gerrit.common.ChangeHookRunner.HookResult;
import com.google.gerrit.common.ChangeHooks;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.Capable;
import com.google.gerrit.common.data.LabelTypes;
import com.google.gerrit.common.data.PermissionRule;
@ -144,8 +145,6 @@ import java.util.concurrent.Callable;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.annotation.Nullable;
/** Receives change upload using the Git receive-pack protocol. */
public class ReceiveCommits {
private static final Logger log =

View File

@ -14,6 +14,7 @@
package com.google.gerrit.server.git;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.reviewdb.client.Branch;
import com.google.gerrit.reviewdb.client.Project.SubmitType;
import com.google.gerrit.reviewdb.server.ReviewDb;
@ -41,8 +42,6 @@ import org.slf4j.LoggerFactory;
import java.util.Set;
import javax.annotation.Nullable;
/** Factory to create a {@link SubmitStrategy} for a {@link SubmitType}. */
public class SubmitStrategyFactory {
private static final Logger log = LoggerFactory

View File

@ -14,6 +14,7 @@
package com.google.gerrit.server.git;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.reviewdb.client.Branch;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Project;
@ -62,8 +63,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
public class SubmoduleOp {
public interface Factory {
SubmoduleOp create(Branch.NameKey destBranch, RevCommit mergeTip,

View File

@ -15,6 +15,7 @@
package com.google.gerrit.server.git.validators;
import com.google.common.base.CharMatcher;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.PageLinks;
import com.google.gerrit.extensions.registration.DynamicSet;
import com.google.gerrit.server.GerritPersonIdent;
@ -52,8 +53,6 @@ import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import javax.annotation.Nullable;
public class CommitValidators {
private static final Logger log = LoggerFactory
.getLogger(CommitValidators.class);

View File

@ -16,6 +16,7 @@ package com.google.gerrit.server.index;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.extensions.events.LifecycleListener;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@ -25,8 +26,6 @@ import java.util.Collections;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicReference;
import javax.annotation.Nullable;
/** Dynamic pointers to the index versions used for searching and writing. */
@Singleton
public class IndexCollection implements LifecycleListener {

View File

@ -14,6 +14,7 @@
package com.google.gerrit.server.mail;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.reviewdb.server.ReviewDb;
import com.google.gerrit.server.AnonymousUser;
import com.google.gerrit.server.IdentifiedUser;
@ -38,8 +39,6 @@ import org.apache.velocity.runtime.RuntimeInstance;
import java.util.List;
import javax.annotation.Nullable;
class EmailArguments {
final GitRepositoryManager server;
final ProjectCache projectCache;

View File

@ -24,6 +24,7 @@ import static org.eclipse.jgit.lib.ObjectIdSerialization.readNotNull;
import static org.eclipse.jgit.lib.ObjectIdSerialization.writeCanBeNull;
import static org.eclipse.jgit.lib.ObjectIdSerialization.writeNotNull;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.reviewdb.client.Patch;
import com.google.gerrit.reviewdb.client.PatchSet;
@ -44,8 +45,6 @@ import java.util.List;
import java.util.zip.DeflaterOutputStream;
import java.util.zip.InflaterInputStream;
import javax.annotation.Nullable;
public class PatchList implements Serializable {
private static final long serialVersionUID = PatchListKey.serialVersionUID;
private static final Comparator<PatchListEntry> PATCH_CMP =

View File

@ -21,6 +21,7 @@ import static org.eclipse.jgit.lib.ObjectIdSerialization.readNotNull;
import static org.eclipse.jgit.lib.ObjectIdSerialization.writeCanBeNull;
import static org.eclipse.jgit.lib.ObjectIdSerialization.writeNotNull;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.client.AccountDiffPreference.Whitespace;
@ -32,8 +33,6 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import javax.annotation.Nullable;
public class PatchListKey implements Serializable {
static final long serialVersionUID = 16L;

View File

@ -14,6 +14,7 @@
package com.google.gerrit.server.patch;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.CommentDetail;
import com.google.gerrit.common.data.PatchScript;
import com.google.gerrit.reviewdb.client.Account;
@ -51,8 +52,6 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import javax.annotation.Nullable;
public class PatchScriptFactory implements Callable<PatchScript> {
public interface Factory {

View File

@ -16,6 +16,7 @@ package com.google.gerrit.server.plugins;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.extensions.annotations.PluginData;
import com.google.gerrit.extensions.annotations.PluginName;
import com.google.gerrit.extensions.registration.RegistrationHandle;
@ -38,8 +39,6 @@ import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import javax.annotation.Nullable;
class JarPlugin extends Plugin {
/** Unique key that changes whenever a plugin reloads. */

View File

@ -16,6 +16,7 @@ package com.google.gerrit.server.plugins;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.extensions.registration.RegistrationHandle;
import com.google.gerrit.extensions.registration.ReloadableRegistrationHandle;
import com.google.gerrit.lifecycle.LifecycleManager;
@ -31,8 +32,6 @@ import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import javax.annotation.Nullable;
public abstract class Plugin {
public static enum ApiType {
EXTENSION, PLUGIN, JS;

View File

@ -23,6 +23,7 @@ import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.extensions.events.LifecycleListener;
import com.google.gerrit.extensions.registration.DynamicItem;
import com.google.gerrit.extensions.registration.DynamicMap;
@ -54,7 +55,6 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.annotation.Nullable;
import javax.inject.Inject;
/**

View File

@ -15,6 +15,7 @@
package com.google.gerrit.server.project;
import com.google.common.collect.Lists;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.LabelType;
import com.google.gerrit.common.data.LabelTypes;
import com.google.gerrit.common.data.PermissionRange;
@ -50,8 +51,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
/** Access control management for a user accessing a single change. */
public class ChangeControl {

View File

@ -15,6 +15,7 @@
package com.google.gerrit.server.project;
import com.google.common.collect.Lists;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.PageLinks;
import com.google.gerrit.common.data.AccessSection;
import com.google.gerrit.common.data.Capable;
@ -47,8 +48,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
/** Access control management for a user accessing a project's data. */
public class ProjectControl {
public static final int VISIBLE = 1 << 0;

View File

@ -15,6 +15,7 @@
package com.google.gerrit.server.project;
import com.google.common.collect.Lists;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.reviewdb.server.ReviewDb;
@ -34,8 +35,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
/**
* Evaluates a submit-like Prolog rule found in the rules.pl file of the current
* project and filters the results through rules found in the parent projects,

View File

@ -15,6 +15,7 @@
package com.google.gerrit.server.util;
import com.google.common.collect.Maps;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.server.RemotePeer;
import com.google.gerrit.server.config.CanonicalWebUrl;
import com.google.gerrit.server.config.RequestScopedReviewDbProvider;
@ -31,8 +32,6 @@ import java.net.SocketAddress;
import java.util.Map;
import java.util.concurrent.Callable;
import javax.annotation.Nullable;
/** Propagator for Guice's built-in servlet scope. */
public class GuiceRequestScopePropagator extends RequestScopePropagator {

View File

@ -15,6 +15,7 @@
package com.google.gerrit.server.util;
import com.google.common.base.Objects;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.errors.NotSignedInException;
import com.google.gerrit.reviewdb.server.ReviewDb;
import com.google.gerrit.server.CurrentUser;
@ -27,8 +28,6 @@ import com.google.inject.ProvisionException;
import com.google.inject.name.Named;
import com.google.inject.name.Names;
import javax.annotation.Nullable;
/**
* ThreadLocalRequestContext manages the current RequestContext using a
* ThreadLocal. When the context is set, the fields exposed by the context

View File

@ -15,6 +15,7 @@
package com.google.gerrit.sshd;
import com.google.common.util.concurrent.Atomics;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.extensions.annotations.PluginName;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.client.Project.NameKey;
@ -54,8 +55,6 @@ import java.io.UnsupportedEncodingException;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicReference;
import javax.annotation.Nullable;
public abstract class BaseCommand implements Command {
private static final Logger log = LoggerFactory.getLogger(BaseCommand.class);
public static final String ENC = "UTF-8";

View File

@ -2,6 +2,7 @@ java_library(
name = 'cli',
srcs = glob(['src/main/java/**/*.java']),
deps = [
'//gerrit-common:server',
'//lib:args4j',
'//lib:guava',
'//lib:jsr305',

View File

@ -15,6 +15,7 @@
package com.google.gerrit.util.cli;
import com.google.common.collect.ImmutableMap;
import com.google.gerrit.common.Nullable;
import com.google.inject.Binding;
import com.google.inject.Inject;
import com.google.inject.Injector;
@ -26,8 +27,6 @@ import com.google.inject.TypeLiteral;
import java.lang.reflect.ParameterizedType;
import java.util.Map.Entry;
import javax.annotation.Nullable;
@Singleton
public class OptionHandlers {
public static OptionHandlers empty() {