Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Add missing Thymeleaf expression language hints #725

Closed
leccelecce opened this issue Apr 12, 2021 · 2 comments · Fixed by #728
Closed

Add missing Thymeleaf expression language hints #725

leccelecce opened this issue Apr 12, 2021 · 2 comments · Fixed by #728
Labels
type: compatibility Native image compatibility issue
Milestone

Comments

@leccelecce
Copy link
Contributor

leccelecce commented Apr 12, 2021

The org.thymeleaf.expression package contains a variety of classes that can be used in Thymeleaf templates e.g. org.thymeleaf.expression.Arrays, which is accessed in a template via ${#arrays.xxx()}. This requires reflection config like the below example:

@TypeHint(types = {org.thymeleaf.expression.Arrays.class},
					access = AccessBits.LOAD_AND_CONSTRUCT_AND_PUBLIC_METHODS)}

On the basis that the project added IterStatusVar in #679, I think the project could logically add something like the following for the 15-20 classes in the org.thymeleaf.expression package?

Happy to send a PR (including tests) if you think this makes sense.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 12, 2021
@aclement
Copy link
Contributor

Yes, I am not surprised we need to add some more. It is perhaps just a shame we will end up adding those that aren't being used to some apps, but I suspect working out which are required in a particular app is not easy.

Happy to take a PR, could perhaps enhance the existing sample to cover more kinds of expression.

@leccelecce
Copy link
Contributor Author

PR provided to add the expression classes; I will look at improving the sample separately as having some issues getting the tests to pass on my machine even prior to the change.

I did think about whether I could create some kind of processor to scan through any templates found and identify which #xxx expressions were being used - but it felt like quite a bit of effort given the expression classes themselves look fairly small and straightforward.

@sdeleuze sdeleuze added this to the 0.9.2 milestone Apr 13, 2021
@sdeleuze sdeleuze added type: compatibility Native image compatibility issue and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Apr 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: compatibility Native image compatibility issue
Development

Successfully merging a pull request may close this issue.

4 participants