Add explict this checkstyle rule and fix violations

This commit is contained in:
broccolai 2021-01-28 09:30:10 +00:00 committed by Jason
parent a6eb44376c
commit d5259dfbe4
62 changed files with 195 additions and 192 deletions

View file

@ -69,7 +69,7 @@ class AnnotatedMethodService<Context, Result> implements Service<Context, Result
} catch (final Throwable throwable) {
new IllegalStateException(String
.format("Failed to call method service implementation '%s' in class '%s'",
method.getName(), instance.getClass().getCanonicalName()
this.method.getName(), this.instance.getClass().getCanonicalName()
), throwable)
.printStackTrace();
}

View file

@ -76,7 +76,7 @@ public final class ServicePipeline {
final @NonNull Service<@NonNull Context, @NonNull Result> defaultImplementation
) {
synchronized (this.lock) {
if (repositories.containsKey(type.getType())) {
if (this.repositories.containsKey(type.getType())) {
throw new IllegalArgumentException(String
.format(
"Service of type '%s' has already been registered",
@ -151,7 +151,7 @@ public final class ServicePipeline {
final @NonNull Collection<Predicate<Context>> filters
) {
synchronized (this.lock) {
final ServiceRepository<Context, Result> repository = getRepository(type);
final ServiceRepository<Context, Result> repository = this.getRepository(type);
repository.registerImplementation(implementation, filters);
}
return this;
@ -175,7 +175,7 @@ public final class ServicePipeline {
final @NonNull Service<Context, Result> implementation,
final @NonNull Collection<Predicate<Context>> filters
) {
return registerServiceImplementation(TypeToken.get(type), implementation, filters);
return this.registerServiceImplementation(TypeToken.get(type), implementation, filters);
}
/**
@ -229,7 +229,7 @@ public final class ServicePipeline {
public <Context, Result, S extends Service<Context, Result>> Collection<TypeToken<? extends S>> getImplementations(
final @NonNull TypeToken<S> type
) {
ServiceRepository<Context, Result> repository = getRepository(type);
ServiceRepository<Context, Result> repository = this.getRepository(type);
List<TypeToken<? extends S>> collection = new LinkedList<>();
final LinkedList<? extends ServiceRepository<Context, Result>.ServiceWrapper<? extends Service<Context, Result>>>
queue = repository.getQueue();

View file

@ -107,7 +107,7 @@ public final class ServiceRepository<Context, Response> {
final @NonNull T implementation,
final @NonNull Collection<Predicate<Context>> filters
) {
this.defaultImplementation = implementations.isEmpty();
this.defaultImplementation = ServiceRepository.this.implementations.isEmpty();
this.implementation = implementation;
this.filters = filters;
ExecutionOrder executionOrder = implementation.order();
@ -139,8 +139,8 @@ public final class ServiceRepository<Context, Response> {
@Override
public String toString() {
return String
.format("ServiceWrapper{type=%s,implementation=%s}", serviceType.toString(),
TypeToken.get(implementation.getClass()).toString()
.format("ServiceWrapper{type=%s,implementation=%s}", ServiceRepository.this.serviceType.toString(),
TypeToken.get(this.implementation.getClass()).toString()
);
}

View file

@ -133,7 +133,7 @@ public final class ServiceSpigot<Context, Result> {
*/
public void getResult(final @NonNull BiConsumer<Result, Throwable> consumer) {
try {
consumer.accept(getResult(), null);
consumer.accept(this.getResult(), null);
} catch (final PipelineException pipelineException) {
consumer.accept(null, pipelineException.getCause());
} catch (final Exception e) {
@ -167,7 +167,7 @@ public final class ServiceSpigot<Context, Result> {
* @return New pump, for the result of this request
*/
public @NonNull CompletableFuture<ServicePump<Result>> forwardAsynchronously() {
return this.getResultAsynchronously().thenApply(pipeline::pump);
return this.getResultAsynchronously().thenApply(this.pipeline::pump);
}
}