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
|
||||
List<ProviderConfigProperty> getCommonProviderConfigProperties() {
|
||||
return Collections.EMPTY_LIST;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -109,7 +109,7 @@ public interface ComponentFactory<CreatedType, ProviderType extends Provider> ex
|
|||
*/
|
||||
default
|
||||
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 alias;
|
||||
private Map<String, String> config = new HashMap<String, String>();
|
||||
private Map<String, String> config = new HashMap<>();
|
||||
|
||||
|
||||
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
|
||||
* 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() {
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ public class IdentityProviderModel implements Serializable {
|
|||
this.providerId = model.getProviderId();
|
||||
this.alias = model.getAlias();
|
||||
this.displayName = model.getDisplayName();
|
||||
this.config = new HashMap<String, String>(model.getConfig());
|
||||
this.config = new HashMap<>(model.getConfig());
|
||||
this.enabled = model.isEnabled();
|
||||
this.trustEmail = model.isTrustEmail();
|
||||
this.storeToken = model.isStoreToken();
|
||||
|
|
|
@ -79,7 +79,7 @@ public class RequiredCredentialModel implements Serializable {
|
|||
public static final RequiredCredentialModel KERBEROS;
|
||||
|
||||
static {
|
||||
Map<String, RequiredCredentialModel> map = new HashMap<String, RequiredCredentialModel>();
|
||||
Map<String, RequiredCredentialModel> map = new HashMap<>();
|
||||
PASSWORD = new RequiredCredentialModel();
|
||||
PASSWORD.setType(PasswordCredentialModel.TYPE);
|
||||
PASSWORD.setInput(true);
|
||||
|
|
|
@ -174,8 +174,7 @@ public class HmacOTP {
|
|||
|
||||
// Copy all the REAL bytes, not the "first"
|
||||
byte[] ret = new byte[bArray.length - 1];
|
||||
for (int i = 0; i < ret.length; i++)
|
||||
ret[i] = bArray[i + 1];
|
||||
System.arraycopy(bArray, 1, ret, 0, ret.length);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ public interface UserStorageProviderFactory<T extends UserStorageProvider> exten
|
|||
|
||||
@Override
|
||||
default List<ProviderConfigProperty> getConfigProperties() {
|
||||
return Collections.EMPTY_LIST;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -62,7 +62,7 @@ public abstract class AbstractUserAdapter implements UserModel {
|
|||
|
||||
@Override
|
||||
public Set<String> getRequiredActions() {
|
||||
return Collections.EMPTY_SET;
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -94,7 +94,7 @@ public abstract class AbstractUserAdapter implements UserModel {
|
|||
* @return
|
||||
*/
|
||||
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() {
|
||||
Set<RoleModel> roleMappings = getRoleMappings();
|
||||
|
||||
Set<RoleModel> realmRoles = new HashSet<RoleModel>();
|
||||
Set<RoleModel> realmRoles = new HashSet<>();
|
||||
for (RoleModel role : roleMappings) {
|
||||
RoleContainerModel container = role.getContainer();
|
||||
if (container instanceof RealmModel) {
|
||||
|
@ -152,7 +152,7 @@ public abstract class AbstractUserAdapter implements UserModel {
|
|||
public Set<RoleModel> getClientRoleMappings(ClientModel app) {
|
||||
Set<RoleModel> roleMappings = getRoleMappings();
|
||||
|
||||
Set<RoleModel> roles = new HashSet<RoleModel>();
|
||||
Set<RoleModel> roles = new HashSet<>();
|
||||
for (RoleModel role : roleMappings) {
|
||||
RoleContainerModel container = role.getContainer();
|
||||
if (container instanceof ClientModel) {
|
||||
|
@ -190,7 +190,7 @@ public abstract class AbstractUserAdapter implements UserModel {
|
|||
}
|
||||
|
||||
protected Set<RoleModel> getRoleMappingsInternal() {
|
||||
return Collections.EMPTY_SET;
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -102,7 +102,7 @@ public abstract class AbstractUserAdapterFederatedStorage implements UserModel {
|
|||
* @return
|
||||
*/
|
||||
protected Set<GroupModel> getGroupsInternal() {
|
||||
return Collections.EMPTY_SET;
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -126,8 +126,7 @@ public abstract class AbstractUserAdapterFederatedStorage implements UserModel {
|
|||
*/
|
||||
@Override
|
||||
public Set<GroupModel> getGroups() {
|
||||
Set<GroupModel> set = new HashSet<>();
|
||||
set.addAll(getFederatedStorage().getGroups(realm, this.getId()));
|
||||
Set<GroupModel> set = new HashSet<>(getFederatedStorage().getGroups(realm, this.getId()));
|
||||
if (appendDefaultGroups()) set.addAll(realm.getDefaultGroups());
|
||||
set.addAll(getGroupsInternal());
|
||||
return set;
|
||||
|
@ -163,7 +162,7 @@ public abstract class AbstractUserAdapterFederatedStorage implements UserModel {
|
|||
public Set<RoleModel> getRealmRoleMappings() {
|
||||
Set<RoleModel> roleMappings = getRoleMappings();
|
||||
|
||||
Set<RoleModel> realmRoles = new HashSet<RoleModel>();
|
||||
Set<RoleModel> realmRoles = new HashSet<>();
|
||||
for (RoleModel role : roleMappings) {
|
||||
RoleContainerModel container = role.getContainer();
|
||||
if (container instanceof RealmModel) {
|
||||
|
@ -185,7 +184,7 @@ public abstract class AbstractUserAdapterFederatedStorage implements UserModel {
|
|||
public Set<RoleModel> getClientRoleMappings(ClientModel app) {
|
||||
Set<RoleModel> roleMappings = getRoleMappings();
|
||||
|
||||
Set<RoleModel> roles = new HashSet<RoleModel>();
|
||||
Set<RoleModel> roles = new HashSet<>();
|
||||
for (RoleModel role : roleMappings) {
|
||||
RoleContainerModel container = role.getContainer();
|
||||
if (container instanceof ClientModel) {
|
||||
|
@ -223,7 +222,7 @@ public abstract class AbstractUserAdapterFederatedStorage implements UserModel {
|
|||
}
|
||||
|
||||
protected Set<RoleModel> getRoleMappingsInternal() {
|
||||
return Collections.EMPTY_SET;
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -235,8 +234,7 @@ public abstract class AbstractUserAdapterFederatedStorage implements UserModel {
|
|||
*/
|
||||
@Override
|
||||
public Set<RoleModel> getRoleMappings() {
|
||||
Set<RoleModel> set = new HashSet<>();
|
||||
set.addAll(getFederatedRoleMappings());
|
||||
Set<RoleModel> set = new HashSet<>(getFederatedRoleMappings());
|
||||
if (appendDefaultRolesToRoleMappings()) set.addAll(DefaultRoles.getDefaultRoles(realm));
|
||||
set.addAll(getRoleMappingsInternal());
|
||||
return set;
|
||||
|
|
Loading…
Reference in a new issue