Deprecate potentially error prone constructor methods
Change-Id: I82d95c27dc7c4b1a6dcf5cc48a1c7583b5e30e2c
diff --git a/core/net/src/main/java/org/onosproject/net/config/impl/DeviceInjectionConfigMonitor.java b/core/net/src/main/java/org/onosproject/net/config/impl/DeviceInjectionConfigMonitor.java
index 78b6c9e..5277075 100644
--- a/core/net/src/main/java/org/onosproject/net/config/impl/DeviceInjectionConfigMonitor.java
+++ b/core/net/src/main/java/org/onosproject/net/config/impl/DeviceInjectionConfigMonitor.java
@@ -189,7 +189,7 @@
// TODO inject port details if something like BasicPortConfig was created
PortNumber number = portNumber(i);
boolean isEnabled = true;
- portDescs.add(new DefaultPortDescription(number, isEnabled));
+ portDescs.add(DefaultPortDescription.builder().withPortNumber(number) .isEnabled(isEnabled).build());
}
providerService.updatePorts(did, portDescs);
}
diff --git a/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java b/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java
index 37fc2cd..c82c1f5 100644
--- a/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java
+++ b/core/net/src/main/java/org/onosproject/net/device/impl/DeviceManager.java
@@ -716,12 +716,10 @@
log.trace("Device not found: {}", deviceId);
}
- PortDescription newPortDescription = new DefaultPortDescription(basePortDescription.portNumber(),
- basePortDescription.isEnabled(),
- true,
- basePortDescription.type(),
- basePortDescription.portSpeed(),
- basePortDescription.annotations());
+ PortDescription newPortDescription = DefaultPortDescription.builder(basePortDescription)
+ .isRemoved(true)
+ .build();
+
final DeviceEvent event = store.updatePortStatus(this.provider().id(),
deviceId,
newPortDescription);
diff --git a/core/net/src/main/java/org/onosproject/net/device/impl/PortAnnotationOperator.java b/core/net/src/main/java/org/onosproject/net/device/impl/PortAnnotationOperator.java
index 2489f79..ac9ea84 100644
--- a/core/net/src/main/java/org/onosproject/net/device/impl/PortAnnotationOperator.java
+++ b/core/net/src/main/java/org/onosproject/net/device/impl/PortAnnotationOperator.java
@@ -71,7 +71,9 @@
builder.putAll(descr.annotations());
builder.putAll(annotations);
- return DefaultPortDescription.copyReplacingAnnotation(descr, builder.build());
+ return DefaultPortDescription.builder(descr)
+ .annotations(builder.build())
+ .build();
}
}