You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Templates render NOT_FOUND in native mode (works fine on JVM) for enum classes when attempting to access a member field of getter of the enum class.
Expected behavior
Render the member field or method both in JVM as in native mode.
Actual behavior
Qute resolves the property in JVM mode just fine but resolves as NOT_FOUND when compiled to native. Current workaround is to override toString() which is the only way to render an enum it seems.
How to Reproduce?
data classAuthenticatedUser(
valroles:Set<Role>
)
enumclassRole(valgroup:String) {
BASIC("SomeBasicGroup"),
ADMIN("AdminGroup); // this is a workaround override fun toString(): String { return group }}
{#for role in user.roles.orEmpty}
<li>{role.group}</li>
{/for}
The above renders NOT_FOUND when native compiled, however when {role} is used it works, so toString() can be called. Adding an other method or getter also results in NOT_FOUND again only when native compiled.
Output of uname -a or ver
quay.io/quarkus/centos-quarkus-maven:21.0-java11
GraalVM version (if different from Java)
quay.io/quarkus/centos-quarkus-maven:21.0-java11
Quarkus version or git rev
1.13.2.Final
Build tool (ie. output of mvnw --version or gradlew --version)
mvn 3.6.2
The text was updated successfully, but these errors were encountered:
Hi @jayv, this is expected. In the JVM a fallback reflection value resolver is used, i.e. enum constants are read as regular fields. Of course, this does not work for native. There are several ways how to solve the problem for the native image:
Describe the bug
Templates render
NOT_FOUND
in native mode (works fine on JVM) for enum classes when attempting to access a member field of getter of the enum class.Expected behavior
Render the member field or method both in JVM as in native mode.
Actual behavior
Qute resolves the property in JVM mode just fine but resolves as
NOT_FOUND
when compiled to native. Current workaround is to overridetoString()
which is the only way to render an enum it seems.How to Reproduce?
The above renders
NOT_FOUND
when native compiled, however when{role}
is used it works, sotoString()
can be called. Adding an other method or getter also results inNOT_FOUND
again only when native compiled.Output of
uname -a
orver
quay.io/quarkus/centos-quarkus-maven:21.0-java11
GraalVM version (if different from Java)
quay.io/quarkus/centos-quarkus-maven:21.0-java11
Quarkus version or git rev
1.13.2.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)mvn 3.6.2
The text was updated successfully, but these errors were encountered: