Move Nullable into core (#29341)

This moves the `Nullable` annotation into the elasticsearch-core project, so it
may be used without relying entirely on the server jar. This will allow us to
decouple more pieces to make them smaller.

In addition, there were two different `Nullable` annotations, these have all
been moved to the ES version rather than the inject version.
This commit is contained in:
Lee Hinman 2018-04-03 07:57:21 -06:00 committed by GitHub
parent 5adfe2d8e3
commit db8ed36436
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 10 additions and 47 deletions

View File

@ -22,7 +22,7 @@ package org.elasticsearch.action.admin.cluster.snapshots.status;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.cluster.SnapshotsInProgress.State; import org.elasticsearch.cluster.SnapshotsInProgress.State;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.internal.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.io.stream.Streamable;

View File

@ -19,7 +19,7 @@
package org.elasticsearch.action.search; package org.elasticsearch.action.search;
import org.elasticsearch.common.inject.internal.Nullable; import org.elasticsearch.common.Nullable;
class ScrollIdForNode { class ScrollIdForNode {
private final String node; private final String node;

View File

@ -17,6 +17,7 @@
package org.elasticsearch.common.inject; package org.elasticsearch.common.inject;
import org.elasticsearch.common.Classes; import org.elasticsearch.common.Classes;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.inject.internal.Annotations; import org.elasticsearch.common.inject.internal.Annotations;
import org.elasticsearch.common.inject.internal.BindingImpl; import org.elasticsearch.common.inject.internal.BindingImpl;
import org.elasticsearch.common.inject.internal.Errors; import org.elasticsearch.common.inject.internal.Errors;
@ -27,7 +28,6 @@ import org.elasticsearch.common.inject.internal.InternalFactory;
import org.elasticsearch.common.inject.internal.LinkedBindingImpl; import org.elasticsearch.common.inject.internal.LinkedBindingImpl;
import org.elasticsearch.common.inject.internal.LinkedProviderBindingImpl; import org.elasticsearch.common.inject.internal.LinkedProviderBindingImpl;
import org.elasticsearch.common.inject.internal.MatcherAndConverter; import org.elasticsearch.common.inject.internal.MatcherAndConverter;
import org.elasticsearch.common.inject.internal.Nullable;
import org.elasticsearch.common.inject.internal.Scoping; import org.elasticsearch.common.inject.internal.Scoping;
import org.elasticsearch.common.inject.internal.SourceProvider; import org.elasticsearch.common.inject.internal.SourceProvider;
import org.elasticsearch.common.inject.internal.ToStringBuilder; import org.elasticsearch.common.inject.internal.ToStringBuilder;

View File

@ -16,6 +16,7 @@
package org.elasticsearch.common.inject.internal; package org.elasticsearch.common.inject.internal;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.util.CollectionUtils; import org.elasticsearch.common.util.CollectionUtils;
import java.io.IOException; import java.io.IOException;

View File

@ -1,38 +0,0 @@
/*
* Copyright (C) 2007 Google Inc.
*
* 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 org.elasticsearch.common.inject.internal;
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;
/**
* The presence of this annotation on a method parameter indicates that
* {@code null} is an acceptable value for that parameter. It should not be
* used for parameters of primitive types.
* <p>
* This annotation may be used with the Google Web Toolkit (GWT).
*
* @author Kevin Bourrillion
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PARAMETER, ElementType.FIELD})
public @interface Nullable {
}

View File

@ -19,7 +19,7 @@
package org.elasticsearch.search.aggregations.bucket.composite; package org.elasticsearch.search.aggregations.bucket.composite;
import org.elasticsearch.common.inject.internal.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.index.mapper.MappedFieldType; import org.elasticsearch.index.mapper.MappedFieldType;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;

View File

@ -25,7 +25,7 @@ import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;
import org.apache.lucene.util.DocIdSetBuilder; import org.apache.lucene.util.DocIdSetBuilder;
import org.elasticsearch.common.inject.internal.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollector;
import java.io.IOException; import java.io.IOException;

View File

@ -21,7 +21,7 @@ package org.elasticsearch.search.aggregations.bucket.histogram;
import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.SortedNumericDocValues; import org.apache.lucene.index.SortedNumericDocValues;
import org.apache.lucene.util.CollectionUtil; import org.apache.lucene.util.CollectionUtil;
import org.elasticsearch.common.inject.internal.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.lease.Releasables; import org.elasticsearch.common.lease.Releasables;
import org.elasticsearch.common.rounding.Rounding; import org.elasticsearch.common.rounding.Rounding;
import org.elasticsearch.common.util.LongHash; import org.elasticsearch.common.util.LongHash;

View File

@ -21,7 +21,7 @@ package org.elasticsearch.search.aggregations.bucket.histogram;
import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.util.CollectionUtil; import org.apache.lucene.util.CollectionUtil;
import org.elasticsearch.common.inject.internal.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.lease.Releasables; import org.elasticsearch.common.lease.Releasables;
import org.elasticsearch.common.util.LongHash; import org.elasticsearch.common.util.LongHash;
import org.elasticsearch.index.fielddata.SortedNumericDoubleValues; import org.elasticsearch.index.fielddata.SortedNumericDoubleValues;

View File

@ -18,7 +18,7 @@
*/ */
package org.elasticsearch.transport; package org.elasticsearch.transport;
import org.elasticsearch.common.inject.internal.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
import java.util.ArrayList; import java.util.ArrayList;
@ -41,7 +41,7 @@ public final class ConnectionProfile {
*/ */
public static ConnectionProfile buildSingleChannelProfile(TransportRequestOptions.Type channelType, public static ConnectionProfile buildSingleChannelProfile(TransportRequestOptions.Type channelType,
@Nullable TimeValue connectTimeout, @Nullable TimeValue connectTimeout,
@Nullable TimeValue handshakeTimeout) { @Nullable TimeValue handshakeTimeout) {
Builder builder = new Builder(); Builder builder = new Builder();
builder.addConnections(1, channelType); builder.addConnections(1, channelType);
final EnumSet<TransportRequestOptions.Type> otherTypes = EnumSet.allOf(TransportRequestOptions.Type.class); final EnumSet<TransportRequestOptions.Type> otherTypes = EnumSet.allOf(TransportRequestOptions.Type.class);