-
Bug
-
Resolution: Done
-
Major
-
1.1.8.Final
-
None
Test case:
@RequestScoped
public class TestVarargs {
public void varargsMethod(String... strings) {}
}
public class TestClass {
@Inject
TestVarargs testVarargs;
public void runTest()
{ testClass(testVarargs.getClass()); testClass(TestVarargs.class); } private void testClass(Class<?> clazz) {
for (Method m : clazz.getMethods()) {
if (m.getName().equals("varargsMethod"))
}
}
}
Prints:
class TestVarargs$Proxy$$$_WeldClientProxy : public void TestVarargs$Proxy$$$_WeldClientProxy.varargsMethod(java.lang.String[]) : false
class TestVarargs : public void TestVarargs.varargsMethod(java.lang.String[]) : true
The method generated in Weld proxy class is not a varargs method while the original one was. This breaks proper method lookup in tools that use reflection - in my case it was ZK EL resolver: for ${bean.method('String arg')} where signature is method(String...) there was proper code to handle a varargs call but only if the method was indeed declared as Method.isVarargs(), which was not the case when ${bean} was a Weld proxy.
- is cloned by
-
WELD-1797 Backport WELD-1141 to 1.1.x - Bean proxy class has non-varargs method for original varargs method
- Resolved