id
stringlengths
29
30
content
stringlengths
152
2.6k
codereview_new_java_data_8147
public void processHeaders(HttpHeaders headers, StreamDecoderOutput<DeframedMess } } - final Metadata metadata = MetadataUtil.copyFromHeaders(headers); - // Note: this implementation slightly differs from upstream in that - // we don't check if the content-type is valid bef...
codereview_new_java_data_8148
import io.grpc.Status; /** - * A listener of gRPC {@link Status}s. Any errors occurring within the armeria will be returned to gRPC business - * logic through this listener, and for clients the final response {@link Status} is also returned. */ public interface TransportStatusListener { default void tran...
codereview_new_java_data_8149
public InetAddress getAddress() { /** * Registers a Network address that the {@link Server} uses. */ - public void setAddress(InetAddress address) { this.address = address; } /** Should return `this` like other setters? public InetAddress getAddre...
codereview_new_java_data_8150
/* - * Copyright 2020 LINE Corporation * * LINE Corporation licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance ```suggestion * Copyright 2023 LINE Corporation ``` /* + * Copyright 2023 LINE Corporation * * LINE Corporation...
codereview_new_java_data_8151
final class RequestObjectTypeSignature extends DescriptiveTypeSignature { private final Object annotatedValueResolvers; - RequestObjectTypeSignature(TypeSignatureType requestObject, String name, Class<?> type, Object annotatedValueResolvers) { - super(requestObject, n...
codereview_new_java_data_8152
static StreamDecoderFactory brotli() { /** * Construct a new {@link StreamDecoder} to use to decode an {@link HttpMessage}. */ @Override default StreamDecoder newDecoder(ByteBufAllocator alloc) { ```suggestion * Construct a new {@link StreamDecoder} to use to decode an {@link HttpMe...
codereview_new_java_data_8153
import static java.util.Objects.requireNonNull; import com.google.errorprone.annotations.concurrent.GuardedBy; import java.util.Set; import java.util.concurrent.locks.ReentrantLock; import java.util.function.Consumer; Could you check your IDE settings and rearrange the imports? https://armeria.dev/community/d...
codereview_new_java_data_8154
public final class ShutdownHooks { private static final Logger logger = LoggerFactory.getLogger(ShutdownHooks.class); - @GuardedBy("autoCloseableOnShutdownTasks") private static final Map<AutoCloseable, Queue<Runnable>> autoCloseableOnShutdownTasks = new LinkedHashMap<>(); This is: ``...
codereview_new_java_data_8155
private static CompletableFuture<Void> addClosingTask( } } }); - } - finally { reentrantLock.unlock(); } })); ```suggestion ...
codereview_new_java_data_8156
final class HttpHealthChecker implements AsyncCloseable { private static final Logger logger = LoggerFactory.getLogger(HttpHealthChecker.class); - private final ReentrantLock lock = new ReentrantLock(); - private static final AsciiString ARMERIA_LPHC = HttpHeaderNames.of("armeria-lphc"); privat...
codereview_new_java_data_8157
import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.classic.spi.IThrowableProxy; import ch.qos.logback.classic.spi.LoggerContextVO; -final class LoggingEventWrapper implements ILoggingEvent { private final ILoggingEvent event; private final Map<String, String> mdcPropertyMap; @Nu...
codereview_new_java_data_8158
public class ContainerTypeSignature extends DefaultTypeSignature { private final List<TypeSignature> typeParameters; ContainerTypeSignature(TypeSignatureType type, String name, - Iterable<TypeSignature> typeParameters) { super(type, name); final List<TypeSignatur...
codereview_new_java_data_8159
boolean isSentConnectionCloseHeader() { @Override public boolean isResponseHeadersSent(int id, int streamId) { - return id < currentId(); } @Override What do you think of renaming this as `isResponseSent` since a response with an id smaller than `currentId` is guaranteed to have been fu...
codereview_new_java_data_8160
void shouldReturn414ForLongUrlForHTTP1() { } @Test - void shouldThrowHeaderListSizeExceptionForLongUrlForHTTP1() { final BlockingWebClient client = BlockingWebClient.of(server.uri(SessionProtocol.H2C)); assertThatThrownBy(() -> { client.get("/?q" + Strings.repeat("a", 200)...
codereview_new_java_data_8161
private PooledChannel acquireNowExact(PoolKey key, SessionProtocol protocol) { private static boolean isHealthy(PooledChannel pooledChannel) { final Channel ch = pooledChannel.get(); - return ch.isActive() && HttpSession.get(ch).canAcquire(); } @Nullable `canAcquire()` usually becom...
codereview_new_java_data_8162
private ChannelFuture respond(ServiceRequestContext reqCtx, ResponseHeadersBuild return future; } - /** - * Sets the keep alive header as per: - * - https://www.w3.org/Protocols/HTTP/1.1/draft-ietf-http-v11-spec-01.html#Connection - */ private void addConnectionCloseHeaders(Response...
codereview_new_java_data_8163
protected void configure(ServerBuilder sb) throws Exception { @Test void shouldCompleteUnfinishedRequestWhenConnectionIsClosed() throws Exception { - final WebClient client = WebClient.builder(server.httpUri()) - .responseTimeoutMillis(0) - ...
codereview_new_java_data_8164
public ServerBuilder addHeader(CharSequence name, Object value) { * <ul> * <li>{@link ServiceRequestContext#additionalResponseHeaders()}</li> * <li>The {@link ResponseHeaders} of the {@link HttpResponse}</li> - * <li>{@link VirtualHostBuilder#addHeader(CharSequence, Object)}</li> - * ...
codereview_new_java_data_8165
public VirtualHostBuilder setHeader(CharSequence name, Object value) { } /** - * Sets the default HTTP headers for {@link HttpResponse}. * * <p>Note that the default headers could be overridden if the same {@link HttpHeaderNames} are defined in * one of the followings: ```suggestion ...
codereview_new_java_data_8166
public void serviceAdded(ServiceConfig cfg) throws Exception { // Build the Specification after all the services are added to the server. final ServerConfig config = server.config(); - final List<VirtualHost> virtualHosts = config.findVirtualHosts(DocService.this); final List<Serv...
codereview_new_java_data_8167
static void verifyResponseBufs() { @Test void shouldReturnEmptyBodyOnHead() throws Exception { - final BlockingWebClient client = WebClient.of(server.httpUri()).blocking(); final AggregatedHttpResponse res = client.head("/hello"); assertThat(res.headers().contentLength()).isEqualTo...
codereview_new_java_data_8168
final AggregatedHttpResponse toAggregatedHttpResponse(HttpStatusException cause) return response; } - final void endLogRequestAndResponse(Throwable cause) { logBuilder().endRequest(cause); logBuilder().endResponse(cause); Should we revert the extra line? final AggregatedHttpRe...
codereview_new_java_data_8169
String uriText() { @Param private Protocol protocol; - @Param({ "100", "1000"}) private int chunkCount; @Setup nit; What do you think of leaving this as a single value by default? Other benchmarks like `plainText`, `empty` would run twice by default due to a parameter they don't rely on. ...
codereview_new_java_data_8170
import java.lang.annotation.Target; import java.util.concurrent.TimeUnit; import com.linecorp.armeria.server.annotation.DecoratorFactory; /** - * Annotation for request timeout */ @DecoratorFactory(RequestTimeoutDecoratorFunction.class) @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.TYPE, Eleme...
codereview_new_java_data_8171
public final class RequestTimeoutDecoratorFunction implements DecoratorFactoryFu return delegate -> new SimpleDecoratingHttpService(delegate) { @Override public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exception { - ServiceRequestContext.cu...
codereview_new_java_data_8172
public String timeoutSeconds(ServiceRequestContext ctx, HttpRequest req) { AnnotatedServiceTest.validateContextAndRequest(ctx, req); return Long.toString(ctx.requestTimeoutMillis()); } - - @Get("/subscriberIsInitialized") - public String subscriberIsInitialized(ServiceR...
codereview_new_java_data_8173
public final class RequestTimeoutDecoratorFunction implements DecoratorFactoryFunction<RequestTimeout> { /** - * Creates a new decorator with the specified {@code parameter}. */ @Override public Function<? super HttpService, ? extends HttpService> newDecorator(RequestTimeout parameter) { `...
codereview_new_java_data_8174
public void subscribe(Subscriber<? super T> subscriber, EventExecutor executor, SubscriptionOption... options) { requireNonNull(subscriber, "subscriber"); requireNonNull(executor, "executor"); - executor.execute(() -> { - subscriber.onSubscribe(NoopSubscri...
codereview_new_java_data_8175
*/ package com.linecorp.armeria.internal.server; import com.linecorp.armeria.common.HttpRequest; import com.linecorp.armeria.common.HttpResponse; /** - * A special {@link RuntimeException} that aborts an {@link HttpRequest} after the corresponding * {@link HttpResponse} is completed. */ -public final cla...
codereview_new_java_data_8176
public void subscribe(Subscriber<? super T> subscriber, EventExecutor executor, SubscriptionOption... options) { requireNonNull(subscriber, "subscriber"); requireNonNull(executor, "executor"); - executor.execute(() -> { - subscriber.onSubscribe(NoopSubscri...
codereview_new_java_data_8177
private <I, O> void startCall(ServerMethodDefinition<I, O> methodDef, ServiceReq .startCall(call, MetadataUtil.copyFromHeaders(req.headers())); } catch (Throwable t) { call.setListener((Listener<I>) EMPTY_LISTENER); - final Metadata metadata = new Metad...
codereview_new_java_data_8178
private static MediaType addKnownType(MediaType mediaType) { /** * The GraphQL response content type is changed from {@link #GRAPHQL_JSON} to {@link #GRAPHQL_RESPONSE_JSON} * in this PR. <a href="https://github.com/graphql/graphql-over-http/pull/215">Change media type</a> */ public static f...
codereview_new_java_data_8179
public HttpResponse execute(ClientRequestContext ctx, HttpRequest req) throws Ex final HttpRequestDuplicator reqDuplicator = req.toDuplicator(ctx.eventLoop().withoutContext(), 0); execute0(ctx, redirectCtx, reqDuplicator, true); } else { - req.aggregate(AggregationOptions....
codereview_new_java_data_8180
default HttpRequest toHttpRequest() { */ default HttpRequest toHttpRequest(RequestHeaders headers) { requireNonNull(headers, "headers"); - return HttpRequest.of(maybeModifyContentLength(headers, content()), content(), trailers()); } } Doesn't have to be done in this PR, just a note: ...
codereview_new_java_data_8181
private static FieldInfo newFieldInfo(FieldDescriptor fieldDescriptor, Set<Descr final TypeSignature typeSignature = newFieldTypeInfo(fieldDescriptor); final Object typeDescriptor = typeSignature.namedTypeDescriptor(); final FieldInfoBuilder builder; - if (typeDescriptor instanceof De...
codereview_new_java_data_8182
private GraphqlErrorsHandlers() {} */ private static HttpResponse toHttpResponse(HttpStatus httpStatus, ExecutionResult executionResult, MediaType produceType) { - // TODO: When WebSocket is implemented, it should be removed. - if (executionResul...
codereview_new_java_data_8183
public GraphqlServiceBuilder useBlockingTaskExecutor(boolean useBlockingTaskExec * Sets the {@link GraphqlErrorsHandler}. */ public GraphqlServiceBuilder errorsHandler(GraphqlErrorsHandler errorsHandler) { - this.errorsHandler = errorsHandler; return this; } ```suggestion ...
codereview_new_java_data_8184
import graphql.ExecutionResult; /** - * A handler that maps GraphQL errors to an {@link HttpResponse}. */ @FunctionalInterface public interface GraphqlErrorsHandler { ```suggestion * A handler that maps GraphQL errors or a {@link Throwable} to an {@link HttpResponse}. ``` import graphql.ExecutionResult;...
codereview_new_java_data_8185
import graphql.GraphqlErrorException; import graphql.schema.DataFetcher; -public class GraphqlErrorsHandlerTest { @RegisterExtension static ServerExtension server = new ServerExtension() { ```suggestion class GraphqlErrorsHandlerTest { ``` We don't need `public` modifier for the test. πŸ˜‰ import...
codereview_new_java_data_8186
static ExecutionResult newExecutionResult(Throwable cause) { } /** - * Return {@link HttpStatus} based List of {@link GraphQLError}. */ private static HttpStatus graphqlErrorsToHttpStatus(List<GraphQLError> errors) { if (errors.isEmpty()) { ```suggestion * Return an {@link Ht...
codereview_new_java_data_8187
import static java.util.Objects.requireNonNull; import com.linecorp.armeria.common.HttpResponse; -import com.linecorp.armeria.common.HttpStatus; import com.linecorp.armeria.common.MediaType; import com.linecorp.armeria.common.annotation.Nullable; import com.linecorp.armeria.common.annotation.UnstableApi; impor...
codereview_new_java_data_8188
public GraphqlServiceBuilder useBlockingTaskExecutor(boolean useBlockingTaskExec /** * Sets the {@link GraphqlErrorsHandler}. */ public GraphqlServiceBuilder errorsHandler(GraphqlErrorsHandler errorsHandler) { this.errorsHandler = requireNonNull(errorsHandler, "errorsHandler"); ```sug...
codereview_new_java_data_8189
public interface GraphqlErrorHandler { /** - * Return the {@link DefaultGraphqlErrorHandler}. */ static GraphqlErrorHandler of() { return DefaultGraphqlErrorHandler.INSTANCE; ```suggestion * Return the default {@link GraphqlErrorHandler}. ``` ... because `DefaultGraphqlErrorHan...
codereview_new_java_data_8190
public GraphqlServiceBuilder useBlockingTaskExecutor(boolean useBlockingTaskExec * Sets the {@link GraphqlErrorHandler}. * If not specified, {@link GraphqlErrorHandler#of()} is used by default. */ - public GraphqlServiceBuilder errorsHandler(GraphqlErrorHandler errorsHandler) { this.error...
codereview_new_java_data_8191
static ResultType toResultType(Type type) { } final Class<?> keyType = (Class<?>) typeArguments[0]; if (!String.class.isAssignableFrom(keyType)) { - throw new IllegalStateException( - keyType + " cannot be used for the key...
codereview_new_java_data_8192
public final class ThriftProtocolFactories { final Constructor<TBinaryProtocol.Factory> ignored = TBinaryProtocol.Factory.class.getConstructor(boolean.class, boolean.class, long.class, long.class); - } catch (NoS...
codereview_new_java_data_8193
/** * A generic handler containing callback methods which are invoked by * {@link CircuitBreakerClient}. It may be useful to create a custom - * implementation in conjunction with {@link CircuitBreakerHandlerFactory} * if one wishes to use a custom CircuitBreaker with {@link CircuitBreakerClient}. */ @Unstab...
codereview_new_java_data_8194
import com.linecorp.armeria.common.annotation.UnstableApi; /** - * An abstract builder class for building a CircuitBreaker mapping * based on a combination of host, method and path. */ @UnstableApi ```suggestion * An abstract builder class for building a {@link CircuitBreakerMapping} ``` import com.lin...
codereview_new_java_data_8195
* Returns a newly-created {@link CircuitBreakerRpcClient} based on the properties of this builder. */ public CircuitBreakerRpcClient build(RpcClient delegate) { - return build(delegate, CircuitBreakerClientHandler.of(CircuitBreakerMapping.ofDefault())); - } - - /** - * Returns a newly...
codereview_new_java_data_8196
static <I extends Request> CircuitBreakerClientHandler<I> of(CircuitBreakerMappi } /** - * Invoked by {@link CircuitBreakerClient} right before executing a request. * In a typical implementation, users may extract the appropriate circuit breaker * implementation using the provided {@link Cl...
codereview_new_java_data_8197
/** * Returns a circuit breaker implementation from remote invocation parameters. */ @FunctionalInterface @UnstableApi How about adding the description of the type parameter `T`? /** * Returns a circuit breaker implementation from remote invocation parameters. + * + * @param <T> the type of circuit br...
codereview_new_java_data_8198
public CircuitBreakerCallback tryRequest(ClientRequestContext ctx, I req) { try { circuitBreaker = requireNonNull(mapping.get(ctx, req), "circuitBreaker"); } catch (Throwable t) { - logger.warn("Failed to get a circuit breaker from mapping", t); return null; ...
codereview_new_java_data_8199
import com.linecorp.armeria.common.annotation.UnstableApi; /** - * A collection of callbacks that are invoked for each request by {@link CircuitBreakerClient}. * Users may implement this class in conjunction with {@link CircuitBreakerClientHandler} to * use arbitrary circuit breaker implementations with {@link...
codereview_new_java_data_8200
public String toString() { return toStringHelper() .add("questions", questions) .add("logPrefix", logPrefix) .toString(); } } Add `attemptsSoFar` as well? It would be useful for debugging. public String toString() { return toStringHelper() ...
codereview_new_java_data_8201
void healthCheckedEndpointGroup_custom() { } // TODO(ikhoon): Revert once CI builds pass - @RepeatedTest(1000) void select_timeout() { final int expectedTimeout = 3000; try (MockEndpointGroup endpointGroup = new MockEndpointGroup(expectedTimeout)) { ```suggestion @RepeatedTe...
codereview_new_java_data_8202
final class ByteStreamMessageOutputStream implements ByteStreamMessage { - private final Consumer<OutputStream> outputStreamWriter; - private final Executor executor; - private final StreamMessageAndWriter<HttpData> streamWriter = new DefaultStreamMessage<>(); private final ByteStreamMessage deleg...
codereview_new_java_data_8203
void refresh() { return; } - final String hostname = address.getHostName(); if (refreshing) { return; } refreshing = true; // 'sendQueries()' always successfully completes. sendQueries(questio...
codereview_new_java_data_8204
void onRemoval(DnsQuestion question, @Nullable List<DnsRecord> records, @Nullable UnknownHostException cause); /** - * Invoked when an eviction occurred for the {@link DnsRecord}s. The eviction may occur due to exceeding - * a maximum size or timed expiration. The cause may vary depe...
codereview_new_java_data_8205
private HttpResponse convertResponseInternal(ServiceRequestContext ctx, private ResponseHeaders buildResponseHeaders(ServiceRequestContext ctx, HttpHeaders customHeaders) { final ResponseHeadersBuilder builder; - // Prefer ResponseHeaders#toBuilder because builder#add is an expensive operation. ...
codereview_new_java_data_8206
import com.linecorp.armeria.server.Server; /** - * An {@link SmartLifecycle} which retries to start the {@link Server} up to {@code maxAttempts}. * This is useful for testing that needs to bind a server to a random port number obtained in advance. */ final class RetryableArmeriaServerGracefulShutdownLifecycle...
codereview_new_java_data_8207
import io.netty.util.concurrent.EventExecutor; -abstract class CancellableStreamMessage<T> extends AbstractStreamMessage<T> { static final Logger logger = LoggerFactory.getLogger(CancellableStreamMessage.class); I didn't review this class carefully because the implementation of this class is derived fro...
codereview_new_java_data_8208
static HttpResponseBuilder builder() { /** * Aggregates this response with the specified {@link AggregationOptions}. The returned * {@link CompletableFuture} will be notified when the content and the trailers of the response are - * received fully. * <pre>{@code * AggregationOptions op...
codereview_new_java_data_8209
static AggregationOptionsBuilder builder() { } /** - * Returns the {@link EventExecutor} that executes the aggregation on. */ EventExecutor executor(); ```suggestion * Returns the {@link EventExecutor} that executes the aggregation. ``` static AggregationOptionsBuilder builder() ...
codereview_new_java_data_8210
public boolean isJson() { } /** - * Returns {@code true} when the subtype is in [{@link MediaType#PROTOBUF}, {@link MediaType#X_PROTOBUF}, {@link MediaType#X_GOOGLE_PROTOBUF}]. * Otherwise {@code false}. * * <pre>{@code We prefer to list elements using `and` or `or`. ```suggestion ...
codereview_new_java_data_8211
public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exc responseFuture.completeExceptionally(t); } else { frameAndServe(unwrap(), ctx, grpcHeaders.build(), clientRequest.content(), - responseFuture, null, res...
codereview_new_java_data_8212
Queue<HealthCheckContextGroup> contextGroupChain() { @VisibleForTesting List<Endpoint> allHealthyEndpoints() { synchronized (contextGroupChain) { - if (contextGroupChain.isEmpty()) { return ImmutableList.of(); } final List<Endpoint> allHealthyE...
codereview_new_java_data_8213
static void deframeAndRespond(ServiceRequestContext ctx, try { requireNonNull(grpcStatusCode, "grpc-status header must exist"); } catch (NullPointerException e) { res.completeExceptionally(e); return; } Let's close a pooled object (a reference counting...
codereview_new_java_data_8214
static void deframeAndRespond(ServiceRequestContext ctx, if (grpcStatusCode == null) { PooledObjects.close(grpcResponse.content()); res.completeExceptionally(new NullPointerException("grpcStatusCode must not be null")); - logger.warn("A gRPC response must have the {} heade...
codereview_new_java_data_8215
void testUnwrap() { @Test void testUnwrapAll() { final Foo foo = new Foo(); final Bar<Foo> bar = new Bar<>(foo); - final Qux<Bar<Foo>> qux = new Qux<>(bar); - final Foo root = qux.root(); - assertThat(root).isSameAs(foo); } private static final class Foo i...
codereview_new_java_data_8216
default Unwrappable unwrap() { * } * } * - * final Foo foo = new Foo(); - * foo.unwrapAll() == foo; * - * final Bar<Foo> bar = new Bar<>(foo); - * bar.unwrapAll() == foo; * - * final Qux<Bar<Foo>> qux = new Qux<>(bar); - * qux.unwrapAll() == foo; * }</pre...
codereview_new_java_data_8217
default Unwrappable unwrap() { * } * } * - * final Foo foo = new Foo(); - * foo.unwrapAll() == foo; * - * final Bar<Foo> bar = new Bar<>(foo); - * bar.unwrapAll() == foo; * - * final Qux<Bar<Foo>> qux = new Qux<>(bar); - * qux.unwrapAll() == foo; * }</pre...
codereview_new_java_data_8218
default Unwrappable unwrap() { * } * } * - * final Foo foo = new Foo(); - * foo.unwrapAll() == foo; * - * final Bar<Foo> bar = new Bar<>(foo); - * bar.unwrapAll() == foo; * - * final Qux<Bar<Foo>> qux = new Qux<>(bar); - * qux.unwrapAll() == foo; * }</pre...
codereview_new_java_data_8219
default Unwrappable unwrap() { * }</pre> */ default Unwrappable unwrapAll() { - return unwrap(); } } Should we improve the default implementation to unwrap until the returned value is the same as the old value? For example: ```java Unwrappable unwrapped = this; while (true) { fi...
codereview_new_java_data_8220
public interface DelegatingResponseConverterFunctionProvider { * Returns a {@link ResponseConverterFunction} instance if the function can convert * the {@code responseType}, otherwise return {@code null}. * The {@link ResponseConverterFunction} passed in is a delegate function which will be used to c...
codereview_new_java_data_8221
import com.linecorp.armeria.server.annotation.ResponseConverterFunction; /** - * For use with ResponseConverterFunctionSelectorTest. */ public class TestDelegatingSpiConverterProvider implements DelegatingResponseConverterFunctionProvider { ```suggestion * For use with ResponseConverterFunctionUtilTest. `...
codereview_new_java_data_8223
/** * A {@link ResponseConverterFunction} provider interface which creates a new * {@link ResponseConverterFunction} for converting an object of the given type and functions. */ @UnstableApi @FunctionalInterface Could you add this to the Javadoc of this interface? ` * @see DelegatingResponseConverterFunctio...
codereview_new_java_data_8224
public interface NamedTypeInfoProvider { * {@code org.apache.thrift.TException} for {@code ThriftDocServicePlugin}</li> * </ul> * - * @return a new {@link StructInfo}. {@code null} if this {@link NamedTypeInfoProvider} cannot convert the - * {@code typeDescriptor} to the {@link...
codereview_new_java_data_8225
public DocServiceBuilder injectedScriptSupplier( } /** - * Adds the specified {@link NamedTypeInfoProvider}s used to create a {@link NamedTypeInfo} from * a type descriptor. */ public DocServiceBuilder namedTypeInfoProvider(NamedTypeInfoProvider namedTypeInfoProvider) { Since it's sin...
codereview_new_java_data_8226
private static <T> T extractFromGetter(JavaType classType, JavaType fieldType, S return null; } - private StructInfo newReflectiveStructInfo(Class<?> clazz) { return (StructInfo) ReflectiveNamedTypeInfoProvider.INSTANCE.newNamedTypeInfo(clazz); } } Let's add `assert value != null;` ...
codereview_new_java_data_8227
public String name() { /** * Returns the alias of the {@link #name()}. */ @Nullable @JsonInclude(Include.NON_NULL) Can it be anything other than class name? public String name() { /** * Returns the alias of the {@link #name()}. + * An alias could be set when a {@link St...
codereview_new_java_data_8228
/** * A {@link NamedTypeInfoProvider} to create a {@link NamedTypeInfo} from a Thrift type such as {@link TBase} - * , {@link TEnum} or {@link TException}. */ public final class ThriftNamedTypeInfoProvider implements NamedTypeInfoProvider { Let's move `,` to the above line. πŸ˜„ /** * A {@link NamedTy...
codereview_new_java_data_8229
public ServiceSpecification generateSpecification(Set<ServiceConfig> serviceConf NamedTypeInfoProvider namedTypeInfoProvider) { requireNonNull(serviceConfigs, "serviceConfigs"); requireNonNull(filter, "filter"); final Map<Class<?>, Ent...
codereview_new_java_data_8230
public DocServiceBuilder injectedScriptSupplier( return this; } /** * Adds the specified {@link NamedTypeInfoProvider} used to create a {@link NamedTypeInfo} from * a type descriptor. How about supporting list of the `namedTypeInfoProvider` using `orElse`? πŸ˜… I think it can be handle...
codereview_new_java_data_8231
public NamedTypeInfo newNamedTypeInfo(Object typeDescriptor) { } final Class<?> clazz = (Class<?>) typeDescriptor; - if (clazz.isEnum()) { @SuppressWarnings("unchecked") final Class<? extends Enum<? extends TEnum>> enumType = (Class<? extends En...
codereview_new_java_data_8232
import com.linecorp.armeria.client.endpoint.EndpointGroup; import com.linecorp.armeria.common.logging.RequestLog; import com.linecorp.armeria.internal.common.CancellationScheduler; /** * This class exposes extension methods for {@link ClientRequestContext} * which are used internally by Armeria but aren't in...
codereview_new_java_data_8233
protected RequestContextWrapper(T delegate) { /** * Returns the delegate context. */ protected final T delegate() { return unwrap(); } How about deprecating this method? protected RequestContextWrapper(T delegate) { /** * Returns the delegate context. */ + @De...
codereview_new_java_data_8234
private static EnumInfo newEnumInfo(Class<?> enumClass) { final Field[] declaredFields = enumClass.getDeclaredFields(); final List<EnumValueInfo> values = Stream.of(declaredFields) - .filter(Field::isEnumConstant) .map(f -> { final Des...
codereview_new_java_data_8236
public final class FieldInfoBuilder { FieldInfoBuilder(String name, TypeSignature typeSignature) { this.name = requireNonNull(name, "name"); this.typeSignature = requireNonNull(typeSignature, "typeSignature"); - this.childFieldInfos = ImmutableList.of(); } FieldInfoBuilder(Str...
codereview_new_java_data_8237
public static FieldInfo of(String name, TypeSignature typeSignature) { } /** - * Creates a new {@link FieldInfo} with the specified {@code name}, {@link TypeSignature} and DocString. * The {@link FieldLocation} and {@link FieldRequirement} of the {@link FieldInfo} will be * {@code UNSPECIFI...
codereview_new_java_data_8238
public List<FieldInfo> fields() { * Returns the description information of the struct. */ @JsonProperty @JsonInclude(Include.NON_NULL) @Nullable public DescriptionInfo descriptionInfo() { ```suggestion @JsonProperty @Override ``` public List<FieldInfo> fields() { * R...
codereview_new_java_data_8239
void jsonSpecification() throws InterruptedException { addPeriodMethodInfo(methodInfos); addMarkdownDescriptionMethodInfo(methodInfos); addMermaidDescriptionMethodInfo(methodInfos); - final Map<Class<?>, DescriptionInfo> serviceDescription = ImmutableMap.of(MyService.class, - ...
codereview_new_java_data_8240
private static EnumInfo newEnumInfo(Class<?> enumClass) { return new EnumValueInfo(f.getName(), null); }) - .collect(Collectors.toList()); if (description != null) { return new EnumInfo(name, values, DescriptionInfo.of(des...
codereview_new_java_data_8241
public Markup markup() { @Override public String toString() { return MoreObjects.toStringHelper(this) - .omitNullValues() .add("docString", docString) .add("markup", markup) .toString(); Not re...
codereview_new_java_data_8242
public HttpMethod httpMethod() { } /** - * Returns the description information object of the function. */ @JsonProperty @JsonInclude(Include.NON_NULL) How about removing `object` from the Javadoc? `object` seems not to deliver any useful information. ```suggestion * Returns the ...
codereview_new_java_data_8243
public List<FieldInfo> fields() { } /** - * Returns the description information of the struct. */ @JsonProperty @Override ```suggestion * Returns the description information of this struct. ``` public List<FieldInfo> fields() { } /** + * Returns the description...
codereview_new_java_data_8244
public HttpResponse period(@Param Period period) { @Description(value = "## Description method with markdown", markup = Markup.MARKDOWN) @Get("/markdown") public String description(@Param @Description(value = "DESCRIPTION `PARAM`", markup = Markup.MARKDOWN) - ...
codereview_new_java_data_8245
public List<EnumValueInfo> values() { } /** - * Returns description information of the enum. */ @Override public DescriptionInfo descriptionInfo() { ```suggestion * Returns the description information of the enum. ``` public List<EnumValueInfo> values() { } /** + ...
codereview_new_java_data_8246
String value() default DefaultValues.UNSPECIFIED; /** - * The supported markup type in doc service. */ Markup markup() default Markup.NONE; } ```suggestion * The supported markup type in {@link DocService}. ``` String value() default DefaultValues.UNSPECIFIED; /** + ...
codereview_new_java_data_8247
@UnstableApi public enum Markup { /** - * The field is not support markup types. */ NONE, /** - * The field is support the markdown. */ MARKDOWN, /** - * The field is support the mermaid. */ MERMAID } The sentences seem not to be grammatically complete. H...
codereview_new_java_data_8248
public static DescriptionInfo of(String docString) { * @param docString the documentation string * @param markup the supported markup string */ - DescriptionInfo(String docString, Markup markup) { this.docString = requireNonNull(docString, "docString"); this.markup = requireNonNu...