Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b7328f9

Browse files
authored
Enabled NullAway for oauth, proxy and resolver packages (#1876)
1 parent 0750055 commit b7328f9

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

‎client/src/main/java/org/asynchttpclient/proxy/ProxyServer.java‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import io.netty.handler.codec.http.HttpHeaders;
2020
import org.asynchttpclient.Realm;
2121
import org.asynchttpclient.Request;
22+
import org.jetbrains.annotations.Nullable;
2223

2324
import java.util.ArrayList;
2425
import java.util.Collections;
@@ -36,12 +37,13 @@ public class ProxyServer {
3637
private final String host;
3738
private final int port;
3839
private final int securedPort;
39-
private final Realm realm;
40+
private final @NullableRealm realm;
4041
private final List<String> nonProxyHosts;
4142
private final ProxyType proxyType;
42-
private final Function<Request, HttpHeaders> customHeaders;
43+
private final @NullableFunction<Request, HttpHeaders> customHeaders;
4344

44-
public ProxyServer(String host, int port, int securedPort, Realm realm, List<String> nonProxyHosts, ProxyType proxyType, Function<Request, HttpHeaders> customHeaders) {
45+
public ProxyServer(String host, int port, int securedPort, @Nullable Realm realm, List<String> nonProxyHosts, ProxyType proxyType,
46+
@Nullable Function<Request, HttpHeaders> customHeaders) {
4547
this.host = host;
4648
this.port = port;
4749
this.securedPort = securedPort;
@@ -71,15 +73,15 @@ public List<String> getNonProxyHosts() {
7173
return nonProxyHosts;
7274
}
7375

74-
public Realm getRealm() {
76+
public @NullableRealm getRealm() {
7577
return realm;
7678
}
7779

7880
public ProxyType getProxyType() {
7981
return proxyType;
8082
}
8183

82-
public Function<Request, HttpHeaders> getCustomHeaders() {
84+
public @NullableFunction<Request, HttpHeaders> getCustomHeaders() {
8385
return customHeaders;
8486
}
8587

@@ -129,10 +131,10 @@ public static class Builder {
129131
private final String host;
130132
private final int port;
131133
private int securedPort;
132-
private Realm realm;
133-
private List<String> nonProxyHosts;
134-
private ProxyType proxyType;
135-
private Function<Request, HttpHeaders> customHeaders;
134+
private @NullableRealm realm;
135+
private @NullableList<String> nonProxyHosts;
136+
private @NullableProxyType proxyType;
137+
private @NullableFunction<Request, HttpHeaders> customHeaders;
136138

137139
public Builder(String host, int port) {
138140
this.host = host;

‎client/src/main/java/org/asynchttpclient/proxy/ProxyServerSelector.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package org.asynchttpclient.proxy;
1717

1818
import org.asynchttpclient.uri.Uri;
19+
import org.jetbrains.annotations.Nullable;
1920

2021
/**
2122
* Selector for a proxy server
@@ -34,5 +35,5 @@ public interface ProxyServerSelector {
3435
* @param uri The URI to select a proxy server for.
3536
* @return The proxy server to use, if any. May return null.
3637
*/
37-
ProxyServer select(Uri uri);
38+
@NullableProxyServer select(Uri uri);
3839
}

‎pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@
231231
-Xep:NullablePrimitive:ERROR
232232
-Xep:NullOptional:ERROR
233233
-XepExcludedPaths:.*/src/test/java/.*
234-
-XepOpt:NullAway:AnnotatedPackages=org.asynchttpclient.channel,org.asynchttpclient.config,org.asynchttpclient.cookie,org.asynchttpclient.exception,org.asynchttpclient.filter
234+
-XepOpt:NullAway:AnnotatedPackages=org.asynchttpclient.channel,org.asynchttpclient.config,org.asynchttpclient.cookie,org.asynchttpclient.exception,org.asynchttpclient.filter,org.asynchttpclient.oauth,org.asynchttpclient.proxy,org.asynchttpclient.resolver
235235
-XepOpt:NullAway:AcknowledgeRestrictiveAnnotations=true
236236
-Xep:NullAway:ERROR
237237
</arg>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /