Class ELMethodDiagnostics

java.lang.Object
io.micronaut.el.resolver.ELMethodDiagnostics

@Internal public final class ELMethodDiagnostics extends Object
Builds the MethodNotFoundException of a method that no executor and no resolver of the chain could resolve, saying why each of the descriptions a method can be reached through did not answer.

A method is dispatched from the bean introspection of its type, from the executable metadata of its bean definition, or reflectively, and each of the three has a precondition an application can fail to meet: the type is not @Introspected, the method is not @Executable, the ELContext carries no bean context for the executable metadata to be read from, or the optional reflection module is not on the classpath. Reporting only the name of the method leaves an author of an expression with no way to tell which of them it was, and the one that is the least visible — a context carrying no bean context, which makes ExecutableMethodELExecutor decline silently — is the one that reads as a method that plainly exists not being found.

Nothing here runs on the happy path. Every check is made once, on the path that is about to throw, and none of it changes what resolves: an executor that declined goes on declining, and this only describes the decline.

Since:
1.1
Author:
Denis Stepanov
  • Method Details

    • notFound

      public static jakarta.el.MethodNotFoundException notFound(jakarta.el.ELContext context, Object base, Object method, Object @Nullable [] arguments)
      The exception of a method the resolver chain of a context did not resolve.

      The reflection module is not reported as a remedy for this path: the chain is not the executors, and the standard one ends in the reflective resolvers, so a method that reached the end of it was looked up reflectively already.

      Parameters:
      context - The context the expression was evaluated with
      base - The base object, or an ELClass for a static method
      method - The method name
      arguments - The evaluated arguments
      Returns:
      The exception to throw
    • notFound

      public static jakarta.el.MethodNotFoundException notFound(jakarta.el.ELContext context, Object base, Object method, Object @Nullable [] arguments, List<? extends ELMethodExecutor> executors)
      The exception of a method none of the executors of an expression parsed at runtime resolved.
      Parameters:
      context - The context the expression was evaluated with
      base - The base object, or an ELClass for a static method
      method - The method name
      arguments - The evaluated arguments
      executors - The executors that were consulted, in order
      Returns:
      The exception to throw