[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: bean introspector fixes

Kaffe CVS cvs-commits at kaffe.org
Mon Nov 8 02:17:30 PST 2004


PatchSet 5421 
Date: 2004/11/08 10:13:12
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: bean introspector fixes

2004-11-07  Robert Schuster <thebohemian at gmx.net>

        Fixed regression:
        * gnu/java/beans/IntrospectionIncubator.java:
        (addMethod): corrected classification of normal and property methods
        (capitalize): added documentation
        (DoubleKey): [class] added documentation

2004-11-07  Dalibor Topic  <robilad at kaffe.org>

        * libraries/javalib/gnu/java/beans/IntrospectionIncubator.java:
        Resynced with GNU Classpath.

        2004-11-06  Robert Schuster  <theBohemian at gmx.net>

        Fixes bug #10908
        * gnu/java/beans/IntrospectionIncubator.java:
        (addMethod): static methods are discarded now, too.

Members: 
	ChangeLog:1.2970->1.2971 
	libraries/javalib/gnu/java/beans/IntrospectionIncubator.java:1.4->1.5 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2970 kaffe/ChangeLog:1.2971
--- kaffe/ChangeLog:1.2970	Sun Nov  7 21:28:00 2004
+++ kaffe/ChangeLog	Mon Nov  8 10:13:12 2004
@@ -1,3 +1,22 @@
+2004-11-07  Robert Schuster <thebohemian at gmx.net>
+
+	Fixed regression:
+	* gnu/java/beans/IntrospectionIncubator.java:
+	(addMethod): corrected classification of normal and property methods
+	(capitalize): added documentation
+	(DoubleKey): [class] added documentation
+
+2004-11-07  Dalibor Topic  <robilad at kaffe.org>
+
+	* libraries/javalib/gnu/java/beans/IntrospectionIncubator.java:
+	Resynced with GNU Classpath.
+
+	2004-11-06  Robert Schuster  <theBohemian at gmx.net>
+
+        Fixes bug #10908
+        * gnu/java/beans/IntrospectionIncubator.java:
+        (addMethod): static methods are discarded now, too.
+
 2004-11-07  Dalibor Topic  <robilad at kaffe.org>
 
 	*  libraries/javalib/java/awt/image/ConvolveOp.java:
Index: kaffe/libraries/javalib/gnu/java/beans/IntrospectionIncubator.java
diff -u kaffe/libraries/javalib/gnu/java/beans/IntrospectionIncubator.java:1.4 kaffe/libraries/javalib/gnu/java/beans/IntrospectionIncubator.java:1.5
--- kaffe/libraries/javalib/gnu/java/beans/IntrospectionIncubator.java:1.4	Mon Mar 22 11:24:10 2004
+++ kaffe/libraries/javalib/gnu/java/beans/IntrospectionIncubator.java	Mon Nov  8 10:13:14 2004
@@ -1,5 +1,5 @@
 /* gnu.java.beans.IntrospectionIncubator
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -57,10 +57,14 @@
 
 /**
  ** IntrospectionIncubator takes in a bunch of Methods, and
- ** Introspects only those Methods you give it.
+ ** Introspects only those Methods you give it. 
+ ** 
+ ** Non-public are silently discarded but it allows static method
+ ** because they are valid in <code>MethodDescriptor</code>
+ ** instances.
  **
  ** @author John Keiser
- ** @version 1.1.0, 30 Jul 1998
+ ** @author Robert Schuster
  ** @see gnu.java.beans.ExplicitBeanInfo
  ** @see java.beans.BeanInfo
  **/
@@ -86,7 +90,14 @@
 			boolean isVoid = retType.equals(java.lang.Void.TYPE);
 			Class methodClass = method.getDeclaringClass();
 			if(propertyStopClass == null || (propertyStopClass.isAssignableFrom(methodClass) && !propertyStopClass.equals(methodClass))) {
-				if(name.startsWith("is")
+				/* At this point a method may be regarded as a property's read or write method if its name
+				 * starts with "is", "get" or "set". However, if a method is static it cannot be part
+				 * of a property.
+				 */
+				if(Modifier.isStatic(method.getModifiers())) {
+					// files method as other because it is static
+					otherMethods.addElement(method);
+				} else if(name.startsWith("is")
 				   && retType.equals(java.lang.Boolean.TYPE)
 				   && params.length == 0) {
 					addToPropertyHash(name,method,IS);
@@ -290,7 +301,6 @@
 		methods[funcType] = method;
 	}
 
-
 	void addToListenerHash(String name, Method method, int funcType) {
 		String newName;
 		Class type;
@@ -318,6 +328,16 @@
 		methods[funcType] = method;
 	}
 
+	/** Transforms a part of a method name into its corresponding
+	 * property name. E.g. "Value" becomes "value".
+	 * 
+	 * Implementation notes:
+	 * If "" is the argument, it is returned without changes.
+	 * If <code>null</code> is the argument, <code>null</code> is returned.
+	 * 
+	 * @param name Part of a method name.
+	 * @return Corresponding property name.
+	 */
 	static String capitalize(String name) {
 		try {
 			if(Character.isUpperCase(name.charAt(0))) {
@@ -335,6 +355,14 @@
 	}
 }
 
+/** This class is a hashmap key that consists of a <code>Class</code> and a
+ * <code>String</code> element.
+ * 
+ * It is used to combine a property's or event's type with its name.
+ * 
+ * @author John Keiser
+ * @author Robert Schuster
+ */ 
 class DoubleKey {
 	Class type;
 	String name;




More information about the kaffe mailing list