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 #100

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).

HeikoKlare commented 3 years ago

This PR breaks our applications (see build result). Took me more than an hour to find out that it's not my recent changes that break the build ...

Thus #101 reverts the changes of the PR to return to working applications. Please resubmit the PR along with adaptations of the applications that ensure that they keep working.

JanWittler commented 3 years ago

Really sorry I forgot to check that. I provided #102 so that in the future this won't happen anymore.