KEYCLOAK-12214 Fix minor warnings for collections in module "server-spi"
This commit is contained in:
parent
5f50c2951a
commit
301e76c0b9
8 changed files with 19 additions and 22 deletions
|
@ -98,7 +98,7 @@ public interface ComponentFactory<CreatedType, ProviderType extends Provider> ex
|
||||||
*/
|
*/
|
||||||
default
|
default
|
||||||
List<ProviderConfigProperty> getCommonProviderConfigProperties() {
|
List<ProviderConfigProperty> getCommonProviderConfigProperties() {
|
||||||
return Collections.EMPTY_LIST;
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,7 +109,7 @@ public interface ComponentFactory<CreatedType, ProviderType extends Provider> ex
|
||||||
*/
|
*/
|
||||||
default
|
default
|
||||||
Map<String, Object> getTypeMetadata() {
|
Map<String, Object> getTypeMetadata() {
|
||||||
return Collections.EMPTY_MAP;
|
return Collections.emptyMap();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class AuthenticatorConfigModel implements Serializable {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
private String alias;
|
private String alias;
|
||||||
private Map<String, String> config = new HashMap<String, String>();
|
private Map<String, String> config = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class IdentityProviderModel implements Serializable {
|
||||||
* <p>A map containing the configuration and properties for a specific identity provider instance and implementation. The items
|
* <p>A map containing the configuration and properties for a specific identity provider instance and implementation. The items
|
||||||
* in the map are understood by the identity provider implementation.</p>
|
* in the map are understood by the identity provider implementation.</p>
|
||||||
*/
|
*/
|
||||||
private Map<String, String> config = new HashMap<String, String>();
|
private Map<String, String> config = new HashMap<>();
|
||||||
|
|
||||||
public IdentityProviderModel() {
|
public IdentityProviderModel() {
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ public class IdentityProviderModel implements Serializable {
|
||||||
this.providerId = model.getProviderId();
|
this.providerId = model.getProviderId();
|
||||||
this.alias = model.getAlias();
|
this.alias = model.getAlias();
|
||||||
this.displayName = model.getDisplayName();
|
this.displayName = model.getDisplayName();
|
||||||
this.config = new HashMap<String, String>(model.getConfig());
|
this.config = new HashMap<>(model.getConfig());
|
||||||
this.enabled = model.isEnabled();
|
this.enabled = model.isEnabled();
|
||||||
this.trustEmail = model.isTrustEmail();
|
this.trustEmail = model.isTrustEmail();
|
||||||
this.storeToken = model.isStoreToken();
|
this.storeToken = model.isStoreToken();
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class RequiredCredentialModel implements Serializable {
|
||||||
public static final RequiredCredentialModel KERBEROS;
|
public static final RequiredCredentialModel KERBEROS;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Map<String, RequiredCredentialModel> map = new HashMap<String, RequiredCredentialModel>();
|
Map<String, RequiredCredentialModel> map = new HashMap<>();
|
||||||
PASSWORD = new RequiredCredentialModel();
|
PASSWORD = new RequiredCredentialModel();
|
||||||
PASSWORD.setType(PasswordCredentialModel.TYPE);
|
PASSWORD.setType(PasswordCredentialModel.TYPE);
|
||||||
PASSWORD.setInput(true);
|
PASSWORD.setInput(true);
|
||||||
|
|
|
@ -174,8 +174,7 @@ public class HmacOTP {
|
||||||
|
|
||||||
// Copy all the REAL bytes, not the "first"
|
// Copy all the REAL bytes, not the "first"
|
||||||
byte[] ret = new byte[bArray.length - 1];
|
byte[] ret = new byte[bArray.length - 1];
|
||||||
for (int i = 0; i < ret.length; i++)
|
System.arraycopy(bArray, 1, ret, 0, ret.length);
|
||||||
ret[i] = bArray[i + 1];
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ public interface UserStorageProviderFactory<T extends UserStorageProvider> exten
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default List<ProviderConfigProperty> getConfigProperties() {
|
default List<ProviderConfigProperty> getConfigProperties() {
|
||||||
return Collections.EMPTY_LIST;
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -62,7 +62,7 @@ public abstract class AbstractUserAdapter implements UserModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getRequiredActions() {
|
public Set<String> getRequiredActions() {
|
||||||
return Collections.EMPTY_SET;
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -94,7 +94,7 @@ public abstract class AbstractUserAdapter implements UserModel {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected Set<GroupModel> getGroupsInternal() {
|
protected Set<GroupModel> getGroupsInternal() {
|
||||||
return Collections.EMPTY_SET;
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,7 +138,7 @@ public abstract class AbstractUserAdapter implements UserModel {
|
||||||
public Set<RoleModel> getRealmRoleMappings() {
|
public Set<RoleModel> getRealmRoleMappings() {
|
||||||
Set<RoleModel> roleMappings = getRoleMappings();
|
Set<RoleModel> roleMappings = getRoleMappings();
|
||||||
|
|
||||||
Set<RoleModel> realmRoles = new HashSet<RoleModel>();
|
Set<RoleModel> realmRoles = new HashSet<>();
|
||||||
for (RoleModel role : roleMappings) {
|
for (RoleModel role : roleMappings) {
|
||||||
RoleContainerModel container = role.getContainer();
|
RoleContainerModel container = role.getContainer();
|
||||||
if (container instanceof RealmModel) {
|
if (container instanceof RealmModel) {
|
||||||
|
@ -152,7 +152,7 @@ public abstract class AbstractUserAdapter implements UserModel {
|
||||||
public Set<RoleModel> getClientRoleMappings(ClientModel app) {
|
public Set<RoleModel> getClientRoleMappings(ClientModel app) {
|
||||||
Set<RoleModel> roleMappings = getRoleMappings();
|
Set<RoleModel> roleMappings = getRoleMappings();
|
||||||
|
|
||||||
Set<RoleModel> roles = new HashSet<RoleModel>();
|
Set<RoleModel> roles = new HashSet<>();
|
||||||
for (RoleModel role : roleMappings) {
|
for (RoleModel role : roleMappings) {
|
||||||
RoleContainerModel container = role.getContainer();
|
RoleContainerModel container = role.getContainer();
|
||||||
if (container instanceof ClientModel) {
|
if (container instanceof ClientModel) {
|
||||||
|
@ -190,7 +190,7 @@ public abstract class AbstractUserAdapter implements UserModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Set<RoleModel> getRoleMappingsInternal() {
|
protected Set<RoleModel> getRoleMappingsInternal() {
|
||||||
return Collections.EMPTY_SET;
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -102,7 +102,7 @@ public abstract class AbstractUserAdapterFederatedStorage implements UserModel {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected Set<GroupModel> getGroupsInternal() {
|
protected Set<GroupModel> getGroupsInternal() {
|
||||||
return Collections.EMPTY_SET;
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -126,8 +126,7 @@ public abstract class AbstractUserAdapterFederatedStorage implements UserModel {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<GroupModel> getGroups() {
|
public Set<GroupModel> getGroups() {
|
||||||
Set<GroupModel> set = new HashSet<>();
|
Set<GroupModel> set = new HashSet<>(getFederatedStorage().getGroups(realm, this.getId()));
|
||||||
set.addAll(getFederatedStorage().getGroups(realm, this.getId()));
|
|
||||||
if (appendDefaultGroups()) set.addAll(realm.getDefaultGroups());
|
if (appendDefaultGroups()) set.addAll(realm.getDefaultGroups());
|
||||||
set.addAll(getGroupsInternal());
|
set.addAll(getGroupsInternal());
|
||||||
return set;
|
return set;
|
||||||
|
@ -163,7 +162,7 @@ public abstract class AbstractUserAdapterFederatedStorage implements UserModel {
|
||||||
public Set<RoleModel> getRealmRoleMappings() {
|
public Set<RoleModel> getRealmRoleMappings() {
|
||||||
Set<RoleModel> roleMappings = getRoleMappings();
|
Set<RoleModel> roleMappings = getRoleMappings();
|
||||||
|
|
||||||
Set<RoleModel> realmRoles = new HashSet<RoleModel>();
|
Set<RoleModel> realmRoles = new HashSet<>();
|
||||||
for (RoleModel role : roleMappings) {
|
for (RoleModel role : roleMappings) {
|
||||||
RoleContainerModel container = role.getContainer();
|
RoleContainerModel container = role.getContainer();
|
||||||
if (container instanceof RealmModel) {
|
if (container instanceof RealmModel) {
|
||||||
|
@ -185,7 +184,7 @@ public abstract class AbstractUserAdapterFederatedStorage implements UserModel {
|
||||||
public Set<RoleModel> getClientRoleMappings(ClientModel app) {
|
public Set<RoleModel> getClientRoleMappings(ClientModel app) {
|
||||||
Set<RoleModel> roleMappings = getRoleMappings();
|
Set<RoleModel> roleMappings = getRoleMappings();
|
||||||
|
|
||||||
Set<RoleModel> roles = new HashSet<RoleModel>();
|
Set<RoleModel> roles = new HashSet<>();
|
||||||
for (RoleModel role : roleMappings) {
|
for (RoleModel role : roleMappings) {
|
||||||
RoleContainerModel container = role.getContainer();
|
RoleContainerModel container = role.getContainer();
|
||||||
if (container instanceof ClientModel) {
|
if (container instanceof ClientModel) {
|
||||||
|
@ -223,7 +222,7 @@ public abstract class AbstractUserAdapterFederatedStorage implements UserModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Set<RoleModel> getRoleMappingsInternal() {
|
protected Set<RoleModel> getRoleMappingsInternal() {
|
||||||
return Collections.EMPTY_SET;
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -235,8 +234,7 @@ public abstract class AbstractUserAdapterFederatedStorage implements UserModel {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<RoleModel> getRoleMappings() {
|
public Set<RoleModel> getRoleMappings() {
|
||||||
Set<RoleModel> set = new HashSet<>();
|
Set<RoleModel> set = new HashSet<>(getFederatedRoleMappings());
|
||||||
set.addAll(getFederatedRoleMappings());
|
|
||||||
if (appendDefaultRolesToRoleMappings()) set.addAll(DefaultRoles.getDefaultRoles(realm));
|
if (appendDefaultRolesToRoleMappings()) set.addAll(DefaultRoles.getDefaultRoles(realm));
|
||||||
set.addAll(getRoleMappingsInternal());
|
set.addAll(getRoleMappingsInternal());
|
||||||
return set;
|
return set;
|
||||||
|
|
Loading…
Reference in a new issue