Reject empty parameter types in ELProcessor.defineFunction() signatures

A signature such as "int sum(,int)" or "int sum(int,)" is now
rejected with NoSuchMethodException rather than being treated as
"int sum(int)". Also note in TestELProcessor that the ExpressionFactory
system property is JVM-global.
diff --git a/api/src/main/java/jakarta/el/ELProcessor.java b/api/src/main/java/jakarta/el/ELProcessor.java
index ba9869c..e79671d 100644
--- a/api/src/main/java/jakarta/el/ELProcessor.java
+++ b/api/src/main/java/jakarta/el/ELProcessor.java
@@ -200,10 +200,14 @@
                 throw new NoSuchMethodException("Bad method signature: " + method);
             }
             String paramString = method.substring(j + 1, p).trim();
-            String[] params = paramString.isEmpty() ? new String[0] : paramString.split(",");
+            String[] params = paramString.isEmpty() ? new String[0] : paramString.split(",", -1);
             Class<?>[] paramTypes = new Class<?>[params.length];
             for (int i = 0; i < params.length; i++) {
-                paramTypes[i] = toClass(params[i].trim(), loader);
+                String param = params[i].trim();
+                if (param.isEmpty()) {
+                    throw new NoSuchMethodException("Bad method signature: " + method);
+                }
+                paramTypes[i] = toClass(param, loader);
             }
             meth = klass.getDeclaredMethod(methodName, paramTypes);
         }
diff --git a/api/src/test/java/jakarta/el/TestELProcessor.java b/api/src/test/java/jakarta/el/TestELProcessor.java
index bd3019a..0ea9f5c 100644
--- a/api/src/test/java/jakarta/el/TestELProcessor.java
+++ b/api/src/test/java/jakarta/el/TestELProcessor.java
@@ -25,7 +25,13 @@
 
     @BeforeAll
     public static void setup() {
-        // The API has no Jakarta Expression Language implementation available when running these tests
+        /*
+         * The API has no Jakarta Expression Language implementation available when running these tests.
+         *
+         * Note: This system property is JVM-global so it applies to every test that runs in the same JVM after this
+         * one, not just the tests in this class. That is acceptable for the limited API tests that currently exist but
+         * if a test ever needs a different ExpressionFactory, the tests will need to run in a fresh JVM per test.
+         */
         System.setProperty(ExpressionFactory.class.getName(), TesterExpressionFactory.class.getName());
     }
 
@@ -55,6 +61,27 @@
                 resolve(elp, "fn", "sum"));
     }
 
+    @Test
+    public void testDefineFunctionSignatureEmptyLeadingParameter() {
+        ELProcessor elp = new ELProcessor();
+        Assertions.assertThrows(NoSuchMethodException.class,
+                () -> elp.defineFunction("fn", "sum", TestELProcessor.class.getName(), "int sum(,int)"));
+    }
+
+    @Test
+    public void testDefineFunctionSignatureEmptyTrailingParameter() {
+        ELProcessor elp = new ELProcessor();
+        Assertions.assertThrows(NoSuchMethodException.class,
+                () -> elp.defineFunction("fn", "sum", TestELProcessor.class.getName(), "int sum(int,)"));
+    }
+
+    @Test
+    public void testDefineFunctionSignatureEmptyMiddleParameter() {
+        ELProcessor elp = new ELProcessor();
+        Assertions.assertThrows(NoSuchMethodException.class,
+                () -> elp.defineFunction("fn", "sum", TestELProcessor.class.getName(), "int sum(int, ,int)"));
+    }
+
     private static Method resolve(ELProcessor elp, String prefix, String function) {
         return elp.getELManager().getELContext().getFunctionMapper().resolveFunction(prefix, function);
     }