Fix ELProcessor.defineFunction() parsing of method signatures

A signature with no parameters, such as "int zero()", failed with
ClassNotFoundException, as did a signature with whitespace between
parameter types, such as the "int sum(int, int)" example in the
Javadoc. When the function name was empty, the whole signature was used
as the function name instead of the method name.
diff --git a/api/src/main/java/jakarta/el/ELProcessor.java b/api/src/main/java/jakarta/el/ELProcessor.java
index c7229f7..ba9869c 100644
--- a/api/src/main/java/jakarta/el/ELProcessor.java
+++ b/api/src/main/java/jakarta/el/ELProcessor.java
@@ -199,10 +199,11 @@
             if (p < 0) {
                 throw new NoSuchMethodException("Bad method signature: " + method);
             }
-            String[] params = method.substring(j + 1, p).split(",");
+            String paramString = method.substring(j + 1, p).trim();
+            String[] params = paramString.isEmpty() ? new String[0] : paramString.split(",");
             Class<?>[] paramTypes = new Class<?>[params.length];
             for (int i = 0; i < params.length; i++) {
-                paramTypes[i] = toClass(params[i], loader);
+                paramTypes[i] = toClass(params[i].trim(), loader);
             }
             meth = klass.getDeclaredMethod(methodName, paramTypes);
         }
@@ -211,7 +212,7 @@
         }
 
         if (function.equals("")) {
-            function = method;
+            function = meth.getName();
         }
 
         elManager.mapFunction(prefix, function, meth);
diff --git a/api/src/test/java/jakarta/el/TestELProcessor.java b/api/src/test/java/jakarta/el/TestELProcessor.java
new file mode 100644
index 0000000..bd3019a
--- /dev/null
+++ b/api/src/test/java/jakarta/el/TestELProcessor.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2026 Contributors to the Eclipse Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+package jakarta.el;
+
+import java.lang.reflect.Method;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+public class TestELProcessor {
+
+    @BeforeAll
+    public static void setup() {
+        // The API has no Jakarta Expression Language implementation available when running these tests
+        System.setProperty(ExpressionFactory.class.getName(), TesterExpressionFactory.class.getName());
+    }
+
+    @Test
+    public void testDefineFunctionSignatureNoParameters() throws Exception {
+        ELProcessor elp = new ELProcessor();
+        elp.defineFunction("fn", "zero", TestELProcessor.class.getName(), "int zero()");
+
+        Assertions.assertEquals(TestELProcessor.class.getMethod("zero"), resolve(elp, "fn", "zero"));
+    }
+
+    @Test
+    public void testDefineFunctionSignatureWithSpaces() throws Exception {
+        ELProcessor elp = new ELProcessor();
+        elp.defineFunction("fn", "sum", TestELProcessor.class.getName(), "int sum(int, int)");
+
+        Assertions.assertEquals(TestELProcessor.class.getMethod("sum", int.class, int.class),
+                resolve(elp, "fn", "sum"));
+    }
+
+    @Test
+    public void testDefineFunctionSignatureEmptyFunctionName() throws Exception {
+        ELProcessor elp = new ELProcessor();
+        elp.defineFunction("fn", "", TestELProcessor.class.getName(), "int sum(int,int)");
+
+        Assertions.assertEquals(TestELProcessor.class.getMethod("sum", int.class, int.class),
+                resolve(elp, "fn", "sum"));
+    }
+
+    private static Method resolve(ELProcessor elp, String prefix, String function) {
+        return elp.getELManager().getELContext().getFunctionMapper().resolveFunction(prefix, function);
+    }
+
+    public static int zero() {
+        return 0;
+    }
+
+    public static int sum(int a, int b) {
+        return a + b;
+    }
+}
diff --git a/api/src/test/java/jakarta/el/TesterExpressionFactory.java b/api/src/test/java/jakarta/el/TesterExpressionFactory.java
new file mode 100644
index 0000000..b627f96
--- /dev/null
+++ b/api/src/test/java/jakarta/el/TesterExpressionFactory.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2026 Contributors to the Eclipse Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+package jakarta.el;
+
+/**
+ * Minimal {@link ExpressionFactory} so API tests can create an {@link ELProcessor} without an implementation.
+ */
+public class TesterExpressionFactory extends ExpressionFactory {
+
+    @Override
+    public ValueExpression createValueExpression(ELContext context, String expression, Class<?> expectedType) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ValueExpression createValueExpression(Object instance, Class<?> expectedType) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public MethodExpression createMethodExpression(ELContext context, String expression, Class<?> expectedReturnType,
+            Class<?>[] expectedParamTypes) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public <T> T coerceToType(Object obj, Class<T> targetType) {
+        throw new UnsupportedOperationException();
+    }
+}