vitruv-tools / Vitruv-Domains-ComponentBasedSystems

Vitruv domains for component-based systems
Eclipse Public License 1.0
1 stars 7 forks source link

Fixed problem with unnamed Java packages & empty path segments #44

Closed tsaglam closed 5 years ago

tsaglam commented 5 years ago

Fixed problem with the persistence of Java packages, which lead to invalid Java changes and as a result of the consistency preservation to duplicate UML packages. Unnamed Java packages produced a path that contained an empty segment (//) instead of a name, which then leads to applying changes, such as rename changes, to the parent package of the unnamed package. The empty segment was being ignored, and the resulting path matches the parent package: E.g. /foo// instead of /foo/bar/. These invalid changes propagated to the UML model and resulted in duplicate package names.

This problem was fixed by replacing the empty segment by any non-empty string (e.g. // => /unnamedPackage/). This placeholder is later replaced when the Java package is renamed.

tsaglam commented 5 years ago

We might need to discuss which is the best placeholder string. I chose unnamedPackage as a first solution, but this could potentially cause problems is there is a real package with that name. If you come up with something more elegant, I can replace this.

HeikoKlare commented 5 years ago

For me, the current dummy package name is fine. unnamedPackage is a rather unlikely name for an ordinary package, so I do not expect conflicts with an actual package. Actually, this is only a workaround, which might have to be implemented differently in a productive system. If two packages with empty names get created at the same time, they cannot be distinguished (as far as I understand the implementation). More precisely, if two classes are created in a package with an empty name and both packages are named differently afterwards, the result may be erroneous as both classes are assigned to the package that is named first. Nevertheless, I do not expect that this causes any problems for us, so it seems to be a suitable solution for now. In general, we should try not to propagate changes for packages (and things contained within them) that do not have a name yet.