[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:35:46 CEST 2005


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 at 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-java mailing list