[weld-issues] [JBoss JIRA] (WELD-1141) Bean proxy class has non-varargs method for original varargs method
Adam Michalik (JIRA)
jira-events at lists.jboss.org
Thu May 24 07:07:17 EDT 2012
[ https://issues.jboss.org/browse/WELD-1141?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Adam Michalik updated WELD-1141:
--------------------------------
Component/s: Proxies
Reflection layer
> 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
>
> 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