eclipse / epsilon

Epsilon is a family of Java-based scripting languages for automating common model-based software engineering tasks, such as code generation, model-to-model transformation and model validation, that work out of the box with EMF (including Xtext and Sirius), UML (including Cameo/MagicDraw), Simulink, XML and other types of models.
https://eclipse.org/epsilon
Eclipse Public License 2.0
66 stars 10 forks source link

PlainXML driver can't access tag information #5

Closed arcanefoam closed 1 year ago

arcanefoam commented 1 year ago

The recommended way to get the tag name of an XML element is to use the 'tagName' property, e.g.

var authors = b.children.select(a|a.tagName = "author");

When using java 11+, this will result in an exception:

Unable to make public java.lang.String com.sun.org.apache.xerces.internal.dom.ElementImpl.getTagName() accessible: module java.xml does not "exports com.sun.org.apache.xerces.internal.dom" to unnamed module @6f7b7657

This happens when the PlainXmlPropertyGetter delegates to the JavaPropertyGetter to resolve the Element#getTagName method, which eventually gets to ReflectionUtil#executeMethod which tries to make the getTagName() method accesible (failing do to the actual type of the element being "internal").

For this I suggest adding an additional 'if' condition to the PlainXmlPropertyGetter#invoke that catches access to the 'tagName' property and invokes the corresponding method directly on the element.