✨ Add errorprone and fix warnings/errors
The compiler will also treat all warnings as errors from now on.
This commit is contained in:
parent
6ffee9d04f
commit
cfac2639ad
101 changed files with 309 additions and 146 deletions
|
|
@ -52,6 +52,7 @@ class AnnotatedMethodService<Context, Result> implements Service<Context, Result
|
|||
executionOrder = order.value();
|
||||
}
|
||||
} catch (final Exception ignored) {
|
||||
// This is fine
|
||||
}
|
||||
this.instance = instance;
|
||||
this.executionOrder = executionOrder;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||
*/
|
||||
public final class PipelineException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = -7092487758537841656L;
|
||||
|
||||
/**
|
||||
* Construct a new pipeline exception
|
||||
*
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ public final class ServicePipeline {
|
|||
* @return Service pipeline instance
|
||||
* @throws Exception Any exceptions thrown during the registration process
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public <T> @NonNull ServicePipeline registerMethods(
|
||||
final @NonNull T instance
|
||||
) throws Exception {
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ public interface ConsumerService<Context>
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("FunctionalInterfaceMethodChanged")
|
||||
default @NonNull State handle(final @NonNull Context context) {
|
||||
try {
|
||||
this.accept(context);
|
||||
|
|
@ -71,6 +72,8 @@ public interface ConsumerService<Context>
|
|||
|
||||
class PipeBurst extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = -1143137258194595985L;
|
||||
|
||||
private PipeBurst() {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ public interface Service<Context, Result> extends Function<@NonNull Context, @Nu
|
|||
@Nullable Result handle(@NonNull Context context) throws Exception;
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("FunctionalInterfaceMethodChanged")
|
||||
default @Nullable Result apply(@NonNull Context context) {
|
||||
try {
|
||||
return this.handle(context);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
//
|
||||
package cloud.commandframework.services.mock;
|
||||
|
||||
public class DefaultMockService implements MockService {
|
||||
public final class DefaultMockService implements MockService {
|
||||
|
||||
@Override
|
||||
public MockResult handle(final MockContext mockContext)
|
||||
|
|
@ -37,6 +37,8 @@ public class DefaultMockService implements MockService {
|
|||
|
||||
public static class TotallyIntentionalException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = -6277471288867949574L;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
//
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2020 Alexander Söderberg & Contributors
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
|
||||
/**
|
||||
* Mock service files
|
||||
*/
|
||||
package cloud.commandframework.services.mock;
|
||||
Loading…
Add table
Add a link
Reference in a new issue