harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r583834 - in /harmony/enhanced/classlib/trunk/modules/beans/src: main/java/java/beans/StandardBeanInfo.java test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java
Date Thu, 11 Oct 2007 14:29:40 GMT
Author: tellison
Date: Thu Oct 11 07:29:39 2007
New Revision: 583834

URL: http://svn.apache.org/viewvc?rev=583834&view=rev
Log:
Fix for HARMONY-4892 ([classlib][beans] Bean introspection should not find static methods)

Modified:
    harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/StandardBeanInfo.java
    harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/StandardBeanInfo.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/StandardBeanInfo.java?rev=583834&r1=583833&r2=583834&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/StandardBeanInfo.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/StandardBeanInfo.java
Thu Oct 11 07:29:39 2007
@@ -507,10 +507,10 @@
         ArrayList<MethodDescriptor> methodList = new ArrayList<MethodDescriptor>(
                 basicMethods.length);
 
-        // Loop over the methods found, looking for public methods
+        // Loop over the methods found, looking for public non-static methods
         for (int i = 0; i < basicMethods.length; i++) {
             int modifiers = basicMethods[i].getModifiers();
-            if (Modifier.isPublic(modifiers)) {
+            if (Modifier.isPublic(modifiers) && !Modifier.isStatic(modifiers)) {
                 // Allocate a MethodDescriptor for this method
                 MethodDescriptor theDescriptor = new MethodDescriptor(
                         basicMethods[i]);

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java?rev=583834&r1=583833&r2=583834&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java
Thu Oct 11 07:29:39 2007
@@ -2302,4 +2302,33 @@
         }
 
     }
+
+    /*
+     * Regression test for HARMONY-4892
+     */
+    public static class MyBean {
+
+        public static String invisble;
+
+        public static String getInvisible() {
+            return invisble;
+        }
+
+        public String visible;
+
+        public String getVisible() {
+            return visible;
+        }
+
+        public void setVisible(String a) {
+            this.visible = a;
+        }
+    }
+
+    public void testPropertyDescriptors() throws IntrospectionException {
+        BeanInfo info = Introspector.getBeanInfo(MyBean.class);
+        for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
+            assertFalse(pd.getName().equals("invisible"));
+        }
+    }
 }



Mime
View raw message