[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:36:30 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:36 -------
SVN commit 467774 by rdale:

* This check via reflection to tell if an event method had been
  overriden was insufficiently herioc - I just love those java
  apis ;). This should fix the bug reported by Jochen Becher

CCBUGS: 112409
CCMAIL: kde-java kde org



 M  +8 -4      Invocation.java  


--- branches/KDE/3.5/kdebindings/qtjava/javalib/org/kde/qt/Invocation.java #467773:467774
 @ -442,11 +442,15  @
 		Object onThis = qtjava.objectForQtKey(target, "org.kde.qt.QObject", false);
 		
 		try {
-			// Assume that an event handler is a protected method, so use getDeclaredMethod()
-			method = onThis.getClass().getDeclaredMethod(methodName, parameterType);
+			method = onThis.getClass().getMethod(methodName, parameterType);
 			method.setAccessible(true);
-		} catch (NoSuchMethodException e) {
-			return false;
+		} catch (NoSuchMethodException e1) {
+			try {
+				method = onThis.getClass().getDeclaredMethod(methodName, parameterType);
+				method.setAccessible(true);
+			} catch (NoSuchMethodException e2) {
+				return true;
+			}
 		}
 
 		// Ignore any native code event handling methods



More information about the Kde-bindings mailing list