Skip to content

Commit

Permalink
fix #350 Fix the warnings produced by errorprone compiler plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
violetagg committed Nov 6, 2020
1 parent d67ce23 commit a6f7a2b
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ subprojects {
"-Xlint:unchecked",
"-Xlint:-serial", // intentionally disabled
"-Xlint:-options", // intentionally disabled
"-Xlint:-fallthrough", // intentionally disabled
"-Xlint:fallthrough",
"-Xlint:rawtypes"
]

Expand Down
10 changes: 0 additions & 10 deletions gradle/errorprone.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,3 @@ dependencies {
errorprone "com.google.guava:guava:$guavaVersion" // prevents conflicts with guava versions of other gradle plugins
errorproneJavac "com.google.errorprone:javac:$errorproneJavacVersion"
}

// Change all errorprone errors to warnings
// TODO: remove when warning have been resolved
project.afterEvaluate {
tasks.withType(JavaCompile) {
options.errorprone {
allErrorsAsWarnings = true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ default SocketAddress address(){
* Releases or closes the underlying {@link Channel}
*/
@Override
@SuppressWarnings("FutureReturnValueIgnored")
@SuppressWarnings({"FutureReturnValueIgnored", "FunctionalInterfaceMethodChanged"})
default void dispose() {
//"FutureReturnValueIgnored" this is deliberate
channel().close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ public void accept(I i) {

// Context interface impl
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings({"unchecked", "rawtypes", "TypeParameterUnusedInFormals"})
public <T> T get(Object key) {
if (KEY_ON_DISCARD == key) {
return (T) this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ default void disposeWhen(SocketAddress address) {
* if you need to synchronously wait for the underlying resources to be disposed.
*/
@Override
@SuppressWarnings("FunctionalInterfaceMethodChanged")
default void dispose() {
//noop default
disposeLater().subscribe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ default boolean daemon() {
* if you need to synchronously wait for the underlying resources to be disposed.
*/
@Override
@SuppressWarnings("FunctionalInterfaceMethodChanged")
default void dispose() {
//noop default
disposeLater().subscribe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ public Iterable<String> searchDomains() {
}

@Override
@SuppressWarnings("UndefinedEquals")
public boolean equals(Object o) {
if (this == o) {
return true;
Expand All @@ -372,6 +373,7 @@ public boolean equals(Object o) {
Objects.equals(loopResources, that.loopResources) &&
queryTimeout.equals(that.queryTimeout) &&
resolvedAddressTypes == that.resolvedAddressTypes &&
// searchDomains is List so Objects.equals is OK
Objects.equals(searchDomains, that.searchDomains);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,14 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
// stop accept new connections for 1 second to allow the channel to recover
// See https://github.com/netty/netty/issues/1328
config.setAutoRead(false);
ctx.channel().eventLoop().schedule(enableAutoReadTask, 1, TimeUnit.SECONDS);
ctx.channel()
.eventLoop()
.schedule(enableAutoReadTask, 1, TimeUnit.SECONDS)
.addListener(future -> {
if (!future.isSuccess()) {
log.debug(format(ctx.channel(), "Cannot enable auto-read"), future.cause());
}
});
}
// still let the exceptionCaught event flow through the pipeline to give the user
// a chance to do something with it
Expand Down

0 comments on commit a6f7a2b

Please sign in to comment.