Skip to content
Snippets Groups Projects
Commit c2c021b5 authored by Simon Barner's avatar Simon Barner
Browse files

Avoid warning about unlikely argument

* container.getContainedElements() is of type List<IHierarchicElement>
* The (unchecked) cast of elementRef -> IHierarchicElement has already
  been present in the previous version of this method

Issue-Ref: 3539
Issue-Url: https://af3-developer.fortiss.org/issues/3539



Signed-off-by: default avatarSimon Barner <barner@fortiss.org>
parent 4653cf4d
No related branches found
No related tags found
1 merge request!273539
This commit is part of merge request !27. Comments created here will be created in the context of that merge request.
ModelElementLibraryService.java ad618d79106b45f9b63856023a1df1ab65f2cec7 GREEN ModelElementLibraryService.java aae1cda83bd706a5798169daa4a64db5be0a0588 YELLOW
...@@ -141,7 +141,8 @@ public class ModelElementLibraryService implements ILibraryService { ...@@ -141,7 +141,8 @@ public class ModelElementLibraryService implements ILibraryService {
final ILibraryElementReference elementRef) { final ILibraryElementReference elementRef) {
IHierarchicElement wrapped = (IHierarchicElement)elementRef.getLibraryElementShadow(); IHierarchicElement wrapped = (IHierarchicElement)elementRef.getLibraryElementShadow();
IHierarchicElement container = (IHierarchicElement)elementRef.eContainer(); IHierarchicElement container = (IHierarchicElement)elementRef.eContainer();
container.getContainedElements().remove(elementRef); IHierarchicElement elementRefHierarchicElement = (IHierarchicElement)elementRef;
container.getContainedElements().remove(elementRefHierarchicElement);
// preserve the ID of the reference // preserve the ID of the reference
((IIdLabeled)wrapped).setId(((IIdLabeled)elementRef).getId()); ((IIdLabeled)wrapped).setId(((IIdLabeled)elementRef).getId());
...@@ -151,7 +152,7 @@ public class ModelElementLibraryService implements ILibraryService { ...@@ -151,7 +152,7 @@ public class ModelElementLibraryService implements ILibraryService {
wrappedConnectorsList.addAll(wrapped.getConnectors()); wrappedConnectorsList.addAll(wrapped.getConnectors());
wrapped.getConnectors().clear(); wrapped.getConnectors().clear();
EList<IConnector> elementRefConnectorsList = new BasicEList<IConnector>(); EList<IConnector> elementRefConnectorsList = new BasicEList<IConnector>();
elementRefConnectorsList.addAll(((IHierarchicElement)elementRef).getConnectors()); elementRefConnectorsList.addAll(elementRefHierarchicElement.getConnectors());
for(IConnector elemRefConnector : elementRefConnectorsList) { for(IConnector elemRefConnector : elementRefConnectorsList) {
wrapped.getConnectors().add(elemRefConnector); wrapped.getConnectors().add(elemRefConnector);
String elementRefConnectorName = ((INamedElement)elemRefConnector).getName(); String elementRefConnectorName = ((INamedElement)elemRefConnector).getName();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment