Skip to content

Commit

Permalink
Allow Thymeleaf to check for allowed method access of Java supertypes
Browse files Browse the repository at this point in the history
To prevent Thymeleaf templates from accessing methods on built-in Java types
that are not allowed, it ships with a list of allowed supertypes.
Its org.thymeleaf.util.ExpressionUtils type has an isMemberAllowed method
that calls getDeclaredMethods() on those types, so that needs to work for
all these types in a native image.

Recent versions of Thymeleaf have expanded the list with two additional
types, which is why the M2 version has 7 new entries while the RC1 / latest
has 9. For details, check out
https://github.com/thymeleaf/thymeleaf/blob/3.1-master/lib/thymeleaf/src/main/java/org/thymeleaf/util/ExpressionUtils.java
  • Loading branch information
jkuipers committed Apr 5, 2024
1 parent cd588e1 commit add5166
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 0 deletions.
49 changes: 49 additions & 0 deletions metadata/org.thymeleaf/thymeleaf/3.1.0.M2/reflect-config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,53 @@
[
{
"name": "java.util.Collection",
"allDeclaredMethods": true,
"condition": {
"typeReachable": "org.thymeleaf.util.ExpressionUtils"
}
},
{
"name": "java.lang.Iterable",
"allDeclaredMethods": true,
"condition": {
"typeReachable": "org.thymeleaf.util.ExpressionUtils"
}
},
{
"name": "java.util.List",
"allDeclaredMethods": true,
"condition": {
"typeReachable": "org.thymeleaf.util.ExpressionUtils"
}
},
{
"name": "java.util.Map",
"allDeclaredMethods": true,
"condition": {
"typeReachable": "org.thymeleaf.util.ExpressionUtils"
}
},
{
"name": "java.util.Map$Entry",
"allDeclaredMethods": true,
"condition": {
"typeReachable": "org.thymeleaf.util.ExpressionUtils"
}
},
{
"name": "java.util.Set",
"allDeclaredMethods": true,
"condition": {
"typeReachable": "org.thymeleaf.util.ExpressionUtils"
}
},
{
"name": "java.util.Calendar",
"allDeclaredMethods": true,
"condition": {
"typeReachable": "org.thymeleaf.util.ExpressionUtils"
}
},
{
"name": "org.thymeleaf.expression.Dates",
"allPublicMethods": true,
Expand Down
63 changes: 63 additions & 0 deletions metadata/org.thymeleaf/thymeleaf/3.1.0.RC1/reflect-config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,67 @@
[
{
"name": "java.util.Collection",
"allDeclaredMethods": true,
"condition": {
"typeReachable": "org.thymeleaf.util.ExpressionUtils"
}
},
{
"name": "java.lang.Iterable",
"allDeclaredMethods": true,
"condition": {
"typeReachable": "org.thymeleaf.util.ExpressionUtils"
}
},
{
"name": "java.util.Iterator",
"allDeclaredMethods": true,
"condition": {
"typeReachable": "org.thymeleaf.util.ExpressionUtils"
}
},
{
"name": "java.util.List",
"allDeclaredMethods": true,
"condition": {
"typeReachable": "org.thymeleaf.util.ExpressionUtils"
}
},
{
"name": "java.util.Map",
"allDeclaredMethods": true,
"condition": {
"typeReachable": "org.thymeleaf.util.ExpressionUtils"
}
},
{
"name": "java.util.Map$Entry",
"allDeclaredMethods": true,
"condition": {
"typeReachable": "org.thymeleaf.util.ExpressionUtils"
}
},
{
"name": "java.util.Set",
"allDeclaredMethods": true,
"condition": {
"typeReachable": "org.thymeleaf.util.ExpressionUtils"
}
},
{
"name": "java.util.Calendar",
"allDeclaredMethods": true,
"condition": {
"typeReachable": "org.thymeleaf.util.ExpressionUtils"
}
},
{
"name": "java.util.stream.Stream",
"allDeclaredMethods": true,
"condition": {
"typeReachable": "org.thymeleaf.util.ExpressionUtils"
}
},
{
"name": "org.thymeleaf.expression.Dates",
"allPublicMethods": true,
Expand Down

0 comments on commit add5166

Please sign in to comment.