[Kde-bindings] [Bug 112409] overloading qt event handling methods in Java subclasses fails

Richard Dale Richard_Dale at tipitina.demon.co.uk
Thu Oct 6 11:44:52 UTC 2005


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=112409         




------- Additional Comments From Richard_Dale tipitina demon co uk  2005-10-06 13:44 -------
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 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-bindings mailing list