[Mulgara-svn] r1523 - trunk/src/jar/util/java/org/mulgara/util
alexhall at mulgara.org
alexhall at mulgara.org
Wed Feb 18 20:10:32 UTC 2009
Author: alexhall
Date: 2009-02-18 12:10:30 -0800 (Wed, 18 Feb 2009)
New Revision: 1523
Modified:
trunk/src/jar/util/java/org/mulgara/util/Reflect.java
Log:
Fixed a bug where a constructor with the wrong number of arguments may be returned by the findConstructor method.
Modified: trunk/src/jar/util/java/org/mulgara/util/Reflect.java
===================================================================
--- trunk/src/jar/util/java/org/mulgara/util/Reflect.java 2009-02-17 22:46:59 UTC (rev 1522)
+++ trunk/src/jar/util/java/org/mulgara/util/Reflect.java 2009-02-18 20:10:30 UTC (rev 1523)
@@ -95,6 +95,11 @@
for (Constructor<T> con: (Constructor<T>[])clazz.getConstructors()) {
boolean match = true;
Class<?>[] paramTypes = con.getParameterTypes();
+
+ // Make sure the candidate constructor has the appropriate number of arguments.
+ if (paramTypes.length != argTypes.length) continue;
+
+ // If the argument count matches, test the argument classes one-by-one.
for (int p = 0; p < paramTypes.length; p++) {
if (match && !assignFrom.test(paramTypes[p], argTypes[p])) {
match = false;
More information about the Mulgara-svn
mailing list