melloware opened a new pull request, #1133:
URL: https://github.com/apache/myfaces/pull/1133

   https://issues.apache.org/jira/browse/MYFACES-4779
   
   In a Quarkus native image these EL expressions work in JVM mode but fail in 
native mode:
   
   - `#{bean.items.size()}` on a `List.of(...)`, `Set.of(...)`, `Map.of(...)`, 
`stream().toList()`, ... fails with `MethodNotFoundException: Method not found: 
class java.util.ImmutableCollections$List12.size()`
   - `#{request.userPrincipal.name}`: `HttpServletRequestImpl` is registered, 
but the Quarkus Security `Principal` it returns is not
   
   ### Changes (`MyFacesProcessor#registerForMethodReflection`)
   
   - Register the JDK internal collection classes by name 
(`ImmutableCollections$*`, `KeyValueHolder`, `Arrays$ArrayList`, 
`Collections$Empty*/Singleton*/Unmodifiable*`). They are not in the Jandex 
index, so `collectImplementors(Collection)` never finds them. This follows the 
existing `Collections$EmptySet` entry.
   - Register the public supertypes too (`List`, `Set`, `SortedSet`, `Map`, 
`SortedMap`, `Abstract*`). The classes above are not public, so EL resolves the 
method on those supertypes. The classes alone are not enough.
   - Register `collectImplementors(combinedIndex, java.security.Principal)`.
   
   ### Testing
   
   Tested with https://github.com/melloware/quarkus-faces-security, which has 
native integration tests for Quarkus form login and OIDC (Keycloak). With the 
original `#{request.userPrincipal.name}`, `#{request.isUserInRole('admin')}` 
and `#{demoUsers.users.size()}`:
   
   - 4.1.4: 500 errors on the secured pages in native
   - this change built as 4.1.5-SNAPSHOT: form login 20/20 and OIDC 6/6 native 
ITs pass (REST Assured and Playwright)
   
   Checkstyle passes on both branches.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to