[Kde-java] branches/KDE/3.5/kdebindings/qtjava/javalib/org/kde/qt

Richard Dale Richard_Dale at tipitina.demon.co.uk
Thu Oct 6 13:44:13 CEST 2005


SVN commit 467777 by rdale:

* Oops, the last commit solved the wrong problem. Instead of 
  two nested exception handlers, which would get both 
  protected and public methods, but not inherited ones.
  A loop is needed to look for inherited event methods, going
  up the class heirarchy.

CCBUGS: 112409
CCMAIL: kde-java at kde.org



 M  +8 -7      Invocation.java  


--- branches/KDE/3.5/kdebindings/qtjava/javalib/org/kde/qt/Invocation.java #467776:467777
@@ -440,18 +440,19 @@
 		Class[] parameterType = new Class[1];
 		parameterType[0] = Class.forName(qtjava.toFullyQualifiedClassName(argClass));
 		Object onThis = qtjava.objectForQtKey(target, "org.kde.qt.QObject", false);
+
+		Class targetClass = onThis.getClass();
 		
-		try {
-			method = onThis.getClass().getMethod(methodName, parameterType);
-			method.setAccessible(true);
-		} catch (NoSuchMethodException e1) {
+		do {
 			try {
-				method = onThis.getClass().getDeclaredMethod(methodName, parameterType);
+				method = targetClass.getDeclaredMethod(methodName, parameterType);
 				method.setAccessible(true);
-			} catch (NoSuchMethodException e2) {
+			} catch (NoSuchMethodException e1) {
 				return true;
 			}
-		}
+			
+			targetClass = targetClass.getSuperclass();
+		} while (targetClass != null);
 
 		// Ignore any native code event handling methods
 		if ((method.getModifiers() & Modifier.NATIVE) != 0) {


More information about the Kde-java mailing list