Skip to content

Commit 29ee30b

Browse files
committed
remove notnull and nullable internal annotations
1 parent 6629e77 commit 29ee30b

9 files changed

Lines changed: 6 additions & 41 deletions

File tree

lib/src/main/java/com/auth0/jwtdecodejava/JWTDecoder.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import com.auth0.jwtdecodejava.interfaces.Header;
88
import com.auth0.jwtdecodejava.interfaces.JWT;
99
import com.auth0.jwtdecodejava.interfaces.Payload;
10-
import com.sun.istack.internal.NotNull;
1110

1211
import java.util.Date;
1312

@@ -86,7 +85,7 @@ public String getId() {
8685
}
8786

8887
@Override
89-
public Claim getClaim(@NotNull String name) {
88+
public Claim getClaim(String name) {
9089
return payload.getClaim(name);
9190
}
9291

lib/src/main/java/com/auth0/jwtdecodejava/Utils.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.auth0.jwtdecodejava.enums.Algorithm;
44
import com.auth0.jwtdecodejava.exceptions.JWTException;
5-
import com.sun.istack.internal.Nullable;
65
import org.apache.commons.codec.binary.Base64;
76
import org.apache.commons.codec.binary.StringUtils;
87

@@ -14,7 +13,6 @@
1413

1514
public class Utils {
1615

17-
@Nullable
1816
public static String base64Decode(String string) throws JWTException {
1917
String decoded;
2018
try {
@@ -25,7 +23,6 @@ public static String base64Decode(String string) throws JWTException {
2523
return decoded;
2624
}
2725

28-
@Nullable
2926
public static String base64Encode(String string) throws JWTException {
3027
String encoded;
3128
try {

lib/src/main/java/com/auth0/jwtdecodejava/impl/ClaimImpl.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import com.fasterxml.jackson.core.JsonProcessingException;
66
import com.fasterxml.jackson.databind.JsonNode;
77
import com.fasterxml.jackson.databind.ObjectMapper;
8-
import com.sun.istack.internal.NotNull;
98

109
import java.lang.reflect.Array;
1110
import java.util.ArrayList;
@@ -17,7 +16,7 @@ class ClaimImpl extends BaseClaim {
1716

1817
private final JsonNode data;
1918

20-
private ClaimImpl(@NotNull JsonNode node) {
19+
private ClaimImpl(JsonNode node) {
2120
this.data = node;
2221
}
2322

@@ -87,12 +86,11 @@ public <T> List<T> asList(Class<T> tClazz) throws JWTException {
8786
return list;
8887
}
8988

90-
public static Claim extractClaim(@NotNull String claimName, @NotNull Map<String, JsonNode> tree) {
89+
public static Claim extractClaim(String claimName, Map<String, JsonNode> tree) {
9190
JsonNode node = tree.get(claimName);
9291
return claimFromNode(node);
9392
}
9493

95-
@NotNull
9694
public static Claim claimFromNode(JsonNode node) {
9795
if (node == null || node.isNull() || node.isMissingNode()) {
9896
return new BaseClaim();

lib/src/main/java/com/auth0/jwtdecodejava/impl/PayloadImpl.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import com.auth0.jwtdecodejava.interfaces.Claim;
44
import com.auth0.jwtdecodejava.interfaces.Payload;
55
import com.fasterxml.jackson.databind.JsonNode;
6-
import com.sun.istack.internal.NotNull;
76

87
import java.util.Date;
98
import java.util.Map;
@@ -67,7 +66,7 @@ public String getId() {
6766
}
6867

6968
@Override
70-
public Claim getClaim(@NotNull String name) {
69+
public Claim getClaim(String name) {
7170
return extractClaim(name, tree);
7271
}
7372

lib/src/main/java/com/auth0/jwtdecodejava/interfaces/Claim.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.auth0.jwtdecodejava.interfaces;
22

33
import com.auth0.jwtdecodejava.exceptions.JWTException;
4-
import com.sun.istack.internal.Nullable;
54

65
import java.util.Date;
76
import java.util.List;
@@ -16,7 +15,6 @@ public interface Claim {
1615
*
1716
* @return the value as a Boolean or null.
1817
*/
19-
@Nullable
2018
Boolean asBoolean();
2119

2220
/**
@@ -25,7 +23,6 @@ public interface Claim {
2523
*
2624
* @return the value as an Integer or null.
2725
*/
28-
@Nullable
2926
Integer asInt();
3027

3128
/**
@@ -34,7 +31,6 @@ public interface Claim {
3431
*
3532
* @return the value as a Double or null.
3633
*/
37-
@Nullable
3834
Double asDouble();
3935

4036
/**
@@ -43,7 +39,6 @@ public interface Claim {
4339
*
4440
* @return the value as a String or null.
4541
*/
46-
@Nullable
4742
String asString();
4843

4944
/**
@@ -52,7 +47,6 @@ public interface Claim {
5247
*
5348
* @return the value as a Date or null.
5449
*/
55-
@Nullable
5650
Date asDate();
5751

5852
/**
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
package com.auth0.jwtdecodejava.interfaces;
22

33
import com.auth0.jwtdecodejava.enums.Algorithm;
4-
import com.sun.istack.internal.Nullable;
5-
6-
import java.util.Map;
74

85
public interface Header {
96

10-
@Nullable
117
Algorithm getAlgorithm();
128

13-
@Nullable
149
String getType();
1510

16-
@Nullable
1711
String getContentType();
1812

1913
}
Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
package com.auth0.jwtdecodejava.interfaces;
22

3-
import com.sun.istack.internal.NotNull;
4-
import com.sun.istack.internal.Nullable;
5-
63
import java.util.Date;
7-
import java.util.Map;
84

95
public interface Payload {
106

@@ -13,55 +9,48 @@ public interface Payload {
139
*
1410
* @return the Issuer value or null.
1511
*/
16-
@Nullable
1712
String getIssuer();
1813

1914
/**
2015
* Get the value of the "sub" claim, or null if it's not available.
2116
*
2217
* @return the Subject value or null.
2318
*/
24-
@Nullable
2519
String getSubject();
2620

2721
/**
2822
* Get the value of the "aud" claim, or null if it's not available.
2923
*
3024
* @return the Audience value or null.
3125
*/
32-
@Nullable
3326
String[] getAudience();
3427

3528
/**
3629
* Get the value of the "exp" claim, or null if it's not available.
3730
*
3831
* @return the Expiration Time value or null.
3932
*/
40-
@Nullable
4133
Date getExpiresAt();
4234

4335
/**
4436
* Get the value of the "nbf" claim, or null if it's not available.
4537
*
4638
* @return the Not Before value or null.
4739
*/
48-
@Nullable
4940
Date getNotBefore();
5041

5142
/**
5243
* Get the value of the "iat" claim, or null if it's not available.
5344
*
5445
* @return the Issued At value or null.
5546
*/
56-
@Nullable
5747
Date getIssuedAt();
5848

5949
/**
6050
* Get the value of the "jti" claim, or null if it's not available.
6151
*
6252
* @return the Payload ID value or null.
6353
*/
64-
@Nullable
6554
String getId();
6655

6756
/**
@@ -70,6 +59,5 @@ public interface Payload {
7059
* @param name the name of the Claim to retrieve.
7160
* @return the Claim if found or null.
7261
*/
73-
@Nullable
74-
Claim getClaim(@NotNull String name);
62+
Claim getClaim(String name);
7563
}
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
package com.auth0.jwtdecodejava.interfaces;
22

3-
import com.sun.istack.internal.Nullable;
4-
53
public interface Signature {
64

75
/**
86
* Get the Signature from this Payload as a Base64 encoded String.
97
*
108
* @return the Signature of the Payload.
119
*/
12-
@Nullable
1310
String getSignature();
1411
}

lib/src/test/java/com/auth0/jwtdecodejava/JWTDecoderTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import com.auth0.jwtdecodejava.impl.BaseClaim;
66
import com.auth0.jwtdecodejava.interfaces.Claim;
77
import com.auth0.jwtdecodejava.interfaces.JWT;
8-
import com.sun.istack.internal.Nullable;
98
import org.junit.Rule;
109
import org.junit.Test;
1110
import org.junit.rules.ExpectedException;
@@ -224,7 +223,7 @@ public void shouldGetNullClaimIfClaimValueIsNull() throws Exception {
224223

225224
//Helper Methods
226225

227-
private JWT customTimeJWT(@Nullable Long iat, @Nullable Long exp) {
226+
private JWT customTimeJWT(Long iat, Long exp) {
228227
String header = base64Encode("{}");
229228
StringBuilder bodyBuilder = new StringBuilder("{");
230229
if (iat != null) {

0 commit comments

Comments
 (0)