diff --git a/java/src/main/java/cucumber/runtime/java/Java8StepDefinition.java b/java/src/main/java/cucumber/runtime/java/Java8StepDefinition.java
index <HASH>..<HASH> 100644
--- a/java/src/main/java/cucumber/runtime/java/Java8StepDefinition.java
+++ b/java/src/main/java/cucumber/runtime/java/Java8StepDefinition.java
@@ -65,7 +65,7 @@ public class Java8StepDefinition implements StepDefinition {
 
     @Override
     public Integer getParameterCount() {
-        return pattern.matcher("").groupCount();
+        return parameterInfos.size();
     }
 
     @Override
Update Java8StepDefinition.java

I have Arity mismatch error when using Java8 step definitions.

Looking at class Java8StepDefinition, I saw that could be solved by returning parameterCounter like JavaStepDefinition actually does. Simple:  return parameterInfos.size();