eclipse-ee4j / eclipse-ee4j/expressly

Varargs: jakarta.el.MethodNotFoundException

Open
#3 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
15
Forks
10
PR merge metrics
No merged PRs in 30d

Description

I encountered the following exception when testing the code below on Wildfly 24."

Tomcat had updated their varargs handling in [BZ 65358](https://bz.apache.org/bugzilla/show_bug.cgi?id=65358#c9), and I'm wondering if this API could have something similar applied?

However, I understand this might also be due to vagueness in the spec? Enum could be coerce to a string? I appreciate any assistance. Thanks!

```java
Caused by: javax.el.MethodNotFoundException: Unable to find unambiguous method: class com.test.TestBean.testMethod(com.test.Level, com.test.Level, com.test.Level)
at javax.el.ELUtil.findMostSpecificWrapper(ELUtil.java:407)
at javax.el.ELUtil.findWrapper(ELUtil.java:376)
at javax.el.ELUtil.findMethod(ELUtil.java:271)
at javax.el.ELUtil.findMethod(ELUtil.java:230)
at javax.el.BeanELResolver.invoke(BeanELResolver.java:327)
at org.apache.jasper.el.JasperELResolver.invoke(JasperELResolver.java:147)

```

```java
public enum Level {
LOW (1);

private final int levelCode;

private Level(int levelCode) {
this.levelCode = levelCode;
}
}
```

```java
public class TestBean {

public Level getLevel() {
return Level.LOW;
}

public String testMethod(Level level1, Level... level2) {
return "(Level level1, Level... level2)";
}

public String testMethod(String param1, Level... level2) {
return "(String param1, Level... level2)";
}
}
```

EL Expression:
`${testBean.testMethod(testBean.getLevel(), testBean.getLevel(), testBean.getLevel())}`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.