Changeset 19294 in josm


Ignore:
Timestamp:
2025-01-28T12:28:11+01:00 (37 hours ago)
Author:
taylor.smock
Message:

Fix test broken by dependency updates

EqualsVerifier did not like having two fields with the same name for an object.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java

    r19214 r19294  
    2525public class AddPrimitivesCommand extends Command {
    2626
    27     private List<PrimitiveData> data;
     27    private List<PrimitiveData> primitiveData;
    2828    private Collection<PrimitiveData> toSelect;
    2929    private List<PrimitiveData> preExistingData;
     
    5656    private void init(List<PrimitiveData> data, List<PrimitiveData> toSelect) {
    5757        CheckParameterUtil.ensureParameterNotNull(data, "data");
    58         this.data = new ArrayList<>(data);
     58        this.primitiveData = new ArrayList<>(data);
    5959        if (toSelect == data) {
    60             this.toSelect = this.data;
     60            this.toSelect = this.primitiveData;
    6161        } else if (toSelect != null) {
    6262            this.toSelect = new ArrayList<>(toSelect);
     
    7676    private void executeRealCommand(DataSet ds) {
    7777        if (createdPrimitives == null) { // first time execution
    78             List<OsmPrimitive> newPrimitives = new ArrayList<>(data.size());
     78            List<OsmPrimitive> newPrimitives = new ArrayList<>(primitiveData.size());
    7979            preExistingData = new ArrayList<>();
    8080
    81             for (PrimitiveData pd : data) {
     81            for (PrimitiveData pd : primitiveData) {
    8282                OsmPrimitive primitive = ds.getPrimitiveById(pd);
    8383                boolean created = primitive == null;
     
    9999            for (int i = 0; i < newPrimitives.size(); i++) {
    100100                if (!(newPrimitives.get(i) instanceof Node)) {
    101                     newPrimitives.get(i).load(data.get(i));
     101                    newPrimitives.get(i).load(primitiveData.get(i));
    102102                }
    103103            }
     
    108108            for (OsmPrimitive osm : createdPrimitives) {
    109109                if (preExistingData.stream().anyMatch(pd -> pd.getPrimitiveId().equals(osm.getPrimitiveId()))) {
    110                     Optional<PrimitiveData> o = data.stream()
     110                    Optional<PrimitiveData> o = primitiveData.stream()
    111111                            .filter(pd -> pd.getPrimitiveId().equals(osm.getPrimitiveId())).findAny();
    112112                    o.ifPresent(osm::load);
     
    121121        DataSet ds = getAffectedDataSet();
    122122        if (createdPrimitives == null) {
    123             createdPrimitives = new ArrayList<>(data.size());
    124             for (PrimitiveData pd : data) {
     123            createdPrimitives = new ArrayList<>(primitiveData.size());
     124            for (PrimitiveData pd : primitiveData) {
    125125                OsmPrimitive p = ds.getPrimitiveById(pd);
    126126                createdPrimitives.add(p);
     
    147147    @Override
    148148    public String getDescriptionText() {
    149         int size = data != null ? data.size() : createdPrimitives.size();
     149        int size = primitiveData != null ? primitiveData.size() : createdPrimitives.size();
    150150        return trn("Added {0} object", "Added {0} objects", size, size);
    151151    }
     
    162162            return createdPrimitives;
    163163
    164         return data.stream()
     164        return primitiveData.stream()
    165165                .map(d -> Objects.requireNonNull(getAffectedDataSet().getPrimitiveById(d), () -> "No primitive found for " + d))
    166166                .collect(Collectors.toSet());
     
    169169    @Override
    170170    public int hashCode() {
    171         return Objects.hash(super.hashCode(), data, toSelect, preExistingData, createdPrimitives);
     171        return Objects.hash(super.hashCode(), primitiveData, toSelect, preExistingData, createdPrimitives);
    172172    }
    173173
     
    178178        if (!super.equals(obj)) return false;
    179179        AddPrimitivesCommand that = (AddPrimitivesCommand) obj;
    180         return Objects.equals(data, that.data) &&
     180        return Objects.equals(primitiveData, that.primitiveData) &&
    181181               Objects.equals(toSelect, that.toSelect) &&
    182182               Objects.equals(preExistingData, that.preExistingData) &&
Note: See TracChangeset for help on using the changeset viewer.