vitruv-tools / Vitruv-Domains-ComponentBasedSystems

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

[Java] Fix namespace setup for classifier reference #103

Closed JanWittler closed 3 years ago

JanWittler commented 3 years ago

Fixes the namespace setup for classifier reference. In particular, previously split(".") was called to resolve a namespace though this would always fail as it is not regex safe ("\\."). This caused a crash when reloading a Java instance with e.g. an ArrayList in it, similar to #97 .

Furthermore, we had other cases were the namespace setup was commented out. To me it seems this was only due to asthetic reasons, as now the generated source code contains the fully qualified name for every non-primitive class. However, since our imports are broken anyways, it makes the generated source code at least valid again.

To make the code easier readable again and fix the import problem, one could post-process the Java files after saving. Since now we have the fully-qualified name, it should be easy to automatically generate the imports from the classes and then trim the class names. This would also enable resolving naming conflicts, which is right now not possible (see JavaTypeUtil.xtend).

Retry of #100 as it had to be reverted.

JanWittler commented 3 years ago

Testet locally against applications. However, to be sure we should first merge #102