Skip to content

MYFACES-4779: Quarkus native: register JDK immutable collections and Principal implementations for EL reflection - #1132

Open
melloware wants to merge 1 commit into
apache:mainfrom
melloware:quarkus-native-el-reflection
Open

melloware wants to merge 1 commit into
apache:mainfrom
melloware:quarkus-native-el-reflection

Conversation

@melloware

@melloware melloware commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

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.

…Principal implementations for EL reflection

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant