Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2020-01-11 18:11:05 +0000
committerbroberts2020-02-28 18:17:29 +0000
commitacaa35aee1f0f7b344b25145de6eb1b3fbc18900 (patch)
tree0199fad3db4a0ee3ce5267b2a5f25d5459cb63e9
parent6eac287baee034de0035c5112b1e970f664f0c9f (diff)
downloadorg.eclipse.osee-beta_no_fb.tar.gz
org.eclipse.osee-beta_no_fb.tar.xz
org.eclipse.osee-beta_no_fb.zip
refactor: Improve null safety of Json SerializerOSEE_0.26.0_NR_202003230211beta_no_fb
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ApplicabilityToken.java3
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactId.java3
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactToken.java5
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TransactionId.java3
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TransactionTokenDeserializer.java3
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TransactionTokenSerializer.java3
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/UserToken.java3
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/UserTokenDeserializer.java3
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/UserTokenSerializer.java3
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/JsonUtil.java12
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/IdSerializer.java3
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.orcs.test/META-INF/MANIFEST.MF1
14 files changed, 31 insertions, 16 deletions
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ApplicabilityToken.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ApplicabilityToken.java
index 7bf56abfafb..369b933344d 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ApplicabilityToken.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ApplicabilityToken.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.framework.core.data;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.osee.framework.jdk.core.type.NamedIdBase;
import org.eclipse.osee.framework.jdk.core.type.NamedIdSerializer;
@@ -30,7 +31,7 @@ public class ApplicabilityToken extends NamedIdBase implements ApplicabilityId {
super(applId, name);
}
- public static ApplicabilityToken valueOf(@JsonProperty("id") long id, @JsonProperty("name") String name) {
+ public static @NonNull ApplicabilityToken valueOf(@JsonProperty("id") long id, @JsonProperty("name") String name) {
return new ApplicabilityToken(id, name);
}
}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactId.java
index 59429513869..76952325e78 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactId.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactId.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.framework.core.data;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.osee.framework.jdk.core.type.BaseId;
import org.eclipse.osee.framework.jdk.core.type.Id;
import org.eclipse.osee.framework.jdk.core.type.IdSerializer;
@@ -45,7 +46,7 @@ public interface ArtifactId extends Id {
return valueOf(Long.valueOf(id));
}
- public static ArtifactId valueOf(Long id) {
+ public static @NonNull ArtifactId valueOf(Long id) {
final class ArtifactIdImpl extends BaseId implements ArtifactId, Comparable<ArtifactId> {
private final Long id;
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactToken.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactToken.java
index 49ecc520dbc..f5f4c816270 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactToken.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/ArtifactToken.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.framework.core.data;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.osee.framework.jdk.core.type.Id;
import org.eclipse.osee.framework.jdk.core.type.Identity;
import org.eclipse.osee.framework.jdk.core.type.NamedId;
@@ -70,7 +71,7 @@ public interface ArtifactToken extends ArtifactId, HasBranch, NamedId, Identity<
return valueOf(id, GUID.create(), name, branch, ArtifactTypeToken.SENTINEL);
}
- public static ArtifactToken valueOf(long id, String name) {
+ public static @NonNull ArtifactToken valueOf(long id, String name) {
return valueOf(id, GUID.create(), name, BranchId.SENTINEL, ArtifactTypeToken.SENTINEL);
}
@@ -82,7 +83,7 @@ public interface ArtifactToken extends ArtifactId, HasBranch, NamedId, Identity<
return valueOf(id, GUID.create(), name, branch, artifactType);
}
- public static ArtifactToken valueOf(long id, String guid, String name, BranchId branch, ArtifactTypeToken artifactType) {
+ public static @NonNull ArtifactToken valueOf(long id, String guid, String name, BranchId branch, ArtifactTypeToken artifactType) {
return new ArtifactTokenImpl(id, guid, name, branch, artifactType);
}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TransactionId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TransactionId.java
index c73cd286fee..0d65da93454 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TransactionId.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TransactionId.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.framework.core.data;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.osee.framework.jdk.core.type.BaseId;
import org.eclipse.osee.framework.jdk.core.type.Id;
@@ -31,7 +32,7 @@ public interface TransactionId extends Id {
return valueOf(Long.valueOf(id));
}
- public static TransactionId valueOf(Long id) {
+ public static @NonNull TransactionId valueOf(Long id) {
final class TransactionToken extends BaseId implements TransactionId {
public TransactionToken(Long txId) {
super(txId);
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TransactionTokenDeserializer.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TransactionTokenDeserializer.java
index 69e6ff6dca6..c60f7229e80 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TransactionTokenDeserializer.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TransactionTokenDeserializer.java
@@ -16,11 +16,12 @@ import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import java.io.IOException;
+import org.eclipse.jdt.annotation.NonNull;
/**
* @author Donald G. Dunne
*/
-public class TransactionTokenDeserializer extends StdDeserializer<TransactionToken> {
+public class TransactionTokenDeserializer extends StdDeserializer<@NonNull TransactionToken> {
public TransactionTokenDeserializer() {
this(TransactionToken.class);
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TransactionTokenSerializer.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TransactionTokenSerializer.java
index 29e770789db..f421dc819a8 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TransactionTokenSerializer.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/TransactionTokenSerializer.java
@@ -18,11 +18,12 @@ import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import java.io.IOException;
import java.lang.reflect.Type;
+import org.eclipse.jdt.annotation.NonNull;
/**
* @author Donald G. Dunne
*/
-public class TransactionTokenSerializer extends StdSerializer<TransactionToken> {
+public class TransactionTokenSerializer extends StdSerializer<@NonNull TransactionToken> {
public TransactionTokenSerializer() {
super(TransactionToken.class);
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/UserToken.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/UserToken.java
index feffb46b500..cc137b2f1b8 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/UserToken.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/UserToken.java
@@ -18,6 +18,7 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.enums.CoreUserGroups;
@@ -40,7 +41,7 @@ public interface UserToken extends ArtifactToken, UserId {
return new UserTokenImpl(id, name, userId, active, email, java.util.Collections.singleton(userId), roles);
}
- public static UserToken create(long id, String name, String email, String userId, boolean active, Collection<String> loginIds, IUserGroupArtifactToken... roles) {
+ public static @NonNull UserToken create(long id, String name, String email, String userId, boolean active, Collection<String> loginIds, IUserGroupArtifactToken... roles) {
return new UserTokenImpl(id, name, userId, active, email, loginIds, roles);
}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/UserTokenDeserializer.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/UserTokenDeserializer.java
index d71bef2897f..40a596557ad 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/UserTokenDeserializer.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/UserTokenDeserializer.java
@@ -18,11 +18,12 @@ import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.jdt.annotation.NonNull;
/**
* @author Stephen J. Molaro
*/
-public class UserTokenDeserializer extends StdDeserializer<UserToken> {
+public class UserTokenDeserializer extends StdDeserializer<@NonNull UserToken> {
private static final long serialVersionUID = 1L;
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/UserTokenSerializer.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/UserTokenSerializer.java
index 5ca61df2468..418fb71adf8 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/UserTokenSerializer.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/UserTokenSerializer.java
@@ -18,11 +18,12 @@ import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import java.io.IOException;
import java.lang.reflect.Type;
+import org.eclipse.jdt.annotation.NonNull;
/**
* @author Stephen J. Molaro
*/
-public class UserTokenSerializer extends StdSerializer<UserToken> {
+public class UserTokenSerializer extends StdSerializer<@NonNull UserToken> {
private static final long serialVersionUID = 1L;
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/JsonUtil.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/JsonUtil.java
index f32d8a35f4b..83465c0572d 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/JsonUtil.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/util/JsonUtil.java
@@ -26,6 +26,7 @@ import com.fasterxml.jackson.databind.module.SimpleModule;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Map;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.osee.framework.core.data.ApplicabilityToken;
import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.ArtifactToken;
@@ -164,17 +165,18 @@ public class JsonUtil {
SimpleModule module = new SimpleModule("OSEE", new Version(1, 0, 0, "", "", ""));
module.addDeserializer(ApplicabilityToken.class, new NamedIdDeserializer<>(ApplicabilityToken::valueOf));
- module.addDeserializer(ArtifactToken.class, new NamedIdDeserializer<ArtifactToken>(ArtifactToken::valueOf));
- module.addDeserializer(ArtifactId.class, new IdDeserializer<ArtifactId>(ArtifactId::valueOf));
+ module.addDeserializer(ArtifactToken.class,
+ new NamedIdDeserializer<@NonNull ArtifactToken>(ArtifactToken::valueOf));
+ module.addDeserializer(ArtifactId.class, new IdDeserializer<@NonNull ArtifactId>(ArtifactId::valueOf));
module.addDeserializer(TransactionToken.class, new TransactionTokenDeserializer());
- module.addSerializer(TransactionToken.class, new TransactionTokenSerializer());
module.addDeserializer(UserToken.class, new UserTokenDeserializer());
+ module.addDeserializer(TransactionId.class, new IdDeserializer<@NonNull TransactionId>(TransactionId::valueOf));
+ module.addSerializer(TransactionToken.class, new TransactionTokenSerializer());
module.addSerializer(UserToken.class, new UserTokenSerializer());
- JsonSerializer<Id> idSerializer = new IdSerializer();
+ JsonSerializer<@NonNull Id> idSerializer = new IdSerializer();
module.addSerializer(TransactionId.class, idSerializer);
module.addSerializer(BranchType.class, idSerializer);
module.addSerializer(BranchState.class, idSerializer);
- module.addDeserializer(TransactionId.class, new IdDeserializer<TransactionId>(TransactionId::valueOf));
objectMapper.registerModule(module);
return objectMapper;
diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/IdSerializer.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/IdSerializer.java
index 73fbb4c1192..62ef629f929 100644
--- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/IdSerializer.java
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/IdSerializer.java
@@ -18,11 +18,12 @@ import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import java.io.IOException;
import java.lang.reflect.Type;
+import org.eclipse.jdt.annotation.NonNull;
/**
* @author Ryan D. Brooks
*/
-public class IdSerializer extends StdSerializer<Id> {
+public class IdSerializer extends StdSerializer<@NonNull Id> {
public IdSerializer() {
super(Id.class);
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
index 202326a1efa..b233d4e5676 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/META-INF/MANIFEST.MF
@@ -39,6 +39,7 @@ Import-Package: com.fasterxml.jackson.core.type,
org.eclipse.emf.common.util,
org.eclipse.emf.ecore.resource,
org.eclipse.equinox.app,
+ org.eclipse.jdt.annotation,
org.eclipse.jdt.core,
org.eclipse.jdt.core.search,
org.eclipse.jface.action,
diff --git a/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF
index af24a1d2adf..662ad2efbbe 100644
--- a/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF
@@ -21,6 +21,7 @@ Import-Package: com.fasterxml.jackson.annotation,
org.eclipse.emf.common.util,
org.eclipse.emf.ecore,
org.eclipse.emf.ecore.util,
+ org.eclipse.jdt.annotation,
org.eclipse.osee.console.admin,
org.eclipse.osee.framework.core.access,
org.eclipse.osee.framework.core.applicability,
diff --git a/plugins/org.eclipse.osee.orcs.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.test/META-INF/MANIFEST.MF
index 6904fd0f776..3eff0472098 100644
--- a/plugins/org.eclipse.osee.orcs.test/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs.test/META-INF/MANIFEST.MF
@@ -11,6 +11,7 @@ Require-Bundle: org.hamcrest.core,
org.mockito;visibility:=reexport
Import-Package: com.google.common.base,
com.google.common.collect,
+ org.eclipse.jdt.annotation,
org.eclipse.osee.framework.core.services,
org.eclipse.osee.framework.core.util,
org.eclipse.osee.jdbc,

Back to the top