Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7F70D67F1 for ; Mon, 13 Jun 2011 17:11:16 +0000 (UTC) Received: (qmail 3428 invoked by uid 500); 13 Jun 2011 17:11:16 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 3360 invoked by uid 500); 13 Jun 2011 17:11:16 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 3344 invoked by uid 99); 13 Jun 2011 17:11:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jun 2011 17:11:16 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jun 2011 17:11:13 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 284E5417B8F for ; Mon, 13 Jun 2011 17:10:52 +0000 (UTC) Date: Mon, 13 Jun 2011 17:10:52 +0000 (UTC) From: "Travis Schneeberger (JIRA)" To: issues@commons.apache.org Message-ID: <722826708.3132.1307985052161.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (BEANUTILS-340) Property with getter from generic interface returns wrong readMethod/propertyType on Linux environment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/BEANUTILS-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13048659#comment-13048659 ] Travis Schneeberger commented on BEANUTILS-340: ----------------------------------------------- BTW. I see that this jira is marked "LATER THAN 1.8.4". Since there is a working patch (which includes unit tests) could we get this included in the 1.8.4 release? > Property with getter from generic interface returns wrong readMethod/propertyType on Linux environment > ------------------------------------------------------------------------------------------------------ > > Key: BEANUTILS-340 > URL: https://issues.apache.org/jira/browse/BEANUTILS-340 > Project: Commons BeanUtils > Issue Type: Bug > Components: Bean / Property Utils > Affects Versions: 1.8.0-BETA > Environment: ==Works correctly in== > Windows XP > java version "1.5.0_12" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04) > Java HotSpot(TM) Client VM (build 1.5.0_12-b04, mixed mode) > ==Fails in== > Linux 2.6.27-gentoo-r8 #6 SMP Thu Feb 5 19:18:16 MST 2009 i686 06/17 GenuineIntel GNU/Linux > java version "1.5.0_17" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_17-b04) > Java HotSpot(TM) Server VM (build 1.5.0_17-b04, mixed mode) > Reporter: Dave Lindquist > Priority: Minor > Fix For: LATER THAN 1.8.4 > > Attachments: jira_340.patch, jira_340_new.patch > > > PropertyUtils.getPropertyDescriptors is returning the wrong readMethod (and thus the wrong property type) when a method is implemented from a genericized interface, but only on some environments. This seems to work on Windows, but fails on Linux. (Compile environment does not matter, runtime environment does seem to matter.) > Take the following test class: > {code} > public class Testing > { > public static void main(String[] args) throws Exception > { > for(PropertyDescriptor desc : PropertyUtils.getPropertyDescriptors(Test2.class)) > { > if(desc.getName().equals("something")) > { > System.out.println(desc.getName() + "\t" + desc.getPropertyType() + "\t" + desc.getReadMethod() + "\t" + desc.getReadMethod().isSynthetic() + "\t" + desc.getReadMethod().isBridge()); > } > } > } > > // An interface with generics, and with getter and setter defined 'generically'. > public static interface Test > { > public T getSomething(); > > public void setSomething(T something); > } > > // A concrete class using a specific genericization of the interface (Long), with getter and setter implemented appropriately. > public static class Test2 implements Test > { > public Long getSomething() > { > return(null); > } > > public void setSomething(Long something) > { > > } > } > } > {code} > When run on Windows XP, and working correctly, this prints: > something class java.lang.Long public java.lang.Long Testing$Test2.getSomething() false false > indicating that it got the 'long' version of the method, and that this method is NOT synthetic or a bridge method. > However, when run on Linux, this prints: > something class java.lang.Number public volatile java.lang.Number Testing$Test2.getSomething() true true > which is the signature from the interface, and is marked with both synthetic and bridge, indicating that this is not the 'real' method, but the compiler-created method due to generics. > I think that it should be ignoring the 'synthetic/bridge' method auto-created by the compiler, but I'm not sure why it is environment-dependent. Perhaps the environment somehow controls the method definition order? (At runtime, not compile time, obviously.) -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira