eclipse-viatra / org.eclipse.viatra

Main components of the VIATRA framework
https://eclipse.dev/viatra
Eclipse Public License 2.0
0 stars 1 forks source link

#135 fix generated compile errors for nested and generic dataype params #158

Open bergmanngabor opened 2 months ago

bergmanngabor commented 2 months ago

The classes generated from this pattern now compile correctly:

pattern bar(e: java ^java.util.Map.Entry, u: java Integer) {
    e == eval(^java.util.Collections.singletonMap(1,2).entrySet.head);
    u == 4;
}

(And the query results are correct as well)

bergmanngabor commented 2 months ago

Fixes #135

bergmanngabor commented 2 months ago

Huge thanks for asking for more tests! You made the right call - the more extensive test coverage revealed that the solution was not quite perfect, since there were serious underlying classloading problems as well (some related, some unrelated to inner classes or generic classes). This lead me down a rabbit hole that culminated in the introduction of a caching mechanism to the Java project based classloader.

bergmanngabor commented 2 months ago

(Note that what I have introduced is resource-based caching, so one classloader per vql file. If you can tell me how to have one shared classloader per source project rather than resource, I am all ears. Even better: can related projects have related classloaders?)

bergmanngabor commented 2 months ago

Fixes #125 as well.