Skip to content

Commit

Permalink
Issue #7613 Override Configurations.add(Configuration) (#7631)
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Bartel <[email protected]>
  • Loading branch information
janbartel authored Feb 22, 2022
1 parent 808b74f commit 3d9f346
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ public Configurations(Configurations classlist)
.map(c -> c.getClass().getName())
.toArray(String[]::new));
}

@Override
public boolean add(Configuration configuration)
{
return addConfiguration(configuration);
}

public void add(Configuration... configurations)
{
Expand Down Expand Up @@ -428,7 +434,7 @@ public Iterator<Configuration> iterator()
return getConfigurations().iterator();
}

private void addConfiguration(Configuration configuration)
private boolean addConfiguration(Configuration configuration)
{
String name = configuration.getClass().getName();
// Is this configuration known?
Expand Down Expand Up @@ -462,14 +468,14 @@ private void addConfiguration(Configuration configuration)
if (r != null)
{
if (r.getName().equals(configuration.getClass().getName()))
return; //skip the addition, a replacement is already present
return false; //skip the addition, a replacement is already present
}

if (c.getClass().getName().equals(configuration.getClass().getName()))
return; //don't add same one twice
return false; //don't add same one twice
}

_configurations.add(configuration);
return _configurations.add(configuration);
}

@Override
Expand Down

0 comments on commit 3d9f346

Please sign in to comment.