[weld-issues] [JBoss JIRA] (WELD-1141) Bean proxy class has non-varargs method for original varargs method
Ales Justin (JIRA)
jira-events at lists.jboss.org
Fri Jun 1 11:23:18 EDT 2012
[ https://issues.jboss.org/browse/WELD-1141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ales Justin resolved WELD-1141.
-------------------------------
Fix Version/s: 1.1.9.Final
Resolution: Done
> Bean proxy class has non-varargs method for original varargs method
> -------------------------------------------------------------------
>
> Key: WELD-1141
> URL: https://issues.jboss.org/browse/WELD-1141
> Project: Weld
> Issue Type: Bug
> Components: Proxies, Reflection layer
> Affects Versions: 1.1.8.Final
> Reporter: Adam Michalik
> Assignee: Ales Justin
> Fix For: 1.1.9.Final
>
>
> 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")) {
> System.out.println(clazz + " : " + m + " : " + m.isVarArgs());
> }
> }
> }
> }
> 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.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the weld-issues
mailing list