diff --git a/api/src/org/labkey/api/assay/AssaySchema.java b/api/src/org/labkey/api/assay/AssaySchema.java index 40bf261ee3b..c74785bcae0 100644 --- a/api/src/org/labkey/api/assay/AssaySchema.java +++ b/api/src/org/labkey/api/assay/AssaySchema.java @@ -41,12 +41,12 @@ public abstract class AssaySchema extends UserSchema @Nullable protected Container _targetStudy; - public AssaySchema(String name, User user, Container container, DbSchema dbSchema, @Nullable Container targetStudy) + public AssaySchema(String name, @NotNull User user, @NotNull Container container, DbSchema dbSchema, @Nullable Container targetStudy) { this(SchemaKey.fromParts(name), DESCR, user, container, dbSchema, targetStudy); } - protected AssaySchema(SchemaKey path, String description, User user, Container container, DbSchema dbSchema, @Nullable Container targetStudy) + protected AssaySchema(SchemaKey path, String description, @NotNull User user, @NotNull Container container, DbSchema dbSchema, @Nullable Container targetStudy) { super(path, description, user, container, dbSchema, null); _targetStudy = targetStudy; diff --git a/api/src/org/labkey/api/exp/query/AbstractExpSchema.java b/api/src/org/labkey/api/exp/query/AbstractExpSchema.java index c564dddc63c..d28c7e7e034 100644 --- a/api/src/org/labkey/api/exp/query/AbstractExpSchema.java +++ b/api/src/org/labkey/api/exp/query/AbstractExpSchema.java @@ -31,7 +31,7 @@ public abstract class AbstractExpSchema extends UserSchema { protected ContainerFilter _containerFilter = null; - public AbstractExpSchema(String name, String description, User user, Container container, DbSchema dbSchema) + public AbstractExpSchema(String name, String description, @NotNull User user, @NotNull Container container, DbSchema dbSchema) { this(SchemaKey.fromParts(name), description, user, container, dbSchema); } diff --git a/api/src/org/labkey/api/query/AbstractSchema.java b/api/src/org/labkey/api/query/AbstractSchema.java index 280ff7e7896..5bb8714c373 100644 --- a/api/src/org/labkey/api/query/AbstractSchema.java +++ b/api/src/org/labkey/api/query/AbstractSchema.java @@ -16,6 +16,7 @@ package org.labkey.api.query; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.labkey.api.data.AbstractTableInfo; import org.labkey.api.data.Container; @@ -29,6 +30,7 @@ import java.util.Collection; import java.util.Collections; import java.util.List; +import java.util.Objects; import java.util.Set; abstract public class AbstractSchema implements QuerySchema @@ -39,11 +41,11 @@ abstract public class AbstractSchema implements QuerySchema protected final Container _container; protected boolean _hidden = false; - public AbstractSchema(DbSchema dbSchema, User user, Container container) + public AbstractSchema(DbSchema dbSchema, @NotNull User user, @NotNull Container container) { _dbSchema = dbSchema; - _user = user; - _container = container; + _user = Objects.requireNonNull(user); + _container = Objects.requireNonNull(container); MemTracker.get().put(this); } diff --git a/api/src/org/labkey/api/query/DefaultSchema.java b/api/src/org/labkey/api/query/DefaultSchema.java index 91b5452722c..f8dce59d333 100644 --- a/api/src/org/labkey/api/query/DefaultSchema.java +++ b/api/src/org/labkey/api/query/DefaultSchema.java @@ -207,7 +207,7 @@ public static QuerySchema resolve(QuerySchema schema, SchemaKey schemaPath) return schema; } - private DefaultSchema(User user, Container container) + private DefaultSchema(@NotNull User user, @NotNull Container container) { super(null, user, container); MemTracker.getInstance().put(this); diff --git a/api/src/org/labkey/api/query/SimpleUserSchema.java b/api/src/org/labkey/api/query/SimpleUserSchema.java index 6b172aaae77..9e473dc3129 100644 --- a/api/src/org/labkey/api/query/SimpleUserSchema.java +++ b/api/src/org/labkey/api/query/SimpleUserSchema.java @@ -78,7 +78,7 @@ public class SimpleUserSchema extends UserSchema private final Set _available = new CaseInsensitiveTreeSet(); protected Set _visible; - public SimpleUserSchema(String name, @Nullable String description, User user, Container container, DbSchema dbschema) + public SimpleUserSchema(String name, @Nullable String description, @NotNull User user, @NotNull Container container, DbSchema dbschema) { super(name, description, user, container, dbschema); if (dbschema != null) diff --git a/api/src/org/labkey/api/query/UserSchema.java b/api/src/org/labkey/api/query/UserSchema.java index ad8e0467bce..400b30fd983 100644 --- a/api/src/org/labkey/api/query/UserSchema.java +++ b/api/src/org/labkey/api/query/UserSchema.java @@ -78,12 +78,12 @@ abstract public class UserSchema extends AbstractSchema implements MemTrackable protected java.util.function.Predicate _getTableAcceptor = (t) -> true; - public UserSchema(@NotNull String name, @Nullable String description, User user, Container container, DbSchema dbSchema) + public UserSchema(@NotNull String name, @Nullable String description, @NotNull User user, @NotNull Container container, DbSchema dbSchema) { this(SchemaKey.fromParts(name), description, user, container, dbSchema, null); } - public UserSchema(@NotNull SchemaKey path, @Nullable String description, User user, Container container, DbSchema dbSchema, Collection schemaCustomizers) + public UserSchema(@NotNull SchemaKey path, @Nullable String description, @NotNull User user, @NotNull Container container, DbSchema dbSchema, Collection schemaCustomizers) { super(dbSchema, user, container); _name = path.getName(); diff --git a/study/src/org/labkey/study/query/StudyQuerySchema.java b/study/src/org/labkey/study/query/StudyQuerySchema.java index 350ed869fce..d4a744d79af 100644 --- a/study/src/org/labkey/study/query/StudyQuerySchema.java +++ b/study/src/org/labkey/study/query/StudyQuerySchema.java @@ -189,7 +189,7 @@ public class StudyQuerySchema extends UserSchema implements UserSchema.HasContex /** use StudyQuerySchema.createSchema() */ - protected StudyQuerySchema(@NotNull StudyImpl study, User user, @Nullable Role contextualRole) + protected StudyQuerySchema(@NotNull StudyImpl study, @NotNull User user, @Nullable Role contextualRole) { this(study, study.getContainer(), user, contextualRole); @@ -207,7 +207,7 @@ protected StudyQuerySchema(@NotNull StudyImpl study, User user, @Nullable Role c /** * This c-tor is for schemas that have no study defined -- _study is null! */ - private StudyQuerySchema(@Nullable StudyImpl study, Container c, User user, @Nullable Role contextualRole) + private StudyQuerySchema(@Nullable StudyImpl study, @NotNull Container c, @NotNull User user, @Nullable Role contextualRole) { this(SchemaKey.fromParts(SCHEMA_NAME), SCHEMA_DESCRIPTION, study, c, user, contextualRole); } @@ -215,7 +215,7 @@ private StudyQuerySchema(@Nullable StudyImpl study, Container c, User user, @Nul /** * This c-tor is for nested study schemas */ - protected StudyQuerySchema(SchemaKey path, String description, @Nullable StudyImpl study, Container c, User user, @Nullable Role contextualRole) + protected StudyQuerySchema(SchemaKey path, String description, @Nullable StudyImpl study, @NotNull Container c, @NotNull User user, @Nullable Role contextualRole) { super(path, description, user, c, StudySchema.getInstance().getSchema(), null); _study = study;