From b8fa638ba2bfe8f2bd78a29bba5395408650846b Mon Sep 17 00:00:00 2001 From: Matej Novotny Date: Wed, 6 Sep 2023 19:03:21 +0200 Subject: [PATCH] Minor adjustments --- .../jboss/weld/bootstrap/events/ProcessSessionBeanImpl.java | 4 ++++ .../src/main/java/org/jboss/weld/invokable/InvokerImpl.java | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSessionBeanImpl.java b/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSessionBeanImpl.java index 65ea078fae..cfce03a3b5 100644 --- a/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSessionBeanImpl.java +++ b/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSessionBeanImpl.java @@ -75,6 +75,10 @@ public Collection> getInvokableMethods() { @Override public InvokerBuilder> createInvoker(AnnotatedMethod annotatedMethod) { checkWithinObserverNotification(); + if (!getBean().getInvokableMethods().contains(annotatedMethod)) { + // TODO better exception + throw new IllegalArgumentException("Not an invokable method: " + annotatedMethod); + } return new InvokerBuilderImpl<>(getBean().getEjbDescriptor().getBeanClass(), annotatedMethod.getJavaMember(), getBeanManager()); } } diff --git a/impl/src/main/java/org/jboss/weld/invokable/InvokerImpl.java b/impl/src/main/java/org/jboss/weld/invokable/InvokerImpl.java index df195165be..4be3217d7c 100644 --- a/impl/src/main/java/org/jboss/weld/invokable/InvokerImpl.java +++ b/impl/src/main/java/org/jboss/weld/invokable/InvokerImpl.java @@ -150,10 +150,10 @@ private InvokerImpl(MethodHandle beanMethodHandle, Annotation[] instanceLookupQu { MethodHandle cleanupMethod; try { - //String runName = "run"; // to appease a silly checkstyle rule + String runName = "run"; // to appease a silly checkstyle rule cleanupMethod = finalMethodHandle.type().returnType() == void.class - ? MethodHandleUtils.createMethodHandle(CleanupActions.class.getMethod("run", Throwable.class, CleanupActions.class)) - : MethodHandleUtils.createMethodHandle(CleanupActions.class.getMethod("run", Throwable.class, Object.class, CleanupActions.class)); + ? MethodHandleUtils.createMethodHandle(CleanupActions.class.getMethod(runName, Throwable.class, CleanupActions.class)) + : MethodHandleUtils.createMethodHandle(CleanupActions.class.getMethod(runName, Throwable.class, Object.class, CleanupActions.class)); } catch (NoSuchMethodException e) { // should never happen throw new IllegalStateException("Unable to locate Weld internal helper method");